From 06cc318dc4fde9a9fce212f316c765155219435a Mon Sep 17 00:00:00 2001 From: Rex Date: Wed, 11 Dec 2024 14:34:33 +0800 Subject: [PATCH] Fix hit-area bug --- dist/rexbbcodetext.js | 56 ++++++++++++++----- dist/rexbbcodetext.min.js | 2 +- dist/rexbbcodetextplugin.js | 56 ++++++++++++++----- dist/rexbbcodetextplugin.min.js | 2 +- dist/rexcolorcomponents.js | 56 ++++++++++++++----- dist/rexcolorcomponents.min.js | 2 +- dist/rexcolorinput.js | 56 ++++++++++++++----- dist/rexcolorinput.min.js | 2 +- dist/rexconfirmdialog.js | 56 ++++++++++++++----- dist/rexconfirmdialog.min.js | 2 +- dist/rexgameobjectshellplugin.js | 56 ++++++++++++++----- dist/rexgameobjectshellplugin.min.js | 4 +- dist/rexmdscenario.js | 56 ++++++++++++++----- dist/rexmdscenario.min.js | 2 +- dist/rexmdscenarioplugin.js | 56 ++++++++++++++----- dist/rexmdscenarioplugin.min.js | 2 +- dist/rexnameinputdialog.js | 56 ++++++++++++++----- dist/rexnameinputdialog.min.js | 2 +- dist/rexsimpledropdownlist.js | 56 ++++++++++++++----- dist/rexsimpledropdownlist.min.js | 2 +- dist/rexsimplelabel.js | 56 ++++++++++++++----- dist/rexsimplelabel.min.js | 2 +- dist/rextagtext.js | 56 ++++++++++++++----- dist/rextagtext.min.js | 2 +- dist/rextagtextplugin.js | 56 ++++++++++++++----- dist/rextagtextplugin.min.js | 2 +- dist/rextrees.js | 56 ++++++++++++++----- dist/rextrees.min.js | 2 +- dist/rextweaker.js | 56 ++++++++++++++----- dist/rextweaker.min.js | 4 +- dist/rexuiplugin.js | 56 ++++++++++++++----- dist/rexuiplugin.min.js | 4 +- examples/bbcodetext/hitarea.js | 10 ++++ .../textbase/canvastext/SetInteractive.js | 51 +++++++++++++---- .../textbase/hitareamanager/HitAreaManager.js | 7 ++- 35 files changed, 761 insertions(+), 241 deletions(-) diff --git a/dist/rexbbcodetext.js b/dist/rexbbcodetext.js index c864cb8eb4..356e8f1971 100644 --- a/dist/rexbbcodetext.js +++ b/dist/rexbbcodetext.js @@ -2284,13 +2284,17 @@ clear() { // Reuse hitArea(rectangle) later for (var i = 0, cnt = this.hitAreas.length; i < cnt; i++) { - Clear(this.hitAreas[i].data); + this.hitAreas[i].data = null; } RectanglePool.pushMultiple(this.hitAreas); return this; } add(x, y, width, height, data) { + if (data === undefined) { + data = {}; + } + var rectangle = RectanglePool.pop(); if (rectangle === null) { rectangle = new Rectangle(x, y, width, height); @@ -2375,6 +2379,11 @@ var key = area.data.key; FireEvent.call(this, 'areadown', key, pointer, localX, localY, event); + // Removed by callback of previous event + if (!area.data) { + return; + } + area.data.isDown = true; }; @@ -2384,21 +2393,29 @@ return; } - var areaData = area.data; - - var key = areaData.key; + var key = area.data.key; FireEvent.call(this, 'areaup', key, pointer, localX, localY, event); - if (areaData.isDown) { + // Removed by callback of previous event + if (!area.data) { + return; + } + + if (area.data.isDown) { FireEvent.call(this, 'areaclick', key, pointer, localX, localY, event); - var url = areaData.url; + // Removed by callback of previous event + if (!area.data) { + return; + } + + var url = area.data.url; if (url) { window.open(url, '_blank'); } } - areaData.isDown = false; + area.data.isDown = false; }; var OnAreaOverOut = function (pointer, localX, localY, event) { @@ -2421,17 +2438,22 @@ FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event); var prevHitArea = this.hitAreaManager.getByKey(this.lastHitAreaKey); - if (this.urlTagCursorStyle && !!prevHitArea.data.url) { - this.scene.input.manager.canvas.style.cursor = ''; - } - prevHitArea.isDown = false; + if (prevHitArea) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, prevHitArea, ''); + } + + prevHitArea.isDown = false; + } } if (key !== null) { FireEvent.call(this, 'areaover', key, pointer, localX, localY, event); - if (this.urlTagCursorStyle && !!area.data.url) { - this.scene.input.manager.canvas.style.cursor = this.urlTagCursorStyle; + if (area.data) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, area, this.urlTagCursorStyle); + } } } @@ -2443,6 +2465,14 @@ this.parent.emit(eventName, key, pointer, localX, localY, event); }; + var SetCursorStyle = function (scene, area, cursorStyle) { + if (!area || !area.data || !area.data.url) { + return; + } + + scene.input.manager.canvas.style.cursor = cursorStyle; + }; + var RE_ASCII = /^[\x00-\x7F]+$/; var IsASCIIString = function (s) { return RE_ASCII.test(s); diff --git a/dist/rexbbcodetext.min.js b/dist/rexbbcodetext.min.js index 567ee1d2b1..d37229c305 100644 --- a/dist/rexbbcodetext.min.js +++ b/dist/rexbbcodetext.min.js @@ -4,4 +4,4 @@ var t,e;t=void 0,e=function(){var t=Phaser.Renderer.WebGL.Utils,e={renderWebGL:f * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -const u=Phaser.Display.Canvas.CanvasPool;var d=function(t){var e=u.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return u.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,u.remove(e),a;var d,g,c=i.getImageData(0,0,h,l).data,p=c.length,f=4*h,v=0,x=!1;for(d=0;do;d--){for(g=0;g0&&this.wrapMode!==f&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=w[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var l=a[h],u=l[0],g=i?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=S(t,u,g);else{var p=E(t,u,g);c&&(p=c(p)),this[h]=p}}var f=S(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=S(t,"fill",null);null!==v&&(this.color=o(v));var x=S(t,"metrics",!1);return x?this.metrics={ascent:S(x,"ascent",0),descent:S(x,"descent",0),fontSize:S(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=d(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=S(t,"fontFamily","Courier"),this.fontSize=S(t,"fontSize","16px"),this.fontStyle=S(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=o(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=o(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=w[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=S(e,"fontFamily",this.fontFamily),this.fontSize=S(e,"fontSize",this.fontSize),this.fontStyle=S(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}const T=Phaser.Utils.Objects.GetValue;class R{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=T(t,"x",0),i=T(t,"y",0));var s=this.cornerRadius;s.tl=m(T(t,"tl",void 0),e,i),s.tr=m(T(t,"tr",void 0),e,i),s.bl=m(T(t,"bl",void 0),e,i),s.br=m(T(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){k(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){k(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){k(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){k(this.cornerRadius.br,t)}}var m=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),_(t),t},k=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=T(e,"x",0),t.y=T(e,"y",0)),_(t)},_=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const P=Phaser.Math.DegToRad;var C=function(t){return!t.hasOwnProperty("convex")||t.convex},b=function(t){return t.x>0&&t.y>0},L=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:s/c,v=r>=p?1:r/p,x=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=x.tl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,l,o,l,180,270,!1,a):L(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,l,o,l,270,360,!1,a):L(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,r-l,o,l,0,90,!1,a):L(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,r-l,o,l,90,180,!1,a):L(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,i,s,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},A={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),M(t.canvas,t.context,u,u,o,l,r,e,i,s,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,x=v.length,y=a.maxLines;y>0&&x>y?(o=y,l="center"===p?Math.floor((x-o)/2):"bottom"===p?x-o:0):(o=x,l=0),u=l+o;var w=this.rtl,E=w?this.parent.width:void 0;g="center"===p?Math.max((s-o*f)/2,0):"bottom"===p?Math.max(s-o*f-2,0):0,g+=e;for(var S=l;S0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(u=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const F=Phaser.Utils.Objects.GetValue,I=g,N=c;class W{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=F(t,"text",""),this.x=F(t,"x",0),this.y=F(t,"y",0),this.width=F(t,"width",0);var e=F(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=F(t,"newLineMode",0),this.startIndex=F(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===N&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===N&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var H=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},$=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:H(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var X={};class Y{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const j=Phaser.Geom.Rectangle;var K=new Y;class V{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&dt(f)){""!==w?a.push(n.getLine(w,E,rt)):0===S&&r>0&&a.push(n.getLine("",0,rt)),a.push(...lt(f,e,ht,s,0,n));var T=a.pop();w=T.text,E=T.width,n.freeLine(T)," "===w&&(w="",E=0)}else(x=E+v)>o?(a.push(n.getLine(w,E,rt)),w=f,E=v,o=s):(w+=f,E=x),S===O-1&&a.push(n.getLine(w,E,l))}return a},ut=function(t,e){var i;switch(e){case at:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==ct&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new U({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;no;d--){for(g=0;g0&&this.wrapMode!==f&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=w[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var l=a[h],u=l[0],g=i?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=S(t,u,g);else{var p=E(t,u,g);c&&(p=c(p)),this[h]=p}}var f=S(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=S(t,"fill",null);null!==v&&(this.color=o(v));var x=S(t,"metrics",!1);return x?this.metrics={ascent:S(x,"ascent",0),descent:S(x,"descent",0),fontSize:S(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=d(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=S(t,"fontFamily","Courier"),this.fontSize=S(t,"fontSize","16px"),this.fontStyle=S(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=o(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=o(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=w[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=S(e,"fontFamily",this.fontFamily),this.fontSize=S(e,"fontSize",this.fontSize),this.fontStyle=S(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}const T=Phaser.Utils.Objects.GetValue;class R{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=T(t,"x",0),i=T(t,"y",0));var s=this.cornerRadius;s.tl=m(T(t,"tl",void 0),e,i),s.tr=m(T(t,"tr",void 0),e,i),s.bl=m(T(t,"bl",void 0),e,i),s.br=m(T(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){k(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){k(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){k(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){k(this.cornerRadius.br,t)}}var m=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),_(t),t},k=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=T(e,"x",0),t.y=T(e,"y",0)),_(t)},_=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const P=Phaser.Math.DegToRad;var C=function(t){return!t.hasOwnProperty("convex")||t.convex},b=function(t){return t.x>0&&t.y>0},L=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:s/c,v=r>=p?1:r/p,x=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=x.tl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,l,o,l,180,270,!1,a):L(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,l,o,l,270,360,!1,a):L(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,r-l,o,l,0,90,!1,a):L(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,r-l,o,l,90,180,!1,a):L(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,i,s,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},A={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),M(t.canvas,t.context,u,u,o,l,r,e,i,s,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,x=v.length,y=a.maxLines;y>0&&x>y?(o=y,l="center"===p?Math.floor((x-o)/2):"bottom"===p?x-o:0):(o=x,l=0),u=l+o;var w=this.rtl,E=w?this.parent.width:void 0;g="center"===p?Math.max((s-o*f)/2,0):"bottom"===p?Math.max(s-o*f-2,0):0,g+=e;for(var S=l;S0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(u=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const F=Phaser.Utils.Objects.GetValue,I=g,N=c;class W{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=F(t,"text",""),this.x=F(t,"x",0),this.y=F(t,"y",0),this.width=F(t,"width",0);var e=F(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=F(t,"newLineMode",0),this.startIndex=F(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===N&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===N&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var H=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var U={};class X{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Y=Phaser.Geom.Rectangle;var j=new X;class K{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&dt(f)){""!==w?a.push(n.getLine(w,E,rt)):0===S&&r>0&&a.push(n.getLine("",0,rt)),a.push(...lt(f,e,ht,s,0,n));var T=a.pop();w=T.text,E=T.width,n.freeLine(T)," "===w&&(w="",E=0)}else(x=E+v)>o?(a.push(n.getLine(w,E,rt)),w=f,E=v,o=s):(w+=f,E=x),S===O-1&&a.push(n.getLine(w,E,l))}return a},ut=function(t,e){var i;switch(e){case at:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==ct&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new D({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;no;d--){for(g=0;g0&&this.wrapMode!==f&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=w[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var l=a[h],u=l[0],g=i?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=S(t,u,g);else{var p=E(t,u,g);c&&(p=c(p)),this[h]=p}}var f=S(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=S(t,"fill",null);null!==v&&(this.color=o(v));var x=S(t,"metrics",!1);return x?this.metrics={ascent:S(x,"ascent",0),descent:S(x,"descent",0),fontSize:S(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=d(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=S(t,"fontFamily","Courier"),this.fontSize=S(t,"fontSize","16px"),this.fontStyle=S(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=o(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=o(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=w[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=S(e,"fontFamily",this.fontFamily),this.fontSize=S(e,"fontSize",this.fontSize),this.fontStyle=S(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}const T=Phaser.Utils.Objects.GetValue;class R{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=T(t,"x",0),i=T(t,"y",0));var s=this.cornerRadius;s.tl=m(T(t,"tl",void 0),e,i),s.tr=m(T(t,"tr",void 0),e,i),s.bl=m(T(t,"bl",void 0),e,i),s.br=m(T(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){k(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){k(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){k(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){k(this.cornerRadius.br,t)}}var m=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),_(t),t},k=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=T(e,"x",0),t.y=T(e,"y",0)),_(t)},_=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const P=Phaser.Math.DegToRad;var C=function(t){return!t.hasOwnProperty("convex")||t.convex},b=function(t){return t.x>0&&t.y>0},L=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:s/c,v=r>=p?1:r/p,x=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=x.tl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,l,o,l,180,270,!1,a):L(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,l,o,l,270,360,!1,a):L(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,r-l,o,l,0,90,!1,a):L(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,r-l,o,l,90,180,!1,a):L(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,i,s,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},A={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),M(t.canvas,t.context,u,u,o,l,r,e,i,s,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,x=v.length,y=a.maxLines;y>0&&x>y?(o=y,l="center"===p?Math.floor((x-o)/2):"bottom"===p?x-o:0):(o=x,l=0),u=l+o;var w=this.rtl,E=w?this.parent.width:void 0;g="center"===p?Math.max((s-o*f)/2,0):"bottom"===p?Math.max(s-o*f-2,0):0,g+=e;for(var S=l;S0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(u=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const F=Phaser.Utils.Objects.GetValue,I=g,N=c;class W{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=F(t,"text",""),this.x=F(t,"x",0),this.y=F(t,"y",0),this.width=F(t,"width",0);var e=F(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=F(t,"newLineMode",0),this.startIndex=F(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===N&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===N&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var H=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},B=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:H(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var j={};class X{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const Y=Phaser.Geom.Rectangle;var K=new X;class V{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&dt(f)){""!==w?a.push(n.getLine(w,E,rt)):0===S&&r>0&&a.push(n.getLine("",0,rt)),a.push(...lt(f,e,ht,s,0,n));var T=a.pop();w=T.text,E=T.width,n.freeLine(T)," "===w&&(w="",E=0)}else(x=E+v)>o?(a.push(n.getLine(w,E,rt)),w=f,E=v,o=s):(w+=f,E=x),S===O-1&&a.push(n.getLine(w,E,l))}return a},ut=function(t,e){var i;switch(e){case at:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==ct&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new U({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;no;d--){for(g=0;g0&&this.wrapMode!==f&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=w[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var l=a[h],u=l[0],g=i?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=S(t,u,g);else{var p=E(t,u,g);c&&(p=c(p)),this[h]=p}}var f=S(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=S(t,"fill",null);null!==v&&(this.color=o(v));var x=S(t,"metrics",!1);return x?this.metrics={ascent:S(x,"ascent",0),descent:S(x,"descent",0),fontSize:S(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=d(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=S(t,"fontFamily","Courier"),this.fontSize=S(t,"fontSize","16px"),this.fontStyle=S(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=o(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=o(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=w[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=S(e,"fontFamily",this.fontFamily),this.fontSize=S(e,"fontSize",this.fontSize),this.fontStyle=S(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}const T=Phaser.Utils.Objects.GetValue;class R{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=T(t,"x",0),i=T(t,"y",0));var s=this.cornerRadius;s.tl=m(T(t,"tl",void 0),e,i),s.tr=m(T(t,"tr",void 0),e,i),s.bl=m(T(t,"bl",void 0),e,i),s.br=m(T(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){k(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){k(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){k(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){k(this.cornerRadius.br,t)}}var m=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),_(t),t},k=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=T(e,"x",0),t.y=T(e,"y",0)),_(t)},_=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const P=Phaser.Math.DegToRad;var C=function(t){return!t.hasOwnProperty("convex")||t.convex},b=function(t){return t.x>0&&t.y>0},L=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:s/c,v=r>=p?1:r/p,x=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=x.tl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,l,o,l,180,270,!1,a):L(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,l,o,l,270,360,!1,a):L(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,r-l,o,l,0,90,!1,a):L(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,r-l,o,l,90,180,!1,a):L(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,i,s,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},A={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),M(t.canvas,t.context,u,u,o,l,r,e,i,s,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,x=v.length,y=a.maxLines;y>0&&x>y?(o=y,l="center"===p?Math.floor((x-o)/2):"bottom"===p?x-o:0):(o=x,l=0),u=l+o;var w=this.rtl,E=w?this.parent.width:void 0;g="center"===p?Math.max((s-o*f)/2,0):"bottom"===p?Math.max(s-o*f-2,0):0,g+=e;for(var S=l;S0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(u=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const F=Phaser.Utils.Objects.GetValue,I=g,N=c;class W{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=F(t,"text",""),this.x=F(t,"x",0),this.y=F(t,"y",0),this.width=F(t,"width",0);var e=F(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=F(t,"newLineMode",0),this.startIndex=F(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===N&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===N&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var H=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var U={};class j{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const X=Phaser.Geom.Rectangle;var Y=new j;class K{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&dt(f)){""!==w?a.push(n.getLine(w,E,rt)):0===S&&r>0&&a.push(n.getLine("",0,rt)),a.push(...lt(f,e,ht,s,0,n));var T=a.pop();w=T.text,E=T.width,n.freeLine(T)," "===w&&(w="",E=0)}else(x=E+v)>o?(a.push(n.getLine(w,E,rt)),w=f,E=v,o=s):(w+=f,E=x),S===O-1&&a.push(n.getLine(w,E,l))}return a},ut=function(t,e){var i;switch(e){case at:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==ct&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new D({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Ac=Phaser.Display.Canvas.CanvasPool;var Yc=function(t){var e=Ac.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Ac.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Ac.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Qh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=sa[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Wc(t,l,d);else{var u=Xc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Wc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Wc(t,"fill",null);null!==v&&(this.color=za(v));var g=Wc(t,"metrics",!1);return g?this.metrics={ascent:Wc(g,"ascent",0),descent:Wc(g,"descent",0),fontSize:Wc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Yc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Yc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wc(t,"fontFamily","Courier"),this.fontSize=Wc(t,"fontSize","16px"),this.fontStyle=Wc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=za(t,this.parent.canvas,this.parent.context),this.backgroundColor2=za(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=za(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=za(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=za(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=sa[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wc(e,"fontFamily",this.fontFamily),this.fontSize=Wc(e,"fontSize",this.fontSize),this.fontStyle=Wc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Fc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ka(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const jc=Phaser.Utils.Objects.GetValue,Ic=Kh,Bc=qh;class Hc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=jc(t,"text",""),this.x=jc(t,"x",0),this.y=jc(t,"y",0),this.width=jc(t,"width",0);var e=jc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=jc(t,"newLineMode",0),this.startIndex=jc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Bc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ic&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Bc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Nc=Phaser.Utils.Objects.GetFastValue,Gc=Kh,Vc=Zh;class Uc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Nc(t,"tagToText",Wt),this.tagToTextScope=Nc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var $c={};const Jc=Phaser.Geom.Rectangle;var Kc=new rl;class qc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&cu(g)){""!==x?h.push(n.getLine(x,b,ru)):0===C&&r>0&&h.push(n.getLine("",0,ru)),h.push(...lu(g,e,au,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,ru)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},du=function(t,e){var i;switch(e){case hu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==pu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Uc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return xp(this.sizerChildren,null),vh.call(this,t),this}},Cp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,xp(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Pp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,xp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)xp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},_p=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const kp=Phaser.Utils.Objects.IsPlainObject,Ep=Phaser.Utils.Objects.GetValue;class Mp extends th{constructor(t,e,i,s,r,n,h,a,o,l){kp(e)?(e=Ep(l=e,"x",0),i=Ep(l,"y",0),s=Ep(l,"width",void 0),r=Ep(l,"height",void 0),n=Ep(l,"column",l.col||0),h=Ep(l,"row",0),a=Ep(l,"columnProportions",0),o=Ep(l,"rowProportions",0)):kp(s)?(s=Ep(l=s,"width",void 0),r=Ep(l,"height",void 0),n=Ep(l,"column",l.col||0),h=Ep(l,"row",0),a=Ep(l,"columnProportions",0),o=Ep(l,"rowProportions",0)):kp(n)?(n=Ep(l=n,"column",l.col||0),h=Ep(l,"row",0),a=Ep(l,"columnProportions",0),o=Ep(l,"rowProportions",0)):kp(a)&&(a=Ep(l=a,"columnProportions",0),o=Ep(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Ep(l,"createCellContainerCallback")),this.setIndentLeft(Ep(l,"space.indentLeftOdd",0),Ep(l,"space.indentLeftEven",0)),this.setIndentTop(Ep(l,"space.indentTopOdd",0),Ep(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Ep(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Tp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=_p.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Mp.prototype,Pp);const Rp=Phaser.Utils.Objects.GetValue,Lp=Phaser.Math.Percent;var Dp=function(t,e,i){var s;return t.y===e.y?s=Lp(i.x,t.x,e.x):t.x===e.x&&(s=Lp(i.y,t.y,e.y)),s},Ap=function(t,e,i){var s,r;this.enable&&(Yp.x=e,Yp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Dp(s,r,Yp))},Yp={},Xp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Wp.x=t.worldX,Wp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Dp(s,r,Wp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Wp={},zp=function(t,e){void 0===e&&(e=Fp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Fp={};const jp=Phaser.Display.Align.LEFT_CENTER,Ip=Phaser.Display.Align.TOP_CENTER;var Bp={};const Hp=Phaser.Display.Align.RIGHT_CENTER,Np=Phaser.Display.Align.BOTTOM_CENTER;var Gp={};const Vp=Phaser.Math.Linear;var Up={};const $p=Phaser.Display.Align.LEFT_CENTER,Jp=Phaser.Display.Align.TOP_CENTER,Kp=Phaser.Display.Align.RIGHT_CENTER,qp=Phaser.Display.Align.BOTTOM_CENTER,Zp=Phaser.Utils.Objects.GetValue,Qp=Phaser.Utils.Objects.IsPlainObject,tv=Phaser.Math.Clamp,ev=Phaser.Math.Snap.To;class iv extends(od(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Zp(e,"reverseAxis",!1);var i=Zp(e,"background",void 0),s=Zp(e,"track",void 0),r=Zp(e,"indicator",void 0),n=Zp(e,"thumb",void 0);if(i&&(Qp(i)&&(i=Sc(t,i)),this.addBackground(i)),s&&(Qp(s)&&(s=Sc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Qp(r)&&(r=Sc(t,r)),this.pin(r)),n){Qp(n)&&(n=Sc(t,n)),this.pin(n);var h=Zp(e,"thumbOffsetX",0),a=Zp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Zp(e,"input",0);switch("string"==typeof o&&(o=sv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Ap,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Xp,this).on("pointermove",Xp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Zp(e,"enable",void 0));var l=Zp(e,"tick",void 0);void 0===l&&(l=Zp(e,"gap",void 0)),this.setGap(l),this.setValue(Zp(e,"value",0),Zp(e,"min",void 0),Zp(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=ev(t,this.gap));var e=this._value;this._value=tv(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const sv={pan:0,drag:0,click:1,none:-1};var rv={getStartPoint:function(t){if(void 0===t&&(t=Bp),this.childrenMap.thumb){var e=0===this.orientation?jp:Ip;zp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Gp),this.childrenMap.thumb){var e=0===this.orientation?Hp:Np;zp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Up),s.x=Vp(e.x,i.x,t),s.y=Vp(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Kp:qp:0===this.orientation?$p:Jp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(iv.prototype,rv);const nv=Phaser.Utils.Objects.GetValue;class hv extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=nv(e,"background",void 0),n=nv(e,"buttons",void 0),h=nv(n,"top",nv(n,"left",void 0)),a=nv(n,"bottom",nv(n,"right",void 0)),o=nv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===nv(o,"width",void 0)?1:0:void 0===nv(o,"height",void 0)?1:0,i=new iv(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=nv(e,"valuechangeCallback",null);if(null!==d){var c=nv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(nv(e,"enable",void 0)),this.setValue(nv(e,"value",0)),this.setScrollStep(nv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class av extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const ov=Phaser.Utils.Objects.GetValue,lv=Phaser.Math.Distance.Between;class dv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=ov(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(ov(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(ov(t,"enable",!0)),this.holdThreshold=ov(t,"holdThreshold",50),this.pointerOutReleaseEnable=ov(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:lv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const cv=Phaser.Utils.Objects.GetValue;class uv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(cv(t,"value",0)),this.setSpeed(cv(t,"speed",0)),this.setAcceleration(cv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class pv{constructor(){this.value,this.dir,this.movement=new uv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const mv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},yv=Phaser.Utils.Objects.GetValue;class xv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=yv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(yv(e,"speed",.1)),this.setEnable(yv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(yv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const bv=Phaser.Utils.Objects.GetValue;var Cv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?bv(s,l,void 0):bv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new hv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=bv(r,"tickLength",void 0);var p=bv(r,"position",0);"string"==typeof p&&(p=wv[p]);var v,g,f=bv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=bv(s,"space.slider",void 0))&&(a?f=0:v=bv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:bv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:bv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:bv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:bv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=bv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=bv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=bv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=bv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=bv(s,"scrollDetectionMode");"string"==typeof x&&(x=Sv[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?bv(s,b,!0):bv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new fv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=bv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new xv(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const wv={right:0,left:1,bottom:0,top:1},Sv={gameObject:0,rectBounds:1},Ov=Phaser.Utils.Objects.GetValue;var Pv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Ov(e,"width"),h=Ov(e,"height");n||Ov(e,"child.expandWidth",!0)||(s[1]=0),h||Ov(e,"child.expandHeight",!0)||(r[1]=0);var a=new Mp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Rp(i,"child"),r=Rp(s,"gameObject",void 0);if(r){var n=Rp(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Rp(n,"top",0),h.bottom=Rp(n,"bottom",0),a.left=Rp(n,"left",0),a.right=Rp(n,"right",0);break;case 1:h.top=Rp(n,"left",0),h.bottom=Rp(n,"right",0),a.top=Rp(n,"top",0),a.bottom=Rp(n,"bottom",0);break;default:h.top=Rp(n,"top",0),h.bottom=Rp(n,"bottom",0),h.left=Rp(n,"left",0),h.right=Rp(n,"right",0)}e.add(r,{column:1,row:1,align:Rp(s,"align","center"),padding:a,expand:{width:Rp(s,"expandWidth",!0),height:Rp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Cv(t,a,"y",e);break;case 1:Cv(t,a,"x",e);break;default:Cv(t,a,"y",e),Cv(t,a,"x",e)}return a},Tv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},_v=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},kv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Av.call(this,-this.textOY)),0),e=Yv.call(this,t)+this.textOY,i=Xv.call(this,t);return function(t,e){switch(Gh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Wv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Fv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Wv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Iv=Phaser.Utils.Objects.IsPlainObject,Bv=Phaser.Utils.Objects.GetValue,Hv=Phaser.Display.Align.TOP_LEFT;class Nv extends th{constructor(t,e,i,s,r,n){Iv(e)?(e=Bv(n=e,"x",0),i=Bv(n,"y",0),s=Bv(n,"width",void 0),r=Bv(n,"height",void 0)):Iv(s)&&(s=Bv(n=s,"width",void 0),r=Bv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Bv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Bv(n,"clampTextOY",!0)),this.alwaysScrollable=Bv(n,"alwaysScrollable",!1);var h=Bv(n,"background",void 0),a=Bv(n,"text",void 0);void 0===a&&(a=Gv(t)),this.textCropEnable=Bv(n,"textCrop",!!a.setCrop);var o=Bv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Hv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Gh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=jh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Av.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Yv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Gv=function(t){return t.add.text(0,0,"")};Object.assign(Nv.prototype,jv);var Vv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Uv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const $v=Phaser.Utils.Objects.GetValue;class Jv extends Lv{constructor(t,e){void 0===e&&(e={});var i=$v(e,"text",void 0),s=$v(e,"textWidth",void 0),r=$v(e,"textHeight",void 0),n=$v(e,"textCrop",!!i.setCrop),h=$v(e,"textMask",!n),a=$v(e,"content",""),o=new Nv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:$v(e,"clampChildOY",!1),alwaysScrollable:$v(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=$v(e,"space",void 0);l&&(l.child=$v(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Jv.prototype,Vv,Uv);const Kv=Phaser.Utils.Objects.GetValue;var qv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new lp(t,e);break;case"bbcodetext":case"bbcode":s=new np(t,0,0,"",e);break;case"label":s=new tg(t,e);break;case"textarea":s=function(t,e,i){e=e?wo(e):{};var s=Kv(i,"background",Sc),r=Kv(i,"text",qv),n=Kv(i,"track",Sc),h=Kv(i,"thumb",Sc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Jv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Tc(t,e)}return wc(s,e),t.add.existing(s),s},Zv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new bc(t,e):new Zd(t,e);break;case"roundRectangle":s=new Ul(t,e);break;default:s=new ic(t,e)}return wc(s,e),t.add.existing(s),s};const Qv=Phaser.Utils.Objects.GetValue;class tg extends xl{constructor(t,e,i){e=function(t,e,i){e=e?wo(e):{};var s=Qv(i,"background",Sc),r=Qv(i,"text",qv),n=Qv(i,"icon",Zv),h=Qv(i,"action",Zv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return eg(this.getChildren(),"setActiveState",t),this}setHoverState(t){return eg(this.getChildren(),"setHoverState",t),this}setDisableState(t){return eg(this.getChildren(),"setDisableState",t),this}}var eg=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Cg(this),wg(this)),this}setNumberInput(){return this.onUpdateCallback=bg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Pg=Phaser.Utils.Objects.GetValue,Tg=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var _g=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Yg.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Xg(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Wg=new Yg,zg=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Fg=/\S/,jg=new Yg;jg.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Fg.test(t)&&!Fg.test(e)},jg.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Ng(t,null,null,i),i," ")},Hg.equals=function(t,e){return Yg.prototype.equals.call(Hg,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Gg=new Yg;Gg.tokenize=function(t){return t.slice()},Gg.join=Gg.removeEmpty=function(t){return t};const Vg=Phaser.Utils.Array.Remove;var Ug=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Vg(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Wg.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Zg={cursorMoveLeft(){if(!this.isOpened)return this;var t=Jg(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Jg(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Kg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Jg(qg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Kg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Jg(qg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Qg=Phaser.Utils.Objects.IsPlainObject;class tf extends dl{constructor(t,e,i,s,r,n){Qg(e)?n=e:Qg(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(_g(e,"wrap.vAlign")||jd(e,"wrap.vAlign",s=i?"center":"top"),_g(e,"wrap.wrapMode")||jd(e,"wrap.wrapMode","char"),_g(e,"wrap.maxLines")||jd(e,"wrap.maxLines",s=i?1:void 0),i&&jd(e,"wrap.wrapWidth",1/0),_g(e,"wrap.useDefaultTextHeight")||jd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!_g(e.edit,"inputType")){var s=i?"text":"textarea";jd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Eg(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=jl(n.background,"focus"),o=jl(n.style,"cursor"),l=jl(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Pg(e,"edit");return void 0===i&&(i={}),rg(e,i,Tg),new Og(t,i)}(this,n),Mg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Ag.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Lg.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Rg(l)&&Object.assign(l,o),Dg.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;so;d--){for(c=0;c0&&this.wrapMode!==Qh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=sa[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Wc(t,l,d);else{var u=Xc(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Wc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Wc(t,"fill",null);null!==v&&(this.color=za(v));var g=Wc(t,"metrics",!1);return g?this.metrics={ascent:Wc(g,"ascent",0),descent:Wc(g,"descent",0),fontSize:Wc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Yc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Yc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wc(t,"fontFamily","Courier"),this.fontSize=Wc(t,"fontSize","16px"),this.fontStyle=Wc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=za(t,this.parent.canvas,this.parent.context),this.backgroundColor2=za(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=za(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=za(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=za(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=sa[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wc(e,"fontFamily",this.fontFamily),this.fontSize=Wc(e,"fontSize",this.fontSize),this.fontStyle=Wc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Fc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ka(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const jc=Phaser.Utils.Objects.GetValue,Ic=Kh,Bc=qh;class Hc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=jc(t,"text",""),this.x=jc(t,"x",0),this.y=jc(t,"y",0),this.width=jc(t,"width",0);var e=jc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=jc(t,"newLineMode",0),this.startIndex=jc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Bc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ic&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Bc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Nc=Phaser.Utils.Objects.GetFastValue,Gc=Kh,Vc=Zh;class Uc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Nc(t,"tagToText",Wt),this.tagToTextScope=Nc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var $c={};const Jc=Phaser.Geom.Rectangle;var Kc=new rl;class qc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&uu(g)){""!==x?h.push(n.getLine(x,b,nu)):0===C&&r>0&&h.push(n.getLine("",0,nu)),h.push(...du(g,e,ou,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,nu)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},cu=function(t,e){var i;switch(e){case au:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Uc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return bp(this.sizerChildren,null),vh.call(this,t),this}},wp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,bp(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Tp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,bp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)bp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},kp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Ep=Phaser.Utils.Objects.IsPlainObject,Mp=Phaser.Utils.Objects.GetValue;class Rp extends th{constructor(t,e,i,s,r,n,h,a,o,l){Ep(e)?(e=Mp(l=e,"x",0),i=Mp(l,"y",0),s=Mp(l,"width",void 0),r=Mp(l,"height",void 0),n=Mp(l,"column",l.col||0),h=Mp(l,"row",0),a=Mp(l,"columnProportions",0),o=Mp(l,"rowProportions",0)):Ep(s)?(s=Mp(l=s,"width",void 0),r=Mp(l,"height",void 0),n=Mp(l,"column",l.col||0),h=Mp(l,"row",0),a=Mp(l,"columnProportions",0),o=Mp(l,"rowProportions",0)):Ep(n)?(n=Mp(l=n,"column",l.col||0),h=Mp(l,"row",0),a=Mp(l,"columnProportions",0),o=Mp(l,"rowProportions",0)):Ep(a)&&(a=Mp(l=a,"columnProportions",0),o=Mp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Mp(l,"createCellContainerCallback")),this.setIndentLeft(Mp(l,"space.indentLeftOdd",0),Mp(l,"space.indentLeftEven",0)),this.setIndentTop(Mp(l,"space.indentTopOdd",0),Mp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Mp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=_p.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=kp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Rp.prototype,Tp);const Lp=Phaser.Utils.Objects.GetValue,Dp=Phaser.Math.Percent;var Ap=function(t,e,i){var s;return t.y===e.y?s=Dp(i.x,t.x,e.x):t.x===e.x&&(s=Dp(i.y,t.y,e.y)),s},Yp=function(t,e,i){var s,r;this.enable&&(Xp.x=e,Xp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Ap(s,r,Xp))},Xp={},Wp=function(t,e,i){if(this.enable&&t.isDown){var s,r;zp.x=t.worldX,zp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Ap(s,r,zp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},zp={},Fp=function(t,e){void 0===e&&(e=jp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},jp={};const Ip=Phaser.Display.Align.LEFT_CENTER,Bp=Phaser.Display.Align.TOP_CENTER;var Hp={};const Np=Phaser.Display.Align.RIGHT_CENTER,Gp=Phaser.Display.Align.BOTTOM_CENTER;var Vp={};const Up=Phaser.Math.Linear;var $p={};const Jp=Phaser.Display.Align.LEFT_CENTER,Kp=Phaser.Display.Align.TOP_CENTER,qp=Phaser.Display.Align.RIGHT_CENTER,Zp=Phaser.Display.Align.BOTTOM_CENTER,Qp=Phaser.Utils.Objects.GetValue,tv=Phaser.Utils.Objects.IsPlainObject,ev=Phaser.Math.Clamp,iv=Phaser.Math.Snap.To;class sv extends(od(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Qp(e,"reverseAxis",!1);var i=Qp(e,"background",void 0),s=Qp(e,"track",void 0),r=Qp(e,"indicator",void 0),n=Qp(e,"thumb",void 0);if(i&&(tv(i)&&(i=Sc(t,i)),this.addBackground(i)),s&&(tv(s)&&(s=Sc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(tv(r)&&(r=Sc(t,r)),this.pin(r)),n){tv(n)&&(n=Sc(t,n)),this.pin(n);var h=Qp(e,"thumbOffsetX",0),a=Qp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Qp(e,"input",0);switch("string"==typeof o&&(o=rv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Yp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Wp,this).on("pointermove",Wp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Qp(e,"enable",void 0));var l=Qp(e,"tick",void 0);void 0===l&&(l=Qp(e,"gap",void 0)),this.setGap(l),this.setValue(Qp(e,"value",0),Qp(e,"min",void 0),Qp(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=iv(t,this.gap));var e=this._value;this._value=ev(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const rv={pan:0,drag:0,click:1,none:-1};var nv={getStartPoint:function(t){if(void 0===t&&(t=Hp),this.childrenMap.thumb){var e=0===this.orientation?Ip:Bp;Fp.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=Vp),this.childrenMap.thumb){var e=0===this.orientation?Np:Gp;Fp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=$p),s.x=Up(e.x,i.x,t),s.y=Up(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?qp:Zp:0===this.orientation?Jp:Kp,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(sv.prototype,nv);const hv=Phaser.Utils.Objects.GetValue;class av extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=hv(e,"background",void 0),n=hv(e,"buttons",void 0),h=hv(n,"top",hv(n,"left",void 0)),a=hv(n,"bottom",hv(n,"right",void 0)),o=hv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===hv(o,"width",void 0)?1:0:void 0===hv(o,"height",void 0)?1:0,i=new sv(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=hv(e,"valuechangeCallback",null);if(null!==d){var c=hv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(hv(e,"enable",void 0)),this.setValue(hv(e,"value",0)),this.setScrollStep(hv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class ov extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const lv=Phaser.Utils.Objects.GetValue,dv=Phaser.Math.Distance.Between;class cv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=lv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(lv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(lv(t,"enable",!0)),this.holdThreshold=lv(t,"holdThreshold",50),this.pointerOutReleaseEnable=lv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:dv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const uv=Phaser.Utils.Objects.GetValue;class pv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(uv(t,"value",0)),this.setSpeed(uv(t,"speed",0)),this.setAcceleration(uv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class vv{constructor(){this.value,this.dir,this.movement=new pv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const yv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},xv=Phaser.Utils.Objects.GetValue;class bv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=xv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(xv(e,"speed",.1)),this.setEnable(xv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(xv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Cv=Phaser.Utils.Objects.GetValue;var wv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Cv(s,l,void 0):Cv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new av(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Cv(r,"tickLength",void 0);var p=Cv(r,"position",0);"string"==typeof p&&(p=Sv[p]);var v,g,f=Cv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Cv(s,"space.slider",void 0))&&(a?f=0:v=Cv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Cv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Cv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Cv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Cv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Cv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Cv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Cv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Cv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=Cv(s,"scrollDetectionMode");"string"==typeof x&&(x=Ov[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?Cv(s,b,!0):Cv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new mv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,T=Cv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==x&&(T.focus=1===x?2:0),C=new bv(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const Sv={right:0,left:1,bottom:0,top:1},Ov={gameObject:0,rectBounds:1},Pv=Phaser.Utils.Objects.GetValue;var Tv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Pv(e,"width"),h=Pv(e,"height");n||Pv(e,"child.expandWidth",!0)||(s[1]=0),h||Pv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Rp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Lp(i,"child"),r=Lp(s,"gameObject",void 0);if(r){var n=Lp(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Lp(n,"top",0),h.bottom=Lp(n,"bottom",0),a.left=Lp(n,"left",0),a.right=Lp(n,"right",0);break;case 1:h.top=Lp(n,"left",0),h.bottom=Lp(n,"right",0),a.top=Lp(n,"top",0),a.bottom=Lp(n,"bottom",0);break;default:h.top=Lp(n,"top",0),h.bottom=Lp(n,"bottom",0),h.left=Lp(n,"left",0),h.right=Lp(n,"right",0)}e.add(r,{column:1,row:1,align:Lp(s,"align","center"),padding:a,expand:{width:Lp(s,"expandWidth",!0),height:Lp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:wv(t,a,"y",e);break;case 1:wv(t,a,"x",e);break;default:wv(t,a,"y",e),wv(t,a,"x",e)}return a},_v=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},kv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Ev=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Yv.call(this,-this.textOY)),0),e=Xv.call(this,t)+this.textOY,i=Wv.call(this,t);return function(t,e){switch(Gh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,zv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,jv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,zv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Bv=Phaser.Utils.Objects.IsPlainObject,Hv=Phaser.Utils.Objects.GetValue,Nv=Phaser.Display.Align.TOP_LEFT;class Gv extends th{constructor(t,e,i,s,r,n){Bv(e)?(e=Hv(n=e,"x",0),i=Hv(n,"y",0),s=Hv(n,"width",void 0),r=Hv(n,"height",void 0)):Bv(s)&&(s=Hv(n=s,"width",void 0),r=Hv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Hv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Hv(n,"clampTextOY",!0)),this.alwaysScrollable=Hv(n,"alwaysScrollable",!1);var h=Hv(n,"background",void 0),a=Hv(n,"text",void 0);void 0===a&&(a=Vv(t)),this.textCropEnable=Hv(n,"textCrop",!!a.setCrop);var o=Hv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Nv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Gh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=jh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Yv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Xv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Vv=function(t){return t.add.text(0,0,"")};Object.assign(Gv.prototype,Iv);var Uv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},$v={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Jv=Phaser.Utils.Objects.GetValue;class Kv extends Dv{constructor(t,e){void 0===e&&(e={});var i=Jv(e,"text",void 0),s=Jv(e,"textWidth",void 0),r=Jv(e,"textHeight",void 0),n=Jv(e,"textCrop",!!i.setCrop),h=Jv(e,"textMask",!n),a=Jv(e,"content",""),o=new Gv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Jv(e,"clampChildOY",!1),alwaysScrollable:Jv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Jv(e,"space",void 0);l&&(l.child=Jv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Kv.prototype,Uv,$v);const qv=Phaser.Utils.Objects.GetValue;var Zv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new dp(t,e);break;case"bbcodetext":case"bbcode":s=new hp(t,0,0,"",e);break;case"label":s=new eg(t,e);break;case"textarea":s=function(t,e,i){e=e?wo(e):{};var s=qv(i,"background",Sc),r=qv(i,"text",Zv),n=qv(i,"track",Sc),h=qv(i,"thumb",Sc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Kv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Tc(t,e)}return wc(s,e),t.add.existing(s),s},Qv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new bc(t,e):new Zd(t,e);break;case"roundRectangle":s=new Ul(t,e);break;default:s=new ic(t,e)}return wc(s,e),t.add.existing(s),s};const tg=Phaser.Utils.Objects.GetValue;class eg extends xl{constructor(t,e,i){e=function(t,e,i){e=e?wo(e):{};var s=tg(i,"background",Sc),r=tg(i,"text",Zv),n=tg(i,"icon",Qv),h=tg(i,"action",Qv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return ig(this.getChildren(),"setActiveState",t),this}setHoverState(t){return ig(this.getChildren(),"setHoverState",t),this}setDisableState(t){return ig(this.getChildren(),"setDisableState",t),this}}var ig=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(wg(this),Sg(this)),this}setNumberInput(){return this.onUpdateCallback=Cg,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Tg=Phaser.Utils.Objects.GetValue,_g=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var kg=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}Xg.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Wg(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const zg=new Xg,Fg=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,jg=/\S/,Ig=new Xg;Ig.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!jg.test(t)&&!jg.test(e)},Ig.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Gg(t,null,null,i),i," ")},Ng.equals=function(t,e){return Xg.prototype.equals.call(Ng,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Vg=new Xg;Vg.tokenize=function(t){return t.slice()},Vg.join=Vg.removeEmpty=function(t){return t};const Ug=Phaser.Utils.Array.Remove;var $g=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Ug(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,zg.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Qg={cursorMoveLeft(){if(!this.isOpened)return this;var t=Kg(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Kg(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=qg(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Kg(Zg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=qg(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Kg(Zg(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const tf=Phaser.Utils.Objects.IsPlainObject;class ef extends dl{constructor(t,e,i,s,r,n){tf(e)?n=e:tf(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(kg(e,"wrap.vAlign")||jd(e,"wrap.vAlign",s=i?"center":"top"),kg(e,"wrap.wrapMode")||jd(e,"wrap.wrapMode","char"),kg(e,"wrap.maxLines")||jd(e,"wrap.maxLines",s=i?1:void 0),i&&jd(e,"wrap.wrapWidth",1/0),kg(e,"wrap.useDefaultTextHeight")||jd(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!kg(e.edit,"inputType")){var s=i?"text":"textarea";jd(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Mg(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=jl(n.background,"focus"),o=jl(n.style,"cursor"),l=jl(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Tg(e,"edit");return void 0===i&&(i={}),ng(e,i,_g),new Pg(t,i)}(this,n),Rg.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),Yg.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),Dg.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),Lg(l)&&Object.assign(l,o),Ag.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const zp=Phaser.Display.Canvas.CanvasPool;var Xp=function(t){var e=zp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return zp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,zp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Lc&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=zc[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=jp(t,l,d);else{var u=Wp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=jp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=jp(t,"fill",null);null!==v&&(this.color=Da(v));var g=jp(t,"metrics",!1);return g?this.metrics={ascent:jp(g,"ascent",0),descent:jp(g,"descent",0),fontSize:jp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Xp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Xp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=jp(t,"fontFamily","Courier"),this.fontSize=jp(t,"fontSize","16px"),this.fontStyle=jp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Da(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Da(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Da(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=zc[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=jp(e,"fontFamily",this.fontFamily),this.fontSize=jp(e,"fontSize",this.fontSize),this.fontStyle=jp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Ip={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Fa(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Bp=Phaser.Utils.Objects.GetValue,Hp=Ec,Gp=Mc;class Vp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Bp(t,"text",""),this.x=Bp(t,"x",0),this.y=Bp(t,"y",0),this.width=Bp(t,"width",0);var e=Bp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Bp(t,"newLineMode",0),this.startIndex=Bp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Gp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Hp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Gp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Np=Phaser.Utils.Objects.GetFastValue,Up=Ec,$p=Rc;class Jp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Np(t,"tagToText",Xt),this.tagToTextScope=Np(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var qp={};const Kp=Phaser.Geom.Rectangle;var Zp=new qo;class Qp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&pv(g)){""!==x?h.push(n.getLine(x,b,hv)):0===C&&r>0&&h.push(n.getLine("",0,hv)),h.push(...cv(g,e,lv,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,hv)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},uv=function(t,e){var i;switch(e){case ov:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==gv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Jp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Cg(this.sizerChildren,null),vh.call(this,t),this}},Sg={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,Cg(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Tg={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Cg(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Cg(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Eg=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Mg=Phaser.Utils.Objects.IsPlainObject,Rg=Phaser.Utils.Objects.GetValue;class Lg extends th{constructor(t,e,i,s,r,n,h,a,o,l){Mg(e)?(e=Rg(l=e,"x",0),i=Rg(l,"y",0),s=Rg(l,"width",void 0),r=Rg(l,"height",void 0),n=Rg(l,"column",l.col||0),h=Rg(l,"row",0),a=Rg(l,"columnProportions",0),o=Rg(l,"rowProportions",0)):Mg(s)?(s=Rg(l=s,"width",void 0),r=Rg(l,"height",void 0),n=Rg(l,"column",l.col||0),h=Rg(l,"row",0),a=Rg(l,"columnProportions",0),o=Rg(l,"rowProportions",0)):Mg(n)?(n=Rg(l=n,"column",l.col||0),h=Rg(l,"row",0),a=Rg(l,"columnProportions",0),o=Rg(l,"rowProportions",0)):Mg(a)&&(a=Rg(l=a,"columnProportions",0),o=Rg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Rg(l,"createCellContainerCallback")),this.setIndentLeft(Rg(l,"space.indentLeftOdd",0),Rg(l,"space.indentLeftEven",0)),this.setIndentTop(Rg(l,"space.indentTopOdd",0),Rg(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Rg(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=_g.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Eg.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Lg.prototype,Tg);const Dg=Phaser.Utils.Objects.GetValue,Ag=Phaser.Math.Percent;var Yg=function(t,e,i){var s;return t.y===e.y?s=Ag(i.x,t.x,e.x):t.x===e.x&&(s=Ag(i.y,t.y,e.y)),s},zg=function(t,e,i){var s,r;this.enable&&(Xg.x=e,Xg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Yg(s,r,Xg))},Xg={},Wg=function(t,e,i){if(this.enable&&t.isDown){var s,r;jg.x=t.worldX,jg.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Yg(s,r,jg);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},jg={},Fg=function(t,e){void 0===e&&(e=Ig);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Ig={};const Bg=Phaser.Display.Align.LEFT_CENTER,Hg=Phaser.Display.Align.TOP_CENTER;var Gg={};const Vg=Phaser.Display.Align.RIGHT_CENTER,Ng=Phaser.Display.Align.BOTTOM_CENTER;var Ug={};const $g=Phaser.Math.Linear;var Jg={};const qg=Phaser.Display.Align.LEFT_CENTER,Kg=Phaser.Display.Align.TOP_CENTER,Zg=Phaser.Display.Align.RIGHT_CENTER,Qg=Phaser.Display.Align.BOTTOM_CENTER,tf=Phaser.Utils.Objects.GetValue,ef=Phaser.Utils.Objects.IsPlainObject,sf=Phaser.Math.Clamp,rf=Phaser.Math.Snap.To;class nf extends(uu(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=tf(e,"reverseAxis",!1);var i=tf(e,"background",void 0),s=tf(e,"track",void 0),r=tf(e,"indicator",void 0),n=tf(e,"thumb",void 0);if(i&&(ef(i)&&(i=Pp(t,i)),this.addBackground(i)),s&&(ef(s)&&(s=Pp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(ef(r)&&(r=Pp(t,r)),this.pin(r)),n){ef(n)&&(n=Pp(t,n)),this.pin(n);var h=tf(e,"thumbOffsetX",0),a=tf(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=tf(e,"input",0);switch("string"==typeof o&&(o=hf[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",zg,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Wg,this).on("pointermove",Wg,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(tf(e,"enable",void 0));var l=tf(e,"tick",void 0);void 0===l&&(l=tf(e,"gap",void 0)),this.setGap(l),this.setValue(tf(e,"value",0),tf(e,"min",void 0),tf(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=rf(t,this.gap));var e=this._value;this._value=sf(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const hf={pan:0,drag:0,click:1,none:-1};var af={getStartPoint:function(t){if(void 0===t&&(t=Gg),this.childrenMap.thumb){var e=0===this.orientation?Bg:Hg;Fg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Ug),this.childrenMap.thumb){var e=0===this.orientation?Vg:Ng;Fg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Jg),s.x=$g(e.x,i.x,t),s.y=$g(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?Zg:Qg:0===this.orientation?qg:Kg,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(nf.prototype,af);const of=Phaser.Utils.Objects.GetValue;class lf extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=of(e,"background",void 0),n=of(e,"buttons",void 0),h=of(n,"top",of(n,"left",void 0)),a=of(n,"bottom",of(n,"right",void 0)),o=of(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===of(o,"width",void 0)?1:0:void 0===of(o,"height",void 0)?1:0,i=new nf(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=of(e,"valuechangeCallback",null);if(null!==d){var c=of(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(of(e,"enable",void 0)),this.setValue(of(e,"value",0)),this.setScrollStep(of(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class df extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const cf=Phaser.Utils.Objects.GetValue,uf=Phaser.Math.Distance.Between;class pf extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=cf(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(cf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(cf(t,"enable",!0)),this.holdThreshold=cf(t,"holdThreshold",50),this.pointerOutReleaseEnable=cf(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:uf(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const vf=Phaser.Utils.Objects.GetValue;class gf{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(vf(t,"value",0)),this.setSpeed(vf(t,"speed",0)),this.setAcceleration(vf(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class ff{constructor(){this.value,this.dir,this.movement=new gf}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const bf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Cf=Phaser.Utils.Objects.GetValue;class wf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Cf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Cf(e,"speed",.1)),this.setEnable(Cf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Cf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Sf=Phaser.Utils.Objects.GetValue;var Of=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Sf(s,l,void 0):Sf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new lf(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Sf(r,"tickLength",void 0);var p=Sf(r,"position",0);"string"==typeof p&&(p=Pf[p]);var v,g,f=Sf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Sf(s,"space.slider",void 0))&&(a?f=0:v=Sf(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Sf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Sf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Sf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Sf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Sf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Sf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Sf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Sf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=Sf(s,"scrollDetectionMode");"string"==typeof x&&(x=kf[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?Sf(s,b,!0):Sf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new xf(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,k=Sf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==x&&(k.focus=1===x?2:0),C=new wf(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const Pf={right:0,left:1,bottom:0,top:1},kf={gameObject:0,rectBounds:1},Tf=Phaser.Utils.Objects.GetValue;var _f=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Tf(e,"width"),h=Tf(e,"height");n||Tf(e,"child.expandWidth",!0)||(s[1]=0),h||Tf(e,"child.expandHeight",!0)||(r[1]=0);var a=new Lg(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Dg(i,"child"),r=Dg(s,"gameObject",void 0);if(r){var n=Dg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Dg(n,"top",0),h.bottom=Dg(n,"bottom",0),a.left=Dg(n,"left",0),a.right=Dg(n,"right",0);break;case 1:h.top=Dg(n,"left",0),h.bottom=Dg(n,"right",0),a.top=Dg(n,"top",0),a.bottom=Dg(n,"bottom",0);break;default:h.top=Dg(n,"top",0),h.bottom=Dg(n,"bottom",0),h.left=Dg(n,"left",0),h.right=Dg(n,"right",0)}e.add(r,{column:1,row:1,align:Dg(s,"align","center"),padding:a,expand:{width:Dg(s,"expandWidth",!0),height:Dg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Of(t,a,"y",e);break;case 1:Of(t,a,"x",e);break;default:Of(t,a,"y",e),Of(t,a,"x",e)}return a},Ef=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Mf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Rf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Xf.call(this,-this.textOY)),0),e=Wf.call(this,t)+this.textOY,i=jf.call(this,t);return function(t,e){switch(kc(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Ff.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Bf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Ff.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Gf=Phaser.Utils.Objects.IsPlainObject,Vf=Phaser.Utils.Objects.GetValue,Nf=Phaser.Display.Align.TOP_LEFT;class Uf extends th{constructor(t,e,i,s,r,n){Gf(e)?(e=Vf(n=e,"x",0),i=Vf(n,"y",0),s=Vf(n,"width",void 0),r=Vf(n,"height",void 0)):Gf(s)&&(s=Vf(n=s,"width",void 0),r=Vf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Vf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Vf(n,"clampTextOY",!0)),this.alwaysScrollable=Vf(n,"alwaysScrollable",!1);var h=Vf(n,"background",void 0),a=Vf(n,"text",void 0);void 0===a&&(a=$f(t)),this.textCropEnable=Vf(n,"textCrop",!!a.setCrop);var o=Vf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Nf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=kc(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Cc.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Xf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Wf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var $f=function(t){return t.add.text(0,0,"")};Object.assign(Uf.prototype,Hf);var Jf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},qf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Kf=Phaser.Utils.Objects.GetValue;class Zf extends Yf{constructor(t,e){void 0===e&&(e={});var i=Kf(e,"text",void 0),s=Kf(e,"textWidth",void 0),r=Kf(e,"textHeight",void 0),n=Kf(e,"textCrop",!!i.setCrop),h=Kf(e,"textMask",!n),a=Kf(e,"content",""),o=new Uf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Kf(e,"clampChildOY",!1),alwaysScrollable:Kf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Kf(e,"space",void 0);l&&(l.child=Kf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Zf.prototype,Jf,qf);const Qf=Phaser.Utils.Objects.GetValue;var tm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new cg(t,e);break;case"bbcodetext":case"bbcode":s=new ag(t,0,0,"",e);break;case"label":s=new sm(t,e);break;case"textarea":s=function(t,e,i){e=e?uo(e):{};var s=Qf(i,"background",Pp),r=Qf(i,"text",tm),n=Qf(i,"track",Pp),h=Qf(i,"thumb",Pp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Zf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new _p(t,e)}return Op(s,e),t.add.existing(s),s},em=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new wp(t,e):new tp(t,e);break;case"roundRectangle":s=new Kc(t,e);break;default:s=new rp(t,e)}return Op(s,e),t.add.existing(s),s};const im=Phaser.Utils.Objects.GetValue;class sm extends Vc{constructor(t,e,i){e=function(t,e,i){e=e?uo(e):{};var s=im(i,"background",Pp),r=im(i,"text",tm),n=im(i,"icon",em),h=im(i,"action",em);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return rm(this.getChildren(),"setActiveState",t),this}setHoverState(t){return rm(this.getChildren(),"setHoverState",t),this}setDisableState(t){return rm(this.getChildren(),"setDisableState",t),this}}var rm=function(t,e,i){for(var s=0,r=t.length;s0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var h=new um(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(h),h};const vm=Phaser.Utils.Objects.GetValue;var gm=function(t,e){var i=vm(e,"expandDirection",void 0);"string"==typeof i&&(i=fm[i]);var s,r,n,h,a,o,l,d=(n="alignTargetX",_l(s=e,r="alignTarget")?ks(s,r):n&&_l(s,n)?ks(s,n):h&&_l(s,h)?ks(s,h):a),c=vm(e,"alignTargetY",d),u=vm(e,"alignOffsetX",0),p=vm(e,"alignOffsetY",0),v=vm(e,"alignSide","").includes("right"),g=vm(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,x=f||m?0:1;t.setOrigin(y,x),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var b=g;b||(b=Dt(t.scene)),m&&t.getBottomLeft().y>b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const fm={down:0,up:1},mm=Phaser.Utils.Objects.GetValue;class ym extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Mi(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new _i(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),gm(t,e),t.isRexSizer&&t.layout();var i=mm(e,"touchOutsideClose",!1),s=mm(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var xm={openColorPicker:function(){if(!this.colorPicker){var t=pm.call(this).layout(),e=new ym(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(xm,wd);const bm=Phaser.Utils.Objects.GetValue;class Cm extends Cd{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(bm(i,"width",160),bm(i,"height",170));var n=bm(i,"background");r=n?function(t){return Pp(t,n)}:bm(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(bm(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(bm(i,"expandDirection")),this.setColorPickerEaseInDuration(bm(i,"easeIn",200)),this.setColorPickerEaseOutDuration(bm(i,"easeOut",200)),this.setColorPickerTransitInCallback(bm(i,"transitIn")),this.setColorPickerTransitOutCallback(bm(i,"transitOut")),this.setColorPickerBounds(bm(i,"bounds"));var h=bm(i,"space");void 0===h&&(h={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(h)}var a=e.colorComponents;if(s&&!1!==a&&null!==a){this.setColorComponentsHeight(bm(a,"height",30)),this.setColorComponentsFormatLabelConfig(bm(a,"formatLabel"));var o=bm(a,"inputText");o||(o=bm(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=bm(a,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}return Object.assign(Cm.prototype,xm),Cm},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e(); + */const zp=Phaser.Display.Canvas.CanvasPool;var Xp=function(t){var e=zp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return zp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,zp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Lc&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=zc[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=jp(t,l,d);else{var u=Wp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=jp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=jp(t,"fill",null);null!==v&&(this.color=Da(v));var g=jp(t,"metrics",!1);return g?this.metrics={ascent:jp(g,"ascent",0),descent:jp(g,"descent",0),fontSize:jp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Xp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Xp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=jp(t,"fontFamily","Courier"),this.fontSize=jp(t,"fontSize","16px"),this.fontStyle=jp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Da(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Da(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Da(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Da(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Da(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=zc[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=jp(e,"fontFamily",this.fontFamily),this.fontSize=jp(e,"fontSize",this.fontSize),this.fontStyle=jp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Ip={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Fa(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var x=this.rtl,b=x?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Bp=Phaser.Utils.Objects.GetValue,Hp=Ec,Gp=Mc;class Vp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Bp(t,"text",""),this.x=Bp(t,"x",0),this.y=Bp(t,"y",0),this.width=Bp(t,"width",0);var e=Bp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Bp(t,"newLineMode",0),this.startIndex=Bp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Gp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Hp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Gp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Np=Phaser.Utils.Objects.GetFastValue,Up=Ec,$p=Rc;class Jp{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Np(t,"tagToText",Xt),this.tagToTextScope=Np(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var qp={};const Kp=Phaser.Geom.Rectangle;var Zp=new qo;class Qp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&vv(g)){""!==x?h.push(n.getLine(x,b,av)):0===C&&r>0&&h.push(n.getLine("",0,av)),h.push(...uv(g,e,dv,s,0,n));var S=h.pop();x=S.text,b=S.width,n.freeLine(S)," "===x&&(x="",b=0)}else(m=b+f)>o?(h.push(n.getLine(x,b,av)),x=g,b=f,o=s):(x+=g,b=m),C===w-1&&h.push(n.getLine(x,b,l))}return h},pv=function(t,e){var i;switch(e){case lv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==fv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Jp({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return wg(this.sizerChildren,null),vh.call(this,t),this}},Og={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,wg(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},_g={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Xe.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,wg(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)wg(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Mg=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Rg=Phaser.Utils.Objects.IsPlainObject,Lg=Phaser.Utils.Objects.GetValue;class Dg extends th{constructor(t,e,i,s,r,n,h,a,o,l){Rg(e)?(e=Lg(l=e,"x",0),i=Lg(l,"y",0),s=Lg(l,"width",void 0),r=Lg(l,"height",void 0),n=Lg(l,"column",l.col||0),h=Lg(l,"row",0),a=Lg(l,"columnProportions",0),o=Lg(l,"rowProportions",0)):Rg(s)?(s=Lg(l=s,"width",void 0),r=Lg(l,"height",void 0),n=Lg(l,"column",l.col||0),h=Lg(l,"row",0),a=Lg(l,"columnProportions",0),o=Lg(l,"rowProportions",0)):Rg(n)?(n=Lg(l=n,"column",l.col||0),h=Lg(l,"row",0),a=Lg(l,"columnProportions",0),o=Lg(l,"rowProportions",0)):Rg(a)&&(a=Lg(l=a,"columnProportions",0),o=Lg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Lg(l,"createCellContainerCallback")),this.setIndentLeft(Lg(l,"space.indentLeftOdd",0),Lg(l,"space.indentLeftEven",0)),this.setIndentTop(Lg(l,"space.indentTopOdd",0),Lg(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Lg(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Eg.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Mg.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Dg.prototype,_g);const Ag=Phaser.Utils.Objects.GetValue,Yg=Phaser.Math.Percent;var zg=function(t,e,i){var s;return t.y===e.y?s=Yg(i.x,t.x,e.x):t.x===e.x&&(s=Yg(i.y,t.y,e.y)),s},Xg=function(t,e,i){var s,r;this.enable&&(Wg.x=e,Wg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=zg(s,r,Wg))},Wg={},jg=function(t,e,i){if(this.enable&&t.isDown){var s,r;Fg.x=t.worldX,Fg.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=zg(s,r,Fg);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Fg={},Ig=function(t,e){void 0===e&&(e=Bg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Bg={};const Hg=Phaser.Display.Align.LEFT_CENTER,Gg=Phaser.Display.Align.TOP_CENTER;var Vg={};const Ng=Phaser.Display.Align.RIGHT_CENTER,Ug=Phaser.Display.Align.BOTTOM_CENTER;var $g={};const Jg=Phaser.Math.Linear;var qg={};const Kg=Phaser.Display.Align.LEFT_CENTER,Zg=Phaser.Display.Align.TOP_CENTER,Qg=Phaser.Display.Align.RIGHT_CENTER,tf=Phaser.Display.Align.BOTTOM_CENTER,ef=Phaser.Utils.Objects.GetValue,sf=Phaser.Utils.Objects.IsPlainObject,rf=Phaser.Math.Clamp,nf=Phaser.Math.Snap.To;class hf extends(uu(Th)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=ef(e,"reverseAxis",!1);var i=ef(e,"background",void 0),s=ef(e,"track",void 0),r=ef(e,"indicator",void 0),n=ef(e,"thumb",void 0);if(i&&(sf(i)&&(i=Pp(t,i)),this.addBackground(i)),s&&(sf(s)&&(s=Pp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(sf(r)&&(r=Pp(t,r)),this.pin(r)),n){sf(n)&&(n=Pp(t,n)),this.pin(n);var h=ef(e,"thumbOffsetX",0),a=ef(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=ef(e,"input",0);switch("string"==typeof o&&(o=af[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Xg,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",jg,this).on("pointermove",jg,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(ef(e,"enable",void 0));var l=ef(e,"tick",void 0);void 0===l&&(l=ef(e,"gap",void 0)),this.setGap(l),this.setValue(ef(e,"value",0),ef(e,"min",void 0),ef(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=nf(t,this.gap));var e=this._value;this._value=rf(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const af={pan:0,drag:0,click:1,none:-1};var of={getStartPoint:function(t){if(void 0===t&&(t=Vg),this.childrenMap.thumb){var e=0===this.orientation?Hg:Gg;Ig.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=$g),this.childrenMap.thumb){var e=0===this.orientation?Ng:Ug;Ig.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=qg),s.x=Jg(e.x,i.x,t),s.y=Jg(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?Qg:tf:0===this.orientation?Kg:Zg,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(hf.prototype,of);const lf=Phaser.Utils.Objects.GetValue;class df extends Th{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=lf(e,"background",void 0),n=lf(e,"buttons",void 0),h=lf(n,"top",lf(n,"left",void 0)),a=lf(n,"bottom",lf(n,"right",void 0)),o=lf(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===lf(o,"width",void 0)?1:0:void 0===lf(o,"height",void 0)?1:0,i=new hf(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=lf(e,"valuechangeCallback",null);if(null!==d){var c=lf(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(lf(e,"enable",void 0)),this.setValue(lf(e,"value",0)),this.setScrollStep(lf(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class cf extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const uf=Phaser.Utils.Objects.GetValue,pf=Phaser.Math.Distance.Between;class vf extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=uf(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(uf(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(uf(t,"enable",!0)),this.holdThreshold=uf(t,"holdThreshold",50),this.pointerOutReleaseEnable=uf(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:pf(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const gf=Phaser.Utils.Objects.GetValue;class ff{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(gf(t,"value",0)),this.setSpeed(gf(t,"speed",0)),this.setAcceleration(gf(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class mf{constructor(){this.value,this.dir,this.movement=new ff}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Cf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},wf=Phaser.Utils.Objects.GetValue;class Sf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=wf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(wf(e,"speed",.1)),this.setEnable(wf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(wf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Of=Phaser.Utils.Objects.GetValue;var Pf=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Of(s,l,void 0):Of(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new df(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Of(r,"tickLength",void 0);var p=Of(r,"position",0);"string"==typeof p&&(p=kf[p]);var v,g,f=Of(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Of(s,"space.slider",void 0))&&(a?f=0:v=Of(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Of(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Of(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Of(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Of(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Of(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Of(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Of(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Of(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,x=Of(s,"scrollDetectionMode");"string"==typeof x&&(x=Tf[x]);var b=`scroller${i}`;(m=a||s.hasOwnProperty(b)?Of(s,b,!0):Of(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==x&&(m.rectBoundsInteractive=1===x),y=new bf(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,O,P,k=Of(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);k&&o&&(void 0!==x&&(k.focus=1===x?2:0),C=new Sf(o,k)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const kf={right:0,left:1,bottom:0,top:1},Tf={gameObject:0,rectBounds:1},_f=Phaser.Utils.Objects.GetValue;var Ef=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=_f(e,"width"),h=_f(e,"height");n||_f(e,"child.expandWidth",!0)||(s[1]=0),h||_f(e,"child.expandHeight",!0)||(r[1]=0);var a=new Dg(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Ag(i,"child"),r=Ag(s,"gameObject",void 0);if(r){var n=Ag(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Ag(n,"top",0),h.bottom=Ag(n,"bottom",0),a.left=Ag(n,"left",0),a.right=Ag(n,"right",0);break;case 1:h.top=Ag(n,"left",0),h.bottom=Ag(n,"right",0),a.top=Ag(n,"top",0),a.bottom=Ag(n,"bottom",0);break;default:h.top=Ag(n,"top",0),h.bottom=Ag(n,"bottom",0),h.left=Ag(n,"left",0),h.right=Ag(n,"right",0)}e.add(r,{column:1,row:1,align:Ag(s,"align","center"),padding:a,expand:{width:Ag(s,"expandWidth",!0),height:Ag(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Pf(t,a,"y",e);break;case 1:Pf(t,a,"x",e);break;default:Pf(t,a,"y",e),Pf(t,a,"x",e)}return a},Mf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Rf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Lf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Wf.call(this,-this.textOY)),0),e=jf.call(this,t)+this.textOY,i=Ff.call(this,t);return function(t,e){switch(kc(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,If.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Hf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,If.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Vf=Phaser.Utils.Objects.IsPlainObject,Nf=Phaser.Utils.Objects.GetValue,Uf=Phaser.Display.Align.TOP_LEFT;class $f extends th{constructor(t,e,i,s,r,n){Vf(e)?(e=Nf(n=e,"x",0),i=Nf(n,"y",0),s=Nf(n,"width",void 0),r=Nf(n,"height",void 0)):Vf(s)&&(s=Nf(n=s,"width",void 0),r=Nf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Nf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Nf(n,"clampTextOY",!0)),this.alwaysScrollable=Nf(n,"alwaysScrollable",!1);var h=Nf(n,"background",void 0),a=Nf(n,"text",void 0);void 0===a&&(a=Jf(t)),this.textCropEnable=Nf(n,"textCrop",!!a.setCrop);var o=Nf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Uf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=kc(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Cc.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Wf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=jf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Jf=function(t){return t.add.text(0,0,"")};Object.assign($f.prototype,Gf);var qf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Kf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Zf=Phaser.Utils.Objects.GetValue;class Qf extends zf{constructor(t,e){void 0===e&&(e={});var i=Zf(e,"text",void 0),s=Zf(e,"textWidth",void 0),r=Zf(e,"textHeight",void 0),n=Zf(e,"textCrop",!!i.setCrop),h=Zf(e,"textMask",!n),a=Zf(e,"content",""),o=new $f(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Zf(e,"clampChildOY",!1),alwaysScrollable:Zf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Zf(e,"space",void 0);l&&(l.child=Zf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Qf.prototype,qf,Kf);const tm=Phaser.Utils.Objects.GetValue;var em=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new ug(t,e);break;case"bbcodetext":case"bbcode":s=new og(t,0,0,"",e);break;case"label":s=new rm(t,e);break;case"textarea":s=function(t,e,i){e=e?uo(e):{};var s=tm(i,"background",Pp),r=tm(i,"text",em),n=tm(i,"track",Pp),h=tm(i,"thumb",Pp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Qf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new _p(t,e)}return Op(s,e),t.add.existing(s),s},im=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new wp(t,e):new tp(t,e);break;case"roundRectangle":s=new Kc(t,e);break;default:s=new rp(t,e)}return Op(s,e),t.add.existing(s),s};const sm=Phaser.Utils.Objects.GetValue;class rm extends Vc{constructor(t,e,i){e=function(t,e,i){e=e?uo(e):{};var s=sm(i,"background",Pp),r=sm(i,"text",em),n=sm(i,"icon",im),h=sm(i,"action",im);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return nm(this.getChildren(),"setActiveState",t),this}setHoverState(t){return nm(this.getChildren(),"setHoverState",t),this}setDisableState(t){return nm(this.getChildren(),"setDisableState",t),this}}var nm=function(t,e,i){for(var s=0,r=t.length;s0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var h=new pm(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(h),h};const gm=Phaser.Utils.Objects.GetValue;var fm=function(t,e){var i=gm(e,"expandDirection",void 0);"string"==typeof i&&(i=mm[i]);var s,r,n,h,a,o,l,d=(n="alignTargetX",_l(s=e,r="alignTarget")?ks(s,r):n&&_l(s,n)?ks(s,n):h&&_l(s,h)?ks(s,h):a),c=gm(e,"alignTargetY",d),u=gm(e,"alignOffsetX",0),p=gm(e,"alignOffsetY",0),v=gm(e,"alignSide","").includes("right"),g=gm(e,"bounds"),f=0===i,m=!(f||1===i),y=v?1:0,x=f||m?0:1;t.setOrigin(y,x),o=v?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var b=g;b||(b=Dt(t.scene)),m&&t.getBottomLeft().y>b.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const mm={down:0,up:1},ym=Phaser.Utils.Objects.GetValue;class xm extends js{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Mi(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new _i(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),fm(t,e),t.isRexSizer&&t.layout();var i=ym(e,"touchOutsideClose",!1),s=ym(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Zs(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var bm={openColorPicker:function(){if(!this.colorPicker){var t=vm.call(this).layout(),e=new xm(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(bm,wd);const Cm=Phaser.Utils.Objects.GetValue;class wm extends Cd{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Cm(i,"width",160),Cm(i,"height",170));var n=Cm(i,"background");r=n?function(t){return Pp(t,n)}:Cm(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Cm(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Cm(i,"expandDirection")),this.setColorPickerEaseInDuration(Cm(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Cm(i,"easeOut",200)),this.setColorPickerTransitInCallback(Cm(i,"transitIn")),this.setColorPickerTransitOutCallback(Cm(i,"transitOut")),this.setColorPickerBounds(Cm(i,"bounds"));var h=Cm(i,"space");void 0===h&&(h={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(h)}var a=e.colorComponents;if(s&&!1!==a&&null!==a){this.setColorComponentsHeight(Cm(a,"height",30)),this.setColorComponentsFormatLabelConfig(Cm(a,"formatLabel"));var o=Cm(a,"inputText");o||(o=Cm(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=Cm(a,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}return Object.assign(wm.prototype,bm),wm},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexcolorinput=e(); diff --git a/dist/rexconfirmdialog.js b/dist/rexconfirmdialog.js index 214f8d63f0..11b571fbf6 100644 --- a/dist/rexconfirmdialog.js +++ b/dist/rexconfirmdialog.js @@ -30175,13 +30175,17 @@ clear() { // Reuse hitArea(rectangle) later for (var i = 0, cnt = this.hitAreas.length; i < cnt; i++) { - Clear(this.hitAreas[i].data); + this.hitAreas[i].data = null; } RectanglePool.pushMultiple(this.hitAreas); return this; } add(x, y, width, height, data) { + if (data === undefined) { + data = {}; + } + var rectangle = RectanglePool.pop(); if (rectangle === null) { rectangle = new Rectangle(x, y, width, height); @@ -30266,6 +30270,11 @@ var key = area.data.key; FireEvent.call(this, 'areadown', key, pointer, localX, localY, event); + // Removed by callback of previous event + if (!area.data) { + return; + } + area.data.isDown = true; }; @@ -30275,21 +30284,29 @@ return; } - var areaData = area.data; - - var key = areaData.key; + var key = area.data.key; FireEvent.call(this, 'areaup', key, pointer, localX, localY, event); - if (areaData.isDown) { + // Removed by callback of previous event + if (!area.data) { + return; + } + + if (area.data.isDown) { FireEvent.call(this, 'areaclick', key, pointer, localX, localY, event); - var url = areaData.url; + // Removed by callback of previous event + if (!area.data) { + return; + } + + var url = area.data.url; if (url) { window.open(url, '_blank'); } } - areaData.isDown = false; + area.data.isDown = false; }; var OnAreaOverOut = function (pointer, localX, localY, event) { @@ -30312,17 +30329,22 @@ FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event); var prevHitArea = this.hitAreaManager.getByKey(this.lastHitAreaKey); - if (this.urlTagCursorStyle && !!prevHitArea.data.url) { - this.scene.input.manager.canvas.style.cursor = ''; - } - prevHitArea.isDown = false; + if (prevHitArea) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, prevHitArea, ''); + } + + prevHitArea.isDown = false; + } } if (key !== null) { FireEvent.call(this, 'areaover', key, pointer, localX, localY, event); - if (this.urlTagCursorStyle && !!area.data.url) { - this.scene.input.manager.canvas.style.cursor = this.urlTagCursorStyle; + if (area.data) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, area, this.urlTagCursorStyle); + } } } @@ -30334,6 +30356,14 @@ this.parent.emit(eventName, key, pointer, localX, localY, event); }; + var SetCursorStyle = function (scene, area, cursorStyle) { + if (!area || !area.data || !area.data.url) { + return; + } + + scene.input.manager.canvas.style.cursor = cursorStyle; + }; + const NO_NEWLINE$1 = CONST.NO_NEWLINE; const RAW_NEWLINE = CONST.RAW_NEWLINE; const WRAPPED_NEWLINE$1 = CONST.WRAPPED_NEWLINE; diff --git a/dist/rexconfirmdialog.min.js b/dist/rexconfirmdialog.min.js index d17b54234b..2194f7dff9 100644 --- a/dist/rexconfirmdialog.min.js +++ b/dist/rexconfirmdialog.min.js @@ -3,4 +3,4 @@ var t,e;t=void 0,e=function(){var t=!1,e=function(e){if(!t){void 0===e&&(e=60);v * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const kp=Phaser.Display.Canvas.CanvasPool;var Ep=function(t){var e=kp.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return kp.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,kp.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Ko&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=tl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Rp(t,l,d);else{var u=Mp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Rp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Rp(t,"fill",null);null!==v&&(this.color=Al(v));var g=Rp(t,"metrics",!1);return g?this.metrics={ascent:Rp(g,"ascent",0),descent:Rp(g,"descent",0),fontSize:Rp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ep(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Ep(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Rp(t,"fontFamily","Courier"),this.fontSize=Rp(t,"fontSize","16px"),this.fontStyle=Rp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Al(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Al(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Al(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Al(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Al(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Al(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Al(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=tl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Rp(e,"fontFamily",this.fontFamily),this.fontSize=Rp(e,"fontSize",this.fontSize),this.fontStyle=Rp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Dp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ul(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var S=l;S0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const zp=Phaser.Utils.Objects.GetValue,Ap=Uo,Yp=$o;class Xp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=zp(t,"text",""),this.x=zp(t,"x",0),this.y=zp(t,"y",0),this.width=zp(t,"width",0);var e=zp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=zp(t,"newLineMode",0),this.startIndex=zp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Yp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ap&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Yp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Bp=Phaser.Utils.Objects.GetFastValue,Wp=Uo,jp=Jo;class Ip{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Bp(t,"tagToText",Xt),this.tagToTextScope=Bp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Fp={};const Hp=Phaser.Geom.Rectangle;var Np=new tc;class Gp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&nv(g)){""!==b?h.push(n.getLine(b,x,Zp)):0===S&&r>0&&h.push(n.getLine("",0,Zp)),h.push(...sv(g,e,ev,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,Zp)),b=g,x=f,o=s):(b+=g,x=m),S===w-1&&h.push(n.getLine(b,x,l))}return h},rv=function(t,e){var i;switch(e){case tv:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==av&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ip({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Xg=Phaser.Utils.Objects.GetValue,Bg=Phaser.Math.Distance.Between;class Wg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Xg(t,"enable",!0)),this.holdThreshold=Xg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Bg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jg=Phaser.Utils.Objects.GetValue;class Ig{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jg(t,"value",0)),this.setSpeed(jg(t,"speed",0)),this.setAcceleration(jg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Fg{constructor(){this.value,this.dir,this.movement=new Ig}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Vg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ug=Phaser.Utils.Objects.GetValue;class $g extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ug(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ug(e,"speed",.1)),this.setEnable(Ug(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ug(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Jg=Phaser.Utils.Objects.GetValue;var Kg=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Jg(s,l,void 0):Jg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ag(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Jg(r,"tickLength",void 0);var p=Jg(r,"position",0);"string"==typeof p&&(p=qg[p]);var v,g,f=Jg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Jg(s,"space.slider",void 0))&&(a?f=0:v=Jg(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Jg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Jg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Jg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Jg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Jg(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Jg(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Jg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Jg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Jg(s,"scrollDetectionMode");"string"==typeof b&&(b=Zg[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Jg(s,x,!0):Jg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Gg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,C,O,P,_=Jg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),S=new $g(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),S&&(P=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[P](-e,!0)})))};const qg={right:0,left:1,bottom:0,top:1},Zg={gameObject:0,rectBounds:1},Qg=Phaser.Utils.Objects.GetValue;var tf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Qg(e,"width"),h=Qg(e,"height");n||Qg(e,"child.expandWidth",!0)||(s[1]=0),h||Qg(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=hg(i,"child"),r=hg(s,"gameObject",void 0);if(r){var n=hg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=hg(n,"top",0),h.bottom=hg(n,"bottom",0),a.left=hg(n,"left",0),a.right=hg(n,"right",0);break;case 1:h.top=hg(n,"left",0),h.bottom=hg(n,"right",0),a.top=hg(n,"top",0),a.bottom=hg(n,"bottom",0);break;default:h.top=hg(n,"top",0),h.bottom=hg(n,"bottom",0),h.left=hg(n,"left",0),h.right=hg(n,"right",0)}e.add(r,{column:1,row:1,align:hg(s,"align","center"),padding:a,expand:{width:hg(s,"expandWidth",!0),height:hg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:Kg(t,a,"y",e);break;case 1:Kg(t,a,"x",e);break;default:Kg(t,a,"y",e),Kg(t,a,"x",e)}return a},ef=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},sf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},rf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(df.call(this,-this.textOY)),0),e=cf.call(this,t)+this.textOY,i=uf.call(this,t);return function(t,e){switch(Fo(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,pf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,gf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,pf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const mf=Phaser.Utils.Objects.IsPlainObject,yf=Phaser.Utils.Objects.GetValue,bf=Phaser.Display.Align.TOP_LEFT;class xf extends rh{constructor(t,e,i,s,r,n){mf(e)?(e=yf(n=e,"x",0),i=yf(n,"y",0),s=yf(n,"width",void 0),r=yf(n,"height",void 0)):mf(s)&&(s=yf(n=s,"width",void 0),r=yf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=yf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(yf(n,"clampTextOY",!0)),this.alwaysScrollable=yf(n,"alwaysScrollable",!1);var h=yf(n,"background",void 0),a=yf(n,"text",void 0);void 0===a&&(a=Sf(t)),this.textCropEnable=yf(n,"textCrop",!!a.setCrop);var o=yf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=bf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Fo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(df.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=cf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Sf=function(t){return t.add.text(0,0,"")};Object.assign(xf.prototype,ff);var wf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Cf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Of=Phaser.Utils.Objects.GetValue;class Pf extends of{constructor(t,e){void 0===e&&(e={});var i=Of(e,"text",void 0),s=Of(e,"textWidth",void 0),r=Of(e,"textHeight",void 0),n=Of(e,"textCrop",!!i.setCrop),h=Of(e,"textMask",!n),a=Of(e,"content",""),o=new xf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Of(e,"clampChildOY",!1),alwaysScrollable:Of(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Of(e,"space",void 0);l&&(l.child=Of(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Pf.prototype,wf,Cf);const _f=Phaser.Utils.Objects.GetValue;var Tf=function(t,e,i){e=e?yd(e):{};var s=_f(i,"background",mp),r=_f(i,"text",kf),n=_f(i,"track",mp),h=_f(i,"thumb",mp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Pf(t,e);return t.add.existing(o),o},kf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new sg(t,e);break;case"bbcodetext":case"bbcode":s=new Qv(t,0,0,"",e);break;case"label":s=new Rf(t,e);break;case"textarea":s=Tf(t,e);break;default:s=new xp(t,e)}return fp(s,e),t.add.existing(s),s},Ef=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new vp(t,e):new Vu(t,e);break;case"roundRectangle":s=new Ic(t,e);break;default:s=new Ku(t,e)}return fp(s,e),t.add.existing(s),s};const Mf=Phaser.Utils.Objects.GetValue;class Rf extends gc{constructor(t,e,i){e=function(t,e,i){e=e?yd(e):{};var s=Mf(i,"background",mp),r=Mf(i,"text",kf),n=Mf(i,"icon",Ef),h=Mf(i,"action",Ef);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Lf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Lf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Lf(this.getChildren(),"setDisableState",t),this}}var Lf=function(t,e,i){for(var s=0,r=t.length;so;d--){for(c=0;c0&&this.wrapMode!==Ko&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=tl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Rp(t,l,d);else{var u=Mp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Rp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Rp(t,"fill",null);null!==v&&(this.color=Al(v));var g=Rp(t,"metrics",!1);return g?this.metrics={ascent:Rp(g,"ascent",0),descent:Rp(g,"descent",0),fontSize:Rp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Ep(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Ep(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Rp(t,"fontFamily","Courier"),this.fontSize=Rp(t,"fontSize","16px"),this.fontStyle=Rp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Al(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Al(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Al(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Al(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Al(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Al(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Al(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Al(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=tl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Rp(e,"fontFamily",this.fontFamily),this.fontSize=Rp(e,"fontSize",this.fontSize),this.fontStyle=Rp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Dp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ul(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var S=l;S0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const zp=Phaser.Utils.Objects.GetValue,Ap=Uo,Yp=$o;class Xp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=zp(t,"text",""),this.x=zp(t,"x",0),this.y=zp(t,"y",0),this.width=zp(t,"width",0);var e=zp(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=zp(t,"newLineMode",0),this.startIndex=zp(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Yp&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Ap&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Yp&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Bp=Phaser.Utils.Objects.GetFastValue,Wp=Uo,jp=Jo;class Ip{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Bp(t,"tagToText",Xt),this.tagToTextScope=Bp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Fp={};const Hp=Phaser.Geom.Rectangle;var Np=new tc;class Gp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&hv(g)){""!==b?h.push(n.getLine(b,x,Qp)):0===S&&r>0&&h.push(n.getLine("",0,Qp)),h.push(...rv(g,e,iv,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,Qp)),b=g,x=f,o=s):(b+=g,x=m),S===w-1&&h.push(n.getLine(b,x,l))}return h},nv=function(t,e){var i;switch(e){case ev:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==ov&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ip({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Bg=Phaser.Utils.Objects.GetValue,Wg=Phaser.Math.Distance.Between;class jg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Bg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Bg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Bg(t,"enable",!0)),this.holdThreshold=Bg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Bg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Wg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Ig=Phaser.Utils.Objects.GetValue;class Fg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Ig(t,"value",0)),this.setSpeed(Ig(t,"speed",0)),this.setAcceleration(Ig(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Hg{constructor(){this.value,this.dir,this.movement=new Fg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Ug={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},$g=Phaser.Utils.Objects.GetValue;class Jg extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=$g(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed($g(e,"speed",.1)),this.setEnable($g(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive($g(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Kg=Phaser.Utils.Objects.GetValue;var qg=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?Kg(s,l,void 0):Kg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Yg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Kg(r,"tickLength",void 0);var p=Kg(r,"position",0);"string"==typeof p&&(p=Zg[p]);var v,g,f=Kg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Kg(s,"space.slider",void 0))&&(a?f=0:v=Kg(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Kg(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Kg(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Kg(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Kg(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Kg(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Kg(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Kg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Kg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Kg(s,"scrollDetectionMode");"string"==typeof b&&(b=Qg[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?Kg(s,x,!0):Kg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Vg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var S,w,C,O,P,_=Kg(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),S=new Jg(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,S),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",S)),n&&(a?(w=h?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(a?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),S&&(P=a?`addChildO${i}`:"addChildOY",S.on("scroll",(function(e){t[P](-e,!0)})))};const Zg={right:0,left:1,bottom:0,top:1},Qg={gameObject:0,rectBounds:1},tf=Phaser.Utils.Objects.GetValue;var ef=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=tf(e,"width"),h=tf(e,"height");n||tf(e,"child.expandWidth",!0)||(s[1]=0),h||tf(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=ag(i,"child"),r=ag(s,"gameObject",void 0);if(r){var n=ag(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=ag(n,"top",0),h.bottom=ag(n,"bottom",0),a.left=ag(n,"left",0),a.right=ag(n,"right",0);break;case 1:h.top=ag(n,"left",0),h.bottom=ag(n,"right",0),a.top=ag(n,"top",0),a.bottom=ag(n,"bottom",0);break;default:h.top=ag(n,"top",0),h.bottom=ag(n,"bottom",0),h.left=ag(n,"left",0),h.right=ag(n,"right",0)}e.add(r,{column:1,row:1,align:ag(s,"align","center"),padding:a,expand:{width:ag(s,"expandWidth",!0),height:ag(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:qg(t,a,"y",e);break;case 1:qg(t,a,"x",e);break;default:qg(t,a,"y",e),qg(t,a,"x",e)}return a},sf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},rf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},nf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(cf.call(this,-this.textOY)),0),e=uf.call(this,t)+this.textOY,i=pf.call(this,t);return function(t,e){switch(Fo(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,vf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,ff.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,vf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const yf=Phaser.Utils.Objects.IsPlainObject,bf=Phaser.Utils.Objects.GetValue,xf=Phaser.Display.Align.TOP_LEFT;class Sf extends rh{constructor(t,e,i,s,r,n){yf(e)?(e=bf(n=e,"x",0),i=bf(n,"y",0),s=bf(n,"width",void 0),r=bf(n,"height",void 0)):yf(s)&&(s=bf(n=s,"width",void 0),r=bf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=bf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(bf(n,"clampTextOY",!0)),this.alwaysScrollable=bf(n,"alwaysScrollable",!1);var h=bf(n,"background",void 0),a=bf(n,"text",void 0);void 0===a&&(a=wf(t)),this.textCropEnable=bf(n,"textCrop",!!a.setCrop);var o=bf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=xf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Fo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Xo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(cf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=uf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var wf=function(t){return t.add.text(0,0,"")};Object.assign(Sf.prototype,mf);var Cf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Of={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Pf=Phaser.Utils.Objects.GetValue;class _f extends lf{constructor(t,e){void 0===e&&(e={});var i=Pf(e,"text",void 0),s=Pf(e,"textWidth",void 0),r=Pf(e,"textHeight",void 0),n=Pf(e,"textCrop",!!i.setCrop),h=Pf(e,"textMask",!n),a=Pf(e,"content",""),o=new Sf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Pf(e,"clampChildOY",!1),alwaysScrollable:Pf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Pf(e,"space",void 0);l&&(l.child=Pf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(_f.prototype,Cf,Of);const Tf=Phaser.Utils.Objects.GetValue;var kf=function(t,e,i){e=e?yd(e):{};var s=Tf(i,"background",mp),r=Tf(i,"text",Ef),n=Tf(i,"track",mp),h=Tf(i,"thumb",mp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new _f(t,e);return t.add.existing(o),o},Ef=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new rg(t,e);break;case"bbcodetext":case"bbcode":s=new tg(t,0,0,"",e);break;case"label":s=new Lf(t,e);break;case"textarea":s=kf(t,e);break;default:s=new xp(t,e)}return fp(s,e),t.add.existing(s),s},Mf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new vp(t,e):new Vu(t,e);break;case"roundRectangle":s=new Ic(t,e);break;default:s=new Ku(t,e)}return fp(s,e),t.add.existing(s),s};const Rf=Phaser.Utils.Objects.GetValue;class Lf extends gc{constructor(t,e,i){e=function(t,e,i){e=e?yd(e):{};var s=Rf(i,"background",mp),r=Rf(i,"text",Ef),n=Rf(i,"icon",Mf),h=Rf(i,"action",Mf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Df(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Df(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Df(this.getChildren(),"setDisableState",t),this}}var Df=function(t,e,i){for(var s=0,r=t.length;s * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const eg=Phaser.Display.Canvas.CanvasPool;var ig=function(t){var e=eg.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return eg.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;if(h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,eg.remove(e),a;var d,c,u=i.getImageData(0,0,o,l).data,p=u.length,g=4*o,v=0,f=!1;for(d=0;dh;d--){for(c=0;c0&&this.wrapMode!==Tl&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Rl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=rg(t,l,d);else{var u=sg(t,l,d);c&&(u=c(u)),this[o]=u}}var p=rg(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=rg(t,"fill",null);null!==g&&(this.color=ud(g));var v=rg(t,"metrics",!1);return v?this.metrics={ascent:rg(v,"ascent",0),descent:rg(v,"descent",0),fontSize:rg(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=ig(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=ig(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=rg(t,"fontFamily","Courier"),this.fontSize=rg(t,"fontSize","16px"),this.fontStyle=rg(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ud(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ud(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ud(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ud(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ud(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ud(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ud(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Rl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=rg(e,"fontFamily",this.fontFamily),this.fontSize=rg(e,"fontSize",this.fontSize),this.fontStyle=rg(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var ag={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Od(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const og=Phaser.Utils.Objects.GetValue,hg=Ol,lg=kl;class dg{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=og(t,"text",""),this.x=og(t,"x",0),this.y=og(t,"y",0),this.width=og(t,"width",0);var e=og(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=og(t,"newLineMode",0),this.startIndex=og(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===lg&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==hg&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===lg&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const cg=Phaser.Utils.Objects.GetFastValue,ug=Ol,pg=Pl;class gg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=cg(t,"tagToText",Rr),this.tagToTextScope=cg(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var vg={};const fg=Phaser.Geom.Rectangle;var mg=new Ec;class yg{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Lg(v)){""!==b?a.push(n.getLine(b,x,kg)):0===C&&r>0&&a.push(n.getLine("",0,kg)),a.push(...Eg(v,e,_g,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,kg)),b=v,x=f,h=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Rg=function(t,e){var i;switch(e){case Tg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Ag&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new gg({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Vv(this.sizerChildren,null),Ch.call(this,t),this}},Hv={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,Vv(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Kv={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=En.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Vv(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Vv(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Jv=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const qv=Phaser.Utils.Objects.IsPlainObject,Qv=Phaser.Utils.Objects.GetValue;class tf extends oh{constructor(t,e,i,s,r,n,a,o,h,l){qv(e)?(e=Qv(l=e,"x",0),i=Qv(l,"y",0),s=Qv(l,"width",void 0),r=Qv(l,"height",void 0),n=Qv(l,"column",l.col||0),a=Qv(l,"row",0),o=Qv(l,"columnProportions",0),h=Qv(l,"rowProportions",0)):qv(s)?(s=Qv(l=s,"width",void 0),r=Qv(l,"height",void 0),n=Qv(l,"column",l.col||0),a=Qv(l,"row",0),o=Qv(l,"columnProportions",0),h=Qv(l,"rowProportions",0)):qv(n)?(n=Qv(l=n,"column",l.col||0),a=Qv(l,"row",0),o=Qv(l,"columnProportions",0),h=Qv(l,"rowProportions",0)):qv(o)&&(o=Qv(l=o,"columnProportions",0),h=Qv(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Qv(l,"createCellContainerCallback")),this.setIndentLeft(Qv(l,"space.indentLeftOdd",0),Qv(l,"space.indentLeftEven",0)),this.setIndentTop(Qv(l,"space.indentTopOdd",0),Qv(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,Qv(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Zv.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Jv.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(tf.prototype,Kv);const ef=Phaser.Utils.Objects.GetValue,sf=Phaser.Math.Percent;var rf=function(t,e,i){var s;return t.y===e.y?s=sf(i.x,t.x,e.x):t.x===e.x&&(s=sf(i.y,t.y,e.y)),s},nf=function(t,e,i){var s,r;this.enable&&(af.x=e,af.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=rf(s,r,af))},af={},of=function(t,e,i){if(this.enable&&t.isDown){var s,r;hf.x=t.worldX,hf.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=rf(s,r,hf);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},hf={},lf=function(t,e){void 0===e&&(e=df);var i=this.childrenMap.thumb,s=i.x,r=i.y;return en(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},df={};const cf=Phaser.Display.Align.LEFT_CENTER,uf=Phaser.Display.Align.TOP_CENTER;var pf={};const gf=Phaser.Display.Align.RIGHT_CENTER,vf=Phaser.Display.Align.BOTTOM_CENTER;var ff={};const mf=Phaser.Math.Linear;var yf={};const bf=Phaser.Display.Align.LEFT_CENTER,xf=Phaser.Display.Align.TOP_CENTER,Cf=Phaser.Display.Align.RIGHT_CENTER,wf=Phaser.Display.Align.BOTTOM_CENTER,Sf=Phaser.Utils.Objects.GetValue,Of=Phaser.Utils.Objects.IsPlainObject,kf=Phaser.Math.Clamp,Pf=Phaser.Math.Snap.To;class Tf extends(Au(Ah)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Sf(e,"reverseAxis",!1);var i=Sf(e,"background",void 0),s=Sf(e,"track",void 0),r=Sf(e,"indicator",void 0),n=Sf(e,"thumb",void 0);if(i&&(Of(i)&&(i=Gp(t,i)),this.addBackground(i)),s&&(Of(s)&&(s=Gp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Of(r)&&(r=Gp(t,r)),this.pin(r)),n){Of(n)&&(n=Gp(t,n)),this.pin(n);var a=Sf(e,"thumbOffsetX",0),o=Sf(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=Sf(e,"input",0);switch("string"==typeof h&&(h=_f[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",nf,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",of,this).on("pointermove",of,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Sf(e,"enable",void 0));var l=Sf(e,"tick",void 0);void 0===l&&(l=Sf(e,"gap",void 0)),this.setGap(l),this.setValue(Sf(e,"value",0),Sf(e,"min",void 0),Sf(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Pf(t,this.gap));var e=this._value;this._value=kf(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const _f={pan:0,drag:0,click:1,none:-1};var Mf={getStartPoint:function(t){if(void 0===t&&(t=pf),this.childrenMap.thumb){var e=0===this.orientation?cf:uf;lf.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=ff),this.childrenMap.thumb){var e=0===this.orientation?gf:vf;lf.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=yf),s.x=mf(e.x,i.x,t),s.y=mf(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o,h=p(a);if(n)o=a.x-h*a.originX,i=this.right-o;else i=(o=a.x-h*a.originX)+h-this.left}else{var l,d=g(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Wn(e,i,s),r=n?0===this.orientation?Cf:wf:0===this.orientation?bf:xf,tn(e,this,r),this.resetChildPositionState(e)}};Object.assign(Tf.prototype,Mf);const Ef=Phaser.Utils.Objects.GetValue;class Rf extends Ah{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Ef(e,"background",void 0),n=Ef(e,"buttons",void 0),a=Ef(n,"top",Ef(n,"left",void 0)),o=Ef(n,"bottom",Ef(n,"right",void 0)),h=Ef(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Ao(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,s=0===this.orientation?void 0===Ef(h,"width",void 0)?1:0:void 0===Ef(h,"height",void 0)?1:0,i=new Tf(t,h),t.add.existing(i),this.add(i,{proportion:s}));o&&(this.add(o),new Ao(o).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,o];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Ef(e,"valuechangeCallback",null);if(null!==d){var c=Ef(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Ef(e,"enable",void 0)),this.setValue(Ef(e,"value",0)),this.setScrollStep(Ef(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class Lf extends N{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Df=Phaser.Utils.Objects.GetValue,Af=Phaser.Math.Distance.Between;class Bf extends l{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Df(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Df(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Df(t,"enable",!0)),this.holdThreshold=Df(t,"holdThreshold",50),this.pointerOutReleaseEnable=Df(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dt(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Af(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!R(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!R(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const jf=Phaser.Utils.Objects.GetValue;class Wf{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(jf(t,"value",0)),this.setSpeed(jf(t,"speed",0)),this.setAcceleration(jf(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class zf{constructor(){this.value,this.dir,this.movement=new Wf}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Ff={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Vf=Phaser.Utils.Objects.GetValue;class Gf extends l{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Vf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Vf(e,"speed",.1)),this.setEnable(Vf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Vf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||R(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Hf=Phaser.Utils.Objects.GetValue;var Uf=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?Hf(s,l,void 0):Hf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Gi(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Rf(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Hf(r,"tickLength",void 0);var p=Hf(r,"position",0);"string"==typeof p&&(p=Nf[p]);var g,v,f=Hf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Hf(s,"space.slider",void 0))&&(o?f=0:g=Hf(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:Hf(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:Hf(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:Hf(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:Hf(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Hf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Hf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Hf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Hf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Hf(s,"scrollDetectionMode");"string"==typeof b&&(b=$f[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?Hf(s,x,!0):Hf(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Xf(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,w,S,O,k,P=Hf(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&h&&(void 0!==b&&(P.focus=1===b?2:0),C=new Gf(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(w=a?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(o?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const Nf={right:0,left:1,bottom:0,top:1},$f={gameObject:0,rectBounds:1},Kf=Phaser.Utils.Objects.GetValue;var Zf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Kf(e,"width"),a=Kf(e,"height");n||Kf(e,"child.expandWidth",!0)||(s[1]=0),a||Kf(e,"child.expandHeight",!0)||(r[1]=0);var o=new tf(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=ef(i,"child"),r=ef(s,"gameObject",void 0);if(r){var n=ef(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=ef(n,"top",0),a.bottom=ef(n,"bottom",0),o.left=ef(n,"left",0),o.right=ef(n,"right",0);break;case 1:a.top=ef(n,"left",0),a.bottom=ef(n,"right",0),o.top=ef(n,"top",0),o.bottom=ef(n,"bottom",0);break;default:a.top=ef(n,"top",0),a.bottom=ef(n,"bottom",0),a.left=ef(n,"left",0),a.right=ef(n,"right",0)}e.add(r,{column:1,row:1,align:ef(s,"align","center"),padding:o,expand:{width:ef(s,"expandWidth",!0),height:ef(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Uf(t,o,"y",e);break;case 1:Uf(t,o,"x",e);break;default:Uf(t,o,"y",e),Uf(t,o,"x",e)}return o},Jf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},qf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Qf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(nm.call(this,-this.textOY)),0),e=am.call(this,t)+this.textOY,i=om.call(this,t);return function(t,e){switch(bl(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,hm.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,An.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,dm.call(this,t,n,a),en(t,s,r,n,a,e.align),e.preOffsetY=0,hm.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const um=Phaser.Utils.Objects.IsPlainObject,pm=Phaser.Utils.Objects.GetValue,gm=Phaser.Display.Align.TOP_LEFT;class vm extends oh{constructor(t,e,i,s,r,n){um(e)?(e=pm(n=e,"x",0),i=pm(n,"y",0),s=pm(n,"width",void 0),r=pm(n,"height",void 0)):um(s)&&(s=pm(n=s,"width",void 0),r=pm(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=pm(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(pm(n,"clampTextOY",!0)),this.alwaysScrollable=pm(n,"alwaysScrollable",!1);var a=pm(n,"background",void 0),o=pm(n,"text",void 0);void 0===o&&(o=fm(t)),this.textCropEnable=pm(n,"textCrop",!!o.setCrop);var h=pm(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=gm,l.padding=dn(0),l.expand=!0,this.textObject=o,this.textObjectType=bl(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=gl.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(nm.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=am.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var fm=function(t){return t.add.text(0,0,"")};Object.assign(vm.prototype,cm);var mm={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},ym={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const bm=Phaser.Utils.Objects.GetValue;class xm extends sm{constructor(t,e){void 0===e&&(e={});var i=bm(e,"text",void 0),s=bm(e,"textWidth",void 0),r=bm(e,"textHeight",void 0),n=bm(e,"textCrop",!!i.setCrop),a=bm(e,"textMask",!n),o=bm(e,"content",""),h=new vm(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:bm(e,"clampChildOY",!1),alwaysScrollable:bm(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=bm(e,"space",void 0);l&&(l.child=bm(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(xm.prototype,mm,ym);const Cm=Phaser.Utils.Objects.GetValue;var wm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Ev(t,e);break;case"bbcodetext":case"bbcode":s=new Pv(t,0,0,"",e);break;case"label":s=new Rv(t,e);break;case"textarea":s=function(t,e,i){e=e?We(e):{};var s=Cm(i,"background",Gp),r=Cm(i,"text",wm),n=Cm(i,"track",Gp),a=Cm(i,"thumb",Gp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new xm(t,e);return t.add.existing(h),h}(t,e);break;default:s=new Np(t,e)}return Vp(s,e),t.add.existing(s),s},Sm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Xp(t,e):new bp(t,e);break;case"roundRectangle":s=new bu(t,e);break;default:s=new Sp(t,e)}return Vp(s,e),t.add.existing(s),s};const Om=Phaser.Utils.Objects.GetValue;var km=function(t,e,i){e=e?We(e):{};var s=Om(i,"background",Gp),r=Om(i,"text",wm),n=Om(i,"icon",Sm),a=Om(i,"action",Sm);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};class Pm extends Hc{constructor(t,e){super(t,e=km(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?We(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Tm=Phaser.Math.Linear;var _m=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Tm(b.a.x,x.a.x,C),e=Tm(b.a.y,x.a.y,C),i=Tm(b.b.x,x.b.x,C),s=Tm(b.b.y,x.b.y,C),r=Tm(b.c.x,x.c.x,C),n=Tm(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Mm=(0,Phaser.Math.DegToRad)(120);var Em=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Mm),i+s*Math.sin(r+Mm)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Mm),i+s*Math.sin(r-Mm)),this.arrowOnly?t.end():t.close()},Rm={buildShapes(){this.addShape((new ap).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?_m.call(this):Em.call(this)}},Lm={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new La(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Dm=Phaser.Utils.Objects.GetValue,Am=Phaser.Utils.Objects.IsPlainObject,Bm=Phaser.Math.DegToRad,jm=Phaser.Math.RadToDeg;class Wm extends Pu{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Am(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Ym(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Dm(r,"x",null);null!==n?(t=n,i=n):(t=Dm(r,"left",0),i=Dm(r,"right",t));var a=Dm(r,"y",null);null!==a?(e=a,s=a):(e=Dm(r,"top",0),s=Dm(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return jm(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Bm(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const zm={right:0,down:1,left:2,up:3};var Ym=function(t){return"string"==typeof t&&(t=zm[t]),t%=4};Object.assign(Wm.prototype,Rm,Lm);class Im extends Pm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new Wm(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} + */const eg=Phaser.Display.Canvas.CanvasPool;var ig=function(t){var e=eg.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return eg.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;if(h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,eg.remove(e),a;var d,c,u=i.getImageData(0,0,o,l).data,p=u.length,g=4*o,v=0,f=!1;for(d=0;dh;d--){for(c=0;c0&&this.wrapMode!==Tl&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Rl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=rg(t,l,d);else{var u=sg(t,l,d);c&&(u=c(u)),this[o]=u}}var p=rg(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=rg(t,"fill",null);null!==g&&(this.color=ud(g));var v=rg(t,"metrics",!1);return v?this.metrics={ascent:rg(v,"ascent",0),descent:rg(v,"descent",0),fontSize:rg(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=ig(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=ig(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=rg(t,"fontFamily","Courier"),this.fontSize=rg(t,"fontSize","16px"),this.fontStyle=rg(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=ud(t,this.parent.canvas,this.parent.context),this.backgroundColor2=ud(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=ud(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=ud(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=ud(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=ud(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=ud(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=ud(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Rl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=rg(e,"fontFamily",this.fontFamily),this.fontSize=rg(e,"fontSize",this.fontSize),this.fontStyle=rg(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var ag={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Od(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const og=Phaser.Utils.Objects.GetValue,hg=Ol,lg=kl;class dg{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=og(t,"text",""),this.x=og(t,"x",0),this.y=og(t,"y",0),this.width=og(t,"width",0);var e=og(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=og(t,"newLineMode",0),this.startIndex=og(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===lg&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==hg&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===lg&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const cg=Phaser.Utils.Objects.GetFastValue,ug=Ol,pg=Pl;class gg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=cg(t,"tagToText",Rr),this.tagToTextScope=cg(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var vg={};const fg=Phaser.Geom.Rectangle;var mg=new Ec;class yg{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Dg(v)){""!==b?a.push(n.getLine(b,x,Pg)):0===C&&r>0&&a.push(n.getLine("",0,Pg)),a.push(...Rg(v,e,Mg,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,Pg)),b=v,x=f,h=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Lg=function(t,e){var i;switch(e){case _g:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Bg&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new gg({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Gv(this.sizerChildren,null),Ch.call(this,t),this}},Uv={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,Gv(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Zv={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=En.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Gv(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Gv(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},qv=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Qv=Phaser.Utils.Objects.IsPlainObject,tf=Phaser.Utils.Objects.GetValue;class ef extends oh{constructor(t,e,i,s,r,n,a,o,h,l){Qv(e)?(e=tf(l=e,"x",0),i=tf(l,"y",0),s=tf(l,"width",void 0),r=tf(l,"height",void 0),n=tf(l,"column",l.col||0),a=tf(l,"row",0),o=tf(l,"columnProportions",0),h=tf(l,"rowProportions",0)):Qv(s)?(s=tf(l=s,"width",void 0),r=tf(l,"height",void 0),n=tf(l,"column",l.col||0),a=tf(l,"row",0),o=tf(l,"columnProportions",0),h=tf(l,"rowProportions",0)):Qv(n)?(n=tf(l=n,"column",l.col||0),a=tf(l,"row",0),o=tf(l,"columnProportions",0),h=tf(l,"rowProportions",0)):Qv(o)&&(o=tf(l=o,"columnProportions",0),h=tf(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(tf(l,"createCellContainerCallback")),this.setIndentLeft(tf(l,"space.indentLeftOdd",0),tf(l,"space.indentLeftEven",0)),this.setIndentTop(tf(l,"space.indentTopOdd",0),tf(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,tf(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Jv.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=qv.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(ef.prototype,Zv);const sf=Phaser.Utils.Objects.GetValue,rf=Phaser.Math.Percent;var nf=function(t,e,i){var s;return t.y===e.y?s=rf(i.x,t.x,e.x):t.x===e.x&&(s=rf(i.y,t.y,e.y)),s},af=function(t,e,i){var s,r;this.enable&&(of.x=e,of.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=nf(s,r,of))},of={},hf=function(t,e,i){if(this.enable&&t.isDown){var s,r;lf.x=t.worldX,lf.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=nf(s,r,lf);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},lf={},df=function(t,e){void 0===e&&(e=cf);var i=this.childrenMap.thumb,s=i.x,r=i.y;return en(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},cf={};const uf=Phaser.Display.Align.LEFT_CENTER,pf=Phaser.Display.Align.TOP_CENTER;var gf={};const vf=Phaser.Display.Align.RIGHT_CENTER,ff=Phaser.Display.Align.BOTTOM_CENTER;var mf={};const yf=Phaser.Math.Linear;var bf={};const xf=Phaser.Display.Align.LEFT_CENTER,Cf=Phaser.Display.Align.TOP_CENTER,wf=Phaser.Display.Align.RIGHT_CENTER,Sf=Phaser.Display.Align.BOTTOM_CENTER,Of=Phaser.Utils.Objects.GetValue,kf=Phaser.Utils.Objects.IsPlainObject,Pf=Phaser.Math.Clamp,Tf=Phaser.Math.Snap.To;class _f extends(Au(Ah)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Of(e,"reverseAxis",!1);var i=Of(e,"background",void 0),s=Of(e,"track",void 0),r=Of(e,"indicator",void 0),n=Of(e,"thumb",void 0);if(i&&(kf(i)&&(i=Gp(t,i)),this.addBackground(i)),s&&(kf(s)&&(s=Gp(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(kf(r)&&(r=Gp(t,r)),this.pin(r)),n){kf(n)&&(n=Gp(t,n)),this.pin(n);var a=Of(e,"thumbOffsetX",0),o=Of(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=Of(e,"input",0);switch("string"==typeof h&&(h=Mf[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",af,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",hf,this).on("pointermove",hf,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Of(e,"enable",void 0));var l=Of(e,"tick",void 0);void 0===l&&(l=Of(e,"gap",void 0)),this.setGap(l),this.setValue(Of(e,"value",0),Of(e,"min",void 0),Of(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Tf(t,this.gap));var e=this._value;this._value=Pf(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const Mf={pan:0,drag:0,click:1,none:-1};var Ef={getStartPoint:function(t){if(void 0===t&&(t=gf),this.childrenMap.thumb){var e=0===this.orientation?uf:pf;df.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=mf),this.childrenMap.thumb){var e=0===this.orientation?vf:ff;df.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=bf),s.x=yf(e.x,i.x,t),s.y=yf(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o,h=p(a);if(n)o=a.x-h*a.originX,i=this.right-o;else i=(o=a.x-h*a.originX)+h-this.left}else{var l,d=g(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Wn(e,i,s),r=n?0===this.orientation?wf:Sf:0===this.orientation?xf:Cf,tn(e,this,r),this.resetChildPositionState(e)}};Object.assign(_f.prototype,Ef);const Rf=Phaser.Utils.Objects.GetValue;class Lf extends Ah{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Rf(e,"background",void 0),n=Rf(e,"buttons",void 0),a=Rf(n,"top",Rf(n,"left",void 0)),o=Rf(n,"bottom",Rf(n,"right",void 0)),h=Rf(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Ao(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,s=0===this.orientation?void 0===Rf(h,"width",void 0)?1:0:void 0===Rf(h,"height",void 0)?1:0,i=new _f(t,h),t.add.existing(i),this.add(i,{proportion:s}));o&&(this.add(o),new Ao(o).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,o];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Rf(e,"valuechangeCallback",null);if(null!==d){var c=Rf(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Rf(e,"enable",void 0)),this.setValue(Rf(e,"value",0)),this.setScrollStep(Rf(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class Df extends N{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Af=Phaser.Utils.Objects.GetValue,Bf=Phaser.Math.Distance.Between;class jf extends l{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Af(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Af(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Af(t,"enable",!0)),this.holdThreshold=Af(t,"holdThreshold",50),this.pointerOutReleaseEnable=Af(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dt(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Bf(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!R(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!R(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Wf=Phaser.Utils.Objects.GetValue;class zf{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Wf(t,"value",0)),this.setSpeed(Wf(t,"speed",0)),this.setAcceleration(Wf(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Yf{constructor(){this.value,this.dir,this.movement=new zf}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Vf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Gf=Phaser.Utils.Objects.GetValue;class Hf extends l{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Gf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Gf(e,"speed",.1)),this.setEnable(Gf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Gf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||R(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Uf=Phaser.Utils.Objects.GetValue;var Nf=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?Uf(s,l,void 0):Uf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Gi(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Lf(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Uf(r,"tickLength",void 0);var p=Uf(r,"position",0);"string"==typeof p&&(p=$f[p]);var g,v,f=Uf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Uf(s,"space.slider",void 0))&&(o?f=0:g=Uf(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:Uf(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:Uf(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:Uf(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:Uf(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Uf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Uf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Uf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Uf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Uf(s,"scrollDetectionMode");"string"==typeof b&&(b=Kf[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?Uf(s,x,!0):Uf(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Ff(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,w,S,O,k,P=Uf(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&h&&(void 0!==b&&(P.focus=1===b?2:0),C=new Hf(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(w=a?"t":"s",O=`scroll${i}`):(w="t",O="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),y&&(o?(S=`childO${i}`,O=`scroll${i}`):(S="childOY",O="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),C&&(k=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[k](-e,!0)})))};const $f={right:0,left:1,bottom:0,top:1},Kf={gameObject:0,rectBounds:1},Zf=Phaser.Utils.Objects.GetValue;var Jf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Zf(e,"width"),a=Zf(e,"height");n||Zf(e,"child.expandWidth",!0)||(s[1]=0),a||Zf(e,"child.expandHeight",!0)||(r[1]=0);var o=new ef(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=sf(i,"child"),r=sf(s,"gameObject",void 0);if(r){var n=sf(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=sf(n,"top",0),a.bottom=sf(n,"bottom",0),o.left=sf(n,"left",0),o.right=sf(n,"right",0);break;case 1:a.top=sf(n,"left",0),a.bottom=sf(n,"right",0),o.top=sf(n,"top",0),o.bottom=sf(n,"bottom",0);break;default:a.top=sf(n,"top",0),a.bottom=sf(n,"bottom",0),a.left=sf(n,"left",0),a.right=sf(n,"right",0)}e.add(r,{column:1,row:1,align:sf(s,"align","center"),padding:o,expand:{width:sf(s,"expandWidth",!0),height:sf(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:Nf(t,o,"y",e);break;case 1:Nf(t,o,"x",e);break;default:Nf(t,o,"y",e),Nf(t,o,"x",e)}return o},qf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Qf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},tm=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(am.call(this,-this.textOY)),0),e=om.call(this,t)+this.textOY,i=hm.call(this,t);return function(t,e){switch(bl(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,lm.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,An.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,cm.call(this,t,n,a),en(t,s,r,n,a,e.align),e.preOffsetY=0,lm.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const pm=Phaser.Utils.Objects.IsPlainObject,gm=Phaser.Utils.Objects.GetValue,vm=Phaser.Display.Align.TOP_LEFT;class fm extends oh{constructor(t,e,i,s,r,n){pm(e)?(e=gm(n=e,"x",0),i=gm(n,"y",0),s=gm(n,"width",void 0),r=gm(n,"height",void 0)):pm(s)&&(s=gm(n=s,"width",void 0),r=gm(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=gm(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(gm(n,"clampTextOY",!0)),this.alwaysScrollable=gm(n,"alwaysScrollable",!1);var a=gm(n,"background",void 0),o=gm(n,"text",void 0);void 0===o&&(o=mm(t)),this.textCropEnable=gm(n,"textCrop",!!o.setCrop);var h=gm(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=vm,l.padding=dn(0),l.expand=!0,this.textObject=o,this.textObjectType=bl(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=gl.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(am.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=om.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var mm=function(t){return t.add.text(0,0,"")};Object.assign(fm.prototype,um);var ym={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},bm={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const xm=Phaser.Utils.Objects.GetValue;class Cm extends rm{constructor(t,e){void 0===e&&(e={});var i=xm(e,"text",void 0),s=xm(e,"textWidth",void 0),r=xm(e,"textHeight",void 0),n=xm(e,"textCrop",!!i.setCrop),a=xm(e,"textMask",!n),o=xm(e,"content",""),h=new fm(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:xm(e,"clampChildOY",!1),alwaysScrollable:xm(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=xm(e,"space",void 0);l&&(l.child=xm(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Cm.prototype,ym,bm);const wm=Phaser.Utils.Objects.GetValue;var Sm=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Rv(t,e);break;case"bbcodetext":case"bbcode":s=new Tv(t,0,0,"",e);break;case"label":s=new Lv(t,e);break;case"textarea":s=function(t,e,i){e=e?We(e):{};var s=wm(i,"background",Gp),r=wm(i,"text",Sm),n=wm(i,"track",Gp),a=wm(i,"thumb",Gp);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Cm(t,e);return t.add.existing(h),h}(t,e);break;default:s=new Np(t,e)}return Vp(s,e),t.add.existing(s),s},Om=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Xp(t,e):new bp(t,e);break;case"roundRectangle":s=new bu(t,e);break;default:s=new Sp(t,e)}return Vp(s,e),t.add.existing(s),s};const km=Phaser.Utils.Objects.GetValue;var Pm=function(t,e,i){e=e?We(e):{};var s=km(i,"background",Gp),r=km(i,"text",Sm),n=km(i,"icon",Om),a=km(i,"action",Om);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};class Tm extends Hc{constructor(t,e){super(t,e=Pm(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?We(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const _m=Phaser.Math.Linear;var Mm=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=_m(b.a.x,x.a.x,C),e=_m(b.a.y,x.a.y,C),i=_m(b.b.x,x.b.x,C),s=_m(b.b.y,x.b.y,C),r=_m(b.c.x,x.c.x,C),n=_m(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Em=(0,Phaser.Math.DegToRad)(120);var Rm=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Em),i+s*Math.sin(r+Em)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Em),i+s*Math.sin(r-Em)),this.arrowOnly?t.end():t.close()},Lm={buildShapes(){this.addShape((new ap).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Mm.call(this):Rm.call(this)}},Dm={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new La(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Am=Phaser.Utils.Objects.GetValue,Bm=Phaser.Utils.Objects.IsPlainObject,jm=Phaser.Math.DegToRad,Wm=Phaser.Math.RadToDeg;class zm extends Pu{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Bm(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Im(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Am(r,"x",null);null!==n?(t=n,i=n):(t=Am(r,"left",0),i=Am(r,"right",t));var a=Am(r,"y",null);null!==a?(e=a,s=a):(e=Am(r,"top",0),s=Am(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Wm(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=jm(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Ym={right:0,down:1,left:2,up:3};var Im=function(t){return"string"==typeof t&&(t=Ym[t]),t%=4};Object.assign(zm.prototype,Lm,Dm);class Xm extends Tm{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new zm(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var Xm=function(t,e){var i=Gi(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},Fm=function(t,e,i){return Gp(t,Xm(e,i))};class Vm extends Za{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Gm={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Hm=function(t,e){ea.popUp.call(t,e,this.expandDirection)},Um=function(t,e){ea.scaleDown.call(t,e,this.expandDirection)},Nm={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Hm.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Um.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const $m=Phaser.Utils.Objects.GetValue;let Km=class extends Ah{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=$m(e,"space"),a=1===this.orientation?"left":"top",o=$m(e,"align.title",a),h=$m(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:$m(n,"titleLeft",0),right:$m(n,"titleRight",0),top:$m(n,"titleTop",0),bottom:$m(n,"titleBottom",0)}});var l=$m(e,"toggleByTarget",void 0),d=$m(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&Oo.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Vm(r),!$m(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=$m(e,"align.child","left");var u=(h=$m(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:o,expand:h,padding:{left:$m(n,"childLeft",0),right:$m(n,"childRight",0),top:$m(n,"childTop",0),bottom:$m(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration($m(p,"duration",200)),this.setExpandCallback($m(p,"expandCallback",void 0)),this.setCollapseCallback($m(p,"collapseCallback",void 0)),this.reLayoutTarget=$m(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var v=e.onExpandComplete;v&&this.on("expand.complete",v);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=$m(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(Km.prototype,Gm,Nm);var Zm={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},Jm={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class qm extends Km{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(qm.prototype,Zm,Jm);const Qm=Phaser.Utils.Objects.GetValue,ty=Phaser.Utils.Objects.GetValue,ey=Ah.prototype.add,iy=Ah.prototype.addSpace;var sy=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)&&iy.call(this),ey.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&iy.call(this),this.hasTailSpace=s}else ey.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;ey.call(this,t,{index:r,proportion:i,expand:!0})}else ey.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},ry={addButton(t){if(uo(t))for(var e=t,i=0,s=e.length;i=0;i--)oy.call(this,e[i],t);return this}},ly=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},dy=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,ly.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},cy={add(t){return this.buttons.push(t),t._click||(t._click=new wo(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),dy.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&Sy.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)_y.call(this,e[i],t);return this}};const Ey=Phaser.Utils.Objects.GetValue;class Ry extends Jh{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new yy({parent:this,eventEmitter:Ey(e,"eventEmitter",this),groupName:Ey(e,"groupName",void 0),clickConfig:Ey(e,"click",void 0)}).setButtonsType(e);var s=Ey(e,"background",void 0),r=Ey(e,"buttons",void 0);this.buttonsAlign=Ey(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ry.prototype,ky,My,my,xy);var Ly=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Dy[i])}void 0===s?s={}:!0===s&&(s=Ay);var n=e.width/t.width,a=e.height/t.height,o=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*o,s.height=t.height*o,s};const Dy={fit:0,FIT:0,envelop:1,ENVELOP:1};var Ay={},By={},jy={};const Wy=Phaser.Utils.Objects.IsPlainObject,zy=Phaser.Utils.Objects.GetValue,Yy=Phaser.Display.Align.CENTER,Iy=Phaser.Utils.String.UUID;var Xy={add:function(t,e,i,s,r,n,a,o,h,l){var d,c;un.call(this,t),Wy(e)&&(e=zy(u=e,"key",void 0),i=zy(u,"align",Yy),s=zy(u,"padding",0),r=zy(u,"expand",!0),t.isRexSizer||(n=zy(u,"minWidth",t._minWidth),a=zy(u,"minHeight",t._minHeighted)),o=zy(u,"offsetX",0),h=zy(u,"offsetY",0),d=zy(u,"offsetOriginX",0),c=zy(u,"offsetOriginY",0),l=zy(u,"aspectRatio",0));var u,v=void 0!==e;return v||(e=Iy()),"string"==typeof i&&(i=Er[i]),void 0===i&&(i=Yy),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===o&&(o=0),void 0===h&&(h=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=p(t)/g(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=dn(s),Wy(r)?(u.expandWidth=zy(r,"width",!1),u.expandHeight=zy(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?p(t):n),u.expandHeight&&(t.minHeight=void 0===a?g(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,v&&this.addChildrenMap(e,t),this}},Fy={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),bn.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Ch.call(this,t),this}},Vy={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,d,c,u=this.innerLeft,v=this.innerTop,f=this.innerWidth,m=this.innerHeight,y=this.sizerChildren;for(var b in y)(t=y[b]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mo.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(By.width=e.aspectRatio,By.height=1,jy.width=l,jy.height=d,l=(c=Ly(By,jy,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),hh(t,this)):Wn(t,l,d),s=u+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=v+i.top*this.scaleY,a=m-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=p(t)),void 0===d&&(d=g(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yo.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(Vy,Xy,Fy);const Gy=Phaser.Utils.Objects.IsPlainObject,Hy=Phaser.Utils.Objects.GetValue;class Uy extends oh{constructor(t,e,i,s,r,n){Gy(e)?(e=Hy(n=e,"x",0),i=Hy(n,"y",0),s=Hy(n,"width",void 0),r=Hy(n,"height",void 0)):Gy(s)&&(s=Hy(n=s,"width",void 0),r=Hy(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Uy.prototype,Vy);const Ny=Uy.prototype.add;var $y=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),Ny.call(this,t,e,i,s,r,n,a,o,h),this},Ky={add:$y,addPage:$y};const Zy=ss.prototype.setChildVisible;var Jy={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(Zy.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(Zy.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(Jy,Ky);const qy=Phaser.Utils.Objects.GetValue;class Qy extends Uy{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(qy(e,"swapMode",0)),this.setFadeInDuration(qy(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=tb[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(Qy.prototype,Jy);const tb={invisible:0,destroy:1},eb=Phaser.Utils.Objects.IsPlainObject,ib=Phaser.Utils.Objects.GetValue,sb=Phaser.Utils.String.UUID;var rb={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},nb={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},ab={top:1,left:3,right:5,bottom:7},ob={top:"bottom",left:"right",right:"left",bottom:"top"},hb={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},lb={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Tb=Phaser.Utils.Objects.GetValue;class _b extends Ah{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Tb(e,"background",void 0),s=Tb(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Tb(e,"space.title",0)}});var r=Tb(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(_b.prototype,kb,Pb);const Mb=Phaser.Utils.Objects.GetValue,Eb=Phaser.Utils.Objects.GetValue;var Rb=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Lb=Phaser.Geom.Intersects.RectangleToRectangle,Db=Phaser.Geom.Rectangle.Overlaps;var Ab=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Bb=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},jb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Wb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},zb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Yb=Phaser.Utils.Objects.GetValue,Ib={update:0,everyTick:1};var Xb={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Yb(t,"updateMode",0)),this.enableChildrenMask(Yb(t,"padding",0)),this.setMaskLayer(Yb(t,"layer",void 0)),this.onMaskGameObjectVisible=Yb(t,"onVisible"),this.onMaskGameObjectInvisible=Yb(t,"onInvisible"),this.maskGameObjectCallbackScope=Yb(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Ib[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=gl.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,d=t.getBounds(),c=Rb(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Ub.prototype,Fb);const Nb=["top","bottom","centerY","center"],$b=["left","right","centerX","center"];var Kb=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=Nb.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=$b.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Zb=Phaser.Utils.Objects.GetValue;class Jb extends sm{constructor(t,e){void 0===e&&(e={});var i=Av(e),s=Zb(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Zb(e,"clampChildOY",!1),s.clampChildOX=Zb(e,"clampChildOX",!1);var r,n,a=new Ub(t,s);switch(t.add.existing(a),i){case 0:r=Zb(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Zb(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Zb(e,"align.panel","center")};var o=Zb(e,"space",void 0);o&&(o.child=Zb(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),rh(this.childrenMap.child,t),this}}var qb={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Kb.call(this,t,"y",e);break;case 1:Kb.call(this,t,"x",e);break;default:Kb.call(this,t,"y",e),Kb.call(this,t,"x",e)}return this}};Object.assign(Jb.prototype,qb);var Qb={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},tx={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class ex extends Jb{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(ex.prototype,Qb,tx);const ix=Phaser.Utils.Objects.GetValue,sx=Phaser.Utils.Objects.GetValue,rx=Phaser.Utils.Objects.GetValue;var nx={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=rx(t,"onGetValue"),this.onSetValue=rx(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},ax={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},ox={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const hx=Phaser.Utils.Objects.GetValue;class lx extends Ah{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=hx(e,"proportion.title",0),o=hx(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=hx(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(lx.prototype,nx,ax,ox);var dx=function(t,e,i){var s=new Pm(t,i);return t.add.existing(s),s},cx=function(t){return void 0===t&&(t=Ah),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},ux=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=yx(this.styles,"inputRow")||{},r=mx(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Gp(t,Xm(e,i))}(this.scene,t,bx(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),xx(this,We(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Ix(this),Xx(this)),this}setNumberInput(){return this.onUpdateCallback=Yx,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Gx=Phaser.Utils.Objects.GetValue,Hx=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Ux=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Qx.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(tC(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const eC=new Qx,iC=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,sC=/\S/,rC=new Qx;rC.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!sC.test(t)&&!sC.test(e)},rC.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(hC(t,null,null,i),i," ")},oC.equals=function(t,e){return Qx.prototype.equals.call(oC,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const lC=new Qx;lC.tokenize=function(t){return t.slice()},lC.join=lC.removeEmpty=function(t){return t};const dC=Phaser.Utils.Array.Remove;var cC=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),dC(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,eC.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},fC={cursorMoveLeft(){if(!this.isOpened)return this;var t=pC(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=pC(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=gC(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=pC(vC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=gC(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=pC(vC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const mC=Phaser.Utils.Objects.IsPlainObject;class yC extends jc{constructor(t,e,i,s,r,n){mC(e)?n=e:mC(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Ux(e,"wrap.vAlign")||Xe(e,"wrap.vAlign",s=i?"center":"top"),Ux(e,"wrap.wrapMode")||Xe(e,"wrap.wrapMode","char"),Ux(e,"wrap.maxLines")||Xe(e,"wrap.maxLines",s=i?1:void 0),i&&Xe(e,"wrap.wrapWidth",1/0),Ux(e,"wrap.useDefaultTextHeight")||Xe(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Ux(e.edit,"inputType")){var s=i?"text":"textarea";Xe(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new $x(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=uu(n.background,"focus"),h=uu(n.style,"cursor"),l=uu(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Gx(e,"edit");return void 0===i&&(i={}),Px(e,i,Hx),new Vx(t,i)}(this,n),Kx.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),qx.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Zx.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),Xs(l)&&Object.assign(l,h),Jx.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=xC(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},wC={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},SC={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const OC=Phaser.Utils.Objects.GetValue;class kC extends sm{constructor(t,e){void 0===e&&(e={});var i,s=OC(e,"text");Ui(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new yC(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=OC(e,"space",void 0);h&&(h.child=OC(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=OC(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(kC.prototype,wC,SC);var PC={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?We(e):{}:e||(e={});var s=new kC(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},TC={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=xC(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const _C=Phaser.Utils.Objects.GetValue,MC=Phaser.Math.Linear,EC=Phaser.Math.Snap.Floor;var RC={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=_C(s,r),a=function(t,e){var i=new Tf(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=_C(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=xC(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=_C(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=MC(t.minValue,t.maxValue,a.value);t.step&&(e=EC(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},LC=function(t,e){var i=new wy(t,e);return t.add.existing(i),i};const DC=Phaser.Utils.Objects.GetValue;var AC={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=DC(e,"incDec")||{},r={text:null,action:null},n=LC(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=xC(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(We(r),s.incButton||{}),d=fb(i,l),c=Object.assign(We(r),s.decButton||{}),u=fb(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Tw(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const Mw=Phaser.Utils.Objects.GetValue;var Ew=function(t,e){var i=Mw(e,"expandDirection",void 0);"string"==typeof i&&(i=Rw[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Ux(s=e,r="alignTarget")?F(s,r):n&&Ux(s,n)?F(s,n):a&&Ux(s,a)?F(s,a):o),c=Mw(e,"alignTargetY",d),u=Mw(e,"alignOffsetX",0),p=Mw(e,"alignOffsetY",0),g=Mw(e,"alignSide","").includes("right"),v=Mw(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=le(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Rw={down:0,up:1},Lw=Phaser.Utils.Objects.GetValue;class Dw extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Kn(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Nn(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Ew(t,e),t.isRexSizer&&t.layout();var i=Lw(e,"touchOutsideClose",!1),s=Lw(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Aw={openColorPicker:function(){if(!this.colorPicker){var t=_w.call(this).layout(),e=new Dw(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Aw,$C);const Bw=Phaser.Utils.Objects.GetValue;class jw extends NC{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Bw(i,"width",160),Bw(i,"height",170));var n=Bw(i,"background");r=n?function(t){return Gp(t,n)}:Bw(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Bw(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Bw(i,"expandDirection")),this.setColorPickerEaseInDuration(Bw(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Bw(i,"easeOut",200)),this.setColorPickerTransitInCallback(Bw(i,"transitIn")),this.setColorPickerTransitOutCallback(Bw(i,"transitOut")),this.setColorPickerBounds(Bw(i,"bounds"));var a=Bw(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(Bw(o,"height",30)),this.setColorComponentsFormatLabelConfig(Bw(o,"formatLabel"));var h=Bw(o,"inputText");h||(h=Bw(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=Bw(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(jw.prototype,Aw);var Ww={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?We(e):{}:e||(e={});var s=new jw(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},zw={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Yw={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Iw={buildShapes(){this.addShape((new hp).setName("box")).addShape((new ap).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},Xw={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new La(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},Fw={};Object.assign(Fw,zw,Yw,Iw,Xw);const Vw=23730,Gw=Phaser.Utils.Objects.GetValue,Hw=Phaser.Utils.Objects.IsPlainObject;class Uw extends Pu{constructor(t,e,i,s,r,n,a){Hw(e)?(e=Gw(a=e,"x",0),i=Gw(a,"y",0),s=Gw(a,"width",2),r=Gw(a,"height",2),n=Gw(a,"color",Vw)):Hw(n)&&(n=Gw(a=n,"color",Vw)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Vw),this.setBoxShape(Gw(a,"circleBox",!1)),this.setBoxFillStyle(n,Gw(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(Gw(a,"uncheckedColor",null),Gw(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(Gw(a,"boxLineWidth",4),Gw(a,"boxStrokeColor",n),Gw(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,Gw(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),Gw(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(Gw(a,"checkerColor",16777215),Gw(a,"checkerAlpha",1)),this.setBoxSize(Gw(a,"boxSize",1)),this.setCheckerSize(Gw(a,"checkerSize",1)),this.setCheckerAnimationDuration(Gw(a,"animationDuration",150)),this.buildShapes();var o=Gw(a,"checked");void 0===o&&(o=Gw(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(Uw.prototype,Fw);const Nw=Phaser.Utils.Objects.GetValue,$w=Phaser.Utils.Objects.IsPlainObject;class Kw extends Uw{constructor(t,e,i,s,r,n,a){$w(e)?(e=Nw(a=e,"x",0),i=Nw(a,"y",0),s=Nw(a,"width",2),r=Nw(a,"height",2),n=Nw(a,"color",Vw)):$w(n)&&(n=Nw(a=n,"color",Vw)),super(t,e,i,s,r,n,a),this._click=new wo(this,Nw(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Nw(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var Zw={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new Kw(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},Jw={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},qw={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},Qw={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},tS=function(t,e,i){return(e-t)*i+t};const eS=Phaser.Math.Linear;var iS={buildShapes(){this.addShape((new hp).setName("track")).addShape((new hp).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&tS(Gs(l),Gs(d),c))<<16|(255&tS(Hs(l),Hs(d),c))<<8|255&tS(Us(l),Us(d),c)),p=eS(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=eS(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},sS={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new La(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},rS={};Object.assign(rS,Jw,qw,Qw,iS,sS);const nS=Phaser.Utils.Objects.GetValue,aS=Phaser.Utils.Objects.IsPlainObject,oS=23730;class hS extends Pu{constructor(t,e,i,s,r,n,a){aS(e)?(e=nS(a=e,"x",0),i=nS(a,"y",0),s=nS(a,"width",2),r=nS(a,"height",2),n=nS(a,"color",oS)):aS(n)&&(n=nS(a=n,"color",oS)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=oS),this.setTrackFillStyle(n,nS(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(nS(a,"falseValueTrackColor",function(t){var e=.3*Gs(t)+.59*Hs(t)+.11*Us(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),nS(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(nS(a,"thumbColor",16777215),nS(a,"thumbAlpha",1)),this.setTrackSize(nS(a,"trackWidth",.9),nS(a,"trackHeight",.5)),this.setTrackRadius(nS(a,"trackRadius",.5*this.trackHeight));var o=nS(a,"thumbHeight",void 0),h=nS(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(nS(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(nS(a,"thumbLeft",.3),nS(a,"thumbRight",void 0)),this.setRTL(nS(a,"rtl",!1)),this.setToggleAnimationDuration(nS(a,"animationDuration",150)),this.buildShapes(),this.setValue(nS(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(hS.prototype,rS);const lS=Phaser.Utils.Objects.GetValue;class dS extends hS{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new wo(this,lS(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(lS(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var cS={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new dS(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},uS={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=pS[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const pS={down:0,up:1},gS=Phaser.Utils.Objects.GetValue;var vS=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=fS(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=mS(e,this.listCreateSliderTrackCallback),g=mS(e,this.listCreateSliderThumbCallback);d=new Jb(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:gS(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=fS(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},fS=function(t,e,i){var s;return i?(e.orientation="x",s=new Ry(t,e)):(e.orientation="y",s=new wy(t,e)),t.add.existing(s),s},mS=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},yS={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},bS={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=vS.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Dw(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(bS,uS,yS);const xS=Phaser.Utils.Objects.GetValue;class CS extends Hc{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(xS(e,"options"));var i=xS(e,"list");this.setWrapEnable(xS(i,"wrap",!1)),this.setCreateButtonCallback(xS(i,"createButtonCallback")),this.setCreateListBackgroundCallback(xS(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(xS(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(xS(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(xS(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(xS(i,"scroller")),this.setListMouseWheelScrollerConfig(xS(i,"mouseWheelScroller")),this.setButtonClickCallback(xS(i,"onButtonClick")),this.setButtonOverCallback(xS(i,"onButtonOver")),this.setButtonOutCallback(xS(i,"onButtonOut")),this.setListExpandDirection(xS(i,"expandDirection")),this.setListEaseInDuration(xS(i,"easeIn",500)),this.setListEaseOutDuration(xS(i,"easeOut",100)),this.setListTransitInCallback(xS(i,"transitIn")),this.settListTransitOutCallback(xS(i,"transitOut")),this.setListMaxHeight(xS(i,"maxHeight",0)),this.setListSize(xS(i,"width"),xS(i,"height",0)),this.setListAlignmentMode(xS(i,"alignParent","text")),this.setListAlignmentSide(xS(i,"alignSide","")),this.setListBounds(xS(i,"bounds")),this.setListSpace(xS(i,"space")),this.setListDraggable(xS(i,"draggable",!1)),this.setValueChangeCallback(xS(e,"setValueCallback"),xS(e,"setValueCallbackScope")),this.setValue(xS(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(CS.prototype,bS);var wS=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?We(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=km(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=fb(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Gp(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Gp(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new CS(t,e);return t.add.existing(i),i},SS=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=wS(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=SS(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const kS=Phaser.Utils.Objects.GetValue;var PS={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?We(e.button):{},r=kS(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=LC(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n=0;i--)hy.call(this,e[i],t);return this}},dy=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},cy=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,dy.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},uy={add(t){return this.buttons.push(t),t._click||(t._click=new wo(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),cy.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&Oy.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)My.call(this,e[i],t);return this}};const Ry=Phaser.Utils.Objects.GetValue;class Ly extends Jh{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new by({parent:this,eventEmitter:Ry(e,"eventEmitter",this),groupName:Ry(e,"groupName",void 0),clickConfig:Ry(e,"click",void 0)}).setButtonsType(e);var s=Ry(e,"background",void 0),r=Ry(e,"buttons",void 0);this.buttonsAlign=Ry(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Ly.prototype,Py,Ey,yy,Cy);var Dy=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Ay[i])}void 0===s?s={}:!0===s&&(s=By);var n=e.width/t.width,a=e.height/t.height,o=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*o,s.height=t.height*o,s};const Ay={fit:0,FIT:0,envelop:1,ENVELOP:1};var By={},jy={},Wy={};const zy=Phaser.Utils.Objects.IsPlainObject,Yy=Phaser.Utils.Objects.GetValue,Iy=Phaser.Display.Align.CENTER,Xy=Phaser.Utils.String.UUID;var Fy={add:function(t,e,i,s,r,n,a,o,h,l){var d,c;un.call(this,t),zy(e)&&(e=Yy(u=e,"key",void 0),i=Yy(u,"align",Iy),s=Yy(u,"padding",0),r=Yy(u,"expand",!0),t.isRexSizer||(n=Yy(u,"minWidth",t._minWidth),a=Yy(u,"minHeight",t._minHeighted)),o=Yy(u,"offsetX",0),h=Yy(u,"offsetY",0),d=Yy(u,"offsetOriginX",0),c=Yy(u,"offsetOriginY",0),l=Yy(u,"aspectRatio",0));var u,v=void 0!==e;return v||(e=Xy()),"string"==typeof i&&(i=Er[i]),void 0===i&&(i=Iy),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===o&&(o=0),void 0===h&&(h=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=p(t)/g(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=dn(s),zy(r)?(u.expandWidth=Yy(r,"width",!1),u.expandHeight=Yy(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?p(t):n),u.expandHeight&&(t.minHeight=void 0===a?g(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,v&&this.addChildrenMap(e,t),this}},Vy={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),bn.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return Ch.call(this,t),this}},Gy={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,d,c,u=this.innerLeft,v=this.innerTop,f=this.innerWidth,m=this.innerHeight,y=this.sizerChildren;for(var b in y)(t=y[b]).rexSizer.hidden||(i=(e=t.rexSizer).padding,mo.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(jy.width=e.aspectRatio,jy.height=1,Wy.width=l,Wy.height=d,l=(c=Dy(jy,Wy,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),hh(t,this)):Wn(t,l,d),s=u+i.left*this.scaleX,n=f-(i.left+i.right)*this.scaleX,r=v+i.top*this.scaleY,a=m-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=p(t)),void 0===d&&(d=g(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,yo.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(Gy,Fy,Vy);const Hy=Phaser.Utils.Objects.IsPlainObject,Uy=Phaser.Utils.Objects.GetValue;class Ny extends oh{constructor(t,e,i,s,r,n){Hy(e)?(e=Uy(n=e,"x",0),i=Uy(n,"y",0),s=Uy(n,"width",void 0),r=Uy(n,"height",void 0)):Hy(s)&&(s=Uy(n=s,"width",void 0),r=Uy(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(Ny.prototype,Gy);const $y=Ny.prototype.add;var Ky=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),$y.call(this,t,e,i,s,r,n,a,o,h),this},Zy={add:Ky,addPage:Ky};const Jy=ss.prototype.setChildVisible;var qy={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?(Jy.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(Jy.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(qy,Zy);const Qy=Phaser.Utils.Objects.GetValue;class tb extends Ny{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(Qy(e,"swapMode",0)),this.setFadeInDuration(Qy(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=eb[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(tb.prototype,qy);const eb={invisible:0,destroy:1},ib=Phaser.Utils.Objects.IsPlainObject,sb=Phaser.Utils.Objects.GetValue,rb=Phaser.Utils.String.UUID;var nb={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},ab={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},ob={top:1,left:3,right:5,bottom:7},hb={top:"bottom",left:"right",right:"left",bottom:"top"},lb={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},db={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const _b=Phaser.Utils.Objects.GetValue;class Mb extends Ah{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=_b(e,"background",void 0),s=_b(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:_b(e,"space.title",0)}});var r=_b(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Mb.prototype,Pb,Tb);const Eb=Phaser.Utils.Objects.GetValue,Rb=Phaser.Utils.Objects.GetValue;var Lb=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Db=Phaser.Geom.Intersects.RectangleToRectangle,Ab=Phaser.Geom.Rectangle.Overlaps;var Bb=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},jb=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},Wb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},zb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Yb=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Ib=Phaser.Utils.Objects.GetValue,Xb={update:0,everyTick:1};var Fb={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Ib(t,"updateMode",0)),this.enableChildrenMask(Ib(t,"padding",0)),this.setMaskLayer(Ib(t,"layer",void 0)),this.onMaskGameObjectVisible=Ib(t,"onVisible"),this.onMaskGameObjectInvisible=Ib(t,"onInvisible"),this.maskGameObjectCallbackScope=Ib(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Xb[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=gl.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,d=t.getBounds(),c=Lb(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(Nb.prototype,Vb);const $b=["top","bottom","centerY","center"],Kb=["left","right","centerX","center"];var Zb=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=$b.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=Kb.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const Jb=Phaser.Utils.Objects.GetValue;class qb extends rm{constructor(t,e){void 0===e&&(e={});var i=Bv(e),s=Jb(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=Jb(e,"clampChildOY",!1),s.clampChildOX=Jb(e,"clampChildOX",!1);var r,n,a=new Nb(t,s);switch(t.add.existing(a),i){case 0:r=Jb(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=Jb(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:Jb(e,"align.panel","center")};var o=Jb(e,"space",void 0);o&&(o.child=Jb(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),rh(this.childrenMap.child,t),this}}var Qb={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:Zb.call(this,t,"y",e);break;case 1:Zb.call(this,t,"x",e);break;default:Zb.call(this,t,"y",e),Zb.call(this,t,"x",e)}return this}};Object.assign(qb.prototype,Qb);var tx={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},ex={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class ix extends qb{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(ix.prototype,tx,ex);const sx=Phaser.Utils.Objects.GetValue,rx=Phaser.Utils.Objects.GetValue,nx=Phaser.Utils.Objects.GetValue;var ax={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=nx(t,"onGetValue"),this.onSetValue=nx(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},ox={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},hx={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const lx=Phaser.Utils.Objects.GetValue;class dx extends Ah{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=lx(e,"proportion.title",0),o=lx(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=lx(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(dx.prototype,ax,ox,hx);var cx=function(t,e,i){var s=new Tm(t,i);return t.add.existing(s),s},ux=function(t){return void 0===t&&(t=Ah),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},px=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=bx(this.styles,"inputRow")||{},r=yx(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Gp(t,Fm(e,i))}(this.scene,t,xx(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),Cx(this,We(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Xx(this),Fx(this)),this}setNumberInput(){return this.onUpdateCallback=Ix,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const Hx=Phaser.Utils.Objects.GetValue,Ux=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Nx=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}tC.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(eC(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const iC=new tC,sC=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,rC=/\S/,nC=new tC;nC.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!rC.test(t)&&!rC.test(e)},nC.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(lC(t,null,null,i),i," ")},hC.equals=function(t,e){return tC.prototype.equals.call(hC,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const dC=new tC;dC.tokenize=function(t){return t.slice()},dC.join=dC.removeEmpty=function(t){return t};const cC=Phaser.Utils.Array.Remove;var uC=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),cC(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,iC.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},mC={cursorMoveLeft(){if(!this.isOpened)return this;var t=gC(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=gC(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=vC(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=gC(fC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=vC(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=gC(fC(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const yC=Phaser.Utils.Objects.IsPlainObject;class bC extends jc{constructor(t,e,i,s,r,n){yC(e)?n=e:yC(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Nx(e,"wrap.vAlign")||Xe(e,"wrap.vAlign",s=i?"center":"top"),Nx(e,"wrap.wrapMode")||Xe(e,"wrap.wrapMode","char"),Nx(e,"wrap.maxLines")||Xe(e,"wrap.maxLines",s=i?1:void 0),i&&Xe(e,"wrap.wrapWidth",1/0),Nx(e,"wrap.useDefaultTextHeight")||Xe(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Nx(e.edit,"inputType")){var s=i?"text":"textarea";Xe(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Kx(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=uu(n.background,"focus"),h=uu(n.style,"cursor"),l=uu(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Hx(e,"edit");return void 0===i&&(i={}),Tx(e,i,Ux),new Gx(t,i)}(this,n),Zx.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Qx.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Jx.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),Xs(l)&&Object.assign(l,h),qx.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=CC(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},SC={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},OC={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const kC=Phaser.Utils.Objects.GetValue;class PC extends rm{constructor(t,e){void 0===e&&(e={});var i,s=kC(e,"text");Ui(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new bC(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=kC(e,"space",void 0);h&&(h.child=kC(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=kC(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(PC.prototype,SC,OC);var TC={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?We(e):{}:e||(e={});var s=new PC(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},_C={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=CC(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const MC=Phaser.Utils.Objects.GetValue,EC=Phaser.Math.Linear,RC=Phaser.Math.Snap.Floor;var LC={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=MC(s,r),a=function(t,e){var i=new _f(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=MC(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=CC(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=MC(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=EC(t.minValue,t.maxValue,a.value);t.step&&(e=RC(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},DC=function(t,e){var i=new Sy(t,e);return t.add.existing(i),i};const AC=Phaser.Utils.Objects.GetValue;var BC={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=AC(e,"incDec")||{},r={text:null,action:null},n=DC(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=CC(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(We(r),s.incButton||{}),d=mb(i,l),c=Object.assign(We(r),s.decButton||{}),u=mb(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new _w(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const Ew=Phaser.Utils.Objects.GetValue;var Rw=function(t,e){var i=Ew(e,"expandDirection",void 0);"string"==typeof i&&(i=Lw[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Nx(s=e,r="alignTarget")?F(s,r):n&&Nx(s,n)?F(s,n):a&&Nx(s,a)?F(s,a):o),c=Ew(e,"alignTargetY",d),u=Ew(e,"alignOffsetX",0),p=Ew(e,"alignOffsetY",0),g=Ew(e,"alignSide","").includes("right"),v=Ew(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=le(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const Lw={down:0,up:1},Dw=Phaser.Utils.Objects.GetValue;class Aw extends Za{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Kn(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Nn(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Rw(t,e),t.isRexSizer&&t.layout();var i=Dw(e,"touchOutsideClose",!1),s=Dw(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&_(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Bw={openColorPicker:function(){if(!this.colorPicker){var t=Mw.call(this).layout(),e=new Aw(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(Bw,KC);const jw=Phaser.Utils.Objects.GetValue;class Ww extends $C{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(jw(i,"width",160),jw(i,"height",170));var n=jw(i,"background");r=n?function(t){return Gp(t,n)}:jw(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(jw(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(jw(i,"expandDirection")),this.setColorPickerEaseInDuration(jw(i,"easeIn",200)),this.setColorPickerEaseOutDuration(jw(i,"easeOut",200)),this.setColorPickerTransitInCallback(jw(i,"transitIn")),this.setColorPickerTransitOutCallback(jw(i,"transitOut")),this.setColorPickerBounds(jw(i,"bounds"));var a=jw(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(jw(o,"height",30)),this.setColorComponentsFormatLabelConfig(jw(o,"formatLabel"));var h=jw(o,"inputText");h||(h=jw(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=jw(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(Ww.prototype,Bw);var zw={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?We(e):{}:e||(e={});var s=new Ww(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Yw={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Iw={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Xw={buildShapes(){this.addShape((new hp).setName("box")).addShape((new ap).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},Fw={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new La(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},Vw={};Object.assign(Vw,Yw,Iw,Xw,Fw);const Gw=23730,Hw=Phaser.Utils.Objects.GetValue,Uw=Phaser.Utils.Objects.IsPlainObject;class Nw extends Pu{constructor(t,e,i,s,r,n,a){Uw(e)?(e=Hw(a=e,"x",0),i=Hw(a,"y",0),s=Hw(a,"width",2),r=Hw(a,"height",2),n=Hw(a,"color",Gw)):Uw(n)&&(n=Hw(a=n,"color",Gw)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=Gw),this.setBoxShape(Hw(a,"circleBox",!1)),this.setBoxFillStyle(n,Hw(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(Hw(a,"uncheckedColor",null),Hw(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(Hw(a,"boxLineWidth",4),Hw(a,"boxStrokeColor",n),Hw(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,Hw(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),Hw(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(Hw(a,"checkerColor",16777215),Hw(a,"checkerAlpha",1)),this.setBoxSize(Hw(a,"boxSize",1)),this.setCheckerSize(Hw(a,"checkerSize",1)),this.setCheckerAnimationDuration(Hw(a,"animationDuration",150)),this.buildShapes();var o=Hw(a,"checked");void 0===o&&(o=Hw(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(Nw.prototype,Vw);const $w=Phaser.Utils.Objects.GetValue,Kw=Phaser.Utils.Objects.IsPlainObject;class Zw extends Nw{constructor(t,e,i,s,r,n,a){Kw(e)?(e=$w(a=e,"x",0),i=$w(a,"y",0),s=$w(a,"width",2),r=$w(a,"height",2),n=$w(a,"color",Gw)):Kw(n)&&(n=$w(a=n,"color",Gw)),super(t,e,i,s,r,n,a),this._click=new wo(this,$w(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly($w(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var Jw={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new Zw(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},qw={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},Qw={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},tS={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},eS=function(t,e,i){return(e-t)*i+t};const iS=Phaser.Math.Linear;var sS={buildShapes(){this.addShape((new hp).setName("track")).addShape((new hp).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&eS(Gs(l),Gs(d),c))<<16|(255&eS(Hs(l),Hs(d),c))<<8|255&eS(Us(l),Us(d),c)),p=iS(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=iS(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},rS={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new La(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},nS={};Object.assign(nS,qw,Qw,tS,sS,rS);const aS=Phaser.Utils.Objects.GetValue,oS=Phaser.Utils.Objects.IsPlainObject,hS=23730;class lS extends Pu{constructor(t,e,i,s,r,n,a){oS(e)?(e=aS(a=e,"x",0),i=aS(a,"y",0),s=aS(a,"width",2),r=aS(a,"height",2),n=aS(a,"color",hS)):oS(n)&&(n=aS(a=n,"color",hS)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=hS),this.setTrackFillStyle(n,aS(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(aS(a,"falseValueTrackColor",function(t){var e=.3*Gs(t)+.59*Hs(t)+.11*Us(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),aS(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(aS(a,"thumbColor",16777215),aS(a,"thumbAlpha",1)),this.setTrackSize(aS(a,"trackWidth",.9),aS(a,"trackHeight",.5)),this.setTrackRadius(aS(a,"trackRadius",.5*this.trackHeight));var o=aS(a,"thumbHeight",void 0),h=aS(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(aS(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(aS(a,"thumbLeft",.3),aS(a,"thumbRight",void 0)),this.setRTL(aS(a,"rtl",!1)),this.setToggleAnimationDuration(aS(a,"animationDuration",150)),this.buildShapes(),this.setValue(aS(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(lS.prototype,nS);const dS=Phaser.Utils.Objects.GetValue;class cS extends lS{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new wo(this,dS(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(dS(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var uS={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new cS(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},pS={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=gS[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const gS={down:0,up:1},vS=Phaser.Utils.Objects.GetValue;var fS=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=mS(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=yS(e,this.listCreateSliderTrackCallback),g=yS(e,this.listCreateSliderThumbCallback);d=new qb(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:vS(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=mS(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},mS=function(t,e,i){var s;return i?(e.orientation="x",s=new Ly(t,e)):(e.orientation="y",s=new Sy(t,e)),t.add.existing(s),s},yS=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},bS={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},xS={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=fS.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Aw(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(xS,pS,bS);const CS=Phaser.Utils.Objects.GetValue;class wS extends Hc{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(CS(e,"options"));var i=CS(e,"list");this.setWrapEnable(CS(i,"wrap",!1)),this.setCreateButtonCallback(CS(i,"createButtonCallback")),this.setCreateListBackgroundCallback(CS(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(CS(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(CS(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(CS(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(CS(i,"scroller")),this.setListMouseWheelScrollerConfig(CS(i,"mouseWheelScroller")),this.setButtonClickCallback(CS(i,"onButtonClick")),this.setButtonOverCallback(CS(i,"onButtonOver")),this.setButtonOutCallback(CS(i,"onButtonOut")),this.setListExpandDirection(CS(i,"expandDirection")),this.setListEaseInDuration(CS(i,"easeIn",500)),this.setListEaseOutDuration(CS(i,"easeOut",100)),this.setListTransitInCallback(CS(i,"transitIn")),this.settListTransitOutCallback(CS(i,"transitOut")),this.setListMaxHeight(CS(i,"maxHeight",0)),this.setListSize(CS(i,"width"),CS(i,"height",0)),this.setListAlignmentMode(CS(i,"alignParent","text")),this.setListAlignmentSide(CS(i,"alignSide","")),this.setListBounds(CS(i,"bounds")),this.setListSpace(CS(i,"space")),this.setListDraggable(CS(i,"draggable",!1)),this.setValueChangeCallback(CS(e,"setValueCallback"),CS(e,"setValueCallbackScope")),this.setValue(CS(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(wS.prototype,xS);var SS=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?We(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Pm(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=mb(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return Gp(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return Gp(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new wS(t,e);return t.add.existing(i),i},OS=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=SS(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=OS(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const PS=Phaser.Utils.Objects.GetValue;var TS={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?We(e.button):{},r=PS(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=DC(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const uC=Phaser.Display.Canvas.CanvasPool;var cC=function(t){var e=uC.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return uC.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,uC.remove(e),a;var u,c,d=i.getImageData(0,0,o,l).data,p=d.length,g=4*o,f=0,v=!1;for(u=0;uh;u--){for(c=0;c0&&this.wrapMode!==Dm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Fm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=pC(t,l,u);else{var d=dC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=pC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=pC(t,"fill",null);null!==g&&(this.color=vy(g));var f=pC(t,"metrics",!1);return f?this.metrics={ascent:pC(f,"ascent",0),descent:pC(f,"descent",0),fontSize:pC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=cC(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=cC(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=pC(t,"fontFamily","Courier"),this.fontSize=pC(t,"fontSize","16px"),this.fontStyle=pC(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=vy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=vy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=vy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Fm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=pC(e,"fontFamily",this.fontFamily),this.fontSize=pC(e,"fontSize",this.fontSize),this.fontStyle=pC(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var fC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Oy(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const vC=Phaser.Utils.Objects.GetValue,mC=Om,yC=Pm;class bC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vC(t,"text",""),this.x=vC(t,"x",0),this.y=vC(t,"y",0),this.width=vC(t,"width",0);var e=vC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vC(t,"newLineMode",0),this.startIndex=vC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===yC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==mC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===yC&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const xC=Phaser.Utils.Objects.GetFastValue,CC=Om,kC=Mm;class SC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=xC(t,"tagToText",gd),this.tagToTextScope=xC(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var wC={};const _C=Phaser.Geom.Rectangle;var EC=new Da;class TC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&GC(f)){""!==b?a.push(n.getLine(b,x,RC)):0===C&&r>0&&a.push(n.getLine("",0,RC)),a.push(...zC(f,e,IC,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,RC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},NC=function(t,e){var i;switch(e){case BC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==YC&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new SC({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Kk(this.sizerChildren,null),sm.call(this,t),this}},Zk={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,Kk(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},iS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=dp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Kk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Kk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},rS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const nS=Phaser.Utils.Objects.IsPlainObject,aS=Phaser.Utils.Objects.GetValue;class oS extends Yv{constructor(t,e,i,s,r,n,a,o,h,l){nS(e)?(e=aS(l=e,"x",0),i=aS(l,"y",0),s=aS(l,"width",void 0),r=aS(l,"height",void 0),n=aS(l,"column",l.col||0),a=aS(l,"row",0),o=aS(l,"columnProportions",0),h=aS(l,"rowProportions",0)):nS(s)?(s=aS(l=s,"width",void 0),r=aS(l,"height",void 0),n=aS(l,"column",l.col||0),a=aS(l,"row",0),o=aS(l,"columnProportions",0),h=aS(l,"rowProportions",0)):nS(n)?(n=aS(l=n,"column",l.col||0),a=aS(l,"row",0),o=aS(l,"columnProportions",0),h=aS(l,"rowProportions",0)):nS(o)&&(o=aS(l=o,"columnProportions",0),h=aS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(aS(l,"createCellContainerCallback")),this.setIndentLeft(aS(l,"space.indentLeftOdd",0),aS(l,"space.indentLeftEven",0)),this.setIndentTop(aS(l,"space.indentTopOdd",0),aS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,aS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=sS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=rS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(oS.prototype,iS);const hS=Phaser.Utils.Objects.GetValue;const lS=Phaser.Math.Percent;var uS=function(t,e,i){var s;return t.y===e.y?s=lS(i.x,t.x,e.x):t.x===e.x&&(s=lS(i.y,t.y,e.y)),s},cS=function(t,e,i){var s,r;this.enable&&(dS.x=e,dS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=uS(s,r,dS))},dS={},pS=function(t,e,i){if(this.enable&&t.isDown){var s,r;gS.x=t.worldX,gS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=uS(s,r,gS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},gS={},fS=function(t,e){void 0===e&&(e=vS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return jd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},vS={};const mS=Phaser.Display.Align.LEFT_CENTER,yS=Phaser.Display.Align.TOP_CENTER;var bS={};const xS=Phaser.Display.Align.RIGHT_CENTER,CS=Phaser.Display.Align.BOTTOM_CENTER;var kS={};const SS=Phaser.Math.Linear;var wS={};const _S=Phaser.Display.Align.LEFT_CENTER,ES=Phaser.Display.Align.TOP_CENTER,TS=Phaser.Display.Align.RIGHT_CENTER,OS=Phaser.Display.Align.BOTTOM_CENTER;const PS=Phaser.Utils.Objects.GetValue,MS=Phaser.Utils.Objects.IsPlainObject,DS=Phaser.Math.Clamp,AS=Phaser.Math.Snap.To;class LS extends(hc(vm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=PS(e,"reverseAxis",!1);var i=PS(e,"background",void 0),s=PS(e,"track",void 0),r=PS(e,"indicator",void 0),n=PS(e,"thumb",void 0);if(i&&(MS(i)&&(i=Qx(t,i)),this.addBackground(i)),s&&(MS(s)&&(s=Qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(MS(r)&&(r=Qx(t,r)),this.pin(r)),n){MS(n)&&(n=Qx(t,n)),this.pin(n);var a=PS(e,"thumbOffsetX",0),o=PS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=PS(e,"input",0);switch("string"==typeof h&&(h=RS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",cS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",pS,this).on("pointermove",pS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(PS(e,"enable",void 0));var l=PS(e,"tick",void 0);void 0===l&&(l=PS(e,"gap",void 0)),this.setGap(l),this.setValue(PS(e,"value",0),PS(e,"min",void 0),PS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=AS(t,this.gap));var e=this._value;this._value=DS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const RS={pan:0,drag:0,click:1,none:-1};var FS={getStartPoint:function(t){if(void 0===t&&(t=bS),this.childrenMap.thumb){var e=0===this.orientation?mS:yS;fS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=kS),this.childrenMap.thumb){var e=0===this.orientation?xS:CS;fS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=wS),s.x=SS(e.x,i.x,t),s.y=SS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=Ir(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=jr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;bp(e,i,s),r=n?0===this.orientation?TS:OS:0===this.orientation?_S:ES,Id(e,this,r),this.resetChildPositionState(e)}};Object.assign(LS.prototype,FS);const BS=Phaser.Utils.Objects.GetValue;class IS extends vm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=BS(e,"background",void 0),r=BS(e,"buttons",void 0),n=BS(r,"top",BS(r,"left",void 0)),a=BS(r,"bottom",BS(r,"right",void 0)),o=BS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new xf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===BS(o,"width",void 0)?1:0;else h=void 0===BS(o,"height",void 0)?1:0;i=new LS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new xf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=BS(e,"valuechangeCallback",null);if(null!==u){var c=BS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(BS(e,"enable",void 0)),this.setValue(BS(e,"value",0)),this.setScrollStep(BS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class jS extends Cg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const zS=Phaser.Utils.Objects.GetValue,NS=Phaser.Math.Distance.Between;class GS extends In{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=zS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(zS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(zS(t,"enable",!0)),this.holdThreshold=zS(t,"holdThreshold",50),this.pointerOutReleaseEnable=zS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return Qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:NS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Kg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Kg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const XS=Phaser.Utils.Objects.GetValue;class YS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(XS(t,"value",0)),this.setSpeed(XS(t,"speed",0)),this.setAcceleration(XS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class WS{constructor(){this.value,this.dir,this.movement=new YS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const US={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},qS=Phaser.Utils.Objects.GetValue;class KS extends In{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=qS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(qS(e,"speed",.1)),this.setEnable(qS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(qS(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Kg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const JS=Phaser.Utils.Objects.GetValue;var ZS=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?JS(s,l,void 0):JS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=lo(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new IS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=JS(r,"tickLength",void 0);var p=JS(r,"position",0);"string"==typeof p&&(p=QS[p]);var g,f,v=JS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=JS(s,"space.slider",void 0))&&(o?v=0:g=JS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:JS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:JS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:JS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:JS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=JS(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=JS(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=JS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=JS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=JS(s,"scrollDetectionMode");"string"==typeof b&&(b=tw[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?JS(s,x,!0):JS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new HS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=JS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new KS(h,E)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n)&&(o?(k=a?"t":"s",w=`scroll${i}`):(k="t",w="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));C&&(_=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[_](-e,!0)})))};const QS={right:0,left:1,bottom:0,top:1},tw={gameObject:0,rectBounds:1},ew=Phaser.Utils.Objects.GetValue;var iw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ew(e,"width"),a=ew(e,"height");n||(ew(e,"child.expandWidth",!0)||(s[1]=0));a||(ew(e,"child.expandHeight",!0)||(r[1]=0));var o=new oS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=hS(i,"child"),r=hS(s,"gameObject",void 0);if(r){var n=hS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=hS(n,"top",0),a.bottom=hS(n,"bottom",0),o.left=hS(n,"left",0),o.right=hS(n,"right",0);break;case 1:a.top=hS(n,"left",0),a.bottom=hS(n,"right",0),o.top=hS(n,"top",0),o.bottom=hS(n,"bottom",0);break;default:a.top=hS(n,"top",0),a.bottom=hS(n,"bottom",0),a.left=hS(n,"left",0),a.right=hS(n,"right",0)}e.add(r,{column:1,row:1,align:hS(s,"align","center"),padding:o,expand:{width:hS(s,"expandWidth",!0),height:hS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:ZS(t,o,"y",e);break;case 1:ZS(t,o,"x",e);break;default:ZS(t,o,"y",e),ZS(t,o,"x",e)}return o},sw=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},rw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},nw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var kw=function(t){return t.add.text(0,0,"")};Object.assign(Cw.prototype,mw);var Sw={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},ww={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const _w=Phaser.Utils.Objects.GetValue;class Ew extends lw{constructor(t,e){void 0===e&&(e={});var i=_w(e,"text",void 0),s=_w(e,"textWidth",void 0),r=_w(e,"textHeight",void 0),n=_w(e,"textCrop",!!i.setCrop),a=_w(e,"textMask",!n),o=_w(e,"content",""),h=new Cw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:_w(e,"clampChildOY",!1),alwaysScrollable:_w(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=_w(e,"space",void 0);l&&(l.child=_w(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Ew.prototype,Sw,ww);const Tw=Phaser.Utils.Objects.GetValue;var Ow=function(t,e,i){e=e?y(e):{};var s=Tw(i,"background",Qx),r=Tw(i,"text",Pw),n=Tw(i,"track",Qx),a=Tw(i,"thumb",Qx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Ew(t,e);return t.add.existing(h),h},Pw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Bk(t,e);break;case"bbcodetext":case"bbcode":s=new Ak(t,0,0,"",e);break;case"label":s=new zk(t,e);break;case"textarea":s=Ow(t,e);break;default:s=new iC(t,e)}return Zx(s,e),t.add.existing(s),s},Mw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Kx(t,e):new Ox(t,e);break;case"roundRectangle":s=new vx(t,e);break;default:s=new Ax(t,e)}return Zx(s,e),t.add.existing(s),s};const Dw=Phaser.Utils.Objects.GetValue;var Aw=function(t,e,i){e=e?y(e):{};var s=Dw(i,"background",Qx),r=Dw(i,"text",Pw),n=Dw(i,"icon",Mw),a=Dw(i,"action",Mw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Lw=Phaser.Utils.Objects.GetValue;var Rw=function(t,e,i){var s,r,n=Lw(i,"innerBackground",Qx),a=Lw(i,"separator",Qx),o=Lw(i,"title",Pw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Aw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Fw extends Jb{constructor(t,e,i){super(t,e=Rw(t,e,i))}}var Bw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ol(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Iw=Phaser.Utils.Objects.GetValue;class jw extends Zl{constructor(t,e){super(t,Iw(e,"x",0),Iw(e,"y",0),Iw(e,"width",64),Iw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Iw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Iw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Iw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Iw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Iw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Iw(t,"color",i)),i=e?0:this.value,this.setValue(Iw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(jw.prototype,Bw);const zw=Phaser.Math.DegToRad,Nw=Phaser.Math.Linear,Gw=Phaser.Math.Easing.Expo.In,Xw={right:0,down:1,left:2,up:3};var Yw=function(t,e,i,s,r,n,a,o,h,l,u){var c=$w(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=$w(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=$w(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=$w(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=$w(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=$w(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Ww={},$w=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Ww.x=a*u+o*c+r,Ww.y=h*u+l*c+n,Ww},Vw={setDirection(t){return"string"==typeof t&&(t=Xw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new ju)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=zw(315);i=Math.cos(a),s=Math.sin(a);var o=zw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=zw(135);i=Math.cos(a),s=Math.sin(a);o=zw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=zw(225);i=Math.cos(a),s=Math.sin(a);o=zw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=zw(45);i=Math.cos(a),s=Math.sin(a);o=zw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=El(s),tE(r)?(d.expandWidth=eE(r,"width",!1),d.expandHeight=eE(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),d.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},nE={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Qd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return sm.call(this,t),this}},aE={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,sf.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Z_.width=e.aspectRatio,Z_.height=1,Q_.width=l,Q_.height=u,l=(c=hl(Z_,Q_,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Wv(t,this)):bp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Ir(t)),void 0===u&&(u=jr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,rf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(aE,rE,nE);const oE=Phaser.Utils.Objects.IsPlainObject,hE=Phaser.Utils.Objects.GetValue;class lE extends Yv{constructor(t,e,i,s,r,n){oE(e)?(e=hE(n=e,"x",0),i=hE(n,"y",0),s=hE(n,"width",void 0),r=hE(n,"height",void 0)):oE(s)&&(s=hE(n=s,"width",void 0),r=hE(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(lE.prototype,aE);const uE=vm.prototype.add,cE=vm.prototype.addSpace;var dE=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&cE.call(this),uE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&cE.call(this),this.hasTailSpace=s}else uE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;uE.call(this,t,{index:r,proportion:i,expand:!0})}else uE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},pE={addButton(t){if(Jg(t))for(var e=t,i=0,s=e.length;i=0;i--)vE.call(this,e[i],t);return this}},yE=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},bE=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,yE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},xE={add(t){return this.buttons.push(t),t._click||(t._click=new hf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),bE.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=RE(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=RE(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const BE=Phaser.Utils.Objects.IsPlainObject,IE=Phaser.Utils.Objects.GetValue,jE=Phaser.Display.Align.CENTER;var zE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Vd.call(this,t),BE(e))&&(e=IE(h=e,"padding",0),i=IE(h,"key",void 0),s=IE(h,"index",void 0),r=IE(h,"offsetX",0),n=IE(h,"offsetY",0),a=IE(h,"offsetOriginX",0),o=IE(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=jE,h.padding=El(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},NE={add(t,e,i){if(Jg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,sm.call(this,t),this}},YE={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&KE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)eT.call(this,e[i],t);return this}};const sT=Phaser.Utils.Objects.GetValue;class rT extends UE{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new TE({parent:this,eventEmitter:sT(e,"eventEmitter",this),groupName:sT(e,"groupName",void 0),clickConfig:sT(e,"click",void 0)}).setButtonsType(e);var s=sT(e,"background",void 0),r=sT(e,"buttons",void 0);this.buttonsAlign=sT(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(rT.prototype,ZE,iT,EE,PE);const nT=oS.prototype.add;var aT={addButton(t,e,i){return nT.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)lT.call(this,e[i],t);return this}};const cT=Phaser.Utils.Objects.GetValue;class dT extends oS{constructor(t,e){void 0===e&&(e={});var i=cT(e,"row",0),s=cT(e,"column",e.col||0),r=cT(e,"createCellContainerCallback"),n=cT(e,"buttons",void 0),a=cT(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(hO(this),lO(this)),this}setNumberInput(){return this.onUpdateCallback=oO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const dO=Phaser.Utils.Objects.GetValue,pO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var gO=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},fO=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ux(t.style,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},vO=function(t){pr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=ux(t.style,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},mO=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ux(t,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function yO(){}function bO(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}yO.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(bO(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const xO=new yO;const CO=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,kO=/\S/,SO=new yO;SO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!kO.test(t)&&!kO.test(e)},SO.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(TO(t,null,null,i),i," ")},EO.equals=function(t,e){return yO.prototype.equals.call(EO,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const OO=new yO;OO.tokenize=function(t){return t.slice()},OO.join=OO.removeEmpty=function(t){return t};const PO=Phaser.Utils.Array.Remove;var MO=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),PO(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,xO.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},FO={cursorMoveLeft(){if(!this.isOpened)return this;var t=AO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=AO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=LO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=AO(RO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=LO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=AO(RO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const BO=Phaser.Utils.Objects.IsPlainObject;class IO extends zb{constructor(t,e,i,s,r,n){BO(e)?n=e:BO(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new $o(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=lx(n.background,"focus"),h=lx(n.style,"cursor"),l=lx(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=dO(e,"edit");return void 0===i&&(i={}),UT(e,i,pO),new cO(t,i)}(this,n),gO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),mO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),fO.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),pr(l)&&Object.assign(l,h),vO.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new I_(t,e);return Zx(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Fw(r,t,i);C.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(C),kr(C,e),C.vpx=l,C.vpy=u,C.frameDelimiter=c,y&&(b=C.getElement("action"),C.setChildVisible(b,!1)),Ec(C),C.emitClick=function(){C.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:C.setInteractive()),x&&C.bindEvent(x,"pointerdown",(function(){C.emitClick()})),C.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=z_[t.keyCode];-1!==e.indexOf(i)&&C.emitClick()}}));var k=function(){C.isTyping?C.once("click",k).stop(!0):C.isLastPage?C.complete2Flag||(C.complete2Flag=!0,C.emit("complete2")):C.once("click",k).typeNextPage()},S=function(){C.isPageEnd&&(C.off("click",S),y&&(b.stop(),C.setChildVisible(b,!1)),v.emit("resume.input"))};C._typeNextPage=S,C.on("pageend",(function(){y&&(b.start(),C.setChildVisible(b,!0)),C.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,C.emitClick)),v.emit("pause.input")})).on("start",(function(){C.off("click",k).once("click",k)}));var w=v.getData("$fastTyping"),_=v.getData("$autoNextPage");C.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(C.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=C.normalTypingSpeed),C.setTypingSpeed(e)}else t&&C.emitClick();else e===_||t||C.isTyping||e&&C.emitClick();w=t,_=e}));var E=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=z_[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return C.bindEvent(r.input.keyboard,"keydown",(function(t){E(t,!0)})),C.bindEvent(r.input.keyboard,"keyup",(function(t){E(t,!1)})),C}}(G_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{typing:Rc,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=Pc(e,`creators.${Vo}`,void 0);if(!1!==s){if(Mc(s)&&(s=void 0),void 0===s){Pc(e,`styles.${Vo}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new xc(t,i);t.add.existing(s),kr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Ec(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Vo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{cross:Oc,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=zT(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(NT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new IT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Ec(u),u}}(zT(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{choice:jT,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=WO(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if($O(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new XO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Ec(u),u}}(WO(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{input:YO,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=K_(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(J_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new Y_(s,t,i);return g&&C.setTitle(g),f&&C.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,C.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(C),kr(C,e),C.vpx=h,C.vpy=l,Ec(C),C}}(K_(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{setText:$_,popUp:V_,shake:Tc}})}}];var HO=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],UO={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},qO=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=lo(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,UO),i)t.setData(s,i[s])};return class extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=on(t,t.cameras.main));for(var a=new To(t,{layers:r?No:Go,layerDepth:i,rootLayer:s}),o=0,h=VO.length;oh;u--){for(c=0;c0&&this.wrapMode!==Dm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Fm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=pC(t,l,u);else{var d=dC(t,l,u);c&&(d=c(d)),this[o]=d}}var p=pC(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=pC(t,"fill",null);null!==g&&(this.color=vy(g));var f=pC(t,"metrics",!1);return f?this.metrics={ascent:pC(f,"ascent",0),descent:pC(f,"descent",0),fontSize:pC(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=cC(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=cC(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=pC(t,"fontFamily","Courier"),this.fontSize=pC(t,"fontSize","16px"),this.fontStyle=pC(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=vy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=vy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=vy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=vy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=vy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Fm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=pC(e,"fontFamily",this.fontFamily),this.fontSize=pC(e,"fontSize",this.fontSize),this.fontStyle=pC(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var fC={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Oy(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const vC=Phaser.Utils.Objects.GetValue,mC=Om,yC=Pm;class bC{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vC(t,"text",""),this.x=vC(t,"x",0),this.y=vC(t,"y",0),this.width=vC(t,"width",0);var e=vC(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vC(t,"newLineMode",0),this.startIndex=vC(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===yC&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==mC&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===yC&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const xC=Phaser.Utils.Objects.GetFastValue,CC=Om,kC=Mm;class SC{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=xC(t,"tagToText",gd),this.tagToTextScope=xC(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var wC={};const _C=Phaser.Geom.Rectangle;var EC=new Da;class TC{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&XC(f)){""!==b?a.push(n.getLine(b,x,FC)):0===C&&r>0&&a.push(n.getLine("",0,FC)),a.push(...NC(f,e,jC,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,FC)),b=f,x=v,h=s):(b+=f,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},GC=function(t,e){var i;switch(e){case IC:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==WC&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new SC({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Jk(this.sizerChildren,null),sm.call(this,t),this}},Qk={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,Jk(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},sS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=dp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Jk(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Jk(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},nS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const aS=Phaser.Utils.Objects.IsPlainObject,oS=Phaser.Utils.Objects.GetValue;class hS extends Yv{constructor(t,e,i,s,r,n,a,o,h,l){aS(e)?(e=oS(l=e,"x",0),i=oS(l,"y",0),s=oS(l,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(s)?(s=oS(l=s,"width",void 0),r=oS(l,"height",void 0),n=oS(l,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(n)?(n=oS(l=n,"column",l.col||0),a=oS(l,"row",0),o=oS(l,"columnProportions",0),h=oS(l,"rowProportions",0)):aS(o)&&(o=oS(l=o,"columnProportions",0),h=oS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(oS(l,"createCellContainerCallback")),this.setIndentLeft(oS(l,"space.indentLeftOdd",0),oS(l,"space.indentLeftEven",0)),this.setIndentTop(oS(l,"space.indentTopOdd",0),oS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,oS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=rS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=nS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(hS.prototype,sS);const lS=Phaser.Utils.Objects.GetValue;const uS=Phaser.Math.Percent;var cS=function(t,e,i){var s;return t.y===e.y?s=uS(i.x,t.x,e.x):t.x===e.x&&(s=uS(i.y,t.y,e.y)),s},dS=function(t,e,i){var s,r;this.enable&&(pS.x=e,pS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=cS(s,r,pS))},pS={},gS=function(t,e,i){if(this.enable&&t.isDown){var s,r;fS.x=t.worldX,fS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=cS(s,r,fS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},fS={},vS=function(t,e){void 0===e&&(e=mS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return jd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},mS={};const yS=Phaser.Display.Align.LEFT_CENTER,bS=Phaser.Display.Align.TOP_CENTER;var xS={};const CS=Phaser.Display.Align.RIGHT_CENTER,kS=Phaser.Display.Align.BOTTOM_CENTER;var SS={};const wS=Phaser.Math.Linear;var _S={};const ES=Phaser.Display.Align.LEFT_CENTER,TS=Phaser.Display.Align.TOP_CENTER,OS=Phaser.Display.Align.RIGHT_CENTER,PS=Phaser.Display.Align.BOTTOM_CENTER;const MS=Phaser.Utils.Objects.GetValue,DS=Phaser.Utils.Objects.IsPlainObject,AS=Phaser.Math.Clamp,LS=Phaser.Math.Snap.To;class RS extends(hc(vm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=MS(e,"reverseAxis",!1);var i=MS(e,"background",void 0),s=MS(e,"track",void 0),r=MS(e,"indicator",void 0),n=MS(e,"thumb",void 0);if(i&&(DS(i)&&(i=Qx(t,i)),this.addBackground(i)),s&&(DS(s)&&(s=Qx(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(DS(r)&&(r=Qx(t,r)),this.pin(r)),n){DS(n)&&(n=Qx(t,n)),this.pin(n);var a=MS(e,"thumbOffsetX",0),o=MS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=MS(e,"input",0);switch("string"==typeof h&&(h=FS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",dS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",gS,this).on("pointermove",gS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(MS(e,"enable",void 0));var l=MS(e,"tick",void 0);void 0===l&&(l=MS(e,"gap",void 0)),this.setGap(l),this.setValue(MS(e,"value",0),MS(e,"min",void 0),MS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=LS(t,this.gap));var e=this._value;this._value=AS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const FS={pan:0,drag:0,click:1,none:-1};var BS={getStartPoint:function(t){if(void 0===t&&(t=xS),this.childrenMap.thumb){var e=0===this.orientation?yS:bS;vS.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=SS),this.childrenMap.thumb){var e=0===this.orientation?CS:kS;vS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=_S),s.x=wS(e.x,i.x,t),s.y=wS(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=Ir(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=jr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;bp(e,i,s),r=n?0===this.orientation?OS:PS:0===this.orientation?ES:TS,Id(e,this,r),this.resetChildPositionState(e)}};Object.assign(RS.prototype,BS);const IS=Phaser.Utils.Objects.GetValue;class jS extends vm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=IS(e,"background",void 0),r=IS(e,"buttons",void 0),n=IS(r,"top",IS(r,"left",void 0)),a=IS(r,"bottom",IS(r,"right",void 0)),o=IS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new xf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===IS(o,"width",void 0)?1:0;else h=void 0===IS(o,"height",void 0)?1:0;i=new RS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new xf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=IS(e,"valuechangeCallback",null);if(null!==u){var c=IS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(IS(e,"enable",void 0)),this.setValue(IS(e,"value",0)),this.setScrollStep(IS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class zS extends Cg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const NS=Phaser.Utils.Objects.GetValue,GS=Phaser.Math.Distance.Between;class XS extends In{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=NS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(NS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(NS(t,"enable",!0)),this.holdThreshold=NS(t,"holdThreshold",50),this.pointerOutReleaseEnable=NS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return Qf(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:GS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Kg(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Kg(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const YS=Phaser.Utils.Objects.GetValue;class WS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(YS(t,"value",0)),this.setSpeed(YS(t,"speed",0)),this.setAcceleration(YS(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class $S{constructor(){this.value,this.dir,this.movement=new WS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const qS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},KS=Phaser.Utils.Objects.GetValue;class JS extends In{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=KS(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(KS(e,"speed",.1)),this.setEnable(KS(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(KS(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Kg(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const ZS=Phaser.Utils.Objects.GetValue;var QS=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?ZS(s,l,void 0):ZS(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=lo(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new jS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=ZS(r,"tickLength",void 0);var p=ZS(r,"position",0);"string"==typeof p&&(p=tw[p]);var g,f,v=ZS(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=ZS(s,"space.slider",void 0))&&(o?v=0:g=ZS(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:ZS(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:ZS(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:ZS(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:ZS(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=ZS(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=ZS(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=ZS(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=ZS(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=ZS(s,"scrollDetectionMode");"string"==typeof b&&(b=ew[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?ZS(s,x,!0):ZS(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new US(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,S,w,_,E=ZS(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(E&&h&&(void 0!==b&&(E.focus=1===b?2:0),C=new JS(h,E)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n)&&(o?(k=a?"t":"s",w=`scroll${i}`):(k="t",w="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));C&&(_=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[_](-e,!0)})))};const tw={right:0,left:1,bottom:0,top:1},ew={gameObject:0,rectBounds:1},iw=Phaser.Utils.Objects.GetValue;var sw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=iw(e,"width"),a=iw(e,"height");n||(iw(e,"child.expandWidth",!0)||(s[1]=0));a||(iw(e,"child.expandHeight",!0)||(r[1]=0));var o=new hS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lS(i,"child"),r=lS(s,"gameObject",void 0);if(r){var n=lS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=lS(n,"top",0),a.bottom=lS(n,"bottom",0),o.left=lS(n,"left",0),o.right=lS(n,"right",0);break;case 1:a.top=lS(n,"left",0),a.bottom=lS(n,"right",0),o.top=lS(n,"top",0),o.bottom=lS(n,"bottom",0);break;default:a.top=lS(n,"top",0),a.bottom=lS(n,"bottom",0),a.left=lS(n,"left",0),a.right=lS(n,"right",0)}e.add(r,{column:1,row:1,align:lS(s,"align","center"),padding:o,expand:{width:lS(s,"expandWidth",!0),height:lS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:QS(t,o,"y",e);break;case 1:QS(t,o,"x",e);break;default:QS(t,o,"y",e),QS(t,o,"x",e)}return o},rw=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},nw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},aw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Sw=function(t){return t.add.text(0,0,"")};Object.assign(kw.prototype,yw);var ww={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},_w={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Ew=Phaser.Utils.Objects.GetValue;class Tw extends uw{constructor(t,e){void 0===e&&(e={});var i=Ew(e,"text",void 0),s=Ew(e,"textWidth",void 0),r=Ew(e,"textHeight",void 0),n=Ew(e,"textCrop",!!i.setCrop),a=Ew(e,"textMask",!n),o=Ew(e,"content",""),h=new kw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Ew(e,"clampChildOY",!1),alwaysScrollable:Ew(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=Ew(e,"space",void 0);l&&(l.child=Ew(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Tw.prototype,ww,_w);const Ow=Phaser.Utils.Objects.GetValue;var Pw=function(t,e,i){e=e?y(e):{};var s=Ow(i,"background",Qx),r=Ow(i,"text",Mw),n=Ow(i,"track",Qx),a=Ow(i,"thumb",Qx);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Tw(t,e);return t.add.existing(h),h},Mw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Ik(t,e);break;case"bbcodetext":case"bbcode":s=new Lk(t,0,0,"",e);break;case"label":s=new Nk(t,e);break;case"textarea":s=Pw(t,e);break;default:s=new iC(t,e)}return Zx(s,e),t.add.existing(s),s},Dw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Kx(t,e):new Ox(t,e);break;case"roundRectangle":s=new vx(t,e);break;default:s=new Ax(t,e)}return Zx(s,e),t.add.existing(s),s};const Aw=Phaser.Utils.Objects.GetValue;var Lw=function(t,e,i){e=e?y(e):{};var s=Aw(i,"background",Qx),r=Aw(i,"text",Mw),n=Aw(i,"icon",Dw),a=Aw(i,"action",Dw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const Rw=Phaser.Utils.Objects.GetValue;var Fw=function(t,e,i){var s,r,n=Rw(i,"innerBackground",Qx),a=Rw(i,"separator",Qx),o=Rw(i,"title",Mw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Lw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Bw extends Jb{constructor(t,e,i){super(t,e=Fw(t,e,i))}}var Iw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ol(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const jw=Phaser.Utils.Objects.GetValue;class zw extends Zl{constructor(t,e){super(t,jw(e,"x",0),jw(e,"y",0),jw(e,"width",64),jw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),jw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(jw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(jw(t,"ease",i)),i=e?0:this.delay,this.setDelay(jw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(jw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(jw(t,"color",i)),i=e?0:this.value,this.setValue(jw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(zw.prototype,Iw);const Nw=Phaser.Math.DegToRad,Gw=Phaser.Math.Linear,Xw=Phaser.Math.Easing.Expo.In,Yw={right:0,down:1,left:2,up:3};var Ww=function(t,e,i,s,r,n,a,o,h,l,u){var c=Vw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Vw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Vw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Vw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Vw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Vw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},$w={},Vw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return $w.x=a*u+o*c+r,$w.y=h*u+l*c+n,$w},Hw={setDirection(t){return"string"==typeof t&&(t=Yw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new ju)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Nw(315);i=Math.cos(a),s=Math.sin(a);var o=Nw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Nw(135);i=Math.cos(a),s=Math.sin(a);o=Nw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Nw(225);i=Math.cos(a),s=Math.sin(a);o=Nw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Nw(45);i=Math.cos(a),s=Math.sin(a);o=Nw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=El(s),eE(r)?(d.expandWidth=iE(r,"width",!1),d.expandHeight=iE(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?Ir(t):n),d.expandHeight&&(t.minHeight=void 0===a?jr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},aE={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Qd.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return sm.call(this,t),this}},oE={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,sf.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Q_.width=e.aspectRatio,Q_.height=1,tE.width=l,tE.height=u,l=(c=hl(Q_,tE,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Wv(t,this)):bp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Ir(t)),void 0===u&&(u=jr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,rf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(oE,nE,aE);const hE=Phaser.Utils.Objects.IsPlainObject,lE=Phaser.Utils.Objects.GetValue;class uE extends Yv{constructor(t,e,i,s,r,n){hE(e)?(e=lE(n=e,"x",0),i=lE(n,"y",0),s=lE(n,"width",void 0),r=lE(n,"height",void 0)):hE(s)&&(s=lE(n=s,"width",void 0),r=lE(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(uE.prototype,oE);const cE=vm.prototype.add,dE=vm.prototype.addSpace;var pE=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)&&dE.call(this),cE.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&dE.call(this),this.hasTailSpace=s}else cE.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;cE.call(this,t,{index:r,proportion:i,expand:!0})}else cE.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},gE={addButton(t){if(Jg(t))for(var e=t,i=0,s=e.length;i=0;i--)mE.call(this,e[i],t);return this}},bE=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},xE=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,bE.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},CE={add(t){return this.buttons.push(t),t._click||(t._click=new hf(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),xE.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=FE(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=FE(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const IE=Phaser.Utils.Objects.IsPlainObject,jE=Phaser.Utils.Objects.GetValue,zE=Phaser.Display.Align.CENTER;var NE=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(Vd.call(this,t),IE(e))&&(e=jE(h=e,"padding",0),i=jE(h,"key",void 0),s=jE(h,"index",void 0),r=jE(h,"offsetX",0),n=jE(h,"offsetY",0),a=jE(h,"offsetOriginX",0),o=jE(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=zE,h.padding=El(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},GE={add(t,e,i){if(Jg(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,sm.call(this,t),this}},WE={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&JE.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)iT.call(this,e[i],t);return this}};const rT=Phaser.Utils.Objects.GetValue;class nT extends qE{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new OE({parent:this,eventEmitter:rT(e,"eventEmitter",this),groupName:rT(e,"groupName",void 0),clickConfig:rT(e,"click",void 0)}).setButtonsType(e);var s=rT(e,"background",void 0),r=rT(e,"buttons",void 0);this.buttonsAlign=rT(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(nT.prototype,QE,sT,TE,ME);const aT=hS.prototype.add;var oT={addButton(t,e,i){return aT.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)uT.call(this,e[i],t);return this}};const dT=Phaser.Utils.Objects.GetValue;class pT extends hS{constructor(t,e){void 0===e&&(e={});var i=dT(e,"row",0),s=dT(e,"column",e.col||0),r=dT(e,"createCellContainerCallback"),n=dT(e,"buttons",void 0),a=dT(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(lO(this),uO(this)),this}setNumberInput(){return this.onUpdateCallback=hO,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const pO=Phaser.Utils.Objects.GetValue,gO=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var fO=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},vO=function(t){pr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=ux(t.style,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},mO=function(t){pr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=ux(t.style,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},yO=function(t){pr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=ux(t,e);Sl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function bO(){}function xO(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}bO.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(xO(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const CO=new bO;const kO=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,SO=/\S/,wO=new bO;wO.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!SO.test(t)&&!SO.test(e)},wO.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(OO(t,null,null,i),i," ")},TO.equals=function(t,e){return bO.prototype.equals.call(TO,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const PO=new bO;PO.tokenize=function(t){return t.slice()},PO.join=PO.removeEmpty=function(t){return t};const MO=Phaser.Utils.Array.Remove;var DO=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),MO(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,CO.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},BO={cursorMoveLeft(){if(!this.isOpened)return this;var t=LO(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=LO(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=RO(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=LO(FO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=RO(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=LO(FO(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const IO=Phaser.Utils.Objects.IsPlainObject;class jO extends zb{constructor(t,e,i,s,r,n){IO(e)?n=e:IO(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new $o(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=lx(n.background,"focus"),h=lx(n.style,"cursor"),l=lx(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=pO(e,"edit");return void 0===i&&(i={}),qT(e,i,gO),new dO(t,i)}(this,n),fO.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),yO.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),vO.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),pr(l)&&Object.assign(l,h),mO.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new j_(t,e);return Zx(i,e),t.add.existing(i),i},y=!0);var b,x,C=new Bw(r,t,i);C.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(C),kr(C,e),C.vpx=l,C.vpy=u,C.frameDelimiter=c,y&&(b=C.getElement("action"),C.setChildVisible(b,!1)),Ec(C),C.emitClick=function(){C.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:C.setInteractive()),x&&C.bindEvent(x,"pointerdown",(function(){C.emitClick()})),C.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=N_[t.keyCode];-1!==e.indexOf(i)&&C.emitClick()}}));var k=function(){C.isTyping?C.once("click",k).stop(!0):C.isLastPage?C.complete2Flag||(C.complete2Flag=!0,C.emit("complete2")):C.once("click",k).typeNextPage()},S=function(){C.isPageEnd&&(C.off("click",S),y&&(b.stop(),C.setChildVisible(b,!1)),v.emit("resume.input"))};C._typeNextPage=S,C.on("pageend",(function(){y&&(b.start(),C.setChildVisible(b,!0)),C.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,C.emitClick)),v.emit("pause.input")})).on("start",(function(){C.off("click",k).once("click",k)}));var w=v.getData("$fastTyping"),_=v.getData("$autoNextPage");C.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(C.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=C.normalTypingSpeed),C.setTypingSpeed(e)}else t&&C.emitClick();else e===_||t||C.isTyping||e&&C.emitClick();w=t,_=e}));var E=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=N_[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return C.bindEvent(r.input.keyboard,"keydown",(function(t){E(t,!0)})),C.bindEvent(r.input.keyboard,"keyup",(function(t){E(t,!1)})),C}}(X_(e,`styles.${Uo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Uo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{typing:Rc,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=Pc(e,`creators.${Vo}`,void 0);if(!1!==s){if(Mc(s)&&(s=void 0),void 0===s){Pc(e,`styles.${Vo}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new xc(t,i);t.add.existing(s),kr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Ec(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Vo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Oo,commands:{cross:Oc,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=NT(e,`creators.${Ko}`,void 0);if(!1!==s){var r;if(GT(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new jT(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Ec(u),u}}(NT(e,`styles.${Ko}`,{}),{viewport:i},r);t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{choice:zT,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=$O(e,`creators.${Jo}`,void 0);if(!1!==s){var r;if(VO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new YO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),kr(u,e),u.vpx=h,u.vpy=l,Ec(u),u}}($O(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{input:WO,shake:Tc}})}},function(t,e){var{viewport:i}=e,s=J_(e,`creators.${qo}`,void 0);if(!1!==s){var r;if(Z_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new xc(t,e);return Zx(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,C=new W_(s,t,i);return g&&C.setTitle(g),f&&C.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,C.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(C),kr(C,e),C.vpx=h,C.vpy=l,Ec(C),C}}(J_(e,`styles.${qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Mo,commands:{setText:V_,popUp:H_,shake:Tc}})}}];var UO=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],qO={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},KO=function(t,e){var{defaultVariables:i}=e;for(var s in i=function(t,e){var i=lo(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i}(i,qO),i)t.setData(s,i[s])};return class extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=on(t,t.cameras.main));for(var a=new To(t,{layers:r?No:Go,layerDepth:i,rootLayer:s}),o=0,h=HO.length;o * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const gk=Phaser.Display.Canvas.CanvasPool;var fk=function(t){var e=gk.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return gk.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h);a={ascent:0,descent:0,fontSize:0};if(!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,gk.remove(e),a;var u,c,d=i.getImageData(0,0,o,l).data,p=d.length,g=4*o,f=0,v=!1;for(u=0;uh;u--){for(c=0;c0&&this.wrapMode!==Bm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=zm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=mk(t,l,u);else{var d=vk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=mk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=mk(t,"fill",null);null!==g&&(this.color=xy(g));var f=mk(t,"metrics",!1);return f?this.metrics={ascent:mk(f,"ascent",0),descent:mk(f,"descent",0),fontSize:mk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=fk(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=fk(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=mk(t,"fontFamily","Courier"),this.fontSize=mk(t,"fontSize","16px"),this.fontStyle=mk(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=xy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=xy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=xy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=xy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=xy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=xy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=xy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=zm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=mk(e,"fontFamily",this.fontFamily),this.fontSize=mk(e,"fontSize",this.fontSize),this.fontStyle=mk(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var bk={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Ly(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var k=l;k0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const xk=Phaser.Utils.Objects.GetValue,kk=Lm,Ck=Am;class Sk{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=xk(t,"text",""),this.x=xk(t,"x",0),this.y=xk(t,"y",0),this.width=xk(t,"width",0);var e=xk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=xk(t,"newLineMode",0),this.startIndex=xk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Ck&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==kk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Ck&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const wk=Phaser.Utils.Objects.GetFastValue,Tk=Lm,Pk=Rm;class Ok{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=wk(t,"tagToText",yd),this.tagToTextScope=wk(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var _k={};const Ek=Phaser.Geom.Rectangle;var Mk=new Ra;class Dk{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Xk(f)){""!==b?a.push(n.getLine(b,x,jk)):0===k&&r>0&&a.push(n.getLine("",0,jk)),a.push(...Vk(f,e,Gk,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,jk)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Yk=function(t,e){var i;switch(e){case Nk:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==$k&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ok({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return eS(this.sizerChildren,null),om.call(this,t),this}},sS={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,eS(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},oS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=vp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,eS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)eS(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},lS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const uS=Phaser.Utils.Objects.IsPlainObject,cS=Phaser.Utils.Objects.GetValue;class dS extends $v{constructor(t,e,i,s,r,n,a,o,h,l){uS(e)?(e=cS(l=e,"x",0),i=cS(l,"y",0),s=cS(l,"width",void 0),r=cS(l,"height",void 0),n=cS(l,"column",l.col||0),a=cS(l,"row",0),o=cS(l,"columnProportions",0),h=cS(l,"rowProportions",0)):uS(s)?(s=cS(l=s,"width",void 0),r=cS(l,"height",void 0),n=cS(l,"column",l.col||0),a=cS(l,"row",0),o=cS(l,"columnProportions",0),h=cS(l,"rowProportions",0)):uS(n)?(n=cS(l=n,"column",l.col||0),a=cS(l,"row",0),o=cS(l,"columnProportions",0),h=cS(l,"rowProportions",0)):uS(o)&&(o=cS(l=o,"columnProportions",0),h=cS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(cS(l,"createCellContainerCallback")),this.setIndentLeft(cS(l,"space.indentLeftOdd",0),cS(l,"space.indentLeftEven",0)),this.setIndentTop(cS(l,"space.indentTopOdd",0),cS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,cS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=hS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=lS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(dS.prototype,oS);const pS=Phaser.Utils.Objects.GetValue;const gS=Phaser.Math.Percent;var fS=function(t,e,i){var s;return t.y===e.y?s=gS(i.x,t.x,e.x):t.x===e.x&&(s=gS(i.y,t.y,e.y)),s},vS=function(t,e,i){var s,r;this.enable&&(mS.x=e,mS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=fS(s,r,mS))},mS={},yS=function(t,e,i){if(this.enable&&t.isDown){var s,r;bS.x=t.worldX,bS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=fS(s,r,bS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},bS={},xS=function(t,e){void 0===e&&(e=kS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Wd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},kS={};const CS=Phaser.Display.Align.LEFT_CENTER,SS=Phaser.Display.Align.TOP_CENTER;var wS={};const TS=Phaser.Display.Align.RIGHT_CENTER,PS=Phaser.Display.Align.BOTTOM_CENTER;var OS={};const _S=Phaser.Math.Linear;var ES={};const MS=Phaser.Display.Align.LEFT_CENTER,DS=Phaser.Display.Align.TOP_CENTER,LS=Phaser.Display.Align.RIGHT_CENTER,AS=Phaser.Display.Align.BOTTOM_CENTER;const RS=Phaser.Utils.Objects.GetValue,BS=Phaser.Utils.Objects.IsPlainObject,FS=Phaser.Math.Clamp,IS=Phaser.Math.Snap.To;class jS extends(dc(xm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=RS(e,"reverseAxis",!1);var i=RS(e,"background",void 0),s=RS(e,"track",void 0),r=RS(e,"indicator",void 0),n=RS(e,"thumb",void 0);if(i&&(BS(i)&&(i=sk(t,i)),this.addBackground(i)),s&&(BS(s)&&(s=sk(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(BS(r)&&(r=sk(t,r)),this.pin(r)),n){BS(n)&&(n=sk(t,n)),this.pin(n);var a=RS(e,"thumbOffsetX",0),o=RS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=RS(e,"input",0);switch("string"==typeof h&&(h=zS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",vS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",yS,this).on("pointermove",yS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(RS(e,"enable",void 0));var l=RS(e,"tick",void 0);void 0===l&&(l=RS(e,"gap",void 0)),this.setGap(l),this.setValue(RS(e,"value",0),RS(e,"min",void 0),RS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=IS(t,this.gap));var e=this._value;this._value=FS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const zS={pan:0,drag:0,click:1,none:-1};var NS={getStartPoint:function(t){if(void 0===t&&(t=wS),this.childrenMap.thumb){var e=0===this.orientation?CS:SS;xS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=OS),this.childrenMap.thumb){var e=0===this.orientation?TS:PS;xS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=ES),s.x=_S(e.x,i.x,t),s.y=_S(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=zr(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=Nr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;Sp(e,i,s),r=n?0===this.orientation?LS:AS:0===this.orientation?MS:DS,Gd(e,this,r),this.resetChildPositionState(e)}};Object.assign(jS.prototype,NS);const GS=Phaser.Utils.Objects.GetValue;class WS extends xm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=GS(e,"background",void 0),r=GS(e,"buttons",void 0),n=GS(r,"top",GS(r,"left",void 0)),a=GS(r,"bottom",GS(r,"right",void 0)),o=GS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new wf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===GS(o,"width",void 0)?1:0;else h=void 0===GS(o,"height",void 0)?1:0;i=new jS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new wf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=GS(e,"valuechangeCallback",null);if(null!==u){var c=GS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(GS(e,"enable",void 0)),this.setValue(GS(e,"value",0)),this.setScrollStep(GS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class VS extends Tg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const YS=Phaser.Utils.Objects.GetValue,XS=Phaser.Math.Distance.Between;class HS extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=YS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(YS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(YS(t,"enable",!0)),this.holdThreshold=YS(t,"holdThreshold",50),this.pointerOutReleaseEnable=YS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return sv(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:XS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!tf(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!tf(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const $S=Phaser.Utils.Objects.GetValue;class US{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue($S(t,"value",0)),this.setSpeed($S(t,"speed",0)),this.setAcceleration($S(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class KS{constructor(){this.value,this.dir,this.movement=new US}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const QS={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},tw=Phaser.Utils.Objects.GetValue;class ew extends Nn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=tw(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(tw(e,"speed",.1)),this.setEnable(tw(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(tw(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||tf(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const iw=Phaser.Utils.Objects.GetValue;var sw=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?iw(s,l,void 0):iw(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=po(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new WS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=iw(r,"tickLength",void 0);var p=iw(r,"position",0);"string"==typeof p&&(p=rw[p]);var g,f,v=iw(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=iw(s,"space.slider",void 0))&&(o?v=0:g=iw(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:iw(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:iw(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:iw(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:iw(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=iw(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=iw(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=iw(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=iw(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=iw(s,"scrollDetectionMode");"string"==typeof b&&(b=nw[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?iw(s,x,!0):iw(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new ZS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=iw(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new ew(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,k),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",k)),n)&&(o?(C=a?"t":"s",w=`scroll${i}`):(C="t",w="scroll"),n.on("valuechange",(function(e){t[C]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));k&&(T=o?`addChildO${i}`:"addChildOY",k.on("scroll",(function(e){t[T](-e,!0)})))};const rw={right:0,left:1,bottom:0,top:1},nw={gameObject:0,rectBounds:1},aw=Phaser.Utils.Objects.GetValue;var ow=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=aw(e,"width"),a=aw(e,"height");n||(aw(e,"child.expandWidth",!0)||(s[1]=0));a||(aw(e,"child.expandHeight",!0)||(r[1]=0));var o=new dS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=pS(i,"child"),r=pS(s,"gameObject",void 0);if(r){var n=pS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=pS(n,"top",0),a.bottom=pS(n,"bottom",0),o.left=pS(n,"left",0),o.right=pS(n,"right",0);break;case 1:a.top=pS(n,"left",0),a.bottom=pS(n,"right",0),o.top=pS(n,"top",0),o.bottom=pS(n,"bottom",0);break;default:a.top=pS(n,"top",0),a.bottom=pS(n,"bottom",0),a.left=pS(n,"left",0),a.right=pS(n,"right",0)}e.add(r,{column:1,row:1,align:pS(s,"align","center"),padding:o,expand:{width:pS(s,"expandWidth",!0),height:pS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:sw(t,o,"y",e);break;case 1:sw(t,o,"x",e);break;default:sw(t,o,"y",e),sw(t,o,"x",e)}return o},hw=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},lw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},uw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Ow=function(t){return t.add.text(0,0,"")};Object.assign(Pw.prototype,Cw);var _w={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Ew={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Mw=Phaser.Utils.Objects.GetValue;class Dw extends gw{constructor(t,e){void 0===e&&(e={});var i=Mw(e,"text",void 0),s=Mw(e,"textWidth",void 0),r=Mw(e,"textHeight",void 0),n=Mw(e,"textCrop",!!i.setCrop),a=Mw(e,"textMask",!n),o=Mw(e,"content",""),h=new Pw(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Mw(e,"clampChildOY",!1),alwaysScrollable:Mw(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=Mw(e,"space",void 0);l&&(l.child=Mw(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Dw.prototype,_w,Ew);const Lw=Phaser.Utils.Objects.GetValue;var Aw=function(t,e,i){e=e?y(e):{};var s=Lw(i,"background",sk),r=Lw(i,"text",Rw),n=Lw(i,"track",sk),a=Lw(i,"thumb",sk);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Dw(t,e);return t.add.existing(h),h},Rw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new NC(t,e);break;case"bbcodetext":case"bbcode":s=new FC(t,0,0,"",e);break;case"label":s=new VC(t,e);break;case"textarea":s=Aw(t,e);break;default:s=new ak(t,e)}return ik(s,e),t.add.existing(s),s},Bw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new tk(t,e):new Lx(t,e);break;case"roundRectangle":s=new xx(t,e);break;default:s=new Fx(t,e)}return ik(s,e),t.add.existing(s),s};const Fw=Phaser.Utils.Objects.GetValue;var Iw=function(t,e,i){e=e?y(e):{};var s=Fw(i,"background",sk),r=Fw(i,"text",Rw),n=Fw(i,"icon",Bw),a=Fw(i,"action",Bw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const jw=Phaser.Utils.Objects.GetValue;var zw=function(t,e,i){var s,r,n=jw(i,"innerBackground",sk),a=jw(i,"separator",sk),o=jw(i,"title",Rw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=Iw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Nw extends ex{constructor(t,e,i){super(t,e=zw(t,e,i))}}var Gw={start:function(t){return this.easeValueTask||(this.easeValueTask=new ul(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Ww=Phaser.Utils.Objects.GetValue;class Vw extends eu{constructor(t,e){super(t,Ww(e,"x",0),Ww(e,"y",0),Ww(e,"width",64),Ww(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Ww(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Ww(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Ww(t,"ease",i)),i=e?0:this.delay,this.setDelay(Ww(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Ww(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Ww(t,"color",i)),i=e?0:this.value,this.setValue(Ww(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Vw.prototype,Gw);const Yw=Phaser.Math.DegToRad,Xw=Phaser.Math.Linear,Hw=Phaser.Math.Easing.Expo.In,$w={right:0,down:1,left:2,up:3};var Uw=function(t,e,i,s,r,n,a,o,h,l,u){var c=qw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=qw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=qw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=qw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=qw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=qw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},Kw={},qw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return Kw.x=a*u+o*c+r,Kw.y=h*u+l*c+n,Kw},Jw={setDirection(t){return"string"==typeof t&&(t=$w[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Gu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Yw(315);i=Math.cos(a),s=Math.sin(a);var o=Yw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Yw(135);i=Math.cos(a),s=Math.sin(a);o=Yw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Yw(225);i=Math.cos(a),s=Math.sin(a);o=Yw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Yw(45);i=Math.cos(a),s=Math.sin(a);o=Yw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=El(s),nP(r)?(d.expandWidth=aP(r,"width",!1),d.expandHeight=aP(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?zr(t):n),d.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},uP={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),sp.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return om.call(this,t),this}},cP={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,of.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(sP.width=e.aspectRatio,sP.height=1,rP.width=l,rP.height=u,l=(c=cl(sP,rP,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Uv(t,this)):Sp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zr(t)),void 0===u&&(u=Nr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,hf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(cP,lP,uP);const dP=Phaser.Utils.Objects.IsPlainObject,pP=Phaser.Utils.Objects.GetValue;class gP extends $v{constructor(t,e,i,s,r,n){dP(e)?(e=pP(n=e,"x",0),i=pP(n,"y",0),s=pP(n,"width",void 0),r=pP(n,"height",void 0)):dP(s)&&(s=pP(n=s,"width",void 0),r=pP(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(gP.prototype,cP);const fP=xm.prototype.add,vP=xm.prototype.addSpace;var mP=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&vP.call(this),fP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&vP.call(this),this.hasTailSpace=s}else fP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;fP.call(this,t,{index:r,proportion:i,expand:!0})}else fP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},yP={addButton(t){if(ef(t))for(var e=t,i=0,s=e.length;i=0;i--)kP.call(this,e[i],t);return this}},SP=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},wP=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,SP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},TP={add(t){return this.buttons.push(t),t._click||(t._click=new df(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),wP.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=zP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=zP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const GP=Phaser.Utils.Objects.IsPlainObject,WP=Phaser.Utils.Objects.GetValue,VP=Phaser.Display.Align.CENTER;var YP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(qd.call(this,t),GP(e))&&(e=WP(h=e,"padding",0),i=WP(h,"key",void 0),s=WP(h,"index",void 0),r=WP(h,"offsetX",0),n=WP(h,"offsetY",0),a=WP(h,"offsetOriginX",0),o=WP(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=VP,h.padding=El(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},XP={add(t,e,i){if(ef(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,om.call(this,t),this}},UP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&eO.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)aO.call(this,e[i],t);return this}};const hO=Phaser.Utils.Objects.GetValue;class lO extends QP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new LP({parent:this,eventEmitter:hO(e,"eventEmitter",this),groupName:hO(e,"groupName",void 0),clickConfig:hO(e,"click",void 0)}).setButtonsType(e);var s=hO(e,"background",void 0),r=hO(e,"buttons",void 0);this.buttonsAlign=hO(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(lO.prototype,sO,oO,DP,RP);const uO=dS.prototype.add;var cO={addButton(t,e,i){return uO.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)gO.call(this,e[i],t);return this}};const vO=Phaser.Utils.Objects.GetValue;class mO extends dS{constructor(t,e){void 0===e&&(e={});var i=vO(e,"row",0),s=vO(e,"column",e.col||0),r=vO(e,"createCellContainerCallback"),n=vO(e,"buttons",void 0),a=vO(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(p_(this),g_(this)),this}setNumberInput(){return this.onUpdateCallback=d_,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const m_=Phaser.Utils.Objects.GetValue,y_=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var b_=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},x_=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=gx(t.style,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},k_=function(t){fr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=gx(t.style,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},C_=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=gx(t,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function S_(){}function w_(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}S_.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(w_(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const T_=new S_;const P_=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,O_=/\S/,__=new S_;__.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!O_.test(t)&&!O_.test(e)},__.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(L_(t,null,null,i),i," ")},D_.equals=function(t,e){return S_.prototype.equals.call(D_,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const A_=new S_;A_.tokenize=function(t){return t.slice()},A_.join=A_.removeEmpty=function(t){return t};const R_=Phaser.Utils.Array.Remove;var B_=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),R_(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,T_.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},N_={cursorMoveLeft(){if(!this.isOpened)return this;var t=I_(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=I_(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=j_(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=I_(z_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=j_(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=I_(z_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const G_=Phaser.Utils.Objects.IsPlainObject;class W_ extends Vb{constructor(t,e,i,s,r,n){G_(e)?n=e:G_(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Uo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=px(n.background,"focus"),h=px(n.style,"cursor"),l=px(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=m_(e,"edit");return void 0===i&&(i={}),QO(e,i,y_),new v_(t,i)}(this,n),b_.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),C_.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),x_.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),fr(l)&&Object.assign(l,h),k_.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new wc(t,e);return ik(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new WT(t,e);return ik(i,e),t.add.existing(i),i},y=!0);var b,x,k=new Nw(r,t,i);k.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(k),wr(k,e),k.vpx=l,k.vpy=u,k.frameDelimiter=c,y&&(b=k.getElement("action"),k.setChildVisible(b,!1)),Mc(k),k.emitClick=function(){k.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:k.setInteractive()),x&&k.bindEvent(x,"pointerdown",(function(){k.emitClick()})),k.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=YT[t.keyCode];-1!==e.indexOf(i)&&k.emitClick()}}));var C=function(){k.isTyping?k.once("click",C).stop(!0):k.isLastPage?k.complete2Flag||(k.complete2Flag=!0,k.emit("complete2")):k.once("click",C).typeNextPage()},S=function(){k.isPageEnd&&(k.off("click",S),y&&(b.stop(),k.setChildVisible(b,!1)),v.emit("resume.input"))};k._typeNextPage=S,k.on("pageend",(function(){y&&(b.start(),k.setChildVisible(b,!0)),k.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,k.emitClick)),v.emit("pause.input")})).on("start",(function(){k.off("click",C).once("click",C)}));var w=v.getData("$fastTyping"),T=v.getData("$autoNextPage");k.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(k.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=k.normalTypingSpeed),k.setTypingSpeed(e)}else t&&k.emitClick();else e===T||t||k.isTyping||e&&k.emitClick();w=t,T=e}));var P=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=YT[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return k.bindEvent(r.input.keyboard,"keydown",(function(t){P(t,!0)})),k.bindEvent(r.input.keyboard,"keyup",(function(t){P(t,!1)})),k}}(HT(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{typing:jc,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=Ac(e,`creators.${Ko}`,void 0);if(!1!==s){if(Rc(s)&&(s=void 0),void 0===s){Ac(e,`styles.${Ko}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new wc(t,i);t.add.existing(s),wr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Mc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Do,commands:{cross:Lc,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=YO(e,`creators.${Qo}`,void 0);if(!1!==s){var r;if(XO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new WO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Mc(u),u}}(YO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{choice:VO,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=K_(e,`creators.${th}`,void 0);if(!1!==s){var r;if(q_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new $_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Mc(u),u}}(K_(e,`styles.${th}`,{}),{viewport:i},r);t.addGameObjectManager({name:th,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{input:U_,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=eP(e,`creators.${Zo}`,void 0);if(!1!==s){var r;if(iP(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new wc(t,e);return ik(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new UT(s,t,i);return g&&k.setTitle(g),f&&k.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,k.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(k),wr(k,e),k.vpx=h,k.vpy=l,Mc(k),k}}(eP(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{setText:qT,popUp:JT,shake:Dc}})}}];var Z_=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],Q_={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},tE=function(t,e){var i=po(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class eE extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=un(t,t.cameras.main));for(var a=new Mo(t,{layers:r?Vo:Yo,layerDepth:i,rootLayer:s}),o=0,h=J_.length;o0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=cE(r,"x",null);null!==n?(t=n,i=n):(t=cE(r,"left",0),i=cE(r,"right",t));var a=cE(r,"y",null);null!==a?(e=a,s=a):(e=cE(r,"top",0),s=cE(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return gE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=pE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const vE={right:0,down:1,left:2,up:3};var mE=function(t){return"string"==typeof t&&(t=vE[t]),t%=4};Object.assign(fE.prototype,lE,uE);class yE extends rE{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new fE(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}var bE=function(t,e,i){return sk(t,tE(e,i))};class xE extends Ag{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var kE={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;(this.show(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();return e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){(this.setChildScale(i,1,1).hide(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},CE=function(t,e){Gp.popUp.call(t,e,this.expandDirection)},SE=function(t,e){Gp.scaleDown.call(t,e,this.expandDirection)},wE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=CE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=SE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const TE=Phaser.Utils.Objects.GetValue;let PE=class extends xm{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=TE(e,"space"),a=1===this.orientation?"left":"top",o=TE(e,"align.title",a),h=TE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:TE(n,"titleLeft",0),right:TE(n,"titleRight",0),top:TE(n,"titleTop",0),bottom:TE(n,"titleBottom",0)}});var l=TE(e,"toggleByTarget",void 0),u=TE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&gf.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new xE(r),!TE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=TE(e,"align.child","left");var d=(h=TE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:TE(n,"childLeft",0),right:TE(n,"childRight",0),top:TE(n,"childTop",0),bottom:TE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(TE(p,"duration",200)),this.setExpandCallback(TE(p,"expandCallback",void 0)),this.setCollapseCallback(TE(p,"collapseCallback",void 0)),this.reLayoutTarget=TE(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var f=e.onExpandComplete;f&&this.on("expand.complete",f);var v=e.onCollapseStart;v&&this.on("collapse.start",v);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=TE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(PE.prototype,kE,wE);var OE={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},_E={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class EE extends PE{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(EE.prototype,OE,_E);const ME=Phaser.Utils.Objects.GetValue;const DE=Phaser.Utils.Objects.GetValue;const LE=gP.prototype.add;var AE=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),LE.call(this,t,e,i,s,r,n,a,o,h),this},RE={add:AE,addPage:AE};const BE=al.prototype.setChildVisible;var FE={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(BE.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(BE.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(FE,RE);const IE=Phaser.Utils.Objects.GetValue;class jE extends gP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(IE(e,"swapMode",0)),this.setFadeInDuration(IE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=zE[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(jE.prototype,FE);const zE={invisible:0,destroy:1};const NE=Phaser.Utils.Objects.IsPlainObject,GE=Phaser.Utils.Objects.GetValue,WE=Phaser.Utils.String.UUID;var VE={swapPage:function(t,e){var i,s;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s));return this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},YE={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},XE={top:1,left:3,right:5,bottom:7},HE={top:"bottom",left:"right",right:"left",bottom:"top"},$E={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},UE={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const cM=Phaser.Utils.Objects.GetValue;class dM extends xm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=cM(e,"background",void 0),s=cM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:cM(e,"space.title",0)}});var r=cM(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(dM.prototype,lM,uM);const pM=Phaser.Utils.Objects.GetValue;const gM=Phaser.Utils.Objects.GetValue;var fM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const vM=Phaser.Geom.Intersects.RectangleToRectangle,mM=Phaser.Geom.Rectangle.Overlaps;var yM=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},bM=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},xM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},kM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},CM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const SM=Phaser.Utils.Objects.GetValue,wM={update:0,everyTick:1};var TM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(SM(t,"updateMode",0)),this.enableChildrenMask(SM(t,"padding",0)),this.setMaskLayer(SM(t,"layer",void 0)),this.onMaskGameObjectVisible=SM(t,"onVisible"),this.onMaskGameObjectInvisible=SM(t,"onInvisible"),this.maskGameObjectCallbackScope=SM(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=wM[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=Tm.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,u=t.getBounds(),c=fM(e),d=0,p=i.length;dthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(MM.prototype,PM);const DM=["top","bottom","centerY","center"],LM=["left","right","centerX","center"];var AM=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=DM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=LM.length;a=0?0:Math.abs(c)<=Math.abs(d)?c:d}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const RM=Phaser.Utils.Objects.GetValue;class BM extends gw{constructor(t,e){void 0===e&&(e={});var i=HC(e),s=RM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=RM(e,"clampChildOY",!1),s.clampChildOX=RM(e,"clampChildOX",!1);var r,n,a=new MM(t,s);switch(t.add.existing(a),i){case 0:r=RM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=RM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:RM(e,"align.panel","center")};var o=RM(e,"space",void 0);o&&(o.child=RM(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Yv(this.childrenMap.child,t),this}}var FM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:AM.call(this,t,"y",e);break;case 1:AM.call(this,t,"x",e);break;default:AM.call(this,t,"y",e),AM.call(this,t,"x",e)}return this}};Object.assign(BM.prototype,FM);var IM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},jM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class zM extends BM{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(zM.prototype,IM,jM);const NM=Phaser.Utils.Objects.GetValue;const GM=Phaser.Utils.Objects.GetValue;const WM=Phaser.Utils.Objects.GetValue;var VM={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=WM(t,"onGetValue"),this.onSetValue=WM(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},YM={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},XM={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const HM=Phaser.Utils.Objects.GetValue;class $M extends xm{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=HM(e,"proportion.title",0),o=HM(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0);a=HM(e,"proportion.inputField",h);this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign($M.prototype,VM,YM,XM);var UM=function(t,e,i){var s=new rE(t,i);return t.add.existing(s),s},KM=function(t){void 0===t&&(t=xm);return class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},qM=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0}));i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange);return n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=iD(this.styles,"inputRow")||{},r=eD(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return sk(t,tE(e,i))}(this.scene,t,sD(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),rD(this,y(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=Y_(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},lD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},uD={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const cD=Phaser.Utils.Objects.GetValue;class dD extends gw{constructor(t,e){void 0===e&&(e={});var i,s=cD(e,"text");fn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new W_(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=cD(e,"space",void 0);h&&(h.child=cD(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=cD(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(dD.prototype,lD,uD);var pD={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new dD(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},gD={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=Y_(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const fD=Phaser.Utils.Objects.GetValue,vD=Phaser.Math.Linear,mD=Phaser.Math.Snap.Floor;var yD={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=fD(s,r),a=function(t,e){var i=new jS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=fD(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var u=e.inputNumber||e.inputText,c=Y_(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=fD(e,"proportion.range.inputText",o);t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=vD(t.minValue,t.maxValue,a.value);t.step&&(e=mD(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},bD=function(t,e){var i=new FP(t,e);return t.add.existing(i),i};const xD=Phaser.Utils.Objects.GetValue;var kD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=xD(e,"incDec")||{},r={text:null,action:null},n=bD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=Y_(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=PO(i,l),c=Object.assign(y(r),s.decButton||{}),d=PO(i,c);n.addButton(u),n.addButton(d);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new gL(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const vL=Phaser.Utils.Objects.GetValue;var mL=function(t,e){var i=vL(e,"expandDirection",void 0);"string"==typeof i&&(i=yL[i]);var s,r,n,a,o,h,l,u=(n="alignTargetX",tt(s=e,r="alignTarget")?Q(s,r):n&&tt(s,n)?Q(s,n):a&&tt(s,a)?Q(s,a):o),c=vL(e,"alignTargetY",u),d=vL(e,"alignOffsetX",0),p=vL(e,"alignOffsetY",0),g=vL(e,"alignSide","").includes("right"),f=vL(e,"bounds"),v=0===i,m=!v&&!(1===i),y=g?1:0,b=v||m?0:1;t.setOrigin(y,b),h=g?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+p);var x=f;x||(x=un(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const yL={down:0,up:1},bL=Phaser.Utils.Objects.GetValue;class xL extends Ag{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Bp(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ap(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),mL(t,e),t.isRexSizer&&t.layout();var i=bL(e,"touchOutsideClose",!1),s=bL(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Yg(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var kL={openColorPicker:function(){if(!this.colorPicker){var t=fL.call(this).layout(),e=new xL(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(kL,BD);const CL=Phaser.Utils.Objects.GetValue;class SL extends RD{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(CL(i,"width",160),CL(i,"height",170));var n=CL(i,"background");r=n?function(t){return sk(t,n)}:CL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(CL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(CL(i,"expandDirection")),this.setColorPickerEaseInDuration(CL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(CL(i,"easeOut",200)),this.setColorPickerTransitInCallback(CL(i,"transitIn")),this.setColorPickerTransitOutCallback(CL(i,"transitOut")),this.setColorPickerBounds(CL(i,"bounds"));var a=CL(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&(!1!==o&&null!==o)){this.setColorComponentsHeight(CL(o,"height",30)),this.setColorComponentsFormatLabelConfig(CL(o,"formatLabel"));var h=CL(o,"inputText");h||(h=CL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=CL(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var u=this.childrenMap.swatch;u&&s&&this.onClick(u,this.openColorPicker,this)}}Object.assign(SL.prototype,kL);var wL={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new SL(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},TL={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},PL={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},OL={buildShapes(){this.addShape((new Yu).setName("box")).addShape((new Gu).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,c=a/2,d=s*this.boxSize-a;h.setTopLeftPosition(r+c+u,n+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,f=2*p,v=3*p;l.startAt(g,f).lineTo(f,v).lineTo(v,g).offset(r+u,n+u).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},_L={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ul(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},EL={};Object.assign(EL,TL,PL,OL,_L);const ML=23730,DL=Phaser.Utils.Objects.GetValue,LL=Phaser.Utils.Objects.IsPlainObject;class AL extends eu{constructor(t,e,i,s,r,n,a){LL(e)?(e=DL(a=e,"x",0),i=DL(a,"y",0),s=DL(a,"width",2),r=DL(a,"height",2),n=DL(a,"color",ML)):LL(n)&&(n=DL(a=n,"color",ML)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=ML),this.setBoxShape(DL(a,"circleBox",!1)),this.setBoxFillStyle(n,DL(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(DL(a,"uncheckedColor",null),DL(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(DL(a,"boxLineWidth",4),DL(a,"boxStrokeColor",n),DL(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,DL(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),DL(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(DL(a,"checkerColor",16777215),DL(a,"checkerAlpha",1)),this.setBoxSize(DL(a,"boxSize",1)),this.setCheckerSize(DL(a,"checkerSize",1)),this.setCheckerAnimationDuration(DL(a,"animationDuration",150)),this.buildShapes();var o=DL(a,"checked");void 0===o&&(o=DL(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(AL.prototype,EL);const RL=Phaser.Utils.Objects.GetValue,BL=Phaser.Utils.Objects.IsPlainObject;class FL extends AL{constructor(t,e,i,s,r,n,a){BL(e)?(e=RL(a=e,"x",0),i=RL(a,"y",0),s=RL(a,"width",2),r=RL(a,"height",2),n=RL(a,"color",ML)):BL(n)&&(n=RL(a=n,"color",ML)),super(t,e,i,s,r,n,a),this._click=new df(this,RL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(RL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var IL={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new FL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},jL={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},zL={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},NL={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},GL=function(t,e,i){return(e-t)*i+t};const WL=Phaser.Math.Linear;var VL={buildShapes(){this.addShape((new Yu).setName("track")).addShape((new Yu).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&GL(yr(l),yr(u),c))<<16|(255&GL(br(l),br(u),c))<<8|255&GL(xr(l),xr(u),c)),p=WL(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(d,p);var g=this.getShape("thumb");if(this.isSizeChanged){var f=t*this.thumbWidth,v=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(f,v).setRadius(m)}var y=WL(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},YL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ul(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},XL={};Object.assign(XL,jL,zL,NL,VL,YL);const HL=Phaser.Utils.Objects.GetValue,$L=Phaser.Utils.Objects.IsPlainObject,UL=23730;class KL extends eu{constructor(t,e,i,s,r,n,a){$L(e)?(e=HL(a=e,"x",0),i=HL(a,"y",0),s=HL(a,"width",2),r=HL(a,"height",2),n=HL(a,"color",UL)):$L(n)&&(n=HL(a=n,"color",UL)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=UL),this.setTrackFillStyle(n,HL(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(HL(a,"falseValueTrackColor",function(t){var e=.3*yr(t)+.59*br(t)+.11*xr(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),HL(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(HL(a,"thumbColor",16777215),HL(a,"thumbAlpha",1)),this.setTrackSize(HL(a,"trackWidth",.9),HL(a,"trackHeight",.5)),this.setTrackRadius(HL(a,"trackRadius",.5*this.trackHeight));var o=HL(a,"thumbHeight",void 0),h=HL(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(HL(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(HL(a,"thumbLeft",.3),HL(a,"thumbRight",void 0)),this.setRTL(HL(a,"rtl",!1)),this.setToggleAnimationDuration(HL(a,"animationDuration",150)),this.buildShapes(),this.setValue(HL(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(KL.prototype,XL);const qL=Phaser.Utils.Objects.GetValue;class JL extends KL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new df(this,qL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(qL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var ZL={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new JL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},QL={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=tA[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const tA={down:0,up:1},eA=Phaser.Utils.Objects.GetValue;var iA=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){s=sA(e,d,this.listWrapEnable);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=rA(e,this.listCreateSliderTrackCallback),g=rA(e,this.listCreateSliderThumbCallback);u=new BM(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:eA(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=sA(e,d,this.listWrapEnable),u=s;return t&&u.addBackground(t,"background"),this.listDraggable&&u.setDraggable(!0),u!==s&&s.on("button.over",(function(t,e,i,s){u.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){u.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){u.emit("button.click",t,e,i,s)})),u},sA=function(t,e,i){var s;return i?(e.orientation="x",s=new lO(t,e)):(e.orientation="y",s=new FP(t,e)),t.add.existing(s),s},rA=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},nA={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;void 0===e?t=0:t=(e+1)%this.listPanel.getButtons().length;return this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},aA={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=iA.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new xL(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(aA,QL,nA);const oA=Phaser.Utils.Objects.GetValue;class hA extends WC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(oA(e,"options"));var i=oA(e,"list");this.setWrapEnable(oA(i,"wrap",!1)),this.setCreateButtonCallback(oA(i,"createButtonCallback")),this.setCreateListBackgroundCallback(oA(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(oA(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(oA(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(oA(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(oA(i,"scroller")),this.setListMouseWheelScrollerConfig(oA(i,"mouseWheelScroller")),this.setButtonClickCallback(oA(i,"onButtonClick")),this.setButtonOverCallback(oA(i,"onButtonOver")),this.setButtonOutCallback(oA(i,"onButtonOut")),this.setListExpandDirection(oA(i,"expandDirection")),this.setListEaseInDuration(oA(i,"easeIn",500)),this.setListEaseOutDuration(oA(i,"easeOut",100)),this.setListTransitInCallback(oA(i,"transitIn")),this.settListTransitOutCallback(oA(i,"transitOut")),this.setListMaxHeight(oA(i,"maxHeight",0)),this.setListSize(oA(i,"width"),oA(i,"height",0)),this.setListAlignmentMode(oA(i,"alignParent","text")),this.setListAlignmentSide(oA(i,"alignSide","")),this.setListBounds(oA(i,"bounds")),this.setListSpace(oA(i,"space")),this.setListDraggable(oA(i,"draggable",!1)),this.setValueChangeCallback(oA(e,"setValueCallback"),oA(e,"setValueCallbackScope")),this.setValue(oA(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(hA.prototype,aA);var lA=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?y(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=Iw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=PO(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return sk(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return sk(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new hA(t,e);return t.add.existing(i),i},uA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=lA(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=uA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const dA=Phaser.Utils.Objects.GetValue;var pA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?y(e.button):{},r=dA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=bD(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n0?r.addScrollable():r).addRows(s,i,!0),r}(t,e,i,s)}}var mA={csv2md:function(t,e={}){"string"==typeof e&&(e={title:e});for(var i,s,r,{title:n}=e,a=lr.parse(t).data,o=!1,h=!1,l=[],u=0,c=a.length;uh;u--){for(c=0;c0&&this.wrapMode!==Bm&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=zm[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],u=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=mk(t,l,u);else{var d=vk(t,l,u);c&&(d=c(d)),this[o]=d}}var p=mk(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=mk(t,"fill",null);null!==g&&(this.color=xy(g));var f=mk(t,"metrics",!1);return f?this.metrics={ascent:mk(f,"ascent",0),descent:mk(f,"descent",0),fontSize:mk(f,"fontSize",0)}:!e&&this.metrics||(this.metrics=fk(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=fk(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=mk(t,"fontFamily","Courier"),this.fontSize=mk(t,"fontSize","16px"),this.fontStyle=mk(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=xy(t,this.parent.canvas,this.parent.context),this.backgroundColor2=xy(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=xy(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=xy(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=xy(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=xy(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=xy(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=xy(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=zm[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=mk(e,"fontFamily",this.fontFamily),this.fontSize=mk(e,"fontSize",this.fontSize),this.fontStyle=mk(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var bk={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),Ly(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,u,c,d,p=a.halign,g=a.valign,f=a.lineHeight,v=r.lines,m=v.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),u=l+h;var b=this.rtl,x=b?this.parent.width:void 0;d="center"===g?Math.max((s-h*f)/2,0):"bottom"===g?Math.max(s-h*f-2,0):0,d+=e;for(var k=l;k0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0){u=i+a.strikethroughOffset-a.strikethroughThickness/2;this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)}if(n.restore(),t.hasAreaMarker&&t.width>0){var c,d=t.prop.area;if(d)c={key:d};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const xk=Phaser.Utils.Objects.GetValue,kk=Lm,Ck=Am;class Sk{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=xk(t,"text",""),this.x=xk(t,"x",0),this.y=xk(t,"y",0),this.width=xk(t,"width",0);var e=xk(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=xk(t,"newLineMode",0),this.startIndex=xk(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Ck&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==kk&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Ck&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const wk=Phaser.Utils.Objects.GetFastValue,Tk=Lm,Pk=Rm;class Ok{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=wk(t,"tagToText",yd),this.tagToTextScope=wk(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,u):c+=this.tagToText(a,l,u),u=l,!(h>=e)));d++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var _k={};const Ek=Phaser.Geom.Rectangle;var Mk=new Ra;class Dk{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Hk(f)){""!==b?a.push(n.getLine(b,x,zk)):0===k&&r>0&&a.push(n.getLine("",0,zk)),a.push(...Yk(f,e,Wk,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+v)>h?(a.push(n.getLine(b,x,zk)),b=f,x=v,h=s):(b+=f,x=m),k===C-1&&a.push(n.getLine(b,x,l))}return a},Xk=function(t,e){var i;switch(e){case Gk:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Uk&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Ok({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return iS(this.sizerChildren,null),om.call(this,t),this}},rS={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,iS(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},hS={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=vp.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,iS(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)iS(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},uS=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const cS=Phaser.Utils.Objects.IsPlainObject,dS=Phaser.Utils.Objects.GetValue;class pS extends $v{constructor(t,e,i,s,r,n,a,o,h,l){cS(e)?(e=dS(l=e,"x",0),i=dS(l,"y",0),s=dS(l,"width",void 0),r=dS(l,"height",void 0),n=dS(l,"column",l.col||0),a=dS(l,"row",0),o=dS(l,"columnProportions",0),h=dS(l,"rowProportions",0)):cS(s)?(s=dS(l=s,"width",void 0),r=dS(l,"height",void 0),n=dS(l,"column",l.col||0),a=dS(l,"row",0),o=dS(l,"columnProportions",0),h=dS(l,"rowProportions",0)):cS(n)?(n=dS(l=n,"column",l.col||0),a=dS(l,"row",0),o=dS(l,"columnProportions",0),h=dS(l,"rowProportions",0)):cS(o)&&(o=dS(l=o,"columnProportions",0),h=dS(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(dS(l,"createCellContainerCallback")),this.setIndentLeft(dS(l,"space.indentLeftOdd",0),dS(l,"space.indentLeftEven",0)),this.setIndentTop(dS(l,"space.indentTopOdd",0),dS(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,dS(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=lS.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=uS.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(pS.prototype,hS);const gS=Phaser.Utils.Objects.GetValue;const fS=Phaser.Math.Percent;var vS=function(t,e,i){var s;return t.y===e.y?s=fS(i.x,t.x,e.x):t.x===e.x&&(s=fS(i.y,t.y,e.y)),s},mS=function(t,e,i){var s,r;this.enable&&(yS.x=e,yS.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=vS(s,r,yS))},yS={},bS=function(t,e,i){if(this.enable&&t.isDown){var s,r;xS.x=t.worldX,xS.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=vS(s,r,xS);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},xS={},kS=function(t,e){void 0===e&&(e=CS);var i=this.childrenMap.thumb,s=i.x,r=i.y;return Wd(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},CS={};const SS=Phaser.Display.Align.LEFT_CENTER,wS=Phaser.Display.Align.TOP_CENTER;var TS={};const PS=Phaser.Display.Align.RIGHT_CENTER,OS=Phaser.Display.Align.BOTTOM_CENTER;var _S={};const ES=Phaser.Math.Linear;var MS={};const DS=Phaser.Display.Align.LEFT_CENTER,LS=Phaser.Display.Align.TOP_CENTER,AS=Phaser.Display.Align.RIGHT_CENTER,RS=Phaser.Display.Align.BOTTOM_CENTER;const BS=Phaser.Utils.Objects.GetValue,FS=Phaser.Utils.Objects.IsPlainObject,IS=Phaser.Math.Clamp,jS=Phaser.Math.Snap.To;class zS extends(dc(xm)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=BS(e,"reverseAxis",!1);var i=BS(e,"background",void 0),s=BS(e,"track",void 0),r=BS(e,"indicator",void 0),n=BS(e,"thumb",void 0);if(i&&(FS(i)&&(i=sk(t,i)),this.addBackground(i)),s&&(FS(s)&&(s=sk(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(FS(r)&&(r=sk(t,r)),this.pin(r)),n){FS(n)&&(n=sk(t,n)),this.pin(n);var a=BS(e,"thumbOffsetX",0),o=BS(e,"thumbOffsetY",0);this.setThumbOffset(a,o)}var h=BS(e,"input",0);switch("string"==typeof h&&(h=NS[h]),h){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",mS,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",bS,this).on("pointermove",bS,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(BS(e,"enable",void 0));var l=BS(e,"tick",void 0);void 0===l&&(l=BS(e,"gap",void 0)),this.setGap(l),this.setValue(BS(e,"value",0),BS(e,"min",void 0),BS(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=jS(t,this.gap));var e=this._value;this._value=IS(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const NS={pan:0,drag:0,click:1,none:-1};var GS={getStartPoint:function(t){if(void 0===t&&(t=TS),this.childrenMap.thumb){var e=0===this.orientation?SS:wS;kS.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=_S),this.childrenMap.thumb){var e=0===this.orientation?PS:OS;kS.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=MS),s.x=ES(e.x,i.x,t),s.y=ES(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var o=zr(a);if(n){h=a.x-o*a.originX;i=this.right-h}else{var h;i=(h=a.x-o*a.originX)+o-this.left}}else{var l=Nr(a);if(n){u=a.y-l*a.originY;s=this.bottom-u}else{var u;s=(u=a.y-l*a.originY)+l-this.top}}else 0===this.orientation?i=this.width*t:s=this.height*t;Sp(e,i,s),r=n?0===this.orientation?AS:RS:0===this.orientation?DS:LS,Gd(e,this,r),this.resetChildPositionState(e)}};Object.assign(zS.prototype,GS);const WS=Phaser.Utils.Objects.GetValue;class VS extends xm{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s=WS(e,"background",void 0),r=WS(e,"buttons",void 0),n=WS(r,"top",WS(r,"left",void 0)),a=WS(r,"bottom",WS(r,"right",void 0)),o=WS(e,"slider",void 0);(s&&this.addBackground(s),n)&&(this.add(n),new wf(n).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this));if(o){var h;if(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,0===this.orientation)h=void 0===WS(o,"width",void 0)?1:0;else h=void 0===WS(o,"height",void 0)?1:0;i=new zS(t,o),t.add.existing(i),this.add(i,{proportion:h})}a&&(this.add(a),new wf(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[n,a];this.addChildrenMap("background",s),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var u=WS(e,"valuechangeCallback",null);if(null!==u){var c=WS(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,c)}this.setEnable(WS(e,"enable",void 0)),this.setValue(WS(e,"value",0)),this.setScrollStep(WS(r,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class YS extends Tg{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const XS=Phaser.Utils.Objects.GetValue,HS=Phaser.Math.Distance.Between;class $S extends Nn{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=XS(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(XS(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(XS(t,"enable",!0)),this.holdThreshold=XS(t,"holdThreshold",50),this.pointerOutReleaseEnable=XS(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return sv(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:HS(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!tf(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!tf(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const US=Phaser.Utils.Objects.GetValue;class KS{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(US(t,"value",0)),this.setSpeed(US(t,"speed",0)),this.setAcceleration(US(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class qS{constructor(){this.value,this.dir,this.movement=new KS}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const tw={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},ew=Phaser.Utils.Objects.GetValue;class iw extends Nn{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=ew(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(ew(e,"speed",.1)),this.setEnable(ew(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(ew(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||tf(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const sw=Phaser.Utils.Objects.GetValue;var rw=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?sw(s,l,void 0):sw(s,"slider",void 0)){var u,c,d;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=po(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new VS(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=sw(r,"tickLength",void 0);var p=sw(r,"position",0);"string"==typeof p&&(p=nw[p]);var g,f,v=sw(s,`space.slider${i}`,void 0);void 0===v&&void 0===(v=sw(s,"space.slider",void 0))&&(o?v=0:g=sw(s,"space.child",0)),f=void 0===g?"number"==typeof v:"number"==typeof g,a?0===p?(u=2,c=1,d=void 0===g?f?{left:v}:v:{left:sw(g,"right",g)}):(u=0,c=1,d=void 0===g?f?{right:v}:v:{right:sw(g,"left",g)}):0===p?(u=1,c=2,d=void 0===g?f?{top:v}:v:{top:sw(g,"bottom",g)}):(u=1,c=0,d=void 0===g?f?{bottom:v}:v:{bottom:sw(g,"top",g)}),e.add(n,{column:u,row:c,align:"center",padding:d,expand:!0}),t[`hideUnscrollableSlider${i}`]=sw(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=sw(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=sw(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=sw(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=sw(s,"scrollDetectionMode");"string"==typeof b&&(b=aw[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?sw(s,x,!0):sw(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new QS(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var k,C,S,w,T,P=sw(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);(P&&h&&(void 0!==b&&(P.focus=1===b?2:0),k=new iw(h,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,k),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",k)),n)&&(o?(C=a?"t":"s",w=`scroll${i}`):(C="t",w="scroll"),n.on("valuechange",(function(e){t[C]=e,t.emit(w,t)})));y&&(o?(S=`childO${i}`,w=`scroll${i}`):(S="childOY",w="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(w,t)})));k&&(T=o?`addChildO${i}`:"addChildOY",k.on("scroll",(function(e){t[T](-e,!0)})))};const nw={right:0,left:1,bottom:0,top:1},aw={gameObject:0,rectBounds:1},ow=Phaser.Utils.Objects.GetValue;var hw=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=ow(e,"width"),a=ow(e,"height");n||(ow(e,"child.expandWidth",!0)||(s[1]=0));a||(ow(e,"child.expandHeight",!0)||(r[1]=0));var o=new pS(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=gS(i,"child"),r=gS(s,"gameObject",void 0);if(r){var n=gS(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=gS(n,"top",0),a.bottom=gS(n,"bottom",0),o.left=gS(n,"left",0),o.right=gS(n,"right",0);break;case 1:a.top=gS(n,"left",0),a.bottom=gS(n,"right",0),o.top=gS(n,"top",0),o.bottom=gS(n,"bottom",0);break;default:a.top=gS(n,"top",0),a.bottom=gS(n,"bottom",0),a.left=gS(n,"left",0),a.right=gS(n,"right",0)}e.add(r,{column:1,row:1,align:gS(s,"align","center"),padding:o,expand:{width:gS(s,"expandWidth",!0),height:gS(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:rw(t,o,"y",e);break;case 1:rw(t,o,"x",e);break;default:rw(t,o,"y",e),rw(t,o,"x",e)}return o},lw=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},uw=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},cw=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&nthis.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var _w=function(t){return t.add.text(0,0,"")};Object.assign(Ow.prototype,Sw);var Ew={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Mw={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Dw=Phaser.Utils.Objects.GetValue;class Lw extends fw{constructor(t,e){void 0===e&&(e={});var i=Dw(e,"text",void 0),s=Dw(e,"textWidth",void 0),r=Dw(e,"textHeight",void 0),n=Dw(e,"textCrop",!!i.setCrop),a=Dw(e,"textMask",!n),o=Dw(e,"content",""),h=new Ow(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:Dw(e,"clampChildOY",!1),alwaysScrollable:Dw(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=Dw(e,"space",void 0);l&&(l.child=Dw(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Lw.prototype,Ew,Mw);const Aw=Phaser.Utils.Objects.GetValue;var Rw=function(t,e,i){e=e?y(e):{};var s=Aw(i,"background",sk),r=Aw(i,"text",Bw),n=Aw(i,"track",sk),a=Aw(i,"thumb",sk);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var o=e.slider;!1!==o&&null!==o&&(void 0===o&&(o={}),n?o.track=n(t,o.track):delete o.track,a?o.thumb=a(t,o.thumb):delete o.thumb,e.slider=o);var h=new Lw(t,e);return t.add.existing(h),h},Bw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new GC(t,e);break;case"bbcodetext":case"bbcode":s=new IC(t,0,0,"",e);break;case"label":s=new YC(t,e);break;case"textarea":s=Rw(t,e);break;default:s=new ak(t,e)}return ik(s,e),t.add.existing(s),s},Fw=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new tk(t,e):new Lx(t,e);break;case"roundRectangle":s=new xx(t,e);break;default:s=new Fx(t,e)}return ik(s,e),t.add.existing(s),s};const Iw=Phaser.Utils.Objects.GetValue;var jw=function(t,e,i){e=e?y(e):{};var s=Iw(i,"background",sk),r=Iw(i,"text",Bw),n=Iw(i,"icon",Fw),a=Iw(i,"action",Fw);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};const zw=Phaser.Utils.Objects.GetValue;var Nw=function(t,e,i){var s,r,n=zw(i,"innerBackground",sk),a=zw(i,"separator",sk),o=zw(i,"title",Bw);null!==e.innerBackground&&n&&(s=n(t,e.innerBackground)),null!==e.separator&&a&&(r=a(t,e.separator)),e=jw(t,e,i),s?e.innerBackground=s:delete e.innerBackground,r?e.separator=r:delete e.separator,null!==e.title&&o?e.title=o(t,e.title):delete e.title;var h=e.background;return h&&(s?t.children.moveBelow(h,s):r&&t.children.moveBelow(h,r)),e};class Gw extends ex{constructor(t,e,i){super(t,e=Nw(t,e,i))}}var Ww={start:function(t){return this.easeValueTask||(this.easeValueTask=new ul(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const Vw=Phaser.Utils.Objects.GetValue;class Yw extends eu{constructor(t,e){super(t,Vw(e,"x",0),Vw(e,"y",0),Vw(e,"width",64),Vw(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),Vw(e,"start",!0)&&this.start()}resetFromConfig(t,e){var i;return void 0===e&&(e=!1),i=e?1e3:this.duration,this.setDuration(Vw(t,"duration",i)),i=e?"Linear":this.ease,this.setEase(Vw(t,"ease",i)),i=e?0:this.delay,this.setDelay(Vw(t,"delay",i)),i=e?0:this.repeatDelay,this.setRepeatDelay(Vw(t,"repeatDelay",i)),i=e?16777215:this.color,this.setColor(Vw(t,"color",i)),i=e?0:this.value,this.setValue(Vw(t,"value",i)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(Yw.prototype,Ww);const Xw=Phaser.Math.DegToRad,Hw=Phaser.Math.Linear,$w=Phaser.Math.Easing.Expo.In,Uw={right:0,down:1,left:2,up:3};var Kw=function(t,e,i,s,r,n,a,o,h,l,u){var c=Jw(e,0,s,r,n,a,o,h,l,u);t.startAt(c.x,c.y);var d=Jw(i,0,s,r,n,a,o,h,l,u);t.lineTo(d.x,d.y);var p=Jw(i,i,s,r,n,a,o,h,l,u);t.lineTo(p.x,p.y);var g=Jw(0,i,s,r,n,a,o,h,l,u);t.lineTo(g.x,g.y);var f=Jw(0,e,s,r,n,a,o,h,l,u);t.lineTo(f.x,f.y);var v=Jw(e,e,s,r,n,a,o,h,l,u);t.lineTo(v.x,v.y),t.close()},qw={},Jw=function(t,e,i,s,r,n,a,o,h,l){var u=t*i,c=e*s;return qw.x=a*u+o*c+r,qw.y=h*u+l*c+n,qw},Zw={setDirection(t){return"string"==typeof t&&(t=Uw[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Gu)},updateShapes(){var t,e,i,s,r,n;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Xw(315);i=Math.cos(a),s=Math.sin(a);var o=Xw(45);r=Math.cos(o),n=Math.sin(o);break;case 3:t=this.centerX,e=this.centerY+this.radius;a=Xw(135);i=Math.cos(a),s=Math.sin(a);o=Xw(225);r=Math.cos(o),n=Math.sin(o);break;case 2:t=this.centerX+this.radius,e=this.centerY;a=Xw(225);i=Math.cos(a),s=Math.sin(a);o=Xw(315);r=Math.cos(o),n=Math.sin(o);break;default:t=this.centerX-this.radius,e=this.centerY;a=Xw(45);i=Math.cos(a),s=Math.sin(a);o=Xw(135);r=Math.cos(o),n=Math.sin(o)}for(var h=this.radius/7,l=this.getShapes(),u=0,c=l.length;uthis.value)for(var u=0;uthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(d=this.getSizerConfig(t)).align=i,d.padding=El(s),aP(r)?(d.expandWidth=oP(r,"width",!1),d.expandHeight=oP(r,"height",!1)):(d.expandWidth=r,d.expandHeight=r),t.isRexSizer||(d.expandWidth&&(t.minWidth=void 0===n?zr(t):n),d.expandHeight&&(t.minHeight=void 0===a?Nr(t):a)),d.alignOffsetX=o,d.alignOffsetY=h,d.alignOffsetOriginX=u,d.alignOffsetOriginY=c,d.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},cP={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),sp.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return om.call(this,t),this}},dP={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,o,h,l,u,c,d=this.innerLeft,p=this.innerTop,g=this.innerWidth,f=this.innerHeight,v=this.sizerChildren;for(var m in v)(t=v[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,of.call(this,t),l=this.getExpandedChildWidth(t),u=this.getExpandedChildHeight(t),e.aspectRatio>0&&(rP.width=e.aspectRatio,rP.height=1,nP.width=l,nP.height=u,l=(c=cl(rP,nP,"FIT",!0)).width,u=c.height),t.isRexSizer?(t.runLayout(this,l,u),Uv(t,this)):Sp(t,l,u),s=d+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=f-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zr(t)),void 0===u&&(u=Nr(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*u)*this.scaleY,hf.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(dP,uP,cP);const pP=Phaser.Utils.Objects.IsPlainObject,gP=Phaser.Utils.Objects.GetValue;class fP extends $v{constructor(t,e,i,s,r,n){pP(e)?(e=gP(n=e,"x",0),i=gP(n,"y",0),s=gP(n,"width",void 0),r=gP(n,"height",void 0)):pP(s)&&(s=gP(n=s,"width",void 0),r=gP(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(fP.prototype,dP);const vP=xm.prototype.add,mP=xm.prototype.addSpace;var yP=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)&&mP.call(this),vP.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&mP.call(this),this.hasTailSpace=s}else vP.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;vP.call(this,t,{index:r,proportion:i,expand:!0})}else vP.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},bP={addButton(t){if(ef(t))for(var e=t,i=0,s=e.length;i=0;i--)CP.call(this,e[i],t);return this}},wP=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},TP=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,wP.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},PP={add(t){return this.buttons.push(t),t._click||(t._click=new df(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),TP.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;so.height/2)){r>(h=NP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];if(!l||l.y!==o.y)r>(h=NP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const WP=Phaser.Utils.Objects.IsPlainObject,VP=Phaser.Utils.Objects.GetValue,YP=Phaser.Display.Align.CENTER;var XP=function(t,e,i,s){if("\n"===t)return this.addNewLine(),this;var r,n,a,o,h;(qd.call(this,t),WP(e))&&(e=VP(h=e,"padding",0),i=VP(h,"key",void 0),s=VP(h,"index",void 0),r=VP(h,"offsetX",0),n=VP(h,"offsetY",0),a=VP(h,"offsetOriginX",0),o=VP(h,"offsetOriginY",0));return void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=YP,h.padding=El(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this},HP={add(t,e,i){if(ef(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,om.call(this,t),this}},KP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;sr&&iO.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)oO.call(this,e[i],t);return this}};const lO=Phaser.Utils.Objects.GetValue;class uO extends tO{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new AP({parent:this,eventEmitter:lO(e,"eventEmitter",this),groupName:lO(e,"groupName",void 0),clickConfig:lO(e,"click",void 0)}).setButtonsType(e);var s=lO(e,"background",void 0),r=lO(e,"buttons",void 0);this.buttonsAlign=lO(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(uO.prototype,rO,hO,LP,BP);const cO=pS.prototype.add;var dO={addButton(t,e,i){return cO.call(this,t,e,i,void 0,0,this.buttonsExpand),this.buttonGroup.add(t),this},addButtons(t,e){for(var i=0,s=t;i=0;i--)fO.call(this,e[i],t);return this}};const mO=Phaser.Utils.Objects.GetValue;class yO extends pS{constructor(t,e){void 0===e&&(e={});var i=mO(e,"row",0),s=mO(e,"column",e.col||0),r=mO(e,"createCellContainerCallback"),n=mO(e,"buttons",void 0),a=mO(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;h=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(r=e.getCharChild(t.prevCursorPosition))&&("\n"===r.text&&r.clearTextSize(),e.emit("cursorout",r,t.prevCursorPosition,e)),null!=s&&(r=e.getCharChild(s))&&("\n"===r.text&&r.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,u=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=u<0?0-u:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(r),e.emit("cursorin",r,s,e)),e.emit("movecursor",s,t.prevCursorPosition,e),t.prevCursorPosition=s}}(this)):(g_(this),f_(this)),this}setNumberInput(){return this.onUpdateCallback=p_,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const y_=Phaser.Utils.Objects.GetValue,b_=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var x_=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},k_=function(t){fr(t)||this.setCursorStyle(t).on("cursorin",(function(t){var e=this.cursorStyle,i=gx(t.style,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("cursorout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},C_=function(t){fr(t)||this.setRangeStyle(t).on("rangein",(function(t){var e=this.rangeStyle,i=gx(t.style,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("rangeout",(function(t){t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)},S_=function(t){fr(t)||this.setFocusStyle(t).on("open",(function(){var t=this.background,e=this.focusStyle,i=gx(t,e);Pl(e,i)||(t.styleSave=i,t.modifyStyle(e))}),this).on("close",(function(){var t=this.background;t.styleSave&&(t.modifyStyle(t.styleSave),t.styleSave=void 0)}),this)};function w_(){}function T_(t,e,i,s,r){let n=0,a=e.length,o=0,h=0;for(;nt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}w_.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let u=[{newPos:-1,components:[]}],c=this.extractCommon(u[0],e,t,0);if(u[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function d(){for(let s=-1*h;s<=h;s+=2){let h,l=u[s-1],c=u[s+1],d=(c?c.newPos:0)-s;l&&(u[s-1]=void 0);let p=l&&l.newPos+1=a&&d+1>=o)return n(T_(r,h.components,e,t,r.useLongestToken));u[s]=h}else u[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();d()||t()}),0)}();else for(;h<=l;){let t=d();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const P_=new w_;const O_=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,__=/\S/,E_=new w_;E_.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!__.test(t)&&!__.test(e)},E_.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(A_(t,null,null,i),i," ")},L_.equals=function(t,e){return w_.prototype.equals.call(L_,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const R_=new w_;R_.tokenize=function(t){return t.slice()},R_.join=R_.removeEmpty=function(t){return t};const B_=Phaser.Utils.Array.Remove;var F_=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),B_(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,P_.diff(h,l,u)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},G_={cursorMoveLeft(){if(!this.isOpened)return this;var t=j_(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=j_(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=z_(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=j_(N_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=z_(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=j_(N_(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const W_=Phaser.Utils.Objects.IsPlainObject;class V_ extends Vb{constructor(t,e,i,s,r,n){W_(e)?n=e:W_(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(tt(e,"wrap.vAlign")||Z(e,"wrap.vAlign",s=i?"center":"top"),tt(e,"wrap.wrapMode")||Z(e,"wrap.wrapMode","char"),tt(e,"wrap.maxLines")||Z(e,"wrap.maxLines",s=i?1:void 0),i&&Z(e,"wrap.wrapWidth",1/0),tt(e,"wrap.useDefaultTextHeight")||Z(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!tt(e.edit,"inputType")){var s=i?"text":"textarea";Z(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Uo(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=px(n.background,"focus"),h=px(n.style,"cursor"),l=px(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=y_(e,"edit");return void 0===i&&(i={}),t_(e,i,b_),new m_(t,i)}(this,n),x_.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),S_.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),k_.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),fr(l)&&Object.assign(l,h),C_.call(this,l);var u=n.onAddChar;u&&this.on("addchar",u);var c=n.onCursorIn;c&&this.on("cursorin",c);var d=n.onCursorOut;d&&this.on("cursorout",d);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var f=p?n.onCursorOut:n.onRangeOut;f&&this.on("rangeout",f);var v,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((v=this.createCharChild("|")).text="",v),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0&&Z(t,"expandTextWidth",!0),h>0&&Z(t,"expandTextHeight",!0),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new wc(t,e);return ik(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var y=!1;i.hasOwnProperty("action")||(i.action=function(t,e){void 0===e&&(e={});var i=new VT(t,e);return ik(i,e),t.add.existing(i),i},y=!0);var b,x,k=new Gw(r,t,i);k.setMinSize(o,h).setOrigin(.5,1).layout(),r.add.existing(k),wr(k,e),k.vpx=l,k.vpy=u,k.frameDelimiter=c,y&&(b=k.getElement("action"),k.setChildVisible(b,!1)),Mc(k),k.emitClick=function(){k.emit("click")},void 0===d&&(d=v.getData("$clickTarget")),null===d||(x="screen"===d.toLowerCase()?f.sys.anyTouchDetector:k.setInteractive()),x&&k.bindEvent(x,"pointerdown",(function(){k.emitClick()})),k.bindEvent(r.input.keyboard,"keydown",(function(t){if(void 0===p&&(p=v.getData("$clickShortcutKeys")),p){var e=p.split("|"),i=XT[t.keyCode];-1!==e.indexOf(i)&&k.emitClick()}}));var C=function(){k.isTyping?k.once("click",C).stop(!0):k.isLastPage?k.complete2Flag||(k.complete2Flag=!0,k.emit("complete2")):k.once("click",C).typeNextPage()},S=function(){k.isPageEnd&&(k.off("click",S),y&&(b.stop(),k.setChildVisible(b,!1)),v.emit("resume.input"))};k._typeNextPage=S,k.on("pageend",(function(){y&&(b.start(),k.setChildVisible(b,!0)),k.once("click",S);let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");var i;(t||e)&&(i=t?0:v.getData("$autoNextPageDelay"),f.sys.timeline.delayCall(i,k.emitClick)),v.emit("pause.input")})).on("start",(function(){k.off("click",C).once("click",C)}));var w=v.getData("$fastTyping"),T=v.getData("$autoNextPage");k.bindScenePreupdateEvent((function(){let t=v.getData("$fastTyping"),e=v.getData("$autoNextPage");if(t!==w)if(k.isTyping){let e;t?e=v.getData("$fastTypingSpeed"):void 0===e&&(e=k.normalTypingSpeed),k.setTypingSpeed(e)}else t&&k.emitClick();else e===T||t||k.isTyping||e&&k.emitClick();w=t,T=e}));var P=function(t,e){if(void 0===g&&(g=v.getData("$fastTypingShortcutKeys")),g){var i=g.split("|"),s=XT[t.keyCode];-1!==i.indexOf(s)&&v.setData("$fastTyping",e)}};return k.bindEvent(r.input.keyboard,"keydown",(function(t){P(t,!0)})),k.bindEvent(r.input.keyboard,"keyup",(function(t){P(t,!1)})),k}}($T(e,`styles.${Jo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Jo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{typing:jc,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=Ac(e,`creators.${Ko}`,void 0);if(!1!==s){if(Rc(s)&&(s=void 0),void 0===s){Ac(e,`styles.${Ko}`,{});s=function(t,{viewport:e}={}){return function(t,i){i.hasOwnProperty("scaleMode")||(i.scaleMode=0);var s=new wc(t,i);t.add.existing(s),wr(s,e);var{vpx:r=.5,vpy:n=.5,vpw:a,vph:o,scaleMode:h}=i;if(s.vpx=r,s.vpy=n,h||void 0!==a||void 0!==o){void 0===a&&(a=1),void 0===o&&(o=1);var l=e.width*a,u=e.height*o;s.resize(l,u)}return Mc(s),s}}(0,{viewport:i})}t.addGameObjectManager({name:Ko,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Do,commands:{cross:Lc,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=XO(e,`creators.${Qo}`,void 0);if(!1!==s){var r;if(HO(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new VO(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Mc(u),u}}(XO(e,`styles.${Qo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Qo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{choice:YO,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=q_(e,`creators.${th}`,void 0);if(!1!==s){var r;if(J_(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=.5,vpy:l=.5}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n);var u=new U_(s,t,i);return u.setMinSize(a,o).setVisible(!1),s.add.existing(u),wr(u,e),u.vpx=h,u.vpy=l,Mc(u),u}}(q_(e,`styles.${th}`,{}),{viewport:i},r);t.addGameObjectManager({name:th,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{input:K_,shake:Dc}})}},function(t,e){var{viewport:i}=e,s=iP(e,`creators.${Zo}`,void 0);if(!1!==s){var r;if(sP(s)&&(r=s,s=void 0),void 0===s)s=function(t,{viewport:e}={},i){return function(s,{vpw:r,vph:n,width:a=0,height:o=0,vpx:h=1,vpy:l=0,alignLeft:u=!1,alignRight:c=!0,alignTop:d=!0,alignBottom:p=!1,text0:g,text1:f,commandExecutor:v,eventSheetManager:m,eventsheet:y}={}){void 0!==r&&(a=e.width*r),void 0!==n&&(o=e.height*n),void 0===i&&(i={}),i.hasOwnProperty("icon")||(i.icon=function(t,e){var i=new wc(t,e);return ik(i,e),i.setOrigin(.5,1),t.add.existing(i),i});var b,x,k=new KT(s,t,i);return g&&k.setTitle(g),f&&k.setText(f),b=u?0:c?1:.5,x=d?0:p?1:.5,k.setMinSize(a,o).setOrigin(b,x).layout(),s.add.existing(k),wr(k,e),k.vpx=h,k.vpy=l,Mc(k),k}}(iP(e,`styles.${Zo}`,{}),{viewport:i},r);t.addGameObjectManager({name:Zo,createGameObject:s,fade:0,viewportCoordinate:{viewport:i},defaultLayer:Ao,commands:{setText:JT,popUp:ZT,shake:Dc}})}}];var Q_=[function(t){t.addExpression("random",(function(t,e){return void 0===t&&void 0===e?(t=0,e=1):void 0===e&&(e=t,t=0),t+Math.random()*(e-t)}))},function(t){t.addExpression("randomInt",(function(t,e){return Math.floor(t+Math.random()*(e-t+1))}))}],tE={$typingSpeed:100,$autoNextPage:!1,$autoNextPageDelay:500,$fastTyping:!1,$fastTypingSpeed:20,$clickShortcutKeys:"SPACE|ENTER",$fastTypingShortcutKeys:"CTRL",$clickTarget:"screen",$transitionDuration:500,$tintOthers:3355443,$shakeDuration:500,$shakeMagnitude:50},eE=function(t,e){var i=po(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i};class iE extends or{constructor(t,e={}){e.commandExecutor=function(t,e){var{layerDepth:i,rootLayer:s,multipleCamerasEnable:r=!1,viewport:n}=e;void 0===n&&(e.viewport=un(t,t.cameras.main));for(var a=new Mo(t,{layers:r?Vo:Yo,layerDepth:i,rootLayer:s}),o=0,h=Z_.length;o0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=dE(r,"x",null);null!==n?(t=n,i=n):(t=dE(r,"left",0),i=dE(r,"right",t));var a=dE(r,"y",null);null!==a?(e=a,s=a):(e=dE(r,"top",0),s=dE(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return fE(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=gE(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const mE={right:0,down:1,left:2,up:3};var yE=function(t){return"string"==typeof t&&(t=mE[t]),t%=4};Object.assign(vE.prototype,uE,cE);class bE extends nE{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new vE(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}}var xE=function(t,e,i){return sk(t,eE(e,i))};class kE extends Ag{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var CE={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;(this.show(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();return e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){(this.setChildScale(i,1,1).hide(i),this.reLayoutEnable)&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout();this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},SE=function(t,e){Gp.popUp.call(t,e,this.expandDirection)},wE=function(t,e){Gp.scaleDown.call(t,e,this.expandDirection)},TE={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=SE.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=wE.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const PE=Phaser.Utils.Objects.GetValue;let OE=class extends xm{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=PE(e,"space"),a=1===this.orientation?"left":"top",o=PE(e,"align.title",a),h=PE(e,"expand.title",!0);this.add(s,{proportion:0,align:o,expand:h,padding:{left:PE(n,"titleLeft",0),right:PE(n,"titleRight",0),top:PE(n,"titleTop",0),bottom:PE(n,"titleBottom",0)}});var l=PE(e,"toggleByTarget",void 0),u=PE(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&gf.onClick.call(l,(function(){this.toggle()}),this,u),this.childTransition=new kE(r),!PE(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}o=PE(e,"align.child","left");var d=(h=PE(e,"expand.child",!0))?1:0;this.add(r,{proportion:d,align:o,expand:h,padding:{left:PE(n,"childLeft",0),right:PE(n,"childRight",0),top:PE(n,"childTop",0),bottom:PE(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(PE(p,"duration",200)),this.setExpandCallback(PE(p,"expandCallback",void 0)),this.setCollapseCallback(PE(p,"collapseCallback",void 0)),this.reLayoutTarget=PE(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var f=e.onExpandComplete;f&&this.on("expand.complete",f);var v=e.onCollapseStart;v&&this.on("collapse.start",v);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=PE(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(OE.prototype,CE,TE);var _E={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},EE={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class ME extends OE{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(ME.prototype,_E,EE);const DE=Phaser.Utils.Objects.GetValue;const LE=Phaser.Utils.Objects.GetValue;const AE=fP.prototype.add;var RE=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),AE.call(this,t,e,i,s,r,n,a,o,h),this},BE={add:RE,addPage:RE};const FE=al.prototype.setChildVisible;var IE={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?(FE.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(FE.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(IE,BE);const jE=Phaser.Utils.Objects.GetValue;class zE extends fP{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(jE(e,"swapMode",0)),this.setFadeInDuration(jE(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=NE[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(zE.prototype,IE);const NE={invisible:0,destroy:1};const GE=Phaser.Utils.Objects.IsPlainObject,WE=Phaser.Utils.Objects.GetValue,VE=Phaser.Utils.String.UUID;var YE={swapPage:function(t,e){var i,s;null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s));return this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},XE={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},HE={top:1,left:3,right:5,bottom:7},$E={top:"bottom",left:"right",right:"left",bottom:"top"},UE={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},KE={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const dM=Phaser.Utils.Objects.GetValue;class pM extends xm{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=dM(e,"background",void 0),s=dM(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:dM(e,"space.title",0)}});var r=dM(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(pM.prototype,uM,cM);const gM=Phaser.Utils.Objects.GetValue;const fM=Phaser.Utils.Objects.GetValue;var vM=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const mM=Phaser.Geom.Intersects.RectangleToRectangle,yM=Phaser.Geom.Rectangle.Overlaps;var bM=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},xM=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},kM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},CM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},SM=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const wM=Phaser.Utils.Objects.GetValue,TM={update:0,everyTick:1};var PM={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(wM(t,"updateMode",0)),this.enableChildrenMask(wM(t,"padding",0)),this.setMaskLayer(wM(t,"layer",void 0)),this.onMaskGameObjectVisible=wM(t,"onVisible"),this.onMaskGameObjectInvisible=wM(t,"onInvisible"),this.maskGameObjectCallbackScope=wM(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=TM[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=Tm.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,o,h,l=!!s||!!r,u=t.getBounds(),c=vM(e),d=0,p=i.length;dthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(DM.prototype,OM);const LM=["top","bottom","centerY","center"],AM=["left","right","centerX","center"];var RM=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=LM.length;a=0?0:Math.abs(l)<=Math.abs(u)?l:u}}else{if(i)for(a=0,o=AM.length;a=0?0:Math.abs(c)<=Math.abs(d)?c:d}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const BM=Phaser.Utils.Objects.GetValue;class FM extends fw{constructor(t,e){void 0===e&&(e={});var i=$C(e),s=BM(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=BM(e,"clampChildOY",!1),s.clampChildOX=BM(e,"clampChildOX",!1);var r,n,a=new DM(t,s);switch(t.add.existing(a),i){case 0:r=BM(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=BM(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:BM(e,"align.panel","center")};var o=BM(e,"space",void 0);o&&(o.child=BM(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Yv(this.childrenMap.child,t),this}}var IM={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:RM.call(this,t,"y",e);break;case 1:RM.call(this,t,"x",e);break;default:RM.call(this,t,"y",e),RM.call(this,t,"x",e)}return this}};Object.assign(FM.prototype,IM);var jM={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},zM={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class NM extends FM{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(NM.prototype,jM,zM);const GM=Phaser.Utils.Objects.GetValue;const WM=Phaser.Utils.Objects.GetValue;const VM=Phaser.Utils.Objects.GetValue;var YM={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=VM(t,"onGetValue"),this.onSetValue=VM(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},XM={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},HM={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const $M=Phaser.Utils.Objects.GetValue;class UM extends xm{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=$M(e,"proportion.title",0),o=$M(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0);a=$M(e,"proportion.inputField",h);this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(UM.prototype,YM,XM,HM);var KM=function(t,e,i){var s=new nE(t,i);return t.add.existing(s),s},qM=function(t){void 0===t&&(t=xm);return class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},JM=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0}));i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange);return n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=sD(this.styles,"inputRow")||{},r=iD(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return sk(t,eE(e,i))}(this.scene,t,rD(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),nD(this,y(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=X_(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},uD={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},cD={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const dD=Phaser.Utils.Objects.GetValue;class pD extends fw{constructor(t,e){void 0===e&&(e={});var i,s=dD(e,"text");fn(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new V_(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,o,h=dD(e,"space",void 0);h&&(h.child=dD(h,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=o!==e;a=t,o=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=dD(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(pD.prototype,uD,cD);var gD={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new pD(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},fD={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=X_(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const vD=Phaser.Utils.Objects.GetValue,mD=Phaser.Math.Linear,yD=Phaser.Math.Snap.Floor;var bD={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=vD(s,r),a=function(t,e){var i=new zS(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=vD(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var u=e.inputNumber||e.inputText,c=X_(i,u).setNumberInput();o=e.defaultExpandWidth?1:0,h=vD(e,"proportion.range.inputText",o);t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=mD(t.minValue,t.maxValue,a.value);t.step&&(e=yD(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},xD=function(t,e){var i=new IP(t,e);return t.add.existing(i),i};const kD=Phaser.Utils.Objects.GetValue;var CD={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=kD(e,"incDec")||{},r={text:null,action:null},n=xD(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var o=e.inputNumber||e.inputText,h=X_(i,o).setNumberInput();h.on("close",(function(){t.setValue(h.value)}));var l=Object.assign(y(r),s.incButton||{}),u=OO(i,l),c=Object.assign(y(r),s.decButton||{}),d=OO(i,c);n.addButton(u),n.addButton(d);var p=s.inputTextIndex||0;n.insert(p,h,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new fL(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const mL=Phaser.Utils.Objects.GetValue;var yL=function(t,e){var i=mL(e,"expandDirection",void 0);"string"==typeof i&&(i=bL[i]);var s,r,n,a,o,h,l,u=(n="alignTargetX",tt(s=e,r="alignTarget")?Q(s,r):n&&tt(s,n)?Q(s,n):a&&tt(s,a)?Q(s,a):o),c=mL(e,"alignTargetY",u),d=mL(e,"alignOffsetX",0),p=mL(e,"alignOffsetY",0),g=mL(e,"alignSide","").includes("right"),f=mL(e,"bounds"),v=0===i,m=!v&&!(1===i),y=g?1:0,b=v||m?0:1;t.setOrigin(y,b),h=g?u.getTopRight().x:u.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+d,l+p);var x=f;x||(x=un(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+d,l+p))};const bL={down:0,up:1},xL=Phaser.Utils.Objects.GetValue;class kL extends Ag{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Bp(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Ap(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),yL(t,e),t.isRexSizer&&t.layout();var i=xL(e,"touchOutsideClose",!1),s=xL(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Yg(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var CL={openColorPicker:function(){if(!this.colorPicker){var t=vL.call(this).layout(),e=new kL(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(CL,FD);const SL=Phaser.Utils.Objects.GetValue;class wL extends BD{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(SL(i,"width",160),SL(i,"height",170));var n=SL(i,"background");r=n?function(t){return sk(t,n)}:SL(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(SL(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(SL(i,"expandDirection")),this.setColorPickerEaseInDuration(SL(i,"easeIn",200)),this.setColorPickerEaseOutDuration(SL(i,"easeOut",200)),this.setColorPickerTransitInCallback(SL(i,"transitIn")),this.setColorPickerTransitOutCallback(SL(i,"transitOut")),this.setColorPickerBounds(SL(i,"bounds"));var a=SL(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&(!1!==o&&null!==o)){this.setColorComponentsHeight(SL(o,"height",30)),this.setColorComponentsFormatLabelConfig(SL(o,"formatLabel"));var h=SL(o,"inputText");h||(h=SL(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=SL(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var u=this.childrenMap.swatch;u&&s&&this.onClick(u,this.openColorPicker,this)}}Object.assign(wL.prototype,CL);var TL={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?y(e):{}:e||(e={});var s=new wL(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},PL={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},OL={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},_L={buildShapes(){this.addShape((new Yu).setName("box")).addShape((new Gu).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var u=s*(1-this.boxSize)/2,c=a/2,d=s*this.boxSize-a;h.setTopLeftPosition(r+c+u,n+c+u).setSize(d,d),this.isCircleShape?h.setRadius(d/2):h.setRadius(0);u=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,f=2*p,v=3*p;l.startAt(g,f).lineTo(f,v).lineTo(v,g).offset(r+u,n+u).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},EL={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ul(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},ML={};Object.assign(ML,PL,OL,_L,EL);const DL=23730,LL=Phaser.Utils.Objects.GetValue,AL=Phaser.Utils.Objects.IsPlainObject;class RL extends eu{constructor(t,e,i,s,r,n,a){AL(e)?(e=LL(a=e,"x",0),i=LL(a,"y",0),s=LL(a,"width",2),r=LL(a,"height",2),n=LL(a,"color",DL)):AL(n)&&(n=LL(a=n,"color",DL)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=DL),this.setBoxShape(LL(a,"circleBox",!1)),this.setBoxFillStyle(n,LL(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(LL(a,"uncheckedColor",null),LL(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(LL(a,"boxLineWidth",4),LL(a,"boxStrokeColor",n),LL(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,LL(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),LL(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(LL(a,"checkerColor",16777215),LL(a,"checkerAlpha",1)),this.setBoxSize(LL(a,"boxSize",1)),this.setCheckerSize(LL(a,"checkerSize",1)),this.setCheckerAnimationDuration(LL(a,"animationDuration",150)),this.buildShapes();var o=LL(a,"checked");void 0===o&&(o=LL(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(RL.prototype,ML);const BL=Phaser.Utils.Objects.GetValue,FL=Phaser.Utils.Objects.IsPlainObject;class IL extends RL{constructor(t,e,i,s,r,n,a){FL(e)?(e=BL(a=e,"x",0),i=BL(a,"y",0),s=BL(a,"width",2),r=BL(a,"height",2),n=BL(a,"color",DL)):FL(n)&&(n=BL(a=n,"color",DL)),super(t,e,i,s,r,n,a),this._click=new df(this,BL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(BL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var jL={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new IL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},zL={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},NL={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},GL={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},WL=function(t,e,i){return(e-t)*i+t};const VL=Phaser.Math.Linear;var YL={buildShapes(){this.addShape((new Yu).setName("track")).addShape((new Yu).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,u,c,d=(l=this.falseValueTrackColor,u=this.trackFillColor,c=i,(255&WL(yr(l),yr(u),c))<<16|(255&WL(br(l),br(u),c))<<8|255&WL(xr(l),xr(u),c)),p=VL(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(d,p);var g=this.getShape("thumb");if(this.isSizeChanged){var f=t*this.thumbWidth,v=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(f,v).setRadius(m)}var y=VL(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},XL={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ul(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},HL={};Object.assign(HL,zL,NL,GL,YL,XL);const $L=Phaser.Utils.Objects.GetValue,UL=Phaser.Utils.Objects.IsPlainObject,KL=23730;class qL extends eu{constructor(t,e,i,s,r,n,a){UL(e)?(e=$L(a=e,"x",0),i=$L(a,"y",0),s=$L(a,"width",2),r=$L(a,"height",2),n=$L(a,"color",KL)):UL(n)&&(n=$L(a=n,"color",KL)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=KL),this.setTrackFillStyle(n,$L(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle($L(a,"falseValueTrackColor",function(t){var e=.3*yr(t)+.59*br(t)+.11*xr(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),$L(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle($L(a,"thumbColor",16777215),$L(a,"thumbAlpha",1)),this.setTrackSize($L(a,"trackWidth",.9),$L(a,"trackHeight",.5)),this.setTrackRadius($L(a,"trackRadius",.5*this.trackHeight));var o=$L(a,"thumbHeight",void 0),h=$L(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius($L(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition($L(a,"thumbLeft",.3),$L(a,"thumbRight",void 0)),this.setRTL($L(a,"rtl",!1)),this.setToggleAnimationDuration($L(a,"animationDuration",150)),this.buildShapes(),this.setValue($L(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(qL.prototype,HL);const JL=Phaser.Utils.Objects.GetValue;class ZL extends qL{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new df(this,JL(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(JL(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var QL={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new ZL(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},tA={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=eA[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const eA={down:0,up:1},iA=Phaser.Utils.Objects.GetValue;var sA=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){s=rA(e,d,this.listWrapEnable);if(this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(u=s)),!u){0===c&&(c=this.listMaxHeight);var p=nA(e,this.listCreateSliderTrackCallback),g=nA(e,this.listCreateSliderThumbCallback);u=new FM(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:iA(this.listSpace,"panel",0)}}),e.add.existing(u)}}else d.height=c,s=rA(e,d,this.listWrapEnable),u=s;return t&&u.addBackground(t,"background"),this.listDraggable&&u.setDraggable(!0),u!==s&&s.on("button.over",(function(t,e,i,s){u.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){u.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){u.emit("button.click",t,e,i,s)})),u},rA=function(t,e,i){var s;return i?(e.orientation="x",s=new uO(t,e)):(e.orientation="y",s=new IP(t,e)),t.add.existing(s),s},nA=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},aA={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;void 0===e?t=0:t=(e+1)%this.listPanel.getButtons().length;return this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},oA={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=sA.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new kL(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(oA,tA,aA);const hA=Phaser.Utils.Objects.GetValue;class lA extends VC{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(hA(e,"options"));var i=hA(e,"list");this.setWrapEnable(hA(i,"wrap",!1)),this.setCreateButtonCallback(hA(i,"createButtonCallback")),this.setCreateListBackgroundCallback(hA(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(hA(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(hA(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(hA(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(hA(i,"scroller")),this.setListMouseWheelScrollerConfig(hA(i,"mouseWheelScroller")),this.setButtonClickCallback(hA(i,"onButtonClick")),this.setButtonOverCallback(hA(i,"onButtonOver")),this.setButtonOutCallback(hA(i,"onButtonOut")),this.setListExpandDirection(hA(i,"expandDirection")),this.setListEaseInDuration(hA(i,"easeIn",500)),this.setListEaseOutDuration(hA(i,"easeOut",100)),this.setListTransitInCallback(hA(i,"transitIn")),this.settListTransitOutCallback(hA(i,"transitOut")),this.setListMaxHeight(hA(i,"maxHeight",0)),this.setListSize(hA(i,"width"),hA(i,"height",0)),this.setListAlignmentMode(hA(i,"alignParent","text")),this.setListAlignmentSide(hA(i,"alignSide","")),this.setListBounds(hA(i,"bounds")),this.setListSpace(hA(i,"space")),this.setListDraggable(hA(i,"draggable",!1)),this.setValueChangeCallback(hA(e,"setValueCallback"),hA(e,"setValueCallbackScope")),this.setValue(hA(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(lA.prototype,oA);var uA=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?y(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,o=jw(t,s,n);o.list=e.list||{},o.list.createButtonCallback=function(t,e){var i=OO(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var h=e.track;h&&(o.list.createTrackCallback=function(t){return sk(t,h)},delete e.track);var l=e.thumb;return l&&(o.list.createThumbCallback=function(t){return sk(t,l)},delete e.thumb),o.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},o.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},o}(t,e);var i=new lA(t,e);return t.add.existing(i),i},cA=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=uA(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=cA(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const pA=Phaser.Utils.Objects.GetValue;var gA={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?y(e.button):{},r=pA(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=xD(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n0?r.addScrollable():r).addRows(s,i,!0),r}(t,e,i,s)}}var yA={csv2md:function(t,e={}){"string"==typeof e&&(e={title:e});for(var i,s,r,{title:n}=e,a=lr.parse(t).data,o=!1,h=!1,l=[],u=0,c=a.length;u * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Ap=Phaser.Display.Canvas.CanvasPool;var Yp=function(t){var e=Ap.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Ap.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Ap.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==el&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=nl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Wp(t,l,d);else{var u=Xp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Wp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Wp(t,"fill",null);null!==v&&(this.color=jl(v));var g=Wp(t,"metrics",!1);return g?this.metrics={ascent:Wp(g,"ascent",0),descent:Wp(g,"descent",0),fontSize:Wp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Yp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Yp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wp(t,"fontFamily","Courier"),this.fontSize=Wp(t,"fontSize","16px"),this.fontStyle=Wp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=jl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=jl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=jl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=jl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=jl(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=jl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=jl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=nl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wp(e,"fontFamily",this.fontFamily),this.fontSize=Wp(e,"fontSize",this.fontSize),this.fontStyle=Wp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var jp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Zl(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Ip=Phaser.Utils.Objects.GetValue,Fp=Zo,Np=Qo;class Hp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Ip(t,"text",""),this.x=Ip(t,"x",0),this.y=Ip(t,"y",0),this.width=Ip(t,"width",0);var e=Ip(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ip(t,"newLineMode",0),this.startIndex=Ip(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Np&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Fp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Np&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Gp=Phaser.Utils.Objects.GetFastValue,Vp=Zo,Up=tl;class $p{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Gp(t,"tagToText",Xt),this.tagToTextScope=Gp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Jp={};const Kp=Phaser.Geom.Rectangle;var qp=new nc;class Zp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&uv(g)){""!==b?h.push(n.getLine(b,x,nv)):0===C&&r>0&&h.push(n.getLine("",0,nv)),h.push(...dv(g,e,ov,s,0,n));var w=h.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,nv)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},cv=function(t,e){var i;switch(e){case av:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==vv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new $p({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Hg=Phaser.Utils.Objects.GetValue,Gg=Phaser.Math.Distance.Between;class Vg extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Hg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Hg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Hg(t,"enable",!0)),this.holdThreshold=Hg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Hg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Gg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Ug=Phaser.Utils.Objects.GetValue;class $g{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Ug(t,"value",0)),this.setSpeed(Ug(t,"speed",0)),this.setAcceleration(Ug(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Jg{constructor(){this.value,this.dir,this.movement=new $g}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Qg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},tf=Phaser.Utils.Objects.GetValue;class ef extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=tf(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(tf(e,"speed",.1)),this.setEnable(tf(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(tf(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const sf=Phaser.Utils.Objects.GetValue;var rf=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?sf(s,l,void 0):sf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Fg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=sf(r,"tickLength",void 0);var p=sf(r,"position",0);"string"==typeof p&&(p=nf[p]);var v,g,f=sf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=sf(s,"space.slider",void 0))&&(a?f=0:v=sf(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:sf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:sf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:sf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:sf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=sf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=sf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=sf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=sf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=sf(s,"scrollDetectionMode");"string"==typeof b&&(b=hf[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?sf(s,x,!0):sf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Zg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,T=sf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==b&&(T.focus=1===b?2:0),C=new ef(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const nf={right:0,left:1,bottom:0,top:1},hf={gameObject:0,rectBounds:1},af=Phaser.Utils.Objects.GetValue;var of=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=af(e,"width"),h=af(e,"height");n||af(e,"child.expandWidth",!0)||(s[1]=0),h||af(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=pg(i,"child"),r=pg(s,"gameObject",void 0);if(r){var n=pg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=pg(n,"top",0),h.bottom=pg(n,"bottom",0),a.left=pg(n,"left",0),a.right=pg(n,"right",0);break;case 1:h.top=pg(n,"left",0),h.bottom=pg(n,"right",0),a.top=pg(n,"top",0),a.bottom=pg(n,"bottom",0);break;default:h.top=pg(n,"top",0),h.bottom=pg(n,"bottom",0),h.left=pg(n,"left",0),h.right=pg(n,"right",0)}e.add(r,{column:1,row:1,align:pg(s,"align","center"),padding:a,expand:{width:pg(s,"expandWidth",!0),height:pg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:rf(t,a,"y",e);break;case 1:rf(t,a,"x",e);break;default:rf(t,a,"y",e),rf(t,a,"x",e)}return a},lf=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},df=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},cf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(mf.call(this,-this.textOY)),0),e=yf.call(this,t)+this.textOY,i=bf.call(this,t);return function(t,e){switch(Uo(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,xf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Sf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,xf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Of=Phaser.Utils.Objects.IsPlainObject,Pf=Phaser.Utils.Objects.GetValue,Tf=Phaser.Display.Align.TOP_LEFT;class kf extends rh{constructor(t,e,i,s,r,n){Of(e)?(e=Pf(n=e,"x",0),i=Pf(n,"y",0),s=Pf(n,"width",void 0),r=Pf(n,"height",void 0)):Of(s)&&(s=Pf(n=s,"width",void 0),r=Pf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Pf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Pf(n,"clampTextOY",!0)),this.alwaysScrollable=Pf(n,"alwaysScrollable",!1);var h=Pf(n,"background",void 0),a=Pf(n,"text",void 0);void 0===a&&(a=_f(t)),this.textCropEnable=Pf(n,"textCrop",!!a.setCrop);var o=Pf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Tf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Uo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Fo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(mf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=yf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var _f=function(t){return t.add.text(0,0,"")};Object.assign(kf.prototype,wf);var Ef={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Mf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Rf=Phaser.Utils.Objects.GetValue;class Lf extends gf{constructor(t,e){void 0===e&&(e={});var i=Rf(e,"text",void 0),s=Rf(e,"textWidth",void 0),r=Rf(e,"textHeight",void 0),n=Rf(e,"textCrop",!!i.setCrop),h=Rf(e,"textMask",!n),a=Rf(e,"content",""),o=new kf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Rf(e,"clampChildOY",!1),alwaysScrollable:Rf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Rf(e,"space",void 0);l&&(l.child=Rf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Lf.prototype,Ef,Mf);const Df=Phaser.Utils.Objects.GetValue;var zf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new dg(t,e);break;case"bbcodetext":case"bbcode":s=new hg(t,0,0,"",e);break;case"label":s=new Xf(t,e);break;case"textarea":s=function(t,e,i){e=e?wd(e):{};var s=Df(i,"background",Op),r=Df(i,"text",zf),n=Df(i,"track",Op),h=Df(i,"thumb",Op);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Lf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new kp(t,e)}return wp(s,e),t.add.existing(s),s},Af=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Cp(t,e):new Qu(t,e);break;case"roundRectangle":s=new $c(t,e);break;default:s=new sp(t,e)}return wp(s,e),t.add.existing(s),s};const Yf=Phaser.Utils.Objects.GetValue;class Xf extends xc{constructor(t,e,i){e=function(t,e,i){e=e?wd(e):{};var s=Yf(i,"background",Op),r=Yf(i,"text",zf),n=Yf(i,"icon",Af),h=Yf(i,"action",Af);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Wf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Wf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Wf(this.getChildren(),"setDisableState",t),this}}var Wf=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(nm(this),hm(this)),this}setNumberInput(){return this.onUpdateCallback=rm,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const lm=Phaser.Utils.Objects.GetValue,dm=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var cm=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}bm.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(xm(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Cm=new bm,Sm=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,wm=/\S/,Om=new bm;Om.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!wm.test(t)&&!wm.test(e)},Om.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(_m(t,null,null,i),i," ")},km.equals=function(t,e){return bm.prototype.equals.call(km,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Em=new bm;Em.tokenize=function(t){return t.slice()},Em.join=Em.removeEmpty=function(t){return t};const Mm=Phaser.Utils.Array.Remove;var Rm=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Mm(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Cm.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Ym={cursorMoveLeft(){if(!this.isOpened)return this;var t=Dm(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Dm(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=zm(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Dm(Am(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=zm(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Dm(Am(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Xm=Phaser.Utils.Objects.IsPlainObject;class Wm extends cc{constructor(t,e,i,s,r,n){Xm(e)?n=e:Xm(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(cm(e,"wrap.vAlign")||Iu(e,"wrap.vAlign",s=i?"center":"top"),cm(e,"wrap.wrapMode")||Iu(e,"wrap.wrapMode","char"),cm(e,"wrap.maxLines")||Iu(e,"wrap.maxLines",s=i?1:void 0),i&&Iu(e,"wrap.wrapWidth",1/0),cm(e,"wrap.useDefaultTextHeight")||Iu(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!cm(e.edit,"inputType")){var s=i?"text":"textarea";Iu(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new pm(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ic(n.background,"focus"),o=Ic(n.style,"cursor"),l=Ic(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=lm(e,"edit");return void 0===i&&(i={}),Ff(e,i,dm),new om(t,i)}(this,n),vm.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),ym.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),fm.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),gm(l)&&Object.assign(l,o),mm.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;so;d--){for(c=0;c0&&this.wrapMode!==el&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=nl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Wp(t,l,d);else{var u=Xp(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Wp(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Wp(t,"fill",null);null!==v&&(this.color=jl(v));var g=Wp(t,"metrics",!1);return g?this.metrics={ascent:Wp(g,"ascent",0),descent:Wp(g,"descent",0),fontSize:Wp(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Yp(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Yp(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wp(t,"fontFamily","Courier"),this.fontSize=Wp(t,"fontSize","16px"),this.fontStyle=Wp(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=jl(t,this.parent.canvas,this.parent.context),this.backgroundColor2=jl(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=jl(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=jl(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=jl(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=jl(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=jl(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=jl(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=nl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Wp(e,"fontFamily",this.fontFamily),this.fontSize=Wp(e,"fontSize",this.fontSize),this.fontStyle=Wp(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var jp={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Zl(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Ip=Phaser.Utils.Objects.GetValue,Fp=Zo,Np=Qo;class Hp{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Ip(t,"text",""),this.x=Ip(t,"x",0),this.y=Ip(t,"y",0),this.width=Ip(t,"width",0);var e=Ip(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ip(t,"newLineMode",0),this.startIndex=Ip(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Np&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Fp&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Np&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Gp=Phaser.Utils.Objects.GetFastValue,Vp=Zo,Up=tl;class $p{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Gp(t,"tagToText",Xt),this.tagToTextScope=Gp(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Jp={};const Kp=Phaser.Geom.Rectangle;var qp=new nc;class Zp{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&pv(g)){""!==b?h.push(n.getLine(b,x,hv)):0===C&&r>0&&h.push(n.getLine("",0,hv)),h.push(...cv(g,e,lv,s,0,n));var w=h.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,hv)),b=g,x=f,o=s):(b+=g,x=m),C===S-1&&h.push(n.getLine(b,x,l))}return h},uv=function(t,e){var i;switch(e){case ov:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==gv&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new $p({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Gg=Phaser.Utils.Objects.GetValue,Vg=Phaser.Math.Distance.Between;class Ug extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Gg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Gg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Gg(t,"enable",!0)),this.holdThreshold=Gg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Gg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Vg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!cr(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!cr(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const $g=Phaser.Utils.Objects.GetValue;class Jg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue($g(t,"value",0)),this.setSpeed($g(t,"speed",0)),this.setAcceleration($g(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Kg{constructor(){this.value,this.dir,this.movement=new Jg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const tf={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},ef=Phaser.Utils.Objects.GetValue;class sf extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=ef(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(ef(e,"speed",.1)),this.setEnable(ef(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(ef(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||cr(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const rf=Phaser.Utils.Objects.GetValue;var nf=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?rf(s,l,void 0):rf(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ng(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=rf(r,"tickLength",void 0);var p=rf(r,"position",0);"string"==typeof p&&(p=hf[p]);var v,g,f=rf(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=rf(s,"space.slider",void 0))&&(a?f=0:v=rf(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:rf(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:rf(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:rf(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:rf(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=rf(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=rf(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=rf(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=rf(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=rf(s,"scrollDetectionMode");"string"==typeof b&&(b=af[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?rf(s,x,!0):rf(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Qg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,S,w,O,P,T=rf(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&o&&(void 0!==b&&(T.focus=1===b?2:0),C=new sf(o,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(w=`childO${i}`,O=`scroll${i}`):(w="childOY",O="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(O,t)}))),C&&(P=a?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const hf={right:0,left:1,bottom:0,top:1},af={gameObject:0,rectBounds:1},of=Phaser.Utils.Objects.GetValue;var lf=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=of(e,"width"),h=of(e,"height");n||of(e,"child.expandWidth",!0)||(s[1]=0),h||of(e,"child.expandHeight",!0)||(r[1]=0);var a=new ho(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=vg(i,"child"),r=vg(s,"gameObject",void 0);if(r){var n=vg(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=vg(n,"top",0),h.bottom=vg(n,"bottom",0),a.left=vg(n,"left",0),a.right=vg(n,"right",0);break;case 1:h.top=vg(n,"left",0),h.bottom=vg(n,"right",0),a.top=vg(n,"top",0),a.bottom=vg(n,"bottom",0);break;default:h.top=vg(n,"top",0),h.bottom=vg(n,"bottom",0),h.left=vg(n,"left",0),h.right=vg(n,"right",0)}e.add(r,{column:1,row:1,align:vg(s,"align","center"),padding:a,expand:{width:vg(s,"expandWidth",!0),height:vg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:nf(t,a,"y",e);break;case 1:nf(t,a,"x",e);break;default:nf(t,a,"y",e),nf(t,a,"x",e)}return a},df=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},cf=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},uf=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(yf.call(this,-this.textOY)),0),e=bf.call(this,t)+this.textOY,i=xf.call(this,t);return function(t,e){switch(Uo(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Cf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,wf.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Cf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Pf=Phaser.Utils.Objects.IsPlainObject,Tf=Phaser.Utils.Objects.GetValue,kf=Phaser.Display.Align.TOP_LEFT;class _f extends rh{constructor(t,e,i,s,r,n){Pf(e)?(e=Tf(n=e,"x",0),i=Tf(n,"y",0),s=Tf(n,"width",void 0),r=Tf(n,"height",void 0)):Pf(s)&&(s=Tf(n=s,"width",void 0),r=Tf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Tf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Tf(n,"clampTextOY",!0)),this.alwaysScrollable=Tf(n,"alwaysScrollable",!1);var h=Tf(n,"background",void 0),a=Tf(n,"text",void 0);void 0===a&&(a=Ef(t)),this.textCropEnable=Tf(n,"textCrop",!!a.setCrop);var o=Tf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=kf,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Uo(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Fo.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(yf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=bf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Ef=function(t){return t.add.text(0,0,"")};Object.assign(_f.prototype,Of);var Mf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Rf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Lf=Phaser.Utils.Objects.GetValue;class Df extends ff{constructor(t,e){void 0===e&&(e={});var i=Lf(e,"text",void 0),s=Lf(e,"textWidth",void 0),r=Lf(e,"textHeight",void 0),n=Lf(e,"textCrop",!!i.setCrop),h=Lf(e,"textMask",!n),a=Lf(e,"content",""),o=new _f(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Lf(e,"clampChildOY",!1),alwaysScrollable:Lf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Lf(e,"space",void 0);l&&(l.child=Lf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Df.prototype,Mf,Rf);const zf=Phaser.Utils.Objects.GetValue;var Af=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new cg(t,e);break;case"bbcodetext":case"bbcode":s=new ag(t,0,0,"",e);break;case"label":s=new Wf(t,e);break;case"textarea":s=function(t,e,i){e=e?wd(e):{};var s=zf(i,"background",Op),r=zf(i,"text",Af),n=zf(i,"track",Op),h=zf(i,"thumb",Op);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Df(t,e);return t.add.existing(o),o}(t,e);break;default:s=new kp(t,e)}return wp(s,e),t.add.existing(s),s},Yf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Cp(t,e):new Qu(t,e);break;case"roundRectangle":s=new $c(t,e);break;default:s=new sp(t,e)}return wp(s,e),t.add.existing(s),s};const Xf=Phaser.Utils.Objects.GetValue;class Wf extends xc{constructor(t,e,i){e=function(t,e,i){e=e?wd(e):{};var s=Xf(i,"background",Op),r=Xf(i,"text",Af),n=Xf(i,"icon",Yf),h=Xf(i,"action",Yf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Bf(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Bf(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Bf(this.getChildren(),"setDisableState",t),this}}var Bf=function(t,e,i){for(var s=0,r=t.length;s=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,h=t.drawX,a=t.drawY,o=h+t.drawTLX,l=h+t.drawTRX,d=a+t.drawTLY,c=a+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(hm(this),am(this)),this}setNumberInput(){return this.onUpdateCallback=nm,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const dm=Phaser.Utils.Objects.GetValue,cm=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var um=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),h.value=t.join(e)}else h.value=t.join(i.slice(a,a+h.count));a+=h.count,h.added||(o+=h.count)}}let l=e[h-1];return h>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[h-2].value+=l.value,e.pop()),e}xm.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let h=(e=this.removeEmpty(this.tokenize(e))).length,a=t.length,o=1,l=h+a;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=h&&c+1>=a)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=h&&u+1>=a)return n(Cm(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,h=t.newPos,a=h-s,o=0;for(;h+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Sm=new xm,wm=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Om=/\S/,Pm=new xm;Pm.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Om.test(t)&&!Om.test(e)},Pm.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Em(t,null,null,i),i," ")},_m.equals=function(t,e){return xm.prototype.equals.call(_m,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Mm=new xm;Mm.tokenize=function(t){return t.slice()},Mm.join=Mm.removeEmpty=function(t){return t};const Rm=Phaser.Utils.Array.Remove;var Lm=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Rm(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,Sm.diff(o,l,d)),r=0,n=0,h=s.length;nr)i+=h;else{if(s!==r)break;i+=Math.min(e.position,h)}}return i},Xm={cursorMoveLeft(){if(!this.isOpened)return this;var t=zm(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=zm(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Am(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=zm(Ym(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Am(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=zm(Ym(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Wm=Phaser.Utils.Objects.IsPlainObject;class Bm extends cc{constructor(t,e,i,s,r,n){Wm(e)?n=e:Wm(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(um(e,"wrap.vAlign")||Iu(e,"wrap.vAlign",s=i?"center":"top"),um(e,"wrap.wrapMode")||Iu(e,"wrap.wrapMode","char"),um(e,"wrap.maxLines")||Iu(e,"wrap.maxLines",s=i?1:void 0),i&&Iu(e,"wrap.wrapWidth",1/0),um(e,"wrap.useDefaultTextHeight")||Iu(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!um(e.edit,"inputType")){var s=i?"text":"textarea";Iu(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new vm(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var h=n.text;h&&delete n.text;var a=Ic(n.background,"focus"),o=Ic(n.style,"cursor"),l=Ic(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=dm(e,"edit");return void 0===i&&(i={}),Nf(e,i,cm),new lm(t,i)}(this,n),gm.call(this),n.focusStyle&&Object.assign(a,n.focusStyle),bm.call(this,a),n.cursorStyle&&Object.assign(o,n.cursorStyle),mm.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),fm(l)&&Object.assign(l,o),ym.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,v=p?n.onCursorIn:n.onRangeIn;v&&this.on("rangein",v);var g=p?n.onCursorOut:n.onRangeOut;g&&this.on("rangeout",g);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),h||(h=""),this.setText(h)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Fv=Phaser.Display.Canvas.CanvasPool;var Hv=function(t){var e=Fv.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Fv.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Fv.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==na&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=la[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Nv(t,l,d);else{var u=Gv(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Nv(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Nv(t,"fill",null);null!==v&&(this.color=Ga(v));var g=Nv(t,"metrics",!1);return g?this.metrics={ascent:Nv(g,"ascent",0),descent:Nv(g,"descent",0),fontSize:Nv(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Hv(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Hv(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Nv(t,"fontFamily","Courier"),this.fontSize=Nv(t,"fontSize","16px"),this.fontStyle=Nv(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Ga(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ga(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Ga(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Ga(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Ga(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Ga(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Ga(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=la[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Nv(e,"fontFamily",this.fontFamily),this.fontSize=Nv(e,"fontSize",this.fontSize),this.fontStyle=Nv(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Uv={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),io(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const $v=Phaser.Utils.Objects.GetValue,Jv=ia,Kv=sa;class qv{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=$v(t,"text",""),this.x=$v(t,"x",0),this.y=$v(t,"y",0),this.width=$v(t,"width",0);var e=$v(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=$v(t,"newLineMode",0),this.startIndex=$v(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Kv&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Jv&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Kv&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Zv=Phaser.Utils.Objects.GetFastValue,Qv=ia,tg=ra;class eg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Zv(t,"tagToText",Wt),this.tagToTextScope=Zv(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var ig={};const sg=Phaser.Geom.Rectangle;var rg=new dl;class ng{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&bg(g)){""!==b?h.push(n.getLine(b,x,ug)):0===C&&r>0&&h.push(n.getLine("",0,ug)),h.push(...mg(g,e,gg,s,0,n));var S=h.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,ug)),b=g,x=f,o=s):(b+=g,x=m),C===w-1&&h.push(n.getLine(b,x,l))}return h},yg=function(t,e){var i;switch(e){case vg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Cg&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new eg({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Cf.call(this,-this.textOY)),0),e=wf.call(this,t)+this.textOY,i=Sf.call(this,t);return function(t,e){switch(qh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Of.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Pf.call(this,t,n,h),oe(t,s,r,n,h,e.align),e.preOffsetY=0,Of.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Tf=Phaser.Utils.Objects.IsPlainObject,Ef=Phaser.Utils.Objects.GetValue,Mf=Phaser.Display.Align.TOP_LEFT;class Rf extends nh{constructor(t,e,i,s,r,n){Tf(e)?(e=Ef(n=e,"x",0),i=Ef(n,"y",0),s=Ef(n,"width",void 0),r=Ef(n,"height",void 0)):Tf(s)&&(s=Ef(n=s,"width",void 0),r=Ef(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Ef(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Ef(n,"clampTextOY",!0)),this.alwaysScrollable=Ef(n,"alwaysScrollable",!1);var h=Ef(n,"background",void 0),a=Ef(n,"text",void 0);void 0===a&&(a=Lf(t)),this.textCropEnable=Ef(n,"textCrop",!!a.setCrop);var o=Ef(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Mf,l.padding=fe(0),l.expand=!0,this.textObject=a,this.textObjectType=qh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Vh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Cf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=wf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Lf=function(t){return t.add.text(0,0,"")};Object.assign(Rf.prototype,_f);var Df={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Yf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Xf=Phaser.Utils.Objects.GetValue;class Af extends $p{constructor(t,e){void 0===e&&(e={});var i=Xf(e,"text",void 0),s=Xf(e,"textWidth",void 0),r=Xf(e,"textHeight",void 0),n=Xf(e,"textCrop",!!i.setCrop),h=Xf(e,"textMask",!n),a=Xf(e,"content",""),o=new Rf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Xf(e,"clampChildOY",!1),alwaysScrollable:Xf(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Xf(e,"space",void 0);l&&(l.child=Xf(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Af.prototype,Df,Yf);const zf=Phaser.Utils.Objects.GetValue;var Wf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new yf(t,e);break;case"bbcodetext":case"bbcode":s=new vf(t,0,0,"",e);break;case"label":s=new bf(t,e);break;case"textarea":s=function(t,e,i){e=e?To(e):{};var s=zf(i,"background",Uu),r=zf(i,"text",Wf),n=zf(i,"track",Uu),h=zf(i,"thumb",Uu);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Af(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Yv(t,e)}return Vu(s,e),t.add.existing(s),s},Bf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Gu(t,e):new wu(t,e);break;case"roundRectangle":s=new mc(t,e);break;default:s=new Pu(t,e)}return Vu(s,e),t.add.existing(s),s};const jf=Phaser.Utils.Objects.GetValue;var If=function(t,e,i){e=e?To(e):{};var s=jf(i,"background",Uu),r=jf(i,"text",Wf),n=jf(i,"icon",Bf),h=jf(i,"action",Bf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e},Ff=function(t,e,i){void 0===i&&(i={});var s=(e=e?To(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,h=i.button||i.label||i,a=If(t,s,n);a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=function(t,e,i){var s=new bf(t,e,i);return t.add.existing(s),s}(t,r,h).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(a.list.createTrackCallback=function(t){return Uu(t,o)},delete e.track);var l=e.thumb;return l&&(a.list.createThumbCallback=function(t){return Uu(t,l)},delete e.thumb),a.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},a.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},a};return class extends Rv{constructor(t,e,i){super(t,e=Ff(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;eo;d--){for(c=0;c0&&this.wrapMode!==na&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=la[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Nv(t,l,d);else{var u=Gv(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Nv(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Nv(t,"fill",null);null!==v&&(this.color=Ga(v));var g=Nv(t,"metrics",!1);return g?this.metrics={ascent:Nv(g,"ascent",0),descent:Nv(g,"descent",0),fontSize:Nv(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Hv(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Hv(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Nv(t,"fontFamily","Courier"),this.fontSize=Nv(t,"fontSize","16px"),this.fontStyle=Nv(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=Ga(t,this.parent.canvas,this.parent.context),this.backgroundColor2=Ga(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=Ga(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=Ga(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=Ga(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=Ga(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=Ga(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=Ga(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=la[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Nv(e,"fontFamily",this.fontFamily),this.fontSize=Nv(e,"fontSize",this.fontSize),this.fontStyle=Nv(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Uv={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),io(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var C=l;C0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const $v=Phaser.Utils.Objects.GetValue,Jv=ia,Kv=sa;class qv{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=$v(t,"text",""),this.x=$v(t,"x",0),this.y=$v(t,"y",0),this.width=$v(t,"width",0);var e=$v(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=$v(t,"newLineMode",0),this.startIndex=$v(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Kv&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Jv&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Kv&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Zv=Phaser.Utils.Objects.GetFastValue,Qv=ia,tg=ra;class eg{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Zv(t,"tagToText",Wt),this.tagToTextScope=Zv(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var ig={};const sg=Phaser.Geom.Rectangle;var rg=new dl;class ng{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&xg(g)){""!==b?h.push(n.getLine(b,x,pg)):0===C&&r>0&&h.push(n.getLine("",0,pg)),h.push(...yg(g,e,fg,s,0,n));var S=h.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,pg)),b=g,x=f,o=s):(b+=g,x=m),C===w-1&&h.push(n.getLine(b,x,l))}return h},bg=function(t,e){var i;switch(e){case gg:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==wg&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new eg({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(wf.call(this,-this.textOY)),0),e=Sf.call(this,t)+this.textOY,i=Of.call(this,t);return function(t,e){switch(qh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,kf.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,_f.call(this,t,n,h),oe(t,s,r,n,h,e.align),e.preOffsetY=0,kf.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Ef=Phaser.Utils.Objects.IsPlainObject,Mf=Phaser.Utils.Objects.GetValue,Rf=Phaser.Display.Align.TOP_LEFT;class Lf extends nh{constructor(t,e,i,s,r,n){Ef(e)?(e=Mf(n=e,"x",0),i=Mf(n,"y",0),s=Mf(n,"width",void 0),r=Mf(n,"height",void 0)):Ef(s)&&(s=Mf(n=s,"width",void 0),r=Mf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Mf(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Mf(n,"clampTextOY",!0)),this.alwaysScrollable=Mf(n,"alwaysScrollable",!1);var h=Mf(n,"background",void 0),a=Mf(n,"text",void 0);void 0===a&&(a=Df(t)),this.textCropEnable=Mf(n,"textCrop",!!a.setCrop);var o=Mf(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Rf,l.padding=fe(0),l.expand=!0,this.textObject=a,this.textObjectType=qh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=Vh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(wf.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Sf.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Df=function(t){return t.add.text(0,0,"")};Object.assign(Lf.prototype,Tf);var Yf={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Xf={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Af=Phaser.Utils.Objects.GetValue;class zf extends $p{constructor(t,e){void 0===e&&(e={});var i=Af(e,"text",void 0),s=Af(e,"textWidth",void 0),r=Af(e,"textHeight",void 0),n=Af(e,"textCrop",!!i.setCrop),h=Af(e,"textMask",!n),a=Af(e,"content",""),o=new Lf(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Af(e,"clampChildOY",!1),alwaysScrollable:Af(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Af(e,"space",void 0);l&&(l.child=Af(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(zf.prototype,Yf,Xf);const Wf=Phaser.Utils.Objects.GetValue;var Bf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new bf(t,e);break;case"bbcodetext":case"bbcode":s=new gf(t,0,0,"",e);break;case"label":s=new xf(t,e);break;case"textarea":s=function(t,e,i){e=e?To(e):{};var s=Wf(i,"background",Uu),r=Wf(i,"text",Bf),n=Wf(i,"track",Uu),h=Wf(i,"thumb",Uu);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new zf(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Yv(t,e)}return Vu(s,e),t.add.existing(s),s},jf=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Gu(t,e):new wu(t,e);break;case"roundRectangle":s=new mc(t,e);break;default:s=new Pu(t,e)}return Vu(s,e),t.add.existing(s),s};const If=Phaser.Utils.Objects.GetValue;var Ff=function(t,e,i){e=e?To(e):{};var s=If(i,"background",Uu),r=If(i,"text",Bf),n=If(i,"icon",jf),h=If(i,"action",jf);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e},Hf=function(t,e,i){void 0===i&&(i={});var s=(e=e?To(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,h=i.button||i.label||i,a=Ff(t,s,n);a.list=e.list||{},a.list.createButtonCallback=function(t,e){var i=function(t,e,i){var s=new xf(t,e,i);return t.add.existing(s),s}(t,r,h).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(a.list.createTrackCallback=function(t){return Uu(t,o)},delete e.track);var l=e.thumb;return l&&(a.list.createThumbCallback=function(t){return Uu(t,l)},delete e.thumb),a.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},a.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},a};return class extends Rv{constructor(t,e,i){super(t,e=Hf(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Lc=Phaser.Display.Canvas.CanvasPool;var Dc=function(t){var e=Lc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,h={ascent:r,descent:n,fontSize:r+n};return Lc.remove(e),h}var a=Math.ceil(s.width*t.baselineX),o=a,l=2*o;if(o=o*t.baselineY|0,e.width=a,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,a,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),h={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,a,l))return h.ascent=o,h.descent=o+6,h.fontSize=h.ascent+h.descent,Lc.remove(e),h;var d,c,u=i.getImageData(0,0,a,l).data,p=u.length,v=4*a,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Qh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=sa[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Yc(t,l,d);else{var u=Ac(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Yc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Yc(t,"fill",null);null!==v&&(this.color=za(v));var g=Yc(t,"metrics",!1);return g?this.metrics={ascent:Yc(g,"ascent",0),descent:Yc(g,"descent",0),fontSize:Yc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Dc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Dc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Yc(t,"fontFamily","Courier"),this.fontSize=Yc(t,"fontSize","16px"),this.fontStyle=Yc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=za(t,this.parent.canvas,this.parent.context),this.backgroundColor2=za(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=za(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=za(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=za(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=sa[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Yc(e,"fontFamily",this.fontFamily),this.fontSize=Yc(e,"fontSize",this.fontSize),this.fontStyle=Yc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Wc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ka(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const zc=Phaser.Utils.Objects.GetValue,Fc=Kh,jc=qh;class Ic{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=zc(t,"text",""),this.x=zc(t,"x",0),this.y=zc(t,"y",0),this.width=zc(t,"width",0);var e=zc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=zc(t,"newLineMode",0),this.startIndex=zc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===jc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Fc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===jc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Bc=Phaser.Utils.Objects.GetFastValue,Hc=Kh,Nc=Zh;class Gc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Bc(t,"tagToText",Wt),this.tagToTextScope=Bc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Vc={};const Uc=Phaser.Geom.Rectangle;var $c=new rl;class Jc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&lu(g)){""!==b?h.push(n.getLine(b,x,iu)):0===w&&r>0&&h.push(n.getLine("",0,iu)),h.push(...au(g,e,nu,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,iu)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&h.push(n.getLine(b,x,l))}return h},ou=function(t,e){var i;switch(e){case ru:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==cu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Gc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return mp(this.sizerChildren,null),vh.call(this,t),this}},bp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,mp(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Cp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,mp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)mp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Pp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const _p=Phaser.Utils.Objects.IsPlainObject,Tp=Phaser.Utils.Objects.GetValue;class kp extends th{constructor(t,e,i,s,r,n,h,a,o,l){_p(e)?(e=Tp(l=e,"x",0),i=Tp(l,"y",0),s=Tp(l,"width",void 0),r=Tp(l,"height",void 0),n=Tp(l,"column",l.col||0),h=Tp(l,"row",0),a=Tp(l,"columnProportions",0),o=Tp(l,"rowProportions",0)):_p(s)?(s=Tp(l=s,"width",void 0),r=Tp(l,"height",void 0),n=Tp(l,"column",l.col||0),h=Tp(l,"row",0),a=Tp(l,"columnProportions",0),o=Tp(l,"rowProportions",0)):_p(n)?(n=Tp(l=n,"column",l.col||0),h=Tp(l,"row",0),a=Tp(l,"columnProportions",0),o=Tp(l,"rowProportions",0)):_p(a)&&(a=Tp(l=a,"columnProportions",0),o=Tp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Tp(l,"createCellContainerCallback")),this.setIndentLeft(Tp(l,"space.indentLeftOdd",0),Tp(l,"space.indentLeftEven",0)),this.setIndentTop(Tp(l,"space.indentTopOdd",0),Tp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,Tp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Op.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Pp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(kp.prototype,Cp);const Ep=Phaser.Utils.Objects.GetValue,Mp=Phaser.Math.Percent;var Rp=function(t,e,i){var s;return t.y===e.y?s=Mp(i.x,t.x,e.x):t.x===e.x&&(s=Mp(i.y,t.y,e.y)),s},Lp=function(t,e,i){var s,r;this.enable&&(Dp.x=e,Dp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Rp(s,r,Dp))},Dp={},Ap=function(t,e,i){if(this.enable&&t.isDown){var s,r;Yp.x=t.worldX,Yp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Rp(s,r,Yp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Yp={},Xp=function(t,e){void 0===e&&(e=Wp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Wp={};const zp=Phaser.Display.Align.LEFT_CENTER,Fp=Phaser.Display.Align.TOP_CENTER;var jp={};const Ip=Phaser.Display.Align.RIGHT_CENTER,Bp=Phaser.Display.Align.BOTTOM_CENTER;var Hp={};const Np=Phaser.Math.Linear;var Gp={};const Vp=Phaser.Display.Align.LEFT_CENTER,Up=Phaser.Display.Align.TOP_CENTER,$p=Phaser.Display.Align.RIGHT_CENTER,Jp=Phaser.Display.Align.BOTTOM_CENTER,Kp=Phaser.Utils.Objects.GetValue,qp=Phaser.Utils.Objects.IsPlainObject,Zp=Phaser.Math.Clamp,Qp=Phaser.Math.Snap.To;class tv extends(hd(_h)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Kp(e,"reverseAxis",!1);var i=Kp(e,"background",void 0),s=Kp(e,"track",void 0),r=Kp(e,"indicator",void 0),n=Kp(e,"thumb",void 0);if(i&&(qp(i)&&(i=wc(t,i)),this.addBackground(i)),s&&(qp(s)&&(s=wc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(qp(r)&&(r=wc(t,r)),this.pin(r)),n){qp(n)&&(n=wc(t,n)),this.pin(n);var h=Kp(e,"thumbOffsetX",0),a=Kp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=Kp(e,"input",0);switch("string"==typeof o&&(o=ev[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Lp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Ap,this).on("pointermove",Ap,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Kp(e,"enable",void 0));var l=Kp(e,"tick",void 0);void 0===l&&(l=Kp(e,"gap",void 0)),this.setGap(l),this.setValue(Kp(e,"value",0),Kp(e,"min",void 0),Kp(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Qp(t,this.gap));var e=this._value;this._value=Zp(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const ev={pan:0,drag:0,click:1,none:-1};var iv={getStartPoint:function(t){if(void 0===t&&(t=jp),this.childrenMap.thumb){var e=0===this.orientation?zp:Fp;Xp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Hp),this.childrenMap.thumb){var e=0===this.orientation?Ip:Bp;Xp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Gp),s.x=Np(e.x,i.x,t),s.y=Np(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?$p:Jp:0===this.orientation?Vp:Up,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(tv.prototype,iv);const sv=Phaser.Utils.Objects.GetValue;class rv extends _h{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=sv(e,"background",void 0),n=sv(e,"buttons",void 0),h=sv(n,"top",sv(n,"left",void 0)),a=sv(n,"bottom",sv(n,"right",void 0)),o=sv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===sv(o,"width",void 0)?1:0:void 0===sv(o,"height",void 0)?1:0,i=new tv(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=sv(e,"valuechangeCallback",null);if(null!==d){var c=sv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(sv(e,"enable",void 0)),this.setValue(sv(e,"value",0)),this.setScrollStep(sv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class nv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const hv=Phaser.Utils.Objects.GetValue,av=Phaser.Math.Distance.Between;class ov extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=hv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(hv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(hv(t,"enable",!0)),this.holdThreshold=hv(t,"holdThreshold",50),this.pointerOutReleaseEnable=hv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:av(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const lv=Phaser.Utils.Objects.GetValue;class dv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(lv(t,"value",0)),this.setSpeed(lv(t,"speed",0)),this.setAcceleration(lv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class cv{constructor(){this.value,this.dir,this.movement=new dv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const gv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},fv=Phaser.Utils.Objects.GetValue;class mv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=fv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(fv(e,"speed",.1)),this.setEnable(fv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(fv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const yv=Phaser.Utils.Objects.GetValue;var bv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?yv(s,l,void 0):yv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new rv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=yv(r,"tickLength",void 0);var p=yv(r,"position",0);"string"==typeof p&&(p=xv[p]);var v,g,f=yv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=yv(s,"space.slider",void 0))&&(a?f=0:v=yv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:yv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:yv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:yv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:yv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=yv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=yv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=yv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=yv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=yv(s,"scrollDetectionMode");"string"==typeof b&&(b=wv[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?yv(s,x,!0):yv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new vv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=yv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new mv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=a?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const xv={right:0,left:1,bottom:0,top:1},wv={gameObject:0,rectBounds:1},Sv=Phaser.Utils.Objects.GetValue;var Cv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Sv(e,"width"),h=Sv(e,"height");n||Sv(e,"child.expandWidth",!0)||(s[1]=0),h||Sv(e,"child.expandHeight",!0)||(r[1]=0);var a=new kp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Ep(i,"child"),r=Ep(s,"gameObject",void 0);if(r){var n=Ep(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Ep(n,"top",0),h.bottom=Ep(n,"bottom",0),a.left=Ep(n,"left",0),a.right=Ep(n,"right",0);break;case 1:h.top=Ep(n,"left",0),h.bottom=Ep(n,"right",0),a.top=Ep(n,"top",0),a.bottom=Ep(n,"bottom",0);break;default:h.top=Ep(n,"top",0),h.bottom=Ep(n,"bottom",0),h.left=Ep(n,"left",0),h.right=Ep(n,"right",0)}e.add(r,{column:1,row:1,align:Ep(s,"align","center"),padding:a,expand:{width:Ep(s,"expandWidth",!0),height:Ep(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:bv(t,a,"y",e);break;case 1:bv(t,a,"x",e);break;default:bv(t,a,"y",e),bv(t,a,"x",e)}return a},Ov=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Pv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},_v=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Lv.call(this,-this.textOY)),0),e=Dv.call(this,t)+this.textOY,i=Av.call(this,t);return function(t,e){switch(Gh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Yv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Wv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Yv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Fv=Phaser.Utils.Objects.IsPlainObject,jv=Phaser.Utils.Objects.GetValue,Iv=Phaser.Display.Align.TOP_LEFT;class Bv extends th{constructor(t,e,i,s,r,n){Fv(e)?(e=jv(n=e,"x",0),i=jv(n,"y",0),s=jv(n,"width",void 0),r=jv(n,"height",void 0)):Fv(s)&&(s=jv(n=s,"width",void 0),r=jv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=jv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(jv(n,"clampTextOY",!0)),this.alwaysScrollable=jv(n,"alwaysScrollable",!1);var h=jv(n,"background",void 0),a=jv(n,"text",void 0);void 0===a&&(a=Hv(t)),this.textCropEnable=jv(n,"textCrop",!!a.setCrop);var o=jv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Iv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Gh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=jh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Lv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Dv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Hv=function(t){return t.add.text(0,0,"")};Object.assign(Bv.prototype,zv);var Nv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Gv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Vv=Phaser.Utils.Objects.GetValue;class Uv extends Mv{constructor(t,e){void 0===e&&(e={});var i=Vv(e,"text",void 0),s=Vv(e,"textWidth",void 0),r=Vv(e,"textHeight",void 0),n=Vv(e,"textCrop",!!i.setCrop),h=Vv(e,"textMask",!n),a=Vv(e,"content",""),o=new Bv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Vv(e,"clampChildOY",!1),alwaysScrollable:Vv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Vv(e,"space",void 0);l&&(l.child=Vv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Uv.prototype,Nv,Gv);const $v=Phaser.Utils.Objects.GetValue;var Jv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new ap(t,e);break;case"bbcodetext":case"bbcode":s=new sp(t,0,0,"",e);break;case"label":s=new Zv(t,e);break;case"textarea":s=function(t,e,i){e=e?So(e):{};var s=$v(i,"background",wc),r=$v(i,"text",Jv),n=$v(i,"track",wc),h=$v(i,"thumb",wc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new Uv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Oc(t,e)}return xc(s,e),t.add.existing(s),s},Kv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new yc(t,e):new Kd(t,e);break;case"roundRectangle":s=new Gl(t,e);break;default:s=new tc(t,e)}return xc(s,e),t.add.existing(s),s};const qv=Phaser.Utils.Objects.GetValue;class Zv extends bl{constructor(t,e,i){e=function(t,e,i){e=e?So(e):{};var s=qv(i,"background",wc),r=qv(i,"text",Jv),n=qv(i,"icon",Kv),h=qv(i,"action",Kv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return Qv(this.getChildren(),"setActiveState",t),this}setHoverState(t){return Qv(this.getChildren(),"setHoverState",t),this}setDisableState(t){return Qv(this.getChildren(),"setDisableState",t),this}}var Qv=function(t,e,i){for(var s=0,r=t.length;so;d--){for(c=0;c0&&this.wrapMode!==Qh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=sa[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var h=this.propertyMap;for(var a in h){var o=h[a],l=o[0],d=i?o[1]:this[a],c=o[2];if("wrapCallback"===a||"wrapCallbackScope"===a)this[a]=Yc(t,l,d);else{var u=Ac(t,l,d);c&&(u=c(u)),this[a]=u}}var p=Yc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Yc(t,"fill",null);null!==v&&(this.color=za(v));var g=Yc(t,"metrics",!1);return g?this.metrics={ascent:Yc(g,"ascent",0),descent:Yc(g,"descent",0),fontSize:Yc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Dc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Dc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Yc(t,"fontFamily","Courier"),this.fontSize=Yc(t,"fontSize","16px"),this.fontStyle=Yc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=za(t,this.parent.canvas,this.parent.context),this.backgroundColor2=za(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=za(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=za(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=za(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=za(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=sa[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Yc(e,"fontFamily",this.fontFamily),this.fontSize=Yc(e,"fontSize",this.fontSize),this.fontStyle=Yc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Wc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var h=this.defaultStyle;this.clear(),Ka(this,h.backgroundColor,h.backgroundStrokeColor,h.backgroundStrokeLineWidth,h.backgroundCornerRadius,h.backgroundColor2,h.backgroundHorizontalGradient,h.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var a,o,l,d,c,u,p=h.halign,v=h.valign,g=h.lineHeight,f=r.lines,m=f.length,y=h.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var a=this.defaultStyle.metrics,o=i-a.ascent,l=a.fontSize;this.drawRectangle(e,o,t.width,l,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(r,n),h.syncStyle(r,n),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;h.fillStyle=r,h.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var h=this.context;n.syncShadow(h,n.shadowStroke);var a=h.lineCap;h.lineCap="butt",h.strokeStyle=r,h.lineWidth=s,h.beginPath(),h.moveTo(t,e),h.lineTo(t+i,e),h.stroke(),h.lineCap=a},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const zc=Phaser.Utils.Objects.GetValue,Fc=Kh,jc=qh;class Ic{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=zc(t,"text",""),this.x=zc(t,"x",0),this.y=zc(t,"y",0),this.width=zc(t,"width",0);var e=zc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=zc(t,"newLineMode",0),this.startIndex=zc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===jc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Fc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===jc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const Bc=Phaser.Utils.Objects.GetFastValue,Hc=Kh,Nc=Zh;class Gc{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=Bc(t,"tagToText",Wt),this.tagToTextScope=Bc(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(h=h.substring(t-a,e-a)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,h,l,d):c+=this.tagToText(h,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Vc={};const Uc=Phaser.Geom.Rectangle;var $c=new rl;class Jc{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&du(g)){""!==b?h.push(n.getLine(b,x,su)):0===w&&r>0&&h.push(n.getLine("",0,su)),h.push(...ou(g,e,hu,s,0,n));var C=h.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(h.push(n.getLine(b,x,su)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&h.push(n.getLine(b,x,l))}return h},lu=function(t,e){var i;switch(e){case nu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==uu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new Gc({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,h=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return yp(this.sizerChildren,null),vh.call(this,t),this}},xp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,yp(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Op={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,h=0,a=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=We.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,yp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)yp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},_p=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Tp=Phaser.Utils.Objects.IsPlainObject,kp=Phaser.Utils.Objects.GetValue;class Ep extends th{constructor(t,e,i,s,r,n,h,a,o,l){Tp(e)?(e=kp(l=e,"x",0),i=kp(l,"y",0),s=kp(l,"width",void 0),r=kp(l,"height",void 0),n=kp(l,"column",l.col||0),h=kp(l,"row",0),a=kp(l,"columnProportions",0),o=kp(l,"rowProportions",0)):Tp(s)?(s=kp(l=s,"width",void 0),r=kp(l,"height",void 0),n=kp(l,"column",l.col||0),h=kp(l,"row",0),a=kp(l,"columnProportions",0),o=kp(l,"rowProportions",0)):Tp(n)?(n=kp(l=n,"column",l.col||0),h=kp(l,"row",0),a=kp(l,"columnProportions",0),o=kp(l,"rowProportions",0)):Tp(a)&&(a=kp(l=a,"columnProportions",0),o=kp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(kp(l,"createCellContainerCallback")),this.setIndentLeft(kp(l,"space.indentLeftOdd",0),kp(l,"space.indentLeftEven",0)),this.setIndentTop(kp(l,"space.indentTopOdd",0),kp(l,"space.indentTopEven",0)),this.resetGrid(n,h,a,o,kp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Pp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=_p.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Ep.prototype,Op);const Mp=Phaser.Utils.Objects.GetValue,Rp=Phaser.Math.Percent;var Lp=function(t,e,i){var s;return t.y===e.y?s=Rp(i.x,t.x,e.x):t.x===e.x&&(s=Rp(i.y,t.y,e.y)),s},Dp=function(t,e,i){var s,r;this.enable&&(Ap.x=e,Ap.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Lp(s,r,Ap))},Ap={},Yp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Xp.x=t.worldX,Xp.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Lp(s,r,Xp);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Xp={},Wp=function(t,e){void 0===e&&(e=zp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return ae(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},zp={};const Fp=Phaser.Display.Align.LEFT_CENTER,jp=Phaser.Display.Align.TOP_CENTER;var Ip={};const Bp=Phaser.Display.Align.RIGHT_CENTER,Hp=Phaser.Display.Align.BOTTOM_CENTER;var Np={};const Gp=Phaser.Math.Linear;var Vp={};const Up=Phaser.Display.Align.LEFT_CENTER,$p=Phaser.Display.Align.TOP_CENTER,Jp=Phaser.Display.Align.RIGHT_CENTER,Kp=Phaser.Display.Align.BOTTOM_CENTER,qp=Phaser.Utils.Objects.GetValue,Zp=Phaser.Utils.Objects.IsPlainObject,Qp=Phaser.Math.Clamp,tv=Phaser.Math.Snap.To;class ev extends(hd(_h)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=qp(e,"reverseAxis",!1);var i=qp(e,"background",void 0),s=qp(e,"track",void 0),r=qp(e,"indicator",void 0),n=qp(e,"thumb",void 0);if(i&&(Zp(i)&&(i=wc(t,i)),this.addBackground(i)),s&&(Zp(s)&&(s=wc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Zp(r)&&(r=wc(t,r)),this.pin(r)),n){Zp(n)&&(n=wc(t,n)),this.pin(n);var h=qp(e,"thumbOffsetX",0),a=qp(e,"thumbOffsetY",0);this.setThumbOffset(h,a)}var o=qp(e,"input",0);switch("string"==typeof o&&(o=iv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Dp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Yp,this).on("pointermove",Yp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(qp(e,"enable",void 0));var l=qp(e,"tick",void 0);void 0===l&&(l=qp(e,"gap",void 0)),this.setGap(l),this.setValue(qp(e,"value",0),qp(e,"min",void 0),qp(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=tv(t,this.gap));var e=this._value;this._value=Qp(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const iv={pan:0,drag:0,click:1,none:-1};var sv={getStartPoint:function(t){if(void 0===t&&(t=Ip),this.childrenMap.thumb){var e=0===this.orientation?Fp:jp;Wp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Np),this.childrenMap.thumb){var e=0===this.orientation?Bp:Hp;Wp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Vp),s.x=Gp(e.x,i.x,t),s.y=Gp(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,h=this.childrenMap.thumb;if(h)if(0===this.orientation){var a,o=Q(h);if(n)a=h.x-o*h.originX,i=this.right-a;else i=(a=h.x-o*h.originX)+o-this.left}else{var l,d=tt(h);if(n)l=h.y-d*h.originY,s=this.bottom-l;else s=(l=h.y-d*h.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?Jp:Kp:0===this.orientation?Up:$p,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(ev.prototype,sv);const rv=Phaser.Utils.Objects.GetValue;class nv extends _h{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=rv(e,"background",void 0),n=rv(e,"buttons",void 0),h=rv(n,"top",rv(n,"left",void 0)),a=rv(n,"bottom",rv(n,"right",void 0)),o=rv(e,"slider",void 0);(r&&this.addBackground(r),h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===rv(o,"width",void 0)?1:0:void 0===rv(o,"height",void 0)?1:0,i=new ev(t,o),t.add.existing(i),this.add(i,{proportion:s}));a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[h,a];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=rv(e,"valuechangeCallback",null);if(null!==d){var c=rv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(rv(e,"enable",void 0)),this.setValue(rv(e,"value",0)),this.setScrollStep(rv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class hv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const av=Phaser.Utils.Objects.GetValue,ov=Phaser.Math.Distance.Between;class lv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=av(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(av(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(av(t,"enable",!0)),this.holdThreshold=av(t,"holdThreshold",50),this.pointerOutReleaseEnable=av(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:ov(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const dv=Phaser.Utils.Objects.GetValue;class cv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(dv(t,"value",0)),this.setSpeed(dv(t,"speed",0)),this.setAcceleration(dv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class uv{constructor(){this.value,this.dir,this.movement=new cv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const fv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},mv=Phaser.Utils.Objects.GetValue;class yv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=mv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(mv(e,"speed",.1)),this.setEnable(mv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(mv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const bv=Phaser.Utils.Objects.GetValue;var xv=function(t,e,i,s){var r,n,h="Y"===(i=i.toUpperCase()),a=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=a||s.hasOwnProperty(l)?bv(s,l,void 0):bv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=h?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new nv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=bv(r,"tickLength",void 0);var p=bv(r,"position",0);"string"==typeof p&&(p=wv[p]);var v,g,f=bv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=bv(s,"space.slider",void 0))&&(a?f=0:v=bv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,h?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:bv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:bv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:bv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:bv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=bv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=bv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=bv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=bv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=bv(s,"scrollDetectionMode");"string"==typeof b&&(b=Sv[b]);var x=`scroller${i}`;(m=a||s.hasOwnProperty(x)?bv(s,x,!0):bv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=h?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new gv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=bv(s,a?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new yv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),a&&!h||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(a?(S=h?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(a?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=a?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const wv={right:0,left:1,bottom:0,top:1},Sv={gameObject:0,rectBounds:1},Cv=Phaser.Utils.Objects.GetValue;var Ov=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Cv(e,"width"),h=Cv(e,"height");n||Cv(e,"child.expandWidth",!0)||(s[1]=0),h||Cv(e,"child.expandHeight",!0)||(r[1]=0);var a=new Ep(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Mp(i,"child"),r=Mp(s,"gameObject",void 0);if(r){var n=Mp(i,"space.child",0);t.childMargin={};var h=t.childMargin,a={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:h.top=0,h.bottom=0,h.left=0,h.right=0;break;default:h.top=n,h.bottom=n,h.left=n,h.right=n}else switch(t.scrollMode){case 0:h.top=Mp(n,"top",0),h.bottom=Mp(n,"bottom",0),a.left=Mp(n,"left",0),a.right=Mp(n,"right",0);break;case 1:h.top=Mp(n,"left",0),h.bottom=Mp(n,"right",0),a.top=Mp(n,"top",0),a.bottom=Mp(n,"bottom",0);break;default:h.top=Mp(n,"top",0),h.bottom=Mp(n,"bottom",0),h.left=Mp(n,"left",0),h.right=Mp(n,"right",0)}e.add(r,{column:1,row:1,align:Mp(s,"align","center"),padding:a,expand:{width:Mp(s,"expandWidth",!0),height:Mp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,a,e),t.scrollMode){case 0:xv(t,a,"y",e);break;case 1:xv(t,a,"x",e);break;default:xv(t,a,"y",e),xv(t,a,"x",e)}return a},Pv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},_v=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Tv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(a=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=a.childrenMap.track,s=a.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Dv.call(this,-this.textOY)),0),e=Av.call(this,t)+this.textOY,i=Yv.call(this,t);return function(t,e){switch(Gh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var h=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=h}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Xv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,h,a=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=a+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,h=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,zv.call(this,t,n,h),ae(t,s,r,n,h,e.align),e.preOffsetY=0,Xv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const jv=Phaser.Utils.Objects.IsPlainObject,Iv=Phaser.Utils.Objects.GetValue,Bv=Phaser.Display.Align.TOP_LEFT;class Hv extends th{constructor(t,e,i,s,r,n){jv(e)?(e=Iv(n=e,"x",0),i=Iv(n,"y",0),s=Iv(n,"width",void 0),r=Iv(n,"height",void 0)):jv(s)&&(s=Iv(n=s,"width",void 0),r=Iv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Iv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Iv(n,"clampTextOY",!0)),this.alwaysScrollable=Iv(n,"alwaysScrollable",!1);var h=Iv(n,"background",void 0),a=Iv(n,"text",void 0);void 0===a&&(a=Nv(t)),this.textCropEnable=Iv(n,"textCrop",!!a.setCrop);var o=Iv(n,"textMask",!this.textCropEnable);h&&this.addBackground(h),this.add(a),this.sizerChildren=[a];var l=this.getSizerConfig(a);l.align=Bv,l.padding=ge(0),l.expand=!0,this.textObject=a,this.textObjectType=Gh(a),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=jh.call(this,this.textObject,this)),this.addChildrenMap("background",h),this.addChildrenMap("text",a)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Dv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Av.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Nv=function(t){return t.add.text(0,0,"")};Object.assign(Hv.prototype,Fv);var Gv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Vv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Uv=Phaser.Utils.Objects.GetValue;class $v extends Rv{constructor(t,e){void 0===e&&(e={});var i=Uv(e,"text",void 0),s=Uv(e,"textWidth",void 0),r=Uv(e,"textHeight",void 0),n=Uv(e,"textCrop",!!i.setCrop),h=Uv(e,"textMask",!n),a=Uv(e,"content",""),o=new Hv(t,{width:s,height:r,text:i,textMask:h,textCrop:n&&!h,content:a,clampTextOY:Uv(e,"clampChildOY",!1),alwaysScrollable:Uv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Uv(e,"space",void 0);l&&(l.child=Uv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign($v.prototype,Gv,Vv);const Jv=Phaser.Utils.Objects.GetValue;var Kv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new op(t,e);break;case"bbcodetext":case"bbcode":s=new rp(t,0,0,"",e);break;case"label":s=new Qv(t,e);break;case"textarea":s=function(t,e,i){e=e?So(e):{};var s=Jv(i,"background",wc),r=Jv(i,"text",Kv),n=Jv(i,"track",wc),h=Jv(i,"thumb",wc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var a=e.slider;!1!==a&&null!==a&&(void 0===a&&(a={}),n?a.track=n(t,a.track):delete a.track,h?a.thumb=h(t,a.thumb):delete a.thumb,e.slider=a);var o=new $v(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Oc(t,e)}return xc(s,e),t.add.existing(s),s},qv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new yc(t,e):new Kd(t,e);break;case"roundRectangle":s=new Gl(t,e);break;default:s=new tc(t,e)}return xc(s,e),t.add.existing(s),s};const Zv=Phaser.Utils.Objects.GetValue;class Qv extends bl{constructor(t,e,i){e=function(t,e,i){e=e?So(e):{};var s=Zv(i,"background",wc),r=Zv(i,"text",Kv),n=Zv(i,"icon",qv),h=Zv(i,"action",qv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&h?e.action=h(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return tg(this.getChildren(),"setActiveState",t),this}setHoverState(t){return tg(this.getChildren(),"setHoverState",t),this}setDisableState(t){return tg(this.getChildren(),"setDisableState",t),this}}var tg=function(t,e,i){for(var s=0,r=t.length;so;d--){for(g=0;g0&&this.wrapMode!==f&&0===this.wrapWidth}setStyle(t,e,s){if(void 0===e&&(e=!0),void 0===s&&(s=!1),t&&t.hasOwnProperty("wordWrap")){var i=t.wordWrap;i.hasOwnProperty("width")&&(t.wrap={mode:"word",width:i.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=w[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&s&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var l=a[h],u=l[0],g=s?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=T(t,u,g);else{var p=k(t,u,g);c&&(p=c(p)),this[h]=p}}var f=T(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=T(t,"fill",null);null!==v&&(this.color=o(v));var y=T(t,"metrics",!1);return y?this.metrics={ascent:T(y,"ascent",0),descent:T(y,"descent",0),fontSize:T(y,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=d(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=T(t,"fontFamily","Courier"),this.fontSize=T(t,"fontSize","16px"),this.fontStyle=T(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,s){return void 0===s&&(s=!0),this.backgroundColor=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=s,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=o(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,s,i,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s="#000"),void 0===i&&(i=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=o(s,this.parent.canvas,this.parent.context),this.shadowBlur=i,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,s){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===s&&(s=0),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=s,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,s){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===s&&(s=0),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=s,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=w[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=T(e,"fontFamily",this.fontFamily),this.fontSize=T(e,"fontSize",this.fontSize),this.fontStyle=T(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var s in e)t[s]=this[s];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}const m=Phaser.Utils.Objects.GetValue;class P{constructor(t,e,s,i,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===s&&(s=0),void 0===i&&(i=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,s,i,r)}setTo(t,e,s,i,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(s,i),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,s;"number"==typeof t?(e=t,s=t):(e=m(t,"x",0),s=m(t,"y",0));var i=this.cornerRadius;i.tl=b(m(t,"tl",void 0),e,s),i.tr=b(m(t,"tr",void 0),e,s),i.bl=b(m(t,"bl",void 0),e,s),i.br=b(m(t,"br",void 0),e,s)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){O(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){O(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){O(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){O(this.cornerRadius.br,t)}}var b=function(t,e,s){return void 0===t?t={x:e,y:s}:"number"==typeof t&&(t={x:t,y:t}),M(t),t},O=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=m(e,"x",0),t.y=m(e,"y",0)),M(t)},M=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const C=Phaser.Math.DegToRad;var F=function(t){return!t.hasOwnProperty("convex")||t.convex},L=function(t){return t.x>0&&t.y>0},W=function(t,e,s,i,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:i/c,v=r>=p?1:r/p,y=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,s),h=y.tl,L(h)?(o=h.x*f,l=h.y*v,F(h)?W(t,o,l,o,l,180,270,!1,a):W(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=y.tr,L(h)?(o=h.x*f,l=h.y*v,F(h)?W(t,i-o,l,o,l,270,360,!1,a):W(t,i,0,o,l,180,90,!0,a)):t.lineTo(i,0),h=y.br,L(h)?(o=h.x*f,l=h.y*v,F(h)?W(t,i-o,r-l,o,l,0,90,!1,a):W(t,i,r,o,l,270,180,!0,a)):t.lineTo(i,r),h=y.bl,L(h)?(o=h.x*f,l=h.y*v,F(h)?W(t,o,r-l,o,l,90,180,!1,a):W(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,s,i,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},A={draw(t,e,s,i){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),function(t,e,s,i,r,n,a,h){if(null!=e||null!=s){var o=t.canvas.width,l=t.canvas.height;null==s&&(i=0);var u=i/2;o=Math.max(1,o-i),l=Math.max(1,l-i),R(t.canvas,t.context,u,u,o,l,r,e,s,i,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,y=v.length,x=a.maxLines;x>0&&y>x?(o=x,l="center"===p?Math.floor((y-o)/2):"bottom"===p?y-o:0):(o=y,l=0),u=l+o;var w=this.rtl,k=w?this.parent.width:void 0;g="center"===p?Math.max((i-o*f)/2,0):"bottom"===p?Math.max(i-o*f-2,0):0,g+=e;for(var T=l;T0){var h=this.defaultStyle.metrics,o=s-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=s+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,s,t.text,a)),t.isImagePen&&this.drawImage(e,s,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(u=s+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,s-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,s,i,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,s,i)},drawLine(t,e,s,i,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=i,a.beginPath(),a.moveTo(t,e),a.lineTo(t+s,e),a.stroke(),a.lineCap=h},drawText(t,e,s,i){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;i.stroke&&"none"!==i.stroke&&i.strokeThickness>0&&(i.syncShadow(r,i.shadowStroke),r.strokeText(s,t,e)),i.color&&"none"!==i.color&&(i.syncShadow(r,i.shadowFill),r.fillText(s,t,e))},drawImage(t,e,s,i,r){e-=this.startYOffset,this.parent.imageManager.draw(s,this.context,t,e,i,this.autoRound)}};const z=Phaser.Utils.Objects.GetValue,I=g,B=c;class _{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=z(t,"text",""),this.x=z(t,"x",0),this.y=z(t,"y",0),this.width=z(t,"width",0);var e=z(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=z(t,"newLineMode",0),this.startIndex=z(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===B&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===B&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var H=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},X=function(t,e){var s=Array.isArray(t);if(void 0===e?e=s?[]:{}:H(e),s){e.length=t.length;for(var i=0,r=t.length;i=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,s,i=!1;for(e=t;e>=0&&!(i=null!=(s=this.lines[e])&&s.length>0);e--);return i?s[s.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var s=e[e.length-1];return null==s?0:s.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,s=0,i=this.lines.length;se&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,s=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var G={};class K{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const V=Phaser.Geom.Rectangle;var N=new K;class J{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ti&&dt(f)){""!==w?a.push(n.getLine(w,k,rt)):0===T&&r>0&&a.push(n.getLine("",0,rt)),a.push(...lt(f,e,ht,i,0,n));var m=a.pop();w=m.text,k=m.width,n.freeLine(m)," "===w&&(w="",k=0)}else(y=k+v)>o?(a.push(n.getLine(w,k,rt)),w=f,k=v,o=i):(w+=f,k=y),T===S-1&&a.push(n.getLine(w,k,l))}return a},ut=function(t,e){var s;switch(e){case at:s=[];for(var i=0,r=(t=t.split(" ")).length;i0&&e!==ct&&s0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new D({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,s){var i;if(null==t)i=this.penManager.plainText;else{var r=this.parser.splitText(t,1);i="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}}var Yt=function(t){for(var e,s,i,r={},n=0,a=(t=t.split(";")).length;n=1&&(i.color=h[0]),o>=2&&(i.thickness=parseInt(h[1].replace("px","")));break;case"shadow":h=i.split(" "),i={},(o=h.length)>=1&&(i.color=h[0]),o>=2&&(i.offsetX=parseInt(h[1].replace("px",""))),o>=3&&(i.offsetY=parseInt(h[2].replace("px",""))),o>=4&&(i.blur=parseInt(h[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var o;h=i.split(" "),i={},(o=h.length)>=1&&(i.color=h[0]),o>=2&&(i.thickness=parseInt(h[1].replace("px",""))),o>=3&&(i.offset=parseInt(h[2].replace("px",""))),"underline"===s?s="u":"strikethrough"===s&&(s="s");break;case"y":i=parseFloat(i)}r[s]=i}return r},Ut=function(t){return 0===(t=t.replace(Nt,"")).length},jt=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,Dt=/<\s*class=/i,Gt=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,Kt=/<\s*style=/i,Vt=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Nt=/^\s+|\s+$/;const Jt=Phaser.Utils.Objects.GetValue;return class extends Bt{constructor(t,e,s,i,r){var n=Jt(r,"tags",void 0);super(t,e,s,i,r,"rexTagText",new $t(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextagtext=e(); +const u=Phaser.Display.Canvas.CanvasPool;var d=function(t){var e=u.create(this),s=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,s);var i=s.measureText(t.testString);if("actualBoundingBoxAscent"in i){var r=i.actualBoundingBoxAscent,n=i.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return u.remove(e),a}var h=Math.ceil(i.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,s.fillStyle="#f00",s.fillRect(0,0,h,l),s.font=t._font,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!s.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,u.remove(e),a;var d,g,c=s.getImageData(0,0,h,l).data,p=c.length,f=4*h,v=0,y=!1;for(d=0;do;d--){for(g=0;g0&&this.wrapMode!==f&&0===this.wrapWidth}setStyle(t,e,s){if(void 0===e&&(e=!0),void 0===s&&(s=!1),t&&t.hasOwnProperty("wordWrap")){var i=t.wordWrap;i.hasOwnProperty("width")&&(t.wrap={mode:"word",width:i.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=w[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&s&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var l=a[h],u=l[0],g=s?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=T(t,u,g);else{var p=k(t,u,g);c&&(p=c(p)),this[h]=p}}var f=T(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=T(t,"fill",null);null!==v&&(this.color=o(v));var y=T(t,"metrics",!1);return y?this.metrics={ascent:T(y,"ascent",0),descent:T(y,"descent",0),fontSize:T(y,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=d(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=T(t,"fontFamily","Courier"),this.fontSize=T(t,"fontSize","16px"),this.fontStyle=T(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,s){return void 0===s&&(s=!0),this.backgroundColor=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=s,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=o(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,s,i,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s="#000"),void 0===i&&(i=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=o(s,this.parent.canvas,this.parent.context),this.shadowBlur=i,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,s){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===s&&(s=0),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=s,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,s){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===s&&(s=0),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=s,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=w[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=T(e,"fontFamily",this.fontFamily),this.fontSize=T(e,"fontSize",this.fontSize),this.fontStyle=T(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var s in e)t[s]=this[s];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}const m=Phaser.Utils.Objects.GetValue;class P{constructor(t,e,s,i,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===s&&(s=0),void 0===i&&(i=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,s,i,r)}setTo(t,e,s,i,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(s,i),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,s;"number"==typeof t?(e=t,s=t):(e=m(t,"x",0),s=m(t,"y",0));var i=this.cornerRadius;i.tl=b(m(t,"tl",void 0),e,s),i.tr=b(m(t,"tr",void 0),e,s),i.bl=b(m(t,"bl",void 0),e,s),i.br=b(m(t,"br",void 0),e,s)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){O(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){O(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){O(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){O(this.cornerRadius.br,t)}}var b=function(t,e,s){return void 0===t?t={x:e,y:s}:"number"==typeof t&&(t={x:t,y:t}),M(t),t},O=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=m(e,"x",0),t.y=m(e,"y",0)),M(t)},M=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const C=Phaser.Math.DegToRad;var F=function(t){return!t.hasOwnProperty("convex")||t.convex},L=function(t){return t.x>0&&t.y>0},W=function(t,e,s,i,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:i/c,v=r>=p?1:r/p,y=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,s),h=y.tl,L(h)?(o=h.x*f,l=h.y*v,F(h)?W(t,o,l,o,l,180,270,!1,a):W(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=y.tr,L(h)?(o=h.x*f,l=h.y*v,F(h)?W(t,i-o,l,o,l,270,360,!1,a):W(t,i,0,o,l,180,90,!0,a)):t.lineTo(i,0),h=y.br,L(h)?(o=h.x*f,l=h.y*v,F(h)?W(t,i-o,r-l,o,l,0,90,!1,a):W(t,i,r,o,l,270,180,!0,a)):t.lineTo(i,r),h=y.bl,L(h)?(o=h.x*f,l=h.y*v,F(h)?W(t,o,r-l,o,l,90,180,!1,a):W(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,s,i,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},A={draw(t,e,s,i){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),function(t,e,s,i,r,n,a,h){if(null!=e||null!=s){var o=t.canvas.width,l=t.canvas.height;null==s&&(i=0);var u=i/2;o=Math.max(1,o-i),l=Math.max(1,l-i),R(t.canvas,t.context,u,u,o,l,r,e,s,i,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,y=v.length,x=a.maxLines;x>0&&y>x?(o=x,l="center"===p?Math.floor((y-o)/2):"bottom"===p?y-o:0):(o=y,l=0),u=l+o;var w=this.rtl,k=w?this.parent.width:void 0;g="center"===p?Math.max((i-o*f)/2,0):"bottom"===p?Math.max(i-o*f-2,0):0,g+=e;for(var T=l;T0){var h=this.defaultStyle.metrics,o=s-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=s+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,s,t.text,a)),t.isImagePen&&this.drawImage(e,s,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(u=s+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,s-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,s,i,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,s,i)},drawLine(t,e,s,i,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=i,a.beginPath(),a.moveTo(t,e),a.lineTo(t+s,e),a.stroke(),a.lineCap=h},drawText(t,e,s,i){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;i.stroke&&"none"!==i.stroke&&i.strokeThickness>0&&(i.syncShadow(r,i.shadowStroke),r.strokeText(s,t,e)),i.color&&"none"!==i.color&&(i.syncShadow(r,i.shadowFill),r.fillText(s,t,e))},drawImage(t,e,s,i,r){e-=this.startYOffset,this.parent.imageManager.draw(s,this.context,t,e,i,this.autoRound)}};const z=Phaser.Utils.Objects.GetValue,I=g,B=c;class _{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=z(t,"text",""),this.x=z(t,"x",0),this.y=z(t,"y",0),this.width=z(t,"width",0);var e=z(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=z(t,"newLineMode",0),this.startIndex=z(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===B&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===B&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var H=function(t,e){var s=Array.isArray(t);if(void 0===e?e=s?[]:{}:function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}(e),s){e.length=t.length;for(var i=0,r=t.length;i=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,s,i=!1;for(e=t;e>=0&&!(i=null!=(s=this.lines[e])&&s.length>0);e--);return i?s[s.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var s=e[e.length-1];return null==s?0:s.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,s=0,i=this.lines.length;se&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,s=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var D={};class G{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const K=Phaser.Geom.Rectangle;var V=new G;class N{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ti&&dt(f)){""!==w?a.push(n.getLine(w,k,rt)):0===T&&r>0&&a.push(n.getLine("",0,rt)),a.push(...lt(f,e,ht,i,0,n));var m=a.pop();w=m.text,k=m.width,n.freeLine(m)," "===w&&(w="",k=0)}else(y=k+v)>o?(a.push(n.getLine(w,k,rt)),w=f,k=v,o=i):(w+=f,k=y),T===S-1&&a.push(n.getLine(w,k,l))}return a},ut=function(t,e){var s;switch(e){case at:s=[];for(var i=0,r=(t=t.split(" ")).length;i0&&e!==ct&&s0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new j({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,s){var i;if(null==t)i=this.penManager.plainText;else{var r=this.parser.splitText(t,1);i="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}}var Yt=function(t){for(var e,s,i,r={},n=0,a=(t=t.split(";")).length;n=1&&(i.color=h[0]),o>=2&&(i.thickness=parseInt(h[1].replace("px","")));break;case"shadow":h=i.split(" "),i={},(o=h.length)>=1&&(i.color=h[0]),o>=2&&(i.offsetX=parseInt(h[1].replace("px",""))),o>=3&&(i.offsetY=parseInt(h[2].replace("px",""))),o>=4&&(i.blur=parseInt(h[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var o;h=i.split(" "),i={},(o=h.length)>=1&&(i.color=h[0]),o>=2&&(i.thickness=parseInt(h[1].replace("px",""))),o>=3&&(i.offset=parseInt(h[2].replace("px",""))),"underline"===s?s="u":"strikethrough"===s&&(s="s");break;case"y":i=parseFloat(i)}r[s]=i}return r},Ut=function(t){return 0===(t=t.replace(Nt,"")).length},jt=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,Dt=/<\s*class=/i,Gt=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,Kt=/<\s*style=/i,Vt=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Nt=/^\s+|\s+$/;const Jt=Phaser.Utils.Objects.GetValue;return class extends Bt{constructor(t,e,s,i,r){var n=Jt(r,"tags",void 0);super(t,e,s,i,r,"rexTagText",new $t(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextagtext=e(); diff --git a/dist/rextagtextplugin.js b/dist/rextagtextplugin.js index a333f64ac1..316be3c533 100644 --- a/dist/rextagtextplugin.js +++ b/dist/rextagtextplugin.js @@ -2284,13 +2284,17 @@ clear() { // Reuse hitArea(rectangle) later for (var i = 0, cnt = this.hitAreas.length; i < cnt; i++) { - Clear(this.hitAreas[i].data); + this.hitAreas[i].data = null; } RectanglePool.pushMultiple(this.hitAreas); return this; } add(x, y, width, height, data) { + if (data === undefined) { + data = {}; + } + var rectangle = RectanglePool.pop(); if (rectangle === null) { rectangle = new Rectangle(x, y, width, height); @@ -2375,6 +2379,11 @@ var key = area.data.key; FireEvent.call(this, 'areadown', key, pointer, localX, localY, event); + // Removed by callback of previous event + if (!area.data) { + return; + } + area.data.isDown = true; }; @@ -2384,21 +2393,29 @@ return; } - var areaData = area.data; - - var key = areaData.key; + var key = area.data.key; FireEvent.call(this, 'areaup', key, pointer, localX, localY, event); - if (areaData.isDown) { + // Removed by callback of previous event + if (!area.data) { + return; + } + + if (area.data.isDown) { FireEvent.call(this, 'areaclick', key, pointer, localX, localY, event); - var url = areaData.url; + // Removed by callback of previous event + if (!area.data) { + return; + } + + var url = area.data.url; if (url) { window.open(url, '_blank'); } } - areaData.isDown = false; + area.data.isDown = false; }; var OnAreaOverOut = function (pointer, localX, localY, event) { @@ -2421,17 +2438,22 @@ FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event); var prevHitArea = this.hitAreaManager.getByKey(this.lastHitAreaKey); - if (this.urlTagCursorStyle && !!prevHitArea.data.url) { - this.scene.input.manager.canvas.style.cursor = ''; - } - prevHitArea.isDown = false; + if (prevHitArea) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, prevHitArea, ''); + } + + prevHitArea.isDown = false; + } } if (key !== null) { FireEvent.call(this, 'areaover', key, pointer, localX, localY, event); - if (this.urlTagCursorStyle && !!area.data.url) { - this.scene.input.manager.canvas.style.cursor = this.urlTagCursorStyle; + if (area.data) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, area, this.urlTagCursorStyle); + } } } @@ -2443,6 +2465,14 @@ this.parent.emit(eventName, key, pointer, localX, localY, event); }; + var SetCursorStyle = function (scene, area, cursorStyle) { + if (!area || !area.data || !area.data.url) { + return; + } + + scene.input.manager.canvas.style.cursor = cursorStyle; + }; + var RE_ASCII = /^[\x00-\x7F]+$/; var IsASCIIString = function (s) { return RE_ASCII.test(s); diff --git a/dist/rextagtextplugin.min.js b/dist/rextagtextplugin.min.js index 685fdbc3f7..fc509bca14 100644 --- a/dist/rextagtextplugin.min.js +++ b/dist/rextagtextplugin.min.js @@ -4,4 +4,4 @@ var t,e;t=void 0,e=function(){var t=Phaser.Renderer.WebGL.Utils,e={renderWebGL:f * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -const u=Phaser.Display.Canvas.CanvasPool;var d=function(t){var e=u.create(this),s=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,s);var i=s.measureText(t.testString);if("actualBoundingBoxAscent"in i){var r=i.actualBoundingBoxAscent,n=i.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return u.remove(e),a}var h=Math.ceil(i.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,s.fillStyle="#f00",s.fillRect(0,0,h,l),s.font=t._font,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!s.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,u.remove(e),a;var d,g,c=s.getImageData(0,0,h,l).data,p=c.length,f=4*h,v=0,y=!1;for(d=0;do;d--){for(g=0;g0&&this.wrapMode!==f&&0===this.wrapWidth}setStyle(t,e,s){if(void 0===e&&(e=!0),void 0===s&&(s=!1),t&&t.hasOwnProperty("wordWrap")){var i=t.wordWrap;i.hasOwnProperty("width")&&(t.wrap={mode:"word",width:i.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=w[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&s&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var l=a[h],u=l[0],g=s?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=T(t,u,g);else{var p=k(t,u,g);c&&(p=c(p)),this[h]=p}}var f=T(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=T(t,"fill",null);null!==v&&(this.color=o(v));var y=T(t,"metrics",!1);return y?this.metrics={ascent:T(y,"ascent",0),descent:T(y,"descent",0),fontSize:T(y,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=d(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=T(t,"fontFamily","Courier"),this.fontSize=T(t,"fontSize","16px"),this.fontStyle=T(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,s){return void 0===s&&(s=!0),this.backgroundColor=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=s,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=o(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,s,i,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s="#000"),void 0===i&&(i=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=o(s,this.parent.canvas,this.parent.context),this.shadowBlur=i,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,s){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===s&&(s=0),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=s,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,s){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===s&&(s=0),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=s,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=w[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=T(e,"fontFamily",this.fontFamily),this.fontSize=T(e,"fontSize",this.fontSize),this.fontStyle=T(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var s in e)t[s]=this[s];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}const S=Phaser.Utils.Objects.GetValue;class P{constructor(t,e,s,i,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===s&&(s=0),void 0===i&&(i=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,s,i,r)}setTo(t,e,s,i,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(s,i),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,s;"number"==typeof t?(e=t,s=t):(e=S(t,"x",0),s=S(t,"y",0));var i=this.cornerRadius;i.tl=b(S(t,"tl",void 0),e,s),i.tr=b(S(t,"tr",void 0),e,s),i.bl=b(S(t,"bl",void 0),e,s),i.br=b(S(t,"br",void 0),e,s)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){O(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){O(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){O(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){O(this.cornerRadius.br,t)}}var b=function(t,e,s){return void 0===t?t={x:e,y:s}:"number"==typeof t&&(t={x:t,y:t}),M(t),t},O=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=S(e,"x",0),t.y=S(e,"y",0)),M(t)},M=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const C=Phaser.Math.DegToRad;var F=function(t){return!t.hasOwnProperty("convex")||t.convex},L=function(t){return t.x>0&&t.y>0},R=function(t,e,s,i,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:i/c,v=r>=p?1:r/p,y=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,s),h=y.tl,L(h)?(o=h.x*f,l=h.y*v,F(h)?R(t,o,l,o,l,180,270,!1,a):R(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=y.tr,L(h)?(o=h.x*f,l=h.y*v,F(h)?R(t,i-o,l,o,l,270,360,!1,a):R(t,i,0,o,l,180,90,!0,a)):t.lineTo(i,0),h=y.br,L(h)?(o=h.x*f,l=h.y*v,F(h)?R(t,i-o,r-l,o,l,0,90,!1,a):R(t,i,r,o,l,270,180,!0,a)):t.lineTo(i,r),h=y.bl,L(h)?(o=h.x*f,l=h.y*v,F(h)?R(t,o,r-l,o,l,90,180,!1,a):R(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,s,i,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},A={draw(t,e,s,i){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),function(t,e,s,i,r,n,a,h){if(null!=e||null!=s){var o=t.canvas.width,l=t.canvas.height;null==s&&(i=0);var u=i/2;o=Math.max(1,o-i),l=Math.max(1,l-i),W(t.canvas,t.context,u,u,o,l,r,e,s,i,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,y=v.length,x=a.maxLines;x>0&&y>x?(o=x,l="center"===p?Math.floor((y-o)/2):"bottom"===p?y-o:0):(o=y,l=0),u=l+o;var w=this.rtl,k=w?this.parent.width:void 0;g="center"===p?Math.max((i-o*f)/2,0):"bottom"===p?Math.max(i-o*f-2,0):0,g+=e;for(var T=l;T0){var h=this.defaultStyle.metrics,o=s-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=s+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,s,t.text,a)),t.isImagePen&&this.drawImage(e,s,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(u=s+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,s-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,s,i,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,s,i)},drawLine(t,e,s,i,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=i,a.beginPath(),a.moveTo(t,e),a.lineTo(t+s,e),a.stroke(),a.lineCap=h},drawText(t,e,s,i){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;i.stroke&&"none"!==i.stroke&&i.strokeThickness>0&&(i.syncShadow(r,i.shadowStroke),r.strokeText(s,t,e)),i.color&&"none"!==i.color&&(i.syncShadow(r,i.shadowFill),r.fillText(s,t,e))},drawImage(t,e,s,i,r){e-=this.startYOffset,this.parent.imageManager.draw(s,this.context,t,e,i,this.autoRound)}};const z=Phaser.Utils.Objects.GetValue,I=g,B=c;class _{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=z(t,"text",""),this.x=z(t,"x",0),this.y=z(t,"y",0),this.width=z(t,"width",0);var e=z(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=z(t,"newLineMode",0),this.startIndex=z(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===B&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===B&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var H=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},X=function(t,e){var s=Array.isArray(t);if(void 0===e?e=s?[]:{}:H(e),s){e.length=t.length;for(var i=0,r=t.length;i=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,s,i=!1;for(e=t;e>=0&&!(i=null!=(s=this.lines[e])&&s.length>0);e--);return i?s[s.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var s=e[e.length-1];return null==s?0:s.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,s=0,i=this.lines.length;se&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,s=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var D={};class K{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const V=Phaser.Geom.Rectangle;var N=new K;class J{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ti&&dt(f)){""!==w?a.push(n.getLine(w,k,rt)):0===T&&r>0&&a.push(n.getLine("",0,rt)),a.push(...lt(f,e,ht,i,0,n));var S=a.pop();w=S.text,k=S.width,n.freeLine(S)," "===w&&(w="",k=0)}else(y=k+v)>o?(a.push(n.getLine(w,k,rt)),w=f,k=v,o=i):(w+=f,k=y),T===m-1&&a.push(n.getLine(w,k,l))}return a},ut=function(t,e){var s;switch(e){case at:s=[];for(var i=0,r=(t=t.split(" ")).length;i0&&e!==ct&&s0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new U({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,s){var i;if(null==t)i=this.penManager.plainText;else{var r=this.parser.splitText(t,1);i="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}}var jt=function(t){for(var e,s,i,r={},n=0,a=(t=t.split(";")).length;n=1&&(i.color=h[0]),o>=2&&(i.thickness=parseInt(h[1].replace("px","")));break;case"shadow":h=i.split(" "),i={},(o=h.length)>=1&&(i.color=h[0]),o>=2&&(i.offsetX=parseInt(h[1].replace("px",""))),o>=3&&(i.offsetY=parseInt(h[2].replace("px",""))),o>=4&&(i.blur=parseInt(h[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var o;h=i.split(" "),i={},(o=h.length)>=1&&(i.color=h[0]),o>=2&&(i.thickness=parseInt(h[1].replace("px",""))),o>=3&&(i.offset=parseInt(h[2].replace("px",""))),"underline"===s?s="u":"strikethrough"===s&&(s="s");break;case"y":i=parseFloat(i)}r[s]=i}return r},Yt=function(t){return 0===(t=t.replace(Nt,"")).length},Gt=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,Ut=/<\s*class=/i,Dt=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,Kt=/<\s*style=/i,Vt=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Nt=/^\s+|\s+$/;const Jt=Phaser.Utils.Objects.GetValue;class qt extends Bt{constructor(t,e,s,i,r){var n=Jt(r,"tags",void 0);super(t,e,s,i,r,"rexTagText",new $t(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}function Et(t,e,s,i){var r=new qt(this.scene,t,e,s,i);return this.scene.add.existing(r),r}const Qt=Phaser.Utils.Objects.GetAdvancedValue,Zt=Phaser.GameObjects.BuildGameObject;function te(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var s=Qt(t,"text",""),i=Qt(t,"style",null),r=Qt(t,"padding",null);null!==r&&(i.padding=r);var n=new qt(this.scene,0,0,s,i);return Zt(this.scene,n,t),n.autoRound=Qt(t,"autoRound",!0),n}var ee=function(t){return null==t||""===t||0===t.length};class se extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexTagText",Et,te)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,s,i){if(void 0===i&&(i="."),"object"==typeof t)if(ee(e)){if(null==s)return;"object"==typeof s&&(t=s)}else{"string"==typeof e&&(e=e.split(i));var r=e.pop(),n=function(t,e,s){var i=t;if(ee(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;no;d--){for(g=0;g0&&this.wrapMode!==f&&0===this.wrapWidth}setStyle(t,e,s){if(void 0===e&&(e=!0),void 0===s&&(s=!1),t&&t.hasOwnProperty("wordWrap")){var i=t.wordWrap;i.hasOwnProperty("width")&&(t.wrap={mode:"word",width:i.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=w[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&s&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var l=a[h],u=l[0],g=s?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=T(t,u,g);else{var p=k(t,u,g);c&&(p=c(p)),this[h]=p}}var f=T(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=T(t,"fill",null);null!==v&&(this.color=o(v));var y=T(t,"metrics",!1);return y?this.metrics={ascent:T(y,"ascent",0),descent:T(y,"descent",0),fontSize:T(y,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=d(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=T(t,"fontFamily","Courier"),this.fontSize=T(t,"fontSize","16px"),this.fontStyle=T(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,s){return void 0===s&&(s=!0),this.backgroundColor=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=s,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=o(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,s,i,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s="#000"),void 0===i&&(i=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=o(s,this.parent.canvas,this.parent.context),this.shadowBlur=i,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,s){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===s&&(s=0),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=s,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,s){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===s&&(s=0),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=s,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=w[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=T(e,"fontFamily",this.fontFamily),this.fontSize=T(e,"fontSize",this.fontSize),this.fontStyle=T(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var s in e)t[s]=this[s];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}const S=Phaser.Utils.Objects.GetValue;class P{constructor(t,e,s,i,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===s&&(s=0),void 0===i&&(i=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,s,i,r)}setTo(t,e,s,i,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(s,i),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,s;"number"==typeof t?(e=t,s=t):(e=S(t,"x",0),s=S(t,"y",0));var i=this.cornerRadius;i.tl=b(S(t,"tl",void 0),e,s),i.tr=b(S(t,"tr",void 0),e,s),i.bl=b(S(t,"bl",void 0),e,s),i.br=b(S(t,"br",void 0),e,s)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){O(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){O(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){O(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){O(this.cornerRadius.br,t)}}var b=function(t,e,s){return void 0===t?t={x:e,y:s}:"number"==typeof t&&(t={x:t,y:t}),M(t),t},O=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=S(e,"x",0),t.y=S(e,"y",0)),M(t)},M=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const C=Phaser.Math.DegToRad;var F=function(t){return!t.hasOwnProperty("convex")||t.convex},L=function(t){return t.x>0&&t.y>0},R=function(t,e,s,i,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:i/c,v=r>=p?1:r/p,y=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,s),h=y.tl,L(h)?(o=h.x*f,l=h.y*v,F(h)?R(t,o,l,o,l,180,270,!1,a):R(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=y.tr,L(h)?(o=h.x*f,l=h.y*v,F(h)?R(t,i-o,l,o,l,270,360,!1,a):R(t,i,0,o,l,180,90,!0,a)):t.lineTo(i,0),h=y.br,L(h)?(o=h.x*f,l=h.y*v,F(h)?R(t,i-o,r-l,o,l,0,90,!1,a):R(t,i,r,o,l,270,180,!0,a)):t.lineTo(i,r),h=y.bl,L(h)?(o=h.x*f,l=h.y*v,F(h)?R(t,o,r-l,o,l,90,180,!1,a):R(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,s,i,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},A={draw(t,e,s,i){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),function(t,e,s,i,r,n,a,h){if(null!=e||null!=s){var o=t.canvas.width,l=t.canvas.height;null==s&&(i=0);var u=i/2;o=Math.max(1,o-i),l=Math.max(1,l-i),W(t.canvas,t.context,u,u,o,l,r,e,s,i,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,u,d,g,c=a.halign,p=a.valign,f=a.lineHeight,v=r.lines,y=v.length,x=a.maxLines;x>0&&y>x?(o=x,l="center"===p?Math.floor((y-o)/2):"bottom"===p?y-o:0):(o=y,l=0),u=l+o;var w=this.rtl,k=w?this.parent.width:void 0;g="center"===p?Math.max((i-o*f)/2,0):"bottom"===p?Math.max(i-o*f-2,0):0,g+=e;for(var T=l;T0){var h=this.defaultStyle.metrics,o=s-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var u=s+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,u,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,s,t.text,a)),t.isImagePen&&this.drawImage(e,s,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(u=s+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,u,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var d,g=t.prop.area;if(g)d={key:g};else{var c=t.prop.url;d={key:`url:${c}`,url:c}}this.hitAreaManager.add(e,s-this.startYOffset,t.width,this.defaultStyle.lineHeight,d)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,s,i,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,s,i)},drawLine(t,e,s,i,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=i,a.beginPath(),a.moveTo(t,e),a.lineTo(t+s,e),a.stroke(),a.lineCap=h},drawText(t,e,s,i){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;i.stroke&&"none"!==i.stroke&&i.strokeThickness>0&&(i.syncShadow(r,i.shadowStroke),r.strokeText(s,t,e)),i.color&&"none"!==i.color&&(i.syncShadow(r,i.shadowFill),r.fillText(s,t,e))},drawImage(t,e,s,i,r){e-=this.startYOffset,this.parent.imageManager.draw(s,this.context,t,e,i,this.autoRound)}};const z=Phaser.Utils.Objects.GetValue,I=g,B=c;class _{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=z(t,"text",""),this.x=z(t,"x",0),this.y=z(t,"y",0),this.width=z(t,"width",0);var e=z(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=z(t,"newLineMode",0),this.startIndex=z(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===B&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===B&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var H=function(t,e){var s=Array.isArray(t);if(void 0===e?e=s?[]:{}:function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}(e),s){e.length=t.length;for(var i=0,r=t.length;i=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,s,i=!1;for(e=t;e>=0&&!(i=null!=(s=this.lines[e])&&s.length>0);e--);return i?s[s.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var s=e[e.length-1];return null==s?0:s.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,s=0,i=this.lines.length;se&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,s=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var U={};class D{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const K=Phaser.Geom.Rectangle;var V=new D;class N{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ti&&dt(f)){""!==w?a.push(n.getLine(w,k,rt)):0===T&&r>0&&a.push(n.getLine("",0,rt)),a.push(...lt(f,e,ht,i,0,n));var S=a.pop();w=S.text,k=S.width,n.freeLine(S)," "===w&&(w="",k=0)}else(y=k+v)>o?(a.push(n.getLine(w,k,rt)),w=f,k=v,o=i):(w+=f,k=y),T===m-1&&a.push(n.getLine(w,k,l))}return a},ut=function(t,e){var s;switch(e){case at:s=[];for(var i=0,r=(t=t.split(" ")).length;i0&&e!==ct&&s0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new G({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,s){var i;if(null==t)i=this.penManager.plainText;else{var r=this.parser.splitText(t,1);i="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}}var jt=function(t){for(var e,s,i,r={},n=0,a=(t=t.split(";")).length;n=1&&(i.color=h[0]),o>=2&&(i.thickness=parseInt(h[1].replace("px","")));break;case"shadow":h=i.split(" "),i={},(o=h.length)>=1&&(i.color=h[0]),o>=2&&(i.offsetX=parseInt(h[1].replace("px",""))),o>=3&&(i.offsetY=parseInt(h[2].replace("px",""))),o>=4&&(i.blur=parseInt(h[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var o;h=i.split(" "),i={},(o=h.length)>=1&&(i.color=h[0]),o>=2&&(i.thickness=parseInt(h[1].replace("px",""))),o>=3&&(i.offset=parseInt(h[2].replace("px",""))),"underline"===s?s="u":"strikethrough"===s&&(s="s");break;case"y":i=parseFloat(i)}r[s]=i}return r},Yt=function(t){return 0===(t=t.replace(Nt,"")).length},Gt=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,Ut=/<\s*class=/i,Dt=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,Kt=/<\s*style=/i,Vt=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,Nt=/^\s+|\s+$/;const Jt=Phaser.Utils.Objects.GetValue;class qt extends Bt{constructor(t,e,s,i,r){var n=Jt(r,"tags",void 0);super(t,e,s,i,r,"rexTagText",new $t(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}function Et(t,e,s,i){var r=new qt(this.scene,t,e,s,i);return this.scene.add.existing(r),r}const Qt=Phaser.Utils.Objects.GetAdvancedValue,Zt=Phaser.GameObjects.BuildGameObject;function te(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var s=Qt(t,"text",""),i=Qt(t,"style",null),r=Qt(t,"padding",null);null!==r&&(i.padding=r);var n=new qt(this.scene,0,0,s,i);return Zt(this.scene,n,t),n.autoRound=Qt(t,"autoRound",!0),n}var ee=function(t){return null==t||""===t||0===t.length};class se extends Phaser.Plugins.BasePlugin{constructor(t){super(t),t.registerGameObject("rexTagText",Et,te)}start(){this.game.events.on("destroy",this.destroy,this)}}return function(t,e,s,i){if(void 0===i&&(i="."),"object"==typeof t)if(ee(e)){if(null==s)return;"object"==typeof s&&(t=s)}else{"string"==typeof e&&(e=e.split(i));var r=e.pop(),n=function(t,e,s){var i=t;if(ee(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Nc=Phaser.Display.Canvas.CanvasPool;var Gc=function(t){var e=Nc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Nc.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,Nc.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,v=4*h,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==wl&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Pl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=Uc(t,l,d);else{var u=Vc(t,l,d);c&&(u=c(u)),this[h]=u}}var p=Uc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Uc(t,"fill",null);null!==v&&(this.color=nd(v));var g=Uc(t,"metrics",!1);return g?this.metrics={ascent:Uc(g,"ascent",0),descent:Uc(g,"descent",0),fontSize:Uc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Gc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Gc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Uc(t,"fontFamily","Courier"),this.fontSize=Uc(t,"fontSize","16px"),this.fontStyle=Uc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=nd(t,this.parent.canvas,this.parent.context),this.backgroundColor2=nd(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=nd(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=nd(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=nd(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=nd(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=nd(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Pl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Uc(e,"fontFamily",this.fontFamily),this.fontSize=Uc(e,"fontSize",this.fontSize),this.fontStyle=Uc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Jc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),ud(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,v=a.valign,g=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Kc=Phaser.Utils.Objects.GetValue,qc=yl,Zc=bl;class Qc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Kc(t,"text",""),this.x=Kc(t,"x",0),this.y=Kc(t,"y",0),this.width=Kc(t,"width",0);var e=Kc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Kc(t,"newLineMode",0),this.startIndex=Kc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Zc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==qc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Zc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const tu=Phaser.Utils.Objects.GetFastValue,eu=yl,iu=xl;class su{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=tu(t,"tagToText",zt),this.tagToTextScope=tu(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var ru={};const nu=Phaser.Geom.Rectangle;var au=new yc;class hu{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&wu(g)){""!==b?a.push(n.getLine(b,x,vu)):0===w&&r>0&&a.push(n.getLine("",0,vu)),a.push(...bu(g,e,mu,s,0,n));var C=a.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,vu)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&a.push(n.getLine(b,x,l))}return a},xu=function(t,e){var i;switch(e){case fu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Cu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new su({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Ep(this.sizerChildren,null),va.call(this,t),this}},Rp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,Ep(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Yp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Ep(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Ep(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},zp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const Wp=Phaser.Utils.Objects.IsPlainObject,jp=Phaser.Utils.Objects.GetValue;class Fp extends ta{constructor(t,e,i,s,r,n,a,h,o,l){Wp(e)?(e=jp(l=e,"x",0),i=jp(l,"y",0),s=jp(l,"width",void 0),r=jp(l,"height",void 0),n=jp(l,"column",l.col||0),a=jp(l,"row",0),h=jp(l,"columnProportions",0),o=jp(l,"rowProportions",0)):Wp(s)?(s=jp(l=s,"width",void 0),r=jp(l,"height",void 0),n=jp(l,"column",l.col||0),a=jp(l,"row",0),h=jp(l,"columnProportions",0),o=jp(l,"rowProportions",0)):Wp(n)?(n=jp(l=n,"column",l.col||0),a=jp(l,"row",0),h=jp(l,"columnProportions",0),o=jp(l,"rowProportions",0)):Wp(h)&&(h=jp(l=h,"columnProportions",0),o=jp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(jp(l,"createCellContainerCallback")),this.setIndentLeft(jp(l,"space.indentLeftOdd",0),jp(l,"space.indentLeftEven",0)),this.setIndentTop(jp(l,"space.indentTopOdd",0),jp(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,jp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=Xp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=zp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Fp.prototype,Yp);const Ip=Phaser.Utils.Objects.GetValue,Bp=Phaser.Math.Percent;var Hp=function(t,e,i){var s;return t.y===e.y?s=Bp(i.x,t.x,e.x):t.x===e.x&&(s=Bp(i.y,t.y,e.y)),s},Np=function(t,e,i){var s,r;this.enable&&(Gp.x=e,Gp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Hp(s,r,Gp))},Gp={},Vp=function(t,e,i){if(this.enable&&t.isDown){var s,r;Up.x=t.worldX,Up.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Hp(s,r,Up);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},Up={},$p=function(t,e){void 0===e&&(e=Jp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return he(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Jp={};const Kp=Phaser.Display.Align.LEFT_CENTER,qp=Phaser.Display.Align.TOP_CENTER;var Zp={};const Qp=Phaser.Display.Align.RIGHT_CENTER,tv=Phaser.Display.Align.BOTTOM_CENTER;var ev={};const iv=Phaser.Math.Linear;var sv={};const rv=Phaser.Display.Align.LEFT_CENTER,nv=Phaser.Display.Align.TOP_CENTER,av=Phaser.Display.Align.RIGHT_CENTER,hv=Phaser.Display.Align.BOTTOM_CENTER,ov=Phaser.Utils.Objects.GetValue,lv=Phaser.Utils.Objects.IsPlainObject,dv=Phaser.Math.Clamp,cv=Phaser.Math.Snap.To;class uv extends(Mh(Ta)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=ov(e,"reverseAxis",!1);var i=ov(e,"background",void 0),s=ov(e,"track",void 0),r=ov(e,"indicator",void 0),n=ov(e,"thumb",void 0);if(i&&(lv(i)&&(i=$o(t,i)),this.addBackground(i)),s&&(lv(s)&&(s=$o(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(lv(r)&&(r=$o(t,r)),this.pin(r)),n){lv(n)&&(n=$o(t,n)),this.pin(n);var a=ov(e,"thumbOffsetX",0),h=ov(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=ov(e,"input",0);switch("string"==typeof o&&(o=pv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Np,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Vp,this).on("pointermove",Vp,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(ov(e,"enable",void 0));var l=ov(e,"tick",void 0);void 0===l&&(l=ov(e,"gap",void 0)),this.setGap(l),this.setValue(ov(e,"value",0),ov(e,"min",void 0),ov(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=cv(t,this.gap));var e=this._value;this._value=dv(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const pv={pan:0,drag:0,click:1,none:-1};var vv={getStartPoint:function(t){if(void 0===t&&(t=Zp),this.childrenMap.thumb){var e=0===this.orientation?Kp:qp;$p.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=ev),this.childrenMap.thumb){var e=0===this.orientation?Qp:tv;$p.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=sv),s.x=iv(e.x,i.x,t),s.y=iv(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?av:hv:0===this.orientation?rv:nv,ae(e,this,r),this.resetChildPositionState(e)}};Object.assign(uv.prototype,vv);const gv=Phaser.Utils.Objects.GetValue;class fv extends Ta{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=gv(e,"background",void 0),n=gv(e,"buttons",void 0),a=gv(n,"top",gv(n,"left",void 0)),h=gv(n,"bottom",gv(n,"right",void 0)),o=gv(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===gv(o,"width",void 0)?1:0:void 0===gv(o,"height",void 0)?1:0,i=new uv(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=gv(e,"valuechangeCallback",null);if(null!==d){var c=gv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(gv(e,"enable",void 0)),this.setValue(gv(e,"value",0)),this.setScrollStep(gv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class mv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const yv=Phaser.Utils.Objects.GetValue,bv=Phaser.Math.Distance.Between;class xv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=yv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(yv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(yv(t,"enable",!0)),this.holdThreshold=yv(t,"holdThreshold",50),this.pointerOutReleaseEnable=yv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:bv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const wv=Phaser.Utils.Objects.GetValue;class Sv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(wv(t,"value",0)),this.setSpeed(wv(t,"speed",0)),this.setAcceleration(wv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Cv{constructor(){this.value,this.dir,this.movement=new Sv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Tv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},kv=Phaser.Utils.Objects.GetValue;class Ev extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=kv(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(kv(e,"speed",.1)),this.setEnable(kv(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(kv(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Mv=Phaser.Utils.Objects.GetValue;var Rv=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?Mv(s,l,void 0):Mv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new fv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Mv(r,"tickLength",void 0);var p=Mv(r,"position",0);"string"==typeof p&&(p=Lv[p]);var v,g,f=Mv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Mv(s,"space.slider",void 0))&&(h?f=0:v=Mv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,a?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Mv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Mv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Mv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Mv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Mv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Mv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Mv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Mv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Mv(s,"scrollDetectionMode");"string"==typeof b&&(b=Dv[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?Mv(s,x,!0):Mv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new _v(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=Mv(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new Ev(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(h?(S=a?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(h?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=h?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const Lv={right:0,left:1,bottom:0,top:1},Dv={gameObject:0,rectBounds:1},Av=Phaser.Utils.Objects.GetValue;var Yv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Av(e,"width"),a=Av(e,"height");n||Av(e,"child.expandWidth",!0)||(s[1]=0),a||Av(e,"child.expandHeight",!0)||(r[1]=0);var h=new Fp(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Ip(i,"child"),r=Ip(s,"gameObject",void 0);if(r){var n=Ip(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=Ip(n,"top",0),a.bottom=Ip(n,"bottom",0),h.left=Ip(n,"left",0),h.right=Ip(n,"right",0);break;case 1:a.top=Ip(n,"left",0),a.bottom=Ip(n,"right",0),h.top=Ip(n,"top",0),h.bottom=Ip(n,"bottom",0);break;default:a.top=Ip(n,"top",0),a.bottom=Ip(n,"bottom",0),a.left=Ip(n,"left",0),a.right=Ip(n,"right",0)}e.add(r,{column:1,row:1,align:Ip(s,"align","center"),padding:h,expand:{width:Ip(s,"expandWidth",!0),height:Ip(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Rv(t,h,"y",e);break;case 1:Rv(t,h,"x",e);break;default:Rv(t,h,"y",e),Rv(t,h,"x",e)}return h},Xv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},zv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},Wv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Nv.call(this,-this.textOY)),0),e=Gv.call(this,t)+this.textOY,i=Vv.call(this,t);return function(t,e){switch(pl(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,Uv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Jv.call(this,t,n,a),he(t,s,r,n,a,e.align),e.preOffsetY=0,Uv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const qv=Phaser.Utils.Objects.IsPlainObject,Zv=Phaser.Utils.Objects.GetValue,Qv=Phaser.Display.Align.TOP_LEFT;class tg extends ta{constructor(t,e,i,s,r,n){qv(e)?(e=Zv(n=e,"x",0),i=Zv(n,"y",0),s=Zv(n,"width",void 0),r=Zv(n,"height",void 0)):qv(s)&&(s=Zv(n=s,"width",void 0),r=Zv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Zv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Zv(n,"clampTextOY",!0)),this.alwaysScrollable=Zv(n,"alwaysScrollable",!1);var a=Zv(n,"background",void 0),h=Zv(n,"text",void 0);void 0===h&&(h=eg(t)),this.textCropEnable=Zv(n,"textCrop",!!h.setCrop);var o=Zv(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=Qv,l.padding=ge(0),l.expand=!0,this.textObject=h,this.textObjectType=pl(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=ol.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Nv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Gv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var eg=function(t){return t.add.text(0,0,"")};Object.assign(tg.prototype,Kv);var ig={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},sg={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const rg=Phaser.Utils.Objects.GetValue;class ng extends Bv{constructor(t,e){void 0===e&&(e={});var i=rg(e,"text",void 0),s=rg(e,"textWidth",void 0),r=rg(e,"textHeight",void 0),n=rg(e,"textCrop",!!i.setCrop),a=rg(e,"textMask",!n),h=rg(e,"content",""),o=new tg(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:rg(e,"clampChildOY",!1),alwaysScrollable:rg(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=rg(e,"space",void 0);l&&(l.child=rg(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(ng.prototype,ig,sg);const ag=Phaser.Utils.Objects.GetValue;var hg=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new bp(t,e);break;case"bbcodetext":case"bbcode":s=new gp(t,0,0,"",e);break;case"label":s=new dg(t,e);break;case"textarea":s=function(t,e,i){e=e?ko(e):{};var s=ag(i,"background",$o),r=ag(i,"text",hg),n=ag(i,"track",$o),a=ag(i,"thumb",$o);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new ng(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Xc(t,e)}return Uo(s,e),t.add.existing(s),s},og=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Go(t,e):new So(t,e);break;case"roundRectangle":s=new gh(t,e);break;default:s=new _o(t,e)}return Uo(s,e),t.add.existing(s),s};const lg=Phaser.Utils.Objects.GetValue;class dg extends Dc{constructor(t,e,i){e=function(t,e,i){e=e?ko(e):{};var s=lg(i,"background",$o),r=lg(i,"text",hg),n=lg(i,"icon",og),a=lg(i,"action",og);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return cg(this.getChildren(),"setActiveState",t),this}setHoverState(t){return cg(this.getChildren(),"setHoverState",t),this}setDisableState(t){return cg(this.getChildren(),"setDisableState",t),this}}var cg=function(t,e,i){for(var s=0,r=t.length;s0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Tg(r,"x",null);null!==n?(t=n,i=n):(t=Tg(r,"left",0),i=Tg(r,"right",t));var a=Tg(r,"y",null);null!==a?(e=a,s=a):(e=Tg(r,"top",0),s=Tg(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Mg(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Eg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Lg={right:0,down:1,left:2,up:3};var Dg=function(t){return"string"==typeof t&&(t=Lg[t]),t%=4};Object.assign(Rg.prototype,Pg,_g);var Ag=function(t,e,i){var s=new Rg(t,e);return t.add.existing(s),s.on("expand.start",(function(t){t.setDirection("down")})).on("collapse.complete",(function(t){t.setDirection("right")})),s};const Yg=Phaser.Utils.Objects.GetValue,Xg=Phaser.Utils.Objects.GetValue,zg=Phaser.Utils.Objects.Clone,Wg=Phaser.Utils.Objects.GetValue;class jg extends(ka(Ya)){constructor(t,e){void 0===e&&(e={});var i=za(t,Wg(e,"background"),{isLeaf:!1},Jo,!1),s=function(t,e){var i=new Ta(t,{orientation:Xg(e,"childrenOrientation","y")});t.add.existing(i);var s=za(t,Xg(e,"childrenBackground"),{isLeaf:!1},Jo,!1);return s&&i.addBackground(s),i}(t,e),r=s.childrenMap.items,n=function(t,e){var i=new vg(t,e,{isLeaf:!1});t.add.existing(i);var s=za(t,Yg(e,"toggleButton"),{isLeaf:!1},Ag,!0);return i.insert(0,s,{padding:{right:Yg(e,"space.toggleButton",0)},fitRatio:1}),i.addChildrenMap("toggleButton",s),i}(t,e),a=n.childrenMap.toggleButton,h=n.childrenMap.nodeBody,o=Oa(Wg(e,"orientation","y")),l=e.space;if(l){var d=Wg(l,"indent",0);l.childLeft=Wg(l,"indentLeft",1===o?d:0),l.childRight=Wg(l,"indentRight",0),l.childTop=Wg(l,"indentTop",0===o?d:0),l.childBottom=Wg(l,"indentBottom",0)}super(t,{background:i,title:n,child:s,toggleByTarget:a,transition:e.transition,orientation:o,space:l,align:e.align,expand:e.expand}),this.type="rexTree",this.rexSizer.treeParent=null,this.nodesMap={},this.configSave=e,this.nodeBody=h,this.addChildrenMap("toggleButton",a),this.addChildrenMap("nodeBody",h),this.addChildrenMap("childrenNodes",r),this.on("expand.start",(function(){a.emit("expand.start",a),Fg(this,"expand.start")}),this).on("expand.complete",(function(){a.emit("expand.complete",a),Fg(this,"expand.complete")})).on("collapse.start",(function(){a.emit("collapse.start",a),Fg(this,"collapse.start")})).on("collapse.complete",(function(){a.emit("collapse.complete",a),Fg(this,"collapse.complete")}));var c=this;c._postAddCallback=function(){var t=Wg(e,"expanded",!0);void 0!==t&&c.setExpandedState(t),delete c._postAddCallback}}destroy(t){this.scene&&!this.ignoreDestroy&&(this.configSave=void 0,Clear(this.nodesMap),this.nodesMap=void 0,super.destroy(t))}get isTree(){return!0}createTree(t){return jg.CreateTree(this.scene,this.configSave,t)}isTreeObject(t){return t&&t instanceof jg}}jg.CreateTree=function(t,e,i){return new jg(t,function(t,e){var i=t?zg(t):{};if(!e)return i;for(var s in e)i[s]=e[s];return i}(e,i))};var Fg=function(t,e){var i=t.getTreesSizer();i&&i.emit(e,t)};Object.assign(jg.prototype,xg);const Ig=Phaser.Utils.String.UUID;var Bg={addTree(t){return bt(t)&&(t={nodeBody:t,nodeKey:nodeKey}),this.insertTree(void 0,t)},insertTree(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=Ig());var s=jg.CreateTree(this.scene,this.treeConfig,e);return gg(this,s),s.nodeKey=i,this.treesMap[i]=s,this.insert(t,s,{expand:!0}),s._postAddCallback(),s}},Hg={removeTree(t,e){return"string"==typeof t&&(t=this.getTree(t)),t?(delete this.treesMap[t.nodeKey],t.nodeKey=null,this.remove(t,e),this):this},removeAllNodes(t){var e=this.treesMap;for(var i in e)this.removeTree(e[i],t);return this}},Ng={getTree(t){return this.treesMap[t]},getTrees(t){for(var e in void 0===t&&(t=[]),this.treesMap)t.push(this.treesMap[e]);return t},getNode(t){var e=t.indexOf(".");if(-1===e)return this.getTree(t);var i=this.getTree(t.substring(0,e));return i?i.getNode(t.substring(e+1)):void 0}},Gg={pointToChild:function(t,e,i,s){for(var r in this.treesMap){var n=this.treesMap[r];if(lr(n.nodeBody,t,e,i,s))return n;var a=n.pointToChild(t,e,i,s);if(a)return a}return null},setChildrenInteractive:function(t){return void 0===t&&(t={}),t.targetMode="parent",t.targetSizers=[this],qn(this,t),this}};Object.assign(Gg,Bg,Hg,Ng);const Vg=Phaser.Utils.Objects.GetValue;class Ug extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation="y"),super(t,e),this.type="rexTrees",this.treesMap={},this.treeConfig=Vg(e,"tree")}destroy(t){this.scene&&!this.ignoreDestroy&&(this.treeConfig=void 0,Clear(this.treesMap),this.treesMap=void 0,super.destroy(t))}}return Object.assign(Ug.prototype,Gg),Ug},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextrees=e(); + */const Nc=Phaser.Display.Canvas.CanvasPool;var Gc=function(t){var e=Nc.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Nc.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,Nc.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,v=4*h,g=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==wl&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Pl[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=Uc(t,l,d);else{var u=Vc(t,l,d);c&&(u=c(u)),this[h]=u}}var p=Uc(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var v=Uc(t,"fill",null);null!==v&&(this.color=nd(v));var g=Uc(t,"metrics",!1);return g?this.metrics={ascent:Uc(g,"ascent",0),descent:Uc(g,"descent",0),fontSize:Uc(g,"fontSize",0)}:!e&&this.metrics||(this.metrics=Gc(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Gc(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=Uc(t,"fontFamily","Courier"),this.fontSize=Uc(t,"fontSize","16px"),this.fontStyle=Uc(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=nd(t,this.parent.canvas,this.parent.context),this.backgroundColor2=nd(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=nd(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=nd(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=nd(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=nd(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=nd(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=nd(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Pl[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=Uc(e,"fontFamily",this.fontFamily),this.fontSize=Uc(e,"fontSize",this.fontSize),this.fontStyle=Uc(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var Jc={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),ud(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,v=a.valign,g=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===v?Math.floor((m-o)/2):"bottom"===v?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===v?Math.max((s-o*g)/2,0):"bottom"===v?Math.max(s-o*g-2,0):0,u+=e;for(var w=l;w0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Kc=Phaser.Utils.Objects.GetValue,qc=yl,Zc=bl;class Qc{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Kc(t,"text",""),this.x=Kc(t,"x",0),this.y=Kc(t,"y",0),this.width=Kc(t,"width",0);var e=Kc(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Kc(t,"newLineMode",0),this.startIndex=Kc(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===Zc&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==qc&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===Zc&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const tu=Phaser.Utils.Objects.GetFastValue,eu=yl,iu=xl;class su{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=tu(t,"tagToText",zt),this.tagToTextScope=tu(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var ru={};const nu=Phaser.Geom.Rectangle;var au=new yc;class hu{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Su(g)){""!==b?a.push(n.getLine(b,x,gu)):0===w&&r>0&&a.push(n.getLine("",0,gu)),a.push(...xu(g,e,yu,s,0,n));var C=a.pop();b=C.text,x=C.width,n.freeLine(C)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,gu)),b=g,x=f,o=s):(b+=g,x=m),w===S-1&&a.push(n.getLine(b,x,l))}return a},wu=function(t,e){var i;switch(e){case mu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Ou&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new su({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Mp(this.sizerChildren,null),va.call(this,t),this}},Lp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,Mp(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},Xp={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=ze.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Mp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Mp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},Wp=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const jp=Phaser.Utils.Objects.IsPlainObject,Fp=Phaser.Utils.Objects.GetValue;class Ip extends ta{constructor(t,e,i,s,r,n,a,h,o,l){jp(e)?(e=Fp(l=e,"x",0),i=Fp(l,"y",0),s=Fp(l,"width",void 0),r=Fp(l,"height",void 0),n=Fp(l,"column",l.col||0),a=Fp(l,"row",0),h=Fp(l,"columnProportions",0),o=Fp(l,"rowProportions",0)):jp(s)?(s=Fp(l=s,"width",void 0),r=Fp(l,"height",void 0),n=Fp(l,"column",l.col||0),a=Fp(l,"row",0),h=Fp(l,"columnProportions",0),o=Fp(l,"rowProportions",0)):jp(n)?(n=Fp(l=n,"column",l.col||0),a=Fp(l,"row",0),h=Fp(l,"columnProportions",0),o=Fp(l,"rowProportions",0)):jp(h)&&(h=Fp(l=h,"columnProportions",0),o=Fp(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(Fp(l,"createCellContainerCallback")),this.setIndentLeft(Fp(l,"space.indentLeftOdd",0),Fp(l,"space.indentLeftEven",0)),this.setIndentTop(Fp(l,"space.indentTopOdd",0),Fp(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,Fp(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=zp.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=Wp.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(Ip.prototype,Xp);const Bp=Phaser.Utils.Objects.GetValue,Hp=Phaser.Math.Percent;var Np=function(t,e,i){var s;return t.y===e.y?s=Hp(i.x,t.x,e.x):t.x===e.x&&(s=Hp(i.y,t.y,e.y)),s},Gp=function(t,e,i){var s,r;this.enable&&(Vp.x=e,Vp.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=Np(s,r,Vp))},Vp={},Up=function(t,e,i){if(this.enable&&t.isDown){var s,r;$p.x=t.worldX,$p.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=Np(s,r,$p);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},$p={},Jp=function(t,e){void 0===e&&(e=Kp);var i=this.childrenMap.thumb,s=i.x,r=i.y;return he(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},Kp={};const qp=Phaser.Display.Align.LEFT_CENTER,Zp=Phaser.Display.Align.TOP_CENTER;var Qp={};const tv=Phaser.Display.Align.RIGHT_CENTER,ev=Phaser.Display.Align.BOTTOM_CENTER;var iv={};const sv=Phaser.Math.Linear;var rv={};const nv=Phaser.Display.Align.LEFT_CENTER,av=Phaser.Display.Align.TOP_CENTER,hv=Phaser.Display.Align.RIGHT_CENTER,ov=Phaser.Display.Align.BOTTOM_CENTER,lv=Phaser.Utils.Objects.GetValue,dv=Phaser.Utils.Objects.IsPlainObject,cv=Phaser.Math.Clamp,uv=Phaser.Math.Snap.To;class pv extends(Mh(Ta)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=lv(e,"reverseAxis",!1);var i=lv(e,"background",void 0),s=lv(e,"track",void 0),r=lv(e,"indicator",void 0),n=lv(e,"thumb",void 0);if(i&&(dv(i)&&(i=$o(t,i)),this.addBackground(i)),s&&(dv(s)&&(s=$o(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(dv(r)&&(r=$o(t,r)),this.pin(r)),n){dv(n)&&(n=$o(t,n)),this.pin(n);var a=lv(e,"thumbOffsetX",0),h=lv(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=lv(e,"input",0);switch("string"==typeof o&&(o=vv[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",Gp,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",Up,this).on("pointermove",Up,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(lv(e,"enable",void 0));var l=lv(e,"tick",void 0);void 0===l&&(l=lv(e,"gap",void 0)),this.setGap(l),this.setValue(lv(e,"value",0),lv(e,"min",void 0),lv(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=uv(t,this.gap));var e=this._value;this._value=cv(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const vv={pan:0,drag:0,click:1,none:-1};var gv={getStartPoint:function(t){if(void 0===t&&(t=Qp),this.childrenMap.thumb){var e=0===this.orientation?qp:Zp;Jp.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=iv),this.childrenMap.thumb){var e=0===this.orientation?tv:ev;Jp.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=rv),s.x=sv(e.x,i.x,t),s.y=sv(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ne(e,i,s),r=n?0===this.orientation?hv:ov:0===this.orientation?nv:av,ae(e,this,r),this.resetChildPositionState(e)}};Object.assign(pv.prototype,gv);const fv=Phaser.Utils.Objects.GetValue;class mv extends Ta{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=fv(e,"background",void 0),n=fv(e,"buttons",void 0),a=fv(n,"top",fv(n,"left",void 0)),h=fv(n,"bottom",fv(n,"right",void 0)),o=fv(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Mr(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===fv(o,"width",void 0)?1:0:void 0===fv(o,"height",void 0)?1:0,i=new pv(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Mr(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=fv(e,"valuechangeCallback",null);if(null!==d){var c=fv(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(fv(e,"enable",void 0)),this.setValue(fv(e,"value",0)),this.setScrollStep(fv(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class yv extends Rs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const bv=Phaser.Utils.Objects.GetValue,xv=Phaser.Math.Distance.Between;class wv extends ii{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=bv(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(bv(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(bv(t,"enable",!0)),this.holdThreshold=bv(t,"holdThreshold",50),this.pointerOutReleaseEnable=bv(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return dn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:xv(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!or(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!or(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Sv=Phaser.Utils.Objects.GetValue;class Cv{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Sv(t,"value",0)),this.setSpeed(Sv(t,"speed",0)),this.setAcceleration(Sv(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Ov{constructor(){this.value,this.dir,this.movement=new Cv}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const kv={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Ev=Phaser.Utils.Objects.GetValue;class Mv extends ii{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Ev(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Ev(e,"speed",.1)),this.setEnable(Ev(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Ev(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||or(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Rv=Phaser.Utils.Objects.GetValue;var Lv=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?Rv(s,l,void 0):Rv(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=mt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new mv(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Rv(r,"tickLength",void 0);var p=Rv(r,"position",0);"string"==typeof p&&(p=Dv[p]);var v,g,f=Rv(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Rv(s,"space.slider",void 0))&&(h?f=0:v=Rv(s,"space.child",0)),g=void 0===v?"number"==typeof f:"number"==typeof v,a?0===p?(d=2,c=1,u=void 0===v?g?{left:f}:f:{left:Rv(v,"right",v)}):(d=0,c=1,u=void 0===v?g?{right:f}:f:{right:Rv(v,"left",v)}):0===p?(d=1,c=2,u=void 0===v?g?{top:f}:f:{top:Rv(v,"bottom",v)}):(d=1,c=0,u=void 0===v?g?{bottom:f}:f:{bottom:Rv(v,"top",v)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Rv(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Rv(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Rv(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Rv(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Rv(s,"scrollDetectionMode");"string"==typeof b&&(b=Av[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?Rv(s,x,!0):Rv(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Tv(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var w,S,C,O,P,_=Rv(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);_&&o&&(void 0!==b&&(_.focus=1===b?2:0),w=new Mv(o,_)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,w),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",w)),n&&(h?(S=a?"t":"s",O=`scroll${i}`):(S="t",O="scroll"),n.on("valuechange",(function(e){t[S]=e,t.emit(O,t)}))),y&&(h?(C=`childO${i}`,O=`scroll${i}`):(C="childOY",O="scroll"),y.on("valuechange",(function(e){t[C]=e,t.emit(O,t)}))),w&&(P=h?`addChildO${i}`:"addChildOY",w.on("scroll",(function(e){t[P](-e,!0)})))};const Dv={right:0,left:1,bottom:0,top:1},Av={gameObject:0,rectBounds:1},Yv=Phaser.Utils.Objects.GetValue;var Xv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=Yv(e,"width"),a=Yv(e,"height");n||Yv(e,"child.expandWidth",!0)||(s[1]=0),a||Yv(e,"child.expandHeight",!0)||(r[1]=0);var h=new Ip(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=Bp(i,"child"),r=Bp(s,"gameObject",void 0);if(r){var n=Bp(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=Bp(n,"top",0),a.bottom=Bp(n,"bottom",0),h.left=Bp(n,"left",0),h.right=Bp(n,"right",0);break;case 1:a.top=Bp(n,"left",0),a.bottom=Bp(n,"right",0),h.top=Bp(n,"top",0),h.bottom=Bp(n,"bottom",0);break;default:a.top=Bp(n,"top",0),a.bottom=Bp(n,"bottom",0),a.left=Bp(n,"left",0),a.right=Bp(n,"right",0)}e.add(r,{column:1,row:1,align:Bp(s,"align","center"),padding:h,expand:{width:Bp(s,"expandWidth",!0),height:Bp(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Lv(t,h,"y",e);break;case 1:Lv(t,h,"x",e);break;default:Lv(t,h,"y",e),Lv(t,h,"x",e)}return h},zv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},Wv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},jv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(Gv.call(this,-this.textOY)),0),e=Vv.call(this,t)+this.textOY,i=Uv.call(this,t);return function(t,e){switch(pl(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,$v.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Ie.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,Kv.call(this,t,n,a),he(t,s,r,n,a,e.align),e.preOffsetY=0,$v.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const Zv=Phaser.Utils.Objects.IsPlainObject,Qv=Phaser.Utils.Objects.GetValue,tg=Phaser.Display.Align.TOP_LEFT;class eg extends ta{constructor(t,e,i,s,r,n){Zv(e)?(e=Qv(n=e,"x",0),i=Qv(n,"y",0),s=Qv(n,"width",void 0),r=Qv(n,"height",void 0)):Zv(s)&&(s=Qv(n=s,"width",void 0),r=Qv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Qv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Qv(n,"clampTextOY",!0)),this.alwaysScrollable=Qv(n,"alwaysScrollable",!1);var a=Qv(n,"background",void 0),h=Qv(n,"text",void 0);void 0===h&&(h=ig(t)),this.textCropEnable=Qv(n,"textCrop",!!h.setCrop);var o=Qv(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=tg,l.padding=ge(0),l.expand=!0,this.textObject=h,this.textObjectType=pl(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=ol.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(Gv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=Vv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var ig=function(t){return t.add.text(0,0,"")};Object.assign(eg.prototype,qv);var sg={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},rg={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const ng=Phaser.Utils.Objects.GetValue;class ag extends Hv{constructor(t,e){void 0===e&&(e={});var i=ng(e,"text",void 0),s=ng(e,"textWidth",void 0),r=ng(e,"textHeight",void 0),n=ng(e,"textCrop",!!i.setCrop),a=ng(e,"textMask",!n),h=ng(e,"content",""),o=new eg(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:ng(e,"clampChildOY",!1),alwaysScrollable:ng(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=ng(e,"space",void 0);l&&(l.child=ng(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(ag.prototype,sg,rg);const hg=Phaser.Utils.Objects.GetValue;var og=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new xp(t,e);break;case"bbcodetext":case"bbcode":s=new fp(t,0,0,"",e);break;case"label":s=new cg(t,e);break;case"textarea":s=function(t,e,i){e=e?ko(e):{};var s=hg(i,"background",$o),r=hg(i,"text",og),n=hg(i,"track",$o),a=hg(i,"thumb",$o);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new ag(t,e);return t.add.existing(o),o}(t,e);break;default:s=new Xc(t,e)}return Uo(s,e),t.add.existing(s),s},lg=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Go(t,e):new So(t,e);break;case"roundRectangle":s=new gh(t,e);break;default:s=new _o(t,e)}return Uo(s,e),t.add.existing(s),s};const dg=Phaser.Utils.Objects.GetValue;class cg extends Dc{constructor(t,e,i){e=function(t,e,i){e=e?ko(e):{};var s=dg(i,"background",$o),r=dg(i,"text",og),n=dg(i,"icon",lg),a=dg(i,"action",lg);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e}(t,e,i),super(t,e),this.type="rexSimpleLabel"}setActiveState(t){return ug(this.getChildren(),"setActiveState",t),this}setHoverState(t){return ug(this.getChildren(),"setHoverState",t),this}setDisableState(t){return ug(this.getChildren(),"setDisableState",t),this}}var ug=function(t,e,i){for(var s=0,r=t.length;s0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=kg(r,"x",null);null!==n?(t=n,i=n):(t=kg(r,"left",0),i=kg(r,"right",t));var a=kg(r,"y",null);null!==a?(e=a,s=a):(e=kg(r,"top",0),s=kg(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Rg(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Mg(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Dg={right:0,down:1,left:2,up:3};var Ag=function(t){return"string"==typeof t&&(t=Dg[t]),t%=4};Object.assign(Lg.prototype,_g,Tg);var Yg=function(t,e,i){var s=new Lg(t,e);return t.add.existing(s),s.on("expand.start",(function(t){t.setDirection("down")})).on("collapse.complete",(function(t){t.setDirection("right")})),s};const Xg=Phaser.Utils.Objects.GetValue,zg=Phaser.Utils.Objects.GetValue,Wg=Phaser.Utils.Objects.Clone,jg=Phaser.Utils.Objects.GetValue;class Fg extends(ka(Ya)){constructor(t,e){void 0===e&&(e={});var i=za(t,jg(e,"background"),{isLeaf:!1},Jo,!1),s=function(t,e){var i=new Ta(t,{orientation:zg(e,"childrenOrientation","y")});t.add.existing(i);var s=za(t,zg(e,"childrenBackground"),{isLeaf:!1},Jo,!1);return s&&i.addBackground(s),i}(t,e),r=s.childrenMap.items,n=function(t,e){var i=new gg(t,e,{isLeaf:!1});t.add.existing(i);var s=za(t,Xg(e,"toggleButton"),{isLeaf:!1},Yg,!0);return i.insert(0,s,{padding:{right:Xg(e,"space.toggleButton",0)},fitRatio:1}),i.addChildrenMap("toggleButton",s),i}(t,e),a=n.childrenMap.toggleButton,h=n.childrenMap.nodeBody,o=Oa(jg(e,"orientation","y")),l=e.space;if(l){var d=jg(l,"indent",0);l.childLeft=jg(l,"indentLeft",1===o?d:0),l.childRight=jg(l,"indentRight",0),l.childTop=jg(l,"indentTop",0===o?d:0),l.childBottom=jg(l,"indentBottom",0)}super(t,{background:i,title:n,child:s,toggleByTarget:a,transition:e.transition,orientation:o,space:l,align:e.align,expand:e.expand}),this.type="rexTree",this.rexSizer.treeParent=null,this.nodesMap={},this.configSave=e,this.nodeBody=h,this.addChildrenMap("toggleButton",a),this.addChildrenMap("nodeBody",h),this.addChildrenMap("childrenNodes",r),this.on("expand.start",(function(){a.emit("expand.start",a),Ig(this,"expand.start")}),this).on("expand.complete",(function(){a.emit("expand.complete",a),Ig(this,"expand.complete")})).on("collapse.start",(function(){a.emit("collapse.start",a),Ig(this,"collapse.start")})).on("collapse.complete",(function(){a.emit("collapse.complete",a),Ig(this,"collapse.complete")}));var c=this;c._postAddCallback=function(){var t=jg(e,"expanded",!0);void 0!==t&&c.setExpandedState(t),delete c._postAddCallback}}destroy(t){this.scene&&!this.ignoreDestroy&&(this.configSave=void 0,Clear(this.nodesMap),this.nodesMap=void 0,super.destroy(t))}get isTree(){return!0}createTree(t){return Fg.CreateTree(this.scene,this.configSave,t)}isTreeObject(t){return t&&t instanceof Fg}}Fg.CreateTree=function(t,e,i){return new Fg(t,function(t,e){var i=t?Wg(t):{};if(!e)return i;for(var s in e)i[s]=e[s];return i}(e,i))};var Ig=function(t,e){var i=t.getTreesSizer();i&&i.emit(e,t)};Object.assign(Fg.prototype,wg);const Bg=Phaser.Utils.String.UUID;var Hg={addTree(t){return bt(t)&&(t={nodeBody:t,nodeKey:nodeKey}),this.insertTree(void 0,t)},insertTree(t,e){var i;"string"==typeof e?(i=e,e=void 0):e&&(i=e.nodeKey,delete e.nodeKey),void 0===i&&(i=Bg());var s=Fg.CreateTree(this.scene,this.treeConfig,e);return fg(this,s),s.nodeKey=i,this.treesMap[i]=s,this.insert(t,s,{expand:!0}),s._postAddCallback(),s}},Ng={removeTree(t,e){return"string"==typeof t&&(t=this.getTree(t)),t?(delete this.treesMap[t.nodeKey],t.nodeKey=null,this.remove(t,e),this):this},removeAllNodes(t){var e=this.treesMap;for(var i in e)this.removeTree(e[i],t);return this}},Gg={getTree(t){return this.treesMap[t]},getTrees(t){for(var e in void 0===t&&(t=[]),this.treesMap)t.push(this.treesMap[e]);return t},getNode(t){var e=t.indexOf(".");if(-1===e)return this.getTree(t);var i=this.getTree(t.substring(0,e));return i?i.getNode(t.substring(e+1)):void 0}},Vg={pointToChild:function(t,e,i,s){for(var r in this.treesMap){var n=this.treesMap[r];if(lr(n.nodeBody,t,e,i,s))return n;var a=n.pointToChild(t,e,i,s);if(a)return a}return null},setChildrenInteractive:function(t){return void 0===t&&(t={}),t.targetMode="parent",t.targetSizers=[this],qn(this,t),this}};Object.assign(Vg,Hg,Ng,Gg);const Ug=Phaser.Utils.Objects.GetValue;class $g extends Ta{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation="y"),super(t,e),this.type="rexTrees",this.treesMap={},this.treeConfig=Ug(e,"tree")}destroy(t){this.scene&&!this.ignoreDestroy&&(this.treeConfig=void 0,Clear(this.treesMap),this.treesMap=void 0,super.destroy(t))}}return Object.assign($g.prototype,Vg),$g},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextrees=e(); diff --git a/dist/rextweaker.js b/dist/rextweaker.js index 9ac23f4792..25b8efd277 100644 --- a/dist/rextweaker.js +++ b/dist/rextweaker.js @@ -27175,13 +27175,17 @@ clear() { // Reuse hitArea(rectangle) later for (var i = 0, cnt = this.hitAreas.length; i < cnt; i++) { - Clear(this.hitAreas[i].data); + this.hitAreas[i].data = null; } RectanglePool.pushMultiple(this.hitAreas); return this; } add(x, y, width, height, data) { + if (data === undefined) { + data = {}; + } + var rectangle = RectanglePool.pop(); if (rectangle === null) { rectangle = new Rectangle(x, y, width, height); @@ -27266,6 +27270,11 @@ var key = area.data.key; FireEvent$1.call(this, 'areadown', key, pointer, localX, localY, event); + // Removed by callback of previous event + if (!area.data) { + return; + } + area.data.isDown = true; }; @@ -27275,21 +27284,29 @@ return; } - var areaData = area.data; - - var key = areaData.key; + var key = area.data.key; FireEvent$1.call(this, 'areaup', key, pointer, localX, localY, event); - if (areaData.isDown) { + // Removed by callback of previous event + if (!area.data) { + return; + } + + if (area.data.isDown) { FireEvent$1.call(this, 'areaclick', key, pointer, localX, localY, event); - var url = areaData.url; + // Removed by callback of previous event + if (!area.data) { + return; + } + + var url = area.data.url; if (url) { window.open(url, '_blank'); } } - areaData.isDown = false; + area.data.isDown = false; }; var OnAreaOverOut = function (pointer, localX, localY, event) { @@ -27312,17 +27329,22 @@ FireEvent$1.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event); var prevHitArea = this.hitAreaManager.getByKey(this.lastHitAreaKey); - if (this.urlTagCursorStyle && !!prevHitArea.data.url) { - this.scene.input.manager.canvas.style.cursor = ''; - } - prevHitArea.isDown = false; + if (prevHitArea) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, prevHitArea, ''); + } + + prevHitArea.isDown = false; + } } if (key !== null) { FireEvent$1.call(this, 'areaover', key, pointer, localX, localY, event); - if (this.urlTagCursorStyle && !!area.data.url) { - this.scene.input.manager.canvas.style.cursor = this.urlTagCursorStyle; + if (area.data) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, area, this.urlTagCursorStyle); + } } } @@ -27334,6 +27356,14 @@ this.parent.emit(eventName, key, pointer, localX, localY, event); }; + var SetCursorStyle = function (scene, area, cursorStyle) { + if (!area || !area.data || !area.data.url) { + return; + } + + scene.input.manager.canvas.style.cursor = cursorStyle; + }; + const NO_NEWLINE$1 = CONST.NO_NEWLINE; const RAW_NEWLINE = CONST.RAW_NEWLINE; const WRAPPED_NEWLINE$1 = CONST.WRAPPED_NEWLINE; diff --git a/dist/rextweaker.min.js b/dist/rextweaker.min.js index ba4c6e07ad..347c7dd4b4 100644 --- a/dist/rextweaker.min.js +++ b/dist/rextweaker.min.js @@ -3,9 +3,9 @@ var t,e;t=void 0,e=function(){var t=!1,e=function(e){if(!t){void 0===e&&(e=60);v * @author Richard Davey * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const lu=Phaser.Display.Canvas.CanvasPool;var du=function(t){var e=lu.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return lu.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,lu.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,g=4*h,v=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Oh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Mh[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=uu(t,l,d);else{var u=cu(t,l,d);c&&(u=c(u)),this[h]=u}}var p=uu(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=uu(t,"fill",null);null!==g&&(this.color=co(g));var v=uu(t,"metrics",!1);return v?this.metrics={ascent:uu(v,"ascent",0),descent:uu(v,"descent",0),fontSize:uu(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=du(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=du(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=uu(t,"fontFamily","Courier"),this.fontSize=uu(t,"fontSize","16px"),this.fontStyle=uu(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=co(t,this.parent.canvas,this.parent.context),this.backgroundColor2=co(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=co(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=co(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=co(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=co(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=co(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Mh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=uu(e,"fontFamily",this.fontFamily),this.fontSize=uu(e,"fontSize",this.fontSize),this.fontStyle=uu(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var gu={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),So(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===g?Math.floor((m-o)/2):"bottom"===g?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-o*v)/2,0):"bottom"===g?Math.max(s-o*v-2,0):0,u+=e;for(var C=l;C0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const vu=Phaser.Utils.Objects.GetValue,fu=wh,mu=Sh;class yu{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vu(t,"text",""),this.x=vu(t,"x",0),this.y=vu(t,"y",0),this.width=vu(t,"width",0);var e=vu(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vu(t,"newLineMode",0),this.startIndex=vu(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===mu&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==fu&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===mu&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const bu=Phaser.Utils.Objects.GetFastValue,xu=wh,Cu=kh;class wu{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=bu(t,"tagToText",It),this.tagToTextScope=bu(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Su={};const ku=Phaser.Geom.Rectangle;var Ou=new El;class Pu{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&ju(v)){""!==b?a.push(n.getLine(b,x,Du)):0===C&&r>0&&a.push(n.getLine("",0,Du)),a.push(...Iu(v,e,Wu,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,Du)),b=v,x=f,o=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},Yu=function(t,e){var i;switch(e){case Bu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Fu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new wu({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return qp(this.sizerChildren,null),ba.call(this,t),this}},Qp={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,qp(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},sg={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ie.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,qp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)qp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},ng=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const ag=Phaser.Utils.Objects.IsPlainObject,hg=Phaser.Utils.Objects.GetValue;class og extends na{constructor(t,e,i,s,r,n,a,h,o,l){ag(e)?(e=hg(l=e,"x",0),i=hg(l,"y",0),s=hg(l,"width",void 0),r=hg(l,"height",void 0),n=hg(l,"column",l.col||0),a=hg(l,"row",0),h=hg(l,"columnProportions",0),o=hg(l,"rowProportions",0)):ag(s)?(s=hg(l=s,"width",void 0),r=hg(l,"height",void 0),n=hg(l,"column",l.col||0),a=hg(l,"row",0),h=hg(l,"columnProportions",0),o=hg(l,"rowProportions",0)):ag(n)?(n=hg(l=n,"column",l.col||0),a=hg(l,"row",0),h=hg(l,"columnProportions",0),o=hg(l,"rowProportions",0)):ag(h)&&(h=hg(l=h,"columnProportions",0),o=hg(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(hg(l,"createCellContainerCallback")),this.setIndentLeft(hg(l,"space.indentLeftOdd",0),hg(l,"space.indentLeftEven",0)),this.setIndentTop(hg(l,"space.indentTopOdd",0),hg(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,hg(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=rg.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=ng.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(og.prototype,sg);const lg=Phaser.Utils.Objects.GetValue,dg=Phaser.Math.Percent;var cg=function(t,e,i){var s;return t.y===e.y?s=dg(i.x,t.x,e.x):t.x===e.x&&(s=dg(i.y,t.y,e.y)),s},ug=function(t,e,i){var s,r;this.enable&&(pg.x=e,pg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=cg(s,r,pg))},pg={},gg=function(t,e,i){if(this.enable&&t.isDown){var s,r;vg.x=t.worldX,vg.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=cg(s,r,vg);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},vg={},fg=function(t,e){void 0===e&&(e=mg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return oe(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},mg={};const yg=Phaser.Display.Align.LEFT_CENTER,bg=Phaser.Display.Align.TOP_CENTER;var xg={};const Cg=Phaser.Display.Align.RIGHT_CENTER,wg=Phaser.Display.Align.BOTTOM_CENTER;var Sg={};const kg=Phaser.Math.Linear;var Og={};const Pg=Phaser.Display.Align.LEFT_CENTER,Tg=Phaser.Display.Align.TOP_CENTER,_g=Phaser.Display.Align.RIGHT_CENTER,Mg=Phaser.Display.Align.BOTTOM_CENTER,Eg=Phaser.Utils.Objects.GetValue,Rg=Phaser.Utils.Objects.IsPlainObject,Lg=Phaser.Math.Clamp,Dg=Phaser.Math.Snap.To;class Ag extends(Ad(La)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Eg(e,"reverseAxis",!1);var i=Eg(e,"background",void 0),s=Eg(e,"track",void 0),r=Eg(e,"indicator",void 0),n=Eg(e,"thumb",void 0);if(i&&(Rg(i)&&(i=Zc(t,i)),this.addBackground(i)),s&&(Rg(s)&&(s=Zc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Rg(r)&&(r=Zc(t,r)),this.pin(r)),n){Rg(n)&&(n=Zc(t,n)),this.pin(n);var a=Eg(e,"thumbOffsetX",0),h=Eg(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=Eg(e,"input",0);switch("string"==typeof o&&(o=Bg[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",ug,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",gg,this).on("pointermove",gg,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Eg(e,"enable",void 0));var l=Eg(e,"tick",void 0);void 0===l&&(l=Eg(e,"gap",void 0)),this.setGap(l),this.setValue(Eg(e,"value",0),Eg(e,"min",void 0),Eg(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Dg(t,this.gap));var e=this._value;this._value=Lg(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const Bg={pan:0,drag:0,click:1,none:-1};var Wg={getStartPoint:function(t){if(void 0===t&&(t=xg),this.childrenMap.thumb){var e=0===this.orientation?yg:bg;fg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerLeft+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerTop+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Sg),this.childrenMap.thumb){var e=0===this.orientation?Cg:wg;fg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Og),s.x=kg(e.x,i.x,t),s.y=kg(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?_g:Mg:0===this.orientation?Pg:Tg,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Ag.prototype,Wg);const zg=Phaser.Utils.Objects.GetValue;class Ig extends La{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=zg(e,"background",void 0),n=zg(e,"buttons",void 0),a=zg(n,"top",zg(n,"left",void 0)),h=zg(n,"bottom",zg(n,"right",void 0)),o=zg(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Br(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===zg(o,"width",void 0)?1:0:void 0===zg(o,"height",void 0)?1:0,i=new Ag(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Br(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=zg(e,"valuechangeCallback",null);if(null!==d){var c=zg(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(zg(e,"enable",void 0)),this.setValue(zg(e,"value",0)),this.setScrollStep(zg(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class Yg extends Bs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const jg=Phaser.Utils.Objects.GetValue,Xg=Phaser.Math.Distance.Between;class Fg extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=jg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(jg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(jg(t,"enable",!0)),this.holdThreshold=jg(t,"holdThreshold",50),this.pointerOutReleaseEnable=jg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Xg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Hg=Phaser.Utils.Objects.GetValue;class Vg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Hg(t,"value",0)),this.setSpeed(Hg(t,"speed",0)),this.setAcceleration(Hg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Gg{constructor(){this.value,this.dir,this.movement=new Vg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Kg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},Jg=Phaser.Utils.Objects.GetValue;class qg extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=Jg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(Jg(e,"speed",.1)),this.setEnable(Jg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(Jg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Zg=Phaser.Utils.Objects.GetValue;var Qg=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?Zg(s,l,void 0):Zg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Ig(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Zg(r,"tickLength",void 0);var p=Zg(r,"position",0);"string"==typeof p&&(p=tv[p]);var g,v,f=Zg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Zg(s,"space.slider",void 0))&&(h?f=0:g=Zg(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:Zg(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:Zg(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:Zg(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:Zg(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Zg(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Zg(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Zg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Zg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Zg(s,"scrollDetectionMode");"string"==typeof b&&(b=ev[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?Zg(s,x,!0):Zg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new $g(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,k,O,P=Zg(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new qg(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(h?(w=a?"t":"s",k=`scroll${i}`):(w="t",k="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(k,t)}))),y&&(h?(S=`childO${i}`,k=`scroll${i}`):(S="childOY",k="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(k,t)}))),C&&(O=h?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[O](-e,!0)})))};const tv={right:0,left:1,bottom:0,top:1},ev={gameObject:0,rectBounds:1},iv=Phaser.Utils.Objects.GetValue;var sv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=iv(e,"width"),a=iv(e,"height");n||iv(e,"child.expandWidth",!0)||(s[1]=0),a||iv(e,"child.expandHeight",!0)||(r[1]=0);var h=new og(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=lg(i,"child"),r=lg(s,"gameObject",void 0);if(r){var n=lg(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=lg(n,"top",0),a.bottom=lg(n,"bottom",0),h.left=lg(n,"left",0),h.right=lg(n,"right",0);break;case 1:a.top=lg(n,"left",0),a.bottom=lg(n,"right",0),h.top=lg(n,"top",0),h.bottom=lg(n,"bottom",0);break;default:a.top=lg(n,"top",0),a.bottom=lg(n,"bottom",0),a.left=lg(n,"left",0),a.right=lg(n,"right",0)}e.add(r,{column:1,row:1,align:lg(s,"align","center"),padding:h,expand:{width:lg(s,"expandWidth",!0),height:lg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:Qg(t,h,"y",e);break;case 1:Qg(t,h,"x",e);break;default:Qg(t,h,"y",e),Qg(t,h,"x",e)}return h},rv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},nv=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},av=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(uv.call(this,-this.textOY)),0),e=pv.call(this,t)+this.textOY,i=gv.call(this,t);return function(t,e){switch(mh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,vv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,mv.call(this,t,n,a),oe(t,s,r,n,a,e.align),e.preOffsetY=0,vv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const bv=Phaser.Utils.Objects.IsPlainObject,xv=Phaser.Utils.Objects.GetValue,Cv=Phaser.Display.Align.TOP_LEFT;class wv extends na{constructor(t,e,i,s,r,n){bv(e)?(e=xv(n=e,"x",0),i=xv(n,"y",0),s=xv(n,"width",void 0),r=xv(n,"height",void 0)):bv(s)&&(s=xv(n=s,"width",void 0),r=xv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=xv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(xv(n,"clampTextOY",!0)),this.alwaysScrollable=xv(n,"alwaysScrollable",!1);var a=xv(n,"background",void 0),h=xv(n,"text",void 0);void 0===h&&(h=Sv(t)),this.textCropEnable=xv(n,"textCrop",!!h.setCrop);var o=xv(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=Cv,l.padding=fe(0),l.expand=!0,this.textObject=h,this.textObjectType=mh(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=uh.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(uv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=pv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var Sv=function(t){return t.add.text(0,0,"")};Object.assign(wv.prototype,yv);var kv={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Ov={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Pv=Phaser.Utils.Objects.GetValue;class Tv extends dv{constructor(t,e){void 0===e&&(e={});var i=Pv(e,"text",void 0),s=Pv(e,"textWidth",void 0),r=Pv(e,"textHeight",void 0),n=Pv(e,"textCrop",!!i.setCrop),a=Pv(e,"textMask",!n),h=Pv(e,"content",""),o=new wv(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:Pv(e,"clampChildOY",!1),alwaysScrollable:Pv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Pv(e,"space",void 0);l&&(l.child=Pv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(Tv.prototype,kv,Ov);const _v=Phaser.Utils.Objects.GetValue;var Mv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Ip(t,e);break;case"bbcodetext":case"bbcode":s=new Ap(t,0,0,"",e);break;case"label":s=new Yp(t,e);break;case"textarea":s=function(t,e,i){e=e?$o(e):{};var s=_v(i,"background",Zc),r=_v(i,"text",Mv),n=_v(i,"track",Zc),a=_v(i,"thumb",Zc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new Tv(t,e);return t.add.existing(o),o}(t,e);break;default:s=new eu(t,e)}return qc(s,e),t.add.existing(s),s},Ev=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Kc(t,e):new Tc(t,e);break;case"roundRectangle":s=new bd(t,e);break;default:s=new Rc(t,e)}return qc(s,e),t.add.existing(s),s};const Rv=Phaser.Utils.Objects.GetValue;var Lv=function(t,e,i){e=e?$o(e):{};var s=Rv(i,"background",Zc),r=Rv(i,"text",Mv),n=Rv(i,"icon",Ev),a=Rv(i,"action",Ev);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};class Dv extends Gl{constructor(t,e){super(t,e=Lv(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?$o(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Av=Phaser.Math.Linear;var Bv=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),h=this.padding,o=this.width-h.right,l=0+h.left,d=this.height-h.bottom,c=0+h.top,u=(l+o)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:o,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:o,y:c}},2:{a:{x:o,y:c},b:{x:l,y:p},c:{x:o,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:o,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Av(b.a.x,x.a.x,C),e=Av(b.a.y,x.a.y,C),i=Av(b.b.x,x.b.x,C),s=Av(b.b.y,x.b.y,C),r=Av(b.c.x,x.c.x,C),n=Av(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Wv=(0,Phaser.Math.DegToRad)(120);var zv=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Wv),i+s*Math.sin(r+Wv)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Wv),i+s*Math.sin(r-Wv)),this.arrowOnly?t.end():t.close()},Iv={buildShapes(){this.addShape((new ac).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Bv.call(this):zv.call(this)}},Yv={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new gs(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const jv=Phaser.Utils.Objects.GetValue,Xv=Phaser.Utils.Objects.IsPlainObject,Fv=Phaser.Math.DegToRad,Hv=Phaser.Math.RadToDeg;class Vv extends Pd{constructor(t,e,i,s,r,n,a){var h,o,l,d,c,u,p,g;if(Xv(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,h=v.strokeColor,o=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==h&&void 0===l&&(l=2),this.setStrokeStyle(l,h,o),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Uv(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=jv(r,"x",null);null!==n?(t=n,i=n):(t=jv(r,"left",0),i=jv(r,"right",t));var a=jv(r,"y",null);null!==a?(e=a,s=a):(e=jv(r,"top",0),s=jv(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Hv(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Fv(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Gv={right:0,down:1,left:2,up:3};var Uv=function(t){return"string"==typeof t&&(t=Gv[t]),t%=4};Object.assign(Vv.prototype,Iv,Yv);class Nv extends Dv{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new Vv(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} + */const lu=Phaser.Display.Canvas.CanvasPool;var du=function(t){var e=lu.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return lu.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,lu.remove(e),a;var d,c,u=i.getImageData(0,0,h,l).data,p=u.length,g=4*h,v=0,f=!1;for(d=0;do;d--){for(c=0;c0&&this.wrapMode!==Oh&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Mh[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var o=a[h],l=o[0],d=i?o[1]:this[h],c=o[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=uu(t,l,d);else{var u=cu(t,l,d);c&&(u=c(u)),this[h]=u}}var p=uu(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=uu(t,"fill",null);null!==g&&(this.color=co(g));var v=uu(t,"metrics",!1);return v?this.metrics={ascent:uu(v,"ascent",0),descent:uu(v,"descent",0),fontSize:uu(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=du(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=du(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=uu(t,"fontFamily","Courier"),this.fontSize=uu(t,"fontSize","16px"),this.fontStyle=uu(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=co(t,this.parent.canvas,this.parent.context),this.backgroundColor2=co(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=co(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=co(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=co(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=co(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=co(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=co(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Mh[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=uu(e,"fontFamily",this.fontFamily),this.fontSize=uu(e,"fontSize",this.fontSize),this.fontStyle=uu(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}var gu={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),So(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var h,o,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(o=y,l="center"===g?Math.floor((m-o)/2):"bottom"===g?m-o:0):(o=m,l=0),d=l+o;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-o*v)/2,0):"bottom"===g?Math.max(s-o*v-2,0):0,u+=e;for(var C=l;C0){var h=this.defaultStyle.metrics,o=i-h.ascent,l=h.fontSize;this.drawRectangle(e,o,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const vu=Phaser.Utils.Objects.GetValue,fu=wh,mu=Sh;class yu{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=vu(t,"text",""),this.x=vu(t,"x",0),this.y=vu(t,"y",0),this.width=vu(t,"width",0);var e=vu(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=vu(t,"newLineMode",0),this.startIndex=vu(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===mu&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==fu&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===mu&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}const bu=Phaser.Utils.Objects.GetFastValue,xu=wh,Cu=kh;class wu{constructor(t){this.pens=[],this.lines=[],this.maxLinesWidth=void 0,this.pensPool=t.pensPool,this.linesPool=t.linesPool,this.tagToText=bu(t,"tagToText",It),this.tagToTextScope=bu(t,"tagToTextScope",void 0)}destroy(){this.clear(),this.tagToText=void 0,this.tagToTextScope=void 0}clear(){for(var t=0,e=this.lines.length;t=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(o>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Su={};const ku=Phaser.Geom.Rectangle;var Ou=new El;class Pu{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&Xu(v)){""!==b?a.push(n.getLine(b,x,Au)):0===C&&r>0&&a.push(n.getLine("",0,Au)),a.push(...Yu(v,e,zu,s,0,n));var S=a.pop();b=S.text,x=S.width,n.freeLine(S)," "===b&&(b="",x=0)}else(m=x+f)>o?(a.push(n.getLine(b,x,Au)),b=v,x=f,o=s):(b+=v,x=m),C===w-1&&a.push(n.getLine(b,x,l))}return a},ju=function(t,e){var i;switch(e){case Wu:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==Hu&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new wu({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return Zp(this.sizerChildren,null),ba.call(this,t),this}},tg={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,Zp(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},rg={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,h=this.sizerChildren,o=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Ie.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,Zp(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)Zp(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},ag=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const hg=Phaser.Utils.Objects.IsPlainObject,og=Phaser.Utils.Objects.GetValue;class lg extends na{constructor(t,e,i,s,r,n,a,h,o,l){hg(e)?(e=og(l=e,"x",0),i=og(l,"y",0),s=og(l,"width",void 0),r=og(l,"height",void 0),n=og(l,"column",l.col||0),a=og(l,"row",0),h=og(l,"columnProportions",0),o=og(l,"rowProportions",0)):hg(s)?(s=og(l=s,"width",void 0),r=og(l,"height",void 0),n=og(l,"column",l.col||0),a=og(l,"row",0),h=og(l,"columnProportions",0),o=og(l,"rowProportions",0)):hg(n)?(n=og(l=n,"column",l.col||0),a=og(l,"row",0),h=og(l,"columnProportions",0),o=og(l,"rowProportions",0)):hg(h)&&(h=og(l=h,"columnProportions",0),o=og(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(og(l,"createCellContainerCallback")),this.setIndentLeft(og(l,"space.indentLeftOdd",0),og(l,"space.indentLeftEven",0)),this.setIndentTop(og(l,"space.indentTopOdd",0),og(l,"space.indentTopEven",0)),this.resetGrid(n,a,h,o,og(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=ng.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=ag.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(lg.prototype,rg);const dg=Phaser.Utils.Objects.GetValue,cg=Phaser.Math.Percent;var ug=function(t,e,i){var s;return t.y===e.y?s=cg(i.x,t.x,e.x):t.x===e.x&&(s=cg(i.y,t.y,e.y)),s},pg=function(t,e,i){var s,r;this.enable&&(gg.x=e,gg.y=i,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint()),this.value=ug(s,r,gg))},gg={},vg=function(t,e,i){if(this.enable&&t.isDown){var s,r;fg.x=t.worldX,fg.y=t.worldY,this.reverseAxis?(s=this.getEndPoint(),r=this.getStartPoint()):(s=this.getStartPoint(),r=this.getEndPoint());var n=ug(s,r,fg);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-n)<.1?this.value=n:this.easeValueTo(n)}},fg={},mg=function(t,e){void 0===e&&(e=yg);var i=this.childrenMap.thumb,s=i.x,r=i.y;return oe(i,this.innerLeft,this.innerTop,this.innerWidth,this.innerHeight,t),e.x=i.x,e.y=i.y,i.x=s,i.y=r,e},yg={};const bg=Phaser.Display.Align.LEFT_CENTER,xg=Phaser.Display.Align.TOP_CENTER;var Cg={};const wg=Phaser.Display.Align.RIGHT_CENTER,Sg=Phaser.Display.Align.BOTTOM_CENTER;var kg={};const Og=Phaser.Math.Linear;var Pg={};const Tg=Phaser.Display.Align.LEFT_CENTER,_g=Phaser.Display.Align.TOP_CENTER,Mg=Phaser.Display.Align.RIGHT_CENTER,Eg=Phaser.Display.Align.BOTTOM_CENTER,Rg=Phaser.Utils.Objects.GetValue,Lg=Phaser.Utils.Objects.IsPlainObject,Dg=Phaser.Math.Clamp,Ag=Phaser.Math.Snap.To;class Bg extends(Ad(La)){constructor(t,e){super(t,e),this.type="rexSlider",this.bootProgressBase(e),this.reverseAxis=Rg(e,"reverseAxis",!1);var i=Rg(e,"background",void 0),s=Rg(e,"track",void 0),r=Rg(e,"indicator",void 0),n=Rg(e,"thumb",void 0);if(i&&(Lg(i)&&(i=Zc(t,i)),this.addBackground(i)),s&&(Lg(s)&&(s=Zc(t,s)),this.add(s,{proportion:1,expand:!0,minWidth:0===this.orientation?0:void 0,minHeight:1===this.orientation?0:void 0})),r&&(Lg(r)&&(r=Zc(t,r)),this.pin(r)),n){Lg(n)&&(n=Zc(t,n)),this.pin(n);var a=Rg(e,"thumbOffsetX",0),h=Rg(e,"thumbOffsetY",0);this.setThumbOffset(a,h)}var o=Rg(e,"input",0);switch("string"==typeof o&&(o=Wg[o]),o){case 0:n&&(n.setInteractive(),this.scene.input.setDraggable(n),n.on("drag",pg,this).on("dragstart",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("dragend",(function(t){this.eventEmitter.emit("inputend",t)}),this));break;case 1:this.on("pointerdown",vg,this).on("pointermove",vg,this).on("pointerdown",(function(t){this.eventEmitter.emit("inputstart",t)}),this).on("pointerup",(function(t){this.eventEmitter.emit("inputend",t)}),this).on("pointerover",(function(t){t.isDown&&this.eventEmitter.emit("inputstart",t)}),this).on("pointerout",(function(t){t.isDown&&this.eventEmitter.emit("inputend",t)}),this).setInteractive()}this.addChildrenMap("background",i),this.addChildrenMap("track",s),this.addChildrenMap("indicator",r),this.addChildrenMap("thumb",n),this.setEnable(Rg(e,"enable",void 0));var l=Rg(e,"tick",void 0);void 0===l&&(l=Rg(e,"gap",void 0)),this.setGap(l),this.setValue(Rg(e,"value",0),Rg(e,"min",void 0),Rg(e,"max",void 0))}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t,e,i){return t&&void 0!==e&&(t/=i-e),this.gap=t,this}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){return this.gap}set tick(t){this.gap=t}setThumbOffset(t,e){return this.thumbOffsetX=t,this.thumbOffsetY=e,this}get value(){return this._value}set value(t){void 0!==this.gap&&(t=Ag(t,this.gap));var e=this._value;this._value=Dg(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}postLayout(t,e,i){return this.updateThumb(),this.updateIndicator(),super.postLayout(t,e,i),this}}const Wg={pan:0,drag:0,click:1,none:-1};var zg={getStartPoint:function(t){if(void 0===t&&(t=Cg),this.childrenMap.thumb){var e=0===this.orientation?bg:xg;mg.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=kg),this.childrenMap.thumb){var e=0===this.orientation?wg:Sg;mg.call(this,e,t)}else 0===this.orientation?(t.x=this.innerRight-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.innerBottom-1);return t},updateThumb:function(t){var e,i,s=this.childrenMap.thumb;return void 0===s||(void 0===t&&(t=this.value),this.reverseAxis?(e=this.getEndPoint(),i=this.getStartPoint()):(e=this.getStartPoint(),i=this.getEndPoint()),function(t,e,i,s){void 0===s&&(s=Pg),s.x=Og(e.x,i.x,t),s.y=Og(e.y,i.y,t)}(t,e,i,s),s.x+=this.thumbOffsetX,s.y+=this.thumbOffsetY,this.resetChildPositionState(s)),this},updateIndicator:function(t){var e=this.childrenMap.indicator;if(void 0===e)return this;void 0===t&&(t=this.value);var i,s,r,n=this.reverseAxis,a=this.childrenMap.thumb;if(a)if(0===this.orientation){var h,o=Q(a);if(n)h=a.x-o*a.originX,i=this.right-h;else i=(h=a.x-o*a.originX)+o-this.left}else{var l,d=tt(a);if(n)l=a.y-d*a.originY,s=this.bottom-l;else s=(l=a.y-d*a.originY)+d-this.top}else 0===this.orientation?i=this.width*t:s=this.height*t;Ge(e,i,s),r=n?0===this.orientation?Mg:Eg:0===this.orientation?Tg:_g,he(e,this,r),this.resetChildPositionState(e)}};Object.assign(Bg.prototype,zg);const Ig=Phaser.Utils.Objects.GetValue;class Yg extends La{constructor(t,e){super(t,e),this.type="rexScrollBar";var i,s,r=Ig(e,"background",void 0),n=Ig(e,"buttons",void 0),a=Ig(n,"top",Ig(n,"left",void 0)),h=Ig(n,"bottom",Ig(n,"right",void 0)),o=Ig(e,"slider",void 0);(r&&this.addBackground(r),a&&(this.add(a),new Br(a).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?this.scrollStep:-this.scrollStep;this.value+=t}}),this)),o)&&(o.orientation=this.orientation,o.eventEmitter=this,o.value=null,s=0===this.orientation?void 0===Ig(o,"width",void 0)?1:0:void 0===Ig(o,"height",void 0)?1:0,i=new Bg(t,o),t.add.existing(i),this.add(i,{proportion:s}));h&&(this.add(h),new Br(h).on("intouch",(function(){if(this.enable){var t=i.reverseAxis?-this.scrollStep:this.scrollStep;this.value+=t}}),this));var l=[a,h];this.addChildrenMap("background",r),this.addChildrenMap("slider",i),this.addChildrenMap("buttons",l);var d=Ig(e,"valuechangeCallback",null);if(null!==d){var c=Ig(e,"valuechangeCallbackScope",void 0);this.on("valuechange",d,c)}this.setEnable(Ig(e,"enable",void 0)),this.setValue(Ig(e,"value",0)),this.setScrollStep(Ig(n,"step",.01))}setScrollStep(t){return this.scrollStep=t,this}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}setGap(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setGap(t,e,i),this}get gap(){if(this.childrenMap.slider)return this.childrenMap.slider.gap}set gap(t){this.childrenMap.slider&&(this.childrenMap.slider.gap=t)}setTick(t,e,i){return this.setGap(t,e,i),this}get tick(){if(this.childrenMap.slider)return this.childrenMap.slider.tick}set tick(t){this.childrenMap.slider&&(this.childrenMap.slider.tick=t)}}class jg extends Bs{constructor(t,e){super(e),this.parent=t,this.init()}init(){this.start("IDLE")}next_IDLE(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}update_IDLE(t,e){this.next()}next_DRAGBEGIN(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const Xg=Phaser.Utils.Objects.GetValue,Fg=Phaser.Math.Distance.Between;class Hg extends si{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=Xg(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(Xg(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(Xg(t,"enable",!0)),this.holdThreshold=Xg(t,"holdThreshold",50),this.pointerOutReleaseEnable=Xg(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return vn(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:Fg(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!ur(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!ur(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const Vg=Phaser.Utils.Objects.GetValue;class Gg{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(Vg(t,"value",0)),this.setSpeed(Vg(t,"speed",0)),this.setAcceleration(Vg(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class Ug{constructor(){this.value,this.dir,this.movement=new Gg}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const Jg={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},qg=Phaser.Utils.Objects.GetValue;class Zg extends si{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=qg(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(qg(e,"speed",.1)),this.setEnable(qg(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(qg(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||ur(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const Qg=Phaser.Utils.Objects.GetValue;var tv=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),h=2===t.scrollMode,o=t.childrenMap.child,l=`slider${i}`;if(r=h||s.hasOwnProperty(l)?Qg(s,l,void 0):Qg(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=yt(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new Yg(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=Qg(r,"tickLength",void 0);var p=Qg(r,"position",0);"string"==typeof p&&(p=ev[p]);var g,v,f=Qg(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=Qg(s,"space.slider",void 0))&&(h?f=0:g=Qg(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:Qg(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:Qg(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:Qg(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:Qg(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=Qg(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=Qg(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=Qg(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=Qg(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=Qg(s,"scrollDetectionMode");"string"==typeof b&&(b=iv[b]);var x=`scroller${i}`;(m=h||s.hasOwnProperty(x)?Qg(s,x,!0):Qg(s,"scroller",!0))&&o&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new Kg(o,m),o.isRexContainerLite&&o.sendChildToBack(o));var C,w,S,k,O,P=Qg(s,h?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);P&&o&&(void 0!==b&&(P.focus=1===b?2:0),C=new Zg(o,P)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),h&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(h?(w=a?"t":"s",k=`scroll${i}`):(w="t",k="scroll"),n.on("valuechange",(function(e){t[w]=e,t.emit(k,t)}))),y&&(h?(S=`childO${i}`,k=`scroll${i}`):(S="childOY",k="scroll"),y.on("valuechange",(function(e){t[S]=e,t.emit(k,t)}))),C&&(O=h?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[O](-e,!0)})))};const ev={right:0,left:1,bottom:0,top:1},iv={gameObject:0,rectBounds:1},sv=Phaser.Utils.Objects.GetValue;var rv=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=sv(e,"width"),a=sv(e,"height");n||sv(e,"child.expandWidth",!0)||(s[1]=0),a||sv(e,"child.expandHeight",!0)||(r[1]=0);var h=new lg(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=dg(i,"child"),r=dg(s,"gameObject",void 0);if(r){var n=dg(i,"space.child",0);t.childMargin={};var a=t.childMargin,h={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=dg(n,"top",0),a.bottom=dg(n,"bottom",0),h.left=dg(n,"left",0),h.right=dg(n,"right",0);break;case 1:a.top=dg(n,"left",0),a.bottom=dg(n,"right",0),h.top=dg(n,"top",0),h.bottom=dg(n,"bottom",0);break;default:a.top=dg(n,"top",0),a.bottom=dg(n,"bottom",0),a.left=dg(n,"left",0),a.right=dg(n,"right",0)}e.add(r,{column:1,row:1,align:dg(s,"align","center"),padding:h,expand:{width:dg(s,"expandWidth",!0),height:dg(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,h,e),t.scrollMode){case 0:tv(t,h,"y",e);break;case 1:tv(t,h,"x",e);break;default:tv(t,h,"y",e),tv(t,h,"x",e)}return h},nv=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},av=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},hv=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(h=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=h.childrenMap.track,s=h.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i}(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(pv.call(this,-this.textOY)),0),e=gv.call(this,t)+this.textOY,i=vv.call(this,t);return function(t,e){switch(mh(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}}(this.textObject,i),this.textObject.rexSizer.offsetY=e,fv.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,Fe.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,h=this.left,o=this.top;(t=this.textObject).rexSizer.hidden||(s=h+(i=(e=t.rexSizer).padding).left*this.scaleX,r=o+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,yv.call(this,t,n,a),oe(t,s,r,n,a,e.align),e.preOffsetY=0,fv.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const xv=Phaser.Utils.Objects.IsPlainObject,Cv=Phaser.Utils.Objects.GetValue,wv=Phaser.Display.Align.TOP_LEFT;class Sv extends na{constructor(t,e,i,s,r,n){xv(e)?(e=Cv(n=e,"x",0),i=Cv(n,"y",0),s=Cv(n,"width",void 0),r=Cv(n,"height",void 0)):xv(s)&&(s=Cv(n=s,"width",void 0),r=Cv(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=Cv(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(Cv(n,"clampTextOY",!0)),this.alwaysScrollable=Cv(n,"alwaysScrollable",!1);var a=Cv(n,"background",void 0),h=Cv(n,"text",void 0);void 0===h&&(h=kv(t)),this.textCropEnable=Cv(n,"textCrop",!!h.setCrop);var o=Cv(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(h),this.sizerChildren=[h];var l=this.getSizerConfig(h);l.align=wv,l.padding=fe(0),l.expand=!0,this.textObject=h,this.textObjectType=mh(h),l.preOffsetY=0,l.offsetY=0,o&&(this.textMask=uh.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",h)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(pv.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=gv.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var kv=function(t){return t.add.text(0,0,"")};Object.assign(Sv.prototype,bv);var Ov={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},Pv={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Tv=Phaser.Utils.Objects.GetValue;class _v extends cv{constructor(t,e){void 0===e&&(e={});var i=Tv(e,"text",void 0),s=Tv(e,"textWidth",void 0),r=Tv(e,"textHeight",void 0),n=Tv(e,"textCrop",!!i.setCrop),a=Tv(e,"textMask",!n),h=Tv(e,"content",""),o=new Sv(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:h,clampTextOY:Tv(e,"clampChildOY",!1),alwaysScrollable:Tv(e,"alwaysScrollable",!1)});t.add.existing(o),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(o),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:o,expandWidth:void 0===s,expandHeight:void 0===r};var l=Tv(e,"space",void 0);l&&(l.child=Tv(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(_v.prototype,Ov,Pv);const Mv=Phaser.Utils.Objects.GetValue;var Ev=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new Yp(t,e);break;case"bbcodetext":case"bbcode":s=new Bp(t,0,0,"",e);break;case"label":s=new jp(t,e);break;case"textarea":s=function(t,e,i){e=e?$o(e):{};var s=Mv(i,"background",Zc),r=Mv(i,"text",Ev),n=Mv(i,"track",Zc),a=Mv(i,"thumb",Zc);s?e.background=s(t,e.background):delete e.background,r?e.text=r(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),n?h.track=n(t,h.track):delete h.track,a?h.thumb=a(t,h.thumb):delete h.thumb,e.slider=h);var o=new _v(t,e);return t.add.existing(o),o}(t,e);break;default:s=new eu(t,e)}return qc(s,e),t.add.existing(s),s},Rv=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new Kc(t,e):new Tc(t,e);break;case"roundRectangle":s=new bd(t,e);break;default:s=new Rc(t,e)}return qc(s,e),t.add.existing(s),s};const Lv=Phaser.Utils.Objects.GetValue;var Dv=function(t,e,i){e=e?$o(e):{};var s=Lv(i,"background",Zc),r=Lv(i,"text",Ev),n=Lv(i,"icon",Rv),a=Lv(i,"action",Rv);return null!==e.background&&s?e.background=s(t,e.background):delete e.background,null!==e.text&&r?e.text=r(t,e.text):delete e.text,null!==e.icon&&n?e.icon=n(t,e.icon):delete e.icon,null!==e.action&&a?e.action=a(t,e.action):delete e.action,e};class Av extends Gl{constructor(t,e){super(t,e=Dv(t,e)),this.type="rexTweaker.Title"}setTitle(t){return(t=t?$o(t):{}).hasOwnProperty("text")||(t.hasOwnProperty("title")?t.text=t.title:t.text=""),this.resetDisplayContent(t),this}}Phaser.Math.Wrap;const Bv=Phaser.Math.Linear;var Wv=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),h=this.padding,o=this.width-h.right,l=0+h.left,d=this.height-h.bottom,c=0+h.top,u=(l+o)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:o,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:o,y:c}},2:{a:{x:o,y:c},b:{x:l,y:p},c:{x:o,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:o,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Bv(b.a.x,x.a.x,C),e=Bv(b.a.y,x.a.y,C),i=Bv(b.b.x,x.b.x,C),s=Bv(b.b.y,x.b.y,C),r=Bv(b.c.x,x.c.x,C),n=Bv(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const zv=(0,Phaser.Math.DegToRad)(120);var Iv=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+zv),i+s*Math.sin(r+zv)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-zv),i+s*Math.sin(r-zv)),this.arrowOnly?t.end():t.close()},Yv={buildShapes(){this.addShape((new ac).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Wv.call(this):Iv.call(this)}},jv={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new gs(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Xv=Phaser.Utils.Objects.GetValue,Fv=Phaser.Utils.Objects.IsPlainObject,Hv=Phaser.Math.DegToRad,Vv=Phaser.Math.RadToDeg;class Gv extends Pd{constructor(t,e,i,s,r,n,a){var h,o,l,d,c,u,p,g;if(Fv(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,h=v.strokeColor,o=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==h&&void 0===l&&(l=2),this.setStrokeStyle(l,h,o),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Nv(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Xv(r,"x",null);null!==n?(t=n,i=n):(t=Xv(r,"left",0),i=Xv(r,"right",t));var a=Xv(r,"y",null);null!==a?(e=a,s=a):(e=Xv(r,"top",0),s=Xv(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Vv(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Hv(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Uv={right:0,down:1,left:2,up:3};var Nv=function(t){return"string"==typeof t&&(t=Uv[t]),t%=4};Object.assign(Gv.prototype,Yv,jv);class $v extends Av{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexTweaker.FolderTitle";var i=new Gv(t,e.expandedIcon);t.add.existing(i),this.addSpace().add(i,{proportion:0,expand:!1,padding:1,fitRatio:1}),this.addChildrenMap("expandedIcon",i)}setExpandedState(t){void 0===t&&(t=!0);var e=t?"down":"right";return this.childrenMap.expandedIcon.setDirection(e),this}} /** * @author Richard Davey * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var $v=function(t,e){var i=yt(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},Kv=function(t,e,i){return Zc(t,$v(e,i))};class Jv extends Hs{constructor(t,e){void 0===e&&(e={}),e.destroy=!1,super(t,e)}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var qv={expand(t){if(!0===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!0;var e=this.childrenMap.title,i=this.childrenMap.child;return this.show(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),e.emit("folder.expand",t,this),i.emit("folder.expand",t,this),this.emit("expand.start",this),this.childTransition.once("open",(function(){this.emit("expand.complete",this)}),this).requestOpen(null,t),this},collapse(t){if(!1===this.expanded)return this;void 0===t&&(t=this.transitionDuration),this.expanded=!1;var e=this.childrenMap.title,i=this.childrenMap.child;return e.emit("folder.collapse",t,this),i.emit("folder.collapse",t,this),this.emit("collapse.start",this),this.childTransition.once("close",(function(){this.setChildScale(i,1,1).hide(i),this.reLayoutEnable&&(this.reLayoutTarget?this.reLayoutTarget:this.getTopmostSizer()).layout(),this.emit("collapse.complete",this)}),this).requestClose(null,t),this},toggle(t){return this.expanded?this.collapse(t):this.expand(t),this},setExpandedState(t){return this.reLayoutEnable=!1,void 0===t?this.expanded=void 0:t?this.expand(0):this.collapse(0),this.reLayoutEnable=!0,this}},Zv=function(t,e){zi.popUp.call(t,e,this.expandDirection)},Qv=function(t,e){zi.scaleDown.call(t,e,this.expandDirection)},tf={setTransitionDuration(t){return this.transitionDuration=t,this.childTransition.setTransitInTime(t).setTransitOutTime(t),this},setExpandCallback(t){return void 0===t&&(t=Zv.bind(this)),this.childTransition.setTransitInCallback(t),this},setCollapseCallback(t){return void 0===t&&(t=Qv.bind(this)),this.childTransition.setTransitOutCallback(t),this}};const ef=Phaser.Utils.Objects.GetValue;let sf=class extends La{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("orientation")||(e.orientation=1),super(t,e),this.type="rexFolder",this.reLayoutEnable=!0,this.expanded=void 0,this.expandDirection=1===this.orientation?"y":"x";var i=e.background,s=e.title,r=e.child;i&&this.addBackground(i);var n=ef(e,"space"),a=1===this.orientation?"left":"top",h=ef(e,"align.title",a),o=ef(e,"expand.title",!0);this.add(s,{proportion:0,align:h,expand:o,padding:{left:ef(n,"titleLeft",0),right:ef(n,"titleRight",0),top:ef(n,"titleTop",0),bottom:ef(n,"titleBottom",0)}});var l=ef(e,"toggleByTarget",void 0),d=ef(e,"toggleClickConfig");if(void 0===l&&(l=s),l&&Or.onClick.call(l,(function(){this.toggle()}),this,d),this.childTransition=new Jv(r),!ef(e,"customChildOrigin",!1)){var c=this.rtl?1:0;r.setOrigin(c)}h=ef(e,"align.child","left");var u=(o=ef(e,"expand.child",!0))?1:0;this.add(r,{proportion:u,align:h,expand:o,padding:{left:ef(n,"childLeft",0),right:ef(n,"childRight",0),top:ef(n,"childTop",0),bottom:ef(n,"childBottom",0)}}),this.addChildrenMap("title",s),this.addChildrenMap("child",r),this.addChildrenMap("background",i);var p=e.transition;this.setTransitionDuration(ef(p,"duration",200)),this.setExpandCallback(ef(p,"expandCallback",void 0)),this.setCollapseCallback(ef(p,"collapseCallback",void 0)),this.reLayoutTarget=ef(e,"reLayoutTarget",void 0);var g=e.onExpandStart;g&&this.on("expand.start",g);var v=e.onExpandComplete;v&&this.on("expand.complete",v);var f=e.onCollapseStart;f&&this.on("collapse.start",f);var m=e.onCollapseComplete;m&&this.on("collapse.complete",m);var y=ef(e,"expanded",void 0);void 0!==y&&this.setExpandedState(y)}};Object.assign(sf.prototype,qv,tf);var rf={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},nf={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class af extends sf{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(af.prototype,rf,nf);const hf=Phaser.Utils.Objects.GetValue,of=Phaser.Utils.Objects.GetValue,lf=La.prototype.add,df=La.prototype.addSpace;var cf=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)&&df.call(this),lf.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&df.call(this),this.hasTailSpace=s}else lf.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;lf.call(this,t,{index:r,proportion:i,expand:!0})}else lf.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},uf={addButton(t){if(pr(t))for(var e=t,i=0,s=e.length;i=0;i--)vf.call(this,e[i],t);return this}},mf=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},yf=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,mf.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},bf={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),yf.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&Rf.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)Wf.call(this,e[i],t);return this}};const If=Phaser.Utils.Objects.GetValue;class Yf extends Ka{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Pf({parent:this,eventEmitter:If(e,"eventEmitter",this),groupName:If(e,"groupName",void 0),clickConfig:If(e,"click",void 0)}).setButtonsType(e);var s=If(e,"background",void 0),r=If(e,"buttons",void 0);this.buttonsAlign=If(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(Yf.prototype,Df,zf,Of,_f);var jf=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Xf[i])}void 0===s?s={}:!0===s&&(s=Ff);var n=e.width/t.width,a=e.height/t.height,h=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*h,s.height=t.height*h,s};const Xf={fit:0,FIT:0,envelop:1,ENVELOP:1};var Ff={},Hf={},Vf={};const Gf=Phaser.Utils.Objects.IsPlainObject,Uf=Phaser.Utils.Objects.GetValue,Nf=Phaser.Display.Align.CENTER,$f=Phaser.Utils.String.UUID;var Kf={add:function(t,e,i,s,r,n,a,h,o,l){var d,c;ye.call(this,t),Gf(e)&&(e=Uf(u=e,"key",void 0),i=Uf(u,"align",Nf),s=Uf(u,"padding",0),r=Uf(u,"expand",!0),t.isRexSizer||(n=Uf(u,"minWidth",t._minWidth),a=Uf(u,"minHeight",t._minHeighted)),h=Uf(u,"offsetX",0),o=Uf(u,"offsetY",0),d=Uf(u,"offsetOriginX",0),c=Uf(u,"offsetOriginY",0),l=Uf(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=$f()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=Nf),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===h&&(h=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=fe(s),Gf(r)?(u.expandWidth=Uf(r,"width",!1),u.expandHeight=Uf(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),u.alignOffsetX=h,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},Jf={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ba.call(this,t),this}},qf={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,h,o,l,d,c,u=this.innerLeft,p=this.innerTop,g=this.innerWidth,v=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,yr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Hf.width=e.aspectRatio,Hf.height=1,Vf.width=l,Vf.height=d,l=(c=jf(Hf,Vf,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),aa(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,br.call(this,t,s,r,n,a,e.align,h,o))}};Object.assign(qf,Kf,Jf);const Zf=Phaser.Utils.Objects.IsPlainObject,Qf=Phaser.Utils.Objects.GetValue;class tm extends na{constructor(t,e,i,s,r,n){Zf(e)?(e=Qf(n=e,"x",0),i=Qf(n,"y",0),s=Qf(n,"width",void 0),r=Qf(n,"height",void 0)):Zf(s)&&(s=Qf(n=s,"width",void 0),r=Qf(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(tm.prototype,qf);const em=tm.prototype.add;var im=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),em.call(this,t,e,i,s,r,n,a,h,o),this},sm={add:im,addPage:im};const rm=Et.prototype.setChildVisible;var nm={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(rm.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(rm.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(nm,sm);const am=Phaser.Utils.Objects.GetValue;class hm extends tm{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(am(e,"swapMode",0)),this.setFadeInDuration(am(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=om[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(hm.prototype,nm);const om={invisible:0,destroy:1},lm=Phaser.Utils.Objects.IsPlainObject,dm=Phaser.Utils.Objects.GetValue,cm=Phaser.Utils.String.UUID;var um={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},pm={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},gm={top:1,left:3,right:5,bottom:7},vm={top:"bottom",left:"right",right:"left",bottom:"top"},fm={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},mm={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Bm=Phaser.Utils.Objects.GetValue;class Wm extends La{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Bm(e,"background",void 0),s=Bm(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Bm(e,"space.title",0)}});var r=Bm(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(Wm.prototype,Dm,Am);const zm=Phaser.Utils.Objects.GetValue,Im=Phaser.Utils.Objects.GetValue;var Ym=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const jm=Phaser.Geom.Intersects.RectangleToRectangle,Xm=Phaser.Geom.Rectangle.Overlaps;var Fm=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Hm=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},Vm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Gm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Um=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Nm=Phaser.Utils.Objects.GetValue,$m={update:0,everyTick:1};var Km={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(Nm(t,"updateMode",0)),this.enableChildrenMask(Nm(t,"padding",0)),this.setMaskLayer(Nm(t,"layer",void 0)),this.onMaskGameObjectVisible=Nm(t,"onVisible"),this.onMaskGameObjectInvisible=Nm(t,"onInvisible"),this.maskGameObjectCallbackScope=Nm(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=$m[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=uh.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,h,o,l=!!s||!!r,d=t.getBounds(),c=Ym(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(ty.prototype,Jm);const ey=["top","bottom","centerY","center"],iy=["left","right","centerX","center"];var sy=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=ey.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=iy.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const ry=Phaser.Utils.Objects.GetValue;class ny extends dv{constructor(t,e){void 0===e&&(e={});var i=Fp(e),s=ry(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ry(e,"clampChildOY",!1),s.clampChildOX=ry(e,"clampChildOX",!1);var r,n,a=new ty(t,s);switch(t.add.existing(a),i){case 0:r=ry(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ry(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:ry(e,"align.panel","center")};var h=ry(e,"space",void 0);h&&(h.child=ry(h,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ia(this.childrenMap.child,t),this}}var ay={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:sy.call(this,t,"y",e);break;case 1:sy.call(this,t,"x",e);break;default:sy.call(this,t,"y",e),sy.call(this,t,"x",e)}return this}};Object.assign(ny.prototype,ay);var hy={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},oy={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class ly extends ny{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(ly.prototype,hy,oy);const dy=Phaser.Utils.Objects.GetValue,cy=Phaser.Utils.Objects.GetValue,uy=Phaser.Utils.Objects.GetValue;var py={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=uy(t,"onGetValue"),this.onSetValue=uy(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},gy={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},vy={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const fy=Phaser.Utils.Objects.GetValue;class my extends La{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=fy(e,"proportion.title",0),h=fy(e,"space.title",0);i=0===this.orientation?{right:h}:{bottom:h},this.add(s,{proportion:a,expand:!0,padding:i});var o=r.defaultProportion;void 0===o&&(o=e.defaultExpandWidth?1:0),a=fy(e,"proportion.inputField",o),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(my.prototype,py,gy,vy);var yy=function(t,e,i){var s=new Dv(t,i);return t.add.existing(s),s},by=function(t){return void 0===t&&(t=La),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},xy=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=Py(this.styles,"inputRow")||{},r=Oy(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Zc(t,$v(e,i))}(this.scene,t,Ty(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),_y(this,$o(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,h=t.drawY,o=a+t.drawTLX,l=a+t.drawTRX,d=h+t.drawTLY,c=h+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(qy(this),Zy(this)),this}setNumberInput(){return this.onUpdateCallback=Jy,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const eb=Phaser.Utils.Objects.GetValue,ib=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var sb=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(h,h+a.count));h+=a.count,a.added||(o+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}cb.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,h=t.length,o=1,l=a+h;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=h)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=h)return n(ub(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,h=a-s,o=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const pb=new cb,gb=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,vb=/\S/,fb=new cb;fb.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!vb.test(t)&&!vb.test(e)},fb.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(xb(t,null,null,i),i," ")},bb.equals=function(t,e){return cb.prototype.equals.call(bb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Cb=new cb;Cb.tokenize=function(t){return t.slice()},Cb.join=Cb.removeEmpty=function(t){return t};const wb=Phaser.Utils.Array.Remove;var Sb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),wb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,pb.diff(o,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},_b={cursorMoveLeft(){if(!this.isOpened)return this;var t=Ob(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Ob(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Pb(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Ob(Tb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Pb(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Ob(Tb(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Mb=Phaser.Utils.Objects.IsPlainObject;class Eb extends Wl{constructor(t,e,i,s,r,n){Mb(e)?n=e:Mb(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(sb(e,"wrap.vAlign")||vc(e,"wrap.vAlign",s=i?"center":"top"),sb(e,"wrap.wrapMode")||vc(e,"wrap.wrapMode","char"),sb(e,"wrap.maxLines")||vc(e,"wrap.maxLines",s=i?1:void 0),i&&vc(e,"wrap.wrapWidth",1/0),sb(e,"wrap.useDefaultTextHeight")||vc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!sb(e.edit,"inputType")){var s=i?"text":"textarea";vc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new nb(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=ud(n.background,"focus"),o=ud(n.style,"cursor"),l=ud(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=eb(e,"edit");return void 0===i&&(i={}),Ay(e,i,ib),new tb(t,i)}(this,n),ab.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),db.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),ob.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),hb(l)&&Object.assign(l,o),lb.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=Lb(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},Ab={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Bb={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const Wb=Phaser.Utils.Objects.GetValue;class zb extends dv{constructor(t,e){void 0===e&&(e={});var i,s=Wb(e,"text");xt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new Eb(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,h,o=Wb(e,"space",void 0);o&&(o.child=Wb(o,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=h!==e;a=t,h=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=Wb(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(zb.prototype,Ab,Bb);var Ib={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?$o(e):{}:e||(e={});var s=new zb(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},Yb={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=Lb(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const jb=Phaser.Utils.Objects.GetValue,Xb=Phaser.Math.Linear,Fb=Phaser.Math.Snap.Floor;var Hb={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=jb(s,r),a=function(t,e){var i=new Ag(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=jb(e,"proportion.range.slider",h),l=void 0===n;t.add(a,{proportion:o,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=Lb(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=jb(e,"proportion.range.inputText",h),t.add(c,{proportion:o,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=Xb(t.minValue,t.maxValue,a.value);t.step&&(e=Fb(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Vb=function(t,e){var i=new Ef(t,e);return t.add.existing(i),i};const Gb=Phaser.Utils.Objects.GetValue;var Ub={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=Gb(e,"incDec")||{},r={text:null,action:null},n=Vb(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=Lb(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign($o(r),s.incButton||{}),d=km(i,l),c=Object.assign($o(r),s.decButton||{}),u=km(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,o,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new Yx(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const Xx=Phaser.Utils.Objects.GetValue;var Fx=function(t,e){var i=Xx(e,"expandDirection",void 0);"string"==typeof i&&(i=Hx[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",sb(s=e,r="alignTarget")?Es(s,r):n&&sb(s,n)?Es(s,n):a&&sb(s,a)?Es(s,a):h),c=Xx(e,"alignTargetY",d),u=Xx(e,"alignOffsetX",0),p=Xx(e,"alignOffsetY",0),g=Xx(e,"alignSide","").includes("right"),v=Xx(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),o=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=v;x||(x=At(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Hx={down:0,up:1},Vx=Phaser.Utils.Objects.GetValue;class Gx extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Mi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Fx(t,e),t.isRexSizer&&t.layout();var i=Vx(e,"touchOutsideClose",!1),s=Vx(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Ux={openColorPicker:function(){if(!this.colorPicker){var t=jx.call(this).layout(),e=new Gx(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(Ux,ax);const Nx=Phaser.Utils.Objects.GetValue;class $x extends nx{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(Nx(i,"width",160),Nx(i,"height",170));var n=Nx(i,"background");r=n?function(t){return Zc(t,n)}:Nx(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(Nx(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(Nx(i,"expandDirection")),this.setColorPickerEaseInDuration(Nx(i,"easeIn",200)),this.setColorPickerEaseOutDuration(Nx(i,"easeOut",200)),this.setColorPickerTransitInCallback(Nx(i,"transitIn")),this.setColorPickerTransitOutCallback(Nx(i,"transitOut")),this.setColorPickerBounds(Nx(i,"bounds"));var a=Nx(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var h=e.colorComponents;if(s&&!1!==h&&null!==h){this.setColorComponentsHeight(Nx(h,"height",30)),this.setColorComponentsFormatLabelConfig(Nx(h,"formatLabel"));var o=Nx(h,"inputText");o||(o=Nx(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=Nx(h,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign($x.prototype,Ux);var Kx={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?$o(e):{}:e||(e={});var s=new $x(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Jx={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},qx={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Zx={buildShapes(){this.addShape((new oc).setName("box")).addShape((new ac).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,h=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;o.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?o.setRadius(u/2):o.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(h,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},Qx={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new gs(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},tC={};Object.assign(tC,Jx,qx,Zx,Qx);const eC=23730,iC=Phaser.Utils.Objects.GetValue,sC=Phaser.Utils.Objects.IsPlainObject;class rC extends Pd{constructor(t,e,i,s,r,n,a){sC(e)?(e=iC(a=e,"x",0),i=iC(a,"y",0),s=iC(a,"width",2),r=iC(a,"height",2),n=iC(a,"color",eC)):sC(n)&&(n=iC(a=n,"color",eC)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=eC),this.setBoxShape(iC(a,"circleBox",!1)),this.setBoxFillStyle(n,iC(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(iC(a,"uncheckedColor",null),iC(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(iC(a,"boxLineWidth",4),iC(a,"boxStrokeColor",n),iC(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,iC(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),iC(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(iC(a,"checkerColor",16777215),iC(a,"checkerAlpha",1)),this.setBoxSize(iC(a,"boxSize",1)),this.setCheckerSize(iC(a,"checkerSize",1)),this.setCheckerAnimationDuration(iC(a,"animationDuration",150)),this.buildShapes();var h=iC(a,"checked");void 0===h&&(h=iC(a,"value",!1)),this.setValue(h)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(rC.prototype,tC);const nC=Phaser.Utils.Objects.GetValue,aC=Phaser.Utils.Objects.IsPlainObject;class hC extends rC{constructor(t,e,i,s,r,n,a){aC(e)?(e=nC(a=e,"x",0),i=nC(a,"y",0),s=nC(a,"width",2),r=nC(a,"height",2),n=nC(a,"color",eC)):aC(n)&&(n=nC(a=n,"color",eC)),super(t,e,i,s,r,n,a),this._click=new Sr(this,nC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(nC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var oC={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new hC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},lC={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},dC={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},cC={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},uC=function(t,e,i){return(e-t)*i+t},pC=function(t){return t>>16&255},gC=function(t){return t>>8&255},vC=function(t){return 255&t};const fC=Phaser.Math.Linear;var mC={buildShapes(){this.addShape((new oc).setName("track")).addShape((new oc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,h=(e-n)/2,o=e*this.trackRadius;s.setTopLeftPosition(a,h).setSize(r,n).setRadius(o)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&uC(pC(l),pC(d),c))<<16|(255&uC(gC(l),gC(d),c))<<8|255&uC(vC(l),vC(d),c)),p=fC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=fC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},yC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new gs(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},bC={};Object.assign(bC,lC,dC,cC,mC,yC);const xC=Phaser.Utils.Objects.GetValue,CC=Phaser.Utils.Objects.IsPlainObject,wC=23730;class SC extends Pd{constructor(t,e,i,s,r,n,a){CC(e)?(e=xC(a=e,"x",0),i=xC(a,"y",0),s=xC(a,"width",2),r=xC(a,"height",2),n=xC(a,"color",wC)):CC(n)&&(n=xC(a=n,"color",wC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=wC),this.setTrackFillStyle(n,xC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(xC(a,"falseValueTrackColor",function(t){var e=.3*pC(t)+.59*gC(t)+.11*vC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),xC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(xC(a,"thumbColor",16777215),xC(a,"thumbAlpha",1)),this.setTrackSize(xC(a,"trackWidth",.9),xC(a,"trackHeight",.5)),this.setTrackRadius(xC(a,"trackRadius",.5*this.trackHeight));var h=xC(a,"thumbHeight",void 0),o=xC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(xC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(xC(a,"thumbLeft",.3),xC(a,"thumbRight",void 0)),this.setRTL(xC(a,"rtl",!1)),this.setToggleAnimationDuration(xC(a,"animationDuration",150)),this.buildShapes(),this.setValue(xC(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(SC.prototype,bC);const kC=Phaser.Utils.Objects.GetValue;class OC extends SC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new Sr(this,kC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(kC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var PC={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new OC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},TC={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=_C[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const _C={down:0,up:1},MC=Phaser.Utils.Objects.GetValue;var EC=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,h=n.length;a0||this.listMaxHeight>0)){if(s=RC(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=LC(e,this.listCreateSliderTrackCallback),g=LC(e,this.listCreateSliderThumbCallback);d=new ny(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:MC(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=RC(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},RC=function(t,e,i){var s;return i?(e.orientation="x",s=new Yf(t,e)):(e.orientation="y",s=new Ef(t,e)),t.add.existing(s),s},LC=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},DC={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},AC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=EC.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Gx(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(AC,TC,DC);const BC=Phaser.Utils.Objects.GetValue;class WC extends Gl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(BC(e,"options"));var i=BC(e,"list");this.setWrapEnable(BC(i,"wrap",!1)),this.setCreateButtonCallback(BC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(BC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(BC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(BC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(BC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(BC(i,"scroller")),this.setListMouseWheelScrollerConfig(BC(i,"mouseWheelScroller")),this.setButtonClickCallback(BC(i,"onButtonClick")),this.setButtonOverCallback(BC(i,"onButtonOver")),this.setButtonOutCallback(BC(i,"onButtonOut")),this.setListExpandDirection(BC(i,"expandDirection")),this.setListEaseInDuration(BC(i,"easeIn",500)),this.setListEaseOutDuration(BC(i,"easeOut",100)),this.setListTransitInCallback(BC(i,"transitIn")),this.settListTransitOutCallback(BC(i,"transitOut")),this.setListMaxHeight(BC(i,"maxHeight",0)),this.setListSize(BC(i,"width"),BC(i,"height",0)),this.setListAlignmentMode(BC(i,"alignParent","text")),this.setListAlignmentSide(BC(i,"alignSide","")),this.setListBounds(BC(i,"bounds")),this.setListSpace(BC(i,"space")),this.setListDraggable(BC(i,"draggable",!1)),this.setValueChangeCallback(BC(e,"setValueCallback"),BC(e,"setValueCallbackScope")),this.setValue(BC(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(WC.prototype,AC);var zC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?$o(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,h=Lv(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=km(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(h.list.createTrackCallback=function(t){return Zc(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return Zc(t,l)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h}(t,e);var i=new WC(t,e);return t.add.existing(i),i},IC=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=zC(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=IC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const jC=Phaser.Utils.Objects.GetValue;var XC={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?$o(e.button):{},r=jC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=Vb(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n=0;i--)ff.call(this,e[i],t);return this}},yf=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},bf=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,yf.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},xf={add(t){return this.buttons.push(t),t._click||(t._click=new Sr(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),bf.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;sr&&Lf.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)zf.call(this,e[i],t);return this}};const Yf=Phaser.Utils.Objects.GetValue;class jf extends Ka{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new Tf({parent:this,eventEmitter:Yf(e,"eventEmitter",this),groupName:Yf(e,"groupName",void 0),clickConfig:Yf(e,"click",void 0)}).setButtonsType(e);var s=Yf(e,"background",void 0),r=Yf(e,"buttons",void 0);this.buttonsAlign=Yf(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(jf.prototype,Af,If,Pf,Mf);var Xf=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=Ff[i])}void 0===s?s={}:!0===s&&(s=Hf);var n=e.width/t.width,a=e.height/t.height,h=i?Math.max(n,a):Math.min(n,a);return s.width=t.width*h,s.height=t.height*h,s};const Ff={fit:0,FIT:0,envelop:1,ENVELOP:1};var Hf={},Vf={},Gf={};const Uf=Phaser.Utils.Objects.IsPlainObject,Nf=Phaser.Utils.Objects.GetValue,$f=Phaser.Display.Align.CENTER,Kf=Phaser.Utils.String.UUID;var Jf={add:function(t,e,i,s,r,n,a,h,o,l){var d,c;ye.call(this,t),Uf(e)&&(e=Nf(u=e,"key",void 0),i=Nf(u,"align",$f),s=Nf(u,"padding",0),r=Nf(u,"expand",!0),t.isRexSizer||(n=Nf(u,"minWidth",t._minWidth),a=Nf(u,"minHeight",t._minHeighted)),h=Nf(u,"offsetX",0),o=Nf(u,"offsetY",0),d=Nf(u,"offsetOriginX",0),c=Nf(u,"offsetOriginY",0),l=Nf(u,"aspectRatio",0));var u,p=void 0!==e;return p||(e=Kf()),"string"==typeof i&&(i=zt[i]),void 0===i&&(i=$f),void 0===s&&(s=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===n&&(n=t._minWidth),void 0===a&&(a=t._minHeight)),void 0===h&&(h=0),void 0===o&&(o=0),void 0===d&&(d=0),void 0===c&&(c=0),void 0===l?l=0:!0===l&&(l=Q(t)/tt(t)),l>0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=fe(s),Uf(r)?(u.expandWidth=Nf(r,"width",!1),u.expandHeight=Nf(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Q(t):n),u.expandHeight&&(t.minHeight=void 0===a?tt(t):a)),u.alignOffsetX=h,u.alignOffsetY=o,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}},qf={remove(t,e){var i;if("string"==typeof t){if(i=t,!(t=this.sizerChildren[i]))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return i&&(delete this.sizerChildren[i],this.childrenMap.hasOwnProperty(i)&&delete this.childrenMap[i]),Oe.call(this,t,e),this},removeAll(t){for(var e in this.sizerChildren)this.remove(e,t);return this},clear(t){for(var e in this.sizerChildren)delete this.sizerChildren[e],this.childrenMap.hasOwnProperty(e)&&delete this.childrenMap[e];return ba.call(this,t),this}},Zf={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildWidth(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).left+e.right)*this.scaleX,s=Math.max(i,s));return n?void 0:s+(this.space.left+this.space.right)*this.scaleX},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,s=0,r=this.sizerChildren,n=!1;for(var a in r)t=r[a],void 0===(i=this.getChildHeight(t))&&(n=!0),n||(i+=((e=t.rexSizer.padding).top+e.bottom)*this.scaleY,s=Math.max(i,s));return n?void 0:s+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(s.expandWidth){var r=e-(this.space.left+this.space.right)*this.scaleX,n=s.padding;i=r-(n.left+n.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(s.expandHeight){var r=e-(this.space.top+this.space.bottom)*this.scaleY,n=s.padding;i=r-(n.top+n.bottom)*this.scaleY}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var s in i)(e=i[s]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,s,r,n,a,h,o,l,d,c,u=this.innerLeft,p=this.innerTop,g=this.innerWidth,v=this.innerHeight,f=this.sizerChildren;for(var m in f)(t=f[m]).rexSizer.hidden||(i=(e=t.rexSizer).padding,yr.call(this,t),l=this.getExpandedChildWidth(t),d=this.getExpandedChildHeight(t),e.aspectRatio>0&&(Vf.width=e.aspectRatio,Vf.height=1,Gf.width=l,Gf.height=d,l=(c=Xf(Vf,Gf,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),aa(t,this)):Ge(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Q(t)),void 0===d&&(d=tt(t)),h=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,o=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,br.call(this,t,s,r,n,a,e.align,h,o))}};Object.assign(Zf,Jf,qf);const Qf=Phaser.Utils.Objects.IsPlainObject,tm=Phaser.Utils.Objects.GetValue;class em extends na{constructor(t,e,i,s,r,n){Qf(e)?(e=tm(n=e,"x",0),i=tm(n,"y",0),s=tm(n,"width",void 0),r=tm(n,"height",void 0)):Qf(s)&&(s=tm(n=s,"width",void 0),r=tm(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(em.prototype,Zf);const im=em.prototype.add;var sm=function(t,e,i,s,r,n,a,h,o){return t.setVisible(!1),im.call(this,t,e,i,s,r,n,a,h,o),this},rm={add:sm,addPage:sm};const nm=Et.prototype.setChildVisible;var am={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?(nm.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(nm.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(am,rm);const hm=Phaser.Utils.Objects.GetValue;class om extends em{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(hm(e,"swapMode",0)),this.setFadeInDuration(hm(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=lm[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(om.prototype,am);const lm={invisible:0,destroy:1},dm=Phaser.Utils.Objects.IsPlainObject,cm=Phaser.Utils.Objects.GetValue,um=Phaser.Utils.String.UUID;var pm={swapPage:function(t,e){var i,s;return null!=(i="number"==typeof t?t:this.getPageIndex(t))&&(void 0!==e&&(s=this.childrenMap.pages.fadeInDuration,this.childrenMap.pages.fadeInDuration=e),this.childrenMap.tabs.emitButtonClick(i),void 0!==s&&(this.childrenMap.pages.fadeInDuration=s)),this},swapFirstPage:function(t){return this.swapPage(0,t),this},swapLastPage:function(t){var e=this.getElement("tabs.buttons").length-1;return this.swapPage(e,t),this}},gm={removePage(t,e){"number"==typeof t&&(t=this.getPageKey(t));var i=this.childrenMap.tabs,s=i.getByName(t),r=this.childrenMap.pages,n=r.getElement(t);return s&&n?(r.removeChildrenMap(t),i.removeButton(s,e),r.remove(n,e),this):this},removeAllPages(t){for(var e=this.getElement("tabs.buttons"),i=e.length-1;i>=0;i--)this.removePage(e[i].name,t);return this}},vm={top:1,left:3,right:5,bottom:7},fm={top:"bottom",left:"right",right:"left",bottom:"top"},mm={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},ym={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const Wm=Phaser.Utils.Objects.GetValue;class zm extends La{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=Wm(e,"background",void 0),s=Wm(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:Wm(e,"space.title",0)}});var r=Wm(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(zm.prototype,Am,Bm);const Im=Phaser.Utils.Objects.GetValue,Ym=Phaser.Utils.Objects.GetValue;var jm=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Xm=Phaser.Geom.Intersects.RectangleToRectangle,Fm=Phaser.Geom.Rectangle.Overlaps;var Hm=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},Vm=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,a=0;return a+=t.contains(r,i)?1:0,a+=t.contains(r,s)?1:0,a+=t.contains(n,i)?1:0,a+=t.contains(n,s)?1:0},Gm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Um=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Nm=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const $m=Phaser.Utils.Objects.GetValue,Km={update:0,everyTick:1};var Jm={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode($m(t,"updateMode",0)),this.enableChildrenMask($m(t,"padding",0)),this.setMaskLayer($m(t,"layer",void 0)),this.onMaskGameObjectVisible=$m(t,"onVisible"),this.onMaskGameObjectInvisible=$m(t,"onInvisible"),this.maskGameObjectCallbackScope=$m(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=Km[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=uh.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},setMaskLayer(t){return this.maskLayer=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.privateRenderLayer?this.privateRenderLayer.setMask(this.childrenMask):this.maskLayer?(this.addToLayer(this.maskLayer),this.maskLayer.setMask(this.childrenMask)):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var a,h,o,l=!!s||!!r,d=t.getBounds(),c=jm(e),u=0,p=i.length;uthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(ey.prototype,qm);const iy=["top","bottom","centerY","center"],sy=["left","right","centerX","center"];var ry=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,h=iy.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,h=sy.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const ny=Phaser.Utils.Objects.GetValue;class ay extends cv{constructor(t,e){void 0===e&&(e={});var i=Hp(e),s=ny(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=ny(e,"clampChildOY",!1),s.clampChildOX=ny(e,"clampChildOX",!1);var r,n,a=new ey(t,s);switch(t.add.existing(a),i){case 0:r=ny(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=ny(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:ny(e,"align.panel","center")};var h=ny(e,"space",void 0);h&&(h.child=ny(h,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),ia(this.childrenMap.child,t),this}}var hy={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:ry.call(this,t,"y",e);break;case 1:ry.call(this,t,"x",e);break;default:ry.call(this,t,"y",e),ry.call(this,t,"x",e)}return this}};Object.assign(ay.prototype,hy);var oy={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},ly={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class dy extends ay{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(dy.prototype,oy,ly);const cy=Phaser.Utils.Objects.GetValue,uy=Phaser.Utils.Objects.GetValue,py=Phaser.Utils.Objects.GetValue;var gy={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=py(t,"onGetValue"),this.onSetValue=py(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},vy={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},fy={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const my=Phaser.Utils.Objects.GetValue;class yy extends La{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=my(e,"proportion.title",0),h=my(e,"space.title",0);i=0===this.orientation?{right:h}:{bottom:h},this.add(s,{proportion:a,expand:!0,padding:i});var o=r.defaultProportion;void 0===o&&(o=e.defaultExpandWidth?1:0),a=my(e,"proportion.inputField",o),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(yy.prototype,gy,vy,fy);var by=function(t,e,i){var s=new Av(t,i);return t.add.existing(s),s},xy=function(t){return void 0===t&&(t=La),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},Cy=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=Ty(this.styles,"inputRow")||{},r=Py(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return Zc(t,Kv(e,i))}(this.scene,t,_y(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,i){return"boolean"==typeof e&&(i=e,e=void 0),void 0===i&&(i=!0),My(this,$o(t),e,i),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;i=r&&o=i&&oi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,h=t.drawY,o=a+t.drawTLX,l=a+t.drawTRX,d=h+t.drawTLY,c=h+t.drawBLY;e=o<0?0-o:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(Zy(this),Qy(this)),this}setNumberInput(){return this.onUpdateCallback=qy,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}}const ib=Phaser.Utils.Objects.GetValue,sb=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var rb=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;rt.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(h,h+a.count));h+=a.count,a.added||(o+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}ub.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,h=t.length,o=1,l=a+h;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=h)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*o;s<=o;s+=2){let o,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=h)return n(pb(r,o.components,e,t,r.useLongestToken));d[s]=o}else d[s]=void 0}var i;o++}if(s)!function t(){setTimeout((function(){if(o>l)return s();u()||t()}),0)}();else for(;o<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,h=a-s,o=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const gb=new ub,vb=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,fb=/\S/,mb=new ub;mb.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!fb.test(t)&&!fb.test(e)},mb.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Cb(t,null,null,i),i," ")},xb.equals=function(t,e){return ub.prototype.equals.call(xb,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const wb=new ub;wb.tokenize=function(t){return t.slice()},wb.join=wb.removeEmpty=function(t){return t};const Sb=Phaser.Utils.Array.Remove;var kb=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Sb(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(o=i,l=e,gb.diff(o,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},Mb={cursorMoveLeft(){if(!this.isOpened)return this;var t=Pb(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=Pb(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=Tb(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=Pb(_b(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=Tb(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=Pb(_b(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const Eb=Phaser.Utils.Objects.IsPlainObject;class Rb extends Wl{constructor(t,e,i,s,r,n){Eb(e)?n=e:Eb(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(rb(e,"wrap.vAlign")||vc(e,"wrap.vAlign",s=i?"center":"top"),rb(e,"wrap.wrapMode")||vc(e,"wrap.wrapMode","char"),rb(e,"wrap.maxLines")||vc(e,"wrap.maxLines",s=i?1:void 0),i&&vc(e,"wrap.wrapWidth",1/0),rb(e,"wrap.useDefaultTextHeight")||vc(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!rb(e.edit,"inputType")){var s=i?"text":"textarea";vc(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new ab(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var h=ud(n.background,"focus"),o=ud(n.style,"cursor"),l=ud(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=ib(e,"edit");return void 0===i&&(i={}),By(e,i,sb),new eb(t,i)}(this,n),hb.call(this),n.focusStyle&&Object.assign(h,n.focusStyle),cb.call(this,h),n.cursorStyle&&Object.assign(o,n.cursorStyle),lb.call(this,o),n.rangeStyle&&Object.assign(l,n.rangeStyle),ob(l)&&Object.assign(l,o),db.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;st.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=Db(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},Bb={setText(t){return this.childrenMap.child.setText(t),this},appendText(t){return this.setText(this.text+t),this}},Wb={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const zb=Phaser.Utils.Objects.GetValue;class Ib extends cv{constructor(t,e){void 0===e&&(e={});var i,s=zb(e,"text");xt(s)?i=s:(void 0===s&&(s={}),s.textArea=!0,i=new Rb(t,s),t.add.existing(i)),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textVisibleHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.contentHeight}})}(i);var r=void 0===s.width,n=void 0===s.height;r&&(i.minWidth=0),n&&(i.minHeight=0),e.scrollMode=0,e.type="rexTextAreaInput",e.child={gameObject:i,expandWidth:r,expandHeight:n};var a,h,o=zb(e,"space",void 0);o&&(o.child=zb(o,"text",0)),e.scroller=!1,super(t,e),this.addChildrenMap("text",i),i.on("cursorin",(function(){var t=i.textOY,e=i.contentHeight,s=a!==t,r=h!==e;a=t,h=e,r&&this.resizeController(),(s||r)&&(this.t=i.t)}),this),i.on("textchange",(function(t){this.emit("textchange",t,this)}),this).on("close",(function(){this.emit("close",this.text,this)}),this);var l=zb(e,"content",void 0);l&&this.setText(l)}get text(){return this.childrenMap.child.text}set text(t){t=null==t?"":t.toString(),this.childrenMap.child.text!==t&&this.setText(t)}get lineHeight(){return this.childrenMap.child.lineHeight}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.contentHeight}get readOnly(){return this.childrenMap.child.readOnly}set readOnly(t){this.childrenMap.child.readOnly=t}setReadOnly(t){return this.childrenMap.child.setReadOnly(t),this}get value(){return this.text}set value(t){this.text=t}}Object.assign(Ib.prototype,Bb,Wb);var Yb={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var i=t.scene;this.type="rexTweaker.TextAreaInput";var s=e.inputTextArea;void 0===s&&(s={}),s.hasOwnProperty("text")||(s.text=e.inputText),s.hasOwnProperty("slider")||(s.slider=e.slider);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?$o(e):{}:e||(e={});var s=new Ib(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},jb={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=Db(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const Xb=Phaser.Utils.Objects.GetValue,Fb=Phaser.Math.Linear,Hb=Phaser.Math.Snap.Floor;var Vb={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=Xb(s,r),a=function(t,e){var i=new Bg(t,e);return t.add.existing(i),i}(i,s),h=e.defaultExpandWidth?2:0,o=Xb(e,"proportion.range.slider",h),l=void 0===n;t.add(a,{proportion:o,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=Db(i,d).setNumberInput();h=e.defaultExpandWidth?1:0,o=Xb(e,"proportion.range.inputText",h),t.add(c,{proportion:o,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=Fb(t.minValue,t.maxValue,a.value);t.step&&(e=Hb(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Gb=function(t,e){var i=new Rf(t,e);return t.add.existing(i),i};const Ub=Phaser.Utils.Objects.GetValue;var Nb={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.IncDecInput";var s=Ub(e,"incDec")||{},r={text:null,action:null},n=Gb(i,{expand:!1}),a=e.defaultExpandWidth?1:0;t.add(n,{proportion:a,expand:!0});var h=e.inputNumber||e.inputText,o=Db(i,h).setNumberInput();o.on("close",(function(){t.setValue(o.value)}));var l=Object.assign($o(r),s.incButton||{}),d=Om(i,l),c=Object.assign($o(r),s.decButton||{}),u=Om(i,c);n.addButton(d),n.addButton(u);var p=s.inputTextIndex||0;n.insert(p,o,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,n.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new jx(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a};const Fx=Phaser.Utils.Objects.GetValue;var Hx=function(t,e){var i=Fx(e,"expandDirection",void 0);"string"==typeof i&&(i=Vx[i]);var s,r,n,a,h,o,l,d=(n="alignTargetX",rb(s=e,r="alignTarget")?Es(s,r):n&&rb(s,n)?Es(s,n):a&&rb(s,a)?Es(s,a):h),c=Fx(e,"alignTargetY",d),u=Fx(e,"alignOffsetX",0),p=Fx(e,"alignOffsetY",0),g=Fx(e,"alignSide","").includes("right"),v=Fx(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),o=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(o+u,l+p);var x=v;x||(x=At(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(o+u,l+p))};const Vx={down:0,up:1},Gx=Phaser.Utils.Objects.GetValue;class Ux extends Hs{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){Ri(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new Mi(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),Hx(t,e),t.isRexSizer&&t.layout();var i=Gx(e,"touchOutsideClose",!1),s=Gx(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&ir(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var Nx={openColorPicker:function(){if(!this.colorPicker){var t=Xx.call(this).layout(),e=new Ux(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(Nx,hx);const $x=Phaser.Utils.Objects.GetValue;class Kx extends ax{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize($x(i,"width",160),$x(i,"height",170));var n=$x(i,"background");r=n?function(t){return Zc(t,n)}:$x(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition($x(i,"hPalettePosition",0)),this.setColorPickerExpandDirection($x(i,"expandDirection")),this.setColorPickerEaseInDuration($x(i,"easeIn",200)),this.setColorPickerEaseOutDuration($x(i,"easeOut",200)),this.setColorPickerTransitInCallback($x(i,"transitIn")),this.setColorPickerTransitOutCallback($x(i,"transitOut")),this.setColorPickerBounds($x(i,"bounds"));var a=$x(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var h=e.colorComponents;if(s&&!1!==h&&null!==h){this.setColorComponentsHeight($x(h,"height",30)),this.setColorComponentsFormatLabelConfig($x(h,"formatLabel"));var o=$x(h,"inputText");o||(o=$x(e,"inputText")),this.setColorComponentsInputTextConfig(o);var l=$x(h,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(Kx.prototype,Nx);var Jx={name:"ColorInput",accept:t=>!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ColorInput";var s=e.colorInput;void 0===s&&(s={}),s.hasOwnProperty("inputText")||(s.inputText=e.inputText);var r=function(t,e,i){void 0===i&&(i=!0),i?e=e?$o(e):{}:e||(e={});var s=new Kx(t,e);return t.add.existing(s),s}(i,s);t.add(r,{proportion:1,expand:!0,key:"colorInput"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},qx={setBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.boxFillColor!==t||this.boxFillAlpha!==e,this.boxFillColor=t,this.boxFillAlpha=e,this},setUncheckedBoxFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.uncheckedBoxFillColor!==t||this.uncheckedBoxFillAlpha!==e,this.uncheckedBoxFillColor=t,this.uncheckedBoxFillAlpha=e,this},setBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.boxLineWidth!==t||this.boxStrokeColor!==e||this.boxStrokeAlpha!==i,this.boxLineWidth=t,this.boxStrokeColor=e,this.boxStrokeAlpha=i,this},setUncheckedBoxStrokeStyle(t,e,i){return void 0===i&&(i=1),this.dirty=this.dirty||this.uncheckedBoxLineWidth!==t||this.uncheckedBoxStrokeColor!==e||this.uncheckedBoxStrokeAlpha!==i,this.uncheckedBoxLineWidth=t,this.uncheckedBoxStrokeColor=e,this.uncheckedBoxStrokeAlpha=i,this},setCheckerStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.checkerColor!==t||this.checkAlpha!==e,this.checkerColor=t,this.checkAlpha=e,this},setBoxShape(t){return void 0===t&&(t=!1),this.isCircleShape===t||(this.isCircleShape=t,this.isSizeChanged=!0,this.dirty=!0),this}},Zx={setBoxSize(t){return this.dirty=this.dirty||this.boxSize!==t,this.boxSize=t,this},setCheckerSize(t){return this.dirty=this.dirty||this.checkerSize!==t,this.checkerSize=t,this}},Qx={buildShapes(){this.addShape((new oc).setName("box")).addShape((new ac).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,h=Math.max(s/10,2),o=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;o.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?o.setRadius(u/2):o.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(o.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(h,this.checkerColor)):(o.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}},tC={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new gs(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},eC={};Object.assign(eC,qx,Zx,Qx,tC);const iC=23730,sC=Phaser.Utils.Objects.GetValue,rC=Phaser.Utils.Objects.IsPlainObject;class nC extends Pd{constructor(t,e,i,s,r,n,a){rC(e)?(e=sC(a=e,"x",0),i=sC(a,"y",0),s=sC(a,"width",2),r=sC(a,"height",2),n=sC(a,"color",iC)):rC(n)&&(n=sC(a=n,"color",iC)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=iC),this.setBoxShape(sC(a,"circleBox",!1)),this.setBoxFillStyle(n,sC(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(sC(a,"uncheckedColor",null),sC(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(sC(a,"boxLineWidth",4),sC(a,"boxStrokeColor",n),sC(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,sC(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),sC(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(sC(a,"checkerColor",16777215),sC(a,"checkerAlpha",1)),this.setBoxSize(sC(a,"boxSize",1)),this.setCheckerSize(sC(a,"checkerSize",1)),this.setCheckerAnimationDuration(sC(a,"animationDuration",150)),this.buildShapes();var h=sC(a,"checked");void 0===h&&(h=sC(a,"value",!1)),this.setValue(h)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(nC.prototype,eC);const aC=Phaser.Utils.Objects.GetValue,hC=Phaser.Utils.Objects.IsPlainObject;class oC extends nC{constructor(t,e,i,s,r,n,a){hC(e)?(e=aC(a=e,"x",0),i=aC(a,"y",0),s=aC(a,"width",2),r=aC(a,"height",2),n=aC(a,"color",iC)):hC(n)&&(n=aC(a=n,"color",iC)),super(t,e,i,s,r,n,a),this._click=new Sr(this,aC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(aC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var lC={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new oC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},dC={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},cC={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},uC={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},pC=function(t,e,i){return(e-t)*i+t},gC=function(t){return t>>16&255},vC=function(t){return t>>8&255},fC=function(t){return 255&t};const mC=Phaser.Math.Linear;var yC={buildShapes(){this.addShape((new oc).setName("track")).addShape((new oc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,h=(e-n)/2,o=e*this.trackRadius;s.setTopLeftPosition(a,h).setSize(r,n).setRadius(o)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&pC(gC(l),gC(d),c))<<16|(255&pC(vC(l),vC(d),c))<<8|255&pC(fC(l),fC(d),c)),p=mC(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=mC(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},bC={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new gs(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},xC={};Object.assign(xC,dC,cC,uC,yC,bC);const CC=Phaser.Utils.Objects.GetValue,wC=Phaser.Utils.Objects.IsPlainObject,SC=23730;class kC extends Pd{constructor(t,e,i,s,r,n,a){wC(e)?(e=CC(a=e,"x",0),i=CC(a,"y",0),s=CC(a,"width",2),r=CC(a,"height",2),n=CC(a,"color",SC)):wC(n)&&(n=CC(a=n,"color",SC)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=SC),this.setTrackFillStyle(n,CC(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(CC(a,"falseValueTrackColor",function(t){var e=.3*gC(t)+.59*vC(t)+.11*fC(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),CC(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(CC(a,"thumbColor",16777215),CC(a,"thumbAlpha",1)),this.setTrackSize(CC(a,"trackWidth",.9),CC(a,"trackHeight",.5)),this.setTrackRadius(CC(a,"trackRadius",.5*this.trackHeight));var h=CC(a,"thumbHeight",void 0),o=CC(a,"thumbWidth",h);void 0===o&&(o=.9*this.trackHeight),this.setThumbSize(o,h),this.setThumbRadius(CC(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(CC(a,"thumbLeft",.3),CC(a,"thumbRight",void 0)),this.setRTL(CC(a,"rtl",!1)),this.setToggleAnimationDuration(CC(a,"animationDuration",150)),this.buildShapes(),this.setValue(CC(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(kC.prototype,xC);const OC=Phaser.Utils.Objects.GetValue;class PC extends kC{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new Sr(this,OC(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(OC(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}var TC={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new PC(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},_C={setWrapEnable(t){return void 0===t&&(t=!0),this.listWrapEnable=t,this},setCreateButtonCallback(t){return this.listCreateButtonCallback=t,this},setCreateListBackgroundCallback(t){return this.listCreateBackgroundCallback=t,this},setCreateListSliderTrackCallback(t){return this.listCreateSliderTrackCallback=t,this},setCreateListSliderThumbCallback(t){return this.listCreateSliderThumbCallback=t,this},setListSliderAdaptThumbSizeEnable(t){return void 0===t&&(t=!0),this.listSliderAdaptThumbSizeEnable=t,this},setListScrollerConfig(t){return void 0===t&&(t={}),this.listScrollerConfig=t,this},setListMouseWheelScrollerConfig(t){return this.listMouseWheelScrollerConfig=t,this},setButtonClickCallback(t){return this.listOnButtonClick=t,this},setButtonOverCallback(t){return this.listOnButtonOver=t,this},setButtonOutCallback(t){return this.listOnButtonOut=t,this},setListExpandDirection(t){return"string"==typeof t&&(t=MC[t]),this.listExpandDirection=t,this},setListEaseInDuration(t){return void 0===t&&(t=0),this.listEaseInDuration=t,this},setListEaseOutDuration(t){return void 0===t&&(t=0),this.listEaseOutDuration=t,this},setListTransitInCallback(t){return this.listTransitInCallback=t,this},settListTransitOutCallback(t){return this.listTransitOutCallback=t,this},setListBounds(t){return this.listBounds=t,this},setListWidth(t){return this.listWidth=t,this},setListHeight(t){return this.listHeight=t,this},setListSize(t,e){return this.setListWidth(t).setListHeight(e),this},setListMaxHeight(t){return this.listMaxHeight=t,this},setListAlignmentMode(t){return this.listAlignMode=t,this},setListAlignmentSide(t){return void 0===t&&(t=""),this.listAlignSide=t,this},setListSpace(t){return void 0===t&&(t={}),this.listSpace=t,this},setListDraggable(t){return void 0===t&&(t=!0),this.listDraggable=t,this}};const MC={down:0,up:1},EC=Phaser.Utils.Objects.GetValue;var RC=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,h=n.length;a0||this.listMaxHeight>0)){if(s=LC(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=DC(e,this.listCreateSliderTrackCallback),g=DC(e,this.listCreateSliderThumbCallback);d=new ay(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:EC(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=LC(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},LC=function(t,e,i){var s;return i?(e.orientation="x",s=new jf(t,e)):(e.orientation="y",s=new Rf(t,e)),t.add.existing(s),s},DC=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s},AC={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},BC={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=RC.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new Ux(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(BC,_C,AC);const WC=Phaser.Utils.Objects.GetValue;class zC extends Gl{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(WC(e,"options"));var i=WC(e,"list");this.setWrapEnable(WC(i,"wrap",!1)),this.setCreateButtonCallback(WC(i,"createButtonCallback")),this.setCreateListBackgroundCallback(WC(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(WC(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(WC(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(WC(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(WC(i,"scroller")),this.setListMouseWheelScrollerConfig(WC(i,"mouseWheelScroller")),this.setButtonClickCallback(WC(i,"onButtonClick")),this.setButtonOverCallback(WC(i,"onButtonOver")),this.setButtonOutCallback(WC(i,"onButtonOut")),this.setListExpandDirection(WC(i,"expandDirection")),this.setListEaseInDuration(WC(i,"easeIn",500)),this.setListEaseOutDuration(WC(i,"easeOut",100)),this.setListTransitInCallback(WC(i,"transitIn")),this.settListTransitOutCallback(WC(i,"transitOut")),this.setListMaxHeight(WC(i,"maxHeight",0)),this.setListSize(WC(i,"width"),WC(i,"height",0)),this.setListAlignmentMode(WC(i,"alignParent","text")),this.setListAlignmentSide(WC(i,"alignSide","")),this.setListBounds(WC(i,"bounds")),this.setListSpace(WC(i,"space")),this.setListDraggable(WC(i,"draggable",!1)),this.setValueChangeCallback(WC(e,"setValueCallback"),WC(e,"setValueCallbackScope")),this.setValue(WC(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(zC.prototype,BC);var IC=function(t,e){e=function(t,e,i){void 0===i&&(i={});var s=(e=e?$o(e):{}).label||e.button,r=e.button||e.label;delete e.label,delete e.button;var n=i.label||i.button||i,a=i.button||i.label||i,h=Dv(t,s,n);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=Om(t,r,a).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var o=e.track;o&&(h.list.createTrackCallback=function(t){return Zc(t,o)},delete e.track);var l=e.thumb;return l&&(h.list.createThumbCallback=function(t){return Zc(t,l)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h}(t,e);var i=new zC(t,e);return t.add.existing(i),i},YC=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=IC(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=YC(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const XC=Phaser.Utils.Objects.GetValue;var FC={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ButtonsInput";var s=e.button?$o(e.button):{},r=XC(s,"expand",!0);r&&(s.align="center"),delete s.expand;var n=Gb(i,{expand:r});n.buttonConfig=s,t.add(n,{proportion:1,expand:!0,key:"list"}),n.on("button.click",(function(e,i,s,r){var a=n.options[i];a&&(t._selectedIndex=i,t.setValue(a.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;n * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */const Pe=Phaser.Display.Canvas.CanvasPool;var Te=function(t){var e=Pe.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return Pe.remove(e),a}var o=Math.ceil(s.width*t.baselineX),h=o,l=2*h;if(h=h*t.baselineY|0,e.width=o,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,o,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,h),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,o,l))return a.ascent=h,a.descent=h+6,a.fontSize=a.ascent+a.descent,Pe.remove(e),a;var d,c,u=i.getImageData(0,0,o,l).data,p=u.length,g=4*o,v=0,f=!1;for(d=0;dh;d--){for(c=0;c0&&this.wrapMode!==_e&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Ie[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=je(t,l,d);else{var u=De(t,l,d);c&&(u=c(u)),this[o]=u}}var p=je(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=je(t,"fill",null);null!==g&&(this.color=qt(g));var v=je(t,"metrics",!1);return v?this.metrics={ascent:je(v,"ascent",0),descent:je(v,"descent",0),fontSize:je(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Te(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Te(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=je(t,"fontFamily","Courier"),this.fontSize=je(t,"fontSize","16px"),this.fontStyle=je(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=qt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=qt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=qt(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=qt(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=qt(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=qt(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=qt(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Ie[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=je(e,"fontFamily",this.fontFamily),this.fontSize=je(e,"fontSize",this.fontSize),this.fontStyle=je(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}};var ze=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Fe={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),se(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Ye=Phaser.Utils.Objects.GetValue,Xe=Oe,We=Me;class Ve{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Ye(t,"text",""),this.x=Ye(t,"x",0),this.y=Ye(t,"y",0),this.width=Ye(t,"width",0);var e=Ye(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ye(t,"newLineMode",0),this.startIndex=Ye(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===We&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Xe&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===We&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var Ge=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:q(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Ke={};const Je=Phaser.Geom.Rectangle;var qe=new I;class Ze{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&gi(v)){""!==b?a.push(n.getLine(b,x,oi)):0===C&&r>0&&a.push(n.getLine("",0,oi)),a.push(...ui(v,e,di,s,0,n));var w=a.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,oi)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},pi=function(t,e){var i;switch(e){case li:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==fi&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new $e({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}};var vs=function(t){for(var e,i,s,r={},n=0,a=(t=t.split(";")).length;n=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px","")));break;case"shadow":o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.offsetX=parseInt(o[1].replace("px",""))),h>=3&&(s.offsetY=parseInt(o[2].replace("px",""))),h>=4&&(s.blur=parseInt(o[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px",""))),h>=3&&(s.offset=parseInt(o[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":s=parseFloat(s)}r[i]=s}return r},fs=function(t){return 0===(t=t.replace(ks,"")).length},ms=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,ys=/<\s*class=/i,bs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,xs=/<\s*style=/i,Cs=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,ks=/^\s+|\s+$/;const ws=Phaser.Utils.Objects.GetValue;class Ss extends Xi{constructor(t,e,i,s,r){var n=ws(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new gs(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}t.register("tagText",(function(t,e,i,s){var r=new Ss(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",Ss);const Ps=Phaser.Utils.Objects.GetValue;var Ts=function(t,e){return void 0===e?t:t[e]},Os=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ps(e,"left",0),t.right=Ps(e,"right",0),t.top=Ps(e,"top",0),t.bottom=Ps(e,"bottom",0)),t};let Ms=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Ms.prototype,Z);var Es={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const _s=Phaser.Math.RotateAround;var Rs;const Ls=Phaser.Geom.Rectangle;var Bs,Is=function(t){void 0===Bs&&(Bs=new Ls);var e=t.drawTLX,i=t.drawTLY;return Bs.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Bs};const Ds=Phaser.Math.RotateAround;var js,As=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===js&&(js={}),s=js),s.x=e,s.y=i,0!==t.rotation&&Ds(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const zs=Phaser.GameObjects.Components.TransformMatrix;var Fs,Ys,Xs={},Ws=function(t,e,i,s,r){var n=As(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Xs);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Fs&&(Fs=new zs,Ys=new zs),t.parentContainer?t.getWorldTransformMatrix(Fs,Ys):Fs.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Fs.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Vs=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Ws(t,e,n,a,r)},Gs={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Rs&&(Rs={}),s=Rs),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&_s(s,0,0,-i.rotation),s}(t,e,this,!0);return Is(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Vs(this.parent,this,t,e,i)}};Object.assign(Gs,Es);const Hs=Phaser.Math.DegToRad,Us=Phaser.Math.RadToDeg,Ns=Phaser.Utils.Objects.GetValue;class $s extends Ms{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Us(this._rotation)}set angle(t){this.rotation=Hs(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=Ns(t,"width",void 0),i=Ns(t,"height",void 0),s=Ns(t,"scaleX",void 0),r=Ns(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign($s.prototype,Gs);var Ks=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const Js=Phaser.Utils.Objects.GetValue;class qs extends $s{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(Js(e,"color",null),Js(e,"color2",null),Js(e,"horizontalGradient",!0)),this.setStroke(Js(e,"stroke",null),Js(e,"strokeThickness",2)),this.setCornerRadius(Js(e,"cornerRadius",0),Js(e,"cornerIteration",null))}set color(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=qt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Ks("color2",t,this),Ks("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Ks("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Ks("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){se(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Zs=Phaser.Utils.Objects.GetValue;class Qs extends $s{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Zs(e,"color",null),Zs(e,"color2",null),Zs(e,"horizontalGradient",!0)),this.setStroke(Zs(e,"stroke",null),Zs(e,"strokeThickness",2))}set color(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=qt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Zs(t,"color2",null),Zs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Zs(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const tr=Phaser.Utils.Objects.GetValue;class er{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(tr(t,"bold",!1)),this.setItalic(tr(t,"italic",!1)),this.setFontSize(tr(t,"fontSize","16px")),this.setFontFamily(tr(t,"fontFamily","Courier")),this.setColor(tr(t,"color","#fff")),this.setStrokeStyle(tr(t,"stroke",null),tr(t,"strokeThickness",0)),this.setShadow(tr(t,"shadowColor",null),tr(t,"shadowOffsetX",0),tr(t,"shadowOffsetY",0),tr(t,"shadowBlur",0)),this.setOffset(tr(t,"offsetX",0),tr(t,"offsetY",0)),this.setSpace(tr(t,"leftSpace",0),tr(t,"rightSpace",0)),this.setAlign(tr(t,"align",void 0)),this.setBackgroundColor(tr(t,"backgroundColor",null)),this.setBackgroundHeight(tr(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(tr(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(tr(t,"backgroundLeftX",0)),this.setBackgroundRightX(tr(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Ks("stroke",t,this),Ks("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Ks("shadowOffsetX",t,this),Ks("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new er(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=qt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=qt(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=qt(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=qt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const ir=Phaser.Utils.Array.Remove,sr=Phaser.Utils.Array.Remove,rr="text",nr="image",ar="drawer",or="space",hr="command";var lr=function(t){return t.type===rr&&"\n"===t.text},dr=function(t){return t.type===rr&&"\f"===t.text},cr=function(t){return t.type===rr},ur=function(t){return t.type===hr};class pr extends $s{constructor(t,e,i){super(t,rr),this.updateTextFlag=!1,this.style=new er(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var gr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class vr extends $s{constructor(t,e,i){super(t,nr),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Ti(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var fr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class mr extends $s{constructor(t,e,i,s){super(t,ar),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}let yr=class extends $s{constructor(t,e){super(t,or),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}};var br=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class xr extends Ms{constructor(t,e,i,s,r){super(t,hr),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var Cr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},kr=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const wr={none:0,word:1,char:2,character:2,mix:3};var Sr=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Mr.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Mr.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=_r(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=_r(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=_r(t,"wrapMode");void 0===c&&(c=_r(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=wr[c]);var u=_r(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=_r(t,"letterSpacing",0),g=_r(t,"hAlign",0),v=_r(t,"vAlign",0),f=_r(t,"justifyPercentage",.25),m=kr({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:_,width:R}),L=Math.max(L,R)),m.start+=M.length,m.isLastPage=!B&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Br(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Br(t,"maxLines",0);var o=0===i,h=Br(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Br(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Br(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Br(t,"letterSpacing",0),p=Br(t,"rtl",!0),g=Br(t,"hAlign",p?2:0),v=Br(t,"vAlign",0),f=kr({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(M.push({children:E,height:_}),R=Math.max(R,_)),f.start+=O.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=M.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Os(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Ts(this.padding,t)},modifyTextStyle:function(t){return this.textStyle.modify(t),this},modifyDefaultTextStyle:function(t){return this.defaultTextStyle.modify(t),this},resetTextStyle:function(){return this.textStyle.copyFrom(this.defaultTextStyle),this},setTestString:function(t){return this.testString=t,this},removeChild:function(t){return this.poolManager.free(t),ir(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},popChild:function(t){return sr(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(rr);return null===i?i=new pr(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Vs(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r>16&255},bn=function(t){return t>>8&255},xn=function(t){return 255&t};const Cn=Phaser.Events.EventEmitter;var kn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=wn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},wn={},Sn=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=kn),function(t){if(t.events)return t;var e=new Cn,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Pn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},Tn=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(En(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},zn=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Fn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Yn=Phaser.Geom.Rectangle,Xn=Phaser.Math.Vector2,Wn=Phaser.Math.RotateAround,Vn=Phaser.GameObjects.Container;var Gn=function(t,e){if(void 0===e?e=new Yn:!0===e&&(void 0===Hn&&(Hn=new Yn),e=Hn),t.getBounds&&!(t instanceof Vn))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Un(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Nn(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,$n(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Kn(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Un(t,e),i=e.x,s=e.y,Nn(t,e),r=e.x,n=e.y,$n(t,e),a=e.x,o=e.y,Kn(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Hn=void 0,Un=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-zn(t)*t.originX,e.y=t.y-Fn(t)*t.originY,Zn(t,e,i))},Nn=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getTopRight?t.getTopRight(e):(e.x=t.x-zn(t)*t.originX+zn(t),e.y=t.y-Fn(t)*t.originY,Zn(t,e,i))},$n=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-zn(t)*t.originX,e.y=t.y-Fn(t)*t.originY+Fn(t),Zn(t,e,i))},Kn=function(t,e,i){return void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-zn(t)*t.originX+zn(t),e.y=t.y-Fn(t)*t.originY+Fn(t),Zn(t,e,i))},Jn=function(t,e,i){void 0===e?e=new Xn:!0===e&&(void 0===qn&&(qn=new Xn),e=qn);var s=zn(t),r=Fn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Zn(t,e,i)},qn=void 0,Zn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Wn(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const Qn=Phaser.Utils.Objects.GetValue;var ta=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=Qn(i,"color"),r=Qn(i,"lineWidth"),n=Qn(i,"fillColor"),a=Qn(i,"fillAlpha",1),o=Qn(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Ha:Ga,this.repeatCounter=0,this}stop(){return this.state=Va,this}update(t,e){this.state!==Va&&this.state!==Na&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Ua)):(this.nowTime=this.duration,this.state=Na):this.nowTime>=0&&(this.state=Ha))}get t(){var t;switch(this.state){case Va:case Ga:case Ua:t=0;break;case Ha:t=this.nowTime/this.duration;break;case Na:t=1}return Xa(t,0,1)}set t(t){(t=Xa(t,-1,1))<0?(this.state=Ga,this.nowTime=-this.delay*t):(this.state=Ha,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Va}get isDelay(){return this.state===Ga}get isCountDown(){return this.state===Ha}get isRunning(){return this.state===Ga||this.state===Ha}get isDone(){return this.state===Na}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Va=0,Ga=1,Ha=2,Ua=3,Na=-1;class $a extends za{constructor(t,e){super(t,e),this.timer=new Wa}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ka=Phaser.Utils.Objects.GetValue,Ja=Phaser.Utils.Objects.GetAdvancedValue,qa=Phaser.Tweens.Builders.GetEaseFunction;class Za extends $a{resetFromJSON(t){return this.timer.resetFromJSON(Ka(t,"timer")),this.setEnable(Ka(t,"enable",!0)),this.setTarget(Ka(t,"target",this.parent)),this.setDelay(Ja(t,"delay",0)),this.setDuration(Ja(t,"duration",1e3)),this.setEase(Ka(t,"ease","Linear")),this.setRepeat(Ka(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=qa(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const Qa=Phaser.Sound.BaseSound;var to=function(t){return t instanceof Qa};const eo=Phaser.Utils.Objects.GetValue,io=Phaser.Utils.Objects.GetAdvancedValue,so=Phaser.Math.Linear;let ro=class extends Za{constructor(t,e,i){to(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(eo(t,"mode",0)),this.setEnable(eo(t,"enable",!0)),this.setVolumeRange(io(t,"volume.start",this.parent.volume),io(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=no[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=so(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const no={stop:1,destroy:2};var ao=function(t,e,i,s,r){to(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new ro(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},oo=function(t,e,i,s){to(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new ro(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const ho=Phaser.Utils.Objects.GetValue;var lo={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:ho(e,"loop",this.backgroundMusicLoop),mute:ho(e,"mute",this.backgroundMusicMute),volume:ho(e,"volume",this.backgroundMusicVolume),detune:ho(e,"detune",0),rate:ho(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&ao(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&oo(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const co=Phaser.Utils.Objects.GetValue;var uo={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:co(e,"loop",this.backgroundMusicLoop),mute:co(e,"mute",this.backgroundMusic2Mute),volume:co(e,"volume",this.backgroundMusic2Volume),detune:co(e,"detune",0),rate:co(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&ao(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&oo(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const po=Phaser.Utils.Array.Remove,go=Phaser.Utils.Objects.GetValue;var vo={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:go(e,"mute",this.soundEffectsMute),volume:go(e,"volume",this.soundEffectsVolume),detune:go(e,"detune",0),rate:go(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&po(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&po(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&ao(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&oo(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)oo(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&ao(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&oo(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)oo(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(J(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Zi(this.delimiterLeft),e=Zi(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=Qo:t||(t=eh),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=sh),this.tagExpression=t,this}setValueExpression(t){return t||(t=sh),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==sh||this.valueExpression!==sh){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Zi(this.delimiterLeft),e=Zi(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=Qo),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:hl,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===rr&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,ll.call(t,i.remainder)}});break}}else ur(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},dl=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},cl=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},ul=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var l=n[1];return r.waitGameObjectDestroy(a,l),void t.emit(h,l);case 3:l=n[1];var d=n[2];if("number"==typeof o.getProperty(l,d))return r.waitGameObjectTweenComplete(a,l,d),void t.emit(h,l,d);var c=d,u=c.startsWith("!");return u&&(c=c.substring(1)),o.hasData(l,c)?(r.waitGameObjectDataFlag(a,l,c,!u),void t.emit(h,l,c)):void r.waitTime(0)}};const pl=Phaser.Input.Keyboard.KeyCodes;var gl=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},El=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},_l=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},Rl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Ll=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Ol(a,s)&&(n=a[1],Cr.call(t,`${s}.play`,Ml,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],Cr.call(t,`${s}.stop`,El,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Ol(n,s)&&(r=n[1],Cr.call(t,`${s}.stop`,El,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],Cr.call(t,`${s}.pause`,_l,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);Cr.call(t,`${s}.chain`,Rl,[s,r,a],t),e.skipEvent()}}}))}];var Bl=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Ll,t.createGameObject=wl(t.createGameObject),this.addGameObjectManager(t,Tl)},Il=function(t,e){return 2===t.length&&t[0]===e},Dl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},jl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},Al=function(t){this.getGameObjectManager(t).removeAll()},zl=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Fl={to:!0,yoyo:!0,from:!0,toLeft:!0,toRight:!0,toUp:!0,toDown:!0,yoyoLeft:!0,yoyoRight:!0,yoyoUp:!0,yoyoDown:!0,fromLeft:!0,fromRight:!0,fromUp:!0,fromDown:!0},Yl=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var l=this.getGameObjectManager(e),d=l.getProperty(i,s);if("number"==typeof d){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=d-r:h.startsWith("from")&&(l.setProperty(i,s,d-r),r=d):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=d+r:h.startsWith("from")&&(l.setProperty(i,s,d+r),r=d):"from"===h&&(l.setProperty(i,s,r),r=d);var c=h.startsWith("yoyo");l.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:c})}};const Xl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Il(a,s)&&(n=a[1],Cr.call(t,`${s}.add`,Dl,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Il(n,s)&&(r=n[1],Cr.call(t,`${s}.remove`,jl,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(Cr.call(t,`${s}.removeall`,Al,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],Cr.call(t,`${s}.call`,zl,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,l,d,c=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Fl[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),Cr.call(t,`${s}.ease`,Yl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Wl=Go.addGameObjectManager;var Vl={addGameObjectManager(t,e){(t=t?Ge(t):{}).name||console.warn("[TextPlayer] Parameter 'name' is required in addGameObjectManager(config) method");var i=t.defaultLayer,s=t.createGameObject,r=this.layerManager;t.createGameObject=function(t,...e){var n=s.call(this,t,...e);return i&&r&&r.addToLayer(i,n),n},Wl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Xl]:Xl).length;a0)return od.length=0,!0;return od.length=0,!1},od=[],hd=void 0;const ld=Phaser.Utils.Objects.GetValue;var dd=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=ld(e,n,s[1]))&&(i[s[0]]=r);return i},cd=function(t){t.addEventListener("touchstart",ud,!1),t.addEventListener("touchmove",ud,!1),t.addEventListener("touchend",ud,!1),t.addEventListener("mousedown",ud,!1),t.addEventListener("mouseup",ud,!1),t.addEventListener("mousemove",ud,!1)},ud=function(t){t.stopPropagation()},pd=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},gd=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",pd,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(ka.call(this.clickOutSideTarget,this.parent),Ca.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},vd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",pd,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const fd=Phaser.Utils.Objects.GetValue;var md=function(t,e){var i,s=fd(e,"inputType",void 0);void 0===s&&(s=fd(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=fd(e,"style",void 0),n=i.style;dd(sd,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",dd(id,e,i),cd(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){gd.call(t)})),i.addEventListener("blur",(function(e){vd.call(t)})),i},yd={open:function(){return this.isOpened||this.readOnly||((t=this)!==hd&&(void 0!==hd&&hd.close(),hd=t),this.node||(this.node=md(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===hd&&(hd=void 0),this.setBlur(),this):this}};const bd=Phaser.Utils.Objects.GetValue;class xd extends Ba{constructor(t,e){super(t);var i=bd(e,"inputType",void 0);void 0===i&&(i=bd(e,"type","text")),this.setEnterCloseEnable(bd(e,"enterClose","textarea"!==i));var s=bd(e,"onOpen",void 0);s||(s=bd(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=bd(e,"clickOutSideTarget",void 0);var r=bd(e,"onClose",void 0);r||(r=bd(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=bd(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return rd(t,e,"inputType"),rd(t,e,"type"),rd(t,e,"style"),rd(t,e,sd),rd(t,e,id),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){nd(this.parent,t)||this.close()}setEnterCloseEnable(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}initText(){}updateText(){}get text(){return this.node?this.node.value:""}set text(t){this.node&&(this.node.value=t)}setText(t){return this.text=t,this}get maxLength(){return this.nodeConfig.maxLength}set maxLength(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t)}setMaxLength(t){return this.maxLength=t,this}get minLength(){return this.nodeConfig.minLength}set minLength(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t)}setMinLength(t){return this.minLength=t,this}get placeholder(){return this.node.placeholder}set placeholder(t){this.node&&(this.node.placeholder=t)}setPlaceholder(t){return this.placeholder=t,this}selectText(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}selectAll(){return this.selectText(),this}get selectionStart(){return this.node?this.node.selectionStart:0}get selectionEnd(){return this.node?this.node.selectionEnd:0}get selectedText(){if(!this.node)return"";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}get cursorPosition(){return this.node?this.node.selectionStart:0}set cursorPosition(t){this.node&&this.node.setSelectionRange(t,t)}setCursorPosition(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}get tooltip(){return this.node?this.node.title:""}set tooltip(t){if(!this.node)return this;this.node.title=t}setTooltip(t){return this.tooltip=t,this}setTextChangedCallback(t){return this.onTextChanged=t,this}get readOnly(){return this.nodeConfig.readOnly}set readOnly(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t)}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}get spellCheck(){return this.node?this.node.spellcheck:""}set spellCheck(t){this.node&&(this.node.spellcheck=t)}setSpellCheck(t){return this.spellCheck=t,this}get fontColor(){if(this.node)return this.node.style.color}set fontColor(t){this.node&&(this.node.style.color=t)}setFontColor(t){return this.fontColor=t,this}setStyle(t,e){return this.node?(this.node.style[t]=e,this):this}getStyle(t){if(this.node)return this.node.style[t]}scrollToBottom(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}setEnabled(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}setBlur(){return this.node?(this.node.blur(),this):this}setFocus(){return this.node?(this.node.focus(),this):this}get isFocused(){return this.isOpened}}Object.assign(xd.prototype,yd);var Cd=function(t,e,i){t=t.replace(" ","");var s=i.previousText;if(t===s)return t;if(isNaN(t)){i.emit("nan",t,i),t=s;var r=i.cursorPosition-1;i.setText(t),i.setCursorPosition(r)}else i.previousText=t;return t},kd=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,s=t.parent,r=e;r=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(kd(this),wd(this)),this}setNumberInput(){return this.onUpdateCallback=Cd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Td=Phaser.Utils.Objects.GetValue,Od=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Md=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Rd=Phaser.GameObjects.Zone;let Ld=class extends Rd{constructor(t){super(t,0,0,2,2),this.fullWindow=new _d(this)}};var Bd=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Id=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},Dd=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Yd.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(Xd(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Wd=new Yd,Vd=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Gd=/\S/,Hd=new Yd;Hd.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Gd.test(t)&&!Gd.test(e)},Hd.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Kd(t,null,null,i),i," ")},$d.equals=function(t,e){return Yd.prototype.equals.call($d,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const Jd=new Yd;Jd.tokenize=function(t){return t.slice()},Jd.join=Jd.removeEmpty=function(t){return t};const qd=Phaser.Utils.Array.Remove;var Zd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),qd(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Wd.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},sc={cursorMoveLeft(){if(!this.isOpened)return this;var t=tc(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=tc(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=ec(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=tc(ic(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=ec(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=tc(ic(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const rc=Phaser.Utils.Objects.IsPlainObject;class nc extends ln{constructor(t,e,i,s,r,n){rc(e)?n=e:rc(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Md(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Md(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Md(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Md(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Md(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Ld(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Bd(n.background,"focus"),h=Bd(n.style,"cursor"),l=Bd(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Td(e,"edit");return void 0===i&&(i={}),rd(e,i,Od),new Pd(t,i)}(this,n),Id.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Fd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),Ad.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),vn(l)&&Object.assign(l,h),zd.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=qc(t,"tl",0),this.radiusTR=qc(t,"tr",0),this.radiusBL=qc(t,"bl",0),this.radiusBR=qc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Bt(e,e,e,e,180,270,!1,r,t):Bt(0,0,e,e,90,0,!0,r,t):Rt(0,0,t),(e=this.radiusTR)>0?this._convexTR?Bt(i-e,e,e,e,270,360,!1,r,t):Bt(i,0,e,e,180,90,!0,r,t):Rt(i,0,t),(e=this.radiusBR)>0?this._convexBR?Bt(i-e,s-e,e,e,0,90,!1,r,t):Bt(i,s,e,e,270,180,!0,r,t):Rt(i,s,t),(e=this.radiusBL)>0?this._convexBL?Bt(e,s-e,e,e,90,180,!1,r,t):Bt(0,s,e,e,360,270,!0,r,t):Rt(0,s,t),t.push(t[0],t[1]),Bc(this.x,this.y,t),super.updateData(),this}}const Qc=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var tu={buildShapes(){this.addShape((new Zc).setName("box")).addShape((new Kc).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}};const eu=Phaser.Utils.Objects.GetValue,iu=Phaser.Math.Linear;class su extends Za{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=eu(t,"key","value");var i=e[this.propertyKey];return this.fromValue=eu(t,"from",i),this.toValue=eu(t,"to",i),this.setEase(eu(t,"ease",this.ease)),this.setDuration(eu(t,"duration",this.duration)),this.setRepeat(eu(t,"repeat",0)),this.setDelay(eu(t,"delay",0)),this.setRepeatDelay(eu(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=iu(this.fromValue,this.toValue,i)}}var ru={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new su(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},nu={};Object.assign(nu,mc,yc,tu,ru);const au=23730,ou=Phaser.Utils.Objects.GetValue,hu=Phaser.Utils.Objects.IsPlainObject;class lu extends fc{constructor(t,e,i,s,r,n,a){hu(e)?(e=ou(a=e,"x",0),i=ou(a,"y",0),s=ou(a,"width",2),r=ou(a,"height",2),n=ou(a,"color",au)):hu(n)&&(n=ou(a=n,"color",au)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=au),this.setBoxShape(ou(a,"circleBox",!1)),this.setBoxFillStyle(n,ou(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(ou(a,"uncheckedColor",null),ou(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(ou(a,"boxLineWidth",4),ou(a,"boxStrokeColor",n),ou(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,ou(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),ou(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(ou(a,"checkerColor",16777215),ou(a,"checkerAlpha",1)),this.setBoxSize(ou(a,"boxSize",1)),this.setCheckerSize(ou(a,"checkerSize",1)),this.setCheckerAnimationDuration(ou(a,"animationDuration",150)),this.buildShapes();var o=ou(a,"checked");void 0===o&&(o=ou(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(lu.prototype,nu);const du=Phaser.Utils.Objects.GetValue;class cu extends Ba{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(du(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(du(t,"enable",!0)),this.setMode(du(t,"mode",1)),this.setClickInterval(du(t,"clickInterval",100)),this.setDragThreshold(du(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=uu[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const uu={press:0,pointerdown:0,release:1,pointerup:1},pu=Phaser.Utils.Objects.GetValue,gu=Phaser.Utils.Objects.IsPlainObject;class vu extends lu{constructor(t,e,i,s,r,n,a){gu(e)?(e=pu(a=e,"x",0),i=pu(a,"y",0),s=pu(a,"width",2),r=pu(a,"height",2),n=pu(a,"color",au)):gu(n)&&(n=pu(a=n,"color",au)),super(t,e,i,s,r,n,a),this._click=new cu(this,pu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(pu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("checkbox",(function(t,e,i,s,r,n){var a=new vu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",vu);var fu={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},mu={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},yu={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},bu=function(t,e,i){return(e-t)*i+t};const xu=Phaser.Math.Linear;var Cu={buildShapes(){this.addShape((new Zc).setName("track")).addShape((new Zc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&bu(yn(l),yn(d),c))<<16|(255&bu(bn(l),bn(d),c))<<8|255&bu(xn(l),xn(d),c)),p=xu(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=xu(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},ku={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new su(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},wu={};Object.assign(wu,fu,mu,yu,Cu,ku);const Su=Phaser.Utils.Objects.GetValue,Pu=Phaser.Utils.Objects.IsPlainObject,Tu=23730;class Ou extends fc{constructor(t,e,i,s,r,n,a){Pu(e)?(e=Su(a=e,"x",0),i=Su(a,"y",0),s=Su(a,"width",2),r=Su(a,"height",2),n=Su(a,"color",Tu)):Pu(n)&&(n=Su(a=n,"color",Tu)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Tu),this.setTrackFillStyle(n,Su(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(Su(a,"falseValueTrackColor",function(t){var e=.3*yn(t)+.59*bn(t)+.11*xn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),Su(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(Su(a,"thumbColor",16777215),Su(a,"thumbAlpha",1)),this.setTrackSize(Su(a,"trackWidth",.9),Su(a,"trackHeight",.5)),this.setTrackRadius(Su(a,"trackRadius",.5*this.trackHeight));var o=Su(a,"thumbHeight",void 0),h=Su(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(Su(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(Su(a,"thumbLeft",.3),Su(a,"thumbRight",void 0)),this.setRTL(Su(a,"rtl",!1)),this.setToggleAnimationDuration(Su(a,"animationDuration",150)),this.buildShapes(),this.setValue(Su(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(Ou.prototype,wu);const Mu=Phaser.Utils.Objects.GetValue;class Eu extends Ou{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new cu(this,Mu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Mu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("toggleSwitch",(function(t,e,i,s,r,n){var a=new Eu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",Eu);var _u={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Ru extends $t{}Object.assign(Ru.prototype,_u),t.register("canvas",(function(t,e,i,s){var r=new Ru(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Ru);const Lu=Phaser.Utils.Objects.GetValue;class Bu extends $t{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexCircleMaskImage",this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={maskType:i});var s=Lu(i,"maskType",0),r=Lu(i,"backgroundColor",void 0),n=Lu(i,"strokeColor",void 0),a=Lu(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Iu[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var o=this.scene.sys.textures.getFrame(t,e);if(!o)return this;o.cutWidth!==this.width||o.cutHeight!==this.height?this.setCanvasSize(o.cutWidth,o.cutHeight):this.clear();var h=this.canvas,l=this.context,d=h.width,c=h.height;null!=r&&(l.fillStyle=r,l.fillRect(0,0,d,c)),l.save(),l.beginPath();var u=a/2;switch(s){case 1:var p=(m=Math.floor(d/2))-u,g=(y=Math.floor(c/2))-u;l.ellipse(m,y,p,g,0,0,2*Math.PI);break;case 2:var v=Lu(i,"radius",0),f=Lu(i,"iteration",void 0);Qt(l,u,u,d-a,c-a,v,f);break;default:var m=Math.floor(d/2),y=Math.floor(c/2),b=Math.min(m,y)-u;l.arc(m,y,b,0,2*Math.PI)}return null!=n&&(l.strokeStyle=n,l.lineWidth=a,l.stroke()),l.clip(),this.loadTexture(t,e),l.restore(),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}const Iu={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new Bu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",Bu);const Du=Phaser.Utils.Objects.GetValue;class ju extends $t{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexAlphaMaskImage",this.maskFrame=null,this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={mask:{key:i}});var s=Du(i,"mask.key"),r=Du(i,"mask.frame"),n=Du(i,"mask.invertAlpha",!1),a=Du(i,"mask.scale"),o=Du(i,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var h=s?this.scene.sys.textures.get(s):null;this.maskFrame=h?h.get(r):null}this._textureKey=t,this._frameName=e;var l=this.maskFrame;if(null===l)return this.loadTexture(t,e),this.dirty=!0,this;var d=null!=o;this.loadTexture(t,e);var c,u,p=this.canvas,g=this.context,v=p.width,f=p.height;g.save(),g.globalCompositeOperation=n?"destination-out":"destination-in",null!=this._maskScale?(c=l.cutWidth*this._maskScale,u=l.cutHeight*this._maskScale):(c=v,u=f);var m=(v-c)/2,y=(f-u)/2;return this.drawFrame(this._maskKey,this._maskFrame,m,y,c,u),g.restore(),d&&(g.save(),g.globalCompositeOperation="destination-over",g.fillStyle=o,g.fillRect(0,0,v,f),g.restore()),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}t.register("alphaMaskImage",(function(t,e,i,s,r){var n=new ju(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",ju);const Au=Phaser.Math.Linear,zu=Phaser.Math.Percent;var Fu={setValue(t,e,i){return null==t||(void 0!==e&&(t=zu(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=zu(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=Au(t,e,i)),i}};const Yu=Phaser.Math.Percent;var Xu={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Yu(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new su(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new su(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Wu=Phaser.Utils.Objects.GetValue,Vu=Phaser.Math.Clamp;function Gu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Wu(t,"eventEmitter",this);var e=Wu(t,"valuechangeCallback",null);if(null!==e){var i=Wu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Wu(t,"easeValue.duration",0)).setEaseValueFunction(Wu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Vu(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,Fu,Xu),e}const Hu=Phaser.Math.RadToDeg,Uu=Phaser.Math.DegToRad;var Nu=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Uu(n),d=Uu(a),c=Math.cos(l),u=Math.sin(l),p=Math.cos(d),g=Math.sin(d);return t.startAt(e+c*s,i+u*s),t.arc(e,i,s,n,a,o),h&&0===r||(t.lineTo(e+p*r,i+g*r),r>0&&t.arc(e,i,r,a,n,!o)),t.close(),t},$u={buildShapes(){var t=this.iterations;this.addShape((new Kc).setIterations(t).setName("track")).addShape((new Kc).setIterations(t).setName("bar")).addShape((new Pc).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),Nu(r,t,t,i,s,0,360,!1)):r.reset();var n,a,o,h=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(n=!1,a=0,o=360):(n=this.anticlockwise,a=Hu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),Nu(h,t,t,i+1,s-1,a,o,!1)):h.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const Ku=Phaser.Utils.Objects.GetValue,Ju=Phaser.Utils.Objects.IsPlainObject,qu=Phaser.Math.Clamp,Zu=Phaser.Math.DegToRad(270);let Qu=class extends(Gu(fc)){constructor(t,e,i,s,r,n,a){Ju(e)&&(e=Ku(a=e,"x",0),i=Ku(a,"y",0),s=Ku(a,"radius",1),r=Ku(a,"barColor",void 0),n=Ku(a,"value",0)),void 0===s&&(s=1);var o=2*s;super(t,e,i,o,o),this.type="rexCircularProgress",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Ku(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Ku(a,"centerColor",void 0)),this.setThickness(Ku(a,"thickness",.2)),this.setStartAngle(Ku(a,"startAngle",Zu)),this.setAnticlockwise(Ku(a,"anticlockwise",!1)),this.iterations=Ku(a,"iterations",128),this.buildShapes(),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=qu(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}};Object.assign(Qu.prototype,$u),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new Qu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",Qu);var tp=function(t,e,i,s,r,n,a,o,h,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=o&&(e.strokeStyle=o,e.lineWidth=h,e.stroke())};const ep=Phaser.Math.PI2;var ip=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,o=this.startAngle,h=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),tp(0,n,e,e,s,s,void 0,this.trackColor,i,o,h,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?h:a?(o-l*this.value+ep)%ep:(o+l*this.value)%ep,n.save(),this.barColor2){var u=e+s*Math.cos(o),p=e+s*Math.sin(o),g=e+s*Math.cos(d),v=e+s*Math.sin(d),f=n.createLinearGradient(u,p,g,v);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;tp(0,n,e,e,s,s,void 0,c,i,o,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),tp(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,o,h,l,d){void 0===h&&null!=o&&(h=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=o,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=o&&"none"!==o&&h>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const sp=Phaser.Utils.Objects.GetValue,rp=Phaser.Utils.Objects.IsPlainObject,np=Phaser.Math.Clamp,ap=Phaser.Math.DegToRad(270),op=Phaser.Math.PI2;class hp extends(Gu($t)){constructor(t,e,i,s,r,n,a){rp(e)&&(e=sp(a=e,"x",0),i=sp(a,"y",0),s=sp(a,"radius",1),r=sp(a,"barColor",void 0),n=sp(a,"value",0));var o=2*s;super(t,e,i,o,o,sp(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(sp(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(sp(a,"barColor2",void 0)),this.setCenterColor(sp(a,"centerColor",void 0)),this.setThickness(sp(a,"thickness",.2)),this.setStartAngle(sp(a,"startAngle",ap)),this.setEndAngle(sp(a,"endAngle",this.startAngle+op)),this.setAnticlockwise(sp(a,"anticlockwise",!1)),this.setTextColor(sp(a,"textColor",void 0)),this.setTextStrokeColor(sp(a,"textStrokeColor",void 0),sp(a,"textStrokeThickness",void 0));var h=sp(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(sp(a,"textSize","16px"),sp(a,"textFamily","Courier"),sp(a,"textStyle","")),this.setTextFormatCallback(sp(a,"textFormatCallback",void 0),sp(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=lp(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=lp(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=lp(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=np(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),ip.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var lp=function(t,e,i){return i?t<=e?op+t-e:t-e:t>=e?op+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new hp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",hp);var dp=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const cp=Phaser.Utils.Objects.GetValue,up=Phaser.Utils.Objects.IsPlainObject;let pp=class extends(Gu(fc)){constructor(t,e,i,s,r,n,a,o){up(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):up(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):up(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Kc).setName("trackFill")).addShape((new Kc).setName("bar")).addShape((new Kc).setName("trackStroke")),this.setTrackColor(cp(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(cp(o,"trackStrokeThickness",2),cp(o,"trackStrokeColor",void 0)),this.setSkewX(cp(o,"skewX",0)),this.setRTL(cp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}};var gp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&dp(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),dp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&dp(o,0,0,e,i,t)}};Object.assign(pp.prototype,gp),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new pp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",pp);var vp=function(t,e,i,s,r){t.setIterations(r).start();var n=s.tl;if(_t(n))if(n.convex){var a=n.x,o=n.y;t.ellipticalArc(a,o,n.x,n.y,180,270,!1)}else a=0,o=0,t.ellipticalArc(a,o,n.x,n.y,90,0,!0);else t.lineTo(0,0);return n=s.tr,_t(n)?n.convex?(a=e-n.x,o=n.y,t.ellipticalArc(a,o,n.x,n.y,270,360,!1)):(a=e,o=0,t.ellipticalArc(a,o,n.x,n.y,180,90,!0)):t.lineTo(e,0),n=s.br,_t(n)?n.convex?(a=e-n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,0,90,!1)):(a=e,o=i,t.ellipticalArc(a,o,n.x,n.y,270,180,!0)):t.lineTo(e,i),n=s.bl,_t(n)?n.convex?(a=n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,90,180,!1)):(a=0,o=i,t.ellipticalArc(a,o,n.x,n.y,360,270,!0)):t.lineTo(0,i),t.close(),t},fp=Phaser.Math.RadToDeg,mp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(_t(a)){l=n>a.x?90:fp(Math.acos((a.x-n)/a.x));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,0);if(a=s.tr,_t(a)&&n>e-a.x){var l=90-fp(Math.acos((n-(e-a.x))/a.x));o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)}else t.lineTo(n,0);a=s.br,_t(a)&&n>e-a.x?(l=90-fp(Math.acos((n-(e-a.x))/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)):t.lineTo(n,i),a=s.bl,_t(a)?(l=n>a.x?90:fp(Math.acos((a.x-n)/a.x)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,i)},yp=Phaser.Math.RadToDeg,bp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(_t(a)){l=n>a.y?90:yp(Math.acos((a.y-n)/a.y));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)}else t.lineTo(0,0);if(a=s.tr,_t(a)?(l=n>a.y?90:yp(Math.acos((a.y-n)/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)):t.lineTo(e,0),a=s.br,_t(a)&&n>i-a.y){var l=90-yp(Math.acos((n-(i-a.y))/a.y));o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)}else t.lineTo(e,n);a=s.bl,_t(a)&&n>i-a.y?(l=90-yp(Math.acos((n-(i-a.y))/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,n)},xp=Phaser.Math.RadToDeg,Cp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(_t(a)){l=n>a.x?90:xp(Math.acos((a.x-n)/a.x));var o=e-a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)}else t.lineTo(e,0);if(a=s.br,_t(a)?(l=n>a.x?90:xp(Math.acos((a.x-n)/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)):t.lineTo(e,i),a=s.bl,_t(a)&&n>e-a.x){var l=90-xp(Math.acos((n-(e-a.x))/a.x));o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)}else t.lineTo(e-n,i);a=s.tl,_t(a)&&n>e-a.x?(l=90-xp(Math.acos((n-(e-a.x))/a.x)),o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)):t.lineTo(e-n,0)},kp=Phaser.Math.RadToDeg,wp=function(t,e,i,s,r){var n=i*r,a=s.br;if(_t(a)){l=n>a.y?90:kp(Math.acos((a.y-n)/a.y));var o=e-a.x,h=i-a.y;t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)}else t.lineTo(e,i);if(a=s.bl,_t(a)?(l=n>a.y?90:kp(Math.acos((a.y-n)/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)):t.lineTo(0,i),a=s.tl,_t(a)&&n>i-a.y){var l=90-kp(Math.acos((n-(i-a.y))/a.y));o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,i-n);a=s.tr,_t(a)&&n>i-a.y?(l=90-kp(Math.acos((n-(i-a.y))/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)):t.lineTo(e,i-n)},Sp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Pp=function(t){return"string"==typeof t&&(t=Sp[t]),t};const Tp=Phaser.Utils.Objects.GetValue,Op=Phaser.Utils.Objects.IsPlainObject;class Mp extends(Gu(fc)){constructor(t,e,i,s,r,n,a,o,h){Op(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Op(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Op(n)&&(n=(h=n).radius,a=h.barColor,o=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===o&&(o=0),super(t,e,i,s,r,h),this.type="rexRoundRectangleProgress",this.rrGeom=new Tt,this.bootProgressBase(h),this.addShape((new Kc).setName("trackFill")).addShape((new Kc).setName("bar")).addShape((new Kc).setName("trackStroke")),this.setTrackColor(Tp(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Tp(h,"trackStrokeThickness",2),Tp(h,"trackStrokeColor",void 0)),this.setOrientation(Tp(h,"orientation",0)),this.setRTL(Tp(h,"rtl",!1)),this.setRadius(n),this.setIteration(Tp(n,"iteration",void 0)),this.setValue(o)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){t=Pp(t),this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var Ep={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,n=this.rtl,a=this.iteration+1,o=this.getShape("trackFill");o.fillStyle(this.trackColor),o.isFilled&&vp(o,t,e,i,a);var h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&function(t,e,i,s,r,n,a,o){t.setIterations(o).start(),0===r||(1===r?vp(t,e,i,s,o):((0===n?a?Cp:mp:a?wp:bp)(t,e,i,s,r),t.close()))}(h,t,e,i,s,r,n,a);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&vp(l,t,e,i,a)}};Object.assign(Mp.prototype,Ep),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Mp(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Mp);var _p=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),_p(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Lp=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var o;return r>=0?((o=n[0]).x=t+r,o.y=e,(o=n[1]).x=i+r,o.y=e,(o=n[2]).x=i,o.y=s,(o=n[3]).x=t,o.y=s):((o=n[0]).x=t,o.y=e,(o=n[1]).x=i,o.y=e,(o=n[2]).x=i-r,o.y=s,(o=n[3]).x=t-r,o.y=s),n};const Bp=Phaser.Utils.Objects.GetValue,Ip=Phaser.Utils.Objects.IsPlainObject;class Dp extends(Gu($t)){constructor(t,e,i,s,r,n,a,o){Ip(e)?(e=Bp(o=e,"x",0),i=Bp(o,"y",0),s=Bp(o,"width",2),r=Bp(o,"height",2),n=Bp(o,"barColor",void 0),a=Bp(o,"value",0)):Ip(s)?(s=Bp(o=s,"width",2),r=Bp(o,"height",2),n=Bp(o,"barColor",void 0),a=Bp(o,"value",0)):Ip(n)&&(n=Bp(o=n,"barColor",void 0),a=Bp(o,"value",0)),super(t,e,i,s,r,Bp(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(Bp(o,"trackColor",void 0)),this.setBarColor(n,Bp(o,"barColor2",void 0),Bp(o,"isHorizontalGradient",void 0)),this.setTrackStroke(Bp(o,"trackStrokeThickness",2),Bp(o,"trackStrokeColor",void 0)),this.setSkewX(Bp(o,"skewX",0)),this.setRTL(Bp(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Rp.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new Dp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",Dp),Phaser.Math.Wrap;const jp=Phaser.Math.Linear;var Ap=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=jp(b.a.x,x.a.x,C),e=jp(b.a.y,x.a.y,C),i=jp(b.b.x,x.b.x,C),s=jp(b.b.y,x.b.y,C),r=jp(b.c.x,x.c.x,C),n=jp(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const zp=(0,Phaser.Math.DegToRad)(120);var Fp=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+zp),i+s*Math.sin(r+zp)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-zp),i+s*Math.sin(r-zp)),this.arrowOnly?t.end():t.close()},Yp={buildShapes(){this.addShape((new Kc).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?Ap.call(this):Fp.call(this)}},Xp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new su(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Wp=Phaser.Utils.Objects.GetValue,Vp=Phaser.Utils.Objects.IsPlainObject,Gp=Phaser.Math.DegToRad,Hp=Phaser.Math.RadToDeg;class Up extends fc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Vp(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=$p(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Wp(r,"x",null);null!==n?(t=n,i=n):(t=Wp(r,"left",0),i=Wp(r,"right",t));var a=Wp(r,"y",null);null!==a?(e=a,s=a):(e=Wp(r,"top",0),s=Wp(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Hp(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Gp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const Np={right:0,down:1,left:2,up:3};var $p=function(t){return"string"==typeof t&&(t=Np[t]),t%=4};Object.assign(Up.prototype,Yp,Xp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Up(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Up),F();const Kp=Phaser.GameObjects.Zone,Jp=Phaser.Utils.Array.Add,qp=Phaser.Utils.Array.Remove;let Zp=class extends Kp{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[]}destroy(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return Jp(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return qp(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;irg(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;erg(t).x,getChildLocalY:t=>rg(t).y};const xg=Phaser.Math.DegToRad;var Cg={updateChildRotation(t){var e=rg(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=rg(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return rg(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return rg(t).rotation=xg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=rg(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>rg(t).rotation},kg={updateChildScale(t){var e=rg(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=rg(t),i=e.parent;return e.scaleX=yg(t.scaleX,i.scaleX),e.scaleY=yg(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=rg(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=rg(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>rg(t).scaleX,getChildLocalScaleY:t=>rg(t).scaleY},wg={updateChildVisible(t){var e=rg(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=rg(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),rg(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),rg(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=rg(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>rg(t).visible},Sg={updateChildAlpha(t){var e=rg(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=rg(t),i=e.parent;return e.alpha=yg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return rg(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=rg(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>rg(t).alpha},Pg={updateChildActive(t){var e=rg(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return rg(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),rg(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=rg(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>rg(t).active},Tg={updateChildScrollFactor(t){var e=rg(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Og={updateCameraFilter(t){var e=rg(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Mg={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},Eg=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},_g={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Rg=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Bg=Phaser.Utils.Array;var Ig={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Nv=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const $v=/(\S+)\[(\d+)\]/i;var Kv={getInnerPadding(t){return Ts(this.space,t)},setInnerPadding(t,e){return Os(this.space,t,e),this},getOuterPadding(t){return Ts(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Os(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Ts(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Os(this.getSizerConfig(t).padding,e,i),this}},Jv=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},qv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Zv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},Qv=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},tf=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},ef=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},sf={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},rf=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var fm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=Ra(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},mm={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=h),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=h),this.transitOutCallback=t,this}},ym={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},bm={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},xm={};Object.assign(xm,fm,mm,ym,bm);const Cm=Phaser.Utils.Objects.GetValue;class km extends Ba{constructor(t,e){super(t,e),this.setTransitInTime(Cm(e,"duration.in",200)),this.setTransitOutTime(Cm(e,"duration.out",200)),this.setTransitInCallback(Cm(e,"transitIn")),this.setTransitOutCallback(Cm(e,"transitOut")),this.oneShotMode=Cm(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new vm(this,{eventEmitter:!1,initState:Cm(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(km.prototype,xm);const wm=Phaser.GameObjects.Rectangle;class Sm extends wm{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new _d(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Pm=Phaser.Utils.Objects.GetValue;class Tm extends Ba{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Pm(t,"hitAreaMode",0)),this.setEnable(Pm(t,"enable",!0)),this.setStopMode(Pm(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Om[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Om={default:0,fullWindow:1};const Mm=Phaser.Utils.Objects.GetValue;class Em extends Sm{constructor(t,e){super(t,Mm(e,"color",0),Mm(e,"alpha",.8)),this.touchEventStop=new Tm(this,{hitAreaMode:1})}}var _m={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,bf(t,e)},scaleDown(t,e){xf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,_f(t,e)},fadeOut(t,e){Rf(t,e,!1)}},Rm=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,_f(t,e,t.alpha)},Lm=function(t,e){Rf(t,e,!1)},Bm=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Gn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Im=Phaser.Utils.Objects.GetValue;let Dm=class extends km{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=jm.popUp),null==e.transitOut&&(e.transitOut=jm.scaleDown),e.destroy=Im(e,"destroy",!0),super(t,e);var i=Im(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new Em(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Im(i,"transitIn",Rm)),this.setCoverTransitOutCallback(Im(i,"transitOut",Lm)));var s=Im(e,"touchOutsideClose",!1),r=Im(e,"duration.hold",-1),n=Im(e,"timeOutClose",r>=0),a=Im(e,"anyTouchClose",!1);Im(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Im(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Bm(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=jm[t]),t){case jm.popUp:t=_m.popUp;break;case jm.fadeIn:t=_m.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=jm[t]),t){case jm.scaleDown:t=_m.scaleDown;break;case jm.fadeOut:t=_m.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const jm={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var Am=function(t,e){var i=new Dm(t,e);return i.on("open",(function(){t.emit("modal.open",i)})),i.on("close",(function(e){t.emit("modal.close",e,i)})),t.on("modal.requestClose",i.requestClose,i),i},zm=function(t,e){t.emit("modal.requestClose",e)},Fm=function(t){return t&&"function"==typeof t},Ym={modal(t,e){return Fm(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=Am(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return zm(this,t),this}},Xm=function(t,e,i,s,r){Fm(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Wm={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Xm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Xm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Xm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Xm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Xm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Xm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Xm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Xm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Xm.call(this,"shutdown",t,e,i,s),this}},Vm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Gm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Gm={},Hm=function(t,e,i,s){return function(t,e,i,s,r){var n,a=t.scene.sys.cameras.main,o=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return o?i(t,e.x,e.y,s,r):!!(n=Vm(e,a,!0))&&i(t,n.x,n.y,s,r);for(var h=t.scene.input.manager,l=h.pointersTotal,d=h.pointers,c=0;c=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const ry={press:0,pointerdown:0,release:1,pointerup:1};var ny={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new sy(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class ay extends gm{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const oy=Phaser.Utils.Objects.GetValue;class hy extends Ba{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new ay,this.parent.setInteractive(oy(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(oy(t,"enable",!0)),this.setCooldown(oy(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var ly={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Hm(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new hy(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new hy(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},dy={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},cy=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=Oy,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===My&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Oy,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=Ey,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Hm(t,s,e,i)}}const Oy=0,My=1,Ey="IDLE",_y=Phaser.Utils.Objects.GetValue,Ry=Phaser.Math.Distance.Between;class Ly extends Ty{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=By},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(_y(t,"time",250)),this.setTapInterval(_y(t,"tapInterval",200)),this.setDragThreshold(_y(t,"threshold",9)),this.setTapOffset(_y(t,"tapOffset",10));var e=_y(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(_y(t,"maxTaps",void 0)),this.setMinTaps(_y(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case By:this.state=Iy;break;case Iy:var t=this.lastPointer;Ry(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=Dy,this.state=Iy);break;case Dy:this.state=Iy}}onDragEnd(){this.state===Iy&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=Dy))}onDrag(){this.state!==By&&this.pointer.getDistance()>this.dragThreshold&&(this.state=By)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Iy){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=By):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=Dy:this.state=By)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===Dy&&(this.state=By)}get isTapped(){return this.state===Dy}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const By="IDLE",Iy="BEGIN",Dy="RECOGNIZED",jy=Phaser.Utils.Objects.GetValue;class Ay extends Ty{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=zy},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(jy(t,"threshold",9)),this.setHoldTime(jy(t,"time",251)),this}onDragStart(){this.state=Fy,0===this.holdTime&&(this.state=Yy)}onDragEnd(){this.state=zy}onDrag(){this.state!==zy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=zy)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===Fy&&t-this.pointer.downTime>=this.holdTime&&(this.state=Yy)}get isPressed(){return this.state===Yy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const zy="IDLE",Fy="BEGIN",Yy="RECOGNIZED",Xy=Phaser.Utils.Objects.GetValue;class Wy extends Ty{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=Vm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Vy},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Xy(t,"threshold",10)),this}onDragStart(){this.state=Gy,0===this.dragThreshold&&(this.state=Hy)}onDragEnd(){this.state=Vy}onDrag(){switch(this.state){case Gy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Hy,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case Hy:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=Vm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Hy}setDragThreshold(t){return this.dragThreshold=t,this}}const Vy="IDLE",Gy="BEGIN",Hy="RECOGNIZED",Uy=Phaser.Math.Distance.Between,Ny=Phaser.Math.Angle.Between;var $y={getDt:function(){return oc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Uy(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ny(e.x,e.y,t.x,t.y)}},Ky={"up&down":0,"left&right":1,"4dir":2,"8dir":3},Jy={};const qy=Phaser.Utils.Objects.GetValue,Zy=Phaser.Math.RadToDeg;class Qy extends Ty{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=tb},eventEmitter:!1};this.setRecongizedStateObject(new gm(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(qy(t,"threshold",10)),this.setVelocityThreshold(qy(t,"velocityThreshold",1e3)),this.setDirectionMode(qy(t,"dir","8dir")),this}onDragStart(){this.state=eb}onDragEnd(){this.state=tb}onDrag(){this.state===eb&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=ib))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===ib&&(this.state=tb)}get isSwiped(){return this.state===ib}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Ky[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=Jy),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Zy(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(Qy.prototype,$y);const tb="IDLE",eb="BEGIN",ib="RECOGNIZED",sb=Phaser.Utils.Objects.GetValue,rb=Phaser.Utils.Array.SpliceOne,nb=Phaser.Math.Distance.Between,ab=Phaser.Math.Angle.Between;class ob{constructor(t,e){var i=Ra(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(sb(e,"inputConfig",void 0)),this.setEventEmitter(sb(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(sb(t,"enable",!0)),this.bounds=sb(t,"bounds",void 0),this.tracerState=lb,this.pointers.length=0,q(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,q(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case lb:this.tracerState=db,this.onDrag1Start();break;case db:this.tracerState=cb,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],rb(this.pointers,e),this.tracerState){case db:this.tracerState=lb,this.onDrag1End();break;case cb:this.tracerState=db,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case db:this.onDrag1();break;case cb:this.onDrag2()}}}dragCancel(){return this.tracerState===cb&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=lb,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==cb)return 0;var t=this.pointers[0],e=this.pointers[1];return nb(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==cb)return 0;var t=this.pointers[0],e=this.pointers[1];return ab(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;hb.x=e.x-i.x,hb.y=e.y-i.y}else hb.x=0,hb.y=0;return hb}get centerX(){if(this.tracerState!==cb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==cb)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==cb)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==cb)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=ub,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Hm(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Hm(t,s,e,i)}}Object.assign(ob.prototype,dn);var hb={};const lb=0,db=1,cb=2,ub="IDLE",pb=Phaser.Utils.Objects.GetValue;class gb extends ob{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=vb},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(pb(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=fb,0===this.dragThreshold&&(this.state=mb)}onDrag2End(){this.state=vb}onDrag2(){switch(this.state){case fb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=this.distanceBetween;this.scaleFactor=t/this.prevDistance,this.prevDistance=t,this.state=mb}break;case mb:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===mb}setDragThreshold(t){return this.dragThreshold=t,this}}const vb="IDLE",fb="BEGIN",mb="RECOGNIZED",yb=Phaser.Math.RotateAround;var bb=function(t,e,i,s){return yb(t,e,i,s),t.rotation+=s,t},xb={};const Cb=Phaser.Utils.Objects.GetValue,kb=Phaser.Math.Angle.WrapDegrees,wb=Phaser.Math.Angle.ShortestBetween,Sb=Phaser.Math.RadToDeg,Pb=Phaser.Math.DegToRad;class Tb extends ob{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevAngle=void 0,i.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("rotatestart",i)},exit:function(){i.emit("rotateend",i)}}},init:function(){this.state=Mb},eventEmitter:!1};this.setRecongizedStateObject(new gm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Cb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=kb(Sb(this.angleBetween)),this.state=Eb,0===this.dragThreshold&&(this.state=_b)}onDrag2End(){this.state=Mb}onDrag2(){switch(this.state){case Eb:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=kb(Sb(this.angleBetween));this.angle=wb(this.prevAngle,t),this.prevAngle=t,this.state=_b}break;case _b:t=kb(Sb(this.angleBetween)),this.angle=wb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===_b}get rotation(){return Pb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var Ob={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=xb),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=Iv(s),$b(r)?(u.expandWidth=Kb(r,"width",!1),u.expandHeight=Kb(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?zn(t):n),u.expandHeight&&(t.minHeight=void 0===a?Fn(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}};const Qb=Qg.prototype.clear;var tx=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),Qb.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Ub.width=e.aspectRatio,Ub.height=1,Nb.width=l,Nb.height=d,l=(c=Wb(Ub,Nb,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),Hb(t,this)):of(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=zn(t)),void 0===d&&(d=Fn(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,Zm.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(ix,Zb,ex);var sx=function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null};const rx=Phaser.Utils.Objects.IsPlainObject,nx=Phaser.Utils.Objects.GetValue;class ax extends Xb{constructor(t,e,i,s,r,n){rx(e)?(e=nx(n=e,"x",0),i=nx(n,"y",0),s=nx(n,"width",void 0),r=nx(n,"height",void 0)):rx(s)&&(s=nx(n=s,"width",void 0),r=nx(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return sx(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(ax.prototype,ix);var ox=Phaser.Math.Distance.Between,hx=function(t,e,i){var s=t.width/2;return ox(s,s,e,i)<=s};const lx=Phaser.Math.Angle.Between,dx=Phaser.Math.Angle.Normalize;var cx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(hx(s,e,i)){var r=s.width/2,n=s.startAngle,a=lx(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=dx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},ux=function(){this.sizerChildren.knob.on("pointerdown",cx,this).on("pointermove",cx,this).setInteractive()};const px=Phaser.Math.Angle.Between,gx=Phaser.Math.Angle.Wrap;var vx=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;hx(s,e,i)&&yx.call(this,t)}},fx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case Cx:hx(s,e,i)&&yx.call(this,t);break;case kx:hx(s,e,i)?xx.call(this):bx.call(this)}}},mx=function(t,e,i){this.enable&&this.panPointer===t&&bx.call(this)},yx=function(t){this.panPointer=t,this.panState=kx},bx=function(){this.panPointer=void 0,this.panState=Cx},xx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=px(i.x,i.y,t.x,t.y),r=px(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=gx(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const Cx=0,kx=1;var wx=function(){this.sizerChildren.knob.on("pointerdown",vx,this).on("pointermove",fx,this).on("pointerup",mx,this).setInteractive(),this.panPointer=void 0,this.panState=Cx},Sx=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},Px={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:Sx,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(Sx.call(this,t)),e.layout&&e.layout()),this}};const Tx=Phaser.Utils.Objects.GetValue,Ox=Phaser.Math.Snap.To;class Mx extends(Gu(ax)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Tx(e,"background",void 0),s=Tx(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Tx(e,"textFormatCallback",void 0),Tx(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new hp(t,e);r.setDepth(Tx(e,"knobDepth",0)),r._value=-1,t.add.existing(r),this.add(r,"knob"),s&&(this.add(s,"text","center",0,!1),t.children.moveBelow(r,s)),this.addChildrenMap("background",i),this.addChildrenMap("knob",r),this.addChildrenMap("text",s),this.setEnable(Tx(e,"enable",void 0)),this.setGap(Tx(e,"gap",void 0)),this.setValue(Tx(e,"value",0),Tx(e,"min",void 0),Tx(e,"max",void 0));var n=Tx(e,"input",0);switch("string"==typeof n&&(n=Ex[n]),n){case 0:wx.call(this);break;case 1:ux.call(this)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t){return this.gap=t,this}get value(){return this.sizerChildren.knob.value}set value(t){void 0!==this.gap&&(t=Ox(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter))}}const Ex={pan:0,drag:0,click:1,none:-1};Object.assign(Mx.prototype,Px),t.register("knob",(function(t){var e=new Mx(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",Mx);const _x={arc:Sc,circle:Pc,curve:class extends kc{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;ethis.value)for(var d=0;dthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0?d.pop().setTexture(u,O):r(c,u,O),h&&c.add.existing(T),l){var M=b+k*P+a*k,E=x+w*S+o*w;T.setOrigin(a,o).setPosition(M,E).setScale(v,f).setRotation(m),vk(T,b,x,m)}C.push(T)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a))),e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode&&(s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))))};Object.assign(Pk.prototype,yk);const Ok={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new Pk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",Pk);const Mk=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,Ek=Phaser.Utils.Objects.GetValue,_k=Phaser.Math.Clamp;class Rk extends Mk{constructor(t){super({name:"rexDissolvePostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n// Scene buffer\nuniform sampler2D uMainSampler;\nuniform sampler2D uMainSampler2;\n\nuniform int resizeMode;\nuniform float progress;\nuniform float fromRatio;\nuniform float toRatio;\nvarying vec2 outFragCoord;\n// Effect parameters\nuniform float noiseX;\nuniform float noiseY;\nuniform float noiseZ;\nuniform float fromEdgeStart;\nuniform float fromEdgeWidth;\nuniform float toEdgeStart;\nuniform float toEdgeWidth;\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nvec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); }\nfloat Perlin(vec3 P) {\n vec3 i0 = mod289(floor(P)), i1 = mod289(i0 + vec3(1.0));\n vec3 f0 = fract(P), f1 = f0 - vec3(1.0), f = fade(f0);\n vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x), iy = vec4(i0.yy, i1.yy);\n vec4 iz0 = i0.zzzz, iz1 = i1.zzzz;\n vec4 ixy = permute(permute(ix) + iy), ixy0 = permute(ixy + iz0), ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0), gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n vec4 gx1 = ixy1 * (1.0 / 7.0), gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0); gx1 = fract(gx1);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0), sz0 = step(gz0, vec4(0.0));\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1), sz1 = step(gz1, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g0 = vec3(gx0.x,gy0.x,gz0.x), g1 = vec3(gx0.y,gy0.y,gz0.y),\n g2 = vec3(gx0.z,gy0.z,gz0.z), g3 = vec3(gx0.w,gy0.w,gz0.w),\n g4 = vec3(gx1.x,gy1.x,gz1.x), g5 = vec3(gx1.y,gy1.y,gz1.y),\n g6 = vec3(gx1.z,gy1.z,gz1.z), g7 = vec3(gx1.w,gy1.w,gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g0,g0), dot(g2,g2), dot(g1,g1), dot(g3,g3)));\n vec4 norm1 = taylorInvSqrt(vec4(dot(g4,g4), dot(g6,g6), dot(g5,g5), dot(g7,g7)));\n g0 *= norm0.x; g2 *= norm0.y; g1 *= norm0.z; g3 *= norm0.w;\n g4 *= norm1.x; g6 *= norm1.y; g5 *= norm1.z; g7 *= norm1.w;\n vec4 nz = mix(vec4(dot(g0, vec3(f0.x, f0.y, f0.z)), dot(g1, vec3(f1.x, f0.y, f0.z)),\n dot(g2, vec3(f0.x, f1.y, f0.z)), dot(g3, vec3(f1.x, f1.y, f0.z))),\n vec4(dot(g4, vec3(f0.x, f0.y, f1.z)), dot(g5, vec3(f1.x, f0.y, f1.z)),\n dot(g6, vec3(f0.x, f1.y, f1.z)), dot(g7, vec3(f1.x, f1.y, f1.z))), f.z);\n return 2.2 * mix(mix(nz.x,nz.z,f.y), mix(nz.y,nz.w,f.y), f.x);\n}\nfloat Perlin(vec2 P) { return Perlin(vec3(P, 0.0)); }\n\n\nvec4 getFromColor (vec2 uv) {\n return texture2D(uMainSampler, uv);\n}\n\nvec4 getToColor (vec2 uv) {\n if (resizeMode == 2) {\n // cover\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(min(fromRatio / toRatio, 1.0), min((toRatio / fromRatio), 1.0)));\n } else if (resizeMode == 1) {\n // contain\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(max(fromRatio / toRatio, 1.0), max((toRatio / fromRatio), 1.0)));\n } else {\n // stretch\n return texture2D(uMainSampler2, vec2(uv.x, 1.0 - uv.y));\n }\n}\n\nvec4 transition (vec2 uv) { \n vec4 colorFront = getFromColor(uv);\n vec4 colorTo = getToColor(uv);\n\n float noise = (Perlin(vec3(uv.x * noiseX, uv.y * noiseY, noiseZ)) + 1.0) / 2.0\n * (1.0 - (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth))\n + (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth) * 0.5;\n vec4 colorResult = colorFront * smoothstep(progress - (fromEdgeStart + fromEdgeWidth), progress - fromEdgeStart, noise)\n + colorTo * smoothstep((1.0 - progress) - (toEdgeStart + toEdgeWidth), (1.0 - progress) - toEdgeStart, (1.0 - noise));\n return colorResult;\n}\n\nvoid main () {\n vec2 uv = outFragCoord;\n gl_FragColor = transition(uv);\n}\n"}),this._progress=0,this.toFrame=null,this.targetTexture=null,this.resizeMode=1,this.toRatio=1,this.noiseX=0,this.noiseY=0,this.noiseZ=0,this.fromEdgeStart=.01,this.fromEdgeWidth=.05,this.toEdgeStart=.01,this.toEdgeWidth=.05}resetFromJSON(t){return this.setProgress(Ek(t,"progress",0)),this.setTransitionTargetTexture(Ek(t,"toTexture","__DEFAULT"),Ek(t,"toFrame",void 0),Ek(t,"resizeMode",1)),this.setNoise(Ek(t,"noiseX",void 0),Ek(t,"noiseY",void 0),Ek(t,"noiseZ",void 0)),this.setFromEdge(Ek(t,"fromEdgeStart",.01),Ek(t,"fromEdgeWidth",.05)),this.setToEdge(Ek(t,"toEdgeStart",.01),Ek(t,"toEdgeWidth",.05)),this}onBoot(){}onPreRender(){this.set1f("progress",this.progress),this.set1i("resizeMode",this.resizeMode),this.set1f("noiseX",this.noiseX),this.set1f("noiseY",this.noiseY),this.set1f("noiseZ",this.noiseZ),this.set1f("fromEdgeStart",this.fromEdgeStart),this.set1f("fromEdgeWidth",this.fromEdgeWidth),this.set1f("toEdgeStart",this.toEdgeStart),this.set1f("toEdgeWidth",this.toEdgeWidth)}onDraw(t){this.set1f("fromRatio",t.width/t.height),this.set1f("toRatio",this.toRatio),this.set1i("uMainSampler2",1),this.bindTexture(this.targetTexture,1),this.bindAndDraw(t)}get progress(){return this._progress}set progress(t){this._progress=_k(t,0,1)}setProgress(t){return this.progress=t,this}setTransitionTargetTexture(t,e,i){void 0===t&&(t="__DEFAULT");var s=this.game.textures.getFrame(t,e);return s||(s=this.game.textures.getFrame("__DEFAULT")),this.toRatio=s.width/s.height,this.toFrame=s,this.targetTexture=s.glTexture,void 0!==i&&(this.resizeMode=i),this}setResizeMode(t){return"string"==typeof t&&(t=Lk[t]),this.resizeMode=t,this}setNoise(t,e,i){return void 0===t&&(t=4+6*Math.random()),void 0===e&&(e=4+6*Math.random()),void 0===i&&(i=10*Math.random()),this.noiseX=t,this.noiseY=e,this.noiseZ=i,this}setFromEdge(t,e){return this.fromEdgeStart=t,this.fromEdgeWidth=e,this}setToEdge(t,e){return this.toEdgeStart=t,this.toEdgeWidth=e,this}}var Lk={stretch:0,contain:1,cover:2};const Bk=Phaser.Utils.Array.SpliceOne,Ik=.1,Dk=[function(t){t.addTransitionMode("slideAwayRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}})},function(t){t.addTransitionMode("slideRight",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(s-1);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideLeft",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(1-s);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideDown",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(s-1);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideUp",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(1-s);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("pushRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0),r=i.width*(s-1),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0),r=i.width*(1-s),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r),r=i.height*(s-1),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r),r=i.height*(1-s),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("zoomOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=1-s;t.setChildLocalScale(e,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1)}}).addTransitionMode("zoomIn",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=s;t.setChildLocalScale(i,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(i,1,1)}}).addTransitionMode("zoomInOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(r=1-Po(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-Po(s),t.setChildLocalScale(i,r,r))},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildLocalScale(i,1,1),t.setChildVisible(i,!0),i.tint=16777215}})},function(t){t.addTransitionMode("fade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(s=Po(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=Po(s),r=Math.floor(255*(1-s)),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}}).addTransitionMode("crossFade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){t.setChildLocalAlpha(e,1-s),t.setChildLocalAlpha(i,s)},onComplete:function(t,e,i,s){t.setChildLocalAlpha(e,1)}})},function(t){var e,i=(e=t.scene,new Hx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){this.getShape("rect").fillStyle(16777215).setSize(this.width*this.value,this.height*this.value).setCenterPosition(this.centerX,this.centerY)}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("irisOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Hx(e,{type:"Graphics",create:[{name:"pie",type:"arc"}],update:function(){var t=2*Math.max(this.width,this.height),e=90*this.value;this.getShape("pie").fillStyle(16777215).setCenterPosition(this.centerX,0).setRadius(t).setAngle(90-e,90+e).setPie()}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("pieOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=Po(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Hx(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){var t=this.getShape("rect").fillStyle(16777215),e=1-this.value;switch(this.wipeMode){case"right":t.setSize(this.width*e,this.height).setTopLeftPosition(this.width-t.width,0);break;case"left":t.setSize(this.width*e,this.height).setTopLeftPosition(0,0);break;case"down":t.setSize(this.width,this.height*e).setTopLeftPosition(0,this.height-t.height);break;case"up":t.setSize(this.width,this.height*e).setTopLeftPosition(0,0)}}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("wipeRight",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="right"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeLeft",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="left"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeDown",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="down"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeUp",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="up"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}})},function(t){var e=function(t,e){var i=new Hx(t,{type:"Graphics",create:{rectangle:e},update:function(){for(var t=this.getShapes(),i=this.width/e,s=0;s=0;s--)(a=r[s])instanceof e&&(a.destroy(),Bk(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,Rk),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ik,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ik,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ik,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Ik,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class jk extends Pk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=Dk.length;at.dropEnable}),this.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var s in this.filters){for(var r=this.filters[s],n=[],a=0,o=i.length;a0&&this.emit(`drop.${s}`,n)}}),this)}get files(){return this._files}}Object.assign(xw.prototype,vw),t.register("fileDropZone",(function(t){var e=new xw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",xw);const Cw=Phaser.Math.Wrap;var kw=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,a=0,o=n.length;a(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const Tw=Phaser.Utils.Objects.IsPlainObject,Ow=Phaser.Utils.Objects.GetValue,Mw=Phaser.Display.Align.CENTER,Ew={min:0,full:-1};var _w=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,p;jv.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=Ew[e];else if(Tw(e)){var f;e=Ow(f=e,"proportion",void 0),i=Ow(f,"align",Mw),s=Ow(f,"padding",0),r=Ow(f,"expand",!1),n=Ow(f,"key",void 0),a=Ow(f,"index",void 0),t.isRexSizer||(o=Ow(f,"minWidth",void 0),h=Ow(f,"minHeight",void 0)),l=Ow(f,"fitRatio",0),d=Ow(f,"offsetX",0),c=Ow(f,"offsetY",0),u=Ow(f,"offsetOriginX",0),p=Ow(f,"offsetOriginY",0)}return"string"==typeof i&&(i=iv[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Mw),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=zn(t)/Fn(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=Iv(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?zn(t):o:t.minHeight=void 0===h?Fn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Rw={add:_w,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),_w.call(this,new Sw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Tw(i)&&(i.index=t),_w.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Pw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Lw=Phaser.Utils.Array.Remove;var Bw={remove(t,e){return this.getParentSizer(t)!==this||(Lw(this.sizerChildren,t),Vv.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,tx.call(this,t),this}},Iw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=iv[e]),this.getSizerConfig(t).align=e,this}},Dw={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},jw={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},Aw={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},zw={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(of(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,rf.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Qv.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||qv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&kw.call(this,t,void 0),Zv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||tf.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&kw.call(this,void 0,t),ef.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(zw,Rw,Bw,Iw,Dw,jw,Aw);var Fw=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i};const Yw=Phaser.Utils.Objects.IsPlainObject,Xw=Phaser.Utils.Objects.GetValue;class Ww extends Xb{constructor(t,e,i,s,r,n,a){Yw(e)?(e=Xw(a=e,"x",0),i=Xw(a,"y",0),s=Xw(a,"width",void 0),r=Xw(a,"height",void 0),n=Xw(a,"orientation",0)):Yw(s)?(s=Xw(a=s,"width",void 0),r=Xw(a,"height",void 0),n=Xw(a,"orientation",0)):Yw(n)&&(n=Xw(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Xw(a,"space.item",0)),this.setStartChildIndex(Xw(a,"startChildIndex",0)),this.setRTL(Xw(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Pp(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Fw.call(this)),this._childrenProportion}}Object.assign(Ww.prototype,zw);var Vw=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Gw={appendText:Ei,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Hw extends Ww{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Vw(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Vw(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Vw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Vw(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Hw.prototype,Gw);var Uw=function(t,e,i,s){var r=new lk(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const Nw=Phaser.GameObjects.Text;var $w=function(t){return t instanceof Nw};const Kw=Phaser.GameObjects.BitmapText;var Jw=function(t){return t instanceof Kw},qw=function(t){return Jw(t)?2:$w(t)?0:1},Zw=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},tS=function(t,e){switch(qw(t)){case 0:switch("string"==typeof e&&(e=Ie[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Zw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Ie[e]||0),t.style.wrapMode=e}},eS=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof ln}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):Jw(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return $w(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const iS=65535;var sS=function(t,e,i){if(null==e)return t;if(0===e)return aS(t,0,i),t;var s=t.text.length;if(0===s)return aS(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},a=nS(t,r,e,i,n),o=0;o<=iS&&0!==a;o++){if((r+=a)<0){r=0;break}a=nS(t,r,e,i,n)}return o===iS&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),aS(t,e,i),t},rS=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},nS=function(t,e,i,s,r){var n,a=rS(t,e,r),o=rS(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},aS=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const oS=Phaser.Utils.Objects.GetValue;var hS=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=oS(e,"minWidth",0),s=oS(e,"minHeight",0),r=oS(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return sS(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),sS(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const lS=Phaser.Utils.Objects.GetValue;class dS extends Hw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=lS(e,"background",void 0),r=lS(e,"icon",void 0),n=lS(e,"iconMask",void 0),a=lS(e,"text",void 0),o=lS(e,"action",void 0),h=lS(e,"actionMask",void 0),l=lS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:lS(e,"space.icon",0),top:lS(e,"space.iconTop",0),bottom:lS(e,"space.iconBottom",0),left:lS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:lS(e,"space.icon",0),left:lS(e,"space.iconLeft",0),right:lS(e,"space.iconRight",0),top:lS(e,"space.iconTop",0)});var d=lS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Uw.call(this,r,r,1)),!d){var c=lS(e,"iconSize",void 0);this.setIconSize(lS(e,"iconWidth",c),lS(e,"iconHeight",c))}}if(a){var u=lS(e,"wrapText",!1),p=lS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),tS(a,u),e.expandTextWidth=!0,eS(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,hS(a,{fitHeight:!0}));var g,v,f=lS(e,"space.text",0),m=lS(e,"expandTextWidth",!1),y=lS(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:lS(e,"space.actionTop",0),bottom:lS(e,"space.actionBottom",0),right:lS(e,"space.actionRight",0)}:{left:lS(e,"space.actionLeft",0),right:lS(e,"space.actionRight",0),bottom:lS(e,"space.actionBottom",0)},d=lS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Uw.call(this,o,o,1)),!d)){var b=lS(e,"actionSize");this.setActionSize(lS(e,"actionWidth",b),lS(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}const cS=Phaser.Utils.Objects.GetValue;var uS=function(t,e){var i=cS(e,"canvas"),s=cS(i,"width",128),r=cS(i,"height",128),n=new Ru(t,0,0,s,r);t.add.existing(n);var a=cS(i,"key"),o=cS(i,"frame"),h=cS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const pS=Phaser.Utils.Objects.GetValue;var gS=function(t,e){var i=pS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const vS=Phaser.Utils.Objects.GetValue,fS={accept:"image/*",multiple:!1};var mS=function(t,e){if(0!==e.length){var i=t.childrenMap.icon,s=i.image,r=e[0];return s.loadFromFilePromise(r).then((function(){return i.scaleImage(),t.emit("select",r,t),Promise.resolve(r)}))}},yS={async openPromise(){var t=this;return rw(this.scene.game,fS).then((function(e){return mS(t,e.files)}))},open(){return this.openPromise(),this},setClickOpenEnable(t){return void 0===t&&(t=!0),this.clickBehavior&&this.clickBehavior.setEnable(t),this.fileChooser&&this.fileChooser.setOpenEnable(t),this}},bS={getFileName:function(t){if(!t)return null;var e=t.name;return e.substr(0,e.lastIndexOf("."))},saveTexture:function(t){return this.childrenMap.canvas.generateTexture(t),this}};Object.assign(bS,yS);const xS=Phaser.Utils.Objects.GetValue;class CS extends dS{constructor(t,e){var i=function(t,e){var i=new Xk(t,{scaleUp:cS(e,"scaleUpIcon",!1),background:cS(e,"iconBackground"),image:uS(t,e)});return t.add.existing(i),i}(t,e);e.icon=i,super(t,e),this.type="rexImageFileInputLabel";var s=this.iconWidth,r=this.iconWidth;void 0!==s&&void 0!==r&&i.resize(s,r),this.clickTarget=gS(this,e),this.clickTarget&&(xS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new cw(e,fS);return e.add.existing(i),t.pin(i),i.on("change",(function(){mS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=gS(t,e);if(i){var s=vS(e,"click"),r=new cu(i,s);return r.on("click",t.open,t),r}}(this,e)),this.addChildrenMap("canvas",i.image),this.addChildrenMap("iconBackground",i.background),this.addChildrenMap("fileChooser",this.fileChooser)}postLayout(t,e,i){this.fileChooser&&(this.fileChooser.syncTo(this.clickTarget),this.resetChildState(this.fileChooser)),super.postLayout(t,e,i)}}Object.assign(CS.prototype,bS),t.register("imageInputLabel",(function(t){var e=new CS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",CS);let kS=class extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const wS=Phaser.Utils.Objects.GetValue;class SS extends Ba{constructor(t,e){super(t,e),this.style=wS(e,"style",this);var i=wS(e,"propertiesMap");this.activeStyle=PS(e,"active",i),this.hoverStyle=PS(e,"hover",i),this.disableStyle=PS(e,"disable",i),this.onModifyStyle=wS(e,"onModifyStyle")}getStyle(t){return Dd(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return jd(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return TS.call(this,"active",t),this}setHoverState(t){return TS.call(this,"hover",t),this}setDisableState(t){return TS.call(this,"disable",t),this}}var PS=function(t,e,i){var s=Bd(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},TS=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},OS={addStyleManager(t){return this.styleManager=new SS(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};const MS=Phaser.GameObjects.Image,ES=Phaser.Utils.Objects.GetValue;class _S extends MS{constructor(t,e){void 0===e&&(e={}),super(t,ES(e,"x",0),ES(e,"y",0),ES(e,"key",""),ES(e,"frame",void 0)),this.type="rexStatesImage";var i=ES(e,"effects",!0);i&&En(this,i),this.style=new kS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(_S.prototype,OS),t.register("statesImage",(function(t){var e=new _S(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",_S);class RS extends At{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=LS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const LS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(RS.prototype,OS),t.register("statesRoundRectangle",(function(t){var e=new RS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",RS);let BS=class extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const IS=Phaser.GameObjects.NineSlice,DS=Phaser.Utils.Objects.GetValue;class jS extends IS{constructor(t,e){void 0===e&&(e={}),super(t,DS(e,"x",0),DS(e,"y",0),DS(e,"key",null),DS(e,"frame",null),DS(e,"width",0),DS(e,"height",0),DS(e,"leftWidth",0),DS(e,"rightWidth",0),DS(e,"topHeight",0),DS(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=DS(e,"effects",!0);i&&En(this,i),this.style=new BS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(jS.prototype,OS),t.register("statesNineSlice",(function(t){var e=new jS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",jS);let AS=class extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const zS=Phaser.Utils.Objects.GetValue;class FS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=zS(e,"effects",!0);i&&En(this,i),this.style=new AS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(FS.prototype,OS),t.register("statesNinePatch",(function(t){var e=new FS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",FS);const YS=Phaser.GameObjects.Text,XS=Phaser.Utils.Objects.GetValue;class WS extends YS{constructor(t,e){void 0===e&&(e={}),super(t,XS(e,"x",0),XS(e,"y",0),XS(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(WS.prototype,OS),t.register("statesText",(function(t){var e=new WS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",WS);class VS extends Ba{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get fontSize(){return this.parent.fontSize}set fontSize(t){this.parent.setFontSize(t)}get tint(){return this.parent.tintTopLeft}set tint(t){this.parent.setTint(t)}get letterSpacing(){return this.parent.letterSpacing}set letterSpacing(t){this.parent.setLetterSpacing(t)}get lineSpacing(){return this.parent.lineSpacing}set lineSpacing(t){this.parent.setLineSpacing(t)}}const GS=Phaser.GameObjects.BitmapText,HS=Phaser.Utils.Objects.GetValue;class US extends GS{constructor(t,e){void 0===e&&(e={});var i=HS(e,"x",0),s=HS(e,"y",0),r=HS(e,"font",""),n=HS(e,"fontSize",!1),a=HS(e,"align",0),o=HS(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=HS(e,"effects",!0);h&&En(this,h),this.style=new VS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(US.prototype,OS),t.register("statesBitmapText",(function(t){var e=new US(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",US);class NS extends pp{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),P(e,"easeValue.duration",e.easeDuration),P(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=$S,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const $S={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign(NS.prototype,OS),t.register("statesBarRectangle",(function(t){var e=new NS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",NS);var KS=function(t,e){void 0===e&&(e={}),void 0===e.options&&(e.options={});var i=e.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var s=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(s=!0,i.animation={});var r=i.animation;s&&(r.duration=0);var n=r.onProgress;r.onProgress=function(e){n&&n(e),t.needRedraw()};var a=r.onComplete;return r.onComplete=function(e){a&&a(e),t.needRedraw()},e};let JS=class extends Ru{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.type="rexChart",this.chart=void 0,void 0!==n&&this.setChart(n)}destroy(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),super.destroy(t))}resize(t,e){if(t===this.width&&e===this.height)return this;if(super.resize(t,e),this.chart){var i=this.chart;i.height=this.canvas.height,i.width=this.canvas.width,i.aspectRatio=i.height?i.width/i.height:null,i.update()}return this}};var qS={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,KS(this,t)),this):(console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');"),this)},getChartDataset:function(t){if(void 0!==this.chart){if("string"!=typeof t)return this.chart.data.datasets[t];for(var e,i=this.chart.data.datasets,s=0,r=i.length;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return nP(this.sizerChildren,null),tx.call(this,t),this}},oP={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,nP(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},cP={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=Qv.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,nP(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)nP(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},pP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const gP=Phaser.Utils.Objects.IsPlainObject,vP=Phaser.Utils.Objects.GetValue;class fP extends Xb{constructor(t,e,i,s,r,n,a,o,h,l){gP(e)?(e=vP(l=e,"x",0),i=vP(l,"y",0),s=vP(l,"width",void 0),r=vP(l,"height",void 0),n=vP(l,"column",l.col||0),a=vP(l,"row",0),o=vP(l,"columnProportions",0),h=vP(l,"rowProportions",0)):gP(s)?(s=vP(l=s,"width",void 0),r=vP(l,"height",void 0),n=vP(l,"column",l.col||0),a=vP(l,"row",0),o=vP(l,"columnProportions",0),h=vP(l,"rowProportions",0)):gP(n)?(n=vP(l=n,"column",l.col||0),a=vP(l,"row",0),o=vP(l,"columnProportions",0),h=vP(l,"rowProportions",0)):gP(o)&&(o=vP(l=o,"columnProportions",0),h=vP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(vP(l,"createCellContainerCallback")),this.setIndentLeft(vP(l,"space.indentLeftOdd",0),vP(l,"space.indentLeftEven",0)),this.setIndentTop(vP(l,"space.indentTopOdd",0),vP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,vP(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=uP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=pP.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(fP.prototype,cP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new fP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",fP);var mP=function(t,e,i,s){return e/t<=i?e/(s-1):0},yP=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=bP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=bP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const CP=Phaser.Utils.Objects.IsPlainObject,kP=Phaser.Utils.Objects.GetValue,wP=Phaser.Display.Align.CENTER;var SP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(jv.call(this,t),CP(e)&&(e=kP(h=e,"padding",0),i=kP(h,"key",void 0),s=kP(h,"index",void 0),r=kP(h,"offsetX",0),n=kP(h,"offsetY",0),a=kP(h,"offsetOriginX",0),o=kP(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=wP,h.padding=Iv(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},PP={add(t,e,i){if(Um(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,tx.call(this,t),this}},MP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const yT=Phaser.Utils.Objects.GetValue,bT=Phaser.Math.Distance.Between;class xT extends Ba{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=yT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(yT(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(yT(t,"enable",!0)),this.holdThreshold=yT(t,"holdThreshold",50),this.pointerOutReleaseEnable=yT(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return oc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:bT(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Hm(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Hm(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const CT=Phaser.Utils.Objects.GetValue;class kT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(CT(t,"value",0)),this.setSpeed(CT(t,"speed",0)),this.setAcceleration(CT(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class wT{constructor(){this.value,this.dir,this.movement=new kT}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const OT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},MT=Phaser.Utils.Objects.GetValue;class ET extends Ba{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=MT(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(MT(e,"speed",.1)),this.setEnable(MT(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(MT(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Hm(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const _T=Phaser.Utils.Objects.GetValue;var RT=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?_T(s,l,void 0):_T(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Ge(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new fT(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=_T(r,"tickLength",void 0);var p=_T(r,"position",0);"string"==typeof p&&(p=LT[p]);var g,v,f=_T(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=_T(s,"space.slider",void 0))&&(o?f=0:g=_T(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:_T(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:_T(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:_T(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:_T(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=_T(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=_T(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=_T(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=_T(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=_T(s,"scrollDetectionMode");"string"==typeof b&&(b=BT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?_T(s,x,!0):_T(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new TT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=_T(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new ET(h,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(k=a?"t":"s",S=`scroll${i}`):(k="t",S="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(S,t)}))),y&&(o?(w=`childO${i}`,S=`scroll${i}`):(w="childOY",S="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(S,t)}))),C&&(P=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const LT={right:0,left:1,bottom:0,top:1},BT={gameObject:0,rectBounds:1},IT=Phaser.Utils.Objects.GetValue;var DT=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=IT(e,"width"),a=IT(e,"height");n||IT(e,"child.expandWidth",!0)||(s[1]=0),a||IT(e,"child.expandHeight",!0)||(r[1]=0);var o=new fP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=XP(i,"child"),r=XP(s,"gameObject",void 0);if(r){var n=XP(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=XP(n,"top",0),a.bottom=XP(n,"bottom",0),o.left=XP(n,"left",0),o.right=XP(n,"right",0);break;case 1:a.top=XP(n,"left",0),a.bottom=XP(n,"right",0),o.top=XP(n,"top",0),o.bottom=XP(n,"bottom",0);break;default:a.top=XP(n,"top",0),a.bottom=XP(n,"bottom",0),a.left=XP(n,"left",0),a.right=XP(n,"right",0)}e.add(r,{column:1,row:1,align:XP(s,"align","center"),padding:o,expand:{width:XP(s,"expandWidth",!0),height:XP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:RT(t,o,"y",e);break;case 1:RT(t,o,"x",e);break;default:RT(t,o,"y",e),RT(t,o,"x",e)}return o},jT=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},AT=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},zT=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},HT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},UT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},NT=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var s=this.lines.getLineStartIndex(t),r=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(s,r,!0)}return e},$T=function(t,e){switch(qw(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}},KT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&JT.call(this)},JT=function(){if(this.textObject.setCrop){var t,e,i=this.textObject.rexSizer.offsetY;i<=0?(t=-i,e=this.height):(t=0,e=this.height-i),this.textObject.setCrop(0,t,this.width,e)}},qT=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var s=t.style,r=Math.max(e,0);0===this.textObjectType?s.wordWrapWidth=r:(0===s.wrapMode&&(s.wrapMode=1),s.wrapWidth=r);break;case 2:t.setMaxWidth(e)}this.setText()}},ZT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=GT(this.textObject,this.text,this.lines),this.linesCount=this.lines.length,this._textHeight=void 0,this._textVisibleHeight=void 0,this.updateTextObject(),this},updateTextObject:function(){var t=Math.max(Math.floor(HT.call(this,-this.textOY)),0),e=UT.call(this,t)+this.textOY,i=NT.call(this,t);return $T(this.textObject,i),this.textObject.rexSizer.offsetY=e,KT.call(this),this},preLayout:function(){return this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,rf.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,qT.call(this,t,n,a),Tv(t,s,r,n,a,e.align),e.preOffsetY=0,KT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const QT=Phaser.Utils.Objects.IsPlainObject,tO=Phaser.Utils.Objects.GetValue,eO=Phaser.Display.Align.TOP_LEFT;class iO extends Xb{constructor(t,e,i,s,r,n){QT(e)?(e=tO(n=e,"x",0),i=tO(n,"y",0),s=tO(n,"width",void 0),r=tO(n,"height",void 0)):QT(s)&&(s=tO(n=s,"width",void 0),r=tO(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=tO(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(tO(n,"clampTextOY",!0)),this.alwaysScrollable=tO(n,"alwaysScrollable",!1);var a=tO(n,"background",void 0),o=tO(n,"text",void 0);void 0===o&&(o=sO(t)),this.textCropEnable=tO(n,"textCrop",!!o.setCrop);var h=tO(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=eO,l.padding=Iv(0),l.expand=!0,this.textObject=o,this.textObjectType=qw(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Uw.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(HT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=UT.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var sO=function(t){return t.add.text(0,0,"")};Object.assign(iO.prototype,ZT);var rO={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},nO={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const aO=Phaser.Utils.Objects.GetValue;class oO extends WT{constructor(t,e){void 0===e&&(e={});var i=aO(e,"text",void 0),s=aO(e,"textWidth",void 0),r=aO(e,"textHeight",void 0),n=aO(e,"textCrop",!!i.setCrop),a=aO(e,"textMask",!n),o=aO(e,"content",""),h=new iO(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:aO(e,"clampChildOY",!1),alwaysScrollable:aO(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=aO(e,"space",void 0);l&&(l.child=aO(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(oO.prototype,rO,nO);const hO=Phaser.Utils.Objects.GetValue;var lO=function(t,e,s){e=e?i(e):{};var r=hO(s,"background",AP),n=hO(s,"text",dO),a=hO(s,"track",AP),o=hO(s,"thumb",AP);r?e.background=r(t,e.background):delete e.background,n?e.text=n(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),a?h.track=a(t,h.track):delete h.track,o?h.thumb=o(t,h.thumb):delete h.thumb,e.slider=h);var l=new oO(t,e);return t.add.existing(l),l},dO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new US(t,e);break;case"bbcodetext":case"bbcode":s=new cs(t,0,0,"",e);break;case"label":s=new gO(t,e);break;case"textarea":s=lO(t,e);break;default:s=new WS(t,e)}return jP(s,e),t.add.existing(s),s},cO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new FS(t,e):new jS(t,e);break;case"roundRectangle":s=new RS(t,e);break;default:s=new _S(t,e)}return jP(s,e),t.add.existing(s),s};const uO=Phaser.Utils.Objects.GetValue;var pO=function(t,e,s){e=e?i(e):{};var r=uO(s,"background",AP),n=uO(s,"text",dO),a=uO(s,"icon",cO),o=uO(s,"action",cO);return null!==e.background&&r?e.background=r(t,e.background):delete e.background,null!==e.text&&n?e.text=n(t,e.text):delete e.text,null!==e.icon&&a?e.icon=a(t,e.icon):delete e.icon,null!==e.action&&o?e.action=o(t,e.action):delete e.action,e};class gO extends dS{constructor(t,e,i){super(t,e=pO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return vO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return vO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return vO(this.getChildren(),"setDisableState",t),this}}var vO=function(t,e,i){for(var s=0,r=t.length;sthis.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=BO(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(Um(s)||(s=jc(zO,i,1)),BO(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=YO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=FO[t]),this.timeUnit=t,this}}var zO=[];const FO={ms:0,s:1,sec:1},YO={abs:0,absolute:0,inc:1,increment:1};var XO=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,h).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},WO={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const VO=Phaser.Utils.Objects.GetValue;class GO extends RO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(VO(e,"easeDuration",1e3)),this.levelCounter=new LO(VO(e,"levelCounter")),this.player=new AO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",XO,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}Object.assign(GO.prototype,WO),t.register("expBar",(function(t){var e=new GO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",GO);const HO=Ww.prototype.add,UO=Ww.prototype.addSpace;var NO=function(t){var e=!t.isRexSpace,i=!e||this.buttonsExpand?1:0;if(0===this.sizerChildren.length)if(e){!this.buttonsExpand&&("right"===this.buttonsAlign||"center"===this.buttonsAlign||"bottom"===this.buttonsAlign)&&UO.call(this),HO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&UO.call(this),this.hasTailSpace=s}else HO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;HO.call(this,t,{index:r,proportion:i,expand:!0})}else HO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},$O={addButton(t){if(Um(t))for(var e=t,i=0,s=e.length;i=0;i--)qO.call(this,e[i],t);return this}},QO=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},tM=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,QO.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},eM={add(t){return this.buttons.push(t),t._click||(t._click=new cu(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),tM.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)mM.call(this,e[i],t);return this}};const bM=Phaser.Utils.Objects.GetValue;class xM extends fP{constructor(t,e){void 0===e&&(e={});var i=bM(e,"row",0),s=bM(e,"column",e.col||0),r=bM(e,"createCellContainerCallback"),n=bM(e,"buttons",void 0),a=bM(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;hr&&CM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)TM.call(this,e[i],t);return this}};const MM=Phaser.Utils.Objects.GetValue;class EM extends BP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new hM({parent:this,eventEmitter:MM(e,"eventEmitter",this),groupName:MM(e,"groupName",void 0),clickConfig:MM(e,"click",void 0)}).setButtonsType(e);var s=MM(e,"background",void 0),r=MM(e,"buttons",void 0);this.buttonsAlign=MM(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(EM.prototype,wM,OM,oM,dM),t.register("fixWidthButtons",(function(t){var e=new EM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",EM);var _M={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const RM=Phaser.Utils.Objects.GetValue;class LM extends dS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new cw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(RM(e,"accept","")),this.setMultiple(RM(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}Object.assign(LM.prototype,_M),t.register("fileSelectorButton",(function(t){var e=new LM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",LM);var BM={getChoice(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable(t){var e=this.childrenMap.choicesSizer;return!!e&&e.getButtonEnable(t)},getActionEnable(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this},hasAnyChoice(){var t=this.childrenMap.choicesSizer;return!!t&&t.hasAnyButton()},hasAnyAction(){var t=this.childrenMap.actionsSizer;return!!t&&t.hasAnyButton()},hasAnyToolbar(){var t=this.childrenMap.toolbarSizer;return!!t&&t.hasAnyButton()},hasAnyLeftToolbar(){var t=this.childrenMap.leftToolbarSizer;return!!t&&t.hasAnyButton()}},IM={onCreateModalBehavior(t){t.on("button.click",(function(e,i,s,r,n){var a=!1;switch(i){case"actions":a=!0;break;case"choices":t.hasAnyAction()||(a=!0)}if(a){var o={index:s,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0}t.modalClose(o)}}))},modal(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,Ym.modal.call(this,t,e),this}},DM={};Object.assign(DM,BM,IM);const jM=Phaser.Utils.Objects.GetValue;class AM extends Ww{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=jM(e,"eventEmitter",this);var i,s,r,n,a=jM(e,"background",void 0),o=jM(e,"title",void 0),h=jM(e,"toolbar",void 0),l=jM(e,"toolbarBackground",void 0),d=jM(e,"leftToolbar",void 0),c=jM(e,"leftToolbarBackground",void 0),u=jM(e,"content",void 0),p=jM(e,"description",void 0),g=jM(e,"choices",void 0),v=jM(e,"choicesBackground",void 0),f=jM(e,"actions",void 0),m=jM(e,"actionsBackground",void 0),y=jM(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new uM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:jM(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new uM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:jM(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&jM(e,"expand.title",!0),C=jM(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new Ww(t,{orientation:0}):new ax(t),t.add.existing(b);var w=!!k||{height:!0};if(n&&b.add(n,{align:"left",expand:w}),o){k&&!x&&"right"===C&&b.addSpace();var S={left:jM(e,"space.titleLeft",0),right:jM(e,"space.titleRight",0)},P=x?1:0;b.add(o,{align:C,proportion:P,expand:w,padding:S}),k&&!x&&"left"===C&&b.addSpace()}r&&(k&&!o&&b.addSpace(),b.add(r,{align:"right",expand:w})),(u||p||g||f)&&(S={bottom:jM(e,"space.title",0),top:jM(e,"space.titleTop",0)}),P=jM(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=jM(e,"align.content","center"),O=jM(e,"space.content",0),M=(S={left:jM(e,"space.contentLeft",0),right:jM(e,"space.contentRight",0),bottom:p||g||f?O:0},P=jM(e,"proportion.content",0),jM(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=jM(e,"align.description","center");var E=jM(e,"space.description",0);S={left:jM(e,"space.descriptionLeft",0),right:jM(e,"space.descriptionRight",0),bottom:g||f?E:0},P=jM(e,"proportion.description",0),M=jM(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=jM(e,"choicesType","").split("-"),R=zM(_,"wrap")?EM:zM(_,"grid")?xM:uM,L=zM(_,"radio")?"radio":zM(_,"checkboxes")?"checkboxes":void 0,B={left:jM(e,"space.choicesBackgroundLeft",0),right:jM(e,"space.choicesBackgroundRight",0),top:jM(e,"space.choicesBackgroundTop",0),bottom:jM(e,"space.choicesBackgroundBottom",0)},I=jM(e,"space.choice",0);R===uM?B.item=I:R===EM?(B.item=I,B.line=jM(e,"space.choiceLine",I)):(B.column=jM(e,"space.choiceColumn",I),B.row=jM(e,"space.choiceRow",I));var D={width:jM(e,"choicesWidth",void 0),height:jM(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:jM(e,"choicesSetValueCallback",void 0),setValueCallbackScope:jM(e,"choicesSetValueCallbackScope",void 0)};R===uM&&(D.orientation=zM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var j=jM(e,"space.choices",0);S={left:jM(e,"space.choicesLeft",0),right:jM(e,"space.choicesRight",0),bottom:f?j:0},T=jM(e,"align.choices","center"),P=jM(e,"proportion.choices",0),M=jM(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new uM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:jM(e,"space.action",0)},expand:jM(e,"expand.actions",!1),align:jM(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:jM(e,"space.actionsLeft",0),right:jM(e,"space.actionsRight",0),bottom:jM(e,"space.actionsBottom",0)},P=jM(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),YM(this,"click"),YM(this,"over"),YM(this,"out"),YM(this,"enable"),YM(this,"disable"),this.addChildrenMap("background",a),this.addChildrenMap("title",o),this.addChildrenMap("toolbar",h),this.addChildrenMap("leftToolbar",d),this.addChildrenMap("content",u),this.addChildrenMap("description",p),this.addChildrenMap("choices",i?i.buttons:void 0),this.addChildrenMap("actions",s?s.buttons:void 0),this.addChildrenMap("choicesSizer",i),this.addChildrenMap("actionsSizer",s),this.addChildrenMap("toolbarSizer",r),this.addChildrenMap("leftToolbarSizer",n)}}var zM=function(t,e){return-1!==t.indexOf(e)},FM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},YM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){FM.hasOwnProperty(s)&&t.emit(`${FM[s]}.${e}`,i,r,n,a)}))};Object.assign(AM.prototype,DM),t.register("dialog",(function(t){var e=new AM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",AM);var XM=function(t,e,i){var s=new gO(t,e,i);return t.add.existing(s),s},WM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},VM=function(t){var e=this.childrenMap.content;if(null===(t=t.content))e.hide();else if(e.show(),e.resetDisplayContent)e.resetDisplayContent(t);else{var i=t||"";e.setText(i)}},GM=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var s=this.scene,r=this.defaultActionConfig,n=this.defaultActionButtonCreator,a=0,o=i.length;a=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var a=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=ZE(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;sthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(H_.prototype,X_);const U_=["top","bottom","centerY","center"],N_=["left","right","centerX","center"];var $_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=U_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=N_.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const K_=Phaser.Utils.Objects.GetValue;class J_ extends WT{constructor(t,e){void 0===e&&(e={});var i=FP(e),s=K_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=K_(e,"clampChildOY",!1),s.clampChildOX=K_(e,"clampChildOX",!1);var r,n,a=new H_(t,s);switch(t.add.existing(a),i){case 0:r=K_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=K_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:K_(e,"align.panel","center")};var o=K_(e,"space",void 0);o&&(o.child=K_(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),zb(this.childrenMap.child,t),this}}var q_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:$_.call(this,t,"y",e);break;case 1:$_.call(this,t,"x",e);break;default:$_.call(this,t,"y",e),$_.call(this,t,"x",e)}return this}};Object.assign(J_.prototype,q_);const Z_=Phaser.Utils.Objects.GetValue;var Q_=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=tR(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=eR(e,this.listCreateSliderTrackCallback),g=eR(e,this.listCreateSliderThumbCallback);d=new J_(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:Z_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=tR(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},tR=function(t,e,i){var s;return i?(e.orientation="x",s=new EM(t,e)):(e.orientation="y",s=new uM(t,e)),t.add.existing(s),s},eR=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const iR=Phaser.Utils.Objects.GetValue;var sR=function(t,e){var i=iR(e,"expandDirection",void 0);"string"==typeof i&&(i=rR[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Md(s=e,r="alignTarget")?J(s,r):n&&Md(s,n)?J(s,n):a&&Md(s,a)?J(s,a):o),c=iR(e,"alignTargetY",d),u=iR(e,"alignOffsetX",0),p=iR(e,"alignOffsetY",0),g=iR(e,"alignSide","").includes("right"),v=iR(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=ha(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const rR={down:0,up:1},nR=Phaser.Utils.Objects.GetValue;class aR extends km{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){bf(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new mf(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),sR(t,e),t.isRexSizer&&t.layout();var i=nR(e,"touchOutsideClose",!1),s=nR(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Bm(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var oR={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},hR={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=Q_.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new aR(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(hR,F_,oR);const lR=Phaser.Utils.Objects.GetValue;class dR extends dS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(lR(e,"options"));var i=lR(e,"list");this.setWrapEnable(lR(i,"wrap",!1)),this.setCreateButtonCallback(lR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(lR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(lR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(lR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(lR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(lR(i,"scroller")),this.setListMouseWheelScrollerConfig(lR(i,"mouseWheelScroller")),this.setButtonClickCallback(lR(i,"onButtonClick")),this.setButtonOverCallback(lR(i,"onButtonOver")),this.setButtonOutCallback(lR(i,"onButtonOut")),this.setListExpandDirection(lR(i,"expandDirection")),this.setListEaseInDuration(lR(i,"easeIn",500)),this.setListEaseOutDuration(lR(i,"easeOut",100)),this.setListTransitInCallback(lR(i,"transitIn")),this.settListTransitOutCallback(lR(i,"transitOut")),this.setListMaxHeight(lR(i,"maxHeight",0)),this.setListSize(lR(i,"width"),lR(i,"height",0)),this.setListAlignmentMode(lR(i,"alignParent","text")),this.setListAlignmentSide(lR(i,"alignSide","")),this.setListBounds(lR(i,"bounds")),this.setListSpace(lR(i,"space")),this.setListDraggable(lR(i,"draggable",!1)),this.setValueChangeCallback(lR(e,"setValueCallback"),lR(e,"setValueCallbackScope")),this.setValue(lR(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(dR.prototype,hR),t.register("dropDownList",(function(t){var e=new dR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",dR);var cR=function(t,e,s){void 0===s&&(s={});var r=(e=e?i(e):{}).label||e.button,n=e.button||e.label;delete e.label,delete e.button;var a=s.label||s.button||s,o=s.button||s.label||s,h=pO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=XM(t,n,o).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var l=e.track;l&&(h.list.createTrackCallback=function(t){return AP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return AP(t,d)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h};class uR extends dR{constructor(t,e,i){super(t,e=cR(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(mR,pR,vR,fR);const yR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class bR extends Ba{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=qw(this.parent),this.pageStartIndexes=[],this.lines=GT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(yR(t,"maxLines",void 0)),this.setPageBreak(yR(t,"pageBreak","\f\n")),this.setText(yR(t,"text","")),this.startLineIndex=yR(t,"start",-1),this.endLineIndex=yR(t,"end",void 0);var e=yR(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(qw(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(bR.prototype,mR);var xR={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?$T(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(ze(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},CR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},kR=function(t,e){for(var i=void 0,s=0;s0?wR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=wR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},PR={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=CR(this.parent,t);n=kR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)SR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(PR,xR);const TR=Phaser.Utils.Objects.GetFastValue,OR=Phaser.Utils.Objects.GetValue;class MR extends Ba{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(OR(t,"wrap",!1)),this.setTypeMode(OR(t,"typeMode",0)),this.setTypingSpeed(OR(t,"speed",333)),this.setTextCallback=TR(t,"setTextCallback",null),this.setTextCallbackScope=TR(t,"setTextCallbackScope",null),this.setTypingContent(TR(t,"text","")),this.typingIndex=TR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=TR(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=ER[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=ze(t);this.textWrapEnable&&(e=function(t,e){switch(qw(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=CR(this.parent,this.text).length,this}onTyping(){var t=SR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?$T(this.parent,t):this.parent.setText(t)}}const ER={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(MR.prototype,PR);const _R=Phaser.Utils.Objects.GetValue,RR={page:0,line:1};class LR extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=_R(i,"expandTextWidth",!1),n=_R(i,"expandTextHeight",!1);if(r||n){var a=qw(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(_R(i,"typingMode","page")),this.page=new bR(s,_R(i,"page",void 0)),this.typing=new MR(s,_R(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=RR[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(xO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new LR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",LR);class BR extends LR{constructor(t,e,i){super(t,e=kO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new BR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",BR);const IR=Phaser.Utils.Objects.GetValue;class DR extends Ww{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=IR(e,"background",void 0),a=IR(e,"icon",void 0),o=IR(e,"iconMask",void 0),h=IR(e,"slider",void 0),l=IR(e,"text",void 0),d=IR(e,"space.icon",0),c=IR(e,"space.slider",0);(n&&this.addBackground(n),a&&(0===this.orientation?(h||l)&&(s={right:d}):(h||l)&&(s={bottom:d}),this.add(a,{proportion:0,align:"center",padding:s}),o&&(o=Uw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new uT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===IR(h,"width",void 0)?1:0:void 0===IR(h,"height",void 0)?1:0,this.add(i,{proportion:r,align:"center",padding:s}));l&&this.add(l),this.addChildrenMap("background",n),this.addChildrenMap("icon",a),this.addChildrenMap("iconMask",o),this.addChildrenMap("slider",i),this.addChildrenMap("text",l);var u=IR(e,"valuechangeCallback",null);if(null!==u){var p=IR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(IR(e,"enable",void 0)),this.setValue(IR(e,"value",0))}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}get text(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")}set text(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t))}setText(t){return this.text=t,this}}t.register("numberBar",(function(t){var e=new DR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",DR),t.register("scrollBar",(function(t){var e=new fT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",fT);const jR=Phaser.Utils.Objects.GetValue,AR={leftTop:"left-top",centerTop:"center-top",rightTop:"right-top",leftCenter:"left-center",center:"center",rightCenter:"right-center",leftBottom:"left-bottom",centerBottom:"center-bottom",rightBottom:"right-bottom"};class zR extends ax{constructor(t,e){super(t,e),this.type="rexBadge";var i=jR(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=jR(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),AR){var n=jR(e,r,void 0);n&&(this.add(n,{key:r,align:AR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new zR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",zR);const FR=ax.prototype.add;var YR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),FR.call(this,t,e,i,s,r,n,a,o,h),this},XR={add:YR,addPage:YR};const WR=Qg.prototype.setChildVisible;var VR={getPage:function(t){return void 0===t?null:this.sizerChildren.hasOwnProperty(t)?this.sizerChildren[t]:null},swapPage:function(t,e){this._previousKey=this._currentKey;var i=this.previousPage;i&&(0===this.swapMode?(WR.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(WR.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(VR,XR);const GR=Phaser.Utils.Objects.GetValue;class HR extends ax{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(GR(e,"swapMode",0)),this.setFadeInDuration(GR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=UR[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(HR.prototype,VR);const UR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new HR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",HR);const NR=Phaser.GameObjects.Mesh;class $R extends NR{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const KR=Phaser.Math.Vector3,JR=Phaser.Math.Matrix4;var qR=new KR,ZR=new KR,QR=new JR;const tL=Phaser.Utils.Objects.IsPlainObject,eL=Phaser.Utils.Objects.GetValue,iL=Phaser.Geom.Mesh.GenerateGridVerts,sL=Phaser.Math.RadToDeg,rL=Phaser.Math.DegToRad,nL=1+1/Math.sin(rL(45));let aL=class extends $R{constructor(t,e,i,s,r,n){tL(e)&&(e=eL(n=e,"x",0),i=eL(n,"y",0),s=eL(n,"key",null),r=eL(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(nL),this.hideCCW=eL(n,"hideCCW",!0);var a=eL(n,"gridWidth",0),o=eL(n,"gridHeight",a);this.resetVerts(a,o),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,iL({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return sL(this.rotationX)}set angleX(t){this.rotationX=rL(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return sL(this.rotationY)}set angleY(t){this.rotationY=rL(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return sL(this.rotationZ)}set angleZ(t){this.rotationZ=rL(t)}transformVerts(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=r,this.transformInfo.rotateZ=n,function(t,e,i,s,r,n,a){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),qR.set(e,i,s),ZR.set(r,n,a),QR.fromRotationXYTranslation(ZR,qR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},UL={top:1,left:3,right:5,bottom:7},NL={top:"bottom",left:"right",right:"left",bottom:"top"},$L={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},KL={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i=a.y)continue;break;case 2:if(n.x<=a.x)continue;break;case 3:if(n.x>=a.x)continue}JB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},QB={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if($B.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;KB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return ZB(this,e,this.transitInTime),this},removeMessage(t){if(this.getParentSizer(t)!==this)return this;if(!t.__isDestroying){t.__isDestroying=!0;var e=this.transitOutTime;return this.transitOutCallback(t,e,this),KB.call(t,e+10,(function(){delete t.__isDestroying,t.destroy()})),this}},removeAllMessages(){for(var t=this.childrenMap.items,e=0,i=t.length;e0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new $I(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a},JI={openColorPicker:function(){if(!this.colorPicker){var t=KI.call(this).layout(),e=new aR(t,{duration:{in:this.colorPickerEaseInDuration,out:this.colorPickerEaseOutDuration},transitIn:this.colorPickerTransitInCallback,transitOut:this.colorPickerTransitOutCallback,expandDirection:this.colorPickerExpandDirection,alignTargetX:this,alignTargetY:this,bounds:this.colorPickerBounds,touchOutsideClose:!0}).on("open",(function(){t.on("valuechange",(function(t){this.setValue(t)}),this)}),this).on("close",(function(){this.colorPicker=void 0,this.dropDownBehavior=void 0}),this);return this.colorPicker=t,this.dropDownBehavior=e,this.pin(t),this}}};Object.assign(JI,mI);const qI=Phaser.Utils.Objects.GetValue;class ZI extends fI{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(qI(i,"width",160),qI(i,"height",170));var n=qI(i,"background");r=n?function(t){return AP(t,n)}:qI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(qI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(qI(i,"expandDirection")),this.setColorPickerEaseInDuration(qI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(qI(i,"easeOut",200)),this.setColorPickerTransitInCallback(qI(i,"transitIn")),this.setColorPickerTransitOutCallback(qI(i,"transitOut")),this.setColorPickerBounds(qI(i,"bounds"));var a=qI(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(qI(o,"height",30)),this.setColorComponentsFormatLabelConfig(qI(o,"formatLabel"));var h=qI(o,"inputText");h||(h=qI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=qI(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(ZI.prototype,JI),t.register("colorInput",(function(t){var e=new ZI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",ZI),t.register("colorInputLite",(function(t){var e=new fI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",fI),t.register("colorPicker",(function(t){var e=new FI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",FI),t.register("colorComponents",(function(t){var e=new UI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",UI);var QI=function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&b0&&xh;d--){for(c=0;c0&&this.wrapMode!==_e&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=Ie[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var o in a){var h=a[o],l=h[0],d=i?h[1]:this[o],c=h[2];if("wrapCallback"===o||"wrapCallbackScope"===o)this[o]=je(t,l,d);else{var u=De(t,l,d);c&&(u=c(u)),this[o]=u}}var p=je(t,"font",null);this._font=null===p?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:p;var g=je(t,"fill",null);null!==g&&(this.color=qt(g));var v=je(t,"metrics",!1);return v?this.metrics={ascent:je(v,"ascent",0),descent:je(v,"descent",0),fontSize:je(v,"fontSize",0)}:!e&&this.metrics||(this.metrics=Te(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=Te(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=je(t,"fontFamily","Courier"),this.fontSize=je(t,"fontSize","16px"),this.fontStyle=je(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=qt(t,this.parent.canvas,this.parent.context),this.backgroundColor2=qt(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=qt(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=qt(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=qt(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=qt(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=qt(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=qt(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=Ie[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=je(e,"fontFamily",this.fontFamily),this.fontSize=je(e,"fontSize",this.fontSize),this.fontStyle=je(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}};var ze=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t},Fe={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),se(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration),t+=this.startXOffset,e+=this.startYOffset;var o,h,l,d,c,u,p=a.halign,g=a.valign,v=a.lineHeight,f=r.lines,m=f.length,y=a.maxLines;y>0&&m>y?(h=y,l="center"===g?Math.floor((m-h)/2):"bottom"===g?m-h:0):(h=m,l=0),d=l+h;var b=this.rtl,x=b?this.parent.width:void 0;u="center"===g?Math.max((s-h*v)/2,0):"bottom"===g?Math.max(s-h*v-2,0):0,u+=e;for(var C=l;C0){var o=this.defaultStyle.metrics,h=i-o.ascent,l=o.fontSize;this.drawRectangle(e,h,t.width,l,a.bgcolor,a)}if(a.underlineThickness>0&&t.width>0){var d=i+a.underlineOffset-a.underlineThickness/2;this.drawLine(e,d,t.width,a.underlineThickness,a.underlineColor,a)}if(t.isTextPen&&(a.buildFont(),a.syncFont(r,n),a.syncStyle(r,n),this.drawText(e,i,t.text,a)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,a),a.strikethroughThickness>0&&t.width>0&&(d=i+a.strikethroughOffset-a.strikethroughThickness/2,this.drawLine(e,d,t.width,a.strikethroughThickness,a.strikethroughColor,a)),n.restore(),t.hasAreaMarker&&t.width>0){var c,u=t.prop.area;if(u)c={key:u};else{var p=t.prop.url;c={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,this.defaultStyle.lineHeight,c)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var o=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=o},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context;s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e))},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const Ye=Phaser.Utils.Objects.GetValue,Xe=Oe,We=Me;class Ve{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=Ye(t,"text",""),this.x=Ye(t,"x",0),this.y=Ye(t,"y",0),this.width=Ye(t,"width",0);var e=Ye(t,"prop",null);null===e&&(e={}),this.prop=e,this.newLineMode=Ye(t,"newLineMode",0),this.startIndex=Ye(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===We&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==Xe&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===We&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}var Ge=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:q(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t];return e&&e[0]?e[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0&&!(s=null!=(i=this.lines[e])&&i.length>0);e--);return s?i[i.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e[e.length-1];return null==i?0:i.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&h<=e||(a=a.substring(t-o,e-o)),this.tagToTextScope?c+=this.tagToText.call(this.tagToTextScope,a,l,d):c+=this.tagToText(a,l,d),d=l,!(h>=e)));u++);return c}get length(){return this.lines.length}set length(t){this.clear()}}var Ke={};const Je=Phaser.Geom.Rectangle;var qe=new I;class Ze{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&vi(v)){""!==b?a.push(n.getLine(b,x,hi)):0===C&&r>0&&a.push(n.getLine("",0,hi)),a.push(...pi(v,e,ci,s,0,n));var w=a.pop();b=w.text,x=w.width,n.freeLine(w)," "===b&&(b="",x=0)}else(m=x+f)>h?(a.push(n.getLine(b,x,hi)),b=v,x=f,h=s):(b+=v,x=m),C===k-1&&a.push(n.getLine(b,x,l))}return a},gi=function(t,e){var i;switch(e){case di:i=[];for(var s=0,r=(t=t.split(" ")).length;s0&&e!==mi&&i0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount,e=this.defaultStyle.lineHeight*t;return t>0&&(e-=this.defaultStyle.lineSpacing),e}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new $e({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n${t}`:e.hasOwnProperty("_style")?`${t}`:t}destroy(){this.tags=void 0}isTextTag(t){var e=this.tags[t];return!!e&&null==e.img}};var fs=function(t){for(var e,i,s,r={},n=0,a=(t=t.split(";")).length;n=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px","")));break;case"shadow":o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.offsetX=parseInt(o[1].replace("px",""))),h>=3&&(s.offsetY=parseInt(o[2].replace("px",""))),h>=4&&(s.blur=parseInt(o[3].replace("px","")));break;case"u":case"underline":case"s":case"strikethrough":var h;o=s.split(" "),s={},(h=o.length)>=1&&(s.color=o[0]),h>=2&&(s.thickness=parseInt(o[1].replace("px",""))),h>=3&&(s.offset=parseInt(o[2].replace("px",""))),"underline"===i?i="u":"strikethrough"===i&&(i="s");break;case"y":s=parseFloat(s)}r[i]=s}return r},ms=function(t){return 0===(t=t.replace(ws,"")).length},ys=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>|<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/g,bs=/<\s*class=/i,xs=/<\s*class=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/class\s*\>/,Cs=/<\s*style=/i,ks=/<\s*style=["|']([^"|']+)["|']\s*\>([\s\S]*?)<\s*\/style\s*\>/,ws=/^\s+|\s+$/;const Ss=Phaser.Utils.Objects.GetValue;class Ps extends Wi{constructor(t,e,i,s,r){var n=Ss(r,"tags",void 0);super(t,e,i,s,r,"rexTagText",new vs(n))}addTag(t,e){return this.parser.addTag(t,e),this.updateText(!0)}addTags(t){for(var e in t)this.parser.addTag(e,t[e]);return this.updateText(!0)}getTag(t){return this.parser.getTag(t)}preDestroy(){super.preDestroy(),this.parser.destroy(),this.parser=void 0}}t.register("tagText",(function(t,e,i,s){var r=new Ps(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.TagText",Ps);const Ts=Phaser.Utils.Objects.GetValue;var Os=function(t,e){return void 0===e?t:t[e]},Ms=function(t,e,i){void 0===t&&(t={}),void 0===e&&(e=0);var s=typeof e;return"string"===s?t[e]=i:"number"===s?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Ts(e,"left",0),t.right=Ts(e,"right",0),t.top=Ts(e,"top",0),t.bottom=Ts(e,"bottom",0)),t};let Es=class{constructor(t,e){this.setParent(t),this.type=e,this.renderable=!1,this.reset().setActive()}destroy(){this.parent.removeChild(this)}setParent(t){return this.parent=t,this}get scene(){return this.parent.scene}get canvas(){return this.parent?this.parent.canvas:null}get context(){return this.parent?this.parent.context:null}setDirty(t){return t&&this.parent&&(this.parent.dirty=!0),this}get active(){return this._active}set active(t){this.setDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}onFree(){this.reset().setParent()}reset(){return this}render(){}contains(t,e){return!1}};Object.assign(Es.prototype,Z);var _s={renderContent(){},render(){if(!this.willRender)return this;var t=this.context;if(t.save(),t.globalAlpha=this.alpha,this.toLocalPosition){var e=this.drawX,i=this.drawY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation)}return this.drawBelowCallback&&this.drawBelowCallback(this),this.renderContent(),this.drawAboveCallback&&this.drawAboveCallback(this),t.restore(),this}};const Rs=Phaser.Math.RotateAround;var Ls;const Bs=Phaser.Geom.Rectangle;var Is,Ds=function(t){void 0===Is&&(Is=new Bs);var e=t.drawTLX,i=t.drawTLY;return Is.setTo(e,i,t.drawTRX-e,t.drawBLY-i),Is};const js=Phaser.Math.RotateAround;var As,zs=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===As&&(As={}),s=As),s.x=e,s.y=i,0!==t.rotation&&js(s,0,0,t.rotation),s.x=s.x*t.scaleX+t.drawX,s.y=s.y*t.scaleY+t.drawY,s};const Fs=Phaser.GameObjects.Components.TransformMatrix;var Ys,Xs,Ws={},Vs=function(t,e,i,s,r){var n=zs(e,i,s,!0),a=function(t,e,i,s){void 0===s?s={}:!0===s&&(s=Ws);var r=e-t.width*t.originX,n=i-t.height*t.originY;return void 0===Ys&&(Ys=new Fs,Xs=new Fs),t.parentContainer?t.getWorldTransformMatrix(Ys,Xs):Ys.applyITRS(t.x,t.y,t.rotation,t.scaleX,t.scaleY),Ys.transformPoint(r,n,s),s}(t,n.x,n.y,r);return a},Gs=function(t,e,i,s,r){"number"!=typeof i&&(r=i,i=0,s=0);var n=e.drawCenterX+i,a=e.drawCenterY+s;return Vs(t,e,n,a,r)},Hs={contains:function(t,e){if(0===this.width||0===this.height)return!1;var i=function(t,e,i,s){return void 0===s?s={}:!0===s&&(void 0===Ls&&(Ls={}),s=Ls),s.x=(t-i.drawX)/i.scaleX,s.y=(e-i.drawY)/i.scaleY,0!==i.rotation&&Rs(s,0,0,-i.rotation),s}(t,e,this,!0);return Ds(this).contains(i.x,i.y)},getWorldPosition:function(t,e,i){return Gs(this.parent,this,t,e,i)}};Object.assign(Hs,_s);const Us=Phaser.Math.DegToRad,Ns=Phaser.Math.RadToDeg,$s=Phaser.Utils.Objects.GetValue;class Ks extends Es{constructor(t,e){super(t,e),this.renderable=!0,this.scrollFactorX=1,this.scrollFactorY=1,this.toLocalPosition=!0,this.originX=0,this.offsetX=0,this.offsetY=0}get visible(){return this._visible}set visible(t){this.setDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDirty(this._alpha!=t),this._alpha=t}setAlpha(t){return this.alpha=t,this}get x(){return this._x}set x(t){this.setDirty(this._x!=t),this._x=t}setX(t){return this.x=t,this}get y(){return this._y}set y(t){this.setDirty(this._y!=t),this._y=t}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setInitialPosition(t,e){return this.x0=t,this.y0=e,this}setScrollFactorX(t){return this.scrollFactorX=t,this}setScrollFactorY(t){return this.scrollFactorY=t,this}setScrollFactor(t,e){return void 0===e&&(e=t),this.scrollFactorX=t,this.scrollFactorY=e,this}get rotation(){return this._rotation}set rotation(t){this.setDirty(this._rotation!=t),this._rotation=t}setRotation(t){return this.rotation=t,this}get angle(){return Ns(this._rotation)}set angle(t){this.rotation=Us(t)}setAngle(t){return this.angle=t,this}get scaleX(){return this._scaleX}set scaleX(t){this.setDirty(this._scaleX!==t),this._scaleX=t}setScaleX(t){return this.scaleX=t,this}get width(){return 0}set width(t){}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}get leftSpace(){return this._leftSpace}set leftSpace(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}setLeftSpace(t){return this.leftSpace=t,this}get rightSpace(){return this._rightSpace}set rightSpace(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}setRightSpace(t){return this.rightSpace=t,this}get outerWidth(){return this.width+this.leftSpace+this.rightSpace}get scaleY(){return this._scaleY}set scaleY(t){this.setDirty(this._scaleY!==t),this._scaleY=t}setScaleY(t){return this.scaleY=t,this}get height(){return 0}set height(t){}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}setOrigin(t){return this.originX=t,this}setAlign(t){return this.align=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=$s(t,"width",void 0),i=$s(t,"height",void 0),s=$s(t,"scaleX",void 0),r=$s(t,"scaleY",void 0);return void 0!==e?void 0===i&&void 0===r?this.setWidth(e,!0):this.setWidth(e):void 0!==s&&this.setScaleX(s),void 0!==i?void 0===e&&void 0===s?this.setHeight(i,!0):this.setHeight(i):void 0!==r&&this.setScaleY(r),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),this}setDrawBelowCallback(t){return this.drawBelowCallback=t,this}setDrawAboveCallback(t){return this.drawAboveCallback=t,this}reset(){return this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setAlign().setDrawBelowCallback().setDrawAboveCallback(),this}get willRender(){return this.visible&&this.alpha>0}get drawX(){var t=this.x+this.leftSpace+this.offsetX-this.originX*this.width;return this.parent._textOX*this.scrollFactorX+t}get drawY(){var t=this.y+this.offsetY;return this.parent._textOY*this.scrollFactorY+t}get drawTLX(){return 0}get drawTLY(){return 0}get drawBLX(){return 0}get drawBLY(){return 0}get drawTRX(){return 0}get drawTRY(){return 0}get drawBRX(){return 0}get drawBRY(){return 0}get drawCenterX(){return(this.drawTRX+this.drawTLX)/2}get drawCenterY(){return(this.drawBLY+this.drawTLY)/2}}Object.assign(Ks.prototype,Hs);var Js=function(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]};const qs=Phaser.Utils.Objects.GetValue;class Zs extends Ks{constructor(t,e){super(t,"background"),this.setScrollFactor(0),this.setColor(qs(e,"color",null),qs(e,"color2",null),qs(e,"horizontalGradient",!0)),this.setStroke(qs(e,"stroke",null),qs(e,"strokeThickness",2)),this.setCornerRadius(qs(e,"cornerRadius",0),qs(e,"cornerIteration",null))}set color(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=qt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}set cornerRadius(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}get cornerRadius(){return this._cornerRadius}set cornerIteration(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}get cornerIteration(){return this._cornerIteration}modifyStyle(t){return t.hasOwnProperty("color")&&this.setColor(t.color,Js("color2",t,this),Js("horizontalGradient",t,this)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Js("strokeThickness",t,this)),t.hasOwnProperty("cornerRadius")&&this.setCornerRadius(t.cornerRadius,Js("cornerIteration",t,this)),this}modifyPorperties(t){return super.modifyPorperties(t),this.modifyStyle(t),this}setCornerRadius(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}renderContent(){se(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}const Qs=Phaser.Utils.Objects.GetValue;class tr extends Ks{constructor(t,e){super(t,"innerbounds"),this.setScrollFactor(0),this.setColor(Qs(e,"color",null),Qs(e,"color2",null),Qs(e,"horizontalGradient",!0)),this.setStroke(Qs(e,"stroke",null),Qs(e,"strokeThickness",2))}set color(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}get color(){return this._color}set color2(t){t=qt(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}get color2(){return this._color2}set horizontalGradient(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}get horizontalGradient(){return this._horizontalGradient}setColor(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}set stroke(t){t=qt(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}get stroke(){return this._stroke}set strokeThickness(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}get strokeThickness(){return this._strokeThickness}setStroke(t,e){return null!=t&&void 0===e&&(e=2),this.stroke=t,this.strokeThickness=e,this}modifyPorperties(t){super.modifyPorperties(t),t.hasOwnProperty("color")&&this.setColor(t.color,Qs(t,"color2",null),Qs(t,"horizontalGradient",!0)),t.hasOwnProperty("stroke")&&this.setStroke(t.stroke,Qs(t,"strokeThickness",2))}renderContent(){var t,e,i=this.parent.padding,s=i.left,r=i.top,n=this.parent.width-i.left-i.right,a=this.parent.height-i.top-i.bottom,o=this.context;null!=this.color&&(null!=this.color2?((e=this.horizontalGradient?o.createLinearGradient(0,0,n,0):o.createLinearGradient(0,0,0,a)).addColorStop(0,this.color),e.addColorStop(1,this.color2),t=e):t=this.color,o.fillStyle=t,o.fillRect(s,r,n,a));null!=this.stroke&&this.strokeThickness>0&&(o.strokeStyle=this.stroke,o.lineWidth=this.strokeThickness,o.strokeRect(s,r,n,a))}}const er=Phaser.Utils.Objects.GetValue;class ir{constructor(t,e){this.parent=t,this.set(e)}toJSON(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY,leftSpace:this.leftSpace,rightSpace:this.rightSpace,backgroundHeight:this.backgroundHeight,backgroundBottomY:this.backgroundBottomY,align:this.align}}set(t){return this.setBold(er(t,"bold",!1)),this.setItalic(er(t,"italic",!1)),this.setFontSize(er(t,"fontSize","16px")),this.setFontFamily(er(t,"fontFamily","Courier")),this.setColor(er(t,"color","#fff")),this.setStrokeStyle(er(t,"stroke",null),er(t,"strokeThickness",0)),this.setShadow(er(t,"shadowColor",null),er(t,"shadowOffsetX",0),er(t,"shadowOffsetY",0),er(t,"shadowBlur",0)),this.setOffset(er(t,"offsetX",0),er(t,"offsetY",0)),this.setSpace(er(t,"leftSpace",0),er(t,"rightSpace",0)),this.setAlign(er(t,"align",void 0)),this.setBackgroundColor(er(t,"backgroundColor",null)),this.setBackgroundHeight(er(t,"backgroundHeight",void 0)),this.setBackgroundBottomY(er(t,"backgroundBottomY",void 0)),this.setBackgroundLeftX(er(t,"backgroundLeftX",0)),this.setBackgroundRightX(er(t,"backgroundRightX",0)),this}modify(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(Js("stroke",t,this),Js("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(Js("shadowOffsetX",t,this),Js("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setRightSpace(t.rightSpace),t.hasOwnProperty("align")&&this.setAlign(t.align),t.hasOwnProperty("backgroundColor")&&this.setBackgroundColor(t.backgroundColor),t.hasOwnProperty("backgroundHeight")&&this.setBackgroundHeight(t.backgroundHeight),t.hasOwnProperty("backgroundBottomY")&&this.setBackgroundBottomY(t.backgroundBottomY),t.hasOwnProperty("backgroundLeftX")&&this.setBackgroundLeftX(t.backgroundLeftX),t.hasOwnProperty("backgroundRightX")&&this.setBackgroundRightX(t.backgroundRightX),this}setUpdateTextFlag(){return this.parent&&(this.parent.updateTextFlag=!0),this}clone(){return new ir(null,this.toJSON())}copyFrom(t){return this.set(t.toJSON()),this}copyTo(t){return t.set(this.toJSON()),this}setBold(t){return void 0===t&&(t=!0),this.bold=t,this.setUpdateTextFlag(),this}setItalic(t){return void 0===t&&(t=!0),this.italic=t,this.setUpdateTextFlag(),this}get fontStyle(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}setFontSize(t){return"number"==typeof t&&(t=`${t}px`),this.fontSize=t,this.setUpdateTextFlag(),this}setFontFamily(t){return this.fontFamily=t,this.setUpdateTextFlag(),this}get font(){return`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`}setColor(t){return this.color=qt(t),this}get hasFill(){return null!=this.color}setStrokeStyle(t,e){return this.stroke=qt(t),void 0!==e&&(this.strokeThickness=e),this}setStrokeThickness(t){return this.strokeThickness=t,this}get hasStroke(){return null!=this.stroke&&this.strokeThickness>0}setShadowColor(t){return this.shadowColor=qt(t),this}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}setShadowBlur(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}setShadow(t,e,i,s){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(s),this}setBackgroundColor(t){return this.backgroundColor=qt(t),this}get hasBackgroundColor(){return null!=this.backgroundColor}setBackgroundHeight(t){return this.backgroundHeight=t,this}setBackgroundBottomY(t){return this.backgroundBottomY=t,this}setBackgroundLeftX(t){return this.backgroundLeftX=t,this}setBackgroundRightX(t){return this.backgroundRightX=t,this}setOffsetX(t){return void 0===t&&(t=0),this.offsetX=t,this}setOffsetY(t){return void 0===t&&(t=0),this.offsetY=t,this}setOffset(t,e){return this.setOffsetX(t).setOffsetY(e),this}setLeftSpace(t){return void 0===t&&(t=0),this.leftSpace=t,this}setRightSpace(t){return void 0===t&&(t=0),this.rightSpace=t,this}setSpace(t,e){return this.setLeftSpace(t).setRightSpace(e),this}setAlign(t){return this.align=t,this}syncFont(t){return t.font=this.font,this}syncStyle(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}syncShadow(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}getTextMetrics(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}const sr=Phaser.Utils.Array.Remove,rr=Phaser.Utils.Array.Remove,nr="text",ar="image",or="drawer",hr="space",lr="command";var dr=function(t){return t.type===nr&&"\n"===t.text},cr=function(t){return t.type===nr&&"\f"===t.text},ur=function(t){return t.type===nr},pr=function(t){return t.type===lr};class gr extends Ks{constructor(t,e,i){super(t,nr),this.updateTextFlag=!1,this.style=new ir(this,i),this.setText(e)}get autoRound(){return this.parent.autoRound}get offsetX(){return this.style.offsetX}set offsetX(t){this.style&&(this.style.offsetX=t)}get offsetY(){return this.style.offsetY}set offsetY(t){this.style&&(this.style.offsetY=t)}get leftSpace(){return this.style.leftSpace*this.scaleX}set leftSpace(t){this.style&&(this.style.leftSpace=t),super.leftSpace=t}get rightSpace(){return this.style.rightSpace*this.scaleX}set rightSpace(t){this.style&&(this.style.rightSpace=t),super.rightSpace=t}get align(){return this.style.align}set align(t){this.style&&(this.style.align=t)}modifyStyle(t){return this.setDirty(!0),this.style.modify(t),this.updateTextFlag&&this.updateTextSize(),this}modifyPorperties(t){return t?(this.modifyStyle(t),super.modifyPorperties(t),this):this}setText(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}updateTextSize(){var t=this.text;if("\n"===t||"\f"===t||""===t)this.clearTextSize();else{var e,i,s=this.style.getTextMetrics(this.context,this.text);this.textWidth=s.width,"actualBoundingBoxAscent"in s?(e=s.actualBoundingBoxAscent,i=s.actualBoundingBoxDescent):(e=0,i=0),this.textHeight=e+i,this.ascent=e,this.descent=i}return this.updateTextFlag=!1,this}clearTextSize(){return this.textWidth=0,this.textHeight=0,this.ascent=0,this.descent=0,this}copyTextSize(t){return this.textWidth=t.textWidth,this.textHeight=t.textHeight,this.ascent=t.ascent,this.descent=t.descent,this}get width(){return this.textWidth*this.scaleX}set width(t){this.textWidth>0?this.scaleX=t/this.textWidth:this.scaleX=1}get height(){return this.textHeight*this.scaleY}set height(t){this.textHeight>0?this.scaleY=t/this.textHeight:this.scaleY=1}get willRender(){return 0!==this.textWidth&&super.willRender}renderContent(){var t=this.context,e=this.style;if(e.hasBackgroundColor){t.fillStyle=e.backgroundColor;var i=this.drawTLX+e.backgroundLeftX,s=i,r=this.drawTRX+e.backgroundRightX-i+1;if(r>0){var n=e.backgroundBottomY;null==n&&(n=this.drawBLY);var a=e.backgroundHeight;null==a&&(a=n-this.drawTLY);var o=n-a;t.fillRect(s,o,r,a)}}var h=e.hasFill,l=e.hasStroke;(h||l)&&(e.syncFont(t).syncStyle(t),l&&(e.syncShadow(t),t.strokeText(this.text,0,0)),h&&(e.syncShadow(t),t.fillText(this.text,0,0)))}get drawTLX(){return-this.leftSpace}get drawTLY(){return-this.ascent}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.descent}get drawTRX(){return this.textWidth+this.rightSpace}get drawTRY(){return-this.ascent}get drawBRX(){return this.textWidth+this.rightSpace}get drawBRY(){return this.descent}}var vr=function(t,e){var i=this.createCharChildren(t,e);return this.addChild(i),this};Phaser.Display.Canvas.CanvasPool;class fr extends Ks{constructor(t,e,i){super(t,ar),this.setTexture(e,i),this.color=void 0}get frameWidth(){return this.frameObj?this.frameObj.cutWidth:0}get frameHeight(){return this.frameObj?this.frameObj.cutHeight:0}get offsetY(){return-this.height}set offsetY(t){}get key(){return this._key}set key(t){this.setDirty(this._key!=t),this._key=t}get frame(){return this._frame}set frame(t){this.setDirty(this._frame!=t),this._frame=t}setTexture(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.sys.textures.getFrame(t,e),this}get width(){return this.frameWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}get height(){return this.frameHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setColor(t){return this.color=t,this}modifyPorperties(t){return t.hasOwnProperty("color")&&this.setColor(t.color),super.modifyPorperties(t),this}renderContent(){Oi(this.frameObj,this.canvas,0,0,this.frameWidth,this.frameHeight,this.color,!1)}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.frameHeight}get drawTRX(){return this.frameWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.frameWidth+this.rightSpace}get drawBRY(){return this.frameHeight}}var mr=function(t,e,i){var s=this.createImageChild(t,e,i);return this.addChild(s),this};class yr extends Ks{constructor(t,e,i,s){super(t,or),this.setRenderCallback(e),this.setDrawerSize(i,s)}setRenderCallback(t){return t?this.renderContent=t.bind(this):delete this.renderContent,this}setDrawerSize(t,e){return!0===t?(this.toLocalPosition=!1,t=void 0,e=void 0):this.toLocalPosition=!0,void 0===t&&(t=0),void 0===e&&(e=t),this.drawerWidth=t,this.drawerHeight=e,this}onFree(){super.onFree(),this.setRenderCallback()}get width(){return this.drawerWidth*this.scaleX}set width(t){this.setDirty(this.width!==t),this.scaleX=this.drawerWidth>0?t/this.drawerWidth:1}get height(){return this.drawerHeight*this.scaleY}set height(t){this.setDirty(this.height!==t),this.scaleY=this.drawerHeight>0?t/this.drawerHeight:1}get offsetY(){return-this.height}set offsetY(t){}get drawTLX(){return-this.leftSpace}get drawTLY(){return 0}get drawBLX(){return-this.leftSpace}get drawBLY(){return this.drawerHeight}get drawTRX(){return this.drawerWidth+this.rightSpace}get drawTRY(){return 0}get drawBRX(){return this.drawerWidth+this.rightSpace}get drawBRY(){return this.drawerHeight}}let br=class extends Ks{constructor(t,e){super(t,hr),this.setSpaceWidth(e)}get width(){return this.spaceWidth*this.scaleX}set width(t){this.spaceWidth>0?this.scaleX=t/this.spaceWidth:this.scaleX=1}setSpaceWidth(t){return this.spaceWidth=t,this}};var xr=function(t){var e=this.createSpaceChild(t);return this.addChild(e),this};class Cr extends Es{constructor(t,e,i,s,r){super(t,lr),this.setName(e).setParameter(s).setCallback(i,r)}setName(t){return this.name=t,this}setParameter(t){return this.param=t,this}setCallback(t,e){return this.callback=t,this.scope=e,this}exec(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}onFree(){super.onFree(),this.setName().setCallback().setParameter()}}var kr=function(t,e,i,s){var r=this.createCommandChild(t,e,i,s);return this.addChild(r),this},wr=function(t){var e={callback:void 0,start:0,isLastPage:!1,maxLines:void 0,padding:void 0,letterSpacing:void 0,hAlign:void 0,vAlign:void 0,children:[],lines:[],maxLineWidth:0,linesHeight:0,lineHeight:void 0,maxLineHeight:0,linesWidth:0,lineWidth:void 0};return Object.assign(e,t)};const Sr={none:0,word:1,char:2,character:2,mix:3};var Pr=function(t,e,i,s){void 0===s&&(s={word:[],width:0}),s.word.length=0;for(var r=2===i,n=3===i,a=!r&&!n,o=t.length,h=e,l=s.word,d=0,c=!1;h0&&!o){var h=this.fixedHeight-s;i>0?n=h/i:(n=(l=Er.call(this)).height,a=l.ascent,i=Math.floor((h-a)/n))}else{var l;n=(l=Er.call(this)).height,a=l.ascent}}else this.fixedHeight>0?void 0===(i=Rr(t,"maxLines"))&&(h=this.fixedHeight-s,i=Math.floor(h/n)):i=Rr(t,"maxLines",0);void 0===a&&(a=n);var d=0===i,c=Rr(t,"wrapMode");void 0===c&&(c=Rr(t,"charWrap",!1)?"char":"word"),"string"==typeof c&&(c=Sr[c]);var u=Rr(t,"wrapWidth",void 0);void 0===u&&(this.fixedWidth>0?u=this.fixedWidth-r:(u=1/0,c=0));for(var p=Rr(t,"letterSpacing",0),g=Rr(t,"hAlign",0),v=Rr(t,"vAlign",0),f=Rr(t,"justifyPercentage",.25),m=wr({callback:"runWordWrap",start:e,padding:this.wrapPadding,letterSpacing:p,maxLines:i,hAlign:g,vAlign:v,justifyPercentage:f,ascent:a,lineHeight:n,wrapWidth:u,wrapMode:c}),y=this.children,b=0,x=y.length;b0&&(E.push({children:_,width:R}),L=Math.max(L,R)),m.start+=M.length,m.isLastPage=!B&&m.start===O,m.maxLineWidth=L,m.linesHeight=E.length*n;var Y=this.fixedWidth>0?this.fixedWidth:m.maxLineWidth+r,X=this.fixedHeight>0?this.fixedHeight:m.linesHeight+s;for(function(t,e,i){for(var s,r,n=t.hAlign,a=t.vAlign,o=t.justifyPercentage,h=t.lines,l=0,d=h.length;l0?(a=this.fixedWidth-r)/i:0;else if(this.fixedWidth>0){if(void 0===(i=Ir(t,"maxLines",void 0))){var a=this.fixedWidth-r;i=Math.floor(a/n)+1}}else i=Ir(t,"maxLines",0);var o=0===i,h=Ir(t,"fixedCharacterHeight",void 0);if(void 0===h){var l=Ir(t,"charPerLine",void 0);if(void 0!==l){var d=this.fixedHeight-s;h=Math.floor(d/l)}}var c=Ir(t,"wrapHeight",void 0);void 0===c&&(c=this.fixedHeight>0?this.fixedHeight-s:1/0);for(var u=Ir(t,"letterSpacing",0),p=Ir(t,"rtl",!0),g=Ir(t,"hAlign",p?2:0),v=Ir(t,"vAlign",0),f=wr({callback:"runVerticalWrap",start:e,padding:this.wrapPadding,letterSpacing:u,maxLines:i,hAlign:g,vAlign:v,lineWidth:n,fixedCharacterHeight:h,wrapHeight:c,rtl:p}),m=this.children,y=0,b=m.length;y0&&(M.push({children:E,height:_}),R=Math.max(R,_)),f.start+=O.length,f.isLastPage=f.start===T,f.maxLineHeight=R,f.linesWidth=M.length*n;var A=this.fixedWidth>0?this.fixedWidth:f.linesWidth+r,z=this.fixedHeight>0?this.fixedHeight:f.maxLineHeight+s;for(function(t,e,i){var s,r,n=t.hAlign,a=t.vAlign,o=t.rtl,h=t.lines,l=t.lineWidth,d=t.linesWidth;switch(n){case 1:case"center":s=(e-d)/2;break;case 2:case"right":s=e-d;break;default:s=0}o&&(s+=l);for(var c=0,u=h.length;c0?t:this.width,e>0?e:this.height)),this},setPadding:function(t,e){var i=this.padding,s=i.left,r=i.right,n=i.top,a=i.bottom;return Ms(i,t,e),this.dirty=this.dirty||s!=i.left||r!=i.right||n!=i.top||a!=i.bottom,this},getPadding:function(t){return Os(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),sr(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 rr(this.children,t),this.lastAppendedChildren.length=0,this.lastOverChild=null,this.dirty=!0,this},clearContent:function(){return this.setText(),this},addChild:function(t,e){var i=Array.isArray(t);return void 0===e||e===this.children.length?i?this.children.push(...t):this.children.push(t):i?this.children.splice(e,0,...t):this.children.splice(e,0,t),this.lastAppendedChildren.length=0,i?this.lastAppendedChildren.push(...t):this.lastAppendedChildren.push(t),this},createCharChild:function(t,e){e&&this.textStyle.modify(e);var i=this.poolManager.allocate(nr);return null===i?i=new gr(this,t,this.textStyle):i.setParent(this).setActive().modifyStyle(this.textStyle).setText(t),i},createCharChildren:function(t,e){e&&this.textStyle.modify(e);for(var i=[],s=0,r=t.length;se&&(s=e,r=t)})),r},getCharWorldPosition:function(t,e,i,s){return"number"==typeof t&&(t=this.getCharChild(t,!0)),Gs(this,t,e,i,s)},setToMinSize:function(){for(var t=this.children,e=0,i=0,s=0,r=t.length;s=i.length&&(t=i.length);for(var s=0,r=0;r>16&255},xn=function(t){return t>>8&255},Cn=function(t){return 255&t};const kn=Phaser.Events.EventEmitter;var wn=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=Sn),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},Sn={},Pn=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=wn),function(t){if(t.events)return t;var e=new kn,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},Tn=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},On=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(_n(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},Fn=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Yn=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const Xn=Phaser.Geom.Rectangle,Wn=Phaser.Math.Vector2,Vn=Phaser.Math.RotateAround,Gn=Phaser.GameObjects.Container;var Hn=function(t,e){if(void 0===e?e=new Xn:!0===e&&(void 0===Un&&(Un=new Xn),e=Un),t.getBounds&&!(t instanceof Gn))return t.getBounds(e);var i,s,r,n,a,o,h,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();Nn(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,$n(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,Kn(t,e),d.transformPoint(e.x,e.y,e),a=e.x,o=e.y,Jn(t,e),d.transformPoint(e.x,e.y,e),h=e.x,l=e.y}else Nn(t,e),i=e.x,s=e.y,$n(t,e),r=e.x,n=e.y,Kn(t,e),a=e.x,o=e.y,Jn(t,e),h=e.x,l=e.y;return e.x=Math.min(i,r,a,h),e.y=Math.min(s,n,o,l),e.width=Math.max(i,r,a,h)-e.x,e.height=Math.max(s,n,o,l)-e.y,e},Un=void 0,Nn=function(t,e,i){return void 0===e?e=new Wn:!0===e&&(void 0===Zn&&(Zn=new Wn),e=Zn),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-Fn(t)*t.originX,e.y=t.y-Yn(t)*t.originY,Qn(t,e,i))},$n=function(t,e,i){return void 0===e?e=new Wn:!0===e&&(void 0===Zn&&(Zn=new Wn),e=Zn),t.getTopRight?t.getTopRight(e):(e.x=t.x-Fn(t)*t.originX+Fn(t),e.y=t.y-Yn(t)*t.originY,Qn(t,e,i))},Kn=function(t,e,i){return void 0===e?e=new Wn:!0===e&&(void 0===Zn&&(Zn=new Wn),e=Zn),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-Fn(t)*t.originX,e.y=t.y-Yn(t)*t.originY+Yn(t),Qn(t,e,i))},Jn=function(t,e,i){return void 0===e?e=new Wn:!0===e&&(void 0===Zn&&(Zn=new Wn),e=Zn),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-Fn(t)*t.originX+Fn(t),e.y=t.y-Yn(t)*t.originY+Yn(t),Qn(t,e,i))},qn=function(t,e,i){void 0===e?e=new Wn:!0===e&&(void 0===Zn&&(Zn=new Wn),e=Zn);var s=Fn(t),r=Yn(t);return e.x=t.x+s*(.5-t.originX),e.y=t.y+r*(.5-t.originY),Qn(t,e,i)},Zn=void 0,Qn=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&Vn(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const ta=Phaser.Utils.Objects.GetValue;var ea=function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=ta(i,"color"),r=ta(i,"lineWidth"),n=ta(i,"fillColor"),a=ta(i,"fillAlpha",1),o=ta(i,"padding",0)),Array.isArray(t))for(var h=0,l=t.length;h0?-this.delay:0,this.state=this.nowTime>=0?Ua:Ha,this.repeatCounter=0,this}stop(){return this.state=Ga,this}update(t,e){this.state!==Ga&&this.state!==$a&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter0&&(this.nowTime-=this.repeatDelay,this.state=Na)):(this.nowTime=this.duration,this.state=$a):this.nowTime>=0&&(this.state=Ua))}get t(){var t;switch(this.state){case Ga:case Ha:case Na:t=0;break;case Ua:t=this.nowTime/this.duration;break;case $a:t=1}return Wa(t,0,1)}set t(t){(t=Wa(t,-1,1))<0?(this.state=Ha,this.nowTime=-this.delay*t):(this.state=Ua,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Ga}get isDelay(){return this.state===Ha}get isCountDown(){return this.state===Ua}get isRunning(){return this.state===Ha||this.state===Ua}get isDone(){return this.state===$a}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const Ga=0,Ha=1,Ua=2,Na=3,$a=-1;class Ka extends Fa{constructor(t,e){super(t,e),this.timer=new Va}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const Ja=Phaser.Utils.Objects.GetValue,qa=Phaser.Utils.Objects.GetAdvancedValue,Za=Phaser.Tweens.Builders.GetEaseFunction;class Qa extends Ka{resetFromJSON(t){return this.timer.resetFromJSON(Ja(t,"timer")),this.setEnable(Ja(t,"enable",!0)),this.setTarget(Ja(t,"target",this.parent)),this.setDelay(qa(t,"delay",0)),this.setDuration(qa(t,"duration",1e3)),this.setEase(Ja(t,"ease","Linear")),this.setRepeat(Ja(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=Za(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const to=Phaser.Sound.BaseSound;var eo=function(t){return t instanceof to};const io=Phaser.Utils.Objects.GetValue,so=Phaser.Utils.Objects.GetAdvancedValue,ro=Phaser.Math.Linear;let no=class extends Qa{constructor(t,e,i){eo(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(io(t,"mode",0)),this.setEnable(io(t,"enable",!0)),this.setVolumeRange(so(t,"volume.start",this.parent.volume),so(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=ao[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=ro(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}};const ao={stop:1,destroy:2};var oo=function(t,e,i,s,r){eo(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new no(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},ho=function(t,e,i,s){eo(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new no(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const lo=Phaser.Utils.Objects.GetValue;var co={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:lo(e,"loop",this.backgroundMusicLoop),mute:lo(e,"mute",this.backgroundMusicMute),volume:lo(e,"volume",this.backgroundMusicVolume),detune:lo(e,"detune",0),rate:lo(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&oo(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&ho(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const uo=Phaser.Utils.Objects.GetValue;var po={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:uo(e,"loop",this.backgroundMusicLoop),mute:uo(e,"mute",this.backgroundMusic2Mute),volume:uo(e,"volume",this.backgroundMusic2Volume),detune:uo(e,"detune",0),rate:uo(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&oo(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&ho(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const go=Phaser.Utils.Array.Remove,vo=Phaser.Utils.Objects.GetValue;var fo={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:vo(e,"mute",this.soundEffectsMute),volume:vo(e,"volume",this.soundEffectsVolume),detune:vo(e,"detune",0),rate:vo(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&go(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&go(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&oo(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&ho(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)ho(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute=t;return this},setSoundEffectVolume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setVolume(t)}else this.soundEffectsVolume=t;return this},setSoundEffectDetune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect()]:this.soundEffects).length;s=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect2(t){var e=this.getLastSoundEffect2();return e&&oo(e,t,this.soundEffects2Volume,0),this},fadeOutSoundEffect2(t,e){var i=this.getLastSoundEffect2();return i&&ho(i,t,e),this},fadeOutAllSoundEffects2(t,e){for(var i=this.soundEffects2.length-1;i>=0;i--)ho(this.soundEffects2[i],t,e);return this},setSoundEffect2Mute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setMute(t)}else this.soundEffects2Mute=t;return this},setSoundEffect2Volume(t,e){if(void 0===e&&(e=!1),e){var i=this.getLastSoundEffect2();i&&i.setVolume(t)}else this.soundEffects2Volume=t;return this},setSoundEffect2Detune(t,e){var i;void 0===e&&(e=!1);for(var s=0,r=(i=e?[this.getLastSoundEffect2()]:this.soundEffects2).length;s=0;t--)this.soundEffects[t].destroy();if(this.soundEffects.length=0,this.soundEffects2.length)for(t=this.soundEffects2.length-1;t>=0;t--)this.soundEffects2[t].destroy();return this.soundEffects2.length=0,this.sound=void 0,this}get backgroundMusicMute(){return this._backgroundMusicMute}set backgroundMusicMute(t){this._backgroundMusicMute=t,this.backgroundMusic&&this.backgroundMusic.setMute(mute)}get backgroundMusicVolume(){return this._backgroundMusicVolume}set backgroundMusicVolume(t){this._backgroundMusicVolume=t,this.backgroundMusic&&this.backgroundMusic.setVolume(t)}get backgroundMusic2Mute(){return this._backgroundMusic2Mute}set backgroundMusic2Mute(t){this._backgroundMusic2Mute=t,this.backgroundMusic2&&this.backgroundMusic2.setMute(mute)}get backgroundMusic2Volume(){return this._backgroundMusic2Volume}set backgroundMusic2Volume(t){this._backgroundMusic2Volume=t,this.backgroundMusic2&&this.backgroundMusic2.setVolume(t)}get soundEffectsMute(){return this._soundEffectsMute}set soundEffectsMute(t){this._soundEffectsMute=t;for(var e=this.soundEffects,i=0,s=e.length;i");this.setDelimiters(e[0],e[1]),this.setTranslateTagNameCallback(J(t,"translateTagNameCallback")),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.justCompleted=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}shutdown(){this.destroyEventEmitter()}destroy(){this.shutdown()}setMultipleLinesTagEnable(t){return void 0===t&&(t=!0),this.multipleLinesTagEnable=t,this}setDelimiters(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=Qi(this.delimiterLeft),e=Qi(this.delimiterRight);var i=this.multipleLinesTagEnable?"gs":"gi";return this.reSplit=RegExp(`${t}(.+?)${e}`,i),this}setTranslateTagNameCallback(t){return this.translateTagNameCallback=t,this}setValueConverter(t){return!0===t?t=th:t||(t=ih),this.valueConverter=t,this}setLoopEnable(t){return void 0===t&&(t=!0),this.loopEnable=t,this}setSource(t){return this.source=t,this}resetIndex(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this.justCompleted=!1,this.isRunning=!1,this}start(t){return this.setSource(t).restart(),this}restart(){this.resetIndex().next()}next(){if(this.isPaused&&this.onResume(),this.isRunning)return this;if(this.isRunning=!0,this.justCompleted)return this.isRunning=!1,this;0===this.reSplit.lastIndex&&this.onStart();var t=this.source,e=t.length;for(this.reSplit.lastIndex=this.progressIndex;;){var i=this.reSplit.exec(t);if(!i){if(this.progressIndex");this.setDelimiters(e[0],e[1])}setTagExpression(t){return t||(t=rh),this.tagExpression=t,this}setValueExpression(t){return t||(t=rh),this.valueExpression=t,this}setDelimiters(t,e){super.setDelimiters(t,e);var i=`(${this.tagExpression})(=(${this.valueExpression}))?`;if(this.reTag=RegExp(i,"i"),this.tagExpression!==rh||this.valueExpression!==rh){var s=`${this.tagExpression}(=${this.valueExpression})?`,r=`/${this.tagExpression}`;t=Qi(this.delimiterLeft),e=Qi(this.delimiterRight);var n=this.multipleLinesTagEnable?"gs":"gi";this.reSplit=RegExp(`${t}((${s})|(${r}))${e}`,n)}return this}onTag(t){var e=t.match(this.reTag),i=e[1],s="/"===i.charAt(0);if(s&&(i=i.substring(1,i.length)),this.translateTagNameCallback&&(i=this.translateTagNameCallback(i)),this.skipEventFlag=!1,s)this.emit(`-${i}`),this.skipEventFlag||this.emit("-",i),this.lastTagEnd=i;else{var r=function(t,e,i){if(null==t)return[];void 0===e&&(e=th),void 0===i&&(i=",");for(var s=t.split(i),r=0,n=s.length;r0){var n=this.timeline.addTimer({name:ll,target:s,duration:r.duration,yoyo:r.yoyo,onStart:r.onStart,onProgress:r.onProgress,onComplete:r.onComplete});this.skipTypingAnimation&&n.seek(1)}else r.onStart&&r.onStart(s,0);this.minSizeEnable&&this.textPlayer.setToMinSize(),this.textPlayer.emit("typing",s);var a=this.nextChild;if(a)if(this.skipSpaceEnable&&(e=a).type===nr&&" "===e.text);else if(i+=this.speed+t,t=0,i>0){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:i,onComplete:function(t,e,i){t.typingTimer=void 0,dl.call(t,i.remainder)}});break}}else pr(s)&&s.exec()}this.minSizeEnable&&this.textPlayer.setToMinSize(),this.inTypingProcessLoop=!1},cl=function(t){switch(t){case"camera.fadein":case"camera.fadeout":case"camera.flash":case"camera.shake":case"camera.zoom":case"camera.rotate":case"camera.scroll":return!0;default:return!1}},ul=function(t,e){var i=e.split(".");return t.gameObjectManagers.hasOwnProperty(i[0])},pl=function(t,e,i,s){var r=t.waitEventManager,n=e.split("."),a=n[0],o=t.getGameObjectManager(a),h=`wait.${a}`;switch(n.length){case 1:return r.waitGameObjectManagerEmpty(a),void t.emit(h);case 2:var l=n[1];return r.waitGameObjectDestroy(a,l),void t.emit(h,l);case 3:l=n[1];var d=n[2];if("number"==typeof o.getProperty(l,d))return r.waitGameObjectTweenComplete(a,l,d),void t.emit(h,l,d);var c=d,u=c.startsWith("!");return u&&(c=c.substring(1)),o.hasData(l,c)?(r.waitGameObjectDataFlag(a,l,c,!u),void t.emit(h,l,c)):void r.waitTime(0)}};const gl=Phaser.Input.Keyboard.KeyCodes;var vl=function(t,e,i,s){var r=t.waitEventManager;r.clearWaitCompleteCallbacks().addWaitCompleteCallback(i,s);for(var n=0,a=(e="string"==typeof e&&e.length>1&&-1!==e.indexOf("|")?e.split("|"):[e]).length;n0&&n.chainAnimation(i,s)},_l=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).stopAnimation(...i)},Rl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).pauseAnimation(...i)},Ll=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).chainAnimation(...i)};const Bl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Ml(a,s)&&(n=a[1],kr.call(t,`${s}.play`,El,[s,n,r],t),e.skipEvent())}})).on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"stop"===t[2]})(n,s)&&(r=n[1],kr.call(t,`${s}.stop`,_l,[s,r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Ml(n,s)&&(r=n[1],kr.call(t,`${s}.stop`,_l,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");(function(t,e){return 3===t.length&&t[0]===e&&"pause"===t[2]})(n,s)&&(r=n[1],kr.call(t,`${s}.pause`,Rl,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("+",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");if(function(t,e){return 3===t.length&&t[0]===e&&"chain"===t[2]}(n,s)){r=n[1];var a=Array.prototype.slice.call(arguments,1);kr.call(t,`${s}.chain`,Ll,[s,r,a],t),e.skipEvent()}}}))}];var Il=function(t){void 0===t&&(t={}),t.name="sprite",t.parseCallbacks=Bl,t.createGameObject=Sl(t.createGameObject),this.addGameObjectManager(t,Ol)},Dl=function(t,e){return 2===t.length&&t[0]===e},jl=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).add(...i)},Al=function(t){var e,i;[e,...i]=t,this.getGameObjectManager(e).remove(...i)},zl=function(t){this.getGameObjectManager(t).removeAll()},Fl=function(t){var e,i,s,r;[e,i,s,...r]=t;var n=`${e}.${s}`;if(this.emit(n,i,...r),!(this.listenerCount(n)>0)){var a=this.getGameObjectManager(e);a.hasMethod(i,s)?a.call(i,s,...r):a.setProperty(i,s,r[0])}},Yl={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},Xl=function(t){var e,i,s,r,n,a,o,h;[e,i,s,r,n,a,o,h]=t;var l=this.getGameObjectManager(e),d=l.getProperty(i,s);if("number"==typeof d){h.endsWith("Left")||h.endsWith("Up")?h.startsWith("to")||h.startsWith("yoyo")?r=d-r:h.startsWith("from")&&(l.setProperty(i,s,d-r),r=d):h.endsWith("Right")||h.endsWith("Down")?h.startsWith("to")||h.startsWith("yoyo")?r=d+r:h.startsWith("from")&&(l.setProperty(i,s,d+r),r=d):"from"===h&&(l.setProperty(i,s,r),r=d);var c=h.startsWith("yoyo");l.easeProperty(i,{property:s,value:r,duration:n,ease:a,repeat:o,yoyo:c})}};const Wl=[function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a=i.split(".");Dl(a,s)&&(n=a[1],kr.call(t,`${s}.add`,jl,[s,n,...r],t),e.skipEvent())}})).on("-",(function(i){if(!e.skipEventFlag){var r,n=i.split(".");Dl(n,s)&&(r=n[1],kr.call(t,`${s}.remove`,Al,[s,r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;e.on("-",(function(i){e.skipEventFlag||i===s&&(kr.call(t,`${s}.removeall`,zl,s,t),e.skipEvent())}))},function(t,e,i){var s=i.name;e.on("+",(function(i,...r){if(!e.skipEventFlag){var n,a,o=i.split(".");(function(t,e){return 3===t.length&&t[0]===e})(o,s)&&(n=o[1],a=o[2],kr.call(t,`${s}.call`,Fl,[s,n,a,...r],t),e.skipEvent())}}))},function(t,e,i){var s=i.name;t.getGameObjectManager(s),e.on("+",(function(i,r,n,a,o){if(!e.skipEventFlag){var h,l,d,c=i.split(".");(function(t,e){return 4===t.length&&t[0]===e&&Yl[t[3]]})(c,s)&&(h=c[1],l=c[2],d=c[3],"number"==typeof a&&(o=a,a=void 0),kr.call(t,`${s}.ease`,Xl,[s,h,l,r,n,a,o,d],t),e.skipEvent())}}))}],Vl=Ho.addGameObjectManager;var Gl={addGameObjectManager(t,e){(t=t?Ge(t):{}).name||console.warn("[TextPlayer] Parameter 'name' is required in addGameObjectManager(config) method");var i=t.defaultLayer,s=t.createGameObject,r=this.layerManager;t.createGameObject=function(t,...e){var n=s.call(this,t,...e);return i&&r&&r.addToLayer(i,n),n},Vl.call(this,t,e);for(var n=t.parseCallbacks,a=0,o=(n=n?[...n,...Wl]:Wl).length;a0)return hd.length=0,!0;return hd.length=0,!1},hd=[],ld=void 0;const dd=Phaser.Utils.Objects.GetValue;var cd=function(t,e,i){var s,r;for(var n in void 0===i&&(i={}),t)s=t[n],void 0!==(r=dd(e,n,s[1]))&&(i[s[0]]=r);return i},ud=function(t){t.addEventListener("touchstart",pd,!1),t.addEventListener("touchmove",pd,!1),t.addEventListener("touchend",pd,!1),t.addEventListener("mousedown",pd,!1),t.addEventListener("mouseup",pd,!1),t.addEventListener("mousemove",pd,!1)},pd=function(t){t.stopPropagation()},gd=function(){return this.close(),this.emit("keydown-ENTER",this.parent,this),this},vd=function(){this.isOpened=!0,this.initText(),this.enterCloseEnable&&this.scene.input.keyboard.once("keydown-ENTER",gd,this),this.scene.sys.events.on("postupdate",this.updateText,this),this.clickOutSideTarget?(wa.call(this.clickOutSideTarget,this.parent),ka.call(this.clickOutSideTarget,this.parent),this.clickOutSideTarget.setInteractive().on("pointerdown",this.onClickOutside,this)):this.scene.input.on("pointerdown",this.onClickOutside,this),this.onOpenCallback&&this.onOpenCallback(this.parent,this),this.emit("open",this)},fd=function(){this.isOpened=!1,this.updateText(),this.enterCloseEnable&&this.scene.input.keyboard.off("keydown-ENTER",gd,this),this.scene.sys.events.off("postupdate",this.updateText,this),this.clickOutSideTarget?this.clickOutSideTarget.disableInteractive().off("pointerdown",this.onClickOutside,this):this.scene.input.off("pointerdown",this.onClickOutside,this),this.onCloseCallback&&this.onCloseCallback(this.parent,this),function(t){if(t){var e=t.parentElement;e&&e.removeChild(t)}}(this.node),this.node=void 0,this.emit("close",this)};const md=Phaser.Utils.Objects.GetValue;var yd=function(t,e){var i,s=md(e,"inputType",void 0);void 0===s&&(s=md(e,"type","text")),"textarea"===s?(i=document.createElement("textarea")).style.resize="none":(i=document.createElement("input")).type=s;var r=md(e,"style",void 0),n=i.style;cd(rd,r,n),n.position="absolute",n.opacity=0,n.pointerEvents="none",n.zIndex=0,n.transform="scale(0)",cd(sd,e,i),ud(i);var a=t.scene.sys.scale;return(a.isFullscreen?a.fullscreenTarget:document.body).appendChild(i),i.addEventListener("focus",(function(e){vd.call(t)})),i.addEventListener("blur",(function(e){fd.call(t)})),i},bd={open:function(){return this.isOpened||this.readOnly||((t=this)!==ld&&(void 0!==ld&&ld.close(),ld=t),this.node||(this.node=yd(this,this.nodeConfig)),this.setFocus()),this;var t},close:function(){return this.isOpened?(this===ld&&(ld=void 0),this.setBlur(),this):this}};const xd=Phaser.Utils.Objects.GetValue;class Cd extends Ia{constructor(t,e){super(t);var i=xd(e,"inputType",void 0);void 0===i&&(i=xd(e,"type","text")),this.setEnterCloseEnable(xd(e,"enterClose","textarea"!==i));var s=xd(e,"onOpen",void 0);s||(s=xd(e,"onFocus",void 0)),this.onOpenCallback=s,this.clickOutSideTarget=xd(e,"clickOutSideTarget",void 0);var r=xd(e,"onClose",void 0);r||(r=xd(e,"onBlur",void 0)),this.onCloseCallback=r,this.onUpdateCallback=xd(e,"onUpdate",void 0),this.isOpened=!1,t.on("pointerdown",(function(){this.open()}),this).setInteractive(),this.nodeConfig=function(t){void 0===t&&(t={});var e={};return nd(t,e,"inputType"),nd(t,e,"type"),nd(t,e,"style"),nd(t,e,rd),nd(t,e,sd),e}(e),this.node=void 0}destroy(){this.close(),this.clickOutSideTarget&&this.clickOutSideTarget.destroy(),super.destroy()}onClickOutside(t){ad(this.parent,t)||this.close()}setEnterCloseEnable(t){return void 0===t&&(t=!0),this.enterCloseEnable=t,this}initText(){}updateText(){}get text(){return this.node?this.node.value:""}set text(t){this.node&&(this.node.value=t)}setText(t){return this.text=t,this}get maxLength(){return this.nodeConfig.maxLength}set maxLength(t){this.nodeConfig.maxLength=t,this.node&&(this.node.maxLength=t)}setMaxLength(t){return this.maxLength=t,this}get minLength(){return this.nodeConfig.minLength}set minLength(t){this.nodeConfig.minLength=t,this.node&&(this.node.minLength=t)}setMinLength(t){return this.minLength=t,this}get placeholder(){return this.node.placeholder}set placeholder(t){this.node&&(this.node.placeholder=t)}setPlaceholder(t){return this.placeholder=t,this}selectText(t,e){return this.node?(void 0===t?this.node.select():this.node.setSelectionRange(t,e),this):this}selectAll(){return this.selectText(),this}get selectionStart(){return this.node?this.node.selectionStart:0}get selectionEnd(){return this.node?this.node.selectionEnd:0}get selectedText(){if(!this.node)return"";var t=this.node;return t.value.substring(t.selectionStart,t.selectionEnd)}get cursorPosition(){return this.node?this.node.selectionStart:0}set cursorPosition(t){this.node&&this.node.setSelectionRange(t,t)}setCursorPosition(t){return void 0===t?t=this.text.length:t<0&&(t=this.text.length+t),this.cursorPosition=t,this}get tooltip(){return this.node?this.node.title:""}set tooltip(t){if(!this.node)return this;this.node.title=t}setTooltip(t){return this.tooltip=t,this}setTextChangedCallback(t){return this.onTextChanged=t,this}get readOnly(){return this.nodeConfig.readOnly}set readOnly(t){this.nodeConfig.readOnly=t,this.node&&(this.node.readOnly=t)}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}get spellCheck(){return this.node?this.node.spellcheck:""}set spellCheck(t){this.node&&(this.node.spellcheck=t)}setSpellCheck(t){return this.spellCheck=t,this}get fontColor(){if(this.node)return this.node.style.color}set fontColor(t){this.node&&(this.node.style.color=t)}setFontColor(t){return this.fontColor=t,this}setStyle(t,e){return this.node?(this.node.style[t]=e,this):this}getStyle(t){if(this.node)return this.node.style[t]}scrollToBottom(){return this.node?(this.node.scrollTop=this.node.scrollHeight,this):this}setEnabled(t){return this.node?(void 0===t&&(t=!0),this.node.disabled=!t,this):this}setBlur(){return this.node?(this.node.blur(),this):this}setFocus(){return this.node?(this.node.focus(),this):this}get isFocused(){return this.isOpened}}Object.assign(Cd.prototype,bd);var kd=function(t,e,i){t=t.replace(" ","");var s=i.previousText;if(t===s)return t;if(isNaN(t)){i.emit("nan",t,i),t=s;var r=i.cursorPosition-1;i.setText(t),i.setCursorPosition(r)}else i.previousText=t;return t},wd=function(t){var e=t.prevSelectionStart;if(null!==e){for(var i=t.prevSelectionEnd,s=t.parent,r=e;r=r&&h=i&&hi.length&&(t.prevCursorPosition=null),null!==t.prevCursorPosition&&(s=e.getCharChild(t.prevCursorPosition))&&("\n"===s.text&&s.clearTextSize(),e.emit("cursorout",s,t.prevCursorPosition,e)),null!=r&&(s=e.getCharChild(r))&&("\n"===s.text&&s.copyTextSize(e.lastInsertCursor),function(t){var e,i,s=t.parent,r=s.width,n=s.height,a=t.drawX,o=t.drawY,h=a+t.drawTLX,l=a+t.drawTRX,d=o+t.drawTLY,c=o+t.drawBLY;e=h<0?0-h:l>r?r-l:0,i=d<0?0-d:c>n?n-c:0,s._textOX+=e,s._textOY+=i}(s),e.emit("cursorin",s,r,e)),e.emit("movecursor",r,t.prevCursorPosition,e),t.prevCursorPosition=r)}(this)):(wd(this),Sd(this)),this}setNumberInput(){return this.onUpdateCallback=kd,this}setSelectAllWhenFocusEnable(t){return void 0===t&&(t=!0),this.selectAllWhenFocus=t,this}setRequestCursorPosition(t){return this.isOpened?(this.requestCursorPosition=t,this):this}};const Od=Phaser.Utils.Objects.GetValue,Md=["inputType","onOpen","clickOutSideTarget","onFocus","onClose","onBlur","onUpdate","enterClose","readOnly","maxLength","minLength","selectAll"];var Ed=function(t,e){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return!0;if(-1!==e.indexOf(".")){for(var i=e.split("."),s=t,r=0;r0))return e;return null}(e);if(i){e.setScrollFactor(0).setOrigin(.5);var s=t.sys.scale.gameSize,r=s.width,n=s.height,a=1/i.zoom,o=r/2,h=n/2,l=r*a,d=n*a;e.x===o&&e.y===h||e.setPosition(o,h),e.width===l&&e.height===d||e.setSize(l,d)}}}const Ld=Phaser.GameObjects.Zone;let Bd=class extends Ld{constructor(t){super(t,0,0,2,2),this.fullWindow=new Rd(this)}};var Id=function(t,e,i,s){if(void 0===i&&(i="."),void 0===s&&(s={}),!t)return s;if(e in t)return Object.assign(s,t[e]);for(var r in e+=i,t)r.startsWith(e)&&(s[r.replace(e,"")]=t[r]);return s},Dd=function(){var t=this.scene.input.keyboard;this.textEdit.on("open",(function(){t.on("keydown-UP",this.cursorMoveUp,this).on("keydown-DOWN",this.cursorMoveDown,this)}),this).on("close",(function(){t.off("keydown-UP",this.cursorMoveUp,this).off("keydown-DOWN",this.cursorMoveDown,this)}),this)},jd=function(t,e,i){if(void 0===i&&(i={}),Array.isArray(e))for(var s=0,r=e.length;st.length?i:t})),a.value=t.join(e)}else a.value=t.join(i.slice(o,o+a.count));o+=a.count,a.added||(h+=a.count)}}let l=e[a-1];return a>1&&"string"==typeof l.value&&(l.added||l.removed)&&t.equals("",l.value)&&(e[a-2].value+=l.value,e.pop()),e}Xd.prototype={diff(t,e,i={}){let s=i.callback;"function"==typeof i&&(s=i,i={}),this.options=i;let r=this;function n(t){return s?(setTimeout((function(){s(void 0,t)}),0),!0):t}t=this.castInput(t),e=this.castInput(e),t=this.removeEmpty(this.tokenize(t));let a=(e=this.removeEmpty(this.tokenize(e))).length,o=t.length,h=1,l=a+o;i.maxEditLength&&(l=Math.min(l,i.maxEditLength));let d=[{newPos:-1,components:[]}],c=this.extractCommon(d[0],e,t,0);if(d[0].newPos+1>=a&&c+1>=o)return n([{value:this.join(e),count:e.length}]);function u(){for(let s=-1*h;s<=h;s+=2){let h,l=d[s-1],c=d[s+1],u=(c?c.newPos:0)-s;l&&(d[s-1]=void 0);let p=l&&l.newPos+1=a&&u+1>=o)return n(Wd(r,h.components,e,t,r.useLongestToken));d[s]=h}else d[s]=void 0}var i;h++}if(s)!function t(){setTimeout((function(){if(h>l)return s();u()||t()}),0)}();else for(;h<=l;){let t=u();if(t)return t}},pushComponent(t,e,i){let s=t[t.length-1];s&&s.added===e&&s.removed===i?t[t.length-1]={count:s.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon(t,e,i,s){let r=e.length,n=i.length,a=t.newPos,o=a-s,h=0;for(;a+1t,tokenize:t=>t.split(""),join:t=>t.join("")};const Vd=new Xd,Gd=/^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u,Hd=/\S/,Ud=new Xd;Ud.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Hd.test(t)&&!Hd.test(e)},Ud.tokenize=function(t){let e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);for(let t=0;tvoid 0===i?e:i}=this.options;return"string"==typeof t?t:JSON.stringify(Jd(t,null,null,i),i," ")},Kd.equals=function(t,e){return Xd.prototype.equals.call(Kd,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};const qd=new Xd;qd.tokenize=function(t){return t.slice()},qd.join=qd.removeEmpty=function(t){return t};const Zd=Phaser.Utils.Array.Remove;var Qd=function(t,e){var i=t.text;if(e!==i){if(null==i&&(i=""),Zd(t.children,t.lastInsertCursor),""===e)t.removeChildren();else for(var s=(h=i,l=e,Vd.diff(h,l,d)),r=0,n=0,a=s.length;nr)i+=a;else{if(s!==r)break;i+=Math.min(e.position,a)}}return i},rc={cursorMoveLeft(){if(!this.isOpened)return this;var t=ec(this.cursorPosition-1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveRight(){if(!this.isOpened)return this;var t=ec(this.cursorPosition+1,0,this.inputText.length);return this.setCursorPosition(t),this},cursorMoveUp(){if(!this.isOpened)return this;var t=ic(this.characterCountOfLines,this.cursorPosition);t.lineIndex-=1;var e=ec(sc(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this},cursorMoveDown(){if(!this.isOpened)return this;var t=ic(this.characterCountOfLines,this.cursorPosition);t.lineIndex+=1;var e=ec(sc(this.characterCountOfLines,t),0,this.inputText.length);return this.setCursorPosition(e),this}};const nc=Phaser.Utils.Objects.IsPlainObject;class ac extends dn{constructor(t,e,i,s,r,n){nc(e)?n=e:nc(s)&&(n=s),void 0===n&&(n={}),function(t,e){var i=!e.textArea;if(Ed(e,"wrap.vAlign")||P(e,"wrap.vAlign",s=i?"center":"top"),Ed(e,"wrap.wrapMode")||P(e,"wrap.wrapMode","char"),Ed(e,"wrap.maxLines")||P(e,"wrap.maxLines",s=i?1:void 0),i&&P(e,"wrap.wrapWidth",1/0),Ed(e,"wrap.useDefaultTextHeight")||P(e,"wrap.useDefaultTextHeight",!0),e.edit||(e.edit={}),!Ed(e.edit,"inputType")){var s=i?"text":"textarea";P(e.edit,"inputType",s)}if(!0===e.clickOutSideTarget){var r=new Bd(t);t.add.existing(r),e.clickOutSideTarget=r}}(t,n);var a=n.text;a&&delete n.text;var o=Id(n.background,"focus"),h=Id(n.style,"cursor"),l=Id(n.style,"range");super(t,e,i,s,r,n),this.type="rexCanvasInput",this.contentWidth=void 0,this.contentHeight=void 0,this.lineHeight=void 0,this.linesCount=void 0,this.characterCountOfLines=[],this._text,this.textEdit=function(t,e){var i=Od(e,"edit");return void 0===i&&(i={}),nd(e,i,Md),new Td(t,i)}(this,n),Dd.call(this),n.focusStyle&&Object.assign(o,n.focusStyle),Yd.call(this,o),n.cursorStyle&&Object.assign(h,n.cursorStyle),zd.call(this,h),n.rangeStyle&&Object.assign(l,n.rangeStyle),fn(l)&&Object.assign(l,h),Fd.call(this,l);var d=n.onAddChar;d&&this.on("addchar",d);var c=n.onCursorIn;c&&this.on("cursorin",c);var u=n.onCursorOut;u&&this.on("cursorout",u);var p=!n.onRangeIn&&!n.onRangeOut,g=p?n.onCursorIn:n.onRangeIn;g&&this.on("rangein",g);var v=p?n.onCursorOut:n.onRangeOut;v&&this.on("rangeout",v);var f,m=n.onMoveCursor;m&&this.on("movecursor",m),this.setParseTextCallback(n.parseTextCallback),this.lastInsertCursor=((f=this.createCharChild("|")).text="",f),a||(a=""),this.setText(a)}addChild(t,e){if(super.addChild(t,e),Array.isArray(t))for(var i=t,s=0,r=i.length;s0,a=0,o=e.length;a0;this.dirty=this.dirty||this._radiusTL!==t||this._convexTL!==e,this._convexTL=e,this._radiusTL=Math.abs(t)}get radiusTR(){return this._radiusTR}set radiusTR(t){var e=t>0;this.dirty=this.dirty||this._radiusTR!==t||this._convexTR!==e,this._convexTR=e,this._radiusTR=Math.abs(t)}get radiusBL(){return this._radiusBL}set radiusBL(t){var e=t>0;this.dirty=this.dirty||this._radiusBL!==t||this._convexBL!==e,this._convexBL=e,this._radiusBL=Math.abs(t)}get radiusBR(){return this._radiusBR}set radiusBR(t){var e=t>0;this.dirty=this.dirty||this._radiusBR!==t||this._convexBR!==e,this._convexBR=e,this._radiusBR=Math.abs(t)}get radius(){return Math.max(this.radiusTL,this.radiusTR,this.radiusBL,this.radiusBR)}set radius(t){"number"==typeof t?(this.radiusTL=t,this.radiusTR=t,this.radiusBL=t,this.radiusBR=t):(this.radiusTL=Zc(t,"tl",0),this.radiusTR=Zc(t,"tr",0),this.radiusBL=Zc(t,"bl",0),this.radiusBR=Zc(t,"br",0))}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){var t=this.pathData;t.length=0;var e,i=this.width,s=this.height,r=this.iterations+1;return(e=this.radiusTL)>0?this._convexTL?Bt(e,e,e,e,180,270,!1,r,t):Bt(0,0,e,e,90,0,!0,r,t):Rt(0,0,t),(e=this.radiusTR)>0?this._convexTR?Bt(i-e,e,e,e,270,360,!1,r,t):Bt(i,0,e,e,180,90,!0,r,t):Rt(i,0,t),(e=this.radiusBR)>0?this._convexBR?Bt(i-e,s-e,e,e,0,90,!1,r,t):Bt(i,s,e,e,270,180,!0,r,t):Rt(i,s,t),(e=this.radiusBL)>0?this._convexBL?Bt(e,s-e,e,e,90,180,!1,r,t):Bt(0,s,e,e,360,270,!0,r,t):Rt(0,s,t),t.push(t[0],t[1]),Ic(this.x,this.y,t),super.updateData(),this}}const tu=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var eu={buildShapes(){this.addShape((new Qc).setName("box")).addShape((new Jc).setName("checker"))},updateShapes(){var t=this.width/2,e=this.height/2,i=Math.min(t,e),s=2*i,r=t-i,n=e-i,a=this.boxLineWidth,o=Math.max(s/10,2),h=this.getShape("box"),l=this.getShape("checker");if(this.isSizeChanged){var d=s*(1-this.boxSize)/2,c=a/2,u=s*this.boxSize-a;h.setTopLeftPosition(r+c+d,n+c+d).setSize(u,u),this.isCircleShape?h.setRadius(u/2):h.setRadius(0),d=s*(1-this.checkerSize)/2;var p=s*this.checkerSize/4,g=1*p,v=2*p,f=3*p;l.startAt(g,v).lineTo(v,f).lineTo(f,g).offset(r+d,n+d).end()}this.checked?(h.fillStyle(this.boxFillColor,this.boxFillAlpha).lineStyle(a,this.boxStrokeColor,this.boxStrokeAlpha),l.lineStyle(o,this.checkerColor)):(h.fillStyle(this.uncheckedBoxFillColor,this.uncheckedBoxFillAlpha).lineStyle(a,this.uncheckedBoxStrokeColor,this.uncheckedBoxStrokeAlpha),l.lineStyle()),this.checked&&l.setDisplayPathSegment(this.checkerAnimProgress)}};const iu=Phaser.Utils.Objects.GetValue,su=Phaser.Math.Linear;class ru extends Qa{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=iu(t,"key","value");var i=e[this.propertyKey];return this.fromValue=iu(t,"from",i),this.toValue=iu(t,"to",i),this.setEase(iu(t,"ease",this.ease)),this.setDuration(iu(t,"duration",this.duration)),this.setRepeat(iu(t,"repeat",0)),this.setDelay(iu(t,"delay",0)),this.setRepeatDelay(iu(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=su(this.fromValue,this.toValue,i)}}var nu={setCheckerAnimationDuration(t){return void 0===t&&(t=0),this.checkerAnimDuration=t,this},playCheckerAnimation(){return void 0===this.checkerAnimProgressTask&&(this.checkerAnimProgressTask=new ru(this,{eventEmitter:null})),this.checkerAnimProgressTask.restart({key:"checkerAnimProgress",from:0,to:1,duration:this.checkerAnimDuration}),this},stopCheckerAnimation(){return void 0===this.checkerAnimProgressTask||this.checkerAnimProgressTask.stop(),this}},au={};Object.assign(au,yc,bc,eu,nu);const ou=23730,hu=Phaser.Utils.Objects.GetValue,lu=Phaser.Utils.Objects.IsPlainObject;class du extends mc{constructor(t,e,i,s,r,n,a){lu(e)?(e=hu(a=e,"x",0),i=hu(a,"y",0),s=hu(a,"width",2),r=hu(a,"height",2),n=hu(a,"color",ou)):lu(n)&&(n=hu(a=n,"color",ou)),super(t,e,i,s,r),this.type="rexCheckbox",void 0===n&&(n=ou),this.setBoxShape(hu(a,"circleBox",!1)),this.setBoxFillStyle(n,hu(a,"boxFillAlpha",1)),this.setUncheckedBoxFillStyle(hu(a,"uncheckedColor",null),hu(a,"uncheckedBoxFillAlpha",1)),this.setBoxStrokeStyle(hu(a,"boxLineWidth",4),hu(a,"boxStrokeColor",n),hu(a,"boxStrokeAlpha",1)),this.setUncheckedBoxStrokeStyle(this.boxLineWidth,hu(a,"uncheckedBoxStrokeColor",this.boxStrokeColor),hu(a,"uncheckedBoxStrokeAlpha",this.boxStrokeAlpha)),this.setCheckerStyle(hu(a,"checkerColor",16777215),hu(a,"checkerAlpha",1)),this.setBoxSize(hu(a,"boxSize",1)),this.setCheckerSize(hu(a,"checkerSize",1)),this.setCheckerAnimationDuration(hu(a,"animationDuration",150)),this.buildShapes();var o=hu(a,"checked");void 0===o&&(o=hu(a,"value",!1)),this.setValue(o)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,t?this.playCheckerAnimation():this.stopCheckerAnimation(),this.emit("valuechange",t))}setValue(t){return this.value=t,this}toggleValue(){return this.setValue(!this.value),this}get checked(){return this.value}set checked(t){this.value=t}setChecked(t){return void 0===t&&(t=!0),this.setValue(t),this}toggleChecked(){return this.toggleValue(),this}get checkerAnimProgress(){return this._checkerAnimProgress}set checkerAnimProgress(t){this._checkerAnimProgress!==t&&(this._checkerAnimProgress=t,this.dirty=!0)}}Object.assign(du.prototype,au);const cu=Phaser.Utils.Objects.GetValue;class uu extends Ia{constructor(t,e){super(t,e),this._enable=void 0,t.setInteractive(cu(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.lastClickTime=void 0,this.isDown=!1,this.isOver=!1,this.setEnable(cu(t,"enable",!0)),this.setMode(cu(t,"mode",1)),this.setClickInterval(cu(t,"clickInterval",100)),this.setDragThreshold(cu(t,"threshold",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this)}shutdown(t){this.isShutdown||(this.pointer=null,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setMode(t){return"string"==typeof t&&(t=pu[t]),this.mode=t,this}setClickInterval(t){return this.clickInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}onPress(t,e,i,s){void 0===this.pointer&&(this.pointer=t,this.isDown=!0,this.emit("down",this,this.parent,t,s),0===this.mode&&this.click(t.downTime,t,s))}onRelease(t,e,i,s){this.pointer===t&&(this.isDown=!1,this.emit("up",this,this.parent,t,s),1===this.mode&&this.click(t.upTime,t,s),this.pointer=void 0)}onPointOut(t,e){this.pointer===t&&this.cancel()}onMove(t,e,i,s){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel()}onOver(t,e,i,s){return this.enable?(this.isOver=!0,this.emit("over",this,this.parent,t,s),this):this}onOut(t,e){return this.enable?(this.isOver=!1,this.emit("out",this,this.parent,t,e),this):this}click(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var s=this.lastClickTime;return void 0!==s&&t-s<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}cancel(){return this.pointer=void 0,this}}const pu={press:0,pointerdown:0,release:1,pointerup:1},gu=Phaser.Utils.Objects.GetValue,vu=Phaser.Utils.Objects.IsPlainObject;class fu extends du{constructor(t,e,i,s,r,n,a){vu(e)?(e=gu(a=e,"x",0),i=gu(a,"y",0),s=gu(a,"width",2),r=gu(a,"height",2),n=gu(a,"color",ou)):vu(n)&&(n=gu(a=n,"color",ou)),super(t,e,i,s,r,n,a),this._click=new uu(this,gu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(gu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("checkbox",(function(t,e,i,s,r,n){var a=new fu(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Checkbox",fu);var mu={setTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.trackFillColor!==t||this.trackFillAlpha!==e,this.trackFillColor=t,this.trackFillAlpha=e,this},setFalseValueTrackFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.falseValueTrackColor!==t||this.uncheckedTrackFillAlpha!==e,this.falseValueTrackColor=t,this.falseValueTrackFillAlpha=e,this},setThumbStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.thumbColor!==t||this.checkAlpha!==e,this.thumbColor=t,this.thumbAlpha=e,this}},yu={setTrackSize(t,e){return this.dirty=this.dirty||this.trackWidth!==t||this.trackHeight!==e,this.trackWidth=t,this.trackHeight=e,this},setTrackRadius(t){return this.dirty=this.dirty||this.trackRadius!==t,this.trackRadius=t,this},setThumbSize(t,e){return void 0===e&&(e=t),this.dirty=this.dirty||this.thumbWidth!==t||this.thumbHeight!==e,this.thumbWidth=t,this.thumbHeight=e,this},setThumbRadius(t){return this.dirty=this.dirty||this.thumbRadius!==t,this.thumbRadius=t,this}},bu={setThumbPosition(t,e){return void 0===e&&(e=1-t),this.thumbLeftX=t,this.thumbRightX=e,this},setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}},xu=function(t,e,i){return(e-t)*i+t};const Cu=Phaser.Math.Linear;var ku={buildShapes(){this.addShape((new Qc).setName("track")).addShape((new Qc).setName("thumb"))},updateShapes(){var t=this.width,e=this.height,i=this.value?this.toggleAnimProgress:1-this.toggleAnimProgress,s=this.getShape("track");if(this.isSizeChanged){var r=t*this.trackWidth,n=e*this.trackHeight,a=(t-r)/2,o=(e-n)/2,h=e*this.trackRadius;s.setTopLeftPosition(a,o).setSize(r,n).setRadius(h)}var l,d,c,u=(l=this.falseValueTrackColor,d=this.trackFillColor,c=i,(255&xu(bn(l),bn(d),c))<<16|(255&xu(xn(l),xn(d),c))<<8|255&xu(Cn(l),Cn(d),c)),p=Cu(this.falseValueTrackFillAlpha,this.trackFillAlpha,i);s.fillStyle(u,p);var g=this.getShape("thumb");if(this.isSizeChanged){var v=t*this.thumbWidth,f=e*this.thumbHeight,m=e*this.thumbRadius;g.setSize(v,f).setRadius(m)}var y=Cu(this.thumbLeftX,this.thumbRightX,i)*t;this.rtl&&(y=t-y);var b=e/2;g.setCenterPosition(y,b),g.fillStyle(this.thumbColor,this.thumbAlpha)}},wu={setToggleAnimationDuration(t){return void 0===t&&(t=0),this.toggleAnimDuration=t,this},playToggleAnimation(){return void 0===this.toggleAnimProgressTask&&(this.toggleAnimProgressTask=new ru(this,{eventEmitter:null})),this.toggleAnimProgressTask.restart({key:"toggleAnimProgress",from:0,to:1,duration:this.toggleAnimDuration}),this},stopToggleAnimation(){return void 0===this.toggleAnimProgressTask||this.toggleAnimProgressTask.stop(),this}},Su={};Object.assign(Su,mu,yu,bu,ku,wu);const Pu=Phaser.Utils.Objects.GetValue,Tu=Phaser.Utils.Objects.IsPlainObject,Ou=23730;class Mu extends mc{constructor(t,e,i,s,r,n,a){Tu(e)?(e=Pu(a=e,"x",0),i=Pu(a,"y",0),s=Pu(a,"width",2),r=Pu(a,"height",2),n=Pu(a,"color",Ou)):Tu(n)&&(n=Pu(a=n,"color",Ou)),super(t,e,i,s,r),this.type="rexToggleSwitch",void 0===n&&(n=Ou),this.setTrackFillStyle(n,Pu(a,"trackFillAlpha",1)),this.setFalseValueTrackFillStyle(Pu(a,"falseValueTrackColor",function(t){var e=.3*bn(t)+.59*xn(t)+.11*Cn(t);return(255&e)<<16|(255&e)<<8|255&e}(n)),Pu(a,"falseValueTrackFillAlpha",1)),this.setThumbStyle(Pu(a,"thumbColor",16777215),Pu(a,"thumbAlpha",1)),this.setTrackSize(Pu(a,"trackWidth",.9),Pu(a,"trackHeight",.5)),this.setTrackRadius(Pu(a,"trackRadius",.5*this.trackHeight));var o=Pu(a,"thumbHeight",void 0),h=Pu(a,"thumbWidth",o);void 0===h&&(h=.9*this.trackHeight),this.setThumbSize(h,o),this.setThumbRadius(Pu(a,"thumbRadius",.5*this.thumbHeight)),this.setThumbPosition(Pu(a,"thumbLeft",.3),Pu(a,"thumbRight",void 0)),this.setRTL(Pu(a,"rtl",!1)),this.setToggleAnimationDuration(Pu(a,"animationDuration",150)),this.buildShapes(),this.setValue(Pu(a,"value",!1),0)}get value(){return this._value}set value(t){t=!!t,this._value!==t&&(this.dirty=!0,this._value=t,this.playToggleAnimation(),this.emit("valuechange",t))}setValue(t,e){void 0===e&&(e=this.toggleAnimDuration);var i=this.toggleAnimDuration;return this.toggleAnimDuration=e,this.value=t,this.toggleAnimDuration=i,this}toggleValue(t){return this.setValue(!this.value,t),this}get toggleAnimProgress(){return this._toggleAnimProgress}set toggleAnimProgress(t){this._toggleAnimProgress!==t&&(this._toggleAnimProgress=t,this.dirty=!0)}}Object.assign(Mu.prototype,Su);const Eu=Phaser.Utils.Objects.GetValue;class _u extends Mu{constructor(t,e,i,s,r,n,a){super(t,e,i,s,r,n,a),this._click=new uu(this,Eu(a,"click")),this._click.on("click",(function(){this.toggleValue()}),this),this.setReadOnly(Eu(a,"readOnly",!1))}get readOnly(){return!this._click.enable}set readOnly(t){this._click.enable=!t}setReadOnly(t){return void 0===t&&(t=!0),this.readOnly=t,this}}t.register("toggleSwitch",(function(t,e,i,s,r,n){var a=new _u(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.ToggleSwitch",_u);var Ru={loadFromURL(t,e){var i=this,s=new Image;return s.onload=function(){i.width!==s.width||i.height!==s.height?i.resize(s.width,s.height):i.clear(),i.context.drawImage(s,0,0),i.updateTexture(),e&&e(),s.onload=null,s.src="",s.remove()},s.src=t,this},loadFromURLPromise(t){var e=this;return new Promise((function(i,s){e.loadFromURL(t,i)}))},loadFromFile(t,e){var i=URL.createObjectURL(t);return this.loadFromURL(i,(function(){URL.revokeObjectURL(i),e&&e()})),this},loadFromFilePromise(t){var e=this;return new Promise((function(i,s){e.loadFromFile(t,i)}))}};class Lu extends $t{}Object.assign(Lu.prototype,Ru),t.register("canvas",(function(t,e,i,s){var r=new Lu(this.scene,t,e,i,s);return this.scene.add.existing(r),r})),P(window,"RexPlugins.UI.Canvas",Lu);const Bu=Phaser.Utils.Objects.GetValue;class Iu extends $t{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexCircleMaskImage",this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={maskType:i});var s=Bu(i,"maskType",0),r=Bu(i,"backgroundColor",void 0),n=Bu(i,"strokeColor",void 0),a=Bu(i,"strokeWidth",null!=n?10:0);if(void 0===s?s=0:"string"==typeof s&&(s=Du[s]),this._textureKey=t,this._frameName=e,null===s)return this.loadTexture(t,e),this.dirty=!0,this;var o=this.scene.sys.textures.getFrame(t,e);if(!o)return this;o.cutWidth!==this.width||o.cutHeight!==this.height?this.setCanvasSize(o.cutWidth,o.cutHeight):this.clear();var h=this.canvas,l=this.context,d=h.width,c=h.height;null!=r&&(l.fillStyle=r,l.fillRect(0,0,d,c)),l.save(),l.beginPath();var u=a/2;switch(s){case 1:var p=(m=Math.floor(d/2))-u,g=(y=Math.floor(c/2))-u;l.ellipse(m,y,p,g,0,0,2*Math.PI);break;case 2:var v=Bu(i,"radius",0),f=Bu(i,"iteration",void 0);Qt(l,u,u,d-a,c-a,v,f);break;default:var m=Math.floor(d/2),y=Math.floor(c/2),b=Math.min(m,y)-u;l.arc(m,y,b,0,2*Math.PI)}return null!=n&&(l.strokeStyle=n,l.lineWidth=a,l.stroke()),l.clip(),this.loadTexture(t,e),l.restore(),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}const Du={circle:0,ellipse:1,roundRectangle:2};t.register("circleMaskImage",(function(t,e,i,s,r){var n=new Iu(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.CircleMaskImage",Iu);const ju=Phaser.Utils.Objects.GetValue;class Au extends $t{constructor(t,e,i,s,r,n){super(t,e,i),this.type="rexAlphaMaskImage",this.maskFrame=null,this.setTexture(s,r,n)}setTexture(t,e,i){"object"==typeof e&&(i=e,e=void 0),"string"==typeof i&&(i={mask:{key:i}});var s=ju(i,"mask.key"),r=ju(i,"mask.frame"),n=ju(i,"mask.invertAlpha",!1),a=ju(i,"mask.scale"),o=ju(i,"backgroundColor");if(s){this._maskKey=s,this._maskFrame=r,this._maskScale=a;var h=s?this.scene.sys.textures.get(s):null;this.maskFrame=h?h.get(r):null}this._textureKey=t,this._frameName=e;var l=this.maskFrame;if(null===l)return this.loadTexture(t,e),this.dirty=!0,this;var d=null!=o;this.loadTexture(t,e);var c,u,p=this.canvas,g=this.context,v=p.width,f=p.height;g.save(),g.globalCompositeOperation=n?"destination-out":"destination-in",null!=this._maskScale?(c=l.cutWidth*this._maskScale,u=l.cutHeight*this._maskScale):(c=v,u=f);var m=(v-c)/2,y=(f-u)/2;return this.drawFrame(this._maskKey,this._maskFrame,m,y,c,u),g.restore(),d&&(g.save(),g.globalCompositeOperation="destination-over",g.fillStyle=o,g.fillRect(0,0,v,f),g.restore()),this.dirty=!0,this}resize(t,e){return this.setDisplaySize(t,e),this}}t.register("alphaMaskImage",(function(t,e,i,s,r){var n=new Au(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.AlphaMaskImage",Au);const zu=Phaser.Math.Linear,Fu=Phaser.Math.Percent;var Yu={setValue(t,e,i){return null==t||(void 0!==e&&(t=Fu(t,e,i)),this.value=t),this},addValue(t,e,i){return void 0!==e&&(t=Fu(t,e,i)),this.value+=t,this},getValue(t,e){var i=this.value;return void 0!==t&&(i=zu(t,e,i)),i}};const Xu=Phaser.Math.Percent;var Wu={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=Xu(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new ru(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,s){return void 0===i&&(i=-1),void 0===s&&(s=0),void 0===this.easeValueTask&&(this.easeValueTask=new ru(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:s}),this}};const Vu=Phaser.Utils.Objects.GetValue,Gu=Phaser.Math.Clamp;function Hu(t){class e extends t{bootProgressBase(t){this.eventEmitter=Vu(t,"eventEmitter",this);var e=Vu(t,"valuechangeCallback",null);if(null!==e){var i=Vu(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i)}return this.setEaseValuePropName("value").setEaseValueDuration(Vu(t,"easeValue.duration",0)).setEaseValueFunction(Vu(t,"easeValue.ease","Linear")),this}get value(){return this._value}set value(t){t=Gu(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter)}}return Object.assign(e.prototype,Yu,Wu),e}const Uu=Phaser.Math.RadToDeg,Nu=Phaser.Math.DegToRad;var $u=function(t,e,i,s,r,n,a,o){var h=360===Math.abs(a-n),l=Nu(n),d=Nu(a),c=Math.cos(l),u=Math.sin(l),p=Math.cos(d),g=Math.sin(d);return t.startAt(e+c*s,i+u*s),t.arc(e,i,s,n,a,o),h&&0===r||(t.lineTo(e+p*r,i+g*r),r>0&&t.arc(e,i,r,a,n,!o)),t.close(),t},Ku={buildShapes(){var t=this.iterations;this.addShape((new Jc).setIterations(t).setName("track")).addShape((new Jc).setIterations(t).setName("bar")).addShape((new Tc).setIterations(t).setName("center"))},updateShapes(){var t=this.radius,e=this.thickness*this.radius,i=this.radius,s=i-e,r=this.getShape("track");null!=this.trackColor&&this.thickness>0?(r.fillStyle(this.trackColor),$u(r,t,t,i,s,0,360,!1)):r.reset();var n,a,o,h=this.getShape("bar");null!=this.barColor&&this.thickness>0?(1===this.value?(n=!1,a=0,o=360):(n=this.anticlockwise,a=Uu(this.startAngle),o=360*(n?1-this.value:this.value)+a),h.fillStyle(this.barColor),$u(h,t,t,i+1,s-1,a,o,!1)):h.reset();var l=this.getShape("center");this.centerColor&&s>0?l.setCenterPosition(t,t).setRadius(s).fillStyle(this.centerColor):l.reset()}};const Ju=Phaser.Utils.Objects.GetValue,qu=Phaser.Utils.Objects.IsPlainObject,Zu=Phaser.Math.Clamp,Qu=Phaser.Math.DegToRad(270);let tp=class extends(Hu(mc)){constructor(t,e,i,s,r,n,a){qu(e)&&(e=Ju(a=e,"x",0),i=Ju(a,"y",0),s=Ju(a,"radius",1),r=Ju(a,"barColor",void 0),n=Ju(a,"value",0)),void 0===s&&(s=1);var o=2*s;super(t,e,i,o,o),this.type="rexCircularProgress",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(Ju(a,"trackColor",void 0)),this.setBarColor(r),this.setCenterColor(Ju(a,"centerColor",void 0)),this.setThickness(Ju(a,"thickness",.2)),this.setStartAngle(Ju(a,"startAngle",Qu)),this.setAnticlockwise(Ju(a,"anticlockwise",!1)),this.iterations=Ju(a,"iterations",128),this.buildShapes(),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t}setStartAngle(t){return this.startAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=Zu(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}setCenterColor(t){return this.centerColor=t,this}};Object.assign(tp.prototype,Ku),t.register("circularProgress",(function(t,e,i,s,r,n){var a=new tp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgress",tp);var ep=function(t,e,i,s,r,n,a,o,h,l,d,c){void 0===l&&(l=0),void 0===d&&(d=2*Math.PI),void 0===c&&(c=!1),e.beginPath(),e.ellipse(i,s,r,n,0,l,d,c),null!=a&&(e.fillStyle=a,e.fill()),null!=o&&(e.strokeStyle=o,e.lineWidth=h,e.stroke())};const ip=Phaser.Math.PI2;var sp=function(){var t,e=this.radius,i=this.thickness*this.radius,s=this.radius-i/2,r=this.radius-i,n=(this.canvas,this.context),a=this.anticlockwise,o=this.startAngle,h=this.endAngle,l=this._deltaAngle;if(this.trackColor&&i>0&&(n.save(),ep(0,n,e,e,s,s,void 0,this.trackColor,i,o,h,a),n.restore()),this.barColor&&s>0){var d,c;if(d=this.value>=1?h:a?(o-l*this.value+ip)%ip:(o+l*this.value)%ip,n.save(),this.barColor2){var u=e+s*Math.cos(o),p=e+s*Math.sin(o),g=e+s*Math.cos(d),v=e+s*Math.sin(d),f=n.createLinearGradient(u,p,g,v);f.addColorStop(0,this.barColor2),f.addColorStop(1,this.barColor),c=f}else c=this.barColor;ep(0,n,e,e,s,s,void 0,c,i,o,d,a),n.restore()}this.centerColor&&r>0&&(this.centerColor2?((t=this.context.createRadialGradient(e,e,0,e,e,r)).addColorStop(0,this.centerColor),t.addColorStop(1,this.centerColor2)):t=this.centerColor,n.save(),ep(0,n,e,e,r,r,t),n.restore()),this.textFormatCallback&&(this.textColor||this.textStrokeColor)&&(n.save(),function(t,e,i,s,r,n,a,o,h,l,d){void 0===h&&null!=o&&(h=2),void 0===l&&(l="start"),void 0===d&&(d="alphabetic"),e.font=n,e.textAlign=l,e.textBaseline=d,e.fillStyle=a,e.strokeStyle=o,e.lineWidth=h,e.lineCap="round",e.lineJoin="round",null!=o&&"none"!==o&&h>0&&e.strokeText(r,i,s),null!=a&&"none"!==a&&e.fillText(r,i,s)}(0,n,e,e,this.getFormatText(),this.textFont,this.textColor,this.textStrokeColor,this.textStrokeThickness,"center","middle"),n.restore())};const rp=Phaser.Utils.Objects.GetValue,np=Phaser.Utils.Objects.IsPlainObject,ap=Phaser.Math.Clamp,op=Phaser.Math.DegToRad(270),hp=Phaser.Math.PI2;class lp extends(Hu($t)){constructor(t,e,i,s,r,n,a){np(e)&&(e=rp(a=e,"x",0),i=rp(a,"y",0),s=rp(a,"radius",1),r=rp(a,"barColor",void 0),n=rp(a,"value",0));var o=2*s;super(t,e,i,o,o,rp(a,"resolution",1)),this.type="rexCircularProgressCanvas",this.bootProgressBase(a),this.setRadius(s),this.setTrackColor(rp(a,"trackColor",void 0)),this.setBarColor(r),this.setBarColor2(rp(a,"barColor2",void 0)),this.setCenterColor(rp(a,"centerColor",void 0)),this.setThickness(rp(a,"thickness",.2)),this.setStartAngle(rp(a,"startAngle",op)),this.setEndAngle(rp(a,"endAngle",this.startAngle+hp)),this.setAnticlockwise(rp(a,"anticlockwise",!1)),this.setTextColor(rp(a,"textColor",void 0)),this.setTextStrokeColor(rp(a,"textStrokeColor",void 0),rp(a,"textStrokeThickness",void 0));var h=rp(a,"textFont",void 0);h?this.setTextFont(h):this.setTextFont(rp(a,"textSize","16px"),rp(a,"textFamily","Courier"),rp(a,"textStyle","")),this.setTextFormatCallback(rp(a,"textFormatCallback",void 0),rp(a,"textFormatCallbackScope",void 0)),this.setValue(n)}resize(t,e){return(t=Math.floor(Math.min(t,e)))===this.width||(super.resize(t,t),this.setRadius(t/2)),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t;var e=2*t;this.resize(e,e)}setRadius(t){return this.radius=t,this}get trackColor(){return this._trackColor}set trackColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get barColor(){return this._barColor}set barColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get barColor2(){return this._barColor2}set barColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}setBarColor2(t){return this.barColor2=t,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!=t,this._startAngle=t,this._deltaAngle=dp(this._startAngle,this._endAngle,this._anticlockwise)}setStartAngle(t){return this.startAngle=t,this}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!=t,this._endAngle=t,this._deltaAngle=dp(this._startAngle,this._endAngle,this._anticlockwise)}setEndAngle(t){return this.endAngle=t,this}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!=t,this._anticlockwise=t,this._deltaAngle=dp(this._startAngle,this._endAngle,this._anticlockwise)}setAnticlockwise(t){return void 0===t&&(t=!0),this.anticlockwise=t,this}get thickness(){return this._thickness}set thickness(t){t=ap(t,0,1),this.dirty=this.dirty||this._thickness!=t,this._thickness=t}setThickness(t){return this.thickness=t,this}get centerColor(){return this._centerColor}set centerColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor!=t,this._centerColor=t}get centerColor2(){return this._centerColor2}set centerColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._centerColor2!=t,this._centerColor2=t}setCenterColor(t,e){return this.centerColor=t,this.centerColor2=e,this}get textColor(){return this._textColor}set textColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._textColor!=t,this._textColor=t}setTextColor(t){return this.textColor=t,this}get textStrokeColor(){return this._textStrokeColor}set textStrokeColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._textStrokeColor!=t,this._textStrokeColor=t}get textStrokeThickness(){return this._textStrokeThickness}set textStrokeThickness(t){this.dirty=this.dirty||this._textStrokeThickness!=t,this._textStrokeThickness=t}setTextStrokeColor(t,e){return void 0===e&&(e=2),this.textStrokeColor=t,this.textStrokeThickness=e,this}get textFont(){return this._textFont}set textFont(t){this.dirty=this.dirty||this._textFont!=t,this._textFont=t}setTextFont(t,e,i){var s;return s=void 0===e?t:i+" "+t+" "+e,this.textFont=s,this}setTextFormatCallback(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),sp.call(this)}),this),this}getFormatText(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)}}var dp=function(t,e,i){return i?t<=e?hp+t-e:t-e:t>=e?hp+e-t:e-t};t.register("circularProgressCanvas",(function(t,e,i,s,r,n){var a=new lp(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.CircularProgressCanvas",lp);var cp=function(t,e,i,s,r,n){var a=(e+s)/2;return n>=0?t.startAt(a+n,i).lineTo(s+n,i).lineTo(s,r).lineTo(e,r).lineTo(e+n,i).lineTo(a+n,i):t.startAt(a,i).lineTo(s,i).lineTo(s-n,r).lineTo(e-n,r).lineTo(e,i).lineTo(a,i),t.close(),t};const up=Phaser.Utils.Objects.GetValue,pp=Phaser.Utils.Objects.IsPlainObject;let gp=class extends(Hu(mc)){constructor(t,e,i,s,r,n,a,o){pp(e)?(e=(o=e).x,i=o.y,s=o.width,r=o.height,n=o.barColor,a=o.value):pp(s)?(s=(o=s).width,r=o.height,n=o.barColor,a=o.value):pp(n)&&(n=(o=n).barColor,a=o.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=2),void 0===r&&(r=s),void 0===a&&(a=0),super(t,e,i,s,r,o),this.type="rexLineProgress",this.bootProgressBase(o),this.addShape((new Jc).setName("trackFill")).addShape((new Jc).setName("bar")).addShape((new Jc).setName("trackStroke")),this.setTrackColor(up(o,"trackColor",void 0)),this.setBarColor(n),this.setTrackStroke(up(o,"trackStrokeThickness",2),up(o,"trackStrokeColor",void 0)),this.setSkewX(up(o,"skewX",0)),this.setRTL(up(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}};var vp={updateShapes:function(){var t=this.skewX,e=this.width-Math.abs(t),i=this.height,s=this.getShape("trackFill");s.fillStyle(this.trackColor),s.isFilled&&cp(s,0,0,e,i,t);var r,n,a=this.getShape("bar");a.fillStyle(this.barColor),a.isFilled&&(this.rtl?(r=e*(1-this.value),n=e):(r=0,n=e*this.value),cp(a,r,0,n,i,t));var o=this.getShape("trackStroke");o.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),o.isStroked&&cp(o,0,0,e,i,t)}};Object.assign(gp.prototype,vp),t.register("lineProgress",(function(t,e,i,s,r,n,a){var o=new gp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgress",gp);var fp=function(t,e,i,s,r){t.setIterations(r).start();var n=s.tl;if(_t(n))if(n.convex){var a=n.x,o=n.y;t.ellipticalArc(a,o,n.x,n.y,180,270,!1)}else a=0,o=0,t.ellipticalArc(a,o,n.x,n.y,90,0,!0);else t.lineTo(0,0);return n=s.tr,_t(n)?n.convex?(a=e-n.x,o=n.y,t.ellipticalArc(a,o,n.x,n.y,270,360,!1)):(a=e,o=0,t.ellipticalArc(a,o,n.x,n.y,180,90,!0)):t.lineTo(e,0),n=s.br,_t(n)?n.convex?(a=e-n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,0,90,!1)):(a=e,o=i,t.ellipticalArc(a,o,n.x,n.y,270,180,!0)):t.lineTo(e,i),n=s.bl,_t(n)?n.convex?(a=n.x,o=i-n.y,t.ellipticalArc(a,o,n.x,n.y,90,180,!1)):(a=0,o=i,t.ellipticalArc(a,o,n.x,n.y,360,270,!0)):t.lineTo(0,i),t.close(),t},mp=Phaser.Math.RadToDeg,yp=function(t,e,i,s,r){var n=e*r,a=s.tl;if(_t(a)){l=n>a.x?90:mp(Math.acos((a.x-n)/a.x));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,0);if(a=s.tr,_t(a)&&n>e-a.x){var l=90-mp(Math.acos((n-(e-a.x))/a.x));o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)}else t.lineTo(n,0);a=s.br,_t(a)&&n>e-a.x?(l=90-mp(Math.acos((n-(e-a.x))/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)):t.lineTo(n,i),a=s.bl,_t(a)?(l=n>a.x?90:mp(Math.acos((a.x-n)/a.x)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,i)},bp=Phaser.Math.RadToDeg,xp=function(t,e,i,s,r){var n=i*r,a=s.tl;if(_t(a)){l=n>a.y?90:bp(Math.acos((a.y-n)/a.y));var o=a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)}else t.lineTo(0,0);if(a=s.tr,_t(a)?(l=n>a.y?90:bp(Math.acos((a.y-n)/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270,270+l,!1)):t.lineTo(e,0),a=s.br,_t(a)&&n>i-a.y){var l=90-bp(Math.acos((n-(i-a.y))/a.y));o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)}else t.lineTo(e,n);a=s.bl,_t(a)&&n>i-a.y?(l=90-bp(Math.acos((n-(i-a.y))/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,180-l,180,!1)):t.lineTo(0,n)},Cp=Phaser.Math.RadToDeg,kp=function(t,e,i,s,r){var n=e*r,a=s.tr;if(_t(a)){l=n>a.x?90:Cp(Math.acos((a.x-n)/a.x));var o=e-a.x,h=a.y;t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)}else t.lineTo(e,0);if(a=s.br,_t(a)?(l=n>a.x?90:Cp(Math.acos((a.x-n)/a.x)),o=e-a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,0,0+l,!1)):t.lineTo(e,i),a=s.bl,_t(a)&&n>e-a.x){var l=90-Cp(Math.acos((n-(e-a.x))/a.x));o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)}else t.lineTo(e-n,i);a=s.tl,_t(a)&&n>e-a.x?(l=90-Cp(Math.acos((n-(e-a.x))/a.x)),o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,270-l,270,!1)):t.lineTo(e-n,0)},wp=Phaser.Math.RadToDeg,Sp=function(t,e,i,s,r){var n=i*r,a=s.br;if(_t(a)){l=n>a.y?90:wp(Math.acos((a.y-n)/a.y));var o=e-a.x,h=i-a.y;t.ellipticalArc(o,h,a.x,a.y,90-l,90,!1)}else t.lineTo(e,i);if(a=s.bl,_t(a)?(l=n>a.y?90:wp(Math.acos((a.y-n)/a.y)),o=a.x,h=i-a.y,t.ellipticalArc(o,h,a.x,a.y,90,90+l,!1)):t.lineTo(0,i),a=s.tl,_t(a)&&n>i-a.y){var l=90-wp(Math.acos((n-(i-a.y))/a.y));o=a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,180,180+l,!1)}else t.lineTo(0,i-n);a=s.tr,_t(a)&&n>i-a.y?(l=90-wp(Math.acos((n-(i-a.y))/a.y)),o=e-a.x,h=a.y,t.ellipticalArc(o,h,a.x,a.y,360-l,360,!1)):t.lineTo(e,i-n)},Pp={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Tp=function(t){return"string"==typeof t&&(t=Pp[t]),t};const Op=Phaser.Utils.Objects.GetValue,Mp=Phaser.Utils.Objects.IsPlainObject;class Ep extends(Hu(mc)){constructor(t,e,i,s,r,n,a,o,h){Mp(e)?(e=(h=e).x,i=h.y,s=h.width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Mp(s)?(s=(h=s).width,r=h.height,n=h.radius,a=h.barColor,o=h.value):Mp(n)&&(n=(h=n).radius,a=h.barColor,o=h.value),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===o&&(o=0),super(t,e,i,s,r,h),this.type="rexRoundRectangleProgress",this.rrGeom=new Tt,this.bootProgressBase(h),this.addShape((new Jc).setName("trackFill")).addShape((new Jc).setName("bar")).addShape((new Jc).setName("trackStroke")),this.setTrackColor(Op(h,"trackColor",void 0)),this.setBarColor(a),this.setTrackStroke(Op(h,"trackStrokeThickness",2),Op(h,"trackStrokeColor",void 0)),this.setOrientation(Op(h,"orientation",0)),this.setRTL(Op(h,"rtl",!1)),this.setRadius(n),this.setIteration(Op(n,"iteration",void 0)),this.setValue(o)}get trackColor(){return this._trackColor}set trackColor(t){this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){this.dirty=this.dirty||this._barColor!=t,this._barColor=t}setBarColor(t){return this.barColor=t,this}get orientation(){return this._orientation}set orientation(t){t=Tp(t),this.dirty=this.dirty||this._orientation!=t,this._orientation=t}setOrientation(t){return this.orientation=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get radius(){return this.rrGeom.radius}set radius(t){this.rrGeom.setRadius(t),this.dirty=!0}get radiusTL(){return this.rrGeom.radiusTL}set radiusTL(t){this.rrGeom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.rrGeom.radiusTR}set radiusTR(t){this.rrGeom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.rrGeom.radiusBL}set radiusBL(t){this.rrGeom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.rrGeom.radiusBR}set radiusBR(t){this.rrGeom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.rrGeom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}}var _p={updateShapes:function(){var t=this.width,e=this.height,i=this.rrGeom.cornerRadius,s=this.value,r=this.orientation,n=this.rtl,a=this.iteration+1,o=this.getShape("trackFill");o.fillStyle(this.trackColor),o.isFilled&&fp(o,t,e,i,a);var h=this.getShape("bar");h.fillStyle(this.barColor),h.isFilled&&function(t,e,i,s,r,n,a,o){t.setIterations(o).start(),0===r||(1===r?fp(t,e,i,s,o):((0===n?a?kp:yp:a?Sp:xp)(t,e,i,s,r),t.close()))}(h,t,e,i,s,r,n,a);var l=this.getShape("trackStroke");l.lineStyle(this.trackStrokeThickness,this.trackStrokeColor),l.isStroked&&fp(l,t,e,i,a)}};Object.assign(Ep.prototype,_p),t.register("roundRectanleProgress",(function(t,e,i,s,r,n,a,o){var h=new Ep(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),P(window,"RexPlugins.UI.RoundRectangleProgress",Ep);var Rp=function(t,e,i,s,r,n,a){void 0===a&&(a="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var s=1,r=e.length;s0&&(n.save(),Rp(0,n,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),n.restore())},Bp=function(t,e,i,s,r,n){void 0===n&&(n=[]),n.length=4;for(var a=0;a<4;a++)n[a]||(n[a]={});var o;return r>=0?((o=n[0]).x=t+r,o.y=e,(o=n[1]).x=i+r,o.y=e,(o=n[2]).x=i,o.y=s,(o=n[3]).x=t,o.y=s):((o=n[0]).x=t,o.y=e,(o=n[1]).x=i,o.y=e,(o=n[2]).x=i-r,o.y=s,(o=n[3]).x=t-r,o.y=s),n};const Ip=Phaser.Utils.Objects.GetValue,Dp=Phaser.Utils.Objects.IsPlainObject;class jp extends(Hu($t)){constructor(t,e,i,s,r,n,a,o){Dp(e)?(e=Ip(o=e,"x",0),i=Ip(o,"y",0),s=Ip(o,"width",2),r=Ip(o,"height",2),n=Ip(o,"barColor",void 0),a=Ip(o,"value",0)):Dp(s)?(s=Ip(o=s,"width",2),r=Ip(o,"height",2),n=Ip(o,"barColor",void 0),a=Ip(o,"value",0)):Dp(n)&&(n=Ip(o=n,"barColor",void 0),a=Ip(o,"value",0)),super(t,e,i,s,r,Ip(o,"resolution",1)),this.type="rexLineProgressCanvas",this.trackPoints=[],this.barPoints=[],this.bootProgressBase(o),this.setTrackColor(Ip(o,"trackColor",void 0)),this.setBarColor(n,Ip(o,"barColor2",void 0),Ip(o,"isHorizontalGradient",void 0)),this.setTrackStroke(Ip(o,"trackStrokeThickness",2),Ip(o,"trackStrokeColor",void 0)),this.setSkewX(Ip(o,"skewX",0)),this.setRTL(Ip(o,"rtl",!1)),this.setValue(a)}get trackColor(){return this._trackColor}set trackColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t}setTrackColor(t){return this.trackColor=t,this}get trackStrokeColor(){return this._trackStrokeColor}set trackStrokeColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t}get trackStrokeThickness(){return this._trackStrokeThickness}set trackStrokeThickness(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t}setTrackStroke(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}get barColor(){return this._barColor}set barColor(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t}get barColor2(){return this._barColor2}set barColor2(t){t=qt(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setBarColor(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}get skewX(){return this._skewX}set skewX(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t}setSkewX(t){return this.skewX=t,this}get rtl(){return this._rtl}set rtl(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}updateTexture(){return super.updateTexture((function(){this.clear(),Lp.call(this)}),this),this}}t.register("circularProgressCanvas",(function(t,e,i,s,r,n,a){var o=new jp(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),P(window,"RexPlugins.UI.LineProgressCanvas",jp),Phaser.Math.Wrap;const Ap=Phaser.Math.Linear;var zp=function(){var t,e,i,s,r,n,a=this.getShape("triangle"),o=this.padding,h=this.width-o.right,l=0+o.left,d=this.height-o.bottom,c=0+o.top,u=(l+h)/2,p=(c+d)/2,g={0:{a:{x:l,y:c},b:{x:h,y:p},c:{x:l,y:d}},1:{a:{x:l,y:c},b:{x:u,y:d},c:{x:h,y:c}},2:{a:{x:h,y:c},b:{x:l,y:p},c:{x:h,y:d}},3:{a:{x:l,y:d},b:{x:u,y:c},c:{x:h,y:d}}};if(void 0===this.previousDirection){var v=g[this.direction],f=v.a,m=v.b,y=v.c;t=f.x,e=f.y,i=m.x,s=m.y,r=y.x,n=y.y}else{var b=g[this.previousDirection],x=g[this.direction],C=this.easeDirectionProgress;t=Ap(b.a.x,x.a.x,C),e=Ap(b.a.y,x.a.y,C),i=Ap(b.b.x,x.b.x,C),s=Ap(b.b.y,x.b.y,C),r=Ap(b.c.x,x.c.x,C),n=Ap(b.c.y,x.c.y,C)}a.startAt(t,e).lineTo(i,s).lineTo(r,n),this.arrowOnly?a.end():a.close()};const Fp=(0,Phaser.Math.DegToRad)(120);var Yp=function(t){t=this.getShape("triangle");var e=this.width/2,i=this.height/2,s=Math.min(e,i)*this.radius,r=this.verticeRotation;t.startAt(e+s*Math.cos(r+Fp),i+s*Math.sin(r+Fp)).lineTo(e+s*Math.cos(r),i+s*Math.sin(r)).lineTo(e+s*Math.cos(r-Fp),i+s*Math.sin(r-Fp)),this.arrowOnly?t.end():t.close()},Xp={buildShapes(){this.addShape((new Jc).setName("triangle"))},updateShapes(){var t=this.getShape("triangle");this.arrowOnly?t.fillStyle().lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha):t.fillStyle(this.fillColor,this.fillAlpha).lineStyle(this.lineWidth,this.strokeColor,this.strokeAlpha),0===this.shapeMode?zp.call(this):Yp.call(this)}},Wp={setEaseDuration(t){return void 0===t&&(t=0),this.easeDuration=t,this},playEaseDirectionation(){return void 0===this.easeDirectionProgressTask&&(this.easeDirectionProgressTask=new ru(this,{eventEmitter:null})),this.easeDirectionProgressTask.restart({key:"easeDirectionProgress",from:0,to:1,duration:this.easeDuration}),this},stopEaseDirection(){return void 0===this.easeDirectionProgressTask||this.easeDirectionProgressTask.stop(),this}};const Vp=Phaser.Utils.Objects.GetValue,Gp=Phaser.Utils.Objects.IsPlainObject,Hp=Phaser.Math.DegToRad,Up=Phaser.Math.RadToDeg;class Np extends mc{constructor(t,e,i,s,r,n,a){var o,h,l,d,c,u,p,g;if(Gp(e)){var v=e;e=v.x,i=v.y,s=v.width,r=v.height,n=v.color,a=v.alpha,o=v.strokeColor,h=v.strokeAlpha,l=v.strokeWidth,d=v.arrowOnly,c=v.direction,u=v.easeDuration,p=v.padding,g=v.radius}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===d&&(d=!1),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),void 0===g&&(g=void 0),super(t,e,i,s,r),this.type="rexTriangle",this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setArrowOnly(d),this.setDirection(c,u),this.setPadding(p),this.setRadius(g),this.buildShapes()}get arrowOnly(){return this._arrowOnly}set arrowOnly(t){this.dirty=this.dirty||this._arrowOnly!=t,this._arrowOnly=t}setArrowOnly(t){return void 0===t&&(t=!0),this.arrowOnly=t,this}get direction(){return this._direction}set direction(t){t=Kp(t),this._direction!==t&&(this.easeDuration>0&&void 0!==this._direction?this.previousDirection=this._direction:this.previousDirection=void 0,this._direction=t,this.verticeAngle=90*t,this.dirty=!0,void 0!==this.previousDirection?this.playEaseDirectionation():this.stopEaseDirection())}setDirection(t,e){return void 0!==e&&this.setEaseDuration(e),this.direction=t,this}toggleDirection(t){return this.setDirection(this.direction+2,t),this}get easeDirectionProgress(){return this._easeDirectionProgress}set easeDirectionProgress(t){this._easeDirectionProgress!==t&&(this._easeDirectionProgress=t,this.dirty=!0)}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=Vp(r,"x",null);null!==n?(t=n,i=n):(t=Vp(r,"left",0),i=Vp(r,"right",t));var a=Vp(r,"y",null);null!==a?(e=a,s=a):(e=Vp(r,"top",0),s=Vp(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return void 0===this.padding&&(this.padding={}),this.dirty=this.dirty||this.padding.left!=t||this.padding.top!=e||this.padding.right!=i||this.padding.bottom!=s,this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.setRadius(),this}get radius(){return this._radius}set radius(t){this.dirty=this.dirty||this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this.shapeMode=null==t?0:1,this}get verticeRotation(){return this._verticeRotation}set verticeRotation(t){this.dirty=this.dirty||this._verticeRotation!=t,this._verticeRotation=t}setVerticeRotation(t){return this.verticeRotation=t,this}get verticeAngle(){return Up(this.verticeRotation)}set verticeAngle(t){this.verticeRotation=Hp(t)}setVerticeAngle(t){return this.verticeAngle=t,this}}const $p={right:0,down:1,left:2,up:3};var Kp=function(t){return"string"==typeof t&&(t=$p[t]),t%=4};Object.assign(Np.prototype,Xp,Wp),t.register("triangle",(function(t,e,i,s,r,n){var a=new Np(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),P(window,"RexPlugins.UI.Triangle",Np),F();const Jp=Phaser.GameObjects.Zone,qp=Phaser.Utils.Array.Add,Zp=Phaser.Utils.Array.Remove;let Qp=class extends Jp{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[]}destroy(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return qp(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return Zp(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;ing(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;eng(t).x,getChildLocalY:t=>ng(t).y};const Cg=Phaser.Math.DegToRad;var kg={updateChildRotation(t){var e=ng(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=ng(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return ng(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return ng(t).rotation=Cg(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=ng(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>ng(t).rotation},wg={updateChildScale(t){var e=ng(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=ng(t),i=e.parent;return e.scaleX=bg(t.scaleX,i.scaleX),e.scaleY=bg(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=ng(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=ng(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>ng(t).scaleX,getChildLocalScaleY:t=>ng(t).scaleY},Sg={updateChildVisible(t){var e=ng(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=ng(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),ng(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),ng(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=ng(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>ng(t).visible},Pg={updateChildAlpha(t){var e=ng(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=ng(t),i=e.parent;return e.alpha=bg(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return ng(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=ng(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>ng(t).alpha},Tg={updateChildActive(t){var e=ng(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return ng(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),ng(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=ng(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>ng(t).active},Og={updateChildScrollFactor(t){var e=ng(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Mg={updateCameraFilter(t){var e=ng(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Eg={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearMask(t){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t)})),t&&this.mask&&this.mask.destroy(),this}},_g=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},Rg={setDepth(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s=0;r--){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveBelow(n,s),s=n))}return this}},Lg=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const Ig=Phaser.Utils.Array;var Dg={getChildren(t){if(t)for(var e=0,i=this.children.length;e=0;e--)this.remove(this.backgroundChildren[e],t);return this}},$v=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else{var i=t;for(t in i)this.childrenMap[t]=i[t]}return this};const Kv=/(\S+)\[(\d+)\]/i;var Jv={getInnerPadding(t){return Os(this.space,t)},setInnerPadding(t,e){return Ms(this.space,t,e),this},getOuterPadding(t){return Os(this.getSizerConfig(this).padding,t)},setOuterPadding(t,e){return Ms(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding(t,e){return"string"==typeof t&&(t=this.getElement(t)),Os(this.getSizerConfig(t).padding,e)},setChildOuterPadding(t,e,i){return"string"==typeof t&&(t=this.getElement(t)),Ms(this.getSizerConfig(t).padding,e,i),this}},qv=function(t){var e=this.childrenWidth;if(void 0!==e){var i=void 0!==this.minWidth?this.minWidth*this.scaleX:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) < childrenWidth (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout width warn: ${this.constructor.name}'s minWidth (${i}) or childrenWidth (${e} > targetWidth ${t})`),t}},Zv=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runWidthWrap&&(!t.hasWidthWrap||t.hasWidthWrap()))return!0;return!1},Qv=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer?void 0===(s=e.resolveWidth(i))&&(s=i):s=i,e.runWidthWrap(s));return this},tf=function(t){var e=this.childrenHeight;if(void 0!==e){var i=void 0!==this.minHeight?this.minHeight*this.scaleY:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) < childrenHeight (${e})`)):this.layoutWarnEnable&&(i>t||e>t)&&console.warn(`Layout height warn: ${this.constructor.name}'s minHeight (${i}) or childrenHeight (${e}) > targetHeight (${t})`),t}},ef=function(){var t;for(var e in this.sizerChildren)if(!(!(t=this.sizerChildren[e])||t.isRexSizer&&t.ignoreLayout)&&t.runHeightWrap&&(!t.hasHeightWrap||t.hasHeightWrap()))return!0;return!1},sf=function(t){var e,i,s;for(var r in this.sizerChildren)!(e=this.sizerChildren[r])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(i=this.getExpandedChildHeight(e,t),e.isRexSizer?void 0===(s=e.resolveHeight(i))&&(s=i):s=i,e.runHeightWrap(s));return this},rf={getShownChildren(t){void 0===t&&(t=[]);for(var e,i=this.children,s=0,r=i.length;s0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push(...i.children))}return t}},nf=function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,s=e.length;i0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_OPNE(){this.parent.removeDelayCall()}next_OPEN(){return"TRANS_CLOSE"}enter_OPEN(){this.parent.onOpen()}exit_OPEN(){this.parent.removeDelayCall()}next_TRANS_CLOSE(){return"CLOSE"}enter_TRANS_CLOSE(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this)}else this.next()}exit_TRANS_CLOSE(){this.parent.removeDelayCall()}next_CLOSE(){return"TRANS_OPNE"}enter_CLOSE(){this.parent.onClose()}exit_CLOSE(){}canOpen(){return"IDLE"===this.state||"CLOSE"===this.state}canClose(){return"IDLE"===this.state||"OPEN"===this.state}};var mm={delayCall(t,e,i){return this.delayCallTimer=function(t,e,i,s,r){var n=La(t);return n.time.delayedCall(e,(function(){n.game.events.once("poststep",(function(){i.call(s,r)}))}))}(this,t,e,i),this},removeDelayCall(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},ym={setTransitInTime(t){return this.transitInTime=t,this},setTransitOutTime(t){return this.transitOutTime=t,this},setTransitInCallback(t){return t||(t=h),this.transitInCallback=t,this},setTransitOutCallback(t){return t||(t=h),this.transitOutCallback=t,this}},bm={runTransitionInCallback(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen(){},requestOpen(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},xm={runTransitionOutCallback(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose(){this.oneShotMode&&this.parent.destroy()},requestClose(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},Cm={};Object.assign(Cm,mm,ym,bm,xm);const km=Phaser.Utils.Objects.GetValue;class wm extends Ia{constructor(t,e){super(t,e),this.setTransitInTime(km(e,"duration.in",200)),this.setTransitOutTime(km(e,"duration.out",200)),this.setTransitInCallback(km(e,"transitIn")),this.setTransitOutCallback(km(e,"transitOut")),this.oneShotMode=km(e,"destroy",!1),this.delayCallTimer=void 0,this._state=new fm(this,{eventEmitter:!1,initState:km(e,"initState","IDLE")}),this.openEventData=void 0,this.closeEventData=void 0}get state(){return this._state.state}shutdown(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),super.shutdown(t))}}Object.assign(wm.prototype,Cm);const Sm=Phaser.GameObjects.Rectangle;class Pm extends Sm{constructor(t,e,i){super(t,0,0,2,2,e,1),this.fullWindow=new Rd(this),this.setAlpha(i)}get tint(){return this.fillColor}set tint(t){this.setFillStyle(t,this.fillAlpha)}}const Tm=Phaser.Utils.Objects.GetValue;class Om extends Ia{constructor(t,e){super(t,{eventEmitter:!1}),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setHitAreaMode(Tm(t,"hitAreaMode",0)),this.setEnable(Tm(t,"enable",!0)),this.setStopMode(Tm(t,"stopAllLevels",!0)),this}boot(){this.parent.on("pointerdown",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerup",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointermove",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerover",(function(t,e,i,s){this.stopAllLevels&&s.stopPropagation()}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation()}),this)}setHitAreaMode(t){"string"==typeof t&&(t=Mm[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return!0}}),this}setEnable(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}setStopMode(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}toggleEnable(){return this.setEnable(!this.enable),this}}var Mm={default:0,fullWindow:1};const Em=Phaser.Utils.Objects.GetValue;class _m extends Pm{constructor(t,e){super(t,Em(e,"color",0),Em(e,"alpha",.8)),this.touchEventStop=new Om(this,{hitAreaMode:1})}}var Rm={popUp(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,xf(t,e)},scaleDown(t,e){Cf(t,e,void 0,void 0,!1)},fadeIn(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Rf(t,e)},fadeOut(t,e){Lf(t,e,!1)}},Lm=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Rf(t,e,t.alpha)},Bm=function(t,e){Lf(t,e,!1)},Im=function(t,e,i,s,r){return!(!t||s&&!s(t,e,i)||!Hn(t,!0).contains(e,i)||r&&!r(t,e,i))};const Dm=Phaser.Utils.Objects.GetValue;let jm=class extends wm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=Am.popUp),null==e.transitOut&&(e.transitOut=Am.scaleDown),e.destroy=Dm(e,"destroy",!0),super(t,e);var i=Dm(e,"cover");this.cover=!1!==i?function(t,e){var i=t.scene,s=new _m(i,e);return i.add.existing(s),t.isRexContainerLite?(t.pin(s,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(s)):i.children.moveBelow(s,t),s}(t,i):void 0,this.cover&&(this.setCoverTransitInCallback(Dm(i,"transitIn",Lm)),this.setCoverTransitOutCallback(Dm(i,"transitOut",Bm)));var s=Dm(e,"touchOutsideClose",!1),r=Dm(e,"duration.hold",-1),n=Dm(e,"timeOutClose",r>=0),a=Dm(e,"anyTouchClose",!1);Dm(e,"manualClose",!1)&&(s=!1,a=!1,n=!1),a&&(s=!1),n?this.setDisplayTime(r):this.setDisplayTime(-1),a?this.once("open",this.anyTouchClose,this):s&&this.once("open",this.touchOutsideClose,this),Dm(e,"openOnStart",!0)&&this.delayCall(0,this.requestOpen,this)}shutdown(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),super.shutdown(t))}touchOutsideClose(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Im(this.parent,t.worldX,t.worldY)||this.requestClose()}runTransitionInCallback(){var t=super.runTransitionInCallback(),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}runTransitionOutCallback(){var t=super.runTransitionOutCallback(),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}onOpen(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.closeEventData),super.onClose()}setDisplayTime(t){return this.displayTime=t,this}setTransitInCallback(t){switch("string"==typeof t&&(t=Am[t]),t){case Am.popUp:t=Rm.popUp;break;case Am.fadeIn:t=Rm.fadeIn}return super.setTransitInCallback(t),this}setTransitOutCallback(t){switch("string"==typeof t&&(t=Am[t]),t){case Am.scaleDown:t=Rm.scaleDown;break;case Am.fadeOut:t=Rm.fadeOut}return super.setTransitOutCallback(t),this}setCoverTransitInCallback(t){return this.coverTransitInCallback=t,this}setCoverTransitOutCallback(t){return this.coverTransitOutCallback=t,this}};const Am={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1};var zm=function(t,e){var i=new jm(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},Fm=function(t,e){t.emit("modal.requestClose",e)},Ym=function(t){return t&&"function"==typeof t},Xm={modal(t,e){return Ym(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=zm(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise(t){var e=this;return new Promise((function(i,s){e.modal(t,i)}))},modalClose(t){return Fm(this,t),this}},Wm=function(t,e,i,s,r){Ym(e)&&(r=s,s=i,i=e,e=this);var n=this.scene.events;return this.bindEvent(e,n,t,i,s,r),this},Vm={bindEvent(t,e,i,s,r,n){return"string"==typeof e&&(n=r,r=s,s=i,i=e,e=t,t=this),function(t,e,i,s,r,n){void 0===n&&(n=!1),e[n?"once":"on"](i,s,r),t.once("destroy",(function(){e.off(i,s,r)}))}(t,e,i,s,r,n),this},bindScenePreupdateEvent(t,e,i,s){return Wm.call(this,"preupdate",t,e,i,s),this},bindSceneUpdateEvent(t,e,i,s){return Wm.call(this,"update",t,e,i,s),this},bindScenePostupdateEvent(t,e,i,s){return Wm.call(this,"postupdate",t,e,i,s),this},bindSceneRenderEvent(t,e,i,s){return Wm.call(this,"render",t,e,i,s),this},bindScenePauseEvent(t,e,i,s){return Wm.call(this,"pause",t,e,i,s),this},bindSceneResumeEvent(t,e,i,s){return Wm.call(this,"resume",t,e,i,s),this},bindSceneSleepEvent(t,e,i,s){return Wm.call(this,"sleep",t,e,i,s),this},bindSceneWakeEvent(t,e,i,s){return Wm.call(this,"wake",t,e,i,s),this},bindSceneShutdownEvent(t,e,i,s){return Wm.call(this,"shutdown",t,e,i,s),this}},Gm=function(t,e,i){var s=t.camera;return s?(void 0===i?i={}:!0===i&&(i=Hm),s===e?(i.x=t.worldX,i.y=t.worldY):s.getWorldPoint(t.x,t.y,i),i):null},Hm={},Um=function(t,e,i,s){return function(t,e,i,s,r){var n,a=t.scene.sys.cameras.main,o=0===t.scrollFactorX&&0===t.scrollFactorY;if(e)return o?i(t,e.x,e.y,s,r):!!(n=Gm(e,a,!0))&&i(t,n.x,n.y,s,r);for(var h=t.scene.input.manager,l=h.pointersTotal,d=h.pointers,c=0;c=this.dragThreshold||this.isPointerInside(t))&&this.cancel()}click(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}cancel(){return this.pointer=void 0,this}}const ny={press:0,pointerdown:0,release:1,pointerup:1};var ay={onClickOutside(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new ry(t,s)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(e),this},disableClickOutside(t){return void 0===t&&(t=this),void 0===t._clickOutside||t._clickOutside.setEnable(!1),this}};class oy extends vm{constructor(){super({eventEmitter:!1}),this.goto("IDLE")}setCooldownTime(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}request(){return this.runMethod("request")}update_IDLE(){this.compensationTime=0}request_IDLE(){return this.next(),!0}next_IDLE(){if(this.cooldownMode)return"COOLDOWN"}enter_COOLDOWN(){this.remainderTime=this.cooldownTime+this.compensationTime}update_COOLDOWN(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"))}request_COOLDOWN(){return!1}}const hy=Phaser.Utils.Objects.GetValue;class ly extends Ia{constructor(t,e){super(t,e),this._enable=void 0,this.cooldown=new oy,this.parent.setInteractive(hy(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(hy(t,"enable",!0)),this.setCooldown(hy(t,"cooldown",void 0)),this}boot(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t))}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get cooldownTime(){return this.cooldown.cooldownTime}set cooldownTime(t){this.cooldown.setCooldownTime(t)}setCooldown(t){return this.cooldownTime=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0)}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1)}preupdate(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching}}var dy={isPointerInBounds(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&Um(t)},onTouching(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new ly(t,s)),t._inTouching.on("intouch",e,i),this):this},offTouching(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd(t,e,i,s){return t?("function"==typeof t&&(s=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new ly(t,s)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd(t,e,i){return"function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching(t,e){return"boolean"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(e),this},disableTouching(t){return void 0===t&&(t=this),void 0===t._inTouching||t._inTouching.setEnable(!1),this}},cy={onOver(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerover",e,i),this):this},onOut(t,e,i){return t?("function"==typeof t&&(i=e,e=t,t=this),t.setInteractive().on("pointerout",e,i),this):this}},uy=function(t,e,i,s){if("parent"===t){for(var r,n=0,a=e.length;n0),this.onDragStart())}onPointerUp(t){this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.pointerCamera=void 0,this.movedState=!1,this.tracerState=My,this.onDragEnd())}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}dragCancel(){return this.tracerState===Ey&&this.onDragEnd(),this.pointer=void 0,this.tracerState=My,this}onDragStart(){this.emit("dragstart",this)}onDragEnd(){this.emit("dragend",this)}onDrag(){this.emit("drag",this)}preUpdate(t,e){}postUpdate(t,e){}startTicking(){super.startTicking(),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}stopTicking(){super.stopTicking(),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=_y,this}isPointerInGameObject(t,e,i){var s=this.lastPointer;return!!s&&Um(t,s,e,i)}}const My=0,Ey=1,_y="IDLE",Ry=Phaser.Utils.Objects.GetValue,Ly=Phaser.Math.Distance.Between;class By extends Oy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.stop(),i.tapsCount=0,i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start(),i.tapsCount=0,i.emit("tappingstart",i,i.gameObject,i.lastPointer)}},RECOGNIZED:{enter:function(){i.start(),i.emit("tap",i,i.gameObject,i.lastPointer),i.emit(`${i.tapsCount}tap`,i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Iy},eventEmitter:!1};this.setRecongizedStateObject(new vm(s))}resetFromJSON(t){super.resetFromJSON(t),this.setHoldTime(Ry(t,"time",250)),this.setTapInterval(Ry(t,"tapInterval",200)),this.setDragThreshold(Ry(t,"threshold",9)),this.setTapOffset(Ry(t,"tapOffset",10));var e=Ry(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(Ry(t,"maxTaps",void 0)),this.setMinTaps(Ry(t,"minTaps",void 0))),this}onDragStart(){switch(this.state){case Iy:this.state=Dy;break;case Dy:var t=this.lastPointer;Ly(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=jy,this.state=Dy);break;case jy:this.state=Dy}}onDragEnd(){this.state===Dy&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=jy))}onDrag(){this.state!==Iy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Iy)}preUpdate(t,e){if(this.isRunning&&this.enable&&this.state===Dy){var i=this.lastPointer;i.isDown?t-i.downTime>this.holdTime&&(this.state=Iy):t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=jy:this.state=Iy)}}postUpdate(t,e){this.isRunning&&this.enable&&this.state===jy&&(this.state=Iy)}get isTapped(){return this.state===jy}setHoldTime(t){return this.holdTime=t,this}setTapInterval(t){return this.tapInterval=t,this}setDragThreshold(t){return this.dragThreshold=t,this}setTapOffset(t){return this.tapOffset=t,this}setMaxTaps(t){return this.maxTaps=t,this}setMinTaps(t){return this.minTaps=t,this}setTaps(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}const Iy="IDLE",Dy="BEGIN",jy="RECOGNIZED",Ay=Phaser.Utils.Objects.GetValue;class zy extends Oy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0,i.lastPointer=void 0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.start()},exit:function(){i.stop()}},RECOGNIZED:{enter:function(){i.emit("pressstart",i,i.gameObject,i.lastPointer)},exit:function(){i.emit("pressend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Fy},eventEmitter:!1};this.setRecongizedStateObject(new vm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Ay(t,"threshold",9)),this.setHoldTime(Ay(t,"time",251)),this}onDragStart(){this.state=Yy,0===this.holdTime&&(this.state=Xy)}onDragEnd(){this.state=Fy}onDrag(){this.state!==Fy&&this.pointer.getDistance()>this.dragThreshold&&(this.state=Fy)}preUpdate(t,e){this.isRunning&&this.enable&&this.state===Yy&&t-this.pointer.downTime>=this.holdTime&&(this.state=Xy)}get isPressed(){return this.state===Xy}setHoldTime(t){return this.holdTime=t,this}setDragThreshold(t){return this.dragThreshold=t,this}}const Fy="IDLE",Yy="BEGIN",Xy="RECOGNIZED",Wy=Phaser.Utils.Objects.GetValue;class Vy extends Oy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{},BEGIN:{enter:function(){var t=i.pointer;i.startX=t.x,i.startY=t.y,i.startWorldX=t.worldX,i.startWorldY=t.worldY}},RECOGNIZED:{enter:function(){i.emit("panstart",i,i.gameObject,i.lastPointer)},exit:function(){var t=i.lastPointer;i.endX=t.x,i.endY=t.y;var e=Gm(t,i.pointerCamera,!0);i.endWorldX=e.x,i.endWorldY=e.y,i.emit("panend",i,i.gameObject,i.lastPointer)}}},init:function(){this.state=Gy},eventEmitter:!1};this.setRecongizedStateObject(new vm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Wy(t,"threshold",10)),this}onDragStart(){this.state=Hy,0===this.dragThreshold&&(this.state=Uy)}onDragEnd(){this.state=Gy}onDrag(){switch(this.state){case Hy:if(this.pointer.getDistance()>=this.dragThreshold){this.state=Uy,this.dx=0,this.dy=0,this.dWorldX=0,this.dWorldY=0;var t=this.pointer;this.x=t.x,this.y=t.y,this.worldX=t.worldX,this.worldY=t.worldY}break;case Uy:var e=this.pointerCamera,i=this.pointer.position,s=this.pointer.prevPosition;this.dx=i.x-s.x,this.dy=i.y-s.y,this.dWorldX=this.dx/e.zoom,this.dWorldY=this.dy/e.zoom,t=this.pointer,this.x=t.x,this.y=t.y;var r=Gm(t,e,!0);this.worldX=r.x,this.worldY=r.y,this.emit("pan",this,this.gameObject,this.lastPointer)}}get isPanned(){return this.state===Uy}setDragThreshold(t){return this.dragThreshold=t,this}}const Gy="IDLE",Hy="BEGIN",Uy="RECOGNIZED",Ny=Phaser.Math.Distance.Between,$y=Phaser.Math.Angle.Between;var Ky={getDt:function(){return hc(this.scene)},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Ny(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 $y(e.x,e.y,t.x,t.y)}},Jy={"up&down":0,"left&right":1,"4dir":2,"8dir":3},qy={};const Zy=Phaser.Utils.Objects.GetValue,Qy=Phaser.Math.RadToDeg;class tb extends Oy{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.x=0,i.y=0,i.worldX=0,i.worldY=0},exit:function(){var t=i.lastPointer;i.x=t.x,i.y=t.y,i.worldX=t.worldX,i.worldY=t.worldY}},BEGIN:{enter:function(){i.validDrag=!1}},RECOGNIZED:{enter:function(){i.start(),i.updateDirectionStates(),i.emit("swipe",i,i.gameObject,i.lastPointer)},exit:function(){i.stop(),i.clearDirectionStates()}}},init:function(){this.state=eb},eventEmitter:!1};this.setRecongizedStateObject(new vm(s)),this.clearDirectionStates()}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(Zy(t,"threshold",10)),this.setVelocityThreshold(Zy(t,"velocityThreshold",1e3)),this.setDirectionMode(Zy(t,"dir","8dir")),this}onDragStart(){this.state=ib}onDragEnd(){this.state=eb}onDrag(){this.state===ib&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=sb))}postUpdate(t,e){this.isRunning&&this.enable&&this.state===sb&&(this.state=eb)}get isSwiped(){return this.state===sb}get dragVelocity(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}setDragThreshold(t){return this.dragThreshold=t,this}setVelocityThreshold(t){return this.velocityThreshold=t,this}setDirectionMode(t){return"string"==typeof t&&(t=Jy[t]),this.dirMode=t,this}updateDirectionStates(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=qy),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0}}(Qy(this.getVelocityAngle()),this.dirMode,this),this}clearDirectionStates(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}Object.assign(tb.prototype,Ky);const eb="IDLE",ib="BEGIN",sb="RECOGNIZED",rb=Phaser.Utils.Objects.GetValue,nb=Phaser.Utils.Array.SpliceOne,ab=Phaser.Math.Distance.Between,ob=Phaser.Math.Angle.Between;class hb{constructor(t,e){var i=La(t);i===t&&(t=void 0);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.gameObject=t,t&&t.setInteractive(rb(e,"inputConfig",void 0)),this.setEventEmitter(rb(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.setEnable(rb(t,"enable",!0)),this.bounds=rb(t,"bounds",void 0),this.tracerState=db,this.pointers.length=0,q(this.movedState),this}boot(){this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}shutdown(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,q(this.movedState),this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0,this.gameObject=void 0)}destroy(){this.shutdown()}get enable(){return this._enable}set enable(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}onPointerDown(t){if(this.enable&&2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.pointerCamera=t.camera,this.tracerState){case db:this.tracerState=cb,this.onDrag1Start();break;case cb:this.tracerState=ub,this.onDrag2Start()}}onPointerUp(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],nb(this.pointers,e),this.tracerState){case cb:this.tracerState=db,this.onDrag1End();break;case ub:this.tracerState=cb,this.onDrag2End(),this.onDrag1Start()}}}onPointerMove(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case cb:this.onDrag1();break;case ub:this.onDrag2()}}}dragCancel(){return this.tracerState===ub&&this.onDrag2End(),this.pointers.length=0,q(this.movedState),this.tracerState=db,this}onDrag1Start(){this.emit("drag1start",this)}onDrag1End(){this.emit("drag1end",this)}onDrag1(){this.emit("drag1",this)}onDrag2Start(){this.emit("drag2start",this)}onDrag2End(){this.emit("drag2end",this)}onDrag2(){this.emit("drag2",this)}get distanceBetween(){if(this.tracerState!==ub)return 0;var t=this.pointers[0],e=this.pointers[1];return ab(t.x,t.y,e.x,e.y)}get angleBetween(){if(this.tracerState!==ub)return 0;var t=this.pointers[0],e=this.pointers[1];return ob(t.x,t.y,e.x,e.y)}get drag1Vector(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;lb.x=e.x-i.x,lb.y=e.y-i.y}else lb.x=0,lb.y=0;return lb}get centerX(){if(this.tracerState!==ub)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}get centerY(){if(this.tracerState!==ub)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}get prevCenterX(){if(this.tracerState!==ub)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}get prevCenterY(){if(this.tracerState!==ub)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}get movementCenterX(){return this.centerX-this.prevCenterX}get movementCenterY(){return this.centerY-this.prevCenterY}setRecongizedStateObject(t){return this.recongizedState=t,this}get state(){return this.recongizedState.state}set state(t){this.recongizedState.state=t}cancel(){return this.state=pb,this}isPointer0InGameObject(t,e,i){var s=this.pointers[0];return!!s&&Um(t,s,e,i)}isPointer1InGameObject(t,e,i){var s=this.pointers[1];return!!s&&Um(t,s,e,i)}}Object.assign(hb.prototype,cn);var lb={};const db=0,cb=1,ub=2,pb="IDLE",gb=Phaser.Utils.Objects.GetValue;class vb extends hb{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevDistance=void 0,i.scaleFactor=1}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("pinchstart",i)},exit:function(){i.emit("pinchend",i)}}},init:function(){this.state=fb},eventEmitter:!1};this.setRecongizedStateObject(new vm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(gb(t,"threshold",0)),this}onDrag2Start(){this.scaleFactor=1,this.prevDistance=this.distanceBetween,this.state=mb,0===this.dragThreshold&&(this.state=yb)}onDrag2End(){this.state=fb}onDrag2(){switch(this.state){case mb: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=yb}break;case yb:t=this.distanceBetween,this.scaleFactor=t/this.prevDistance,this.emit("pinch",this),this.prevDistance=t}}get isPinched(){return this.state===yb}setDragThreshold(t){return this.dragThreshold=t,this}}const fb="IDLE",mb="BEGIN",yb="RECOGNIZED",bb=Phaser.Math.RotateAround;var xb=function(t,e,i,s){return bb(t,e,i,s),t.rotation+=s,t},Cb={};const kb=Phaser.Utils.Objects.GetValue,wb=Phaser.Math.Angle.WrapDegrees,Sb=Phaser.Math.Angle.ShortestBetween,Pb=Phaser.Math.RadToDeg,Tb=Phaser.Math.DegToRad;class Ob extends hb{constructor(t,e){super(t,e);var i=this,s={states:{IDLE:{enter:function(){i.prevAngle=void 0,i.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){i.emit("rotatestart",i)},exit:function(){i.emit("rotateend",i)}}},init:function(){this.state=Eb},eventEmitter:!1};this.setRecongizedStateObject(new vm(s))}resetFromJSON(t){return super.resetFromJSON(t),this.setDragThreshold(kb(t,"threshold",0)),this}onDrag2Start(){this.prevAngle=wb(Pb(this.angleBetween)),this.state=_b,0===this.dragThreshold&&(this.state=Rb)}onDrag2End(){this.state=Eb}onDrag2(){switch(this.state){case _b:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=wb(Pb(this.angleBetween));this.angle=Sb(this.prevAngle,t),this.prevAngle=t,this.state=Rb}break;case Rb:t=wb(Pb(this.angleBetween)),this.angle=Sb(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}get isRotated(){return this.state===Rb}get rotation(){return Tb(this.angle)}setDragThreshold(t){return this.dragThreshold=t,this}}var Mb={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,s=this.movementCenterY,r=function(t,e,i,s){return void 0===s?s={}:!0===s&&(s=Cb),i.getWorldPoint(t,e,s),s}(this.centerX,this.centerY,e,!0),n=r.x,a=r.y,o=this.rotation;if(Array.isArray(t))for(var h=t,l=0,d=h.length;l0&&(r=!0,void 0===n&&(n=0),void 0===a&&(a=0)),(u=this.getSizerConfig(t)).align=i,u.padding=Dv(s),Kb(r)?(u.expandWidth=Jb(r,"width",!1),u.expandHeight=Jb(r,"height",!1)):(u.expandWidth=r,u.expandHeight=r),t.isRexSizer||(u.expandWidth&&(t.minWidth=void 0===n?Fn(t):n),u.expandHeight&&(t.minHeight=void 0===a?Yn(t):a)),u.alignOffsetX=o,u.alignOffsetY=h,u.alignOffsetOriginX=d,u.alignOffsetOriginY=c,u.aspectRatio=l,this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,p&&this.addChildrenMap(e,t),this}};const tx=tv.prototype.clear;var ex=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),tx.call(this,t),i)for(var s,r=0,n=e.length;r0&&(Nb.width=e.aspectRatio,Nb.height=1,$b.width=l,$b.height=d,l=(c=Vb(Nb,$b,"FIT",!0)).width,d=c.height),t.isRexSizer?(t.runLayout(this,l,d),Ub(t,this)):hf(t,l,d),s=u+i.left*this.scaleX,n=g-(i.left+i.right)*this.scaleX,r=p+i.top*this.scaleY,a=v-(i.top+i.bottom)*this.scaleY,void 0===l&&(l=Fn(t)),void 0===d&&(d=Yn(t)),o=(e.alignOffsetX+e.alignOffsetOriginX*l)*this.scaleX,h=(e.alignOffsetY+e.alignOffsetOriginY*d)*this.scaleY,Qm.call(this,t,s,r,n,a,e.align,o,h))}};Object.assign(sx,Qb,ix);var rx=function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null};const nx=Phaser.Utils.Objects.IsPlainObject,ax=Phaser.Utils.Objects.GetValue;class ox extends Wb{constructor(t,e,i,s,r,n){nx(e)?(e=ax(n=e,"x",0),i=ax(n,"y",0),s=ax(n,"width",void 0),r=ax(n,"height",void 0)):nx(s)&&(s=ax(n=s,"width",void 0),r=ax(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexOverlapSizer",this.sizerChildren={},this.addChildrenMap("items",this.sizerChildren)}childToKey(t){if("string"!=typeof t)return rx(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}Object.assign(ox.prototype,sx);var hx=Phaser.Math.Distance.Between,lx=function(t,e,i){var s=t.width/2;return hx(s,s,e,i)<=s};const dx=Phaser.Math.Angle.Between,cx=Phaser.Math.Angle.Normalize;var ux=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;if(lx(s,e,i)){var r=s.width/2,n=s.startAngle,a=dx(r,r,e,i),o=s.anticlockwise?n-a:a-n,h=cx(o)/(2*Math.PI);this.stopEaseValue(),0===this.easeValueDuration||Math.abs(this.value-h)<.1?this.value=h:this.easeValueTo(h)}}},px=function(){this.sizerChildren.knob.on("pointerdown",ux,this).on("pointermove",ux,this).setInteractive()};const gx=Phaser.Math.Angle.Between,vx=Phaser.Math.Angle.Wrap;var fx=function(t,e,i){if(this.enable&&!this.panPointer){var s=this.sizerChildren.knob;lx(s,e,i)&&bx.call(this,t)}},mx=function(t,e,i){if(this.enable&&t.isDown){var s=this.sizerChildren.knob;switch(this.panState){case kx:lx(s,e,i)&&bx.call(this,t);break;case wx:lx(s,e,i)?Cx.call(this):xx.call(this)}}},yx=function(t,e,i){this.enable&&this.panPointer===t&&xx.call(this)},bx=function(t){this.panPointer=t,this.panState=wx},xx=function(){this.panPointer=void 0,this.panState=kx},Cx=function(){var t=this.panPointer.prevPosition,e=this.panPointer.position,i=this.sizerChildren.knob,s=gx(i.x,i.y,t.x,t.y),r=gx(i.x,i.y,e.x,e.y),n=i.anticlockwise?s-r:r-s,a=vx(n)/(2*Math.PI);this.stopEaseValue(),this.value+=a};const kx=0,wx=1;var Sx=function(){this.sizerChildren.knob.on("pointerdown",fx,this).on("pointermove",mx,this).on("pointerup",yx,this).setInteractive(),this.panPointer=void 0,this.panState=kx},Px=function(t){return void 0===t&&(t=this.value),this.textFormatCallbackScope?this.textFormatCallback(t):this.textFormatCallback.call(this.textFormatCallbackScope,t)},Tx={setTextFormatCallback:function(t,e){return this.textFormatCallback=t,this.textFormatCallbackScope=e,this},getFormatText:Px,updateText:function(t){var e=this.sizerChildren.text;return e&&this.textFormatCallback&&(e.setText(Px.call(this,t)),e.layout&&e.layout()),this}};const Ox=Phaser.Utils.Objects.GetValue,Mx=Phaser.Math.Snap.To;class Ex extends(Hu(ox)){constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexKnob",this.bootProgressBase(e);var i=Ox(e,"background",void 0),s=Ox(e,"text",void 0);i&&this.addBackground(i),s&&(e.textColor=void 0,e.textStrokeColor=void 0,this.setTextFormatCallback(Ox(e,"textFormatCallback",void 0),Ox(e,"textFormatCallbackScope",void 0)),e.textFormatCallback=void 0,e.textFormatCallbackScope=void 0);var r=new lp(t,e);r.setDepth(Ox(e,"knobDepth",0)),r._value=-1,t.add.existing(r),this.add(r,"knob"),s&&(this.add(s,"text","center",0,!1),t.children.moveBelow(r,s)),this.addChildrenMap("background",i),this.addChildrenMap("knob",r),this.addChildrenMap("text",s),this.setEnable(Ox(e,"enable",void 0)),this.setGap(Ox(e,"gap",void 0)),this.setValue(Ox(e,"value",0),Ox(e,"min",void 0),Ox(e,"max",void 0));var n=Ox(e,"input",0);switch("string"==typeof n&&(n=_x[n]),n){case 0:Sx.call(this);break;case 1:px.call(this)}}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setGap(t){return this.gap=t,this}get value(){return this.sizerChildren.knob.value}set value(t){void 0!==this.gap&&(t=Mx(t,this.gap));var e=this.value;this.sizerChildren.knob.value=t;var i=this.value;e!==i&&(this.updateText(),this.eventEmitter.emit("valuechange",i,e,this.eventEmitter))}}const _x={pan:0,drag:0,click:1,none:-1};Object.assign(Ex.prototype,Tx),t.register("knob",(function(t){var e=new Ex(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Knob",Ex);const Rx={arc:Pc,circle:Tc,curve:class extends wc{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,i=t.length;ethis.value)for(var d=0;dthis.value&&(t+=1));for(var r=this.getShapes(),n=0,a=r.length;n0?d.pop().setTexture(u,O):r(c,u,O),h&&c.add.existing(T),l){var M=b+k*P+a*k,E=x+w*S+o*w;T.setOrigin(a,o).setPosition(M,E).setScale(v,f).setRotation(m),fk(T,b,x,m)}C.push(T)}return C}(t,e,i,s),a=0,o=n.length;a0&&(a=this.getChildLocalScaleX(s),a/=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a/=r.biasScale,this.setChildLocalScale(r,a))),e?t.call(e,i,s,r,n):t(i,s,r,n),this.scaleMode&&(s.biasScale>0&&(a=this.getChildLocalScaleX(s),a*=s.biasScale,this.setChildLocalScale(s,a)),r.biasScale&&(a=this.getChildLocalScaleX(r),a*=r.biasScale,this.setChildLocalScale(r,a))))};Object.assign(Tk.prototype,bk);const Mk={fit:1,FIT:1,envelop:2,ENVELOP:2};t.register("transitionImage",(function(t,e,i,s,r){var n=new Tk(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n})),P(window,"RexPlugins.UI.TransitionImage",Tk);const Ek=Phaser.Renderer.WebGL.Pipelines.PostFXPipeline,_k=Phaser.Utils.Objects.GetValue,Rk=Phaser.Math.Clamp;class Lk extends Ek{constructor(t){super({name:"rexDissolvePostFx",game:t,renderTarget:!0,fragShader:"#ifdef GL_FRAGMENT_PRECISION_HIGH\n#define highmedp highp\n#else\n#define highmedp mediump\n#endif\nprecision highmedp float;\n// Scene buffer\nuniform sampler2D uMainSampler;\nuniform sampler2D uMainSampler2;\n\nuniform int resizeMode;\nuniform float progress;\nuniform float fromRatio;\nuniform float toRatio;\nvarying vec2 outFragCoord;\n// Effect parameters\nuniform float noiseX;\nuniform float noiseY;\nuniform float noiseZ;\nuniform float fromEdgeStart;\nuniform float fromEdgeWidth;\nuniform float toEdgeStart;\nuniform float toEdgeWidth;\n\nvec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }\nvec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }\nvec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }\nvec3 fade(vec3 t) { return t*t*t*(t*(t*6.0-15.0)+10.0); }\nfloat Perlin(vec3 P) {\n vec3 i0 = mod289(floor(P)), i1 = mod289(i0 + vec3(1.0));\n vec3 f0 = fract(P), f1 = f0 - vec3(1.0), f = fade(f0);\n vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x), iy = vec4(i0.yy, i1.yy);\n vec4 iz0 = i0.zzzz, iz1 = i1.zzzz;\n vec4 ixy = permute(permute(ix) + iy), ixy0 = permute(ixy + iz0), ixy1 = permute(ixy + iz1);\n vec4 gx0 = ixy0 * (1.0 / 7.0), gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n vec4 gx1 = ixy1 * (1.0 / 7.0), gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n gx0 = fract(gx0); gx1 = fract(gx1);\n vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0), sz0 = step(gz0, vec4(0.0));\n vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1), sz1 = step(gz1, vec4(0.0));\n gx0 -= sz0 * (step(0.0, gx0) - 0.5); gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n gx1 -= sz1 * (step(0.0, gx1) - 0.5); gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n vec3 g0 = vec3(gx0.x,gy0.x,gz0.x), g1 = vec3(gx0.y,gy0.y,gz0.y),\n g2 = vec3(gx0.z,gy0.z,gz0.z), g3 = vec3(gx0.w,gy0.w,gz0.w),\n g4 = vec3(gx1.x,gy1.x,gz1.x), g5 = vec3(gx1.y,gy1.y,gz1.y),\n g6 = vec3(gx1.z,gy1.z,gz1.z), g7 = vec3(gx1.w,gy1.w,gz1.w);\n vec4 norm0 = taylorInvSqrt(vec4(dot(g0,g0), dot(g2,g2), dot(g1,g1), dot(g3,g3)));\n vec4 norm1 = taylorInvSqrt(vec4(dot(g4,g4), dot(g6,g6), dot(g5,g5), dot(g7,g7)));\n g0 *= norm0.x; g2 *= norm0.y; g1 *= norm0.z; g3 *= norm0.w;\n g4 *= norm1.x; g6 *= norm1.y; g5 *= norm1.z; g7 *= norm1.w;\n vec4 nz = mix(vec4(dot(g0, vec3(f0.x, f0.y, f0.z)), dot(g1, vec3(f1.x, f0.y, f0.z)),\n dot(g2, vec3(f0.x, f1.y, f0.z)), dot(g3, vec3(f1.x, f1.y, f0.z))),\n vec4(dot(g4, vec3(f0.x, f0.y, f1.z)), dot(g5, vec3(f1.x, f0.y, f1.z)),\n dot(g6, vec3(f0.x, f1.y, f1.z)), dot(g7, vec3(f1.x, f1.y, f1.z))), f.z);\n return 2.2 * mix(mix(nz.x,nz.z,f.y), mix(nz.y,nz.w,f.y), f.x);\n}\nfloat Perlin(vec2 P) { return Perlin(vec3(P, 0.0)); }\n\n\nvec4 getFromColor (vec2 uv) {\n return texture2D(uMainSampler, uv);\n}\n\nvec4 getToColor (vec2 uv) {\n if (resizeMode == 2) {\n // cover\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(min(fromRatio / toRatio, 1.0), min((toRatio / fromRatio), 1.0)));\n } else if (resizeMode == 1) {\n // contain\n return texture2D(uMainSampler2, 0.5 + (vec2(uv.x, 1.0 - uv.y) - 0.5) * vec2(max(fromRatio / toRatio, 1.0), max((toRatio / fromRatio), 1.0)));\n } else {\n // stretch\n return texture2D(uMainSampler2, vec2(uv.x, 1.0 - uv.y));\n }\n}\n\nvec4 transition (vec2 uv) { \n vec4 colorFront = getFromColor(uv);\n vec4 colorTo = getToColor(uv);\n\n float noise = (Perlin(vec3(uv.x * noiseX, uv.y * noiseY, noiseZ)) + 1.0) / 2.0\n * (1.0 - (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth))\n + (fromEdgeStart + fromEdgeWidth + toEdgeStart + toEdgeWidth) * 0.5;\n vec4 colorResult = colorFront * smoothstep(progress - (fromEdgeStart + fromEdgeWidth), progress - fromEdgeStart, noise)\n + colorTo * smoothstep((1.0 - progress) - (toEdgeStart + toEdgeWidth), (1.0 - progress) - toEdgeStart, (1.0 - noise));\n return colorResult;\n}\n\nvoid main () {\n vec2 uv = outFragCoord;\n gl_FragColor = transition(uv);\n}\n"}),this._progress=0,this.toFrame=null,this.targetTexture=null,this.resizeMode=1,this.toRatio=1,this.noiseX=0,this.noiseY=0,this.noiseZ=0,this.fromEdgeStart=.01,this.fromEdgeWidth=.05,this.toEdgeStart=.01,this.toEdgeWidth=.05}resetFromJSON(t){return this.setProgress(_k(t,"progress",0)),this.setTransitionTargetTexture(_k(t,"toTexture","__DEFAULT"),_k(t,"toFrame",void 0),_k(t,"resizeMode",1)),this.setNoise(_k(t,"noiseX",void 0),_k(t,"noiseY",void 0),_k(t,"noiseZ",void 0)),this.setFromEdge(_k(t,"fromEdgeStart",.01),_k(t,"fromEdgeWidth",.05)),this.setToEdge(_k(t,"toEdgeStart",.01),_k(t,"toEdgeWidth",.05)),this}onBoot(){}onPreRender(){this.set1f("progress",this.progress),this.set1i("resizeMode",this.resizeMode),this.set1f("noiseX",this.noiseX),this.set1f("noiseY",this.noiseY),this.set1f("noiseZ",this.noiseZ),this.set1f("fromEdgeStart",this.fromEdgeStart),this.set1f("fromEdgeWidth",this.fromEdgeWidth),this.set1f("toEdgeStart",this.toEdgeStart),this.set1f("toEdgeWidth",this.toEdgeWidth)}onDraw(t){this.set1f("fromRatio",t.width/t.height),this.set1f("toRatio",this.toRatio),this.set1i("uMainSampler2",1),this.bindTexture(this.targetTexture,1),this.bindAndDraw(t)}get progress(){return this._progress}set progress(t){this._progress=Rk(t,0,1)}setProgress(t){return this.progress=t,this}setTransitionTargetTexture(t,e,i){void 0===t&&(t="__DEFAULT");var s=this.game.textures.getFrame(t,e);return s||(s=this.game.textures.getFrame("__DEFAULT")),this.toRatio=s.width/s.height,this.toFrame=s,this.targetTexture=s.glTexture,void 0!==i&&(this.resizeMode=i),this}setResizeMode(t){return"string"==typeof t&&(t=Bk[t]),this.resizeMode=t,this}setNoise(t,e,i){return void 0===t&&(t=4+6*Math.random()),void 0===e&&(e=4+6*Math.random()),void 0===i&&(i=10*Math.random()),this.noiseX=t,this.noiseY=e,this.noiseZ=i,this}setFromEdge(t,e){return this.fromEdgeStart=t,this.fromEdgeWidth=e,this}setToEdge(t,e){return this.toEdgeStart=t,this.toEdgeWidth=e,this}}var Bk={stretch:0,contain:1,cover:2};const Ik=Phaser.Utils.Array.SpliceOne,Dk=.1,jk=[function(t){t.addTransitionMode("slideAwayRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}}).addTransitionMode("slideAwayUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0)}})},function(t){t.addTransitionMode("slideRight",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(s-1);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideLeft",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.width*(1-s);t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideDown",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(s-1);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}}).addTransitionMode("slideUp",{ease:"Linear",dir:"in",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=i.height*(1-s);t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("pushRight",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*s;t.setChildLocalPosition(e,r,0),r=i.width*(s-1),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushLeft",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.width*-s;t.setChildLocalPosition(e,r,0),r=i.width*(1-s),t.setChildLocalPosition(i,r,0)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushDown",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*s;t.setChildLocalPosition(e,0,r),r=i.height*(s-1),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}}).addTransitionMode("pushUp",{ease:"Linear",dir:"out",mask:!0,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=e.height*-s;t.setChildLocalPosition(e,0,r),r=i.height*(1-s),t.setChildLocalPosition(i,0,r)},onComplete:function(t,e,i,s){t.setChildLocalPosition(e,0,0),t.setChildLocalPosition(i,0,0)}})},function(t){t.addTransitionMode("zoomOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=1-s;t.setChildLocalScale(e,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1)}}).addTransitionMode("zoomIn",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){var r=s;t.setChildLocalScale(i,r,r)},onComplete:function(t,e,i,s){t.setChildLocalScale(i,1,1)}}).addTransitionMode("zoomInOut",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(r=1-To(s),t.setChildLocalScale(e,r,r)):(e.visible&&t.setChildVisible(e,!1),r=1-To(s),t.setChildLocalScale(i,r,r))},onComplete:function(t,e,i,s){t.setChildLocalScale(e,1,1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildLocalScale(i,1,1),t.setChildVisible(i,!0),i.tint=16777215}})},function(t){t.addTransitionMode("fade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){i.tint=0},onProgress:function(t,e,i,s){var r;s<.5?(s=To(s),r=Math.floor(255*(1-s)),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=To(s),r=Math.floor(255*(1-s)),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}}).addTransitionMode("crossFade",{ease:"Linear",dir:"out",mask:!1,onStart:function(t,e,i,s){},onProgress:function(t,e,i,s){t.setChildLocalAlpha(e,1-s),t.setChildLocalAlpha(i,s)},onComplete:function(t,e,i,s){t.setChildLocalAlpha(e,1)}})},function(t){var e,i=(e=t.scene,new Ux(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){this.getShape("rect").fillStyle(16777215).setSize(this.width*this.value,this.height*this.value).setCenterPosition(this.centerX,this.centerY)}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("irisOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("irisInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=To(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=To(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Ux(e,{type:"Graphics",create:[{name:"pie",type:"arc"}],update:function(){var t=2*Math.max(this.width,this.height),e=90*this.value;this.getShape("pie").fillStyle(16777215).setCenterPosition(this.centerX,0).setRadius(t).setAngle(90-e,90+e).setPie()}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("pieOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieIn",{ease:"Linear",dir:"in",mask:i,onStart:function(t,e,i,s){t.setNextImageMaskEnable(!0,!0)},onProgress:function(t,e,i,s){t.maskGameObject.setValue(1-s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("pieInOut",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){i.tint=0,t.setCurrentImageMaskEnable(!0),t.setNextImageMaskEnable(!0)},onProgress:function(t,e,i,s){var r;s<.5?(s=To(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),e.tint=(r<<16)+(r<<8)+r):(e.visible&&t.setChildVisible(e,!1),s=To(s),r=Math.floor(255*(1-s)),t.maskGameObject.setValue(1-s),i.tint=(r<<16)+(r<<8)+r)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1),t.setChildVisible(e,!0),e.tint=16777215,t.setChildVisible(i,!0),i.tint=16777215}})},function(t){var e,i=(e=t.scene,new Ux(e,{type:"Graphics",create:[{name:"rect",type:"rectangle"}],update:function(){var t=this.getShape("rect").fillStyle(16777215),e=1-this.value;switch(this.wipeMode){case"right":t.setSize(this.width*e,this.height).setTopLeftPosition(this.width-t.width,0);break;case"left":t.setSize(this.width*e,this.height).setTopLeftPosition(0,0);break;case"down":t.setSize(this.width,this.height*e).setTopLeftPosition(0,this.height-t.height);break;case"up":t.setSize(this.width,this.height*e).setTopLeftPosition(0,0)}}}));t.once("destroy",(function(){i.destroy()})).addTransitionMode("wipeRight",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="right"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeLeft",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="left"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeDown",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="down"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}}).addTransitionMode("wipeUp",{ease:"Linear",dir:"out",mask:i,onStart:function(t,e,i,s){t.setCurrentImageMaskEnable(!0),t.maskGameObject.wipeMode="up"},onProgress:function(t,e,i,s){t.maskGameObject.setValue(s)},onComplete:function(t,e,i,s){t.removeMaskGameObject(!1)}})},function(t){var e=function(t,e){var i=new Ux(t,{type:"Graphics",create:{rectangle:e},update:function(){for(var t=this.getShapes(),i=this.width/e,s=0;s=0;s--)(a=r[s])instanceof e&&(a.destroy(),Ik(r,s));else{s=0;for(var r,n=(r=t.postPipelines).length;s0}(e,Lk),delete e.effect}})},function(t){t.addTransitionMode("revealRight",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Dk,0,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealLeft",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Dk,1,0)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealDown",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Dk,0,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}}).addTransitionMode("revealUp",{ease:"Linear",dir:"in",mask:!1,onStart:function(t,e,i,s){i.effect=i.preFX.addReveal(Dk,1,1)},onProgress:function(t,e,i,s){i.effect.progress=s},onComplete:function(t,e,i,s){i.preFX.remove(i.effect),delete i.effect}})}];class Ak extends Tk{constructor(t,e,i,s,r,n){super(t,e,i,s,r,n);for(var a=0,o=jk.length;at.dropEnable}),this.on("drop",(function(t,e){this._files=e.dataTransfer.files;var i=this._files;if(i&&this.filters)for(var s in this.filters){for(var r=this.filters[s],n=[],a=0,o=i.length;a0&&this.emit(`drop.${s}`,n)}}),this)}get files(){return this._files}}Object.assign(Cw.prototype,fw),t.register("fileDropZone",(function(t){var e=new Cw(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileDropZone",Cw);const kw=Phaser.Math.Wrap;var ww=function(t,e){if(this.hasRatioFitChild){var i,s,r;0===this.orientation?i=e-(this.getInnerPadding("top")+this.getInnerPadding("bottom"))*this.scaleY:(this.getInnerPadding("left"),this.getInnerPadding("right"),this.scaleX);for(var n=this.sizerChildren,a=0,o=n.length;a(i=0===this.orientation?Math.abs(h.left-t):Math.abs(h.top-e))&&(n=i,r=a)}return h=s[s.length-1],n>(i=0===this.orientation?Math.abs(h.right-t):Math.abs(h.bottom-e))&&(n=i,r=a+1),r};const Ow=Phaser.Utils.Objects.IsPlainObject,Mw=Phaser.Utils.Objects.GetValue,Ew=Phaser.Display.Align.CENTER,_w={min:0,full:-1};var Rw=function(t,e,i,s,r,n,a,o,h,l){var d,c,u,p;Av.call(this,t);var g=t.isRexSpace,v=typeof e;if(null===e)return this;if("number"===v);else if("string"===v)e=_w[e];else if(Ow(e)){var f;e=Mw(f=e,"proportion",void 0),i=Mw(f,"align",Ew),s=Mw(f,"padding",0),r=Mw(f,"expand",!1),n=Mw(f,"key",void 0),a=Mw(f,"index",void 0),t.isRexSizer||(o=Mw(f,"minWidth",void 0),h=Mw(f,"minHeight",void 0)),l=Mw(f,"fitRatio",0),d=Mw(f,"offsetX",0),c=Mw(f,"offsetY",0),u=Mw(f,"offsetOriginX",0),p=Mw(f,"offsetOriginY",0)}return"string"==typeof i&&(i=sv[i]),void 0===e&&(e=g?1:0),void 0===i&&(i=Ew),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===o&&(g?o=0:t.isRexSizer||(o=t._minWidth)),void 0===h&&(g?h=0:t.isRexSizer||(h=t._minHeight)),void 0===l||!1===l?l=0:!0===l&&(l=Fn(t)/Yn(t)),void 0===d&&(d=0),void 0===c&&(c=0),void 0===u&&(u=0),void 0===p&&(p=0),(f=this.getSizerConfig(t)).proportion=e,f.align=i,f.padding=Dv(s),f.expand=r,f.fitRatio=0===e?l:0,f.alignOffsetX=d,f.alignOffsetY=c,f.alignOffsetOriginX=u,f.alignOffsetOriginY=p,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(a,0,t),t.isRexSizer||(e>0&&(0===this.orientation?t.minWidth=void 0===o?Fn(t):o:t.minHeight=void 0===h?Yn(t):h),r&&(0===this.orientation?t.minHeight=h:t.minWidth=o)),void 0!==n&&this.addChildrenMap(n,t),this},Lw={add:Rw,addSpace(t){return this.insertSpace(void 0,t),this},insertSpace(t,e){return void 0===e&&(e=1),Rw.call(this,new Pw(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert(t,e,i,s,r,n,a,o){return Ow(i)&&(i.index=t),Rw.call(this,e,i,s,r,n,a,t,o),this},insertAtPosition(t,e,i,s,r,n,a,o,h){var l=Tw.call(this,t,e);return-1===l&&(l=void 0),this.insert(l,i,s,r,n,a,o,h),this}};const Bw=Phaser.Utils.Array.Remove;var Iw={remove(t,e){return this.getParentSizer(t)!==this||(Bw(this.sizerChildren,t),Gv.call(this,t,e)),this},removeAll(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ex.call(this,t),this}},Dw={getChildAlign(t){return this.getSizerConfig(t).align},setChildAlign(t,e){return"string"==typeof e&&(e=sv[e]),this.getSizerConfig(t).align=e,this}},jw={getChildProportion(t){return this.getSizerConfig(t).proportion},setChildProportion(t,e){return this.getSizerConfig(t).proportion=e,this}},Aw={getChildExpand(t){return this.getSizerConfig(t).expand},setChildExpand(t,e){return this.getSizerConfig(t).expand=e,this}},zw={sortChildren(t){return this.sizerChildren.sort(t),this},sortChildrenByData(t,e){return this.sizerChildren.sort((function(i,s){var r=i.getData(t),n=s.getData(t);return e?n-r:r-n})),this},sortChildrenByProperty(t,e){return this.sizerChildren.sort((function(i,s){var r=i[t],n=s[t];return e?n-r:r-n})),this}},Fw={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;if(this.childrenProportion,0===this.orientation)for(var l=!0,d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=e.rexSizer.padding).left+r.right)*this.scaleX,l?l=!1:n+=this.space.item*this.scaleX,a+=n)));else for(d=0,c=o.length;d0&&!i.resolved&&(n=void 0),void 0===n&&(0===s||this.hasProportion0Child?h=!0:n=0)):n=0,h||(n+=((r=i.padding).top+r.bottom)*this.scaleY,c?c=!1:n+=this.space.item*this.scaleY,a+=n)))}return h?void 0:a+(this.space.top+this.space.bottom)*this.scaleY},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width*this.scaleX);var s=t.rexSizer;if(0===this.orientation)s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);else if(s.expand){var r=this.space,n=e-(r.left+r.right)*this.scaleX,a=s.padding;i=n-(a.left+a.right)*this.scaleX}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var s=t.rexSizer;if(0===this.orientation){if(s.expand){var r=this.space,n=e-(r.top+r.bottom)*this.scaleY,a=s.padding;i=n-(a.top+a.bottom)*this.scaleY}}else s.proportion>0&&this.proportionLength>0&&(i=s.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s0&&(hf(t,0,0),e.resolved=!1,this.hasRatioFitChild=!0);return this._childrenProportion=void 0,this.hasProportion0Child=!1,this.proportionLength=void 0,nf.call(this),this},layoutChildren:function(){for(var t,e,i,s,r,n,a,o,h,l,d,c,u=this.sizerChildren,p=this.innerLeft,g=this.innerTop,v=this.innerWidth,f=this.innerHeight,m=p,y=g,b=this.startChildIndex,x=0,C=u.length;x0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},resolveHeight:function(t){if(void 0!==(t=tf.call(this,t))&&1===this.orientation&&void 0===this.proportionLength){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0}return t},hasWidthWrap:function(){return!(!this.hasRatioFitChild||1!==this.orientation)||Zv.call(this)},runWidthWrap:function(t){this.wrapResult||(1===this.orientation&&ww.call(this,t,void 0),Qv.call(this,t))},hasHeightWrap:function(){return!(!this.hasRatioFitChild||0!==this.orientation)||ef.call(this)},runHeightWrap:function(t){this.wrapResult||(0===this.orientation&&ww.call(this,void 0,t),sf.call(this,t))},setChildrenAlignMode:function(t){void 0===t&&(t="left");var e=this.sizerChildren,i=e[0],s=i&&i.isRexSpace;"right"===t||"bottom"===t||"center"===t?s||this.insertSpace(0):s&&this.remove(i,!0);var r=e.length-1,n=e[r],a=n&&n.isRexSpace;return"center"===t?a||this.insertSpace(r+1):a&&this.remove(n,!0),this}};Object.assign(Fw,Lw,Iw,Dw,jw,Aw,zw);var Yw=function(){for(var t,e,i=0,s=this.sizerChildren,r=0,n=s.length;r0?i+=e:0===e&&(this.hasProportion0Child=!0));return i};const Xw=Phaser.Utils.Objects.IsPlainObject,Ww=Phaser.Utils.Objects.GetValue;class Vw extends Wb{constructor(t,e,i,s,r,n,a){Xw(e)?(e=Ww(a=e,"x",0),i=Ww(a,"y",0),s=Ww(a,"width",void 0),r=Ww(a,"height",void 0),n=Ww(a,"orientation",0)):Xw(s)?(s=Ww(a=s,"width",void 0),r=Ww(a,"height",void 0),n=Ww(a,"orientation",0)):Xw(n)&&(n=Ww(a=n,"orientation",0)),void 0===n&&(n=0),super(t,e,i,s,r,a),this.type="rexSizer",this.sizerChildren=[],this.setOrientation(n),this.setItemSpacing(Ww(a,"space.item",0)),this.setStartChildIndex(Ww(a,"startChildIndex",0)),this.setRTL(Ww(a,"rtl",!1)),this.addChildrenMap("items",this.sizerChildren)}setOrientation(t){return this.orientation=Tp(t),this}setItemSpacing(t){return this.space.item=t,this}setStartChildIndex(t){return this.startChildIndex=t,this}setRTL(t){return void 0===t&&(t=!0),this.rtl=t,this}get childrenProportion(){return void 0===this._childrenProportion&&(this._childrenProportion=Yw.call(this)),this._childrenProportion}}Object.assign(Vw.prototype,Fw);var Gw=function(t,e,i){if(t){var s=null==e,r=null==i;return s&&r||(s||(t.displayWidth=e),r||(t.displayHeight=i),s&&(t.scaleX=t.scaleY),r&&(t.scaleY=t.scaleX)),t}},Hw={appendText:_i,resetDisplayContent:function(t){void 0===t?t={}:"string"==typeof t&&(t={text:t});var e=t.text||"";this.setText(e);var i=this.childrenMap.icon;if(i){t.icon?this.show(i):this.hide(i);var s=t.iconSize;s&&(this.setChildDisplaySize(i,s,s),void 0!==this.iconWidth&&this.setIconSize(s)),!0!==t.icon&&this.setIconTexture(t.icon,t.iconFrame)}var r=this.childrenMap.action;if(r){t.action?this.show(r):this.hide(r);var n=t.actionSize;n&&(this.setChildDisplaySize(r,n,n),void 0!==this.actionWidth&&this.setActionSize(n)),!0!==t.action&&this.setActionTexture(t.action,t.actionFrame)}return this}};class Uw extends Vw{get text(){var t=this.childrenMap.text;return t?t.text:""}set text(t){var e=this.childrenMap.text;e&&e.setText(t)}setText(t){return this.text=t,this}setIconTexture(t,e){var i=this.childrenMap.icon;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.iconWidth&&void 0!==this.iconHeight&&(Gw(i,this.iconWidth,this.iconHeight),this.resetChildScaleState(i)),this):this}setTexture(t,e){return this.setIconTexture(t,e),this}setIconSize(t,e){return void 0===e&&(e=t),this.iconWidth=t,this.iconHeight=e,this}get texture(){var t=this.childrenMap.icon;if(t)return t.texture}get frame(){var t=this.childrenMap.icon;if(t)return t.frame}setActionTexture(t,e){var i=this.childrenMap.action;return i&&i.setTexture?(i.setTexture(t,e),void 0!==this.actionWidth&&void 0!==this.actionHeight&&(Gw(i,this.actionWidth,this.actionHeight),this.resetChildScaleState(i)),this):this}get actionTexture(){var t=this.childrenMap.action;if(t)return t.texture}get actionFrame(){var t=this.childrenMap.action;if(t)return t.frame}setActionSize(t,e){return void 0===e&&(e=t),this.actionWidth=t,this.actionHeight=e,this}preLayout(){var t=this.childrenMap.icon;t&&void 0!==this.iconWidth&&void 0!==this.iconHeight&&Gw(t,this.iconWidth,this.iconHeight);var e=this.childrenMap.action;e&&void 0!==this.actionWidth&&void 0!==this.actionHeight&&Gw(e,this.actionWidth,this.actionHeight),super.preLayout()}postLayout(t,e,i){var s=this.childrenMap.iconMask;s&&(s.setPosition(),this.resetChildPositionState(s));var r=this.childrenMap.actionMask;return r&&(r.setPosition(),this.resetChildPositionState(r)),super.postLayout(t,e,i),this}resize(t,e){super.resize(t,e);var i=this.childrenMap.iconMask;i&&i.resize();var s=this.childrenMap.actionMask;return s&&s.resize(),this}}Object.assign(Uw.prototype,Hw);var Nw=function(t,e,i,s){var r=new dk(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const $w=Phaser.GameObjects.Text;var Kw=function(t){return t instanceof $w};const Jw=Phaser.GameObjects.BitmapText;var qw=function(t){return t instanceof Jw},Zw=function(t){return qw(t)?2:Kw(t)?0:1},Qw=function(t,e){for(var i=[],s=t.split("\n"),r=e.style,n=r.wordWrapWidth,a=r.hasOwnProperty("wrapMode")?r.wrapMode:3,o=e.context,h=0,l=s.length;h0&&r.push(h.join("")),r},eS=function(t,e){switch(Zw(t)){case 0:switch("string"==typeof e&&(e=Ie[e]||0),t.style.wrapMode=e,e){case 2:case 3:t.style.wordWrapCallback=Qw;break;default:t.style.wordWrapCallback=null}break;case 1:"string"==typeof e&&(e=Ie[e]||0),t.style.wrapMode=e}},iS=function(t,e){return void 0===e&&(e=0),t._minWidth=e,t.runWidthWrap=function(t){return t instanceof dn}(t)?function(t){return function(e){return t.setFixedSize(e,0).runWordWrap(),t.minHeight=t.height,t}}(t):qw(t)?function(t){return function(e){return t.setMaxWidth(e),t.minHeight=t.height,t}}(t):function(t){return function(e){var i=t.padding,s=e-(i.left+i.right)*t.scaleX,r=t.style;return Kw(t)?(r.wordWrapWidth=s,r.maxLines=0):(0===r.wrapMode&&(r.wrapMode=1),r.wrapWidth=s,r.maxLines=0),r.fixedWidth=e,r.fixedHeight=0,t.updateText(),t.minHeight=t.height,t}}(t),t};const sS=65535;var rS=function(t,e,i){if(null==e)return t;if(0===e)return oS(t,0,i),t;var s=t.text.length;if(0===s)return oS(t,e,i),t;var r=Math.floor(1.5*e/s);void 0!==i&&r>i&&(r=Math.floor(i));for(var n={},a=aS(t,r,e,i,n),o=0;o<=sS&&0!==a;o++){if((r+=a)<0){r=0;break}a=aS(t,r,e,i,n)}return o===sS&&console.warn("FontSizeFit: Test count exceeds 65535"),t.setFontSize(r),oS(t,e,i),t},nS=function(t,e,i){return void 0===i[e]&&(t.setFontSize(e),i[e]={width:t.width,height:t.height}),i[e]},aS=function(t,e,i,s,r){var n,a=nS(t,e,r),o=nS(t,e+1,r);if(void 0!==s)if(a.height<=s&&o.height>s)n=0;else{if(a.height>s)return-1;n=Math.floor(s-a.height)}if(a.width<=i&&o.width>i)return 0;if(a.width>i)return-1;var h=Math.floor(i-a.width);return void 0===n?h:Math.min(h,n)},oS=function(t,e,i){var s=t.style;s&&(s.fixedWidth=e,s.parent.width=e,void 0!==i&&(s.fixedHeight=i,s.parent.height=i),s.update(!1))};const hS=Phaser.Utils.Objects.GetValue;var lS=function(t,e){"number"==typeof e&&(e={minWidth:e});var i=hS(e,"minWidth",0),s=hS(e,"minHeight",0),r=hS(e,"fitHeight",!1);return t._minWidth=i,t._minHeight=s,r?(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),t.setFontSize(1),t},t.resize=function(e,i){return rS(t,e,i),t}):(t.runWidthWrap=function(e){return t.setFixedSize&&t.setFixedSize(0,0),rS(t,e,void 0),t},t.resize=function(e,i){return t.width===e&&t.height===i||t.setFixedSize(e,i),t}),t};const dS=Phaser.Utils.Objects.GetValue;class cS extends Uw{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexLabel";var i,s=dS(e,"background",void 0),r=dS(e,"icon",void 0),n=dS(e,"iconMask",void 0),a=dS(e,"text",void 0),o=dS(e,"action",void 0),h=dS(e,"actionMask",void 0),l=dS(e,"align",void 0);if(s&&this.addBackground(s),r){0===this.orientation?(a||o)&&(i={right:dS(e,"space.icon",0),top:dS(e,"space.iconTop",0),bottom:dS(e,"space.iconBottom",0),left:dS(e,"space.iconLeft",0)}):(a||o)&&(i={bottom:dS(e,"space.icon",0),left:dS(e,"space.iconLeft",0),right:dS(e,"space.iconRight",0),top:dS(e,"space.iconTop",0)});var d=dS(e,"squareFitIcon",!1)?1:0;if(this.add(r,{proportion:0,padding:i,fitRatio:d}),n&&(n=Nw.call(this,r,r,1)),!d){var c=dS(e,"iconSize",void 0);this.setIconSize(dS(e,"iconWidth",c),dS(e,"iconHeight",c))}}if(a){var u=dS(e,"wrapText",!1),p=dS(e,"adjustTextFontSize",!1);u?(!0===u&&(u="word"),eS(a,u),e.expandTextWidth=!0,iS(a)):p&&(e.expandTextWidth=!0,e.expandTextHeight=!0,lS(a,{fitHeight:!0}));var g,v,f=dS(e,"space.text",0),m=dS(e,"expandTextWidth",!1),y=dS(e,"expandTextHeight",!1);0===this.orientation?(g=m?1:0,o&&(i={right:f}),v=y):(g=y?1:0,o&&(i={bottom:f}),v=m),this.add(a,{proportion:g,expand:v,padding:i})}if(o&&(i=0===this.orientation?{top:dS(e,"space.actionTop",0),bottom:dS(e,"space.actionBottom",0),right:dS(e,"space.actionRight",0)}:{left:dS(e,"space.actionLeft",0),right:dS(e,"space.actionRight",0),bottom:dS(e,"space.actionBottom",0)},d=dS(e,"squareFitAction",!1)?1:0,this.add(o,{proportion:0,padding:i,fitRatio:d}),h&&(h=Nw.call(this,o,o,1)),!d)){var b=dS(e,"actionSize");this.setActionSize(dS(e,"actionWidth",b),dS(e,"actionHeight",b))}this.setChildrenAlignMode(l),this.addChildrenMap("background",s),this.addChildrenMap("icon",r),this.addChildrenMap("iconMask",n),this.addChildrenMap("text",a),this.addChildrenMap("action",o),this.addChildrenMap("actionMask",h)}}const uS=Phaser.Utils.Objects.GetValue;var pS=function(t,e){var i=uS(e,"canvas"),s=uS(i,"width",128),r=uS(i,"height",128),n=new Lu(t,0,0,s,r);t.add.existing(n);var a=uS(i,"key"),o=uS(i,"frame"),h=uS(i,"fill");return void 0!==h?n.fill(h):void 0!==a&&n.loadTexture(a,o),n.setTexture=n.loadTexture.bind(n),n};const gS=Phaser.Utils.Objects.GetValue;var vS=function(t,e){var i=gS(e,"clickTarget",this);return"string"==typeof i&&(i=t.getElement(i)),i};const fS=Phaser.Utils.Objects.GetValue,mS={accept:"image/*",multiple:!1};var yS=function(t,e){if(0!==e.length){var i=t.childrenMap.icon,s=i.image,r=e[0];return s.loadFromFilePromise(r).then((function(){return i.scaleImage(),t.emit("select",r,t),Promise.resolve(r)}))}},bS={async openPromise(){var t=this;return nw(this.scene.game,mS).then((function(e){return yS(t,e.files)}))},open(){return this.openPromise(),this},setClickOpenEnable(t){return void 0===t&&(t=!0),this.clickBehavior&&this.clickBehavior.setEnable(t),this.fileChooser&&this.fileChooser.setOpenEnable(t),this}},xS={getFileName:function(t){if(!t)return null;var e=t.name;return e.substr(0,e.lastIndexOf("."))},saveTexture:function(t){return this.childrenMap.canvas.generateTexture(t),this}};Object.assign(xS,bS);const CS=Phaser.Utils.Objects.GetValue;class kS extends cS{constructor(t,e){var i=function(t,e){var i=new Wk(t,{scaleUp:uS(e,"scaleUpIcon",!1),background:uS(e,"iconBackground"),image:pS(t,e)});return t.add.existing(i),i}(t,e);e.icon=i,super(t,e),this.type="rexImageFileInputLabel";var s=this.iconWidth,r=this.iconWidth;void 0!==s&&void 0!==r&&i.resize(s,r),this.clickTarget=vS(this,e),this.clickTarget&&(CS(e,"domButton",!0)?this.fileChooser=function(t){var e=t.scene,i=new uw(e,mS);return e.add.existing(i),t.pin(i),i.on("change",(function(){yS(t,i.files)})),i}(this):this.clickBehavior=function(t,e){var i=vS(t,e);if(i){var s=fS(e,"click"),r=new uu(i,s);return r.on("click",t.open,t),r}}(this,e)),this.addChildrenMap("canvas",i.image),this.addChildrenMap("iconBackground",i.background),this.addChildrenMap("fileChooser",this.fileChooser)}postLayout(t,e,i){this.fileChooser&&(this.fileChooser.syncTo(this.clickTarget),this.resetChildState(this.fileChooser)),super.postLayout(t,e,i)}}Object.assign(kS.prototype,xS),t.register("imageInputLabel",(function(t){var e=new kS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ImageInputLabel",kS);let wS=class extends Ia{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.parent.setFrame(t)}get scale(){return this.parent.scaleX}set scale(t){this.parent.setScale(t)}};const SS=Phaser.Utils.Objects.GetValue;class PS extends Ia{constructor(t,e){super(t,e),this.style=SS(e,"style",this);var i=SS(e,"propertiesMap");this.activeStyle=TS(e,"active",i),this.hoverStyle=TS(e,"hover",i),this.disableStyle=TS(e,"disable",i),this.onModifyStyle=SS(e,"onModifyStyle")}getStyle(t){return jd(this.style,t)}modifyStyle(t){for(var e in t)this.style[e]=t[e];return this.onModifyStyle&&this.onModifyStyle(this.parent,t),this}applyStyle(t){if(t){var e=this.getStyle(t);return Ad(e,t)?void 0:(this.modifyStyle(t),e)}}setActiveState(t){return OS.call(this,"active",t),this}setHoverState(t){return OS.call(this,"hover",t),this}setDisableState(t){return OS.call(this,"disable",t),this}}var TS=function(t,e,i){var s=Id(t,e);if(i)for(var r in s)i.hasOwnProperty(r)&&(s[i[r]]=s[r],delete s[r]);return s},OS=function(t,e){void 0===e&&(e=!0);var i=`${t}State`,s=`${t}Style`,r=`${t}StyleSave`;this[i]!==e&&(this[i]=e,e?this[r]=this.applyStyle(this[s]):(this.applyStyle(this[r]),this[r]=void 0))},MS={addStyleManager(t){return this.styleManager=new PS(this,t),this},setActiveState(t){return this.styleManager.setActiveState(t),this},setHoverState(t){return this.styleManager.setHoverState(t),this},setDisableState(t){return this.styleManager.setDisableState(t),this}};const ES=Phaser.GameObjects.Image,_S=Phaser.Utils.Objects.GetValue;class RS extends ES{constructor(t,e){void 0===e&&(e={}),super(t,_S(e,"x",0),_S(e,"y",0),_S(e,"key",""),_S(e,"frame",void 0)),this.type="rexStatesImage";var i=_S(e,"effects",!0);i&&_n(this,i),this.style=new wS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(RS.prototype,MS),t.register("statesImage",(function(t){var e=new RS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesImage",RS);class LS extends At{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesRoundRectangleShape",e.style=this,e.propertiesMap=BS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}}const BS={color:"fillColor",alpha:"fillAlpha",strokeWidth:"lineWidth"};Object.assign(LS.prototype,MS),t.register("statesRoundRectangle",(function(t){var e=new LS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesRoundRectangle",LS);let IS=class extends Ia{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.key!==t&&this.parent.setTexture(t,this.frame)}get frame(){return this.parent.frame.name}set frame(t){this.frame!==t&&this.parent.setFrame(t)}};const DS=Phaser.GameObjects.NineSlice,jS=Phaser.Utils.Objects.GetValue;class AS extends DS{constructor(t,e){void 0===e&&(e={}),super(t,jS(e,"x",0),jS(e,"y",0),jS(e,"key",null),jS(e,"frame",null),jS(e,"width",0),jS(e,"height",0),jS(e,"leftWidth",0),jS(e,"rightWidth",0),jS(e,"topHeight",0),jS(e,"bottomHeight",0)),this.type="rexStatesNineSlice";var i=jS(e,"effects",!0);i&&_n(this,i),this.style=new IS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(AS.prototype,MS),t.register("statesNineSlice",(function(t){var e=new AS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNineSlice",AS);let zS=class extends Ia{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.textureKey}set key(t){this.key!==t&&this.parent.setBaseTexture(t,this.baseFrameName)}get frame(){return this.parent.baseFrameName}set frame(t){this.frame!==t&&this.parent.setBaseTexture(this.parent.textureKey,t)}};const FS=Phaser.Utils.Objects.GetValue;class YS extends k{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexStatesNinePatch";var i=FS(e,"effects",!0);i&&_n(this,i),this.style=new zS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(YS.prototype,MS),t.register("statesNinePatch",(function(t){var e=new YS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesNinePatch",YS);const XS=Phaser.GameObjects.Text,WS=Phaser.Utils.Objects.GetValue;class VS extends XS{constructor(t,e){void 0===e&&(e={}),super(t,WS(e,"x",0),WS(e,"y",0),WS(e,"text",""),e),this.type="rexStatesText",e.style=this.style,e.onModifyStyle=function(t,e){var i=e.hasOwnProperty("fontStyle")||e.hasOwnProperty("fontSize")||e.hasOwnProperty("fontFamily");t.style.update(i)},this.addStyleManager(e),delete e.style}}Object.assign(VS.prototype,MS),t.register("statesText",(function(t){var e=new VS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesText",VS);class GS extends Ia{constructor(t,e){return super(t),new Proxy(this,this)}get(t,e){if(oe(t,e))return t[e];var i=t.parent;return oe(i,e)?i[e]:void 0}set(t,e,i){return oe(t,e)?t[e]=i:oe(t.parent,e)&&(t.parent[e]=i),!0}get key(){return this.parent.texture.key}set key(t){this.parent.setTexture(t,this.frame)}get fontSize(){return this.parent.fontSize}set fontSize(t){this.parent.setFontSize(t)}get tint(){return this.parent.tintTopLeft}set tint(t){this.parent.setTint(t)}get letterSpacing(){return this.parent.letterSpacing}set letterSpacing(t){this.parent.setLetterSpacing(t)}get lineSpacing(){return this.parent.lineSpacing}set lineSpacing(t){this.parent.setLineSpacing(t)}}const HS=Phaser.GameObjects.BitmapText,US=Phaser.Utils.Objects.GetValue;class NS extends HS{constructor(t,e){void 0===e&&(e={});var i=US(e,"x",0),s=US(e,"y",0),r=US(e,"font",""),n=US(e,"fontSize",!1),a=US(e,"align",0),o=US(e,"tint");super(t,i,s,r,"",n,a),this.type="rexStatesBitmapText",void 0!==o&&this.setTint(o);var h=US(e,"effects",!0);h&&_n(this,h),this.style=new GS(this,e),e.style=this.style,this.addStyleManager(e),delete e.style}}Object.assign(NS.prototype,MS),t.register("statesBitmapText",(function(t){var e=new NS(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBitmapText",NS);class $S extends gp{constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("value")||(e.value=0),e.hasOwnProperty("hover.bar")||(e["hover.bar"]=!0),e.hasOwnProperty("easeDuration")||(e.easeDuration=200),e.hasOwnProperty("ease")||(e.ease="Quad"),P(e,"easeValue.duration",e.easeDuration),P(e,"easeValue.ease",e.ease),super(t,e),this.type="rexStatesBarRectangleShape",this.barState=!1,e.style=this,e.propertiesMap=KS,this.addStyleManager(e),delete e.style,delete e.propertiesMap}get bar(){return this.barState}set bar(t){t=!!t,this.barState!==t&&(this.barState=t,this.easeValueTo(this.barState?1:0))}}const KS={color:"trackColor",strokeColor:"trackStrokeColor",strokeWidth:"trackStrokeThickness"};Object.assign($S.prototype,MS),t.register("statesBarRectangle",(function(t){var e=new $S(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.StatesBarRectangle",$S);var JS=function(t,e){void 0===e&&(e={}),void 0===e.options&&(e.options={});var i=e.options;i.responsive=!1,i.maintainAspectRatio=!1,i.hasOwnProperty("devicePixelRatio")||(i.devicePixelRatio=1);var s=!1;void 0===i.animation?i.animation={}:!1===i.animation&&(s=!0,i.animation={});var r=i.animation;s&&(r.duration=0);var n=r.onProgress;r.onProgress=function(e){n&&n(e),t.needRedraw()};var a=r.onComplete;return r.onComplete=function(e){a&&a(e),t.needRedraw()},e};let qS=class extends Lu{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.type="rexChart",this.chart=void 0,void 0!==n&&this.setChart(n)}destroy(t){this.scene&&(this.chart&&(this.chart.destroy(),this.chart=void 0),super.destroy(t))}resize(t,e){if(t===this.width&&e===this.height)return this;if(super.resize(t,e),this.chart){var i=this.chart;i.height=this.canvas.height,i.width=this.canvas.width,i.aspectRatio=i.height?i.width/i.height:null,i.update()}return this}};var ZS={setChart:function(t){return window.Chart?(this.chart&&this.chart.destroy(),this.chart=new Chart(this.context,JS(this,t)),this):(console.error("Can not find chartjs! Load chartjs in preload stage.\nscene.load.script('chartjs', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/Chart.min.js');"),this)},getChartDataset:function(t){if(void 0!==this.chart){if("string"!=typeof t)return this.chart.data.datasets[t];for(var e,i=this.chart.data.datasets,s=0,r=i.length;s=0;e--){var i=this.sizerChildren[e];i&&this.remove(i,t)}return this},clear(t){return aP(this.sizerChildren,null),ex.call(this,t),this}},hP={setColumnSpace(t){if(this.space.column||(this.space.column=[]),this.space.column.length=this.columnCount-1,"number"==typeof t)this.space.column0=t,aP(this.space.column,t);else{this.space.column0=t[0];for(var e=0,i=this.columnCount-1;e=0;s--){var r=s*this.columnCount+t;this.sizerChildren.splice(r,0,null)}return this.columnProportions.push(e),this.columnWidth.length+=1,this.space.column.splice(t,0,i),this},uP={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,s,r,n,a=0,o=this.sizerChildren,h=!1;this.totalColumnProportions;for(var l=0;l0){var i=t-this.getChildrenWidth(!1);i>=0&&(this.proportionWidthLength=i/e)}else this.proportionWidthLength=0}return t},resolveHeight:function(t){if(void 0!==(t=tf.call(this,t))&&void 0===this.proportionHeightLength){var e=this.totalRowProportions;if(e>0){var i=t-this.getChildrenHeight(!1);i>=0&&(this.proportionHeightLength=i/e)}else this.proportionHeightLength=0}return t},resolveChildrenWidth:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),void 0===(s=e.resolveWidth(i))&&(s=i),e.resolveChildrenWidth(s))},resolveChildrenHeight:function(t){var e,i,s,r;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),void 0===(s=e.resolveHeight(i))&&(s=i),e.resolveChildrenHeight(s))},runWidthWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(r=this.getColumnWidth(parseInt(n)%this.columnCount),i=this.getExpandedChildWidth(e,r),e.isRexSizer&&void 0===(s=e.resolveWidth(i))&&(s=i),e.runWidthWrap(s));return this},runHeightWrap:function(t){var e,i,s,r;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runHeightWrap||(r=this.getRowHeight(Math.floor(parseInt(n)/this.rowCount)),i=this.getExpandedChildHeight(e,r),e.isRexSizer&&void 0===(s=e.resolveHeight(i))&&(s=i),e.runHeightWrap(s));return this},resetGrid:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.columnCount=t,this.rowCount=e,this.gridCount=t*e,this.removeAll(),this.sizerChildren.length=t*e,aP(this.sizerChildren,null),this.columnProportions=[],this.columnProportions.length=t,"number"==typeof i)aP(this.columnProportions,i);else for(var n=0;n0?e+=t:0===t&&(this.hasColumnProportion0Child=!0);return e},gP=function(){for(var t,e=0,i=0;i0?e+=t:0===t&&(this.hasRowProportion0Child=!0);return e};const vP=Phaser.Utils.Objects.IsPlainObject,fP=Phaser.Utils.Objects.GetValue;class mP extends Wb{constructor(t,e,i,s,r,n,a,o,h,l){vP(e)?(e=fP(l=e,"x",0),i=fP(l,"y",0),s=fP(l,"width",void 0),r=fP(l,"height",void 0),n=fP(l,"column",l.col||0),a=fP(l,"row",0),o=fP(l,"columnProportions",0),h=fP(l,"rowProportions",0)):vP(s)?(s=fP(l=s,"width",void 0),r=fP(l,"height",void 0),n=fP(l,"column",l.col||0),a=fP(l,"row",0),o=fP(l,"columnProportions",0),h=fP(l,"rowProportions",0)):vP(n)?(n=fP(l=n,"column",l.col||0),a=fP(l,"row",0),o=fP(l,"columnProportions",0),h=fP(l,"rowProportions",0)):vP(o)&&(o=fP(l=o,"columnProportions",0),h=fP(l,"rowProportions",0)),super(t,e,i,s,r,l),this.type="rexGridSizer",this.sizerChildren=[],this.addChildrenMap("items",this.sizerChildren),this.setCreateCellContainerCallback(fP(l,"createCellContainerCallback")),this.setIndentLeft(fP(l,"space.indentLeftOdd",0),fP(l,"space.indentLeftEven",0)),this.setIndentTop(fP(l,"space.indentTopOdd",0),fP(l,"space.indentTopEven",0)),this.resetGrid(n,a,o,h,fP(l,"space",void 0))}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.columnProportions=void 0,this.rowProportions=void 0,this.columnWidth=void 0,this.rowHeight=void 0,this.createCellContainerCallback=void 0)}setColumnProportion(t,e){return t>=this.columnProportions.length||(this.columnProportions[t]=e),this}setRowProportion(t,e){return t>=this.rowProportions.length||(this.rowProportions[t]=e),this}get totalColumnProportions(){return void 0===this._totalColumnProportions&&(this._totalColumnProportions=pP.call(this)),this._totalColumnProportions}get totalRowProportions(){return void 0===this._totalRowProportions&&(this._totalRowProportions=gP.call(this)),this._totalRowProportions}getChildAt(t,e){return this.sizerChildren[e*this.columnCount+t]}childToGridIndex(t,e){if(!t)return null;var i=this.sizerChildren.indexOf(t);return-1===i?null:(void 0===e&&(e={}),e.x=i%this.columnCount,e.y=Math.floor(i/this.columnCount),e)}getColumnWidth(t){var e=this.columnProportions[t];return 0===e?this.columnWidth[t]:e*this.proportionWidthLength}getRowHeight(t){var e=this.rowProportions[t];return 0===e?this.rowHeight[t]:e*this.proportionHeightLength}setCreateCellContainerCallback(t){return this.createCellContainerCallback=t,this}}Object.assign(mP.prototype,uP),t.register("gridSizer",(function(t,e,i,s,r,n,a,o,h){var l=new mP(this.scene,t,e,i,s,r,n,a,o,h);return this.scene.add.existing(l),l})),P(window,"RexPlugins.UI.GridSizer",mP);var yP=function(t,e,i,s){return e/t<=i?e/(s-1):0},bP=function(t){var e,i,s,r,n,a={lines:[],width:0,height:0},o=this.sizerChildren,h=0,l=a.lines,d=void 0;if(0===this.orientation){for(var c=0,u=o.length;co.height/2)){r>(h=xP(o.left,o.centerY,t,e))&&(r=h,s=n);var h,l=i[n+1];l&&l.y===o.y||r>(h=xP(o.right,o.centerY,t,e))&&(r=h,s=n+1)}}return s};const kP=Phaser.Utils.Objects.IsPlainObject,wP=Phaser.Utils.Objects.GetValue,SP=Phaser.Display.Align.CENTER;var PP=function(t,e,i,s){return"\n"===t?(this.addNewLine(),this):(Av.call(this,t),kP(e)&&(e=wP(h=e,"padding",0),i=wP(h,"key",void 0),s=wP(h,"index",void 0),r=wP(h,"offsetX",0),n=wP(h,"offsetY",0),a=wP(h,"offsetOriginX",0),o=wP(h,"offsetOriginY",0)),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(h=this.getSizerConfig(t)).align=SP,h.padding=Dv(e),h.alignOffsetX=r,h.alignOffsetY=n,h.alignOffsetOriginX=a,h.alignOffsetOriginY=o,void 0===s||s>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(s,0,t),void 0!==i&&this.addChildrenMap(i,t),this);var r,n,a,o,h},TP={add(t,e,i){if(Nm(t))for(var s=t,r=0,n=s.length;r=0;e--)this.remove(this.sizerChildren[e],t);return this},clear(t){return this.sizerChildren.length=0,ex.call(this,t),this}},EP={getChildrenWidth:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=0===this.orientation&&t?this.maxChildWidth:this.rexSizer.resolved?this.wrapResult.width:void 0)?e+(this.space.left+this.space.right)*this.scaleX:void 0);var e},getChildrenHeight:function(t){return this.rexSizer.hidden?0:(void 0===t&&(t=!0),void 0!==(e=1===this.orientation&&t?this.maxChildHeight:this.rexSizer.resolved?this.wrapResult.height:void 0)?e+(this.space.top+this.space.bottom)*this.scaleY:void 0);var e},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,s=0,r=i.length;s=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}update_DRAGBEGIN(t,e){this.next()}next_DRAG(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}update_DRAG(t,e){var i=this.parent;i.dragState.justMoved&&i.dragging(),this.next()}enter_DRAG(){this.parent.onDragStart()}exit_DRAG(){this.parent.onDragEnd()}next_SLIDE(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}enter_SLIDE(){this.parent.onSliding()}exit_SLIDE(){this.parent.stop()}update_SLIDE(t,e){this.parent.sliding(t,e),this.next()}next_BACK(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}enter_BACK(){this.parent.onPullBack()}exit_BACK(){this.parent.stop()}update_BACK(t,e){this.parent.pullBack(t,e),this.next()}}const bT=Phaser.Utils.Objects.GetValue,xT=Phaser.Math.Distance.Between;class CT extends Ia{constructor(t,e){super(t,e),this._enable=void 0,this.rectBoundsInteractive=bT(e,"rectBoundsInteractive",!1),this.rectBoundsInteractive||t.setInteractive(bT(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(bT(t,"enable",!0)),this.holdThreshold=bT(t,"holdThreshold",50),this.pointerOutReleaseEnable=bT(t,"pointerOutRelease",!0),this}boot(){var t=this.scene,e=this.parent;this.rectBoundsInteractive?(t.input.on("pointerdown",this.onPointIn,this),t.input.on("pointerup",this.onPointOut,this),t.input.on("pointermove",this.onPointerMove,this)):(e.on("pointerdown",this.onPointIn,this),e.on("pointerup",this.onPointOut,this),this.pointerOutReleaseEnable&&e.on("pointerout",this.onPointOut,this),e.on("pointermove",this.onPointerMove,this)),t.sys.events.on("preupdate",this.preupdate,this)}shutdown(t){if(!this.isShutdown){var e=this.scene;this.parent,this.rectBoundsInteractive&&(e.input.off("pointerdown",this.onPointIn,this),e.input.off("pointerup",this.onPointOut,this),e.input.off("pointermove",this.onPointerMove,this)),e.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,super.shutdown(t)}}get enable(){return this._enable}set enable(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}toggleEnable(){return this.setEnable(!this.enable),this}setPointerOutReleaseEnable(t){return void 0===t&&(t=!0),this.pointerOutReleaseEnable=t,this}get isDown(){return this.pointer&&this.pointer.isDown}get isUp(){return!this.isDown}get dx(){return this.x-this.preX}get dy(){return this.y-this.preY}get dt(){return hc(this.scene)}get speed(){return this.x===this.preX&&this.y===this.preY?0:xT(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}get speedX(){return this.dx/(.001*this.dt)}get speedY(){return this.dy/(.001*this.dt)}onPointIn(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.rectBoundsInteractive&&!Um(this.parent,t)||(this.pointer=t,this.localX=e,this.localY=i))}onPointOut(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}onPointerMove(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.rectBoundsInteractive&&this.pointerOutReleaseEnable&&!Um(this.parent,t)?this.onPointOut(t):(this.localX=e,this.localY=i))}preupdate(t,e){if(this.enable){var i=this.pointer;this.justMoved=!1,i&&!this.isInTouched?(this.x=i.worldX,this.y=i.worldY,this.preX=i.worldX,this.preY=i.worldY,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",i,this.localX,this.localY)):i&&this.isInTouched?this.x===i.x&&this.y===i.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=i.worldX,this.y=i.worldY,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",i,this.localX,this.localY)):!i&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",i))}}}const kT=Phaser.Utils.Objects.GetValue;class wT{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){return this.setValue(kT(t,"value",0)),this.setSpeed(kT(t,"speed",0)),this.setAcceleration(kT(t,"acceleration",0)),this}reset(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}setValue(t){return this.value=t,this}setSpeed(t){return this.speed=t,this}setAcceleration(t){return this.acceleration=t,this}updateSpeed(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}getDeltaValue(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}update(t){return this.updateSpeed(t),this.speed>0&&(this.value+=this.getDeltaValue(t)),this}get isMoving(){return this.speed>0}}class ST{constructor(){this.value,this.dir,this.movement=new wT}init(t,e,i,s,r){return this.value=t,this.end=r,this.dir=void 0!==r?tthis.end&&(this.value=this.end):this.valuethis.maxValue}overMin(t){return null!=this.minValue&&t0,Math.abs(e),i)}sliding(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}onPullBack(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),s=this.backDeceleration,r=Math.sqrt(2*s*i);this._slowDown.init(t,void 0,r,s,e)}pullBack(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}stop(){this._slowDown.stop()}}const MT={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},ET=Phaser.Utils.Objects.GetValue;class _T extends Ia{constructor(t,e){switch(super(t,e),this.parent!==this.scene?this.focusMode=ET(e,"focus",!0):this.focusMode=!1,"boolean"==typeof this.focusMode&&(this.focusMode=this.focusMode?1:0),this.setSpeed(ET(e,"speed",.1)),this.setEnable(ET(e,"enable",!0)),this.focusMode){case 0:case 2:this.scene.input.on("wheel",this.onSceneScroll,this);break;default:t.setInteractive(ET(e,"inputConfig",void 0)).on("wheel",(function(t,e,i,s,r){this.tryScroll(i)}),this)}}destroy(){switch(this.focusMode){case 0:case 2:this.scene.input.off("wheel",this.onSceneScroll,this)}}onSceneScroll(t,e,i,s,r,n){(2!==this.focusMode||Um(this.parent,t))&&this.tryScroll(s)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}setSpeed(t){return this.speed=t,this}tryScroll(t){if(this.enable)return this.scroll(t),this}scroll(t){return t*=this.speed,this.emit("scroll",t,this.parent,this),this}}const RT=Phaser.Utils.Objects.GetValue;var LT=function(t,e,i,s){var r,n,a="Y"===(i=i.toUpperCase()),o=2===t.scrollMode,h=t.childrenMap.child,l=`slider${i}`;if(r=o||s.hasOwnProperty(l)?RT(s,l,void 0):RT(s,"slider",void 0)){var d,c,u;!0===r&&(r={}),r.orientation=a?1:0,n=function(t,e){void 0===e&&(e={});var i=Ge(e);(e={slider:i}).orientation=i.orientation,delete i.orientation,e.background=i.background,delete i.background,e.buttons=i.buttons,delete i.buttons,e.value=null;var s=new mT(t,e);t.add.existing(s);var r=s.childrenMap.slider;return s.addChildrenMap("track",r.childrenMap.track),s.addChildrenMap("indicator",r.childrenMap.indicator),s.addChildrenMap("thumb",r.childrenMap.thumb),s}(t.scene,r),n.tickLength=RT(r,"tickLength",void 0);var p=RT(r,"position",0);"string"==typeof p&&(p=BT[p]);var g,v,f=RT(s,`space.slider${i}`,void 0);void 0===f&&void 0===(f=RT(s,"space.slider",void 0))&&(o?f=0:g=RT(s,"space.child",0)),v=void 0===g?"number"==typeof f:"number"==typeof g,a?0===p?(d=2,c=1,u=void 0===g?v?{left:f}:f:{left:RT(g,"right",g)}):(d=0,c=1,u=void 0===g?v?{right:f}:f:{right:RT(g,"left",g)}):0===p?(d=1,c=2,u=void 0===g?v?{top:f}:f:{top:RT(g,"bottom",g)}):(d=1,c=0,u=void 0===g?v?{bottom:f}:f:{bottom:RT(g,"top",g)}),e.add(n,{column:d,row:c,align:"center",padding:u,expand:!0}),t[`hideUnscrollableSlider${i}`]=RT(r,"hideUnscrollableSlider",!1),t[`disableUnscrollableDrag${i}`]=RT(r,"disableUnscrollableDrag",!1),t[`adaptThumb${i}SizeMode`]=RT(r,"adaptThumbSize",!1),t[`minThumb${i}Size`]=RT(r,"minThumbSize",void 0)}else t[`hideUnscrollableSlider${i}`]=!1,t[`disableUnscrollableDrag${i}`]=!1,t[`adaptThumb${i}SizeMode`]=!1,t[`minThumb${i}Size`]=void 0;var m,y,b=RT(s,"scrollDetectionMode");"string"==typeof b&&(b=IT[b]);var x=`scroller${i}`;(m=o||s.hasOwnProperty(x)?RT(s,x,!0):RT(s,"scroller",!0))&&h&&(!0===m&&(m={}),m.orientation=a?0:1,void 0!==b&&(m.rectBoundsInteractive=1===b),y=new OT(h,m),h.isRexContainerLite&&h.sendChildToBack(h));var C,k,w,S,P,T=RT(s,o?`mouseWheelScroller${i}`:"mouseWheelScroller",!1);T&&h&&(void 0!==b&&(T.focus=1===b?2:0),C=new _T(h,T)),t.addChildrenMap(`slider${i}`,n),t.addChildrenMap(`scroller${i}`,y),t.addChildrenMap(`mouseWheelScroller${i}`,C),o&&!a||(t.hideUnscrollableSlider=t[`hideUnscrollableSlider${i}`],t.disableUnscrollableDrag=t[`disableUnscrollableDrag${i}`],t.adaptThumbSizeMode=t[`adaptThumb${i}SizeMode`],t.minThumbSize=t[`minThumb${i}Size`],t.addChildrenMap("slider",n),t.addChildrenMap("scroller",y),t.addChildrenMap("mouseWheelScroller",C)),n&&(o?(k=a?"t":"s",S=`scroll${i}`):(k="t",S="scroll"),n.on("valuechange",(function(e){t[k]=e,t.emit(S,t)}))),y&&(o?(w=`childO${i}`,S=`scroll${i}`):(w="childOY",S="scroll"),y.on("valuechange",(function(e){t[w]=e,t.emit(S,t)}))),C&&(P=o?`addChildO${i}`:"addChildOY",C.on("scroll",(function(e){t[P](-e,!0)})))};const BT={right:0,left:1,bottom:0,top:1},IT={gameObject:0,rectBounds:1},DT=Phaser.Utils.Objects.GetValue;var jT=function(t,e){var i=t.scene,s=[0,1,0],r=[0,1,0],n=DT(e,"width"),a=DT(e,"height");n||DT(e,"child.expandWidth",!0)||(s[1]=0),a||DT(e,"child.expandHeight",!0)||(r[1]=0);var o=new mP(i,{column:3,row:3,columnProportions:s,rowProportions:r});switch(function(t,e,i){var s=WP(i,"child"),r=WP(s,"gameObject",void 0);if(r){var n=WP(i,"space.child",0);t.childMargin={};var a=t.childMargin,o={};if("number"==typeof n)switch(t.scrollMode){case 0:case 1:a.top=0,a.bottom=0,a.left=0,a.right=0;break;default:a.top=n,a.bottom=n,a.left=n,a.right=n}else switch(t.scrollMode){case 0:a.top=WP(n,"top",0),a.bottom=WP(n,"bottom",0),o.left=WP(n,"left",0),o.right=WP(n,"right",0);break;case 1:a.top=WP(n,"left",0),a.bottom=WP(n,"right",0),o.top=WP(n,"top",0),o.bottom=WP(n,"bottom",0);break;default:a.top=WP(n,"top",0),a.bottom=WP(n,"bottom",0),a.left=WP(n,"left",0),a.right=WP(n,"right",0)}e.add(r,{column:1,row:1,align:WP(s,"align","center"),padding:o,expand:{width:WP(s,"expandWidth",!0),height:WP(s,"expandHeight",!0)}})}t.addChildrenMap("child",r)}(t,o,e),t.scrollMode){case 0:LT(t,o,"y",e);break;case 1:LT(t,o,"x",e);break;default:LT(t,o,"y",e),LT(t,o,"x",e)}return o},AT=function(t){var e,i,s,r;switch(this.scrollMode){case 0:case 1:e=this.topChildOY,i=this.bottomChildOY,s=this.childrenMap.scroller,r=this.childrenMap.slider,t=0===this.scrollMode?"Y":"X";break;default:"Y"===(t=t.toUpperCase())?(e=this.topChildOY,i=this.bottomChildOY):(e=this.leftChildOX,i=this.rightChildOX),s=this.childrenMap[`scroller${t}`],r=this.childrenMap[`slider${t}`]}i*="Y"===t?this.scaleY:this.scaleX,s&&s.setBounds(e,i),r&&(r.setEnable(e!==i),r.tickLength&&r.setTick(r.tickLength,e,i))},zT=function(t){switch(this.scrollMode){case 0:case 1:(i=this.childrenMap.slider)&&this.hideUnscrollableSlider&&this.setChildVisible(i,this.isOverflow),(r=this.childrenMap.scroller)&&this.disableUnscrollableDrag&&r.setEnable(this.isOverflow);break;default:var e=this[`isOverflow${t=t.toUpperCase()}`],i=this.childrenMap[`slider${t}`],s=this[`hideUnscrollableSlider${t}`];i&&s&&this.setChildVisible(i,e);var r=this.childrenMap.scroller,n=this[`disableUnscrollableDrag${t}`];r&&n&&r.setEnable(e)}},FT=function(t){switch(this.scrollMode){case 0:case 1:if(!this.adaptThumbSizeMode)return;if(!(o=this.childrenMap.slider))return;var e=Math.min(this.childVisibleHeight/this.childHeight,1),i=o.childrenMap.track,s=o.childrenMap.thumb,r=this.minThumbSize;if(0===this.scrollMode){var n=i.displayHeight*e;void 0!==r&&n0?t.setText(e).getTextBounds().wrappedText.split("\n"):e.split("\n")}return i},UT=function(t){return(t-this.textLineSpacing)/(this.textLineHeight+this.textLineSpacing)},NT=function(t){return t*(this.textLineHeight+this.textLineSpacing)-this.textLineSpacing},$T=function(t){var e,i=t+this.visibleLinesCount+1;switch(this.textObjectType){case 0:case 2:e=this.lines.slice(t,i).join("\n");break;case 1:var s=this.lines.getLineStartIndex(t),r=this.lines.getLineEndIndex(i-1);e=this.lines.getSliceTagText(s,r,!0)}return e},KT=function(t,e){switch(Zw(t)){case 0:var i=(r=t.style).wordWrapWidth,s=r.wordWrapCallback;r.wordWrapWidth=0,r.wordWrapCallback=void 0,t.setText(e),r.wordWrapWidth=i,r.wordWrapCallback=s;break;case 1:var r,n=(r=t.style).wrapMode;r.wrapMode=0,t.setText(e),r.wrapMode=n;break;case 2:var a=t._maxWidth;t._maxWidth=0,t.setText(e),t._maxWidth=a}},JT=function(){var t=this.textObject.rexSizer;this.textObject.y+=t.offsetY-t.preOffsetY,t.preOffsetY=t.offsetY,this.resetChildPositionState(this.textObject),this.textCropEnable&&qT.call(this)},qT=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)}},ZT=function(t,e,i){if(i+=this.textLineHeight+this.textLineSpacing,this.textObjectWidth!==e||this._textObjectRealHeight!==i){switch(this.textObjectWidth=e,this._textObjectRealHeight=i,this.textObjectType){case 0:case 1:t.setFixedSize(e,i);var s=t.style,r=Math.max(e,0);0===this.textObjectType?s.wordWrapWidth=r:(0===s.wrapMode&&(s.wrapMode=1),s.wrapWidth=r);break;case 2:t.setMaxWidth(e)}this.setText()}},QT={setText:function(t){return void 0!==t&&(this.text=t),this.lines=HT(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(UT.call(this,-this.textOY)),0),e=NT.call(this,t)+this.textOY,i=$T.call(this,t);return KT(this.textObject,i),this.textObject.rexSizer.offsetY=e,JT.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,nf.call(this),this},layoutChildren:function(){var t,e,i,s,r,n,a,o=this.left,h=this.top;(t=this.textObject).rexSizer.hidden||(s=o+(i=(e=t.rexSizer).padding).left*this.scaleX,r=h+i.top*this.scaleY,n=this.width*this.scaleX-(i.left+i.right)*this.scaleX,a=this.height*this.scaleY-(i.top+i.bottom)*this.scaleY,ZT.call(this,t,n,a),Ov(t,s,r,n,a,e.align),e.preOffsetY=0,JT.call(this),this.textMask&&(this.textMask.setPosition().resize(),this.resetChildPositionState(this.textMask)))}};const tO=Phaser.Utils.Objects.IsPlainObject,eO=Phaser.Utils.Objects.GetValue,iO=Phaser.Display.Align.TOP_LEFT;class sO extends Wb{constructor(t,e,i,s,r,n){tO(e)?(e=eO(n=e,"x",0),i=eO(n,"y",0),s=eO(n,"width",void 0),r=eO(n,"height",void 0)):tO(s)&&(s=eO(n=s,"width",void 0),r=eO(n,"height",void 0)),super(t,e,i,s,r,n),this.type="rexTextBlock",this.textObject=void 0,this.linesCount=0,this.textMask=void 0,this.textObjectType=void 0,this._textLineHeight=void 0,this._textLineSpacing=void 0,this._visibleLinesCount=void 0,this._textHeight=void 0,this._textVisibleHeight=void 0,this._textObjectRealHeight=0,this.lines=void 0,this.text=eO(n,"content",""),this._textOY=0,this.execeedTopState=!1,this.execeedBottomState=!1,this.setClampMode(eO(n,"clampTextOY",!0)),this.alwaysScrollable=eO(n,"alwaysScrollable",!1);var a=eO(n,"background",void 0),o=eO(n,"text",void 0);void 0===o&&(o=rO(t)),this.textCropEnable=eO(n,"textCrop",!!o.setCrop);var h=eO(n,"textMask",!this.textCropEnable);a&&this.addBackground(a),this.add(o),this.sizerChildren=[o];var l=this.getSizerConfig(o);l.align=iO,l.padding=Dv(0),l.expand=!0,this.textObject=o,this.textObjectType=Zw(o),l.preOffsetY=0,l.offsetY=0,h&&(this.textMask=Nw.call(this,this.textObject,this)),this.addChildrenMap("background",a),this.addChildrenMap("text",o)}destroy(t){if(this.scene&&!this.ignoreDestroy){if(this.textObject=void 0,this.textMask=void 0,this.lines){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.lines=void 0}super.destroy(t)}}setClampMode(t){return void 0===t&&(t=!0),this.clampTextOY=t,this}get textLineHeight(){if(void 0===this._textLineHeight){var t;switch(this.textObjectType){case 0:case 1:var e=this.textObject.style;t=e.metrics.fontSize+e.strokeThickness;break;case 2:var i=this.textObject.fontSize/this.textObject.fontData.size;t=this.textObject.fontData.lineHeight*i}this._textLineHeight=t}return this._textLineHeight}get textLineSpacing(){if(void 0===this._textLineSpacing){var t;switch(this.textObjectType){case 0:case 1:t=this.textObject.lineSpacing;break;case 2:t=0}this._textLineSpacing=t}return this._textLineSpacing}get visibleLinesCount(){return void 0===this._visibleLinesCount&&(this._visibleLinesCount=Math.floor(UT.call(this,this._textObjectRealHeight))),this._visibleLinesCount}get topTextOY(){return 0}get bottomTextOY(){return-this.textVisibleHeight}get textHeight(){return void 0===this._textHeight&&(this._textHeight=NT.call(this,this.linesCount)),this._textHeight}get textObjectHeight(){return this._textObjectRealHeight-(this.textLineHeight+this.textLineSpacing)}get textVisibleHeight(){if(void 0===this._textVisibleHeight){var t=this.textHeight-this.textObjectHeight;!this.alwaysScrollable&&t<0&&(t=0),this._textVisibleHeight=t}return this._textVisibleHeight}textOYExceedTop(t){return void 0===t&&(t=this.textOY),t>this.topTextOY}textOYExeceedBottom(t){return void 0===t&&(t=this.textOY),tthis.linesCount?t=0:s?t=e:r&&(t=i)),this._textOY!==t&&(this._textOY=t,this.updateTextObject()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}setTextOY(t){return this.textOY=t,this}set t(t){this.textOY=-this.textVisibleHeight*t}get t(){var t=this.textVisibleHeight;return 0===t?0:this.textOY/-t}setTextOYByPercentage(t){return this.t=t,this}}var rO=function(t){return t.add.text(0,0,"")};Object.assign(sO.prototype,QT);var nO={setText(t){return this.childrenMap.child.setText(t),this.resizeController(),this},appendText(t){return this.setText(this.text+t),this}},aO={scrollToLine(t){return this.setChildOY(-this.lineHeight*t),this},scrollToNextLine(t){void 0===t&&(t=1);var e=this.lineIndex+t;return this.scrollToLine(e),this}};const oO=Phaser.Utils.Objects.GetValue;class hO extends VT{constructor(t,e){void 0===e&&(e={});var i=oO(e,"text",void 0),s=oO(e,"textWidth",void 0),r=oO(e,"textHeight",void 0),n=oO(e,"textCrop",!!i.setCrop),a=oO(e,"textMask",!n),o=oO(e,"content",""),h=new sO(t,{width:s,height:r,text:i,textMask:a,textCrop:n&&!a,content:o,clampTextOY:oO(e,"clampChildOY",!1),alwaysScrollable:oO(e,"alwaysScrollable",!1)});t.add.existing(h),function(t){Object.defineProperty(t,"childOY",{configurable:!0,get:function(){return t.textOY},set:function(e){t.textOY=e}}),Object.defineProperty(t,"topChildOY",{get:function(){return t.topTextOY}}),Object.defineProperty(t,"bottomChildOY",{get:function(){return t.bottomTextOY}}),Object.defineProperty(t,"childVisibleHeight",{get:function(){return t.textObjectHeight}}),Object.defineProperty(t,"childHeight",{get:function(){return t.textHeight}})}(h),e.scrollMode=0,e.type="rexTextArea",e.child={gameObject:h,expandWidth:void 0===s,expandHeight:void 0===r};var l=oO(e,"space",void 0);l&&(l.child=oO(l,"text",0)),super(t,e),this.addChildrenMap("text",i)}get text(){return this.childrenMap.child.text}get lineHeight(){var t=this.childrenMap.child;return t.textLineHeight+t.textLineSpacing}get lineIndex(){return Math.floor(-this.childOY/this.lineHeight)}get linesCount(){return this.childrenMap.child.linesCount}get contentHeight(){return this.childrenMap.child.textHeight}}Object.assign(hO.prototype,nO,aO);const lO=Phaser.Utils.Objects.GetValue;var dO=function(t,e,s){e=e?i(e):{};var r=lO(s,"background",zP),n=lO(s,"text",cO),a=lO(s,"track",zP),o=lO(s,"thumb",zP);r?e.background=r(t,e.background):delete e.background,n?e.text=n(t,e.text):delete e.text;var h=e.slider;!1!==h&&null!==h&&(void 0===h&&(h={}),a?h.track=a(t,h.track):delete h.track,o?h.thumb=o(t,h.thumb):delete h.thumb,e.slider=h);var l=new hO(t,e);return t.add.existing(l),l},cO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("key")&&(i="bitmaptext",e.font=e.key)),i){case"bitmaptext":case"bitmap":s=new NS(t,e);break;case"bbcodetext":case"bbcode":s=new us(t,0,0,"",e);break;case"label":s=new vO(t,e);break;case"textarea":s=dO(t,e);break;default:s=new VS(t,e)}return AP(s,e),t.add.existing(s),s},uO=function(t,e){var i,s;switch(e&&(e.hasOwnProperty("$type")?i=e.$type:e.hasOwnProperty("leftWidth")?i="nineSlice":(e.hasOwnProperty("color")||e.hasOwnProperty("strokeColor"))&&(i="roundRectangle")),i){case"nineSlice":s=e.hasOwnProperty("stretchMode")?new YS(t,e):new AS(t,e);break;case"roundRectangle":s=new LS(t,e);break;default:s=new RS(t,e)}return AP(s,e),t.add.existing(s),s};const pO=Phaser.Utils.Objects.GetValue;var gO=function(t,e,s){e=e?i(e):{};var r=pO(s,"background",zP),n=pO(s,"text",cO),a=pO(s,"icon",uO),o=pO(s,"action",uO);return null!==e.background&&r?e.background=r(t,e.background):delete e.background,null!==e.text&&n?e.text=n(t,e.text):delete e.text,null!==e.icon&&a?e.icon=a(t,e.icon):delete e.icon,null!==e.action&&o?e.action=o(t,e.action):delete e.action,e};class vO extends cS{constructor(t,e,i){super(t,e=gO(t,e,i)),this.type="rexSimpleLabel"}setActiveState(t){return fO(this.getChildren(),"setActiveState",t),this}setHoverState(t){return fO(this.getChildren(),"setHoverState",t),this}setDisableState(t){return fO(this.getChildren(),"setDisableState",t),this}}var fO=function(t,e,i){for(var s=0,r=t.length;sthis.maxExp&&(t=this.maxExp),void 0===e&&(e=this.getLevel(t)),this._exp=t,this._level=e,this._requiredExp=this.getRequiredExpToNextLevel(e,t),this}get exp(){return this._exp}set exp(t){if(this.hasMaxLevel&&t>this.maxExp&&(t=this.maxExp),tthis.maxLevel?this.exp=this.maxExp:this.exp=this.getExp(t)}get requiredExp(){return this._requiredExp}getExp(t){return void 0===t?this._exp:this.isLevelMapFunction?this.levelTable(t):(this.hasMaxLevel&&t>this.maxLevel&&(t=this.maxLevel),this.levelTable[t])}getLevel(t,e){if(void 0===t)return this._level;for(void 0===e&&(e=0);;){var i=this.getExp(e+1);if(i>t)break;if(e++,this.hasMaxLevel&&i===this.maxExp)break}return e}getRequiredExpToNextLevel(t,e){return void 0===t&&(t=this.level),void 0===e&&(e=this.exp),this.getExp(t+1)-e}checkLevel(t,e){return e>=this.getExp(t)&&e=0;n--)s=IO(t[n],e,i);else for(var n=0,a=t.length;ns?1:it)return this;for(var e=this.commands;;){var i=e[this.index],s=i[1];if(Nm(s)||(s=Ac(FO,i,1)),IO(s,this.scope),this.emit("runcommand",s,this.scope),this.index>=e.length-1)return this.nextTime=0,this.complete(),this;if(this.index++,this.nextTime=this.getNextDt(this.nextTime),this.nextTime>t)return this}}complete(){this.clock.stop(),this.state=2,this.emit("complete",this.parent,this)}getNextDt(t){var e=this.commands[this.index][0];return 1===this.timeUnit&&(e*=1e3),1===this.dtMode&&(e+=t),e}setDtMode(t){return"string"==typeof t&&(t=XO[t]),this.dtMode=t,this}setTimeUnit(t){return"string"==typeof t&&(t=YO[t]),this.timeUnit=t,this}}var FO=[];const YO={ms:0,s:1,sec:1},XO={abs:0,absolute:0,inc:1,increment:1};var WO=function(t,e,i,s,r){var n=(i-e)/(r-s)*this.totalEaseDuration,a=i===r?t+1:t;this.player.append(0,this.setEaseValueDuration,n).append(0,this.easeValueTo,i,s,r).append(0,this.emit,"levelup.start",t,e,i,this).append(n,h).append(0,this.emit,"levelup.end",a,e,i,this),this.player.isPlaying||this.player.start()},VO={setExpTable(t){return this.levelCounter.setTable(t),this},resetExp(t){return this.levelCounter.resetExp(t),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1)),this},getExp(t){return this.levelCounter.getExp(t)},getLevel(t,e){return this.levelCounter.getLevel(t,e)},getRequiredExpToNextLevel(t,e){return this.levelCounter.getRequiredExpToNextLevel(t,e)},gainExp(t){return this.levelCounter.gainExp(t),this},setExp(t){return this.levelCounter.setExp(t),this},setLevel(t){return this.levelCounter.setLevel(t),this}};const GO=Phaser.Utils.Objects.GetValue;class HO extends LO{constructor(t,e){super(t,e),this.type="rexExpBar",this.setTotalEaseDuration(GO(e,"easeDuration",1e3)),this.levelCounter=new BO(GO(e,"levelCounter")),this.player=new zO(this,{scope:this,dtMode:1}),this.levelCounter.on("levelup",WO,this),this.player.on("complete",(function(){this.player.clear(),this.emit("levelup.complete",this.level,this)}),this),this.setValue(this.exp,this.getExp(this.level),this.getExp(this.level+1))}destroy(t){this.scene&&!this.ignoreDestroy&&(this.levelCounter.destroy(),this.levelCounter=void 0,this.player.destroy(),this.player=void 0,super.destroy(t))}get exp(){return this.levelCounter.exp}set exp(t){this.levelCounter.exp=t}get level(){return this.levelCounter.level}set level(t){this.levelCounter.level=t}get requiredExp(){return this.levelCounter.requiredExp}setTotalEaseDuration(t){return this.totalEaseDuration=t,this}}Object.assign(HO.prototype,VO),t.register("expBar",(function(t){var e=new HO(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ExpBar",HO);const UO=Vw.prototype.add,NO=Vw.prototype.addSpace;var $O=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)&&NO.call(this),UO.call(this,t,{proportion:i,expand:!0});var s=!this.buttonsExpand&&"center"===this.buttonsAlign;s&&NO.call(this),this.hasTailSpace=s}else UO.call(this,t,{proportion:i,expand:!0}),this.hasTailSpace=!1;else if(this.hasTailSpace){var r=this.sizerChildren.length-1;UO.call(this,t,{index:r,proportion:i,expand:!0})}else UO.call(this,t,{proportion:i,expand:!0});return e&&this.buttonGroup.add(t),this},KO={addButton(t){if(Nm(t))for(var e=t,i=0,s=e.length;i=0;i--)ZO.call(this,e[i],t);return this}},tM=function(t,e,i){if(t){var s=this.setValueCallback,r=this.setValueCallbackScope;s&&(r?s.call(r,t,e,i):s(t,e,i)),this.fireEvent("button.statechange",t,e,i)}},eM=function(t){var e=this;t._selected=void 0,Object.defineProperty(t,"selected",{get:function(){return t._selected},set:function(i){if(t._selected!==i){var s=t._selected;t._selected=i,tM.call(e,t,i,s)}},enumerable:!0,configurable:!0}),t.selected=!1},iM={add(t){return this.buttons.push(t),t._click||(t._click=new uu(t,this.clickConfig),t._click.on("click",(function(t,e,i,s){this.fireEvent("button.click",e,i,s)}),this).on("enable",(function(t,e){this.fireEvent("button.enable",e)}),this).on("disable",(function(t,e){this.fireEvent("button.disable",e)}),this).on("over",(function(t,e,i,s){this.fireEvent("button.over",e,i,s)}),this).on("out",(function(t,e,i,s){this.fireEvent("button.out",e,i,s)}),this).on("down",(function(t,e,i,s){this.fireEvent("button.down",e,i,s)}),this).on("up",(function(t,e,i,s){this.fireEvent("button.up",e,i,s)}),this),t.isRexContainerLite&&t.sendChildToBack(t)),this.buttonsType&&(void 0===t.name&&console.error(`${this.parent.constructor.name}: Option button miss value`),eM.call(this,t)),this},addMultiple(t){for(var e=0,i=t.length;e0},setButtonEnable(t,e){var i=this.buttons;if(void 0===t||"boolean"==typeof t){e=t;for(var s=0,r=i.length;s=0;i--)yM.call(this,e[i],t);return this}};const xM=Phaser.Utils.Objects.GetValue;class CM extends mP{constructor(t,e){void 0===e&&(e={});var i=xM(e,"row",0),s=xM(e,"column",e.col||0),r=xM(e,"createCellContainerCallback"),n=xM(e,"buttons",void 0),a=xM(e,"expand",!0),o=a?1:0;if(r&&(e.createCellContainerCallback=void 0),void 0!==n){i=Math.max(i,n.length);for(var h=0,l=n.length;hr&&kM.addNewLine(this)}else for(n=0,a=t.length;n=0;i--)OM.call(this,e[i],t);return this}};const EM=Phaser.Utils.Objects.GetValue;class _M extends IP{constructor(t,e){void 0===e&&(e={});var i=e.space;"number"==typeof i&&(e.space={item:i,line:i}),super(t,e),this.type="rexFixWidthButtons",this.buttonGroup=new lM({parent:this,eventEmitter:EM(e,"eventEmitter",this),groupName:EM(e,"groupName",void 0),clickConfig:EM(e,"click",void 0)}).setButtonsType(e);var s=EM(e,"background",void 0),r=EM(e,"buttons",void 0);this.buttonsAlign=EM(e,"align",void 0),s&&this.addBackground(s),r&&this.addButtons(r),this.addChildrenMap("background",s),this.addChildrenMap("buttons",this.buttonGroup.buttons)}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.buttonGroup.destroy(),this.buttonGroup=void 0)}get buttons(){return this.buttonGroup.buttons}get groupName(){return this.buttonGroup.groupName}set groupName(t){this.buttonGroup.groupName=t}get eventEmitter(){return this.buttonGroup.eventEmitter}}Object.assign(_M.prototype,SM,MM,hM,cM),t.register("fixWidthButtons",(function(t){var e=new _M(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FixWidthButtons",_M);var RM={setAccept(t){return this.childrenMap.fileChooser.setAccept(t),this},setMultiple(t){return this.childrenMap.fileChooser.setMultiple(t),this},loadFile(t,e,i,s,r){return this.childrenMap.fileChooser.loadFile(t,e,i,s,r),this},loadFilePromise(t,e,i,s){return this.childrenMap.fileChooser.loadFilePromise(t,e,i,s)}};const LM=Phaser.Utils.Objects.GetValue;class BM extends cS{constructor(t,e){super(t,e),this.type="rexFileSelectorButton";var i=new uw(t);t.add.existing(i),this.addBackground(i),this.addChildrenMap("fileChooser",i),this.setAccept(LM(e,"accept","")),this.setMultiple(LM(e,"multiple",!1)),i.on("change",(function(t){var e=t.files;0!==e.length&&(e=Array.from(e),this.emit("select",e,this))}),this)}get files(){return this.childrenMap.fileChooser.files}}Object.assign(BM.prototype,RM),t.register("fileSelectorButton",(function(t){var e=new BM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.FileSelectorButton",BM);var IM={getChoice(t){var e=this.childrenMap.choicesSizer;return e?e.getButton(t):void 0},getAction(t){return this.childrenMap.actionsSizer.getButton(t)},getToolbar(t){return this.childrenMap.toolbarSizer.getButton(t)},getLeftToolbar(t){return this.childrenMap.leftToolbarSizer.getButton(t)},setChoiceEnable(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonEnable(t,e),this},setActionEnable(t,e){return this.childrenMap.actionsSizer.setButtonEnable(t,e),this},setToolbarEnable(t,e){return this.childrenMap.toolbarSizer.setButtonEnable(t,e),this},setLeftToolbarEnable(t,e){return this.childrenMap.leftToolbarSizer.setButtonEnable(t,e),this},toggleChoiceEnable(t){var e=this.childrenMap.choicesSizer;return e&&e.toggleButtonEnable(t),this},toggleActionEnable(t){return this.childrenMap.actionsSizer.toggleButtonEnable(t),this},toggleToolbarEnable(t){return this.childrenMap.toolbarSizer.toggleButtonEnable(t),this},toggleLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.toggleButtonEnable(t),this},getChoiceEnable(t){var e=this.childrenMap.choicesSizer;return!!e&&e.getButtonEnable(t)},getActionEnable(t){return this.childrenMap.actionsSizer.getButtonEnable(t)},getToolbarEnable(t){return this.childrenMap.toolbarSizer.getButtonEnable(t)},getLeftToolbarEnable(t){return this.childrenMap.leftToolbarSizer.getButtonEnable(t)},emitChoiceClick(t){var e=this.childrenMap.choicesSizer;return e&&e.emitButtonClick(t),this},emitActionClick(t){return this.childrenMap.actionsSizer.emitButtonClick(t),this},emitToolbarClick(t){return this.childrenMap.toolbarSizer.emitButtonClick(t),this},emitLeftToolbarClick(t){return this.childrenMap.leftToolbarSizer.emitButtonClick(t),this},showChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.showButton(t),this},showAction(t){return this.childrenMap.actionsSizer.showButton(t),this},showToolbar(t){return this.childrenMap.toolbarSizer.showButton(t),this},showLeftToolbar(t){return this.childrenMap.leftToolbarSizer.showButton(t),this},hideChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.hideButton(t),this},hideAction(t){return this.childrenMap.actionsSizer.hideButton(t),this},hideToolbar(t){return this.childrenMap.toolbarSizer.hideButton(t),this},hideLeftToolbar(t){return this.childrenMap.leftToolbarSizer.hideButton(t),this},addChoice(t){var e=this.childrenMap.choicesSizer;return e&&e.addButton(t),this},addAction(t){return this.childrenMap.actionsSizer.addButton(t),this},addToolbar(t){return this.childrenMap.toolbarSizer.addButton(t),this},addLeftToolbar(t){return this.childrenMap.leftToolbarSizer.addButton(t),this},removeChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.removeButton(t,e),this},removeAction(t,e){return this.childrenMap.actionsSizer.removeButton(t,e),this},removeToolbar(t,e){return this.childrenMap.toolbarSizer.removeButton(t,e),this},removeLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.removeButton(t,e),this},clearChoices(t){var e=this.childrenMap.choicesSizer;return e&&e.clearButtons(t),this},clearActions(t){return this.childrenMap.actionsSizer.clearButtons(t),this},clearToolbar(t){return this.childrenMap.toolbarSizer.clearButtons(t),this},clearLeftToolbar(t){return this.childrenMap.leftToolbarSizer.clearButtons(t),this},forEachChoice(t,e){var i=this.childrenMap.choicesSizer;return i&&i.forEachButtton(t,e),this},forEachAction(t,e){return this.childrenMap.actionsSizer.forEachButtton(t,e),this},forEachToolbar(t,e){return this.childrenMap.toolbarSizer.forEachButtton(t,e),this},forEachLeftToolbar(t,e){return this.childrenMap.leftToolbarSizer.forEachButtton(t,e),this},setAllButtonsEnable(t){return void 0===t&&(t=!0),this.childrenMap.toolbarSizer&&this.setToolbarEnable(t),this.childrenMap.leftToolbarSizer&&this.setLeftToolbarEnable(t),this.childrenMap.actionsSizer&&this.setActionEnable(t),this.childrenMap.choicesSizer&&this.setChoiceEnable(t),this},getChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t?t.getAllButtonsState():{}},getChoicesButtonState(t){var e=this.childrenMap.choicesSizer;return void 0===t?e?e.getAllButtonsState():{}:!!e&&e.getButtonState(t)},setChoicesButtonState(t,e){var i=this.childrenMap.choicesSizer;return i&&i.setButtonState(t,e),this},clearChoicesButtonStates(){var t=this.childrenMap.choicesSizer;return t&&t.clearAllButtonsState(),this},getChoicesSelectedButtonName(){var t=this.childrenMap.choicesSizer;return t?t.getSelectedButtonName():""},setChoicesSelectedButtonName(t){var e=this.childrenMap.choicesSizer;return e&&e.setSelectedButtonName(t),this},hasAnyChoice(){var t=this.childrenMap.choicesSizer;return!!t&&t.hasAnyButton()},hasAnyAction(){var t=this.childrenMap.actionsSizer;return!!t&&t.hasAnyButton()},hasAnyToolbar(){var t=this.childrenMap.toolbarSizer;return!!t&&t.hasAnyButton()},hasAnyLeftToolbar(){var t=this.childrenMap.leftToolbarSizer;return!!t&&t.hasAnyButton()}},DM={onCreateModalBehavior(t){t.on("button.click",(function(e,i,s,r,n){var a=!1;switch(i){case"actions":a=!0;break;case"choices":t.hasAnyAction()||(a=!0)}if(a){var o={index:s,text:e.text,button:e,dialog:t};switch(t.buttonsType){case"radio":o.value=t.getChoicesSelectedButtonName();break;case"checkboxes":o.value=t.getChoicesButtonStates();break;default:o.value=void 0}t.modalClose(o)}}))},modal(t,e){return t&&!1===t.defaultBehavior?this.onCreateModalBehavior=!1:delete this.onCreateModalBehavior,Xm.modal.call(this,t,e),this}},jM={};Object.assign(jM,IM,DM);const AM=Phaser.Utils.Objects.GetValue;class zM extends Vw{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexDialog",this.eventEmitter=AM(e,"eventEmitter",this);var i,s,r,n,a=AM(e,"background",void 0),o=AM(e,"title",void 0),h=AM(e,"toolbar",void 0),l=AM(e,"toolbarBackground",void 0),d=AM(e,"leftToolbar",void 0),c=AM(e,"leftToolbarBackground",void 0),u=AM(e,"content",void 0),p=AM(e,"description",void 0),g=AM(e,"choices",void 0),v=AM(e,"choicesBackground",void 0),f=AM(e,"actions",void 0),m=AM(e,"actionsBackground",void 0),y=AM(e,"click",void 0);if(a&&this.addBackground(a),h&&(r=new pM(t,{groupName:"toolbar",background:l,buttons:h,orientation:0,space:{item:AM(e,"space.toolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(r)),d&&(n=new pM(t,{groupName:"leftToolbar",background:c,buttons:d,orientation:0,space:{item:AM(e,"space.leftToolbarItem",0)},click:y,eventEmitter:this.eventEmitter}),t.add.existing(n)),o||h||d){var b,x=!!o&&AM(e,"expand.title",!0),C=AM(e,"align.title","center"),k=!(o&&!x&&"center"===C||!o&&(h||d));b=k?new Vw(t,{orientation:0}):new ox(t),t.add.existing(b);var w=!!k||{height:!0};if(n&&b.add(n,{align:"left",expand:w}),o){k&&!x&&"right"===C&&b.addSpace();var S={left:AM(e,"space.titleLeft",0),right:AM(e,"space.titleRight",0)},P=x?1:0;b.add(o,{align:C,proportion:P,expand:w,padding:S}),k&&!x&&"left"===C&&b.addSpace()}r&&(k&&!o&&b.addSpace(),b.add(r,{align:"right",expand:w})),(u||p||g||f)&&(S={bottom:AM(e,"space.title",0),top:AM(e,"space.titleTop",0)}),P=AM(e,"proportion.title",0),this.add(b,{padding:S,proportion:P,expand:!0})}if(u){var T=AM(e,"align.content","center"),O=AM(e,"space.content",0),M=(S={left:AM(e,"space.contentLeft",0),right:AM(e,"space.contentRight",0),bottom:p||g||f?O:0},P=AM(e,"proportion.content",0),AM(e,"expand.content",!0));this.add(u,{align:T,padding:S,proportion:P,expand:M})}if(p){T=AM(e,"align.description","center");var E=AM(e,"space.description",0);S={left:AM(e,"space.descriptionLeft",0),right:AM(e,"space.descriptionRight",0),bottom:g||f?E:0},P=AM(e,"proportion.description",0),M=AM(e,"expand.description",!0),this.add(p,{align:T,padding:S,proportion:P,expand:M})}if(g){var _=AM(e,"choicesType","").split("-"),R=FM(_,"wrap")?_M:FM(_,"grid")?CM:pM,L=FM(_,"radio")?"radio":FM(_,"checkboxes")?"checkboxes":void 0,B={left:AM(e,"space.choicesBackgroundLeft",0),right:AM(e,"space.choicesBackgroundRight",0),top:AM(e,"space.choicesBackgroundTop",0),bottom:AM(e,"space.choicesBackgroundBottom",0)},I=AM(e,"space.choice",0);R===pM?B.item=I:R===_M?(B.item=I,B.line=AM(e,"space.choiceLine",I)):(B.column=AM(e,"space.choiceColumn",I),B.row=AM(e,"space.choiceRow",I));var D={width:AM(e,"choicesWidth",void 0),height:AM(e,"choicesHeight",void 0),groupName:"choices",buttonsType:L,background:v,buttons:g,space:B,click:y,eventEmitter:this.eventEmitter,setValueCallback:AM(e,"choicesSetValueCallback",void 0),setValueCallbackScope:AM(e,"choicesSetValueCallbackScope",void 0)};R===pM&&(D.orientation=FM(_,"x")?0:1),i=new R(t,D),t.add.existing(i);var j=AM(e,"space.choices",0);S={left:AM(e,"space.choicesLeft",0),right:AM(e,"space.choicesRight",0),bottom:f?j:0},T=AM(e,"align.choices","center"),P=AM(e,"proportion.choices",0),M=AM(e,"expand.choices",!0),this.add(i,{align:T,padding:S,proportion:P,expand:M}),this.buttonsType=L}f&&(s=new pM(t,{groupName:"actions",background:m,buttons:f,orientation:0,space:{item:AM(e,"space.action",0)},expand:AM(e,"expand.actions",!1),align:AM(e,"align.actions","center"),click:y,eventEmitter:this.eventEmitter}),t.add.existing(s),S={left:AM(e,"space.actionsLeft",0),right:AM(e,"space.actionsRight",0),bottom:AM(e,"space.actionsBottom",0)},P=AM(e,"proportion.action",0),this.add(s,{align:"center",padding:S,proportion:P,expand:!0})),XM(this,"click"),XM(this,"over"),XM(this,"out"),XM(this,"enable"),XM(this,"disable"),this.addChildrenMap("background",a),this.addChildrenMap("title",o),this.addChildrenMap("toolbar",h),this.addChildrenMap("leftToolbar",d),this.addChildrenMap("content",u),this.addChildrenMap("description",p),this.addChildrenMap("choices",i?i.buttons:void 0),this.addChildrenMap("actions",s?s.buttons:void 0),this.addChildrenMap("choicesSizer",i),this.addChildrenMap("actionsSizer",s),this.addChildrenMap("toolbarSizer",r),this.addChildrenMap("leftToolbarSizer",n)}}var FM=function(t,e){return-1!==t.indexOf(e)},YM={actions:"action",choices:"choice",toolbar:"toolbar",leftToolbar:"leftToolbar"},XM=function(t,e){t.on(`button.${e}`,(function(i,s,r,n,a){YM.hasOwnProperty(s)&&t.emit(`${YM[s]}.${e}`,i,r,n,a)}))};Object.assign(zM.prototype,jM),t.register("dialog",(function(t){var e=new zM(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Dialog",zM);var WM=function(t,e,i){var s=new vO(t,e,i);return t.add.existing(s),s},VM=function(t){var e=this.childrenMap.title;null===(t=t.title)?e.hide():(e.show(),e.resetDisplayContent(t))},GM=function(t){var e=this.childrenMap.content;if(null===(t=t.content))e.hide();else if(e.show(),e.resetDisplayContent)e.resetDisplayContent(t);else{var i=t||"";e.setText(i)}},HM=function(t){var e=this.childrenMap.actions;if(e){var i=t.buttons;if(i){for(var s=this.scene,r=this.defaultActionConfig,n=this.defaultActionButtonCreator,a=0,o=i.length;a=0&&t=0&&i0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var a=i;(s=(i+=1)>=0&&i=this.colCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;ri,n=tthis.leftTableOX,n=tt?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=QE(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;sthis.topChildOY}childOYExeceedBottom(t){return void 0===t&&(t=this.childOY),tthis.leftChildOX}childOXExeceedRight(t){return void 0===t&&(t=this.childOX),tthis.childHeight?t=0:s?t=e:r&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),s&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=s,r&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=r}get childOX(){return this._childOX}set childOX(t){var e=this.leftChildOX,i=this.rightChildOX,s=this.childOXExceedLeft(t),r=this.childOXExeceedRight(t);this.clampChildOX&&(this.childVisibleWidth>this.childWidth?t=0:s?t=e:r&&(t=i)),this._childOX!==t&&(this._childOX=t,this.resetChildPosition()),s&&(this.execeedLeftState||this.emit("execeedleft",this,t,e)),this.execeedLeftState=s,r&&(this.execeedRightState||this.emit("execeedright",this,t,i)),this.execeedRightState=r}setChildOY(t){return this.childOY=t,this}setChildOX(t){return this.childOX=t,this}set t(t){this.childOY=-this.visibleHeight*t}get t(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}set s(t){this.childOX=-this.visibleWidth*t}get s(){var t=this.visibleWidth;return 0===t?0:this.childOX/-t}setChildOYByPercentage(t){return this.t=t,this}setChildOXByPercentage(t){return this.s=t,this}}Object.assign(U_.prototype,W_);const N_=["top","bottom","centerY","center"],$_=["left","right","centerX","center"];var K_=function(t,e,i){var s,r="Y"===(e=e.toUpperCase()),n=this.childrenMap.child;if(r){if(i)for(var a=0,o=N_.length;a=0?0:Math.abs(l)<=Math.abs(d)?l:d}}else{if(i)for(a=0,o=$_.length;a=0?0:Math.abs(c)<=Math.abs(u)?c:u}}switch(this.scrollMode){case 0:case 1:this.childOY+=s;break;default:this[`childO${e}`]+=s}};const J_=Phaser.Utils.Objects.GetValue;class q_ extends VT{constructor(t,e){void 0===e&&(e={});var i=YP(e),s=J_(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=i,s.clampChildOY=J_(e,"clampChildOY",!1),s.clampChildOX=J_(e,"clampChildOX",!1);var r,n,a=new U_(t,s);switch(t.add.existing(a),i){case 0:r=J_(e,"expand.panel",!0),n=!0;break;case 1:r=!0,n=J_(e,"expand.panel",!0);break;default:r=!0,n=!0}e.type="rexScrollablePanel",e.child={gameObject:a,expandWidth:r,expandHeight:n,align:J_(e,"align.panel","center")};var o=J_(e,"space",void 0);o&&(o.child=J_(o,"panel",0)),super(t,e),this.addChildrenMap("panel",a.child),this.addChildrenMap("panelLayer",a.maskLayer),this.addChildrenMap("mask",a.maskGameObject),this.addChildrenMap("scrollableBlock",a)}setChildrenInteractive(t){return void 0===t&&(t={}),t.hasOwnProperty("eventEmitter")||(t.eventEmitter=this),t.hasOwnProperty("targets")||(t.targets=[this.childrenMap.panel]),Fb(this.childrenMap.child,t),this}}var Z_={scrollToChild:function(t,e){if(!this.hasChild(t))return this;switch(this.scrollMode){case 0:K_.call(this,t,"y",e);break;case 1:K_.call(this,t,"x",e);break;default:K_.call(this,t,"y",e),K_.call(this,t,"x",e)}return this}};Object.assign(q_.prototype,Z_);const Q_=Phaser.Utils.Objects.GetValue;var tR=function(){var t,e=this.scene,i=this.listCreateBackgroundCallback;i&&(t=i.call(this,e),e.add.existing(t));var s=[],r=this.listCreateButtonCallback;if(r)for(var n=this.options,a=0,o=n.length;a0||this.listMaxHeight>0)){if(s=eR(e,u,this.listWrapEnable),this.listMaxHeight>0&&(s.layout(),s.height<=this.listMaxHeight&&(d=s)),!d){0===c&&(c=this.listMaxHeight);var p=iR(e,this.listCreateSliderTrackCallback),g=iR(e,this.listCreateSliderThumbCallback);d=new q_(e,{height:c,scrollMode:0,panel:{child:s,mask:{padding:1}},slider:{track:p,thumb:g,adaptThumbSize:this.listSliderAdaptThumbSizeEnable},scrollDetectionMode:1,scroller:this.listScrollerConfig,mouseWheelScroller:this.listMouseWheelScrollerConfig,space:{panel:Q_(this.listSpace,"panel",0)}}),e.add.existing(d)}}else u.height=c,s=eR(e,u,this.listWrapEnable),d=s;return t&&d.addBackground(t,"background"),this.listDraggable&&d.setDraggable(!0),d!==s&&s.on("button.over",(function(t,e,i,s){d.emit("button.over",t,e,i,s)})).on("button.out",(function(t,e,i,s){d.emit("button.out",t,e,i,s)})).on("button.click",(function(t,e,i,s){d.emit("button.click",t,e,i,s)})),d},eR=function(t,e,i){var s;return i?(e.orientation="x",s=new _M(t,e)):(e.orientation="y",s=new pM(t,e)),t.add.existing(s),s},iR=function(t,e,i){var s;return e&&(s=e.call(i,t),t.add.existing(s)),s};const sR=Phaser.Utils.Objects.GetValue;var rR=function(t,e){var i=sR(e,"expandDirection",void 0);"string"==typeof i&&(i=nR[i]);var s,r,n,a,o,h,l,d=(n="alignTargetX",Ed(s=e,r="alignTarget")?J(s,r):n&&Ed(s,n)?J(s,n):a&&Ed(s,a)?J(s,a):o),c=sR(e,"alignTargetY",d),u=sR(e,"alignOffsetX",0),p=sR(e,"alignOffsetY",0),g=sR(e,"alignSide","").includes("right"),v=sR(e,"bounds"),f=0===i,m=!(f||1===i),y=g?1:0,b=f||m?0:1;t.setOrigin(y,b),h=g?d.getTopRight().x:d.getTopLeft().x,l=c.getBottomLeft().y,t.setPosition(h+u,l+p);var x=v;x||(x=la(t.scene)),m&&t.getBottomLeft().y>x.bottom&&(l=c.getTopLeft().y,t.setOrigin(0,1).setPosition(h+u,l+p))};const nR={down:0,up:1},aR=Phaser.Utils.Objects.GetValue;class oR extends wm{constructor(t,e){void 0===e&&(e={}),null==e.transitIn&&(e.transitIn=function(t,e){xf(t,e,"y","Cubic")}),null==e.transitOut&&(e.transitOut=function(t,e){!function(t,e,i,s,r){void 0===s&&(s="Linear");var n={mode:0};switch(i){case 0:case"x":n.end={x:0};break;case 1:case"y":n.end={y:0};break;default:n.end=0}n.duration=e,n.ease=s,void 0===r?r=new yf(t,n):r.resetFromJSON(n),r.restart()}(t,e,"y","Linear")}),e.manualClose=!0,e.clickOutsideClose=!0,e.destroy=!0,super(t,e),rR(t,e),t.isRexSizer&&t.layout();var i=aR(e,"touchOutsideClose",!1),s=aR(e,"anyTouchClose",!1);s&&(i=!1),s?this.once("open",this.anyTouchClose,this):i&&this.once("open",this.touchOutsideClose,this),this.requestOpen()}shutdown(t){this.isShutdown||(this.scene.input.off("pointerup",this.touchCloseCallback,this),super.shutdown(t))}touchOutsideClose(){return this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}anyTouchClose(){return this.scene.input.once("pointerup",this.touchCloseCallback,this),this}touchCloseCallback(t){this.clickOutsideTest&&Im(this.parent,t.worldX,t.worldY)||this.requestClose()}onOpen(){this.emit("open",this.parent,this),super.onOpen()}onClose(){this.emit("close",this.parent,this),super.onClose()}}var hR={focusNextButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;return t=void 0===e?0:(e+1)%this.listPanel.getButtons().length,this.emitButtonOver(t),this},focusPrevButton(){if(!this.isOpened)return this;var t,e=this.currentOverIndex;if(void 0===e)t=0;else{var i=this.listPanel.getButtons().length;t=(e-1+i)%i}return this.emitButtonOver(t),this}},lR={openListPanel:function(){if(this.listPanel)return this;if(0===this.options.length)return this;var t,e=tR.call(this);e.on("button.over",(function(t,i,s,r){this.currentOverIndex=i,this.listOnButtonOver&&this.listOnButtonOver.call(this,t,i,s,r),this.emit("button.over",this,e,t,i,s,r)}),this).on("button.out",(function(t,i,s,r){this.currentOverIndex===i&&(this.currentOverIndex=void 0),this.listOnButtonOut&&this.listOnButtonOut.call(this,t,i,s,r),this.emit("button.out",this,e,t,i,s,r)}),this),t=this.listAlignMode&&"label"!==this.listAlignMode?this.getElement(this.listAlignMode):this;var i=new oR(e,{duration:{in:this.listEaseInDuration,out:this.listEaseOutDuration},transitIn:this.listTransitInCallback,transitOut:this.listTransitOutCallback,expandDirection:this.listExpandDirection,alignTargetX:t,alignTargetY:this,alignSide:this.listAlignSide,bounds:this.listBounds}).on("open",(function(){e.on("button.click",(function(t,i,s,r){this.listOnButtonClick&&this.listOnButtonClick.call(this,t,i,s,r),this.emit("button.click",this,e,t,i,s,r),this.dropDownBehavior.requestClose()}),this),this.emit("list.open",this,e)}),this).on("close",(function(){this.listPanel=void 0,this.dropDownBehavior=void 0,this.emit("list.close",this)}),this);return e.onClickOutside((function(){i.requestClose()})),this.listPanel=e,this.dropDownBehavior=i,this.pin(e),this},closeListPanel:function(){return this.dropDownBehavior?(this.dropDownBehavior.requestClose(),this.currentOverIndex=void 0,this):this},toggleListPanel:function(){return this.listPanel?this.closeListPanel():this.openListPanel(),this},emitButtonClick:function(t){if(void 0===t&&(t=this.currentOverIndex),void 0===t)return this;var e=this.listPanel,i=e?e.getButton(t):this.options[t];return this.listOnButtonClick&&this.listOnButtonClick.call(this,i,t),this.emit("button.click",this,e,i,t),this},emitButtonOver:function(t){var e=this.listPanel;return e?(e.emitButtonOver(t),this):this}};Object.assign(lR,Y_,hR);const dR=Phaser.Utils.Objects.GetValue;class cR extends cS{constructor(t,e){super(t,e),this.type="rexDropDownList",this.timer=void 0,this.listPanel=void 0,this.currentOverIndex=void 0,this.setOptions(dR(e,"options"));var i=dR(e,"list");this.setWrapEnable(dR(i,"wrap",!1)),this.setCreateButtonCallback(dR(i,"createButtonCallback")),this.setCreateListBackgroundCallback(dR(i,"createBackgroundCallback")),this.setCreateListSliderTrackCallback(dR(i,"createTrackCallback")),this.setCreateListSliderThumbCallback(dR(i,"createThumbCallback")),this.setListSliderAdaptThumbSizeEnable(dR(i,"sliderAdaptThumbSize",!1)),this.setListScrollerConfig(dR(i,"scroller")),this.setListMouseWheelScrollerConfig(dR(i,"mouseWheelScroller")),this.setButtonClickCallback(dR(i,"onButtonClick")),this.setButtonOverCallback(dR(i,"onButtonOver")),this.setButtonOutCallback(dR(i,"onButtonOut")),this.setListExpandDirection(dR(i,"expandDirection")),this.setListEaseInDuration(dR(i,"easeIn",500)),this.setListEaseOutDuration(dR(i,"easeOut",100)),this.setListTransitInCallback(dR(i,"transitIn")),this.settListTransitOutCallback(dR(i,"transitOut")),this.setListMaxHeight(dR(i,"maxHeight",0)),this.setListSize(dR(i,"width"),dR(i,"height",0)),this.setListAlignmentMode(dR(i,"alignParent","text")),this.setListAlignmentSide(dR(i,"alignSide","")),this.setListBounds(dR(i,"bounds")),this.setListSpace(dR(i,"space")),this.setListDraggable(dR(i,"draggable",!1)),this.setValueChangeCallback(dR(e,"setValueCallback"),dR(e,"setValueCallbackScope")),this.setValue(dR(e,"value")),this.onClick(this.toggleListPanel,this)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.listPanel&&(this.listPanel.destroy(t),this.listPanel=void 0),super.destroy(t))}get isOpened(){return!!this.listPanel}setOptions(t){return void 0===t&&(t=[]),this.options=t,this}setValueChangeCallback(t,e){return this.valueChangeCallback=t,this.valueChangeCallbackScope=e,this}setValue(t){return this.value=t,this}get value(){return this._value}set value(t){if(this._value!==t){var e=this._value;this._value=t;var i=this.valueChangeCallback,s=this.valueChangeCallbackScope;i&&(s?i.call(s,this,t,e):i(this,t,e)),this.emit("valuechange",this,t,e)}}}Object.assign(cR.prototype,lR),t.register("dropDownList",(function(t){var e=new cR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.DropDownList",cR);var uR=function(t,e,s){void 0===s&&(s={});var r=(e=e?i(e):{}).label||e.button,n=e.button||e.label;delete e.label,delete e.button;var a=s.label||s.button||s,o=s.button||s.label||s,h=gO(t,r,a);h.list=e.list||{},h.list.createButtonCallback=function(t,e){var i=WM(t,n,o).resetDisplayContent(e);return e.hasOwnProperty("value")&&(i.value=e.value),i};var l=e.track;l&&(h.list.createTrackCallback=function(t){return zP(t,l)},delete e.track);var d=e.thumb;return d&&(h.list.createThumbCallback=function(t){return zP(t,d)},delete e.thumb),h.list.onButtonOver=function(t,e,i,s){t.setHoverState&&t.setHoverState(!0)},h.list.onButtonOut=function(t,e,i,s){t.setHoverState&&t.setHoverState(!1)},h};class pR extends cR{constructor(t,e,i){super(t,e=uR(t,e,i)),this.type="rexSimpleDropDownList"}setOptions(t){void 0===t&&(t=[]);for(var e=0,i=t.length;e0?Math.ceil(s/this.pageLinesCount):1;for(var r=0;r0?t+i:this.totalLinesCount}var s;switch(e>this.totalLinesCount&&(e=this.totalLinesCount),this.textObjectType){case 0:case 2:s=this.lines.slice(t,e).join("\n");break;case 1:var r=this.lines.getLineStartIndex(t),n=this.lines.getLineEndIndex(e-1);((s=this.lines.getSliceTagText(r,n,!0)).match(/\n/g)||[]).length>e-t-1&&(s=s.substring(0,s.length-1))}return s}};Object.assign(yR,gR,fR,mR);const bR=Phaser.Utils.Objects.GetValue;Phaser.Math.Clamp;class xR extends Ia{constructor(t,e){super(t,{eventEmitter:!1}),this.textObjectType=Zw(this.parent),this.pageStartIndexes=[],this.lines=HT(this.parent,""),this.sections=[],this.resetFromJSON(e)}resetFromJSON(t){this.setMaxLines(bR(t,"maxLines",void 0)),this.setPageBreak(bR(t,"pageBreak","\f\n")),this.setText(bR(t,"text","")),this.startLineIndex=bR(t,"start",-1),this.endLineIndex=bR(t,"end",void 0);var e=bR(t,"page");return void 0===e?this.resetIndex():this.setPageIndex(e),this}toJSON(){return{maxLines:this.maxLines,text:this.content,start:this.startLineIndex,end:this.endLineIndex,page:this.pageIndex,pageBreak:this.pageBreak}}shutdown(t){if(!this.isShutdown){switch(this.textObjectType){case 0:case 2:this.lines.length=0;break;case 1:this.lines.destroy()}this.pageStartIndexes.length=0,this.sections.length=0,this.lines=void 0,this.pageStartIndexes=void 0,this.sections=void 0,super.shutdown(t)}}setMaxLines(t){return this.maxLines=t,this}setPageBreak(t){return this.pageBreak=t,this}get pageCount(){return this.pageStartIndexes.length}get lastPageIndex(){return this.pageCount-1}get isFirstPage(){return this.pageIndex<=0}get isLastPage(){return this.pageIndex>=this.pageCount-1}get totalLinesCount(){return this.lines?this.lines.length:0}get pageLinesCount(){if(void 0!==this.maxLines)return this.maxLines;var t;switch(this.textObjectType){case 0:case 1:var e=this.parent.style.maxLines;t=e>0?e:Math.floor(function(t){var e,i,s;switch(Zw(t)){case 0:case 1:e=t.height-t.padding.top-t.padding.bottom,i=t.lineSpacing,s=t.style.metrics.fontSize+t.style.strokeThickness;break;case 2:e=t.height,i=0;var r=t.fontSize/t.fontData.size;s=t.fontData.lineHeight*r}return(e-i)/(s+i)}(this.parent));break;case 2:t=this.totalLinesCount}return t}get isFirstLine(){return this.startLineIndex<=0}get isLastLine(){return this.endLineIndex===this.totalLinesCount}get content(){return this.sections.join(this.pageBreak)}}Object.assign(xR.prototype,yR);var CR={setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?KT(this.parent,t):this.parent.setText(t)},appendText(t){var e=this.text.concat(ze(t));return this.isTyping?this.setTypingContent(e):this.start(e,void 0,this.textLength),this}},kR=function(t,e){return t.getPlainText&&(e=t.getPlainText(e)),e},wR=function(t,e){for(var i=void 0,s=0;s0?SR(n,t,a=(o=i)-d,o):"";var c,u=e-d;u>0?(o=(a=0)+u,this.insertIndex=o,c=SR(n,t,a,o)):(c="",this.insertIndex=0),r=c+l}return this.insertChar=r.charAt(this.insertIndex-1),r},TR={start:function(t,e,i,s){return void 0!==t&&this.setTypingContent(t),void 0!==e&&(this.speed=e),void 0===i&&(i=0),this.typingIndex=i+1,0===this.speed?this.stop(!0):(this.setText(""),this.startTimer(s)),this},startFromLine:function(t,e,i,s,r){var n;if(e>0){void 0===s&&(s=0);var a=kR(this.parent,t);n=wR(a,e)+s}return this.start(t,i,n,r)},stop:function(t){if(this.getTimer()&&this.freeTimer(),t){for(;!this.isLastChar;)PR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode),this.emit("typechar",this.insertChar),this.typingIndex++;this.setText(this.text),this.emit("type"),this.emit("complete",this,this.parent)}return this},pause:function(){var t=this.getTimer();return t&&(t.paused=!0),this},resumeTyping:function(){var t=this.getTimer();return t&&(t.paused=!1),this}};Object.assign(TR,CR);const OR=Phaser.Utils.Objects.GetFastValue,MR=Phaser.Utils.Objects.GetValue;class ER extends Ia{constructor(t,e){super(t,e),this.timer=null,this.resetFromJSON(e)}resetFromJSON(t){this.setTextWrapEnable(MR(t,"wrap",!1)),this.setTypeMode(MR(t,"typeMode",0)),this.setTypingSpeed(MR(t,"speed",333)),this.setTextCallback=OR(t,"setTextCallback",null),this.setTextCallbackScope=OR(t,"setTextCallbackScope",null),this.setTypingContent(OR(t,"text","")),this.typingIndex=OR(t,"typingIndex",0),this.insertIndex=null,this.insertChar=null;var e=OR(t,"elapsed",null);return null!==e&&this.start(void 0,void 0,this.typingIndex,e),this}shutdown(t){this.isShutdown||(this.freeTimer(),super.shutdown(t))}setTypeMode(t){return"string"==typeof t&&(t=_R[t]),this.typeMode=t,this}setTypeSpeed(t){return this.speed=t,this}setTypingSpeed(t){return this.speed=t,this}setTextWrapEnable(t){return void 0===t&&(t=!0),this.textWrapEnable=t,this}set text(t){var e=ze(t);this.textWrapEnable&&(e=function(t,e){switch(Zw(t)){case 0:t.style.syncFont(t.canvas,t.context),e=t.runWordWrap(e);break;case 1:e=t.getText(e,void 0,void 0,!0);break;case 2:e=t.setText(e).getTextBounds().wrappedText}return e}(this.parent,e)),this._text=e}get text(){return this._text}get isTyping(){return null!==this.getTimer()}get isLastChar(){return this.typingIndex===this.textLength}setTypingContent(t){return this.text=t,this.textLength=kR(this.parent,this.text).length,this}onTyping(){var t=PR.call(this,this.text,this.typingIndex,this.textLength,this.typeMode);this.setText(t),this.emit("typechar",this.insertChar),this.emit("type"),this.isLastChar?(this.freeTimer(),this.scene.sys.events.once("preupdate",(function(){this.emit("complete",this,this.parent)}),this)):(this.timer.delay=this.speed,this.typingIndex++)}startTimer(t){var e;return this.timer&&this.freeTimer(),void 0===t?e=0:(this.speed,e=t),this.timer=this.scene.time.addEvent({delay:1e-4,startAt:e,loop:!0,callback:this.onTyping,callbackScope:this}),this}getTimer(){return this.timer}freeTimer(){return this.timer&&(this.timer.remove(),this.timer=null),this}setText(t){this.setTextCallback&&(t=this.setTextCallbackScope?this.setTextCallback.call(this.setTextCallbackScope,t,this.isLastChar,this.insertIndex):this.setTextCallback(t,this.isLastChar,this.insertIndex)),this.textWrapEnable?KT(this.parent,t):this.parent.setText(t)}}const _R={"left-to-right":0,"right-to-left":1,"middle-to-sides":2,"sides-to-middle":3};Object.assign(ER.prototype,TR);const RR=Phaser.Utils.Objects.GetValue,LR={page:0,line:1};class BR extends(function(t,e){return void 0===e&&(e="rexTextBox"),class extends t{constructor(t,i){super(t,i),this.type=e,this.isRunning=!1,this._isPageEnd=!1;var s=this.childrenMap.text,r=RR(i,"expandTextWidth",!1),n=RR(i,"expandTextHeight",!1);if(r||n){var a=Zw(s);switch(a){case 0:case 1:if(s.resize=function(t,e){var i=r?t:0,a=n?e:0;s.setFixedSize(i,a),i>0&&s.setWordWrapWidth(i)},1===a){var o=s.style;0===o.wrapMode&&(o.wrapMode=1)}}r&&(s._minWidth=0),n&&(s._minHeight=0)}this.setTypingMode(RR(i,"typingMode","page")),this.page=new xR(s,RR(i,"page",void 0)),this.typing=new ER(s,RR(i,"typing",i.type)),this.typing.on("complete",this.onTypingComplete,this).on("type",this.onType,this).on("typechar",this.onTypeChar,this),this.textWidthSave=s.width,this.textHeightSave=s.height}setTypingMode(t){return"string"==typeof t&&(t=LR[t]),this.typingMode=t,this}start(t,e){return void 0!==e&&this.setTypingSpeed(e),this.isRunning=!0,this.page.setText(t),this.emit("start"),0===this.typingMode?this.typeNextPage():this.typeNextLine(),this}more(t,e){if(void 0!==e&&this.setTypingSpeed(e),!this.isRunning){if(this.isRunning=!0,this.page.appendText(t),this.emit("start"),0===this.typingMode){this._isPageEnd=!1;var i=this.page.getPage(),s=this.typing.textLength;this.typing.start(i,void 0,s)}return this}this.page.appendText(t),this.typing.appendText(t)}typeNextPage(){if(!this.isRunning)return this;if(this.isLastPage)this.emit("complete");else{this._isPageEnd=!1;var t=this.page.getNextPage();this.typing.start(t)}return this}typeNextLine(){if(!this.isRunning)return this;if(this.isLastLine)this.isRunning=!1,this.emit("pageend"),this.emit("complete");else{var t,e=this.page.getPageOfNextLine();t=this.isFirstLine?0:this.page.pageLinesCount-1,this.typing.startFromLine(e,t)}}pause(){return this.isRunning?(this.isTyping&&(this.typing.pause(),this.emit("pause")),this):this}resume(){return this.isRunning?(this.isTyping||(this.emit("resume"),this.typing.resume()),this):this}stop(t){return this.isRunning?(this.typing.stop(t),this):this}showLastPage(){return this.isRunning?(this.typing.stop(),0===this.typingMode?this.page.showLastPage():this.page.showLastLine(),this.emit("type"),this.onTypingComplete(),this):this}setTypeSpeed(t){return this.typing.setTypingSpeed(t),this}setTypingSpeed(t){return this.typing.setTypingSpeed(t),this}get isTyping(){return this.typing.isTyping}get isPageEnd(){return this._isPageEnd}get isLastPage(){return this.page.isLastPage}get isFirstPage(){return this.page.isFirstPage}get pageCount(){return this.page.pageCount}get pageIndex(){return this.page.pageIndex}get isLastLine(){return this.page.isLastLine}get isFirstLine(){return this.page.isFirstLine}get lineCound(){return this.page.totalLinesCount}get startLineIndex(){return this.page.startLineIndex}get endLineIndex(){return this.page.endLineIndex}get typingSpeed(){return this.typing.speed}onType(){var t=this.childrenMap.text;this.textWidthSave===t.width&&this.textHeightSave===t.height||(this.textWidthSave=t.width,this.textHeightSave=t.height,this.getTopmostSizer().layout()),this.emit("type")}onTypeChar(t){this.emit("typechar",t)}onTypingComplete(){if(0===this.typingMode){this._isPageEnd=!0;var t=this.isLastPage;this.isRunning=!t,this.emit("pageend"),t&&this.emit("complete")}else this.typeNextLine()}}}(CO)){constructor(t,e){void 0===e&&(e={}),e.hasOwnProperty("layoutMode")||(e.layoutMode=1),super(t,e)}}t.register("textBox",(function(t){var e=new BR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.TextBox",BR);class IR extends BR{constructor(t,e,i){super(t,e=wO(t,e,i))}}t.register("simpleTextBox",(function(t){var e=new IR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.SimpleTextBox",IR);const DR=Phaser.Utils.Objects.GetValue;class jR extends Vw{constructor(t,e){super(t,e),this.type="rexNumberBar";var i,s,r,n=DR(e,"background",void 0),a=DR(e,"icon",void 0),o=DR(e,"iconMask",void 0),h=DR(e,"slider",void 0),l=DR(e,"text",void 0),d=DR(e,"space.icon",0),c=DR(e,"space.slider",0);(n&&this.addBackground(n),a&&(0===this.orientation?(h||l)&&(s={right:d}):(h||l)&&(s={bottom:d}),this.add(a,{proportion:0,align:"center",padding:s}),o&&(o=Nw.call(this,a,a,1))),h)&&(h.orientation=this.orientation,h.eventEmitter=this,h.value=null,h.hasOwnProperty("input")||(h.input=-1),i=new pT(t,h),t.add.existing(i),0===this.orientation?l&&(s={right:c}):l&&(s={bottom:c}),r=0===this.orientation?void 0===DR(h,"width",void 0)?1:0:void 0===DR(h,"height",void 0)?1:0,this.add(i,{proportion:r,align:"center",padding:s}));l&&this.add(l),this.addChildrenMap("background",n),this.addChildrenMap("icon",a),this.addChildrenMap("iconMask",o),this.addChildrenMap("slider",i),this.addChildrenMap("text",l);var u=DR(e,"valuechangeCallback",null);if(null!==u){var p=DR(e,"valuechangeCallbackScope",void 0);this.on("valuechange",u,p)}this.setEnable(DR(e,"enable",void 0)),this.setValue(DR(e,"value",0))}get enable(){return!!this.childrenMap.slider&&this.childrenMap.slider.enable}set enable(t){this.childrenMap.slider&&this.childrenMap.slider.setEnable(t)}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}get value(){return this.childrenMap.slider?this.childrenMap.slider.value:0}set value(t){this.childrenMap.slider&&(this.childrenMap.slider.value=t)}setValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.setValue(t,e,i),this}addValue(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.addValue(t,e,i),this}getValue(t,e){return this.childrenMap.slider?this.childrenMap.slider.getValue(t,e):0}easeValueTo(t,e,i){return this.childrenMap.slider&&this.childrenMap.slider.easeValueTo(t,e,i),this}stopEaseValue(){return this.childrenMap.slider&&this.childrenMap.slider.stopEaseValue(),this}setEaseValueDuration(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueDuration(t),this}setEaseValueFunction(t){return this.childrenMap.slider&&this.childrenMap.slider.setEaseValueFunction(t),this}get text(){var t=this.childrenMap.text;return void 0===t?"":t.text?t.text:t.getData("text")}set text(t){var e=this.childrenMap.text;void 0!==e&&(e.setText?e.setText(t):e.setData("text",t))}setText(t){return this.text=t,this}}t.register("numberBar",(function(t){var e=new jR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.NumberBar",jR),t.register("scrollBar",(function(t){var e=new mT(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ScrollBar",mT);const AR=Phaser.Utils.Objects.GetValue,zR={leftTop:"left-top",centerTop:"center-top",rightTop:"right-top",leftCenter:"left-center",center:"center",rightCenter:"right-center",leftBottom:"left-bottom",centerBottom:"center-bottom",rightBottom:"right-bottom"};class FR extends ox{constructor(t,e){super(t,e),this.type="rexBadge";var i=AR(e,"background",void 0);i&&this.addBackground(i),this.addChildrenMap("background",i);var s=AR(e,"main",void 0);for(var r in s&&this.add(s,{key:"main",align:"center",expand:!1}),this.addChildrenMap("main",s),zR){var n=AR(e,r,void 0);n&&(this.add(n,{key:r,align:zR[r],expand:!1}),this.addChildrenMap(r,n))}}}t.register("badgeLabel",(function(t){var e=new FR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.BadgeLabel",FR);const YR=ox.prototype.add;var XR=function(t,e,i,s,r,n,a,o,h){return t.setVisible(!1),YR.call(this,t,e,i,s,r,n,a,o,h),this},WR={add:XR,addPage:XR};const VR=tv.prototype.setChildVisible;var GR={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?(VR.call(this,i,!1),this.emit("pageinvisible",i,this._previousKey,this)):i.destroy()),t&&!this.sizerChildren.hasOwnProperty(t)&&this.emit("createpage",t,this),this._currentKey=t;var s=this.currentPage;return s&&(VR.call(this,s,!0),this.emit("pagevisible",s,this._currentKey,this),void 0===e&&(e=this.fadeInDuration),e>0&&s.setAlpha(0).fadeIn(e,1)),this},hasPage:function(t){return this.sizerChildren.hasOwnProperty(t)}};Object.assign(GR,WR);const HR=Phaser.Utils.Objects.GetValue;class UR extends ox{constructor(t,e){super(t,e),this.type="rexPages",this.childrenMap=this.sizerChildren,this._previousKey=void 0,this._currentKey=void 0,this.setSwapMode(HR(e,"swapMode",0)),this.setFadeInDuration(HR(e,"fadeIn",0))}setSwapMode(t){return"string"==typeof t&&(t=NR[t]),this.swapMode=t,this}setFadeInDuration(t){return this.fadeInDuration=t,this}get previousKey(){return this._previousKey}get currentKey(){return this._currentKey}set currentKey(t){this.swapPage(t)}get currentPage(){return this.getPage(this.currentKey)}get previousPage(){return this.getPage(this.previousKey)}get keys(){return Object.keys(this.sizerChildren)}}Object.assign(UR.prototype,GR);const NR={invisible:0,destroy:1};t.register("pages",(function(t){var e=new UR(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.Pages",UR);const $R=Phaser.GameObjects.Mesh;class KR extends $R{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const JR=Phaser.Math.Vector3,qR=Phaser.Math.Matrix4;var ZR=new JR,QR=new JR,tL=new qR;const eL=Phaser.Utils.Objects.IsPlainObject,iL=Phaser.Utils.Objects.GetValue,sL=Phaser.Geom.Mesh.GenerateGridVerts,rL=Phaser.Math.RadToDeg,nL=Phaser.Math.DegToRad,aL=1+1/Math.sin(nL(45));let oL=class extends KR{constructor(t,e,i,s,r,n){eL(e)&&(e=iL(n=e,"x",0),i=iL(n,"y",0),s=iL(n,"key",null),r=iL(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(aL),this.hideCCW=iL(n,"hideCCW",!0);var a=iL(n,"gridWidth",0),o=iL(n,"gridHeight",a);this.resetVerts(a,o),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,sL({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return rL(this.rotationX)}set angleX(t){this.rotationX=nL(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return rL(this.rotationY)}set angleY(t){this.rotationY=nL(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return rL(this.rotationZ)}set angleZ(t){this.rotationZ=nL(t)}transformVerts(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=r,this.transformInfo.rotateZ=n,function(t,e,i,s,r,n,a){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),ZR.set(e,i,s),QR.set(r,n,a),tL.fromRotationXYTranslation(QR,ZR,!0);for(var o=0,h=t.vertices.length;o=0;i--)this.removePage(e[i].name,t);return this}},NL={top:1,left:3,right:5,bottom:7},$L={top:"bottom",left:"right",right:"left",bottom:"top"},KL={setTabsPadding(t,e){return this.childrenMap.tabs.setOuterPadding(t,e),this},getTabsPadding(t){return this.childrenMap.tabs.getOuterPadding(t)}},JL={getPageKey:function(t){var e=this.getElement("tabs.buttons");if(!(t>=e.length))return e[t].name},getPageIndex:function(t){for(var e=this.getElement("tabs.buttons"),i=0,s=e.length;i=a.y)continue;break;case 2:if(n.x<=a.x)continue;break;case 3:if(n.x>=a.x)continue}qB.call(r,s,a.x,a.y)}}(t,s,r,i),t.transitInCallback(e,i,t)},tI={showMessage(t){var e=function(t,e,i){var s=e(t.scene,i,t);if(KB.call(s,(function(){t.removeMessage(s)})),t.displayTime){var r=t.transitInTime+t.displayTime+10;JB.call(s,r,(function(){t.removeMessage(s)}))}return s}(this,this.createMessageLabelCallback,t);return QB(this,e,this.transitInTime),this},removeMessage(t){if(this.getParentSizer(t)!==this)return this;if(!t.__isDestroying){t.__isDestroying=!0;var e=this.transitOutTime;return this.transitOutCallback(t,e,this),JB.call(t,e+10,(function(){delete t.__isDestroying,t.destroy()})),this}},removeAllMessages(){for(var t=this.childrenMap.items,e=0,i=t.length;e0&&{height:this.colorComponentsHeight,formatLabel:this.colorComponentsFormatLabelConfig,inputText:this.colorComponentsInputTextConfig,space:this.colorComponentsSpace};var a=new KI(t,{width:s,height:n,background:e,space:this.colorPickerSpace,hPalette:{position:this.colorPickerHPalettePosition},colorComponents:r,value:this.value});return t.add.existing(a),a},qI={openColorPicker:function(){if(!this.colorPicker){var t=JI.call(this).layout(),e=new oR(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(qI,yI);const ZI=Phaser.Utils.Objects.GetValue;class QI extends mI{constructor(t,e){void 0===e&&(e={}),super(t,e),this.type="rexColorInput",e.hasOwnProperty("colorPicker")||(e.colorPicker={background:{color:0}});var i=e.colorPicker,s=!1!==i&&null!==i;if(s){var r;this.setColorPickerSize(ZI(i,"width",160),ZI(i,"height",170));var n=ZI(i,"background");r=n?function(t){return zP(t,n)}:ZI(i,"createBackgroundCallback"),this.setCreateColorPickerBackgroundCallback(r),this.setColorPickerHPalettePosition(ZI(i,"hPalettePosition",0)),this.setColorPickerExpandDirection(ZI(i,"expandDirection")),this.setColorPickerEaseInDuration(ZI(i,"easeIn",200)),this.setColorPickerEaseOutDuration(ZI(i,"easeOut",200)),this.setColorPickerTransitInCallback(ZI(i,"transitIn")),this.setColorPickerTransitOutCallback(ZI(i,"transitOut")),this.setColorPickerBounds(ZI(i,"bounds"));var a=ZI(i,"space");void 0===a&&(a={left:10,right:10,top:10,bottom:10,item:8}),this.setColorPickerSpace(a)}var o=e.colorComponents;if(s&&!1!==o&&null!==o){this.setColorComponentsHeight(ZI(o,"height",30)),this.setColorComponentsFormatLabelConfig(ZI(o,"formatLabel"));var h=ZI(o,"inputText");h||(h=ZI(e,"inputText")),this.setColorComponentsInputTextConfig(h);var l=ZI(o,"space");void 0===l&&(l={item:8}),this.setColorComponentsSpace(l)}var d=this.childrenMap.swatch;d&&s&&this.onClick(d,this.openColorPicker,this)}}Object.assign(QI.prototype,qI),t.register("colorInput",(function(t){var e=new QI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInput",QI),t.register("colorInputLite",(function(t){var e=new mI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorInputBase",mI),t.register("colorPicker",(function(t){var e=new YI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorPicker",YI),t.register("colorComponents",(function(t){var e=new NI(this.scene,t);return this.scene.add.existing(e),e})),P(window,"RexPlugins.UI.ColorComponents",NI);var tD=function(t){for(var e,i=t.scene.input,s=i.manager,r=s.pointersTotal,n=s.pointers,a=0;a0&&c0&&u0&&b0&&x * @copyright 2019 Photon Storm Ltd. * @license {@link https://opensource.org/licenses/MIT|MIT License} - */var SD=function(t,e){var i=Ge(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},PD=function(t,e,i){return AP(t,SD(e,i))},TD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},OD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class MD extends nB{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(MD.prototype,TD,OD);const ED=Phaser.Utils.Objects.GetValue,_D=Phaser.Utils.Objects.GetValue;var RD={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const GD=Phaser.Utils.Objects.GetValue;class HD extends Ww{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=GD(e,"background",void 0),s=GD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:GD(e,"space.title",0)}});var r=GD(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(HD.prototype,WD,VD);const UD=Phaser.Utils.Objects.GetValue,ND=Phaser.Utils.Objects.GetValue;var $D={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},KD={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class JD extends J_{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(JD.prototype,$D,KD);const qD=Phaser.Utils.Objects.GetValue,ZD=Phaser.Utils.Objects.GetValue,QD=Phaser.Utils.Objects.GetValue;var tj={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=QD(t,"onGetValue"),this.onSetValue=QD(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},ej={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},ij={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const sj=Phaser.Utils.Objects.GetValue;class rj extends Ww{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=sj(e,"proportion.title",0),o=sj(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=sj(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(rj.prototype,tj,ej,ij);var nj=function(t,e,i){var s=new kD(t,i);return t.add.existing(s),s},aj=function(t){return void 0===t&&(t=Ww),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},oj=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=pj(this.styles,"inputRow")||{},r=uj(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return AP(t,SD(e,i))}(this.scene,t,gj(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,s){return"boolean"==typeof e&&(s=e,e=void 0),void 0===s&&(s=!0),vj(this,i(t),e,s),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=uE(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},xj={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var s=t.scene;this.type="rexTweaker.TextAreaInput";var r=e.inputTextArea;void 0===r&&(r={}),r.hasOwnProperty("text")||(r.text=e.inputText),r.hasOwnProperty("slider")||(r.slider=e.slider);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new jB(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"inputText"}),n.on("close",(function(){t.setValue(n.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},Cj={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=uE(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const kj=Phaser.Utils.Objects.GetValue,wj=Phaser.Math.Linear,Sj=Phaser.Math.Snap.Floor;var Pj={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=kj(s,r),a=function(t,e){var i=new uT(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=kj(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=uE(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=kj(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=wj(t.minValue,t.maxValue,a.value);t.step&&(e=Sj(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Tj=function(t,e){var i=new uM(t,e);return t.add.existing(i),i};const Oj=Phaser.Utils.Objects.GetValue;var Mj={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=Oj(e,"incDec")||{},n={text:null,action:null},a=Tj(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=uE(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=XM(s,d),u=Object.assign(i(n),r.decButton||{}),p=XM(s,u);a.addButton(c),a.addButton(p);var g=r.inputTextIndex||0;a.insert(g,l,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,a.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ColorInput";var r=e.colorInput;void 0===r&&(r={}),r.hasOwnProperty("inputText")||(r.inputText=e.inputText);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new ZI(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"colorInput"}),n.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},_j={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new vu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},Rj={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new Eu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},Lj=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=function(t,e){e=cR(t,e);var i=new dR(t,e);return t.add.existing(i),i}(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=Lj(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const Ij=Phaser.Utils.Objects.GetValue;var Dj={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ButtonsInput";var r=e.button?i(e.button):{},n=Ij(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=Tj(s,{expand:n});a.buttonConfig=r,t.add(a,{proportion:1,expand:!0,key:"list"}),a.on("button.click",(function(e,i,s,r){var n=a.options[i];n&&(t._selectedIndex=i,t.setValue(n.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;nr?n:-n),d.localY=u+(c>s?a:-a)}};const aA=Phaser.Utils.Objects.IsPlainObject,oA=Phaser.Utils.Objects.GetValue,hA=Phaser.Math.DegToRad,lA=Phaser.Math.RadToDeg;class dA extends rA{constructor(t,e,i,s,r){if(aA(e)){var n=e;e=oA(n,"x",0),i=oA(n,"y",0),s=oA(n,"key",null),r=oA(n,"frame",null)}super(t,e,i,s,r),this.type="rexSkewmage",this._skewX=0,this._skewY=0}get skewX(){return this._skewX}set skewX(t){this._skewX=t,nA(this,this._skewX,this._skewY)}get skewXDeg(){return lA(this._skewX)}set skewXDeg(t){this.skewX=hA(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,nA(this,this._skewX,this._skewY)}get skewYDeg(){return lA(this._skewY)}set skewYDeg(t){this.skewY=hA(t)}setSkewX(t){return this.skewX=t,this}setSkewY(t){return this.skewY=t,this}setSkew(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}setSkewXDeg(t){return this.skewXDeg=t,this}setSkewYDeg(t){return this.skewYDeg=t,this}setSkewDeg(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}const cA=Phaser.Utils.Objects.IsPlainObject,uA=Phaser.Utils.Objects.GetValue;class pA extends dA{constructor(t,e,i,s,r){if(cA(e)){var n=e;e=uA(n,"x",0),i=uA(n,"y",0),s=uA(n,"width",32),r=uA(n,"height",32)}super(t,e,i,hL(t,s,r),null),this.type="rexSkewRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}}class gA extends(BL(pA)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new gA(t,e)})),P(window,"RexPlugins.UI.Skew",gA),t.register("anchor",(function(t,e){return new pf(t,e)})),P(window,"RexPlugins.UI.Anchor",pf),t.register("textTyping",(function(t,e){return new MR(t,e)})),P(window,"RexPlugins.UI.TextTyping",MR),t.register("textPage",(function(t,e){return new bR(t,e)})),P(window,"RexPlugins.UI.TextPage",bR);var vA=void 0;const fA=Phaser.Utils.Objects.GetValue,mA=Phaser.Utils.Objects.Clone;var yA=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const bA=Phaser.Utils.Objects.GetValue,xA=Phaser.Utils.Objects.Merge;var CA={open:function(t,e){var i;void 0===t&&(t={}),t=xA(t,this.openConfig),(i=this)!==vA&&(void 0!==vA&&vA.close(),vA=i),Fm(t)&&(e=t,t=void 0);var s=bA(t,"inputType",void 0);void 0===s&&(s=bA(t,"type","text")),void 0===e&&(e=bA(t,"onClose",void 0));var r=bA(t,"onOpen",void 0),n=bA(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=mA(e);var i=t.scene,s=t.style,r=fA(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=fA(e,"text",t.text),e.fontFamily=fA(e,"fontFamily",s.fontFamily),e.fontSize=fA(e,"fontSize",s.fontSize),e.color=fA(e,"color",s.color),e.backgroundColor=r,e.direction=fA(e,"rtl",s.rtl)?"rtl":"ltr",e.align=fA(e,"align",yA(s)),"rtl"===e.direction&&$w(t)&&(e.align="right");var n=t.padding;n.left>0&&(e.paddingLeft=`${n.left}px`),n.right>0&&(e.paddingRight=`${n.right}px`),s.backgroundCornerRadius&&(e.borderRadius=fA(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new qk(i,t.x,t.y,fA(e,"width",t.width),fA(e,"height",t.height),e);a.setScale(t.scaleX,t.scaleY).setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(a):i.add.existing(a),a}(this.parent,t).on("textchange",(function(t){var e=t.text;n?n(this.parent,e):this.parent.text=e}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,bA(t,"enterClose","textarea"!==s)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=function(t,e,i){return t.time.delayedCall(0,e,[],i)}(this.scene,(function(){this.scene.input.once("pointerdown",this.close,this),r&&r(this.parent),this.emit("open",this.parent)}),this),this},close:function(){return this===vA&&(vA=void 0),this.parent.setVisible(!0),this.inputText&&(this.inputText.destroy(),this.inputText=void 0),this.delayCall&&(this.delayCall.remove(),this.delayCall=void 0),this.scene.input.keyboard.off("keydown-ENTER",this.close,this),this.scene.input.off("pointerdown",this.close,this),this.onClose&&this.onClose(this.parent),this.emit("close",this.parent),this}};const kA=Phaser.Utils.Objects.GetValue;class wA extends Ba{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),kA(e,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open()}),this).setInteractive()}shutdown(t){this.isShutdown||(this.close(),super.shutdown(t))}setOpenConfig(t){return void 0===t&&(t={}),this.openConfig=t,this}get isOpened(){return void 0!==this.inputText}get text(){return this.isOpened?this.inputText.text:this.parent.text}}Object.assign(wA.prototype,CA),t.register("textEdit",(function(t,e){return new wA(t,e)})),P(window,"RexPlugins.UI.TextEdit",wA),t.register("layerManager",(function(t){return new Ea(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",Ea);class SA extends Phaser.Plugins.ScenePlugin{constructor(e,i){super(e,i),this.add=new t(e)}boot(){this.scene.events.on("destroy",this.destroy,this)}destroy(){this.add.destroy(),super.destroy()}isInTouching(t,e,i,s){return!!t.visible&&Hm(t,e,i,s)}get viewport(){return ha(this.scene,this.scene.cameras.main,!0)}}var PA={getParentSizer:tg,getTopmostSizer:eg,removeFromParent:fE,hide:am,show:nm,isShown:om,confirmAction:nE,edit:function(t,e,i){return t._edit||(t._edit=new wA(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:eS,fontSizeExpandText:hS,fontSizeResize:sS,setFontSizeToFitWidth:sS,waitEvent:al,waitComplete:ol,delayPromise:tw,setChildrenInteractive:zb,fadeIn:_f,fadeOutDestroy:Rf,easeMoveTo:Xf,easeMoveFrom:Wf,modal:Am,modalPromise:function(t,e){var i=Am(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:zm,requestDrag:QI,openFileChooser:rw};return Object.assign(SA.prototype,PA),SA},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e(); + */var PD=function(t,e){var i=Ge(t);for(var s in e)i.hasOwnProperty(s)||(i[s]=e[s]);return i},TD=function(t,e,i){return zP(t,PD(e,i))},OD={setBindingTarget(t){return this.childrenMap.child.setBindingTarget(t),this}},MD={getMaxInputRowTitleWidth(){return this.childrenMap.child.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.child.setInputRowTitleWidth(t),this}};class ED extends aB{constructor(t,e){void 0===e&&(e={}),e.orientation=1,super(t,e),this.type="rexTweaker.Folder"}setTitle(t){return this.childrenMap.title.setTitle(t),this}}Object.assign(ED.prototype,OD,MD);const _D=Phaser.Utils.Objects.GetValue,RD=Phaser.Utils.Objects.GetValue;var LD={setBindingTarget(t){for(var e=this.childrenMap.pages.children,i=0,s=e.length;i0,setInputRowTitleWidth(t){return this}};const HD=Phaser.Utils.Objects.GetValue;class UD extends Vw{constructor(t,e){void 0===e&&(e={}),e.orientation="y",super(t,e),this.type="rexTweaker.Wrap";var i=HD(e,"background",void 0),s=HD(e,"title",void 0);i&&this.addBackground(i),s&&this.add(s,{expand:!0,space:{bottom:HD(e,"space.title",0)}});var r=HD(e,"child",void 0);this.add(r,{expand:!0}),this.addChildrenMap("title",s),this.addChildrenMap("child",r)}setTitle(t){var e=this.childrenMap.title;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(UD.prototype,VD,GD);const ND=Phaser.Utils.Objects.GetValue,$D=Phaser.Utils.Objects.GetValue;var KD={setBindingTarget(t){return this.childrenMap.panel.setBindingTarget(t),this}},JD={getMaxInputRowTitleWidth(){return this.childrenMap.panel.getMaxInputRowTitleWidth()+this.getInnerPadding("left")},setInputRowTitleWidth(t){return t-=this.getInnerPadding("left"),this.childrenMap.panel.setInputRowTitleWidth(t),this}};class qD extends q_{constructor(t,e){super(t,e),this.type="rexTweaker.Scrollable"}setTitle(t){var e=this.childrenMap.header;return t.title||t.icon?e.show().setTitle(t):e.hide(),this}}Object.assign(qD.prototype,KD,JD);const ZD=Phaser.Utils.Objects.GetValue,QD=Phaser.Utils.Objects.GetValue,tj=Phaser.Utils.Objects.GetValue;var ej={setupBinding(){return this.childrenMap.inputField.on("valuechange",(function(t){this.autoUpdateEnable&&this.setTargetValue(t)}),this),this},setAutoUpdateEnable(t){return void 0===t&&(t=!0),this.autoUpdateEnable=t,this},setBindingTarget(t,e){this.bindingTarget=t,void 0!==e&&this.setBindingTargetKey(e),this.syncTargetValue();var i=this.childrenMap.inputField;return i.onBindTarget&&i.onBindTarget(t,e),this},setBindingTargetKey(t){return this.bindTargetKey=t,this},setValueCallbacks(t){return this.onGetValue=tj(t,"onGetValue"),this.onSetValue=tj(t,"onSetValue"),this},getTargetValue(){if(this.bindingTarget)return null!=this.bindTargetKey?this.bindingTarget[this.bindTargetKey]:this.onGetValue?this.onGetValue(this.bindingTarget):void 0},setTargetValue(t){return this.bindingTarget?null!=this.bindTargetKey?(this.bindingTarget[this.bindTargetKey]=t,this):(this.onSetValue&&this.onSetValue(this.bindingTarget,t),this):this},syncTargetValue(){if(!this.bindingTarget)return this;var t=this.childrenMap.inputField;return t.syncValue&&t.syncValue(this.getTargetValue()),this}},ij={startMonitorTarget(){return this.isMonitoring||(this.isMonitoring=!0,this.scene.events.on("postupdate",this.onMonitorTarget,this)),this},stopMonitorTarget(){return this.isMonitoring?(this.isMonitoring=!1,this.scene.events.off("postupdate",this.onMonitorTarget,this),this):this},onMonitorTarget(){if(this.bindingTarget){var t=this.getTargetValue(),e=this.childrenMap.inputField;e.value!==t&&e.syncValue(t)}}},sj={getMinTitleWidth(){var t=this.childrenMap.title;if(!t||0!==t.orientation)return 0;var e=t.rexSizer.padding;return this.getChildWidth(this.childrenMap.title)+(e.left+e.right)*t.scaleX+this.getInnerPadding("left")},setMinTitleWidth(t){var e=this.childrenMap.title;if(!e||0!==e.orientation)return this;var i=e.rexSizer.padding;return t-=(i.left+i.right)*e.scaleX,e.minWidth=t,this}};const rj=Phaser.Utils.Objects.GetValue;class nj extends Vw{constructor(t,e){super(t,e),this.type="rexTweaker.InputRow",this.bindingTarget=void 0,this.bindTargetKey=void 0,this.autoUpdateEnable=!0;var i,s=e.inputTitle,r=e.inputField,n=e.background,a=rj(e,"proportion.title",0),o=rj(e,"space.title",0);i=0===this.orientation?{right:o}:{bottom:o},this.add(s,{proportion:a,expand:!0,padding:i});var h=r.defaultProportion;void 0===h&&(h=e.defaultExpandWidth?1:0),a=rj(e,"proportion.inputField",h),this.add(r,{proportion:a,expand:!0}),n&&this.addBackground(n),this.addChildrenMap("title",s),this.addChildrenMap("inputField",r),this.addChildrenMap("background",n),this.setupBinding()}destroy(t){this.scene&&!this.ignoreDestroy&&(this.stopMonitorTarget(),super.destroy(t))}setTitle(t){return this.childrenMap.title.setTitle(t),this}preLayout(){var t=this.childrenMap.title;t&&(t.minWidth=0),super.preLayout()}}Object.assign(nj.prototype,ej,ij,sj);var aj=function(t,e,i){var s=new wD(t,i);return t.add.existing(s),s},oj=function(t){return void 0===t&&(t=Vw),class extends t{get bindingTarget(){return this.getParentSizer().bindingTarget}get bindingKey(){return this.getParentSizer().bindTargetKey}get value(){return this._value}get root(){return this.getParentSizer().getParentSizer().root}onBindTarget(t,e){this.onBindTargetCallback&&this.onBindTargetCallback(this,t,e)}validate(t){return!(!this.syncValueFlag&&this.validateCallback)||this.validateCallback(t,this._value,this.bindingTarget,this.bindingKey)}getFotmatText(t){return t=this.textFormatCallback?this.textFormatCallback(t):t.toString()}set value(t){if(this._value!==t&&(this.validate(t)||(t=this._value),this.filterValueCallback&&(t=this.filterValueCallback(this,t)),this.displayValueCallback&&this.displayValueCallback(this,t),this._value!==t)){var e=this._value;if(this._value=t,!this.syncValueFlag){var i=this.bindingTarget,s=this.bindingKey;this.emit("valuechange",t,e,i,s),this.root.emit("valuechange",t,e,i,s)}}}getValue(){return this.value}setValue(t){return this.value=t,this}syncValue(t){return this.syncValueFlag=!0,this.value=t,this.syncValueFlag=!1,this}setup(t,e){return void 0===e&&(e=!1),(e||t.hasOwnProperty("format"))&&this.setTextFormatCallback(t.format),(e||t.hasOwnProperty("onValidate"))&&this.setValidateCallback(t.onValidate),this.setupCallback&&this.setupCallback(this,t,e),this}setSetupCallback(t){return this.setupCallback=t,this}setFilterValueCallback(t){return this.filterValueCallback=t,this}setDisplayValueCallback(t){return this.displayValueCallback=t,this}setOnBindTargetCallback(t){return this.onBindTargetCallback=t,this}setTextFormatCallback(t){return this.textFormatCallback=t,this}setValidateCallback(t){return this.validateCallback=t,this}}},hj=function(t,e,i){for(var s,r=this.inputHandlers,n=0,a=r.length;n0?0:1,0===n.minWidth&&n.setMinWidth(this.itemWidth)),0===n.minHeight&&n.setMinHeight(this.itemHeight),this.add(n,{proportion:r,expand:!0})),i.onValueChange&&n.childrenMap.inputField.on("valuechange",i.onValueChange),n.setAutoUpdateEnable(i.autoUpdate),n.setBindingTarget(t,e),i.monitor&&n.startMonitorTarget(),i.key&&this.root.addChildrenMap(i.key,n),this):(console.error(`[Tweaker] Can't add Input\n title: ${i.title}\n view: ${i.view}\n`),this)},addButtons:function(t){void 0===t&&(t={});var e=this.scene,i=t.bindingTarget;delete t.bindingTarget;var s=gj(this.styles,"inputRow")||{},r=pj(e,t,s);return this.add(r,{expand:!0}),i&&r.setBindingTarget(i),t.key&&this.root.addChildrenMap(t.key,r),this},addButton:function(t){return void 0===t&&(t={}),t.buttons=[{label:t.label,callback:t.callback}],delete t.label,delete t.callback,this.addButtons(t),this},addSeparator:function(t){void 0===t&&(t={});var e=function(t,e,i){return zP(t,PD(e,i))}(this.scene,t,vj(this.styles,"separator"));return this.add(e,{expand:!0}),this},addRows:function(t,e,s){return"boolean"==typeof e&&(s=e,e=void 0),void 0===s&&(s=!0),fj(this,i(t),e,s),this},setBindingTarget:function(t){for(var e=this.sizerChildren,i=0,s=e.length;it.hasOwnProperty("view")?"string"===t.view:"string"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.TextInput";var s=e.inputText,r=pE(i,s);t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}},Cj={name:"TextAreaInput",accept:t=>!!t.hasOwnProperty("view")&&"textarea"===t.view,build(t,e){var s=t.scene;this.type="rexTweaker.TextAreaInput";var r=e.inputTextArea;void 0===r&&(r={}),r.hasOwnProperty("text")||(r.text=e.inputText),r.hasOwnProperty("slider")||(r.slider=e.slider);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new AB(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"inputText"}),n.on("close",(function(){t.setValue(n.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))},onBindTarget(t){t.childrenMap.inputText.scrollToTop()}},kj={name:"NumberInput",accept:t=>t.hasOwnProperty("view")?"number"===t.view:"number"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.NumberInput";var s=e.inputNumber||e.inputText,r=pE(i,s).setNumberInput();t.add(r,{proportion:1,expand:!0,key:"inputText"}),r.on("close",(function(){t.setValue(r.value)}))},setup(t,e,i){(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly),t.isFloatType=!e.int},filterValue:(t,e)=>t.isFloatType?e:Math.floor(e),displayValue(t,e){t.childrenMap.inputText.setText(t.getFotmatText(e))}};const wj=Phaser.Utils.Objects.GetValue,Sj=Phaser.Math.Linear,Pj=Phaser.Math.Snap.Floor;var Tj={name:"RangeInput",accept:t=>t.hasOwnProperty("view")?"range"===t.view:"number"==typeof t.value&&t.hasOwnProperty("min")&&t.hasOwnProperty("max"),build(t,e){var i=t.scene;t.type="rexTweaker.RangeInput";var s=e.slider,r=0===t.orientation?"track.height":"track.width",n=wj(s,r),a=function(t,e){var i=new pT(t,e);return t.add.existing(i),i}(i,s),o=e.defaultExpandWidth?2:0,h=wj(e,"proportion.range.slider",o),l=void 0===n;t.add(a,{proportion:h,expand:l,key:"slider"});var d=e.inputNumber||e.inputText,c=pE(i,d).setNumberInput();o=e.defaultExpandWidth?1:0,h=wj(e,"proportion.range.inputText",o),t.add(c,{proportion:h,expand:!0,key:"inputText"}),c.on("close",(function(){t.setValue(c.value)})),a.on("valuechange",(function(){var e=Sj(t.minValue,t.maxValue,a.value);t.step&&(e=Pj(e,t.step,t.minValue)),t.setValue(e)}))},setup(t,e,i){(i||e.hasOwnProperty("max"))&&function(t,e,i,s){t.minValue=e,t.maxValue=i,t.step=s,t.childrenMap.slider.setGap(s,e,i)}(t,e.min,e.max,e.step),(i||e.hasOwnProperty("inputTextReadOnly"))&&function(t,e){void 0===e&&(e=!0),t.childrenMap.inputText.setReadOnly(e)}(t,!!e.inputTextReadOnly)},displayValue(t,e){t.childrenMap.slider.setValue(e,t.minValue,t.maxValue),t.childrenMap.inputText.setText("").setText(t.getFotmatText(e))}},Oj=function(t,e){var i=new pM(t,e);return t.add.existing(i),i};const Mj=Phaser.Utils.Objects.GetValue;var Ej={name:"RangeInput",accept:t=>!!t.hasOwnProperty("view")&&"incdec"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.IncDecInput";var r=Mj(e,"incDec")||{},n={text:null,action:null},a=Oj(s,{expand:!1}),o=e.defaultExpandWidth?1:0;t.add(a,{proportion:o,expand:!0});var h=e.inputNumber||e.inputText,l=pE(s,h).setNumberInput();l.on("close",(function(){t.setValue(l.value)}));var d=Object.assign(i(n),r.incButton||{}),c=WM(s,d),u=Object.assign(i(n),r.decButton||{}),p=WM(s,u);a.addButton(c),a.addButton(p);var g=r.inputTextIndex||0;a.insert(g,l,{proportion:1,expand:!0}),t.step=1,t.minValue=void 0,t.maxValue=void 0,a.on("button.click",(function(e,i,s,r){var n=t.value;0===i?n+=t.step:n-=t.step,void 0!==t.maxValue&&n>t.maxValue&&(n=t.maxValue),void 0!==t.minValue&&n!!t.hasOwnProperty("view")&&"color"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ColorInput";var r=e.colorInput;void 0===r&&(r={}),r.hasOwnProperty("inputText")||(r.inputText=e.inputText);var n=function(t,e,s){void 0===s&&(s=!0),s?e=e?i(e):{}:e||(e={});var r=new QI(t,e);return t.add.existing(r),r}(s,r);t.add(n,{proportion:1,expand:!0,key:"colorInput"}),n.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.colorInput.setValue(e)}},Rj={name:"CheckboxInput",accept:t=>t.hasOwnProperty("view")?"boolean"===t.view:"boolean"==typeof t.value,build(t,e){var i=t.scene;t.type="rexTweaker.CheckboxInput";var s=e.checkbox,r=function(t,e){var i=new fu(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.add(r,{proportion:0,expand:!1,fitRatio:a,key:"checkbox"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.checkbox.setValue(e)}},Lj={name:"ToggleSwitchInput",accept:t=>!!t.hasOwnProperty("view")&&"toggleSwitch"===t.view,build(t,e){var i=t.scene;t.type="rexTweaker.ToggleSwitchInput";var s=e.toggleSwitch,r=function(t,e){var i=new _u(t,e);return t.add.existing(i),i}(i,s),n=s.size;void 0!==n&&r.setSize(n,n);var a=void 0!==n?0:1;t.addSpace().add(r,{proportion:0,expand:!1,fitRatio:a,key:"toggleSwitch"}),r.on("valuechange",(function(e){t.setValue(e)}))},displayValue(t,e){t.childrenMap.toggleSwitch.setValue(e)}},Bj=function(t,e){for(var i=0,s=t.length;it.hasOwnProperty("view")?"list"===t.view:t.hasOwnProperty("options"),build(t,e){var i=t.scene;t.type="rexTweaker.ListInput";var s=function(t,e){e=uR(t,e);var i=new cR(t,e);return t.add.existing(i),i}(i,e.list);t.add(s,{proportion:1,expand:!0,key:"list"}),s.on("button.click",(function(e,i,s,r,n,a){t.setValue(s.value)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){t.childrenMap.list.setOptions(e)}(t,e.options)},displayValue(t,e){var i=t.childrenMap.list,s=function(t,e){var i=Bj(t,e);if(null!=i)return t[i]}(i.options,e);i.resetDisplayContent(s).setMinSize(i.width,i.height).layout().setMinSize(0,0)}};const Dj=Phaser.Utils.Objects.GetValue;var jj={name:"ButtonsInput",accept:t=>!!t.hasOwnProperty("view")&&"buttons"===t.view,build(t,e){var s=t.scene;t.type="rexTweaker.ButtonsInput";var r=e.button?i(e.button):{},n=Dj(r,"expand",!0);n&&(r.align="center"),delete r.expand;var a=Oj(s,{expand:n});a.buttonConfig=r,t.add(a,{proportion:1,expand:!0,key:"list"}),a.on("button.click",(function(e,i,s,r){var n=a.options[i];n&&(t._selectedIndex=i,t.setValue(n.value),t._selectedIndex=void 0)}))},setup(t,e,i){(i||e.hasOwnProperty("options"))&&function(t,e){var i=t.childrenMap.list;i.options=e;var s=t.scene,r=i.buttonConfig;i.clearButtons(!0);for(var n=0,a=e.length;nr?n:-n),d.localY=u+(c>s?a:-a)}};const oA=Phaser.Utils.Objects.IsPlainObject,hA=Phaser.Utils.Objects.GetValue,lA=Phaser.Math.DegToRad,dA=Phaser.Math.RadToDeg;class cA extends nA{constructor(t,e,i,s,r){if(oA(e)){var n=e;e=hA(n,"x",0),i=hA(n,"y",0),s=hA(n,"key",null),r=hA(n,"frame",null)}super(t,e,i,s,r),this.type="rexSkewmage",this._skewX=0,this._skewY=0}get skewX(){return this._skewX}set skewX(t){this._skewX=t,aA(this,this._skewX,this._skewY)}get skewXDeg(){return dA(this._skewX)}set skewXDeg(t){this.skewX=lA(t)}get skewY(){return this._skewY}set skewY(t){this._skewY=t,aA(this,this._skewX,this._skewY)}get skewYDeg(){return dA(this._skewY)}set skewYDeg(t){this.skewY=lA(t)}setSkewX(t){return this.skewX=t,this}setSkewY(t){return this.skewY=t,this}setSkew(t,e){return void 0===e&&(e=t),this.skewX=t,this.skewY=e,this}setSkewXDeg(t){return this.skewXDeg=t,this}setSkewYDeg(t){return this.skewYDeg=t,this}setSkewDeg(t,e){return void 0===e&&(e=t),this.skewXDeg=t,this.skewYDeg=e,this}}const uA=Phaser.Utils.Objects.IsPlainObject,pA=Phaser.Utils.Objects.GetValue;class gA extends cA{constructor(t,e,i,s,r){if(uA(e)){var n=e;e=pA(n,"x",0),i=pA(n,"y",0),s=pA(n,"width",32),r=pA(n,"height",32)}super(t,e,i,lL(t,s,r),null),this.type="rexSkewRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}}class vA extends(IL(gA)){get skewState(){return this.isRunning}}t.register("skew",(function(t,e){return new vA(t,e)})),P(window,"RexPlugins.UI.Skew",vA),t.register("anchor",(function(t,e){return new gf(t,e)})),P(window,"RexPlugins.UI.Anchor",gf),t.register("textTyping",(function(t,e){return new ER(t,e)})),P(window,"RexPlugins.UI.TextTyping",ER),t.register("textPage",(function(t,e){return new xR(t,e)})),P(window,"RexPlugins.UI.TextPage",xR);var fA=void 0;const mA=Phaser.Utils.Objects.GetValue,yA=Phaser.Utils.Objects.Clone;var bA=function(t){return t.hasOwnProperty("align")?t.align:t.hasOwnProperty("halign")?t.halign:"left"};const xA=Phaser.Utils.Objects.GetValue,CA=Phaser.Utils.Objects.Merge;var kA={open:function(t,e){var i;void 0===t&&(t={}),t=CA(t,this.openConfig),(i=this)!==fA&&(void 0!==fA&&fA.close(),fA=i),Ym(t)&&(e=t,t=void 0);var s=xA(t,"inputType",void 0);void 0===s&&(s=xA(t,"type","text")),void 0===e&&(e=xA(t,"onClose",void 0));var r=xA(t,"onOpen",void 0),n=xA(t,"onTextChanged",void 0);return this.inputText=function(t,e){void 0===e&&(e={}),e=yA(e);var i=t.scene,s=t.style,r=mA(e,"backgroundColor",s.backgroundColor);null===r&&(r="transparent"),e.text=mA(e,"text",t.text),e.fontFamily=mA(e,"fontFamily",s.fontFamily),e.fontSize=mA(e,"fontSize",s.fontSize),e.color=mA(e,"color",s.color),e.backgroundColor=r,e.direction=mA(e,"rtl",s.rtl)?"rtl":"ltr",e.align=mA(e,"align",bA(s)),"rtl"===e.direction&&Kw(t)&&(e.align="right");var n=t.padding;n.left>0&&(e.paddingLeft=`${n.left}px`),n.right>0&&(e.paddingRight=`${n.right}px`),s.backgroundCornerRadius&&(e.borderRadius=mA(e,"borderRadius",`${s.backgroundCornerRadius}px`));var a=new Zk(i,t.x,t.y,mA(e,"width",t.width),mA(e,"height",t.height),e);a.setScale(t.scaleX,t.scaleY).setOrigin(t.originX,t.originY).setScrollFactor(t.scrollFactorX,t.scrollFactorY);var o=t.parentContainer;return o?o.add(a):i.add.existing(a),a}(this.parent,t).on("textchange",(function(t){var e=t.text;n?n(this.parent,e):this.parent.text=e}),this).setFocus(),this.parent.setVisible(!1),this.onClose=e,xA(t,"enterClose","textarea"!==s)&&this.scene.input.keyboard.once("keydown-ENTER",this.close,this),this.delayCall=function(t,e,i){return t.time.delayedCall(0,e,[],i)}(this.scene,(function(){this.scene.input.once("pointerdown",this.close,this),r&&r(this.parent),this.emit("open",this.parent)}),this),this},close:function(){return this===fA&&(fA=void 0),this.parent.setVisible(!0),this.inputText&&(this.inputText.destroy(),this.inputText=void 0),this.delayCall&&(this.delayCall.remove(),this.delayCall=void 0),this.scene.input.keyboard.off("keydown-ENTER",this.close,this),this.scene.input.off("pointerdown",this.close,this),this.onClose&&this.onClose(this.parent),this.emit("close",this.parent),this}};const wA=Phaser.Utils.Objects.GetValue;class SA extends Ia{constructor(t,e){super(t),this.inputText=void 0,this.onClose=void 0,this.delayCall=void 0,this.setOpenConfig(e),wA(e,"clickEnable",!0)&&t.on("pointerdown",(function(){this.open()}),this).setInteractive()}shutdown(t){this.isShutdown||(this.close(),super.shutdown(t))}setOpenConfig(t){return void 0===t&&(t={}),this.openConfig=t,this}get isOpened(){return void 0!==this.inputText}get text(){return this.isOpened?this.inputText.text:this.parent.text}}Object.assign(SA.prototype,kA),t.register("textEdit",(function(t,e){return new SA(t,e)})),P(window,"RexPlugins.UI.TextEdit",SA),t.register("layerManager",(function(t){return new _a(this.scene,t)})),P(window,"RexPlugins.UI.LayerManager",_a);class PA extends Phaser.Plugins.ScenePlugin{constructor(e,i){super(e,i),this.add=new t(e)}boot(){this.scene.events.on("destroy",this.destroy,this)}destroy(){this.add.destroy(),super.destroy()}isInTouching(t,e,i,s){return!!t.visible&&Um(t,e,i,s)}get viewport(){return la(this.scene,this.scene.cameras.main,!0)}}var TA={getParentSizer:eg,getTopmostSizer:ig,removeFromParent:mE,hide:om,show:am,isShown:hm,confirmAction:aE,edit:function(t,e,i){return t._edit||(t._edit=new SA(t,{clickEnable:!1})),t._edit.open(e,i),t._edit},wrapExpandText:iS,fontSizeExpandText:lS,fontSizeResize:rS,setFontSizeToFitWidth:rS,waitEvent:ol,waitComplete:hl,delayPromise:ew,setChildrenInteractive:Fb,fadeIn:Rf,fadeOutDestroy:Lf,easeMoveTo:Wf,easeMoveFrom:Vf,modal:zm,modalPromise:function(t,e){var i=zm(t,e);return new Promise((function(t,e){i.once("close",(function(e){t(e)}))}))},modalClose:Fm,requestDrag:tD,openFileChooser:nw};return Object.assign(PA.prototype,TA),PA},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexuiplugin=e(); diff --git a/examples/bbcodetext/hitarea.js b/examples/bbcodetext/hitarea.js index bcdf0684e7..730cdaec5d 100644 --- a/examples/bbcodetext/hitarea.js +++ b/examples/bbcodetext/hitarea.js @@ -56,6 +56,16 @@ class Demo extends Phaser.Scene { //scene.input.manager.canvas.style.cursor = ''; }) + var txt2 = this.add.rexBBCodeText(400, 300, '[area=1][hit me][/area]', { + backgroundColor: '#555', + fontSize: '24px' + }) + .setInteractive() + .on('areaclick', function () { + // Clear hit-area + this.setText('123456') + }); + } update() { } diff --git a/plugins/gameobjects/tagtext/textbase/canvastext/SetInteractive.js b/plugins/gameobjects/tagtext/textbase/canvastext/SetInteractive.js index e6251492f8..6e2df60235 100644 --- a/plugins/gameobjects/tagtext/textbase/canvastext/SetInteractive.js +++ b/plugins/gameobjects/tagtext/textbase/canvastext/SetInteractive.js @@ -21,6 +21,11 @@ var OnAreaDown = function (pointer, localX, localY, event) { var key = area.data.key; FireEvent.call(this, 'areadown', key, pointer, localX, localY, event); + // Removed by callback of previous event + if (!area.data) { + return; + } + area.data.isDown = true; } @@ -30,21 +35,29 @@ var OnAreaUp = function (pointer, localX, localY, event) { return; } - var areaData = area.data; - - var key = areaData.key; + var key = area.data.key; FireEvent.call(this, 'areaup', key, pointer, localX, localY, event); - if (areaData.isDown) { + // Removed by callback of previous event + if (!area.data) { + return; + } + + if (area.data.isDown) { FireEvent.call(this, 'areaclick', key, pointer, localX, localY, event); - var url = areaData.url; + // Removed by callback of previous event + if (!area.data) { + return; + } + + var url = area.data.url; if (url) { window.open(url, '_blank'); } } - areaData.isDown = false; + area.data.isDown = false; } var OnAreaOverOut = function (pointer, localX, localY, event) { @@ -67,17 +80,22 @@ var OnAreaOverOut = function (pointer, localX, localY, event) { FireEvent.call(this, 'areaout', this.lastHitAreaKey, pointer, localX, localY, event); var prevHitArea = this.hitAreaManager.getByKey(this.lastHitAreaKey); - if (this.urlTagCursorStyle && !!prevHitArea.data.url) { - this.scene.input.manager.canvas.style.cursor = ''; - } - prevHitArea.isDown = false; + if (prevHitArea) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, prevHitArea, ''); + } + + prevHitArea.isDown = false; + } } if (key !== null) { FireEvent.call(this, 'areaover', key, pointer, localX, localY, event); - if (this.urlTagCursorStyle && !!area.data.url) { - this.scene.input.manager.canvas.style.cursor = this.urlTagCursorStyle; + if (area.data) { + if (this.urlTagCursorStyle) { + SetCursorStyle(this.scene, area, this.urlTagCursorStyle); + } } } @@ -88,4 +106,13 @@ var FireEvent = function (eventName, key, pointer, localX, localY, event) { this.parent.emit(`${eventName}-${key}`, pointer, localX, localY, event); this.parent.emit(eventName, key, pointer, localX, localY, event); } + +var SetCursorStyle = function (scene, area, cursorStyle) { + if (!area || !area.data || !area.data.url) { + return; + } + + scene.input.manager.canvas.style.cursor = cursorStyle; +} + export default SetInteractive; \ No newline at end of file diff --git a/plugins/gameobjects/tagtext/textbase/hitareamanager/HitAreaManager.js b/plugins/gameobjects/tagtext/textbase/hitareamanager/HitAreaManager.js index 27fd0ae563..6412e2bb0a 100644 --- a/plugins/gameobjects/tagtext/textbase/hitareamanager/HitAreaManager.js +++ b/plugins/gameobjects/tagtext/textbase/hitareamanager/HitAreaManager.js @@ -1,5 +1,4 @@ import Pool from '../../../../pool.js'; -import Clear from '../../../../utils/object/Clear.js'; const Rectangle = Phaser.Geom.Rectangle; @@ -16,13 +15,17 @@ class HitAreaManager { clear() { // Reuse hitArea(rectangle) later for (var i = 0, cnt = this.hitAreas.length; i < cnt; i++) { - Clear(this.hitAreas[i].data); + this.hitAreas[i].data = null; } RectanglePool.pushMultiple(this.hitAreas); return this; } add(x, y, width, height, data) { + if (data === undefined) { + data = {}; + } + var rectangle = RectanglePool.pop(); if (rectangle === null) { rectangle = new Rectangle(x, y, width, height);