text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rextextplayerplugin=e()}(this,function(){"use strict";function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function h(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function v(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(n){var s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=p(n);if(s){var i=p(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return v(t)}(this,t)}}function y(t,e,i){return(y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(i):s.value}})(t,e,i||t)}function c(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return s(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return s(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var f=Phaser.Renderer.WebGL.Utils,t={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,a=s.height,o=f.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),u=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,a,e.x,e.y,r/e.resolution,a/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,a,o(e.tintTopLeft,i.alpha*e._alphaTL),o(e.tintTopRight,i.alpha*e._alphaTR),o(e.tintBottomLeft,i.alpha*e._alphaBL),o(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,n,!1,u),t.pipelines.postBatch(e)}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n))}},r=Phaser.Display.Color,e={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},loadFromURL:function(t,e){var i=this,n=new Image;return n.onload=function(){i.width!==n.width||i.height!==n.height?i.resize(n.width,n.height):i.clear(),i.context.drawImage(n,0,0),i.updateTexture(),e&&e(),n.onload=null,n.src="",n.remove()},n.src=t,this},loadFromURLPromise:function(i){var n=this;return new Promise(function(t,e){n.loadFromURL(i,t)})},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new r);var n=this.context.getImageData(t,e,1,1);return i.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),i},setPixel:function(t,e,i,n,s,r){if("number"!=typeof i){var a=i;i=a.red,n=a.green,s=a.blue,r=a.alpha}void 0===r&&(r=0!==i||0!==n||0!==s?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=n,o.data[2]=s,o.data[3]=r,this.context.putImageData(o,t,e),this.dirty=!0,this}},a={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,s){var r=this.canvas;return void 0===n?n=r.width:n*=this.resolution,void 0===s?s=r.height:s*=this.resolution,function(t,e,i,n,s,r,a){var o,h=t.textures,u=t.renderer;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=e.width),void 0===a&&(a=e.height);var c=(o=h.exists(i)?h.get(i):h.createCanvas(i,r,a)).getSourceImage();c.width!==r&&(c.width=r),c.height!==a&&(c.height=a);var l=c.getContext("2d");l.clearRect(0,0,r,a),l.drawImage(e,n,s,r,a),u.gl&&o&&u.canvasToTexture(c,o.source[0].glTexture,!0,0)}(this.scene,r,t,e,i,n,s),this},loadTexture:function(t,e){var i=this.scene.textures.getFrame(t,e);return i&&(this.width!==i.cutWidth||this.height!==i.cutHeight?this.resize(i.cutWidth,i.cutHeight):this.clear(),this.context.drawImage(i.source.image,i.cutX,i.cutY,i.cutWidth,i.cutHeight,0,0,this.canvas.width,this.canvas.height),this.dirty=!0),this}},m=Phaser.Display.Canvas.CanvasPool,k=Phaser.GameObjects.GameObject,o=function(){u(o,k);var a=g(o);function o(t,e,i,n,s){var r;return d(this,o),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=1),(r=a.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,r.resolution=1,r._width=n,r._height=s,n=Math.max(Math.ceil(n*r.resolution),1),s=Math.max(Math.ceil(s*r.resolution),1),r.canvas=m.create(v(r),n,s),r.context=r.canvas.getContext("2d"),r.dirty=!1,r.setPosition(e,i),r.setOrigin(.5,.5),r.initPipeline(),r._crop=r.resetCropObject(),r.texture=t.sys.textures.addCanvas(null,r.canvas,!0),r.frame=r.texture.get(),r.frame.source.resolution=r.resolution,r.renderer&&r.renderer.gl&&(r.renderer.deleteTexture(r.frame.source.glTexture),r.frame.source.glTexture=null),r.dirty=!0,t.sys.game.events.on("contextrestored",r.onContextRestored,v(r)),r}return h(o,[{key:"onContextRestored",value:function(){this.dirty=!0}},{key:"preDestroy",value:function(){this.scene.sys.game.events.off("contextrestored",this.onContextRestored,this),m.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t)}},{key:"setSize",value:function(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),o}(),b=Phaser.GameObjects.Components;Phaser.Class.mixin(o,[b.Alpha,b.BlendMode,b.Crop,b.Depth,b.Flip,b.GetBounds,b.Mask,b.Origin,b.Pipeline,b.ScrollFactor,b.Tint,b.Transform,b.Visible,t,e,a]);function w(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;for(var n=e.split("."),s=t,r=i,a=0;a<n.length;a++){if(!s.hasOwnProperty(n[a])){r=i;break}r=s[n[a]],s=s[n[a]]}return r}return i}function x(t){if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}var S={enableData:function(){return void 0===this.data&&(this.data={}),this},getData:function(t,e){return this.enableData(),void 0===t?this.data:w(this.data,t,e)},setData:function(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},incData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData:function(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData:function(){return this.data&&x(this.data),this},resetData:function(t){if(this.clearData(),t)for(var e in this.enableData(),t)this.data[e]=t[e];return this},cloneData:function(){return this.data?function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:x(e),i){e.length=t.length;for(var n=0,s=t.length;n<s;n++)e[n]=t[n]}else for(var r in t)e[r]=t[r];return e}(this.data):{}}},P=Phaser.Math.DegToRad,T=Phaser.Math.RadToDeg,E=Phaser.Utils.Objects.GetValue,O=function(){function i(t,e){d(this,i),this.setParent(t),this.type=e,this.setActive().setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setDrawBelowCallback().setDrawAboveCallback(),this.originX=0,this.offsetX=0,this.offsetY=0}return h(i,[{key:"setParent",value:function(t){return this.parent=t,this}},{key:"scene",get:function(){return this.parent.scene}},{key:"canvas",get:function(){return this.parent?this.parent.canvas:null}},{key:"context",get:function(){return this.parent?this.parent.context:null}},{key:"setDirty",value:function(t){return t&&this.parent&&(this.parent.dirty=!0),this}},{key:"active",get:function(){return this._active},set:function(t){this.setDirty(this._active!=t),this._active=t}},{key:"setActive",value:function(t){return void 0===t&&(t=!0),this.active=t,this}},{key:"visible",get:function(){return this._visible},set:function(t){this.setDirty(this._visible!=t),this._visible=t}},{key:"setVisible",value:function(t){return void 0===t&&(t=!0),this.visible=t,this}},{key:"alpha",get:function(){return this._alpha},set:function(t){this.setDirty(this._alpha!=t),this._alpha=t}},{key:"setAlpha",value:function(t){return this.alpha=t,this}},{key:"x",get:function(){return this._x},set:function(t){this.setDirty(this._x!=t),this._x=t}},{key:"setX",value:function(t){return this.x=t,this}},{key:"y",get:function(){return this._y},set:function(t){this.setDirty(this._y!=t),this._y=t}},{key:"setY",value:function(t){return this.y=t,this}},{key:"setPosition",value:function(t,e){return this.x=t,this.y=e,this}},{key:"rotation",get:function(){return this._rotation},set:function(t){this.setDirty(this._rotation!=t),this._rotation=t}},{key:"setRotation",value:function(t){return this.rotation=t,this}},{key:"angle",get:function(){return T(this._rotation)},set:function(t){this.rotation=P(t)}},{key:"setAngle",value:function(t){return this.angle=t,this}},{key:"scaleX",get:function(){return this._scaleX},set:function(t){this.setDirty(this._scaleX!==t),this._scaleX=t}},{key:"setScaleX",value:function(t){return this.scaleX=t,this}},{key:"width",get:function(){return 0},set:function(){}},{key:"setWidth",value:function(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}},{key:"leftSpace",get:function(){return this._leftSpace},set:function(t){this.setDirty(this._leftSpace!==t),this._leftSpace=t}},{key:"setLeftSpace",value:function(t){return this.leftSpace=t,this}},{key:"rightSpace",get:function(){return this._rightSpace},set:function(t){this.setDirty(this._rightSpace!==t),this._rightSpace=t}},{key:"setRightSpace",value:function(t){return this.rightSpace=t,this}},{key:"outerWidth",get:function(){return this.width+this.leftSpace+this.rightSpace}},{key:"scaleY",get:function(){return this._scaleY},set:function(t){this.setDirty(this._scaleY!==t),this._scaleY=t}},{key:"setScaleY",value:function(t){return this.scaleY=t,this}},{key:"height",get:function(){return 0},set:function(){}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"setScale",value:function(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}},{key:"modifyPorperties",value:function(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=E(t,"width",void 0),i=E(t,"height",void 0),n=E(t,"scaleX",void 0),s=E(t,"scaleY",void 0);return void 0!==e&&(void 0===i&&void 0===s?this.setWidth(e,!0):this.setWidth(e)),void 0!==i&&(void 0===e&&void 0===n?this.setHeight(i,!0):this.setHeight(i)),void 0!==n&&void 0===e&&this.setScaleX(n),void 0!==s&&void 0===i&&this.setScaleY(s),t.hasOwnProperty("leftSpace")&&this.setLeftSpace(t.leftSpace),t.hasOwnProperty("rightSpace")&&this.setLeftSpace(t.rightSpace),this}},{key:"setOrigin",value:function(t){return this.originX=t,this}},{key:"setDrawBelowCallback",value:function(t){return this.drawBelowCallback=t,this}},{key:"setDrawAboveCallback",value:function(t){return this.drawAboveCallback=t,this}},{key:"onFree",value:function(){this.setParent().setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setLeftSpace(0).setRightSpace(0).setOrigin(0).setDrawBelowCallback().setDrawAboveCallback()}},{key:"drawContent",value:function(){}},{key:"draw",value:function(){var t=this.context;t.save();var e=this.x+this.leftSpace+this.offsetX-this.originX*this.width,i=this.y+this.offsetY;this.autoRound&&(e=Math.round(e),i=Math.round(i)),t.translate(e,i),t.globalAlpha=this.alpha,t.scale(this.scaleX,this.scaleY),t.rotate(this.rotation),this.drawBelowCallback&&this.drawBelowCallback.call(this),this.drawContent(),this.drawAboveCallback&&this.drawAboveCallback.call(this),t.restore()}}]),i}();Object.assign(O.prototype,S);function _(t,e,i){if(null==t)return t;switch(l(t)){case"string":return t;case"number":return"#".concat(L(Math.floor(t).toString(16),6,"0",1));case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?"rgba(".concat(t.r,",").concat(t.g,",").concat(t.b,",").concat(t.a,")"):"rgb(".concat(t.r,",").concat(t.g,",").concat(t.b,")"):t.hasOwnProperty("h")?t.hasOwnProperty("a")?"hsla(".concat(t.h,",").concat(t.s,",").concat(t.l,",").concat(t.a,")"):"hsl(".concat(t.h,",").concat(t.s,",").concat(t.l,")"):t;default:return t}}function M(t,e,i,n,s,r,a,o,h,u,c,l,f){var d,p,v,g,y,m,k,b,w,x,S,P,T,E,O,_,M;if(d=e,m=f,P=new I(p=i,v=n,g=s,y=r,a),T=P.minWidth,E=P.minHeight,O=T<=g?1:g/T,_=E<=y?1:y/E,M=P.cornerRadius,d.save(),d.beginPath(),d.translate(p,v),x=g-(b=(k=M.br).x*O),S=y-(w=k.y*_),d.moveTo(g,S),0<b&&0<w?K(d,x,S,b,w,H,N,m):(d.lineTo(g,y),d.lineTo(x,y)),x=b=(k=M.bl).x*O,S=y-(w=k.y*_),d.lineTo(b,y),0<b&&0<w?K(d,x,S,b,w,N,J,m):(d.lineTo(0,y),d.lineTo(0,S)),x=b=(k=M.tl).x*O,S=w=k.y*_,d.lineTo(0,S),0<b&&0<w?K(d,x,S,b,w,J,$,m):(d.lineTo(0,0),d.lineTo(x,0)),x=g-(b=(k=M.tr).x*O),S=w=k.y*_,d.lineTo(x,0),0<b&&0<w?K(d,x,S,b,w,$,H,m):(d.lineTo(g,0),d.lineTo(g,S)),d.closePath(),d.restore(),null!=o){var C;if(null!=c)(C=l?e.createLinearGradient(0,0,s,0):e.createLinearGradient(0,0,0,r)).addColorStop(0,o),C.addColorStop(1,c),o=C;e.fillStyle=o,e.fill()}null!=h&&0<u&&(e.strokeStyle=h,e.lineWidth=u,e.stroke())}function C(t,e,i){return e.hasOwnProperty(t)?e[t]:i[t]}function D(t){var e=t.type;return e===st||e===rt}function F(t){return t.type===st&&"\n"===t.text}function R(t,e){e&&this.textStyle.modify(e);for(var i=this.lastAppendedChildren.length=0,n=t.length;i<n;i++){var s=t.charAt(i),r=this.poolManager.allocate(st);null===r?r=new ot(this,s,this.textStyle):r.setParent(this).setActive().modifyStyle(this.textStyle).setText(s),this.children.push(r),this.lastAppendedChildren.push(r)}return this}function j(t,e,i){var n=this.poolManager.allocate(rt);return null===n?n=new ht(this,t,e):n.setParent(this).setActive().setTexture(t,e),n.modifyPorperties(i),this.lastAppendedChildren.length=0,this.children.push(n),this.lastAppendedChildren.push(n),this}function G(t,e,i,n){var s=this.poolManager.allocate(at);return null===s?s=new ut(this,t,e,i,n):s.setParent(this).setActive().setName(t).setCallback(e,n).setParameter(i),this.lastAppendedChildren.length=0,this.children.push(s),this.lastAppendedChildren.push(s),this}function A(t,e){if(!e)return t;for(var i in null==t&&(t={}),e)t.hasOwnProperty(i)||(t[i]=e[i]);return t}function V(t,e,i,n){void 0===n&&(n={word:[],width:0}),n.word.length=0;for(var s=t.length,r=e,a=n.word,o=0;r<s;){var h=t[r];if(h.type!==st||" "===h.text||"\n"===h.text){r===e&&(a.push(h),o+=h.outerWidth);break}if(a.push(h),o+=h.outerWidth,r++,i)break}return n.width=o,n}function B(t){var e,i=ft(t,"start",0),n=ft(t,"padding.top",0),s=ft(t,"padding.bottom",0),r=ft(t,"lineHeight",void 0);if(void 0===r)e=ft(t,"maxLines",0),r=0<this.fixedHeight?(a=this.fixedHeight-this.padding.top-this.padding.bottom-n-s)/e:0;else if(0<this.fixedHeight){if(void 0===(e=ft(t,"maxLines",void 0))){var a=this.fixedHeight-this.padding.top-this.padding.bottom-n-s;e=Math.floor(a/r)}}else e=ft(t,"maxLines",0);var o=0===e,h=ft(t,"wrapWidth",void 0);void 0===h&&(h=0<this.fixedWidth?this.fixedWidth-this.padding.left-this.padding.right:1/0);for(var u=ft(t,"letterSpacing",0),c=ft(t,"hAlign",0),l=ft(t,"vAlign",0),f=ft(t,"charWrap",!1),d={start:i,isLastPage:!1,padding:{top:n,bottom:s},lineHeight:r,maxLines:e,wrapWidth:h,letterSpacing:u,hAlign:c,vAlign:l,charWrap:f,children:[],lines:[],maxLineWidth:0,linesHeight:0},p=this.children,v=0,g=p.length;v<g;v++)p[v].setActive(!1);h+=u;for(var y,m=this.padding.left,k=m,b=this.padding.top+r+n,w=h,x=i,S=p.length,P=d.children,T=d.lines,E=[],O=0,_=0;x<S;){var M=p[x];if(D(M)){var C=(y=V(p,x,f,y)).word,R=C.length,j=y.width+R*u;x+=R;var G=F(C[0]);if(w<j||G){if(G)(A=C[0]).setActive().setPosition(k,b),P.push(A),E.push(A);if(k=m,b+=r,w=h,T.push({children:E,width:O}),_=Math.max(_,O),O=0,E=[],!o&&T.length===e)break;if(G)continue}w-=j,O+=j;for(v=0,g=C.length;v<g;v++){var A;(A=C[v]).setActive().setPosition(k,b),P.push(A),E.push(A),k+=A.outerWidth+u}}else x++,M.setActive(),P.push(M),E.push(M)}0<E.length&&(T.push({children:E,width:O}),_=Math.max(_,O)),d.start+=P.length,d.isLastPage=d.start===S,d.maxLineWidth=_,d.linesHeight=T.length*r+n+s;var B=0<this.fixedWidth?this.fixedWidth:d.maxLineWidth+this.padding.left+this.padding.right,W=0<this.fixedHeight?this.fixedHeight:d.linesHeight+this.padding.top+this.padding.bottom;return function(t,e,i){var n=t.hAlign,s=t.vAlign;if("string"==typeof n&&(n=ct[n],t.hAlign=n),"string"==typeof s&&(s=lt[s],t.vAlign=s),0!==n)for(var r=t.lines,a=0,o=r.length;a<o;a++){var h,u=r[a],c=u.width,l=u.children;switch(n){case 1:h=(e-c)/2;break;case 2:h=e-c}for(var f=0,d=l.length;f<d;f++){l[f].x+=h}}if(0!==s){var p,v=t.linesHeight;switch(s){case 1:p=(i-v)/2;break;case 2:p=i-v}for(f=0,d=(l=t.children).length;f<d;f++){l[f].y+=p}}}(d,B-this.padding.left-this.padding.right,a=W-this.padding.top-this.padding.bottom-n-s),this.setSize(B,W),d}function W(t){var e,i=dt(t,"start",0),n=dt(t,"padding.top",0),s=dt(t,"padding.bottom",0),r=dt(t,"padding.left",0),a=dt(t,"padding.right",0),o=dt(t,"lineWidth",void 0);if(void 0===o)e=dt(t,"maxLines",0),o=0<this.fixedWidth?(h=this.fixedWidth-this.padding.left-this.padding.right-r-a)/e:0;else if(0<this.fixedWidth){if(void 0===(e=dt(t,"maxLines",void 0))){var h=this.fixedWidth-this.padding.left-this.padding.right;e=Math.floor(h/o)}}else e=dt(t,"maxLines",0);var u=0===e,c=dt(t,"fixedChildHeight",void 0);if(void 0===c){var l=dt(t,"charPerLine",void 0);if(void 0!==l){var f=this.fixedHeight-this.padding.top-this.padding.bottom-n-s;c=Math.floor(f/l)}}var d=dt(t,"wrapHeight",void 0);void 0===d&&(d=0<this.fixedHeight?this.fixedHeight-this.padding.top-this.padding.bottom:1/0);for(var p=dt(t,"letterSpacing",0),v=dt(t,"rtl",!0),g={start:i,isLastPage:!1,padding:{top:n,bottom:s,left:r,right:a},lineWidth:o,maxLines:e,fixedChildHeight:c,wrapHeight:d,letterSpacing:p,hAlign:dt(t,"hAlign",v?2:0),vAlign:dt(t,"vAlign",0),rtl:v,children:[],lines:[],maxLineHeight:0,linesWidth:0},y=this.children,m=0,k=y.length;m<k;m++)y[m].setActive(!1);d+=p;for(var b=this.padding.left+r,w=this.padding.top+n,x=b,S=w,P=d,T=i,E=y.length,O=g.children,_=g.lines,M=[],C=0,R=0;T<E;){var j=y[T];if(T++,D(j)){var G=(void 0!==c?c:j.height)+p,A=F(j);if(P<G||A){if(A&&(j.setActive().setPosition(x,S).setOrigin(.5),O.push(j),M.push(j)),x=b,S=w,P=d,_.push({children:M,height:C}),R=Math.max(R,C),C=0,M=[],!u&&_.length===e)break;if(A)continue}P-=G,C+=G,j.setActive().setPosition(x,S).setOrigin(.5),O.push(j),M.push(j),S+=G}else j.setActive(),O.push(j),M.push(j)}0<M.length&&(_.push({children:M,height:C}),R=Math.max(R,C)),g.start+=O.length,g.isLastPage=g.start===E,g.maxLineHeight=R,g.linesWidth=_.length*o+r+a;var B=0<this.fixedWidth?this.fixedWidth:g.linesWidth+this.padding.left+this.padding.right,W=0<this.fixedHeight?this.fixedHeight:g.maxLineHeight+this.padding.top+this.padding.bottom;return function(t,e,i){var n=t.hAlign,s=t.vAlign;"string"==typeof n&&(n=ct[n],t.hAlign=n),"string"==typeof s&&(s=lt[s],t.vAlign=s);var r,a=t.rtl,o=t.lines,h=t.lineWidth,u=t.linesWidth;switch(n){case 0:r=0;break;case 1:r=(e-u)/2;break;case 2:r=e-u}a&&(r+=h);for(var c=0,l=o.length;c<l;c++){var f,d=o[a?l-c-1:c],p=d.children,v=d.height;switch(s){case 0:f=0;break;case 1:f=(i-v)/2;break;case 2:f=i-v}for(var g=0,y=p.length;g<y;g++){var m=p[g];m.x+=r,m.y+=f}r+=h}}(g,h=B-this.padding.left-this.padding.right-r-a,f=W-this.padding.top-this.padding.bottom-n-s),this.setSize(B,W),g}var L=Phaser.Utils.String.Pad,U=Phaser.Utils.Objects.GetValue,I=function(){function r(t,e,i,n,s){d(this,r),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,n,s)}return h(r,[{key:"setTo",value:function(t,e,i,n,s){return this.setPosition(t,e),this.setRadius(s),this.setSize(i,n),this}},{key:"setPosition",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this}},{key:"setRadius",value:function(t){return void 0===t&&(t=0),this.radius=t,this}},{key:"setSize",value:function(t,e){return this.width=t,this.height=e,this}},{key:"minWidth",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}},{key:"minHeight",get:function(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}},{key:"width",get:function(){return this._width},set:function(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}},{key:"height",get:function(){return this._height},set:function(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}},{key:"radius",get:function(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)},set:function(t){var e,i;i="number"==typeof t?e=t:(e=U(t,"x",0),U(t,"y",0));var n=this.cornerRadius;n.tl=z(U(t,"tl",void 0),e,i),n.tr=z(U(t,"tr",void 0),e,i),n.bl=z(U(t,"bl",void 0),e,i),n.br=z(U(t,"br",void 0),e,i)}},{key:"radiusTL",get:function(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)},set:function(t){Y(this.cornerRadius.tl,t)}},{key:"radiusTR",get:function(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)},set:function(t){Y(this.cornerRadius.tr,t)}},{key:"radiusBL",get:function(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)},set:function(t){Y(this.cornerRadius.bl,t)}},{key:"radiusBR",get:function(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)},set:function(t){Y(this.cornerRadius.br,t)}}]),r}(),z=function(t,e,i){return void 0===t?{x:e,y:i}:"number"==typeof t?{x:t,y:t}:t},Y=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=U(e,"x",0),t.y=U(e,"y",0))},X=Phaser.Math.DegToRad,H=X(0),N=X(90),J=X(180),$=X(270),K=function(t,e,i,n,s,r,a,o){if(null==o)t.ellipse(e,i,n,s,0,r,a);else for(var h,u,c,l=(a-r)/(o+=1),f=0;f<=o;f++)c=r+l*f,h=e+n*Math.cos(c),u=i+s*Math.sin(c),t.lineTo(h,u)},Z=Phaser.Utils.Objects.GetValue,q=function(){u(s,O);var n=g(s);function s(t,e){var i;return d(this,s),(i=n.call(this,t,"background")).setColor(Z(e,"color",null),Z(e,"color2",null),Z(e,"horizontalGradient",!0)),i.setStroke(Z(e,"stroke",null),Z(e,"strokeThickness",2)),i.setCornerRadius(Z(e,"cornerRadius",0),Z(e,"cornerIteration",null)),i}return h(s,[{key:"color",get:function(){return this._color},set:function(t){t=_(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}},{key:"color2",get:function(){return this._color2},set:function(t){t=_(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=_(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}},{key:"setStroke",value:function(t,e){return this.stroke=t,this.strokeThickness=e,this}},{key:"cornerRadius",get:function(){return this._cornerRadius},set:function(t){this.setDirty(this._cornerRadius!=t),this._cornerRadius=t}},{key:"cornerIteration",get:function(){return this._cornerIteration},set:function(t){this.setDirty(this._cornerIteration!=t),this._cornerIteration=t}},{key:"setCornerRadius",value:function(t,e){return this.cornerRadius=t,this.cornerIteration=e,this}},{key:"drawContent",value:function(){!function(t,e,i,n,s,r,a,o){if(null!=e||null!=i){var h=t.canvas.width,u=t.canvas.height;null==i&&(n=0);var c=n/2;h-=n,u-=n,M(t.canvas,t.context,c,c,h,u,s,e,i,n,r,a,o)}}(this.parent,this.color,this.stroke,this.strokeThickness,this.cornerRadius,this.color2,this.horizontalGradient,this.cornerIteration)}}]),s}(),Q=Phaser.Utils.Objects.GetValue,tt=function(){u(s,O);var n=g(s);function s(t,e){var i;return d(this,s),(i=n.call(this,t,"background")).setColor(Q(e,"color",null),Q(e,"color2",null),Q(e,"horizontalGradient",!0)),i.setStroke(Q(e,"stroke",null),Q(e,"strokeThickness",2)),i}return h(s,[{key:"color",get:function(){return this._color},set:function(t){t=_(t,this.canvas,this.context),this.setDirty(this._color!=t),this._color=t}},{key:"color2",get:function(){return this._color2},set:function(t){t=_(t,this.canvas,this.context),this.setDirty(this._color2!=t),this._color2=t}},{key:"horizontalGradient",get:function(){return this._horizontalGradient},set:function(t){this.setDirty(this._horizontalGradient!=t),this._horizontalGradient=t}},{key:"setColor",value:function(t,e,i){return void 0===i&&(i=!0),this.color=t,this.color2=e,this.horizontalGradient=i,this}},{key:"stroke",get:function(){return this._stroke},set:function(t){t=_(t,this.canvas,this.context),this.setDirty(this._stroke!=t),this._stroke=t}},{key:"strokeThickness",get:function(){return this._strokeThickness},set:function(t){this.setDirty(this._strokeThickness!=t),this._strokeThickness=t}},{key:"setStroke",value:function(t,e){return this.stroke=t,this.strokeThickness=e,this}},{key:"drawContent",value:function(){var t=this.parent.padding,e=t.left,i=t.top,n=this.parent.width-t.left-t.right,s=this.parent.height-t.top-t.bottom,r=this.context;if(null!=this.color){var a,o;if(null!=this.color2)(o=this.horizontalGradient?r.createLinearGradient(0,0,n,0):r.createLinearGradient(0,0,0,s)).addColorStop(0,this.color),o.addColorStop(1,this.color2),a=o;else a=this.color;r.fillStyle=a,r.fillRect(e,i,n,s)}null!=this.stroke&&0<this.strokeThickness&&(r.strokeStyle=this.stroke,r.lineWidth=this.strokeThickness,r.strokeRect(e,i,n,s))}}]),s}(),et=Phaser.Utils.Objects.GetValue,it=function(){function e(t){d(this,e),this.set(t)}return h(e,[{key:"toJSON",value:function(){return{bold:this.bold,italic:this.italic,fontSize:this.fontSize,fontFamily:this.fontFamily,color:this.color,stroke:this.stroke,strokeThickness:this.strokeThickness,shaodwColor:this.shadowColor,shadowBlur:this.shadowBlur,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,offsetX:this.offsetX,offsetY:this.offsetY}}},{key:"set",value:function(t){this.setBold(et(t,"bold",!1)),this.setItalic(et(t,"italic",!1)),this.setFontSize(et(t,"fontSize","16px")),this.setFontFamily(et(t,"fontFamily","Courier")),this.setColor(et(t,"color","#fff")),this.setStrokeStyle(et(t,"stroke",null),et(t,"strokeThickness",0)),this.setShadow(et(t,"shadowColor",null),et(t,"shadowOffsetX",0),et(t,"shadowOffsetY",0),et(t,"shadowBlur",0)),this.setOffset(et(t,"offsetX",0),et(t,"offsetY",0))}},{key:"modify",value:function(t){return t.hasOwnProperty("bold")&&this.setBold(t.bold),t.hasOwnProperty("italic")&&this.setItalic(t.italic),t.hasOwnProperty("fontSize")&&this.setFontSize(t.fontSize),t.hasOwnProperty("fontFamily")&&this.setFontFamily(t.fontFamily),t.hasOwnProperty("color")&&this.setColor(t.color),(t.hasOwnProperty("stroke")||t.hasOwnProperty("strokeThickness"))&&this.setStrokeStyle(C("stroke",t,this),C("strokeThickness",t,this)),t.hasOwnProperty("shadowColor")&&this.setShadowColor(t.shadowColor),(t.hasOwnProperty("shadowOffsetX")||t.hasOwnProperty("shadowOffsetY"))&&this.setShadowOffset(C("shadowOffsetX",t,this),C("shadowOffsetY",t,this)),t.hasOwnProperty("shadowBlur")&&this.setShadowBlur(t.shaodwBlur),t.hasOwnProperty("offsetX")&&this.setOffsetX(t.offsetX),t.hasOwnProperty("offsetY")&&this.setOffsetY(t.offsetY),this}},{key:"setBold",value:function(t){return void 0===t&&(t=!0),this.bold=t,this}},{key:"setItalic",value:function(t){return void 0===t&&(t=!0),this.italic=t,this}},{key:"fontStyle",get:function(){return this.bold&&this.italic?"bold italic":this.bold?"bold":this.italic?"italic":""}},{key:"setFontSize",value:function(t){return"number"==typeof t&&(t="".concat(t,"px")),this.fontSize=t,this}},{key:"setFontFamily",value:function(t){return this.fontFamily=t,this}},{key:"font",get:function(){return"".concat(this.fontStyle," ").concat(this.fontSize," ").concat(this.fontFamily)}},{key:"setColor",value:function(t){return this.color=_(t),this}},{key:"hasFill",get:function(){return null!=this.color}},{key:"setStrokeStyle",value:function(t,e){return this.stroke=_(t),void 0!==e&&(this.strokeThickness=e),this}},{key:"setStrokeThickness",value:function(t){return this.strokeThickness=t,this}},{key:"hasStroke",get:function(){return null!=this.stroke&&0<this.strokeThickness}},{key:"setShadowColor",value:function(t){return this.shadowColor=_(t),this}},{key:"setShadowOffset",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.shadowOffsetX=t,this.shadowOffsetY=e,this}},{key:"setShadowBlur",value:function(t){return void 0===t&&(t=0),this.shaodwBlur=t,this}},{key:"setShadow",value:function(t,e,i,n){return this.setShadowColor(t).setShadowOffset(e,i).setShadowBlur(n),this}},{key:"setOffsetX",value:function(t){return void 0===t&&(t=0),this.offsetX=t,this}},{key:"setOffsetY",value:function(t){return void 0===t&&(t=0),this.offsetY=t,this}},{key:"setOffset",value:function(t,e){return this.setOffsetX(t).setOffsetY(e),this}},{key:"syncFont",value:function(t){return t.font=this.font,this}},{key:"syncStyle",value:function(t){t.textBaseline="alphabetic";var e=this.hasFill,i=this.hasStroke;return t.fillStyle=e?this.color:"#000",t.strokeStyle=i?this.stroke:"#000",t.lineWidth=i?this.strokeThickness:0,t.lineCap="round",t.lineJoin="round",this}},{key:"syncShadow",value:function(t){null!=t.shadowColor?(t.shadowColor=this.shadowColor,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowBlur=this.shadowBlur):(t.shadowColor=0,t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0)}},{key:"getTextMetrics",value:function(t,e){return this.syncFont(t).syncStyle(t),t.measureText(e)}}]),e}(),nt=Phaser.Utils.Objects.GetValue,st="text",rt="image",at="command",ot=function(){u(r,O);var s=g(r);function r(t,e,i){var n;return d(this,r),(n=s.call(this,t,st)).style=new it(i),n.setText(e),n}return h(r,[{key:"autoRound",get:function(){return this.parent.autoRound}},{key:"offsetX",get:function(){return this.style.offsetX},set:function(){}},{key:"offsetY",get:function(){return this.style.offsetY},set:function(){}},{key:"modifyStyle",value:function(t){return this.setDirty(!0),this.style.modify(t),this}},{key:"modifyPorperties",value:function(t){return t&&(this.modifyStyle(t),y(p(r.prototype),"modifyPorperties",this).call(this,t)),this}},{key:"setText",value:function(t){return this.setDirty(this.text!=t),this.text=t,this.updateTextSize(),this}},{key:"updateTextSize",value:function(){if("\n"===this.text||""===this.text)this.textWidth=0,this.textHeight=0;else{var t,e,i=this.style.getTextMetrics(this.context,this.text);this.textWidth=i.width,e=i.hasOwnProperty("actualBoundingBoxAscent")?(t=i.actualBoundingBoxAscent,i.actualBoundingBoxDescent):t=0,this.textHeight=t+e}return this}},{key:"width",get:function(){return this.textWidth*this.scaleX},set:function(t){0<this.textWidth?this.scaleX=t/this.textWidth:this.scaleX=1}},{key:"height",get:function(){return this.textHeight*this.scaleY},set:function(t){0<this.textHeight?this.scaleY=t/this.textHeight:this.scaleY=1}},{key:"drawContent",value:function(){var t=this.style,e=t.hasFill,i=t.hasStroke;if(e||i){var n=this.context;t.syncFont(n).syncStyle(n),i&&(t.syncShadow(n),n.strokeText(this.text,0,0)),e&&(t.syncShadow(n),n.fillText(this.text,0,0))}}},{key:"draw",value:function(){if(!this.visible||""===this.text||"\n"===this.text)return this;y(p(r.prototype),"draw",this).call(this)}}]),r}(),ht=function(){u(r,O);var s=g(r);function r(t,e,i){var n;return d(this,r),(n=s.call(this,t,rt)).setTexture(e,i),n}return h(r,[{key:"frameWidth",get:function(){return this.frameObj?this.frameObj.cutWidth:0}},{key:"frameHeight",get:function(){return this.frameObj?this.frameObj.cutHeight:0}},{key:"offsetY",get:function(){return-this.height},set:function(){}},{key:"key",get:function(){return this._key},set:function(t){this.setDirty(this._key!=t),this._key=t}},{key:"frame",get:function(){return this._frame},set:function(t){this.setDirty(this._frame!=t),this._frame=t}},{key:"setTexture",value:function(t,e){return this.key=t,this.frame=e,this.frameObj=this.scene.textures.getFrame(t,e),this}},{key:"width",get:function(){return this.frameWidth*this.scaleX},set:function(t){this.setDirty(this.width!==t),this.scaleX=t/this.frameWidth}},{key:"height",get:function(){return this.frameHeight*this.scaleY},set:function(t){this.setDirty(this.height!==t),this.scaleY=t/this.frameHeight}},{key:"setHeight",value:function(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}},{key:"drawContent",value:function(){var t=this.context,e=this.frameObj;t.drawImage(e.source.image,e.cutX,e.cutY,e.cutWidth,e.cutHeight)}},{key:"draw",value:function(){if(!this.visible)return this;y(p(r.prototype),"draw",this).call(this)}}]),r}(),ut=function(){u(o,O);var a=g(o);function o(t,e,i,n,s){var r;return d(this,o),(r=a.call(this,t,at)).setName(e).setParameter(n).setCallback(i,s),r}return h(o,[{key:"setName",value:function(t){return this.name=t,this}},{key:"setParameter",value:function(t){return this.param=t,this}},{key:"setCallback",value:function(t,e){return this.callback=t,this.scope=e,this}},{key:"exec",value:function(){return this.scope?this.callback.call(this.scope,this.param,this.name):this.callback(this.param,this.name)}},{key:"draw",value:function(){}},{key:"onFree",value:function(){y(p(o.prototype),"onFree",this).call(this),this.setName().setCallback().setParameter()}}]),o}(),ct={left:0,center:1,right:2},lt={top:0,center:1,bottom:2},ft=Phaser.Utils.Objects.GetValue,dt=Phaser.Utils.Objects.GetValue,pt=Phaser.Utils.Array.GetAll,vt={setPadding:function(t,e){var i,n,s,r,a=this.padding,o=a.left,h=a.right,u=a.top,c=a.bottom;return i=this.padding,s=e,"string"===(r=l(n=t))?i[n]=s:"number"===r?(i.left=n,i.right=n,i.top=n,i.bottom=n):(i.left=nt(n,"left",0),i.right=nt(n,"right",0),i.top=nt(n,"top",0),i.bottom=nt(n,"bottom",0)),this.dirty=this.dirty||o!=this.padding.left||h!=this.padding.right||u!=this.padding.top||c!=this.padding.bottom,this},getPadding:function(t){return e=this.padding,void 0===(i=t)?e:e[i];var e,i},modifyTextStyle:function(t){return this.textStyle.modify(t),this},removeChildren:function(){return this.poolManager.freeMultiple(this.children),this.children.length=0,this.lastAppendedChildren.length=0,this.dirty=!0,this},clearContent:function(){return this.setText(),this},setText:function(t,e){return void 0===t&&(t=""),this.removeChildren(),R.call(this,t,e),this.dirty=!0,this},appendText:R,appendImage:j,appendCommand:G,setWrapConfig:function(t){return this.wrapConfig=t,this},runWordWrap:function(t){return t=A(t,this.wrapConfig),B.call(this,t)},runVerticalWrap:function(t){return t=A(t,this.wrapConfig),W.call(this,t)},drawContent:function(){var t,e=0<this.fixedWidth?this.fixedWidth:this.width,i=0<this.fixedHeight?this.fixedHeight:this.height;this.setSize(e,i),this.background.active&&this.background.draw();for(var n=0,s=this.children.length;n<s;n++)(t=this.children[n]).active&&t.draw();this.innerBounds.active&&this.innerBounds.draw()},getChildren:function(){return this.children},getLastAppendedChildren:function(){return this.lastAppendedChildren},getActiveChildren:function(){return pt(this.children,"active",!0)}},gt=function(){function t(){d(this,t),this.items=[]}return h(t,[{key:"destroy",value:function(){this.clear(),this.items=void 0}},{key:"pop",value:function(){return 0<this.items.length?this.items.pop():null}},{key:"push",value:function(t){return this.items.push(t),this}},{key:"pushMultiple",value:function(t){return this.items.push.apply(this.items,t),t.length=0,this}},{key:"clear",value:function(){return this.items.length=0,this}}]),t}(),yt=Phaser.Utils.Objects.GetFastValue,mt={},kt=function(){function e(t){d(this,e),this.pools=yt(t,"pools",mt)}return h(e,[{key:"free",value:function(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new gt),this.pools[e].push(t),t.onFree(),this}},{key:"freeMultiple",value:function(t){if(!this.pools)return this;for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}},{key:"allocate",value:function(t){return this.pools&&this.pools.hasOwnProperty(t)?this.pools[t].pop():null}}]),e}(),bt=Phaser.Utils.Objects.IsPlainObject,wt=Phaser.Utils.Objects.GetValue,xt=function(){u(l,o);var c=g(l);function l(t,e,i,n,s,r){var a;d(this,l),bt(e)?(e=wt(r=e,"x",0),i=wt(r,"y",0),n=wt(r,"width",0),s=wt(r,"height",0)):bt(n)&&(n=wt(r=n,"width",0),s=wt(r,"height",0));var o=0===n?1:n,h=0===s?1:s;(a=c.call(this,t,e,i,o,h)).type="rexDynamicText",a.autoRound=!0,a.padding={},a.textStyle=new it(wt(r,"style",void 0)),a.background=new q(v(a),wt(r,"background",void 0)),a.innerBounds=new tt(v(a),wt(r,"innerBounds",void 0)),a.children=[],a.lastAppendedChildren=[],a.poolManager=new kt(r),a.setFixedSize(n,s),a.setPadding(wt(r,"padding",0)),a.setWrapConfig(wt(r,"wrap",void 0));var u=wt(r,"text",void 0);return u&&a.setText(u),a}return h(l,[{key:"setFixedSize",value:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),0<t&&0<e&&this.fixedWidth===t&&this.fixedHeight===e||(this.dirty=!0),this.fixedWidth=t,this.fixedHeight=e,this}},{key:"updateTexture",value:function(){return this.clear(),this.drawContent(),y(p(l.prototype),"updateTexture",this).call(this),this}}]),l}();Object.assign(xt.prototype,vt);function St(t){return t.replace(Ot,"\\$&").replace(_t,"\\x2d")}function Pt(t){return"string"!=typeof t||(""===t?t=null:Mt.test(t)?t=parseFloat(t):"false"===t?t=!1:"true"===t&&(t=!0)),t}function Tt(t){return t}var Et={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},Ot=/[|\\{}()[\]^$+*?.]/g,_t=/-/g,Mt=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,Ct=function(){function i(t){d(this,i),this.setEventEmitter(w(t,"eventEmitter",void 0)),this.setTagExpression(w(t,"regex.tag","[a-z0-9-_.]+")),this.setValueExpression(w(t,"regex.value","[ #a-z-_.0-9,|&]+")),this.setValueConverter(w(t,"valueConvert",!0));var e=w(t,"delimiters","<>");this.setDelimiters(e[0],e[1]),this.isRunning=!1,this.isPaused=!1,this.skipEventFlag=!1,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null}return h(i,[{key:"shutdown",value:function(){this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"setTagExpression",value:function(t){return this.tagExpression=t,this}},{key:"setValueExpression",value:function(t){return this.valueExpression=t,this}},{key:"setValueConverter",value:function(t){return t=!0===t?Pt:t||Tt,this.valueConverter=t,this}},{key:"setDelimiters",value:function(t,e){void 0===e&&(e=t[1],t=t[0]),this.delimiterLeft=t,this.delimiterRight=e,t=St(t),e=St(e);var i="".concat(t,"(").concat(this.tagExpression,")(=(").concat(this.valueExpression,"))?").concat(e),n="".concat(t,"/(").concat(this.tagExpression,")").concat(e);return this.reTagOn=RegExp(i,"i"),this.reTagOff=RegExp(n,"i"),this.reSplit=RegExp("".concat(i,"|").concat(n),"gi"),this}},{key:"setSource",value:function(t){return this.source=t,this}},{key:"resetIndex",value:function(t){return void 0===t&&(t=0),this.progressIndex=t,this.reSplit.lastIndex=t,this.lastTagStart=null,this.lastTagEnd=null,this.lastContent=null,this}},{key:"start",value:function(t){return this.setSource(t).restart(),this}},{key:"restart",value:function(){this.resetIndex().next()}},{key:"next",value:function(){this.isPaused&&this.onResume();var t=this.source,e=t.length;for(0===this.reSplit.lastIndex&&this.onStart();!this.isPaused;){var i=this.reSplit.exec(t);if(!i)return this.progressIndex<e&&this.onContent(t.substring(this.progressIndex,e)),void this.onComplete();var n=i[0],s=this.reSplit.lastIndex-n.length;this.progressIndex<s&&this.onContent(t.substring(this.progressIndex,s)),this.reTagOff.test(n)?this.onTagEnd(n):this.onTagStart(n),this.progressIndex=this.reSplit.lastIndex}}},{key:"skipEvent",value:function(){return this.skipEventFlag=!0,this}},{key:"pause",value:function(){return this.isPaused||this.onPause(),this}},{key:"onContent",value:function(t){this.emit("content",t),this.lastContent=t}},{key:"onTagStart",value:function(t){var e=t.match(this.reTagOn),i=e[1],n=function(t,e){if(null==t)return[];for(var i=t.split(","),n=0,s=i.length;n<s;n++)i[n]=e(i[n]);return i}(e[3],this.valueConverter);this.skipEventFlag=!1,this.emit.apply(this,["+".concat(i)].concat(c(n))),this.skipEventFlag||this.emit.apply(this,["+",i].concat(c(n))),this.lastTagStart=i}},{key:"onTagEnd",value:function(t){var e=t.match(this.reTagOff)[1];this.skipEventFlag=!1,this.emit("-".concat(e)),this.skipEventFlag||this.emit("-",e),this.lastTagEnd=e}},{key:"onStart",value:function(){this.isRunning=!0,this.emit("start",this)}},{key:"onComplete",value:function(){this.isRunning=!1,this.emit("complete",this),this.resetIndex()}},{key:"onPause",value:function(){this.isPaused=!0,this.emit("pause",this)}},{key:"onResume",value:function(){this.isPaused=!1,this.emit("resume",this)}}]),i}();Object.assign(Ct.prototype,Et);function Rt(t){this.typeWriter.setSpeed(t)}function jt(t){this.typeWriter.wait(t)}function Gt(t,e){return 2===t.length&&t[0]===e}function At(t,e){return 3===t.length&&t[0]===e&&"play"===t[2]}function Bt(t,e){var i="tag.".concat(e);null==t?this.emit(i):this.emit.apply(this,[i].concat(c(t)))}function Wt(t){return i=t,n="complete",new Promise(function(t,e){i.once(n,function(){t()})});var i,n}function Dt(t,e,i,n,s){return function(){t.emit(pi,s),e.apply(n,i)}}function Ft(t,e,i,n,s){var r=Dt(t,i,n,s,"custom"),a=e?"wait.".concat(e):"wait";t.emit(a,r)}function Vt(t,e,i,n,s){var r,a,o,h,u,c=Dt(t,i,n,s,"time");t.once(pi,function(){r&&(r.remove(),r=void 0)}),a=e,o=c,r=t.typeWriter.timeline.delayCall(a,o,h,u),t.emit("wait.time",e)}function Lt(t,e,i,n){var s=Dt(t,e,i,n,"click"),r=t.clickEE;t.once(pi,function(){r.off("pointerdown",s,t)}),r.once("pointerdown",s,t),t.emit("wait.click")}function Ut(t,e,i,n,s){var r=Dt(t,i,n,s,"music");e&&(t.once(pi,function(){e.off("complete",r,t)}),e.once("complete",r,t)),t.emit("wait.music",e),e||r()}function It(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 1;default:return}}function zt(e,t,i,n,s){var r,a,o=Dt(e,i,n,s,"camera.".concat(t)),h=e.camera;switch(t){case"camera.fadein":r=h.fadeEffect,a="camerafadeincomplete";break;case"camera.fadeout":r=h.fadeEffect,a="camerafadeoutcomplete";break;case"camera.flash":r=h.flashEffect,a="cameraflashcomplete";break;case"camera.shake":r=h.shakeEffect,a="camerashakecomplete";break;case"camera.zoom":r=h.zoomEffect,a="camerazoomcomplete";break;case"camera.rotate":r=h.rotateToEffect,a="camerarotatecomplete";break;case"camera.scroll":r=h.panEffect,a="camerapancomplete"}r.isRunning?(e.once(pi,function(t){h.off(a,o,e)}),h.once(a,o,e),e.emit("wait.camera",t)):(e.emit("wait.camera",t),o())}function Yt(t,e,i,n,s){var r=Dt(t,i,n,s,"keydown"),a="keydown-".concat(e.toUpperCase()),o=t.scene.input.keyboard;t.once(pi,function(){o.off(a,r,t)}),o.once(a,r,t),t.emit("wait.keydown",e)}function Xt(e,t,i,n,s){var r=Dt(e,i,n,s),a=t.split("."),o=e.spriteManager;switch(a.length){case 1:o.isEmpty?(e.emit("wait.sprite"),r()):(e.once(pi,function(t){o.off("empty",r,e)}),o.once("empty",r,e),e.emit("wait.sprite"));break;case 2:var h=a[1];if(o.has(h)){var u=e.spriteManager.get(h).sprite;e.once(pi,function(){u.off("destroy",r,e)}),u.once("destroy",r,e),e.emit("wait.sprite",h)}else e.emit("wait.sprite",h),r();break;case 3:h=a[1];var c=a[2],l=e.spriteManager.getTweenTask(h,c);l?(e.once(pi,function(){l.off("complete",r,e)}),l.once("complete",r,e),e.emit("wait.sprite",h,c)):(e.emit("wait.sprite",h,c),r())}}function Ht(t,e,i,n,s){for(var r=0,a=(e="string"==typeof e&&1<e.length&&-1!==e.indexOf("|")?e.split("|"):[e]).length;r<a;r++){var o=e[r];if(null==o||"wait"===o)Ft(t,void 0,i,n,s);else if("number"!=typeof o&&isNaN(o))if("click"===o)Lt(t,i,n,s);else if("se"===o){var h=t.soundManager.getLastSoundEffect();Ut(t,h,i,n,s)}else if("bgm"===o){h=t.soundManager.getBackgroundMusic();Ut(t,h,i,n,s)}else yi.hasOwnProperty(o.toUpperCase())?Yt(t,o,i,n,s):It(o)?zt(t,o,i,n,s):("sprite"===(u=o.split("."))[0]&&u.length<=3?Xt:Ft)(t,o,i,n,s);else Vt(t,parseFloat(o),i,n,s)}var u}function Nt(t){return t instanceof ki}var Jt=Phaser.Utils.Objects.GetValue,$t=Phaser.Utils.Objects.GetValue,Kt=Phaser.Utils.Objects.GetValue,Zt=Phaser.Utils.Objects.GetValue,qt=Phaser.Utils.Objects.GetValue,Qt=Phaser.Utils.Objects.GetValue,te=Phaser.Utils.Objects.GetValue,ee=Phaser.Utils.Objects.GetValue,ie=Phaser.Utils.Objects.GetValue,ne=function(t,e){G.call(t,"speed",Rt,e,t)},se=Phaser.Utils.Objects.GetValue,re=function(t){if(!this.skipSoundEffect){var e=t[0],i=t[1];this.soundManager.playSoundEffect(e),i&&this.soundManager.fadeInSoundEffect(i)}},ae=Phaser.Utils.Objects.GetValue,oe=function(t){this.soundManager.fadeInSoundEffect(t)},he=Phaser.Utils.Objects.GetValue,ue=function(t){var e;(e=this.soundManager).fadeOutSoundEffect.apply(e,c(t))},ce=Phaser.Utils.Objects.GetValue,le=function(t){this.soundManager.setSoundEffectVolume(t)},fe=Phaser.Utils.Objects.GetValue,de=function(t){var e=t[0],i=t[1];this.soundManager.playBackgroundMusic(e),i&&this.soundManager.fadeInBackgroundMusic(i)},pe=function(){this.soundManager.stopBackgroundMusic()},ve=Phaser.Utils.Objects.GetValue,ge=function(t){this.soundManager.fadeInBackgroundMusic(t)},ye=Phaser.Utils.Objects.GetValue,me=function(t){var e;(e=this.soundManager).fadeOutBackgroundMusic.apply(e,c(t))},ke=Phaser.Utils.Objects.GetValue,be=function(t){var e;(e=this.soundManager).crossFadeBackgroundMusic.apply(e,c(t))},we=Phaser.Utils.Objects.GetValue,xe=function(){this.soundManager.pauseBackgroundMusic()},Se=function(){this.soundManager.resumeBackgroundMusic()},Pe=Phaser.Utils.Objects.GetValue,Te=function(t){var e;(e=this.camera).fadeIn.apply(e,c(t))},Ee=Phaser.Utils.Objects.GetValue,Oe=function(t){var e;(e=this.camera).fadeOut.apply(e,c(t))},_e=Phaser.Utils.Objects.GetValue,Me=function(t){var e;(e=this.camera).shake.apply(e,c(t))},Ce=Phaser.Utils.Objects.GetValue,Re=function(t){var e;(e=this.camera).flash.apply(e,c(t))},je=Phaser.Utils.Objects.GetValue,Ge=function(t){this.camera.setZoom(t)},Ae=function(t){var e;(e=this.camera).zoomTo.apply(e,c(t))},Be=Phaser.Utils.Objects.GetValue,We=Phaser.Math.DegToRad,De=function(t){this.camera.setRotation(t)},Fe=function(t){var e=t[0],i=t[1],n=t[2];this.camera.rotateTo(e,!1,i,n)},Ve=Phaser.Utils.Objects.GetValue,Le=function(t){var e;(e=this.camera).setScroll.apply(e,c(t))},Ue=function(t){var e=t[0],i=t[1],n=t[2],s=t[3],r=this.camera,a=r.scrollX,o=r.scrollY;r.setScroll(e,i),e+=r.centerX,i+=r.centerY,r.setScroll(a,o),r.pan(e,i,n,s)},Ie=Phaser.Utils.Objects.GetValue,ze=function(t,e){G.call(t,"wait",jt,e,t)},Ye=Phaser.Utils.Objects.GetValue,Xe=function(t){var e;(e=this.spriteManager).add.apply(e,c(t))},He=function(t){this.spriteManager.remove(t)},Ne=Phaser.Utils.Objects.GetValue,Je=function(){this.spriteManager.removeAll()},$e=Phaser.Utils.Objects.GetValue,Ke=function(t){var e;(e=this.spriteManager).setTexture.apply(e,c(t))},Ze=Phaser.Utils.Objects.GetValue,qe=function(t){var e=t[0],i=t[1],n=i.shift();this.spriteManager.playAnimation(e,n),0<i.length&&this.spriteManager.chainAnimation(e,i)},Qe=function(t){this.spriteManager.stopAnimation(t)},ti=Phaser.Utils.Objects.GetValue,ei=function(t){var e;(e=this.spriteManager).chainAnimation.apply(e,c(t))},ii=Phaser.Utils.Objects.GetValue,ni=function(t){this.spriteManager.pauseAnimation(t)},si=Phaser.Utils.Objects.GetValue,ri=function(t){var e;(e=this.spriteManager).setProperty.apply(e,c(t))},ai=Phaser.Utils.Objects.GetValue,oi={to:!0,yoyo:!0},hi=function(t){var e;(e=this.spriteManager).easeProperty.apply(e,c(t))},ui=function(t,e,i){G.call(t,e,Bt,i,t)},ci=Phaser.Utils.Objects.GetValue,li=[function(e,i,t){var n,s=Jt(t,"tags.color","color");i.on("start",function(){n=e.textStyle.color}).on("+".concat(s),function(t){e.textStyle.setColor(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setColor(n),i.skipEvent()}).on("complete",function(){e.textStyle.setColor(n)})},function(e,i,t){var n,s=$t(t,"tags.stroke","stroke");i.on("start",function(){n=e.textStyle.stroke,e.textStyle.setStrokeStyle(null)}).on("+".concat(s),function(t){void 0===t&&(t=n),e.textStyle.setStrokeStyle(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setStrokeStyle(null),i.skipEvent()}).on("complete",function(){e.textStyle.setStrokeStyle(n)})},function(t,e,i){var n=Kt(i,"tags.b","b");e.on("start",function(){t.textStyle.setBold(!1)}).on("+".concat(n),function(){t.textStyle.setBold(!0),e.skipEvent()}).on("-".concat(n),function(){t.textStyle.setBold(!1),e.skipEvent()})},function(t,e,i){var n=Zt(i,"tags.i","i");e.on("start",function(){t.textStyle.setItalic(!1)}).on("+".concat(n),function(){t.textStyle.setItalic(!0),e.skipEvent()}).on("-".concat(n),function(){t.textStyle.setItalic(!1),e.skipEvent()})},function(e,i,t){var n,s=qt(t,"tags.size","size");i.on("start",function(){n=e.textStyle.fontSize}).on("+".concat(s),function(t){e.textStyle.setFontSize(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setFontSize(n),i.skipEvent()}).on("complete",function(){e.textStyle.setFontSize(n)})},function(e,i,t){var n,s=Qt(t,"tags.y","y");i.on("start",function(){n=e.textStyle.offsetY,e.textStyle.setOffsetY(0)}).on("+".concat(s),function(t){void 0===t&&(t=n),e.textStyle.setOffsetY(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setOffsetY(0),i.skipEvent()}).on("complete",function(){e.textStyle.setOffsetY(0)})},function(e,i,t){var n,s=te(t,"tags.shadow","shadow");i.on("start",function(){n=e.textStyle.shadowColor,e.textStyle.setShadowColor(null)}).on("+".concat(s),function(t){void 0===t&&(t=n),e.textStyle.setShadowColor(t),i.skipEvent()}).on("-".concat(s),function(){e.textStyle.setShadowColor(null),i.skipEvent()}).on("complete",function(){e.textStyle.setShadowColor(n)})},function(i,n,t){var e=ee(t,"tags.img","img");n.on("+".concat(e),function(t){var e=i.imageManager.get(t);j.call(i,e.key,e.frame,{width:e.width,hieght:e.height,leftSpace:e.left,rightSpace:e.right}),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(e,i,t){var n,s=ie(t,"tags.speed","speed");i.on("start",function(){n=e.typeWriter.speed}).on("+".concat(s),function(t){ne(e,t),i.skipEvent()}).on("-".concat(s),function(){ne(e,n),i.skipEvent()}).on("complete",function(){e.typeWriter.speed=n})},function(i,n,t){var e=se(t,"tags.se","se");n.on("+".concat(e),function(t,e){G.call(i,"se",re,[t,e],i),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(e,i,t){var n=ae(t,"tags.se.fadein","se.fadein");i.on("+".concat(n),function(t){G.call(e,"se.fadein",oe,t,e),i.skipEvent()}).on("-".concat(n),function(){i.skipEvent()})},function(i,n,t){var e=he(t,"tags.se.fadeout","se.fadeout");n.on("+".concat(e),function(t,e){G.call(i,"se.fadeout",ue,[t,e="stop"===e],i),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(e,i,t){var n=ce(t,"tags.se.volume","se.volume");i.on("+".concat(n),function(t){G.call(e,"se.volume",le,t,e),i.skipEvent()}).on("-".concat(n),function(){i.skipEvent()})},function(i,n,t){var e=fe(t,"tags.bgm","bgm");n.on("+".concat(e),function(t,e){G.call(i,"bgm",de,[t,e],i),n.skipEvent()}).on("-".concat(e),function(){G.call(i,"bgm.stop",pe,void 0,i),n.skipEvent()})},function(e,i,t){var n=ve(t,"tags.bgm.fadein","bgm.fadein");i.on("+".concat(n),function(t){G.call(e,"bgm.fadein",ge,t,e),i.skipEvent()}).on("-".concat(n),function(){i.skipEvent()})},function(i,n,t){var e=ye(t,"tags.bgm.fadeout","bgm.fadeout");n.on("+".concat(e),function(t,e){G.call(i,"bgm.fadeout",me,[t,e],i),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(i,n,t){var e=ke(t,"tags.bgm.cross","bgm.cross");n.on("+".concat(e),function(t,e){G.call(i,"bgm.cross",be,[t,e],i),n.skipEvent()}).on("-".concat(e),function(){n.skipEvent()})},function(t,e,i){var n=we(i,"tags.bgm.pause","bgm.pause");e.on("+".concat(n),function(){G.call(t,"bgm.pause",xe,void 0,t),e.skipEvent()}).on("-".concat(n),function(){G.call(t,"bgm.resume",Se,void 0,t),e.skipEvent()})},function(s,r,t){var e=Pe(t,"tags.camera.fadein","camera.fadein");r.on("+".concat(e),function(t,e,i,n){G.call(s,"camera.fadein",Te,[t,e,i,n],s),r.skipEvent()})},function(s,r,t){var e=Ee(t,"tags.camera.fadeout","camera.fadeout");r.on("+".concat(e),function(t,e,i,n){G.call(s,"camera.fadeout",Oe,[t,e,i,n],s),r.skipEvent()})},function(i,n,t){var e=_e(t,"tags.camera.shake","camera.shake");n.on("+".concat(e),function(t,e){G.call(i,"camera.shake",Me,[t,e],i),n.skipEvent()})},function(s,r,t){var e=Ce(t,"tags.camera.flash","camera.flash");r.on("+".concat(e),function(t,e,i,n){G.call(s,"camera.flash",Re,[t,e,i,n],s),r.skipEvent()})},function(n,s,t){var e=je(t,"tags.camera.zoom","camera.zoom");s.on("+".concat(e),function(t){G.call(n,"camera.zoom",Ge,t,n),s.skipEvent()}).on("+".concat(e,".to"),function(t,e,i){G.call(n,"camera.zoom.to",Ae,[t,e,i],n),s.skipEvent()})},function(n,s,t){var e=Be(t,"tags.camera.rotate","camera.rotate");s.on("+".concat(e),function(t){t=We(t),G.call(n,"camera.rotate",De,t,n),s.skipEvent()}).on("+".concat(e,".to"),function(t,e,i){t=We(t),G.call(n,"camera.rotate.to",Fe,[t,e,i],n),s.skipEvent()})},function(s,r,t){var e=Ve(t,"tags.camera.scroll","camera.scroll");r.on("+".concat(e),function(t,e){G.call(s,"camera.scroll",Le,[t,e],s),r.skipEvent()}).on("+".concat(e,".to"),function(t,e,i,n){G.call(s,"camera.scroll.to",Ue,[t,e,i,n],s),r.skipEvent()})},function(e,i,t){var n=Ie(t,"tags.wait","wait"),s=Ie(t,"tags.click","click");i.on("+".concat(n),function(t){ze(e,t),i.skipEvent()}).on("-".concat(n),function(){i.skipEvent()}).on("+".concat(s),function(){ze(e,"click"),i.skipEvent()}).on("-".concat(s),function(){i.skipEvent()})},function(a,o,t){var h=Ye(t,"sprite","sprite");h&&o.on("+",function(t){if(!o.skipEventFlag){var e=t.split(".");if(Gt(e,h)){for(var i=e[1],n=arguments.length,s=new Array(1<n?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];G.call(a,"sprite.add",Xe,[i].concat(s),a),o.skipEvent()}}}).on("-",function(t){if(!o.skipEventFlag){var e=t.split(".");if(Gt(e,h)){var i=e[1];G.call(a,"sprite.remove",He,i,a),o.skipEvent()}}})},function(e,i,t){var n=Ne(t,"sprite","sprite");n&&i.on("-",function(t){i.skipEventFlag||t===n&&(G.call(e,"sprite.removeall",Je,void 0,e),i.skipEvent())})},function(o,h,t){var u=$e(t,"sprite","sprite");u&&h.on("+",function(t,e,i){if(!h.skipEventFlag){var n=t.split(".");if(r=u,3===(s=n).length&&s[0]===r&&"texture"===s[2]){var s,r,a=n[1];G.call(o,"sprite.texture",Ke,[a,e,i],o),h.skipEvent()}}})},function(r,a,t){var o=Ze(t,"sprite","sprite");o&&a.on("+",function(t){if(!a.skipEventFlag){var e,i=t.split(".");if(At(i,o)){e=i[1];var n=Array.prototype.slice.call(arguments,1);G.call(r,"sprite.play",qe,[e,n],r),a.skipEvent()}}}).on("+",function(t){if(!a.skipEventFlag){var e,i,n,s=t.split(".");if(n=o,3===(i=s).length&&i[0]===n&&"stop"===i[2])e=s[1],G.call(r,"sprite.stop",Qe,e,r),a.skipEvent()}}).on("-",function(t){if(!a.skipEventFlag){var e,i=t.split(".");At(i,o)&&(e=i[1],G.call(r,"sprite.stop",Qe,e,r),a.skipEvent())}})},function(a,o,t){var h=ti(t,"sprite","sprite");h&&o.on("+",function(t){if(!o.skipEventFlag){var e,i=t.split(".");if(s=h,3===(n=i).length&&n[0]===s&&"chain"===n[2]){var n,s;e=i[1];var r=Array.prototype.slice.call(arguments,1);G.call(a,"sprite.chain",ei,[e,r],a),o.skipEvent()}}})},function(r,a,t){var o=ii(t,"sprite","sprite");o&&a.on("+",function(t){if(!a.skipEventFlag){var e,i,n,s=t.split(".");if(n=o,3===(i=s).length&&i[0]===n&&"pause"===i[2])e=s[1],G.call(r,"sprite.pause",ni,e,r),a.skipEvent()}})},function(o,h,t){var u=si(t,"sprite","sprite");u&&h.on("+",function(t,e){if(!h.skipEventFlag){var i,n,s,r,a=t.split(".");if(r=u,3===(s=a).length&&s[0]===r)i=a[1],n=a[2],G.call(o,"sprite.set",ri,[i,n,e],o),h.skipEvent()}})},function(c,l,t){var f=ai(t,"sprite","sprite");f&&l.on("+",function(t,e,i,n){if(!l.skipEventFlag){var s,r,a,o,h,u=t.split(".");if(h=f,4===(o=u).length&&o[0]===h&&oi[o[3]])s=u[1],r=u[2],a="yoyo"===u[3],G.call(c,"sprite.ease",hi,[s,r,e,i,n,a],c),l.skipEvent()}})},function(r,a){a.on("start",function(){r.emit("parser.start",a)}).on("+",function(t){if(!a.skipEventFlag){for(var e="+".concat(t),i=arguments.length,n=new Array(1<i?i-1:0),s=1;s<i;s++)n[s-1]=arguments[s];r.emit.apply(r,["parser.".concat(e),a].concat(n)),ui(r,e,n)}}).on("-",function(t){if(!a.skipEventFlag){var e="-".concat(t);r.emit("parser.".concat(e),a),ui(r,e)}}).on("complete",function(){r.emit("parser.complete",a)})},function(t,e,i){var n=ci(i,"tags.r","r");e.on("+".concat(n),function(){R.call(t,"\n"),e.skipEvent()}).on("-".concat(n),function(){e.skipEvent()})},function(e,t){t.on("content",function(t){R.call(e,t)})}],fi=Phaser.Utils.Objects.GetValue,di=function(){u(s,Ct);var n=g(s);function s(t,e){var i;return d(this,s),void 0===e&&(e={}),e.hasOwnProperty("delimiters")||(e.delimiters="[]"),function(t,e,i){for(var n=0,s=li.length;n<s;n++)li[n](t,e,i)}(t,v(i=n.call(this,e)),e),i.setCommentLineStartSymbol(fi(e,"comment","//")),i}return h(s,[{key:"setCommentLineStartSymbol",value:function(t){return this.commentLineStart=t,this}},{key:"start",value:function(t){return y(p(s.prototype),"start",this).call(this,function(t,e){for(var i=t.commentLineStart,n=e.split("\n"),s=0,r=n.length;s<r;s++){var a=n[s];""===a||(0===a.trim().length||i&&a.startsWith(i))&&(n[s]="")}return n.join("")}(this,t)),this}}]),s}(),pi="_remove.wait",vi="_remove.play",gi=[pi,vi],yi=Phaser.Input.Keyboard.KeyCodes,mi={start:function(t){return this.children=t,this.index=0,this.isPageTyping=!0,this.onTypeStart&&this.onTypeStart(t),this.typing(),Wt(this)},typing:function n(t){void 0===t&&(t=0);var e=0;for(this.inTypingProcessLoop=!0;this.inTypingProcessLoop;){var i=this.getNextChild();if(!i){this.timeline.isRunning?this.timeline.once("complete",function(){this.isPageTyping=!1,this.emit("complete")},this):(this.isPageTyping=!1,this.emit("complete"));break}if(D(i)){var s=this.animationConfig;if(0<s.duration){var r=this.timeline.addTimer({name:"anim",target:i,duration:s.duration,yoyo:s.yoyo,onStart:s.onStart,onProgress:s.onProgress,onComplete:s.onComplete});this.skipTypingAnimation&&r.seek(1)}else s.onStart&&s.onStart(i,0);this.textPlayer.emit("typing",i),e+=this.speed+t,t=0;var a=this.index===this.children.length;if(0<e&&!a){this.typingTimer=this.timeline.addTimer({name:"delay",target:this,duration:e,onComplete:function(t,e,i){t.typingTimer=void 0,n.call(t,i.remainder)}});break}}else i.type===at&&i.exec()}this.inTypingProcessLoop=!1},pause:function(){return this.timeline.pause(),this},resume:function(){return this.timeline.resume(),this},pauseTyping:function(){return this.isTypingPaused||(this.typingTimer?(this.typingTimer.pause(),this.isTypingPaused=!0):this.inTypingProcessLoop&&(this.inTypingProcessLoop=!1,this.isTypingPaused=!0)),this},resumeTyping:function(t){return this.isTypingPaused&&(void 0===t&&(t=0),this.typingTimer?(this.isTypingPaused=!1,this.typingTimer.resume(),this.typingTimer.remainder+=t):this.isTypingPaused&&(this.isTypingPaused=!1,this.typing(t))),this},wait:function(t){return this.ignoreWait||(this.pauseTyping(),Ht(this.textPlayer,t,this.resumeTyping,[],this)),this},setTimeScale:function(t){return this.timeline.setTimeScale(t),this},setIgnoreWait:function(t){return void 0===t&&(t=!0),this.ignoreWait=t,this},setSkipTypingAnimation:function(t){if(void 0===t&&(t=!0),this.skipTypingAnimation=t)for(var e=this.timeline.getTimers("anim"),i=0,n=e.length;i<n;i++)e[i].seek(1);return this},setSkipSoundEffect:function(t){if(void 0===t&&(t=!0),this.skipSoundEffect=t){var e=this.textPlayer._soundManager;e&&e.fadeOutAllSoundEffects(100,!0)}return this},skipCurrentTypingDelay:function(){return this.typingTimer&&this.typingTimer.seek(1),this}},ki=Phaser.Scene,bi=Phaser.Utils.Objects.GetValue,wi=function(){function n(t,e){var i;d(this,n),this.parent=t,this.scene=null==(i=t)||"object"!==l(i)?null:Nt(i)?i:i.scene&&Nt(i.scene)?i.scene:i.parent&&i.parent.scene&&Nt(i.parent.scene)?i.parent.scene:void 0,this.isShutdown=!1,this.setEventEmitter(bi(e,"eventEmitter",!0)),this.parent&&this.parent===this.scene?this.scene.events.once("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this)}return h(n,[{key:"shutdown",value:function(){this.isShutdown||(this.parent&&this.parent===this.scene?this.scene.events.off("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.isShutdown=!0)}},{key:"destroy",value:function(t){this.shutdown(t)}},{key:"onSceneDestroy",value:function(){this.destroy(!0)}},{key:"onParentDestroy",value:function(t,e){this.destroy(e)}}]),n}();Object.assign(wi.prototype,Et);var xi=Phaser.Utils.Objects.GetValue,Si=function(){u(s,wi);var n=g(s);function s(t,e){var i;return d(this,s),(i=n.call(this,t,e))._isRunning=!1,i.isPaused=!1,i.tickingState=!1,i.setTickingMode(xi(e,"tickingMode",1)),i}return h(s,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking()}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),y(p(s.prototype),"shutdown",this).call(this,t))}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=Pi[t]),this.tickingMode=t}},{key:"startTicking",value:function(){this.tickingState=!0}},{key:"stopTicking",value:function(){this.tickingState=!1}},{key:"isRunning",get:function(){return this._isRunning},set:function(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}},{key:"start",value:function(){return this.isPaused=!1,this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}},{key:"resume",value:function(){return this.isPaused&&(this.isRunning=!0),this}},{key:"stop",value:function(){return this.isPaused=!1,this.isRunning=!1,this}},{key:"complete",value:function(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}]),s}(),Pi={no:0,lazy:1,always:2},Ti=Phaser.Utils.Objects.GetValue,Ei=function(){u(s,Si);var n=g(s);function s(t,e){var i;return d(this,s),(i=n.call(this,t,e)).resetFromJSON(e),i.boot(),i}return h(s,[{key:"resetFromJSON",value:function(t){return this.isRunning=Ti(t,"isRunning",!1),this.timeScale=Ti(t,"timeScale",1),this.now=Ti(t,"now",0),this}},{key:"toJSON",value:function(){return{isRunning:this.isRunning,timeScale:this.timeScale,now:this.now,tickingMode:this.tickingMode}}},{key:"start",value:function(t){return void 0===t&&(t=0),this.delta=0,this.now=t,y(p(s.prototype),"start",this).call(this),this}},{key:"seek",value:function(t){return this.now=t,this}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"tick",value:function(t){return t*=this.timeScale,this.now+=t,this.delta=t,this.emit("update",this.now,this.delta),this}}]),s}(),Oi=function(){u(e,Ei);var t=g(e);function e(){return d(this,e),t.apply(this,arguments)}return h(e,[{key:"startTicking",value:function(){y(p(e.prototype),"startTicking",this).call(this),this.scene.events.on("update",this.update,this)}},{key:"stopTicking",value:function(){y(p(e.prototype),"stopTicking",this).call(this),this.scene&&this.scene.events.off("update",this.update,this)}},{key:"update",value:function(t,e){return this.isRunning&&0!==this.timeScale&&this.tick(e),this}}]),e}(),_i=Phaser.Math.Clamp,Mi=function(){function i(t,e){d(this,i),this.setTimeline(t).reset(e)}return h(i,[{key:"setTimeline",value:function(t){return this.timeline=t,this}},{key:"setName",value:function(t){return this.name=t,this}},{key:"setCallbacks",value:function(t,e,i,n){return this.target=t,this.onStart=e,this.onProgress=i,this.onComplete=n,this}},{key:"setDuration",value:function(t,e){return void 0===e&&(e=!1),this.duration=t,this.remainder=t,this.t=0,this.yoyo=e,this}},{key:"setPaused",value:function(t){return this.isPaused=t,this}},{key:"pause",value:function(){return this.isPaused=!0,this}},{key:"resume",value:function(){return this.isPaused=!1,this}},{key:"setRemoved",value:function(t){return this.removed=t,this}},{key:"remove",value:function(){return this.removed=!0,this}},{key:"seek",value:function(t){return this.remainder=this.duration*(1-t),this}},{key:"reset",value:function(t){return this.setName(t.name).setDuration(t.duration,t.yoyo).setCallbacks(t.target,t.onStart,t.onProgress,t.onComplete).setPaused(!1).setRemoved(!1),this}},{key:"onFree",value:function(){this.setTimeline().setCallbacks()}},{key:"getProgress",value:function(){var t,e,i=1-this.remainder/this.duration;return i=_i(i,0,1),this.yoyo&&(void 0===e&&(e=.5),(t=i)<=e?t/=e:t=1-(t-e)/(1-e),i=t),i}},{key:"setProgress",value:function(t){t=_i(t,0,1),this.remainder=this.duration*(1-t)}},{key:"runCallback",value:function(t){t&&t(this.target,this.t,this)}},{key:"update",value:function(t,e){if(this.removed)return!0;if(this.isPaused)return!1;this.remainder-=e,this.t=this.getProgress(),this.runCallback(this.onProgress);var i=this.remainder<=0;return i&&this.runCallback(this.onComplete),i}}]),i}(),Ci=function(){u(e,gt);var t=g(e);function e(){return d(this,e),t.apply(this,arguments)}return h(e,[{key:"allocate",value:function(){return this.pop()}},{key:"free",value:function(t){t.onFree(),this.push(t)}},{key:"freeMultiple",value:function(t){for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}}]),e}(),Ri=Phaser.Utils.Objects.GetValue,ji=new Ci,Gi=function(){u(o,Oi);var n=g(o);function o(t,e){var i;return d(this,o),(i=n.call(this,t,e)).addedTimers=[],i.timers=[],i.timerPool=Ri(e,"pool",ji),i}return h(o,[{key:"shutdown",value:function(){this.isShutdown||(this.timerPool.freeMultiple(this.addedTimers).freeMultiple(this.timers),this.timerPool=void 0,this.addedTimers=void 0,this.timers=void 0,y(p(o.prototype),"shutdown",this).call(this))}},{key:"addTimer",value:function(t){var e=this.timerPool.allocate();return e?e.setTimeline(this).reset(t):e=new Mi(this,t),this.addedTimers.push(e),e.runCallback(e.onStart),this.isRunning||this.start(),e}},{key:"delayCall",value:function(t,n,s,r){return this.addTimer({duration:t,onComplete:function(t,e,i){void 0===s&&(s=[]),s.push(i),n.apply(r,s)}})}},{key:"getTimers",value:function(t){for(var e=[],i=[this.addedTimers,this.timers],n=0,s=i.length;n<s;n++)for(var r=i[n],a=0,o=r.length;a<o;a++){var h=r[a];h.name===t&&e.push(h)}return e}},{key:"update",value:function(t,e){var i;y(p(o.prototype),"update",this).call(this,t,e),(i=this.timers).push.apply(i,c(this.addedTimers));for(var n=[],s=this.addedTimers.length=0,r=this.timers.length;s<r;s++){var a=this.timers[s];a.update(this.now,this.delta)?this.timerPool.free(a):n.push(a)}this.timers=n,0===this.timers.length&&0===this.addedTimers.length&&this.complete()}}]),o}(),Ai=Phaser.Utils.Objects.GetValue,Bi=function(){function i(t,e){d(this,i),this.setEventEmitter(),this.textPlayer=t,this.isPageTyping=!1,this.timeline=new Gi(t),this.typingTimer=void 0,this.pauseTypingTimer=void 0,this.inTypingProcessLoop=!1,this.isTypingPaused=!1,this.setIgnoreWait(!1),this.setSkipTypingAnimation(!1),this.setTypingStartCallback(Ai(e,"onTypingStart",Di)),this.setSpeed(Ai(e,"speed",250)),this.setAnimationConfig(Ai(e,"animation",void 0))}return h(i,[{key:"destroy",value:function(){this.destroyEventEmitter(),this.textPlayer=void 0,this.timeline.destroy(),this.timeline=void 0,this.typingTimer=void 0,this.pauseTypingTimer=void 0,this.onTypeStart=void 0,this.animationConfig=void 0}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setTypingStartCallback",value:function(t){return this.onTypeStart=t,this}},{key:"setAnimationConfig",value:function(t){return void 0===t?t={}:!1===t&&(t={duration:0}),t.hasOwnProperty("duration")||(t.duration=1e3),t.hasOwnProperty("onStart")||(t.onStart=Wi),this.animationConfig=t,this}},{key:"getNextChild",value:function(){var t=this.children[this.index];return this.index=Math.min(this.index+1,this.children.length),t}}]),i}(),Wi=function(t){t.setVisible()},Di=function(t){for(var e=0,i=t.length;e<i;e++)t[e].setVisible(!1)};Object.assign(Bi.prototype,Et,mi);function Fi(t,e){void 0===e&&(e={key:t}),e.hasOwnProperty("key")||(e.key=t);var i=e.key,n=e.frame,s=e.width,r=e.height;if(void 0===s||void 0===r){var a=this.textureManager.getFrame(i,n),o=a?a.cutWidth:0,h=a?a.cutHeight:0;void 0===s&&void 0===r?(s=o,r=h):void 0===s?s=o*(r/h):void 0===r&&(r=h*(s/o))}this.images[t]={key:i,frame:n,width:s,height:r,y:Vi(e,"y",0),left:Vi(e,"left",0),right:Vi(e,"right",0)}}var Vi=Phaser.Utils.Objects.GetValue,Li=function(){function e(t){d(this,e),this.textureManager=t.textures,this.images={}}return h(e,[{key:"destroy",value:function(){this.textureManager=void 0,this.images=void 0}},{key:"add",value:function(t,e){if("string"==typeof t)Fi.call(this,t,e);else if(Array.isArray(t))for(var i=0,n=(s=t).length;i<n;i++)Fi.call(this,s[i]);else{var s=t;for(var t in s)Fi.call(this,t,s[t])}return this}},{key:"has",value:function(t){return this.images.hasOwnProperty(t)}},{key:"remove",value:function(t){return this.has(t)&&delete this.images[t],this}},{key:"get",value:function(t){return this.has(t)||this.textureManager.exists(t)&&this.add(t),this.images[t]}},{key:"getOuterWidth",value:function(t){var e=this.get(t);return e?e.width+e.left+e.right:0}},{key:"getFrame",value:function(t){var e=this.get(t);return e?this.textureManager.getFrame(e.key,e.frame):void 0}},{key:"hasTexture",value:function(t){return!!this.getFrame(t)}}]),e}(),Ui={draw:function(t,e,i,n,s){var r=this.get(t);i+=r.left,n+=r.y,s&&(i=Math.round(i),n=Math.round(n));var a=this.textureManager.getFrame(r.key,r.frame);e.drawImage(a.source.image,a.cutX,a.cutY,a.cutWidth,a.cutHeight,i,n,r.width,r.height)}};Object.assign(Li.prototype,Ui);function Ii(t,e,i,n,s){void 0===n&&(n=1),void 0===s&&(s=0);var r,a={mode:0,volume:{start:s,end:n},duration:i};return"string"==typeof e&&(e=t.sound.add(e)),e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(a):(r=new hn(t,e,a),e._fade=r),r.start(),e.isPlaying||e.setVolume(s).play(),e}function zi(t,e,i,n){void 0===n&&(n=!0);var s,r={mode:n?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(s=e._fade).stop().resetFromJSON(r):(s=new hn(t,e,r),e._fade=s),s.start(),e.isPlaying||e.play(),e}function Yi(i,t){return i.hasOwnProperty("tintR")||(void 0===t&&(t=16777215),Object.defineProperty(i,"tint",{get:function(){return i._tintRGB},set:function(t){t=16777215&Math.floor(t),i.setTint(t),i._tintRGB!==t&&(i._tintRGB=t,i._tintR=t>>16&255,i._tintG=t>>8&255,i._tintB=255&t)}}),Object.defineProperty(i,"tintR",{get:function(){return i._tintR},set:function(t){var e;t=255&Math.floor(t),i._tintR!==t&&(i._tintR=t,i._tintRGB=(e=i._tintRGB,(255&t)<<16|65535&e),i.tint=i._tintRGB)}}),Object.defineProperty(i,"tintG",{get:function(){return i._tintG},set:function(t){var e;t=255&Math.floor(t),i._tintG!==t&&(i._tintG=t,i._tintRGB=(e=i._tintRGB,(255&t)<<8|16711935&e),i.tint=i._tintRGB)}}),Object.defineProperty(i,"tintB",{get:function(){return i._tintB},set:function(t){var e;t=255&Math.floor(t),i._tintB!==t&&(i._tintB=t,i._tintRGB=(e=i._tintRGB,255&t|16776960&e),i.tint=i._tintRGB)}}),Object.defineProperty(i,"tintGray",{get:function(){return Math.floor((i._tintR+i._tintG+i._tintB)/3)},set:function(t){t=255&Math.floor(t),i._tintR===t&&i._tintG===t&&i._tintB===t||(i._tintR=t,i._tintG=t,i._tintB=t,i._tintRGB=(i._tintRGB,(255&t)<<16|(255&t)<<8|255&t),i.tint=i._tintRGB)}}),i.tint=t),i}var Xi=function(){u(e,Si);var t=g(e);function e(){return d(this,e),t.apply(this,arguments)}return h(e,[{key:"startTicking",value:function(){y(p(e.prototype),"startTicking",this).call(this),this.scene.events.on("update",this.update,this)}},{key:"stopTicking",value:function(){y(p(e.prototype),"stopTicking",this).call(this),this.scene&&this.scene.events.off("update",this.update,this)}}]),e}(),Hi=Phaser.Utils.Objects.GetValue,Ni=Phaser.Math.Clamp,Ji=function(){function e(t){d(this,e),this.resetFromJSON(t)}return h(e,[{key:"resetFromJSON",value:function(t){this.state=Hi(t,"state",$i),this.timeScale=Hi(t,"timeScale",1),this.delay=Hi(t,"delay",0),this.repeat=Hi(t,"repeat",0),this.repeatCounter=Hi(t,"repeatCounter",0),this.duration=Hi(t,"duration",0),this.nowTime=Hi(t,"nowTime",0),this.justRestart=Hi(t,"justRestart",!1)}},{key:"toJSON",value:function(){return{state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}},{key:"destroy",value:function(){}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setDelay",value:function(t){return void 0===t&&(t=0),this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatInfinity",value:function(){return this.repeat=-1,this}},{key:"start",value:function(){return this.nowTime=0<this.delay?-this.delay:0,this.state=0<=this.nowTime?Zi:Ki,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=$i,this}},{key:"update",value:function(t,e){this.state!==$i&&this.state!==qi&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.state=0<=this.nowTime?Zi:Ki,this.justRestart=!1,this.nowTime>=this.duration&&(-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration):(this.nowTime=this.duration,this.state=qi)))}},{key:"t",get:function(){var t;switch(this.state){case $i:case Ki:t=0;break;case Zi:t=this.nowTime/this.duration;break;case qi:t=1}return Ni(t,0,1)},set:function(t){(t=Ni(t,-1,1))<0?(this.state=Ki,this.nowTime=-this.delay*t):(this.state=Zi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}},{key:"isIdle",get:function(){return this.state===$i}},{key:"isDelay",get:function(){return this.state===Ki}},{key:"isCountDown",get:function(){return this.state===Zi}},{key:"isRunning",get:function(){return this.state===Ki||this.state===Zi}},{key:"isDone",get:function(){return this.state===qi}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),e}(),$i=0,Ki=1,Zi=2,qi=-1,Qi=function(){u(s,Xi);var n=g(s);function s(t,e){var i;return d(this,s),(i=n.call(this,t,e)).timer=new Ji,i}return h(s,[{key:"shutdown",value:function(t){this.isShutdown||(y(p(s.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0)}},{key:"start",value:function(){return this.timer.start(),y(p(s.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),y(p(s.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),y(p(s.prototype),"complete",this).call(this),this}}]),s}(),tn=Phaser.Utils.Objects.GetValue,en=Phaser.Utils.Objects.GetAdvancedValue,nn=Phaser.Tweens.Builders.GetEaseFunction,sn=function(){u(e,Qi);var t=g(e);function e(){return d(this,e),t.apply(this,arguments)}return h(e,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(tn(t,"timer")),this.setEnable(tn(t,"enable",!0)),this.setDelay(en(t,"delay",0)),this.setDuration(en(t,"duration",1e3)),this.setEase(tn(t,"ease","Linear")),this.setRepeat(tn(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=nn(t),this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"start",value:function(){return this.timer.isRunning||y(p(e.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;var n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(){}}]),e}(),rn=Phaser.Utils.Objects.GetValue,an=Phaser.Utils.Objects.GetAdvancedValue,on=Phaser.Math.Linear,hn=function(){u(r,sn);var s=g(r);function r(t,e,i){var n;return d(this,r),e.scene=t,e.active=!0,(n=s.call(this,e,i)).volume={},n.resetFromJSON(i),n}return h(r,[{key:"resetFromJSON",value:function(t){return y(p(r.prototype),"resetFromJSON",this).call(this,t),this.setMode(rn(t,"mode",0)),this.setEnable(rn(t,"enable",!0)),this.setVolumeRange(an(t,"volume.start",this.parent.volume),an(t,"volume.end",0)),this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=un[t]),this.mode=t,this}},{key:"setVolumeRange",value:function(t,e){return this.volume.start=t,this.volume.end=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),y(p(r.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){t.volume=on(this.volume.start,this.volume.end,e.t)}},{key:"complete",value:function(){switch(y(p(r.prototype),"complete",this).call(this),this.mode){case 1:this.parent.stop();break;case 2:this.parent.destroy()}return this}}]),r}(),un={stop:1,destroy:2},cn=Phaser.Utils.Objects.GetValue,ln=Phaser.Utils.Array.Remove,fn=function(){function n(t,e){d(this,n),this.scene=t,this.soundEffects=[],this.backgroundMusic=void 0,this.setBackgroundMusicLoopValue(cn(e,"bgm.loop",!0)),this.setBackgroundMusicFadeTime(cn(e,"bgm.fade",500));var i=cn(e,"bgm.initial",void 0);i&&this.setCurrentBackgroundMusic(i)}return h(n,[{key:"destroy",value:function(t){if(this.soundEffects.length&&!t)for(var e=this.soundEffects.length-1;0<=e;e--)this.soundEffects[e].destroy();this.soundEffects.length=0,this.backgroundMusic&&!t&&this.backgroundMusic.destroy(),this.backgroundMusic=void 0,this.scene=void 0}},{key:"setBackgroundMusicLoopValue",value:function(t){return this.backgroundMusicLoopValue=t,this}},{key:"setBackgroundMusicFadeTime",value:function(t){return this.backgroundMusicFadeTime=t,this}},{key:"getSoundEffects",value:function(){return this.soundEffects}},{key:"getLastSoundEffect",value:function(){return this.soundEffects[this.soundEffects.length-1]}},{key:"getBackgroundMusic",value:function(){return this.backgroundMusic}},{key:"playSoundEffect",value:function(t){var e=this.scene.sound.add(t);return this.soundEffects.push(e),e.once("complete",function(){e.destroy(),this.scene&&ln(this.soundEffects,e)},this).once("destroy",function(){this.scene&&ln(this.soundEffects,e)},this).play(),this}},{key:"setSoundEffectVolume",value:function(t){var e=this.getLastSoundEffect();return e&&e.setVolume(t),this}},{key:"fadeInSoundEffect",value:function(t){var e=this.getLastSoundEffect();return e&&Ii(this.scene,e,t),this}},{key:"fadeOutSoundEffect",value:function(t,e){var i=this.getLastSoundEffect();return i&&zi(this.scene,i,t,e),this}},{key:"fadeOutAllSoundEffects",value:function(t,e){for(var i=this.soundEffects.length-1;0<=i;i--)zi(this.scene,this.soundEffects[i],t,e);return this}},{key:"setCurrentBackgroundMusic",value:function(t){(this.backgroundMusic=t)&&(t.setLoop(this.backgroundMusicLoopValue),t.once("complete",function(){this.backgroundMusic.destroy(),this.backgroundMusic=void 0},this).once("destroy",function(){this.backgroundMusic=void 0},this),t.isPlaying||t.play())}},{key:"playBackgroundMusic",value:function(t){return this.backgroundMusic&&this.backgroundMusic.key===t||(this.stopBackgroundMusic(),this.setCurrentBackgroundMusic(this.scene.sound.add(t)),0<this.backgroundMusicFadeTime&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime)),this}},{key:"pauseBackgroundMusic",value:function(){return this.backgroundMusic&&this.backgroundMusic.pause(),this}},{key:"resumeBackgroundMusic",value:function(){return this.backgroundMusic&&this.backgroundMusic.resume(),this}},{key:"stopBackgroundMusic",value:function(){return this.backgroundMusic&&(0<this.backgroundMusicFadeTime?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this}},{key:"fadeInBackgroundMusic",value:function(t){return this.backgroundMusic&&Ii(this.scene,this.backgroundMusic,t),this}},{key:"fadeOutBackgroundMusic",value:function(t,e){return this.backgroundMusic&&zi(this.scene,this.backgroundMusic,t,e),this}},{key:"crossFadeBackgroundMusic",value:function(t,e){var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this}}]),n}(),dn=function(){function n(t,e,i){d(this,n),this.spriteManager=t,this.sprite=e.setName(i),this.tweens={},this.name=i}return h(n,[{key:"scene",get:function(){return this.spriteManager.scene}},{key:"destroy",value:function(){this.freeSprite().freeTweens(),this.spriteManager=void 0}},{key:"freeSprite",value:function(){return this.sprite.destroy(),this.sprite=void 0,this}},{key:"freeTweens",value:function(){var t=this.tweens;for(var e in t)t[e].remove(),delete t[e];return this}},{key:"setProperty",value:function(t,e){return this.sprite[t]=e,this}},{key:"easeProperty",value:function(t,e,i,n,s,r){var a=this.tweens;a.hasOwnProperty(t)&&a[t].remove();var o={targets:this.sprite,duration:i,ease:n,yoyo:s,onComplete:function(){a[t].remove(),delete a[t],r&&r()},onCompleteScope:this};return o[t]=e,a[t]=this.scene.tweens.add(o),this}},{key:"setTexture",value:function(t,e){return this.sprite.setTexture(t,e),this}},{key:"playAnimation",value:function(t){return this.sprite.play(t),this}},{key:"stopAnimation",value:function(){return this.sprite.stop(),this}},{key:"chainAnimation",value:function(t){return this.sprite.chain(t),this}},{key:"pauseAnimation",value:function(){return this.sprite.anims.pause(),this}}]),n}(),pn=Phaser.Utils.Objects.GetValue,vn=Phaser.Utils.Array.Remove,gn=function(){function i(t,e){d(this,i),this.scene=t,this.setEventEmitter(pn(e,"eventEmitter",void 0)),this.setCreateCallback(pn(e,"createCallback","sprite")),this.setSpriteFadeTime(pn(e,"fade",500)),this.sprites={},this.removedSprites=[]}return h(i,[{key:"destroy",value:function(t){this.clear(!t),this.createCallback=void 0,this.scene=void 0}},{key:"setCreateCallback",value:function(t){return this.createCallback="sprite"===t?function(t,e,i){return t.add.sprite(0,0,e,i)}:"image"===t?function(t,e,i){return t.add.image(0,0,e,i)}:t,this}},{key:"setSpriteFadeTime",value:function(t){return this.fadeTime=t,this}},{key:"has",value:function(t){return this.sprites.hasOwnProperty(t)}},{key:"get",value:function(t){return this.sprites[t]}},{key:"getTweenTask",value:function(t,e){if(this.has(t)){var i=this.get(t).tweens;if(i.hasOwnProperty(e))return i[e]}return null}},{key:"isEmpty",get:function(){return function(t){for(var e in t)return!1;return!0}(this.sprites)&&0===this.removedSprites.length}},{key:"clear",value:function(t){for(var e in void 0===t&&(t=!0),this.sprites)t&&this.sprites[e].destroy(),delete this.sprites[e];return this.removedSprites.length=0,this}},{key:"add",value:function(t,e,i){var n;if(this.remove(t),3===arguments.length)n=this.createCallback(this.scene,e,i);else{var s=Array.prototype.slice.call(arguments,1);n=this.createCallback.apply(this,[this.scene].concat(c(s)))}0<this.fadeTime&&Yi(n),n.once("destroy",function(){vn(this.removedSprites,n),this.isEmpty&&this.emit("empty")},this);var r=new dn(this,n,t);return this.sprites[t]=r,0<this.fadeTime&&r.setProperty("tintGray",0).easeProperty("tintGray",255,this.fadeTime),this}},{key:"setProperty",value:function(t,e,i){return this.has(t)&&this.get(t).setProperty(e,i),this}},{key:"easeProperty",value:function(t,e,i,n,s,r,a){return this.has(t)&&(void 0===n&&(n=1e3),void 0===s&&(s="Linear"),this.get(t).easeProperty(e,i,n,s,r,a)),this}},{key:"remove",value:function(t){if(!this.has(t))return this;var e=this.get(t);return delete this.sprites[t],this.removedSprites.push(e.sprite),0<this.fadeTime?e.easeProperty("tintGray",0,this.fadeTime,"Linear",!1,function(){e.destroy()}):e.destroy(),this}},{key:"removeAll",value:function(){for(var t in this.sprites)this.remove(t);return this}},{key:"setTexture",value:function(t,e,i){return this.has(t)&&this.get(t).setTexture(e,i),this}},{key:"playAnimation",value:function(t,e){return this.has(t)||this.add(t),this.get(t).playAnimation(e),this}},{key:"stopAnimation",value:function(t){return this.has(t)&&this.get(t).stopAnimation(),this}},{key:"chainAnimation",value:function(t,e){return this.has(t)&&this.get(t).chainAnimation(e),this}},{key:"pauseAnimation",value:function(t){return this.has(t)&&this.get(t).pauseAnimation(),this}}]),i}();Object.assign(gn.prototype,Et);var yn=Phaser.Utils.Objects.GetValue,mn={setClickTarget:function(t){return Nt(t)?this.clickEE=t.input:this.clickEE=t.setInteractive(),this},setTargetCamera:function(t){return this.camera=t,this},setNextPageInput:function(s){var r=this;this.nextPageInput=s?"function"==typeof s?function(t,e,i){var n=Dt(r,t,e,i);s.call(r,n)}:function(t,e,i){Ht(r,s,t,e,i)}:null},addImage:function(t,e){return this.imageManager.add(t,e),this},play:function(t){return this.isPlaying||(this.removeChildren(),this.parser.start(t),this.isPlaying=!0,this.once("complete",function(){this.isPlaying=!1},this),this.lastWrapResult=void 0,this.typingNextPage()),this},playPromise:function(t){var e=Wt(this);return this.play(t),e},typingNextPage:function t(){if(!this.isPlaying||this.isPageTyping)return this;var e=yn(this.wrapConfig,"callback",this.runWordWrap);"string"==typeof e&&(e=this[e]);var i=e.call(this,this.lastWrapResult);this.lastWrapResult=i,this.emit("page.start");function n(){this.emit(vi),i.isLastPage?this.emit("complete"):(this.emit("page.complete"),this.nextPageInput&&this.nextPageInput(t,[],this))}this.once(vi,function(){this.typeWriter.off("complete",n,this)}),this.typeWriter.once("complete",n,this).start(i.children)},pause:function(){return this.typeWriter.pause(),this},resume:function(){return this.typeWriter.resume(),this},setTimeScale:function(t){return this.typeWriter.setTimeScale(t),this},setIgnoreWait:function(t){return this.typeWriter.setIgnoreWait(t),this},showPage:function(){if(!this.isPlaying||!this.isPageTyping)return this;var t=this.typeWriter.speed,e=this.typeWriter.ignoreWait,i=this.typeWriter.skipTypingAnimation,n=this.typeWriter.skipSoundEffect;return this.typeWriter.once("complete",function(){this.typeWriter.setSpeed(t).setIgnoreWait(e).setSkipTypingAnimation(i).setSkipSoundEffect(n)},this).setSpeed(0).skipCurrentTypingDelay().setIgnoreWait(!0).setSkipTypingAnimation(!0).setSkipSoundEffect(!0),this}},kn=Phaser.Utils.Objects.IsPlainObject,bn=Phaser.Utils.Objects.GetValue,wn=function(){u(f,xt);var l=g(f);function f(t,e,i,n,s,r){var a;d(this,f),kn(e)?r=e:kn(n)&&(r=n),void 0===r&&(r={});var o=r.text;delete r.text,(a=l.call(this,t,e,i,n,s,r)).type="rexTextPlayer",a.parser=new di(v(a),bn(r,"parser",void 0)),a.typeWriter=new Bi(v(a),bn(r,"typing",void 0)),a._imageManager=void 0;var h=bn(r,"images",void 0);h&&a.addImage(h),a._soundManager=void 0;var u=bn(r,"sounds",void 0);u&&(a._soundManager=new fn(a.scene,u)),a.setTargetCamera(bn(r,"camera",a.scene.cameras.main)),a._spriteManager=void 0;var c=bn(r,"sprites",void 0);return c&&(a._spriteManager=new gn(a.scene,c)),a.setClickTarget(bn(r,"clickTarget",v(a))),a.setNextPageInput(bn(r,"nextPageInput",null)),a.isPlaying=!1,o&&a.play(o),a}return h(f,[{key:"imageManager",get:function(){return void 0===this._imageManager&&(this._imageManager=new Li(this.scene)),this._imageManager}},{key:"soundManager",get:function(){return void 0===this._soundManager&&(this._soundManager=new fn(this.scene)),this._soundManager}},{key:"spriteManager",get:function(){return void 0===this._spriteManager&&(this._spriteManager=new gn(this.scene)),this._spriteManager}},{key:"destroy",value:function(t){this.scene&&(function(t){for(var e=0,i=gi.length;e<i;e++)t.emit(gi[e])}(this),this.parser.destroy(),this.parser=void 0,this.typeWriter.destroy(t),this.typeWriter=void 0,this._imageManager&&this._imageManager.destroy(t),this._imageManager=void 0,this._soundManager&&this._soundManager.destroy(t),this._soundManager=void 0,this.camera=void 0,this._spriteManager&&this._spriteManager.destroy(t),this._spriteManager=void 0,this.clickEE=void 0,y(p(f.prototype),"destroy",this).call(this,t))}},{key:"isPageTyping",get:function(){return this.typeWriter.isPageTyping}}]),f}();function xn(t,e,i,n,s){var r=new wn(this.scene,t,e,i,n,s);return this.scene.add.existing(r),r}Object.assign(wn.prototype,mn);var Sn=Phaser.Utils.Objects.GetAdvancedValue,Pn=Phaser.GameObjects.BuildGameObject;function Tn(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=Sn(t,"width",void 0),n=Sn(t,"height",void 0),s=new wn(this.scene,0,0,i,n,t);return Pn(this.scene,s,t),s}function En(t){return null==t||""===t||0===t.length}var On=function(){u(n,Phaser.Plugins.BasePlugin);var i=g(n);function n(t){var e;return d(this,n),e=i.call(this,t),t.registerGameObject("rexTextPlayer",xn,Tn),e}return h(n,[{key:"start",value:function(){this.game.events.on("destroy",this.destroy,this)}}]),n}();return function(t,e,i){if("object"===l(t)){if(En(e)){if(null==i)return;"object"===l(i)&&(t=i)}else{"string"==typeof e&&(e=e.split("."));var n=e.pop();(function(t,e,i){var n=t;if(!En(e)){var s;"string"==typeof e&&(e=e.split("."));for(var r=0,a=e.length;r<a;r++){var o;if(null==n[s=e[r]]||"object"!==l(n[s]))o=r!==a-1||void 0===i?{}:i,n[s]=o;n=n[s]}}return n})(t,e)[n]=i}}}(window,"RexPlugins.GameObjects.TextPlayer",wn),On});
  