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).rexscrollablepanel=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 p(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 d(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}function t(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 y(t){return(y=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 g(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function e(r){var o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e,i,n=y(r);if(o){var s=y(this).constructor;t=Reflect.construct(n,arguments,s)}else t=n.apply(this,arguments);return e=this,!(i=t)||"object"!=typeof i&&"function"!=typeof i?g(e):i}}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function m(t,e,i){return(m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=u(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(i):s.value}})(t,e,i||t)}function r(t,e,i,n){return(r="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var s,r,o,h,a=u(t,e);if(a){if((s=Object.getOwnPropertyDescriptor(a,e)).set)return s.set.call(n,i),!0;if(!s.writable)return!1}if(s=Object.getOwnPropertyDescriptor(n,e)){if(!s.writable)return!1;s.value=i,Object.defineProperty(n,e,s)}else h=i,(o=e)in(r=n)?Object.defineProperty(r,o,{value:h,enumerable:!0,configurable:!0,writable:!0}):r[o]=h;return!0})(t,e,i,n)}function s(t,e,i,n,s){if(!r(t,e,i,n||t)&&s)throw new Error("failed to set property");return i}function o(t){return function(t){if(Array.isArray(t))return h(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return h(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 h(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 h(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 a=Phaser.GameObjects.Zone,c=Phaser.Utils.Array.Add,v=Phaser.Utils.Array.Remove,f=function(){t(h,a);var o=e(h);function h(t,e,i,n,s){var r;return p(this,h),void 0===n&&(n=1),void 0===s&&(s=1),(r=o.call(this,t,e,i,n,s)).children=[],r}return d(h,[{key:"destroy",value:function(t){this.scene&&(this.clear(!t),m(y(h.prototype),"destroy",this).call(this,t))}},{key:"contains",value:function(t){return-1!==this.children.indexOf(t)}},{key:"add",value:function(t){return c(this.children,t,0,function(t){t.on("destroy",this.remove,this)},this),this}},{key:"remove",value:function(t,e){return v(this.children,t,function(t){t.off("destroy",this.remove,this),e&&t.destroy()}),this}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i<n;i++)(e=this.children[i]).off("destroy",this.remove,this),t&&e.destroy();return this.children.length=0,this}}]),h}(),b=Phaser.GameObjects.Components;Phaser.Class.mixin(f,[b.Alpha,b.Flip]);function k(t){var e;return t.hasOwnProperty("rexContainer")&&(e=t.rexContainer.parent),e}function S(t){return this.setParent(t),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),_.call(this,t),this}function x(t,e){return t===e?1:t/e}function C(t){return"[object Array]"===Object.prototype.toString.call(t)}var O={setParent:function(t,e){void 0===e&&(e=this);var i=this.getLocalState(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent:function(t){return void 0===t&&(t=this),k(t)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=k(t);e;)e=k(t=e);return t}(t)}},_=f.prototype.add,P={add:function(t){return Array.isArray(t)?this.addMultiple(t):S.call(this,t),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)S.call(this,t[e]);return this}},E=f.prototype.remove,M=f.prototype.clear,w={remove:function(t,e){return this.getParent(t)!==this||(this.setParent(t,null),E.call(this,t,e)),this},clear:function(t){for(var e=0,i=this.children.length;e<i;e++)this.setParent(this.children[e],null);return M.call(this,t),this}},Y=Phaser.Math.RotateAround,D={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,Y(t,0,0,-this.rotation),t.x/=this.scaleX,t.y/=this.scaleY,t.x*=this.flipX?-1:1,t.y*=this.flipY?-1:1,t},localToWorld:function(t){return t.x*=this.flipX?-1:1,t.y*=this.flipY?-1:1,t.x*=this.scaleX,t.y*=this.scaleY,Y(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},T={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=this.getLocalState(t);return t.x=e.x,t.y=e.y,this.localToWorld(t),t.scaleX=e.scaleX*this.scaleX,t.scaleY=e.scaleY*this.scaleY,void 0!==t.flipX&&(t.flipX=this.flipX?!e.flipX:e.flipX,t.flipY=this.flipY?!e.flipY:e.flipY),t.rotation=e.rotation+this.rotation,t.isRexContainerLite&&(t.syncChildrenEnable=!0,t.syncPosition()),this},syncPosition:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildPosition,this),this},resetChildPositionState:function(t){var e=this.getLocalState(t);return e.x=t.x,e.y=t.y,this.worldToLocal(e),e.scaleX=x(t.scaleX,this.scaleX),e.scaleY=x(t.scaleY,this.scaleY),void 0!==t.flipX&&(e.flipX=t.flipX,e.flipY=t.flipY),e.rotation=t.rotation-this.rotation,this},setChildPosition:function(t,e,i){return t.x=e,t.y=i,this.resetChildPositionState(t),this},setChildLocalPosition:function(t,e,i){var n=this.getLocalState(t);return n.x=e,n.y=i,this.updateChildPosition(t),this}},j={updateChildVisible:function(t){var e=this.getLocalState(t),i=!e.hasOwnProperty("maskVisible")||e.maskVisible;return t.visible=this.visible&&e.visible&&i,this},syncVisible:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState:function(t){var e=this.getLocalState(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible:function(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible:function(t,e){return void 0===e&&(e=!0),this.getLocalState(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),this.getLocalState(t).maskVisible=e,this.updateChildVisible(t),this}},z={updateChildAlpha:function(t){return t.alpha=this.alpha*this.getLocalState(t).alpha,this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){return this.getLocalState(t).alpha=x(t.alpha,this.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this._add},setChildLocalAlpha:function(t,e){return this.getLocalState(t).alpha=e,this.updateChildAlpha(t),this}},X={updateChildActive:function(t){return t.active=this.active&&this.getLocalState(t).active,this},syncActive:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState:function(t){return this.getLocalState(t).active=t.active,this},setChildActive:function(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive:function(t,e){return void 0===e&&(e=!0),this.getLocalState(t).active=e,this.updateChildActive(t),this}},A={updateChildMask:function(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask:function(t){return this.mask=t,this},clearMask:function(t){return void 0===t&&(t=!1),t&&this.mask&&this.mask.destroy(),this.mask=null,this}},R=Phaser.Utils.Array,L={getChildren:function(){return this.children},getAllChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n<s;n++){if(e=i[n],t.push(e),e.hasOwnProperty("isRexContainerLite"))t.push.apply(t,o(e.getAllChildren()))}return t},contains:function(t){var e=this.getParent(t);return!!e&&(e===this||this.contains(e))},getByName:function(t,e){if(e){for(var i,n,s=[this];s.length;)for(var r=0,o=(i=s.shift()).children.length;r<o;r++){if((n=i.children[r]).name===t)return n;n.isRexContainerLite&&s.push(n)}return null}return R.GetFirst(this.children,"name",t)},getRandom:function(t,e){return R.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return R.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return R.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return R.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return R.Swap(this.children,t,e),this},moveTo:function(t,e){return R.MoveTo(this.children,t,e),this},setAll:function(t,e,i,n){return R.SetAll(this.children,t,e,i,n),this}},V={tweenChild:function(t){var e=t.targets;C(e)||(e=[e]);for(var i,n,s=[],r=0,o=e.length;r<o;r++)(n=e[r]).hasOwnProperty("rexContainer")&&(i=n.scene,s.push(n.rexContainer));if(i){t.targets=s;var h=i.tweens.add(t);return h.on("update",function(t,e,i){for(var n,s,r=0,o=i.length;r<o;r++)switch(n=i.parent,s=i.self,e){case"x":case"y":case"angle":case"rotation":case"scaleX":case"scaleY":case"flipX":case"flipY":n.updateChildPosition(s);break;case"alpha":n.updateChildAlpha(s)}}),h}},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},F={};Object.assign(F,O,P,w,{getLocalState:function(t){return t.hasOwnProperty("rexContainer")||(t.rexContainer={}),t.rexContainer},resetChildState:function(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState:function(t){for(var e=0,i=t.length;e<i;e++)this.resetChildState(t[e]);return this},syncProperties:function(){return this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask(),this}},D,T,j,z,X,{updateChildScrollFactor:function(t){return t.setScrollFactor(this.scrollFactorX,this.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},A,{setDepth:function(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),n=0,s=i.length;n<s;n++)i[n].depth=t;return this},swapDepth:function(t){var e=this.depth,i=t.depth;return this.setDepth(i),t.setDepth(e),this},incDepth:function(t){if(this.depth+=t,this.children)for(var e=this.getAllChildren(),i=0,n=e.length;i<n;i++)e[i].depth+=t;return this}},L,V);var B=function(){t(a,f);var h=e(a);function a(t,e,i,n,s,r){var o;return p(this,a),(o=h.call(this,t,e,i,n,s)).type="rexContainerLite",o.isRexContainerLite=!0,o.syncChildrenEnable=!0,o._active=!0,o._mask=null,o._scrollFactorX=1,o._scrollFactorY=1,r&&o.add(r),o}return d(a,[{key:"destroy",value:function(t){this.scene&&(this.syncChildrenEnable=!1,m(y(a.prototype),"destroy",this).call(this,t))}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"x",get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.syncPosition())}},{key:"y",get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.syncPosition())}},{key:"rotation",get:function(){return m(y(a.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(s(y(a.prototype),"rotation",t,this,!0),this.syncPosition())}},{key:"scaleX",get:function(){return m(y(a.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(s(y(a.prototype),"scaleX",t,this,!0),this.syncPosition())}},{key:"scaleY",get:function(){return m(y(a.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(s(y(a.prototype),"scaleY",t,this,!0),this.syncPosition())}},{key:"flipX",get:function(){return m(y(a.prototype),"flipX",this)},set:function(t){m(y(a.prototype),"flipX",this)!==t&&(s(y(a.prototype),"flipX",t,this,!0),this.syncPosition())}},{key:"flipY",get:function(){return m(y(a.prototype),"flipY",this)},set:function(t){m(y(a.prototype),"flipY",this)!==t&&(s(y(a.prototype),"flipY",t,this,!0),this.syncPosition())}},{key:"visible",get:function(){return m(y(a.prototype),"visible",this)},set:function(t){m(y(a.prototype),"visible",this)!==t&&(s(y(a.prototype),"visible",t,this,!0),this.syncVisible())}},{key:"alpha",get:function(){return m(y(a.prototype),"alpha",this)},set:function(t){m(y(a.prototype),"alpha",this)!==t&&(s(y(a.prototype),"alpha",t,this,!0),this.syncAlpha())}},{key:"active",get:function(){return this._active},set:function(t){this._active!==t&&(this._active=t,this.syncActive())}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.syncMask())}},{key:"scrollFactorX",get:function(){return this._scrollFactorX},set:function(t){this._scrollFactorX!==t&&(this._scrollFactorX=t,this.syncScrollFactor())}},{key:"scrollFactorY",get:function(){return this._scrollFactorY},set:function(t){this._scrollFactorY!==t&&(this._scrollFactorY=t,this.syncScrollFactor())}},{key:"list",get:function(){return this.children}}]),a}();Object.assign(B.prototype,F);function G(){}var I,N=Phaser.Display.Align,H={center:N.CENTER,left:N.LEFT_CENTER,right:N.RIGHT_CENTER,top:N.TOP_CENTER,bottom:N.BOTTOM_CENTER,"left-top":N.TOP_LEFT,"left-center":N.LEFT_CENTER,"left-bottom":N.BOTTOM_LEFT,"center-top":N.TOP_CENTER,"center-center":N.CENTER,"center-bottom":N.BOTTOM_CENTER,"right-top":N.TOP_RIGHT,"right-center":N.RIGHT_CENTER,"right-bottom":N.BOTTOM_RIGHT},U=new Phaser.GameObjects.Zone({sys:{queueDepthSort:G,events:{once:G}}},0,0,1,1);U.setOrigin(0);function W(t){return void 0!==t.displayWidth?t.displayWidth:t.width}function J(t){return void 0!==t.displayHeight?t.displayHeight:t.height}function K(t){var e=J(t);return t.y+e-e*t.originY}function q(t){var e=W(t);return t.x-e*t.originX+.5*e}function Z(t,e){var i=J(t);return t.y=e-i+i*t.originY,t}function $(t,e){var i=W(t),n=i*t.originX;return t.x=e+n-.5*i,t}function Q(t){var e=W(t);return t.x-e*t.originX}function tt(t,e){var i=W(t);return t.x=e+i*t.originX,t}function et(t){var e=W(t);return t.x+e-e*t.originX}function it(t,e){var i=W(t);return t.x=e-i+i*t.originX,t}function nt(t,e){var i=J(t),n=i*t.originY;return t.y=e+n-.5*i,t}function st(t){var e=J(t);return t.y-e*t.originY+.5*e}function rt(t){var e=J(t);return t.y-e*t.originY}function ot(t,e){var i=J(t);return t.y=e+i*t.originY,t}var ht=0,at=1,lt=2,ut=4,ct=6,dt=8,vt=10,ft=12,pt=[];pt[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),$(t,q(e)+i),Z(t,K(e)+n),t},pt[vt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),tt(t,Q(e)-i),Z(t,K(e)+n),t},pt[ft]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),it(t,et(e)+i),Z(t,K(e)+n),t},pt[ct]=function(t,e,i,n){var s,r,o;return void 0===i&&(i=0),void 0===n&&(n=0),s=t,r=q(e)+i,o=st(e)+n,$(s,r),nt(s,o),t},pt[ut]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),tt(t,Q(e)-i),nt(t,st(e)+n),t},pt[dt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),it(t,et(e)+i),nt(t,st(e)+n),t},pt[at]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),$(t,q(e)+i),ot(t,rt(e)-n),t},pt[ht]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),tt(t,Q(e)-i),ot(t,rt(e)-n),t},pt[lt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),it(t,et(e)+i),ot(t,rt(e)-n),t};function yt(t,e,i,n,s){return pt[i](t,e,n,s)}function gt(t,e){return void 0===e&&(e={}),"number"==typeof t?(e.left=t,e.right=t,e.top=t,e.bottom=t):(e.left=Pt(t,"left",0),e.right=Pt(t,"right",0),e.top=Pt(t,"top",0),e.bottom=Pt(t,"bottom",0)),e}function mt(t,e){return void 0===this.childrenMap&&(this.childrenMap={}),this.childrenMap[t]=e,this}function bt(){this._childrenWidth=void 0,this._childrenHeight=void 0}function kt(t){return t instanceof zt}function St(t){return kt(t)?t:t.scene&&kt(t.scene)?t.scene:t.parent&&t.parent.scene&&kt(t.parent.scene)?t.parent.scene:void 0}var xt=Phaser.Utils.Objects.GetValue,Ct=Phaser.GameObjects.Group,Ot=function(t){return t.add.text(0,0,"")},_t=new Phaser.Geom.Rectangle,Pt=Phaser.Utils.Objects.GetValue,Et=B.prototype.add,Mt={pin:function(t){return Et.call(this,t),this},addBackground:function(t,e,i){return void 0===this.backgroundChildren&&(this.backgroundChildren=[]),"string"==typeof e&&(i=e,e=void 0),void 0===e&&(e=0),this.pin(t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=gt(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},wt=/(\S+)\[(\d+)\]/i,Yt=Phaser.Geom.Rectangle,Dt=new Yt,Tt=function(){function i(t,e){p(this,i),this.gameObject=t,this.scene=t.scene,this.resetFromJSON(e),this.boot()}return d(i,[{key:"resetFromJSON",value:function(t){var e,i,n,s,r,o,h,a;return void 0!==t.x?(e=null,i=t.x):void 0!==t.left?(e=0,i=t.left):void 0!==t.right?(e=1,i=t.right):void 0!==t.centerX&&(e=.5,i=t.centerX),void 0!==t.y?(n=null,s=t.y):void 0!==t.top?(n=0,s=t.top):void 0!==t.bottom?(n=1,s=t.bottom):void 0!==t.centerY&&(n=.5,s=t.centerY),void 0!==i&&(i=i.replace("left","0%").replace("right","100%").replace("center","50%").split("%"),r=parseFloat(i[0])/100,o=""===i[1]?0:parseFloat(i[1])),void 0!==s&&(s=s.replace("top","0%").replace("bottom","100%").replace("center","50%").split("%"),h=parseFloat(s[0])/100,a=""===s[1]?0:parseFloat(s[1])),this.setAlign(e,n),this.setPercentage(r,h),this.setOffset(o,a),this}},{key:"boot",value:function(){this.scene.scale.on("resize",this.anchor,this),this.gameObject.on("destroy",this.destroy,this),this.anchor()}},{key:"shutdown",value:function(){this.scene.scale.off("resize",this.anchor,this),this.gameObject=void 0,this.scene=void 0}},{key:"destroy",value:function(){this.shutdown()}},{key:"setAlign",value:function(t,e){return this.alignX=t,this.alignY=e,this}},{key:"setPercentage",value:function(t,e){return this.percentageX=t,this.percentageY=e,this}},{key:"setOffset",value:function(t,e){return this.offsetX=t,this.offsetY=e,this}},{key:"anchor",value:function(){return this.viewport=function(t,e){void 0===e?e=new Yt:!0===e&&(e=Dt);var i=t.scale,n=i.canvasBounds,s=i.displayScale,r=i.autoCenter;return e.x=0<=n.x?0:-(n.x*s.x),e.y=0<=n.y?0:-(n.y*s.y),e.width=n.width*s.x-e.x,e.height=n.height*s.y-e.y,1!==r&&2!==r||(e.width-=e.x),1!==r&&3!==r||(e.height-=e.y),e}(this.scene,!0),this.updatePosition(),this}},{key:"updatePosition",value:function(){var t=this.gameObject;return null===this.alignX?t.x=this.anchorX:void 0!==this.alignX&&(t.x=this.anchorX+t.displayWidth*(t.originX-this.alignX)),null===this.alignY?this.gameObject.y=this.anchorY:void 0!==this.alignY&&(t.y=this.anchorY+t.displayHeight*(t.originY-this.alignY)),this}},{key:"anchorX",get:function(){return this.viewport.x+this.viewport.width*this.percentageX+this.offsetX}},{key:"anchorY",get:function(){return this.viewport.y+this.viewport.height*this.percentageY+this.offsetY}}]),i}(),jt={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=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):[]}},zt=Phaser.Scene,Xt=Phaser.GameObjects.GameObject,At=Phaser.Utils.Objects.GetValue,Rt=function(){function n(t,e){p(this,n),this.parent=t,this.scene=St(t);var i=At(e,"eventEmitter",!1);!0===i&&(i=void 0),this.setEventEmitter(i),this.boot()}return d(n,[{key:"boot",value:function(){this.parent instanceof Xt?this.parent.once&&this.parent.on("destroy",this.destroy,this):kt(this.parent)&&this.parent.events.once("shutdown",this.destroy,this)}},{key:"shutdown",value:function(){return this.stop(),kt(this.parent)&&this.parent.events.off("shutdown",this.destroy,this),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this}},{key:"destroy",value:function(){return this.shutdown(),this}},{key:"start",value:function(t){return this.isRunning||(this.tween=this.scene.tweens.add(t).on("complete",this.complete,this),!1===this.getEventEmitter()&&this.setEventEmitter(this.tween)),this}},{key:"restart",value:function(){return this.stop().start(),this}},{key:"stop",value:function(){return this.tween&&(this.getEventEmitter()===this.tween&&this.setEventEmitter(!1),this.tween.remove(),this.tween=void 0),this}},{key:"complete",value:function(){return this.stop(),this.getEventEmitter()&&this.emit("complete"),this}},{key:"isRunning",get:function(){return!!this.tween}}]),n}();Object.assign(Rt.prototype,jt);function Lt(t){return i=t,n="complete",new Promise(function(t,e){i.once(n,function(){t()})});var i,n}function Vt(t,e,i,n,s){return!(!t||!t.getBounds)&&(!(n&&!n(t,e,i))&&(!!(de=t.getBounds(de)).contains(e,i)&&!(s&&!s(t,e,i))))}function Ft(t,e,i,n,s){return Vt(t,e,i,ve(n),fe(s))}function Bt(t){return!(t.rexSizer&&t.rexSizer.hidden)}function Gt(t,e,i){!t||void 0===e&&void 0===i||(t.resize?(void 0===e&&(e=t.width),void 0===i&&(i=t.height),t.resize(e,i)):(void 0!==e&&(t.displayWidth=e),void 0!==i&&(t.displayHeight=i)))}var It=Phaser.Utils.Objects.GetValue,Nt=Phaser.Utils.Objects.GetAdvancedValue,Ht=function(){t(s,Rt);var n=e(s);function s(t,e){var i;return p(this,s),(i=n.call(this,t)).gameObject=t,i.scaleStart={},i.scaleEnd={},i.resetFromJSON(e),i}return d(s,[{key:"resetFromJSON",value:function(t){return this.setMode(It(t,"mode",0)),this.setScaleRange(Nt(t,"start",void 0),Nt(t,"end",0)),this.setDelay(Nt(t,"delay",0)),this.setDuration(Nt(t,"duration",1e3)),this.setEase(It(t,"ease",void 0)),this}},{key:"toJSON",value:function(){return{mode:this.mode,startX:this.startX,startY:this.startY,endX:this.endX,endY:this.endY,delay:this.delay,duration:this.duration}}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=Ut[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Nt(t,"x",this.gameObject.scaleX),this.startY=Nt(t,"y",this.gameObject.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Nt(e,"x",void 0),this.endY=Nt(e,"y",void 0)),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}},{key:"start",value:function(){if(this.isRunning)return this;var t={targets:this.gameObject,delay:this.delay,duration:this.duration,ease:this.ease,yoyo:2==this.mode,repeat:2==this.mode?-1:0};return void 0!==this.startX&&void 0!==this.endX&&(this.gameObject.scaleX=this.startX,t.scaleX=this.endX),void 0!==this.startY&&void 0!==this.endY&&(this.gameObject.scaleY=this.startY,t.scaleY=this.endY),m(y(s.prototype),"start",this).call(this,t),this}},{key:"complete",value:function(){return m(y(s.prototype),"complete",this).call(this),1===this.mode&&this.gameObject.destroy(),this}}]),s}(),Ut={stop:0,destroy:1,yoyo:2},Wt={},Jt=Phaser.Utils.Objects.IsPlainObject,Kt={popUp:function(t,e,i){if(Jt(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease}this._scale=function(t,e,i,n,s){switch(i){case Wt.mode=0:case"x":Wt.start={x:0};break;case 1:case"y":Wt.start={y:0};break;default:Wt.start=0}return Wt.end=1,Wt.duration=e,Wt.ease=void 0===n?"Cubic":n,void 0===s?s=new Ht(t,Wt):s.resetFromJSON(Wt),s.restart(),s}(this,t,e,i,this._scale),this._scale.once("complete",function(){this.emit("popup.complete",this)},this);var s=this.getParentSizer();if(s){var r=this;this._scale.on("update",function(){s.resetChildPositionState(r)})}return this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Lt(this._scale)},scaleDownDestroy:function(t,e,i,n){if(Jt(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease,n=s.destroy}this._scale=function(t,e,i,n,s,r){s instanceof Ht&&(r=s,s=void 0),void 0===s&&(s=!0);var o={};switch(o.mode=s?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0}return o.duration=e,o.ease=void 0===n?"Linear":n,void 0===r?r=new Ht(t,o):r.resetFromJSON(o),r.restart(),r}(this,t,e,i,n,this._scale),this._scale.once("complete",function(){this.emit("scaledown.complete",this)},this);var r=this.getParentSizer();if(r){var o=this;this._scale.on("update",function(){r.resetChildPositionState(o)})}return this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Lt(this._scale)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Lt(this._scale)}},qt=Phaser.Utils.Objects.GetValue,Zt=Phaser.Utils.Objects.GetAdvancedValue,$t=function(){t(s,Rt);var n=e(s);function s(t,e){var i;return p(this,s),(i=n.call(this,t)).gameObject=t,i.alphaStart=void 0,i.alphaEnd=void 0,i.resetFromJSON(e),i}return d(s,[{key:"resetFromJSON",value:function(t){return this.setMode(qt(t,"mode",0)),this.setAlphaRange(Zt(t,"start",this.gameObject.alpha),Zt(t,"end",0)),this.setDelay(Zt(t,"delay",0)),this.setDuration(Zt(t,"duration",1e3)),this}},{key:"toJSON",value:function(){return{mode:this.mode,start:this.alphaStart,end:this.alphaEnd,delay:this.delay,duration:this.duration}}},{key:"shutdown",value:function(){return m(y(s.prototype),"shutdown",this).call(this),this.gameObject=void 0,this}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=Qt[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"start",value:function(){return this.isRunning||(this.gameObject.setAlpha(this.alphaStart),m(y(s.prototype),"start",this).call(this,{targets:this.gameObject,alpha:this.alphaEnd,delay:this.delay,duration:this.duration,ease:"Linear",yoyo:2==this.mode,repeat:2==this.mode?-1:0})),this}},{key:"complete",value:function(){return m(y(s.prototype),"complete",this).call(this),1===this.mode&&this.gameObject.destroy(),this}}]),s}(),Qt={stop:0,destroy:1,yoyo:2},te=Phaser.Utils.Objects.IsPlainObject,ee={},ie={},ne=Phaser.Utils.Objects.IsPlainObject,se={fadeIn:function(t,e){var i,n,s,r,o,h;ne(t)&&(t=t.duration);this._fade=(n=t,s=e,r=(i=this)._fade,h=te(s)?(o=s.start,s.end):s,void 0===o&&(o=0),void 0===h&&(h=i.alpha),ee.mode=0,ee.start=o,ee.end=h,ee.duration=n,void 0===r?r=new $t(i,ee):r.resetFromJSON(ee),r.restart(),r),this._fade.once("complete",function(){this.emit("fadein.complete",this)},this);var a=this.getParentSizer();if(a){var l=this;this._fade.on("update",function(){a.resetChildAlphaState(l)})}return this},fadeInPromoise:function(t,e){return this.fadeIn(t,e),Lt(this._fade)},fadeOutDestroy:function(t,e){if(ne(t)){var i=t;t=i.duration,e=i.destroy}var n,s,r,o;this._fade=(s=t,r=e,o=(n=this)._fade,r instanceof $t&&(o=r,r=void 0),void 0===r&&(r=!0),ie.mode=r?1:0,ie.end=0,ie.duration=s,void 0===o?o=new $t(n,ie):o.resetFromJSON(ie),o.restart(),o),this._fade.once("complete",function(){this.emit("fadeout.complete",this)},this);var h=this.getParentSizer();if(h){var a=this;this._fade.on("update",function(){h.resetChildAlphaState(a)})}return this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Lt(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Lt(this._fade)}},re=Phaser.Utils.Objects.GetValue,oe=Phaser.Utils.Objects.GetAdvancedValue,he=function(){t(s,Rt);var n=e(s);function s(t,e){var i;return p(this,s),(i=n.call(this,t)).gameObject=t,i.resetFromJSON(e),i}return d(s,[{key:"resetFromJSON",value:function(t){if(this.setMode(re(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=oe(t,"x",void 0),i=oe(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this.setDelay(oe(t,"delay",0)),this.setDuration(oe(t,"duration",1e3)),this.setEase(re(t,"ease",void 0)),this}},{key:"toJSON",value:function(){return{mode:this.mode,startX:this.startX,startY:this.startY,endX:this.endX,endY:this.endY,delay:this.delay,duration:this.duration}}},{key:"setMode",value:function(t){return"string"==typeof t&&(t=ae[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.gameObject.x,this.startY=this.gameObject.y,this.endX=t,this.endY=e;else{var i=t;this.startX=oe(i,"startX",void 0),this.startY=oe(i,"startY",void 0),this.endX=oe(i,"endX",void 0),this.endY=oe(i,"endY",void 0)}return 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}},{key:"start",value:function(){if(this.isRunning)return this;var t={targets:this.gameObject,delay:this.delay,duration:this.duration,ease:this.ease,yoyo:2==this.mode,repeat:2==this.mode?-1:0};return void 0!==this.startX&&void 0!==this.endX&&(this.gameObject.setX(this.startX),t.x=this.endX),void 0!==this.startY&&void 0!==this.endY&&(this.gameObject.setY(this.startY),t.y=this.endY),m(y(s.prototype),"start",this).call(this,t),this}},{key:"complete",value:function(){return m(y(s.prototype),"complete",this).call(this),1===this.mode&&this.gameObject.destroy(),this}}]),s}(),ae={stop:0,destroy:1,yoyo:2},le=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},ue=Phaser.Utils.Objects.IsPlainObject,ce={moveFrom:function(t,e,i,n,s){if(ue(e)){var r=e;e=r.x,i=r.y,t=r.duration,n=r.ease}this._easeMove=function(t,e,i,n,s,r,o){r instanceof he&&(o=r,r=void 0),void 0===r&&(r=!1);var h={};return h.mode=r?1:0,void 0!==i&&(h.startX=le(i,t.x),h.endX=t.x),void 0!==n&&(h.startY=le(n,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===s?"Linear":s,void 0===o?o=new he(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,n,s,this._easeMove),this._easeMove.once("complete",function(){this.emit("movefrom.complete",this)},this);var o=this.getParentSizer();if(o){var h=this;this._easeMove.on("update",function(){o.resetChildPositionState(h)})}return this},moveFromPromise:function(t,e,i,n,s){return this.moveFrom(t,e,i,n,s),Lt(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Lt(this._easeMove)},moveTo:function(t,e,i,n,s){if(ue(e)){var r=e;e=r.x,i=r.y,t=r.duration,n=r.ease}this._easeMove=function(t,e,i,n,s,r,o){r instanceof he&&(o=r,r=void 0),void 0===r&&(r=!1);var h={};return h.mode=r?1:0,void 0!==i&&(h.startX=t.x,h.endX=le(i,t.x)),void 0!==n&&(h.startY=t.y,h.endY=le(n,t.y)),h.duration=e,h.ease=void 0===s?"Linear":s,void 0===o?o=new he(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,n,s,this._easeMove),this._easeMove.once("complete",function(){this.emit("moveto.complete",this)},this);var o=this.getParentSizer();if(o){var h=this;this._easeMove.on("update",function(){o.resetChildPositionState(h)})}return this},moveToPromise:function(t,e,i,n,s){return this.moveTo(t,e,i,n,s),Lt(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Lt(this._easeMove)}},de=void 0,ve=function(n){return n?function(t,e,i){return!!Bt(t)&&(n(t,e,i),!0)}:Bt},fe=function(t){return t},pe=Phaser.Display.Align.CENTER,ye=function(t,e,i){var n=this.getTopmostSizer();n.x+=e-this.x,n.y+=i-this.y},ge={getSizerConfig:function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer},pushIntoBounds:function(t){return void 0===t&&(t=function(t,e){void 0===e&&(void 0===I&&(I=new Phaser.Geom.Rectangle),e=I);var i=t.game.config;return e.setTo(0,0,i.width,i.height),e}(this.scene)),this.left=Math.max(this.left,t.left),this.right=Math.min(this.right,t.right),this.top=Math.max(this.top,t.top),this.bottom=Math.min(this.bottom,t.bottom),this},drawBounds:function(t,e){var i,n,s,r,o=t.scene;if("number"==typeof e)i=e;else{i=xt(e,"color",16777215);var h=xt(e,"name",!1);h&&(n=xt(h,"createTextCallback",Ot),s=xt(h,"createTextCallbackScope",void 0),"string"==typeof(r=xt(h,"align","left-top"))&&(r=H[r]))}if(n&&!t.children){t.children=new Ct(o),t.on("destroy",function(){t.children.destroy(!0),t.children=void 0});var a=t.clear.bind(t);t.clear=function(){a(),t.children.clear(!1,!0)}}for(var l,u,c=this.getAllChildren([this]),d=0,v=c.length;d<v;d++)(l=c[d]).getBounds&&(i&&t.lineStyle(1,i).strokeRectShape(l.getBounds(_t)),l.name&&n&&(u=s?n.call(s,o):n(o))&&(u.setText(l.name),t.children.add(u),U.setPosition(_t.x,_t.y).setSize(_t.width,_t.height),yt(u,U,r)));return this},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:mt,addElement:mt,getElement:function(t,e){if("string"==typeof t&&(t=t.split(".")),0!==t.length){var i=t.shift(),n=null;if("#"===i.charAt(0))i=i.substring(1),n=this.getByName(i,e);else if(-1===i.indexOf("["))this.childrenMap&&(n=this.childrenMap[i]);else{var s=i.match(wt);if(null!=s&&this.childrenMap){var r=this.childrenMap[s[1]];r&&(n=r[s[2]])}}return 0===t.length?n:n&&n.childrenMap?n.getElement(t):null}},getAllChildrenSizers:function(t){void 0===t&&(t=[]);for(var e=t.length,i=this.getChildrenSizers(t),n=t.length,s=e;s<n;s++)i[s].getAllChildrenSizers(t);return t},getChildrenSizers:function(t){return void 0===t&&(t=[]),t},preLayout:function(t){if(!t){this._layoutInit();for(var e,i=this.getChildrenSizers(),n=0,s=i.length;n<s;n++)!(e=i[n]).rexSizer.hidden&&e.dirty&&e.preLayout()}},_layoutInit:bt,layout:function(){return this._layout(),this},_layout:function(t,e,i){return this.rexSizer.hidden||!this.dirty?this:(this.preLayout(t),void 0===e&&(e=Math.max(this.childrenWidth,this.minWidth)),void 0===i&&(i=Math.max(this.childrenHeight,this.minHeight)),this.resize(e,i),this.layoutBackgrounds(),this.postLayout())},layoutBackgrounds:function(){if(void 0!==this.backgroundChildren)for(var t,e,i,n,s,r,o,h=this.backgroundChildren,a=this.left,l=this.top,u=this.width,c=this.height,d=0,v=h.length;d<v;d++)(e=(t=h[d]).rexSizer).hidden||(n=a+(i=e.padding).left,s=l+i.top,r=u-i.left-i.right,o=c-i.top-i.bottom,Gt(t,r,o),U.setPosition(n,s).setSize(r,o),yt(t,U,pe),this.resetChildPositionState(t))},postLayout:function(){return this._anchor&&this._anchor.updatePosition(),this},setAnchor:function(t){return void 0===this._anchor?this._anchor=new Tt(this,t):this._anchor.resetFromJSON(t),this},isInTouching:function(t,e){return void 0===e&&(e=this),function(t,e,i,n){if(e)return Vt(t,e.x,e.y,i,n);for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,h=0;h<r;h++)if(e=o[h],Vt(t,e.x,e.y,i,n))return!0;return!1}(e,t)},pointToChild:function(t,e,i,n,s){var r;if((r=i)&&"function"==typeof r||(s=i,n=i=void 0),void 0===s&&(s=this.sizerChildren?this.sizerChildren:this.children),C(s)){for(var o,h=0,a=s.length;h<a;h++)if(o=s[h],Ft(o,t,e,i,n))return o}else for(var l in s)if(o=s[l],Ft(o,t,e,i,n))return o;return null},setDraggable:function(t,e){var i=l(t);return"string"===i?t=this.getElement(t):void 0!==t&&"object"==i||(e=t,t=this),void 0===e&&(e=!0),t.input&&t.input.hasOwnProperty("draggable")?t.input.draggable=e:e&&(t.setInteractive(),t.scene.input.setDraggable(t),t.on("drag",ye,this)),this}};Object.assign(ge,Mt,{getParentSizer:function(t){return this.getParent(t)},getTopmostSizer:function(t){return this.getTopmostParent(t)}},Kt,se,ce);var me=Phaser.Utils.Objects.GetValue,be=function(){t(l,B);var a=e(l);function l(t,e,i,n,s,r){var o;p(this,l),(o=a.call(this,t,e,i,2,2)).isRexSizer=!0,o.setMinSize(n,s),o.setName(me(r,"name","")),o.rexSizer={},o.backgroundChildren=void 0,o.sizerChildren=void 0;var h=me(r,"anchor",void 0);return h&&o.setAnchor(h),o.space=gt(me(r,"space",0)),o.setDraggable(me(r,"draggable",!1)),o.setDirty(!0),o}return d(l,[{key:"destroy",value:function(t){this.scene&&(void 0!==this.backgroundChildren&&(this.backgroundChildren.length=0),m(y(l.prototype),"destroy",this).call(this,t))}},{key:"setMinSize",value:function(t,e){return this.setMinWidth(t).setMinHeight(e),this}},{key:"setMinWidth",value:function(t){return null==t&&(t=0),this.minWidth=t,this}},{key:"setMinHeight",value:function(t){return null==t&&(t=0),this.minHeight=t,this}},{key:"setDirty",value:function(t){return void 0===t&&(t=!0),this.dirty=t,this}},{key:"alignLeft",value:function(t){return this.left=t,this}},{key:"alignRight",value:function(t){return this.right=t,this}},{key:"alignCenterX",value:function(t){return this.centerX=t,this}},{key:"alignTop",value:function(t){return this.top=t,this}},{key:"alignBottom",value:function(t){return this.bottom=t,this}},{key:"alignCenterY",value:function(t){return this.centerY=t,this}},{key:"childrenWidth",get:function(){return void 0===this._childrenWidth&&(this._childrenWidth=this.getChildrenWidth()),this._childrenWidth}},{key:"childrenHeight",get:function(){return void 0===this._childrenHeight&&(this._childrenHeight=this.getChildrenHeight()),this._childrenHeight}},{key:"left",get:function(){return this.x-W(this)*this.originX},set:function(t){this.x+=t-this.left}},{key:"right",get:function(){return this.left+W(this)},set:function(t){this.x+=t-this.right}},{key:"centerX",get:function(){return this.left+W(this)/2},set:function(t){this.x+=t-this.centerX}},{key:"top",get:function(){return this.y-J(this)*this.originY},set:function(t){this.y+=t-this.top}},{key:"bottom",get:function(){return this.top+J(this)},set:function(t){this.y+=t-this.bottom}},{key:"centerY",get:function(){return this.top+J(this)/2},set:function(t){this.y+=t-this.centerY}},{key:"innerLeft",get:function(){return this.left+this.space.left}},{key:"innerRight",get:function(){return this.right-this.space.right}},{key:"innerTop",get:function(){return this.top+this.space.top}},{key:"innerBottom",get:function(){return this.bottom-this.space.bottom}},{key:"innerWidth",get:function(){return this.width-this.space.left-this.space.right}},{key:"innerHeight",get:function(){return this.height-this.space.top-this.space.bottom}}]),l}();Object.assign(be.prototype,ge);function ke(t,e,i,n,s,r,o){this.pin(t);var h=l(e);if(null===e)return this;if("number"!==h)if("string"===h)e=Oe[e];else if(Se(e)){var a;e=xe(a=e,"proportion",0),i=xe(a,"align",Ce),n=xe(a,"padding",0),s=xe(a,"expand",!1),r=xe(a,"key",void 0),o=xe(a,"index",void 0)}return"string"==typeof i&&(i=H[i]),void 0===e&&(e=0),void 0===i&&(i=Ce),void 0===n&&(n=0),void 0===s&&(s=!1),(a=this.getSizerConfig(t)).proportion=e,a.align=i,a.padding=gt(n),a.expand=s,void 0===o||o>=this.sizerChildren.length?this.sizerChildren.push(t):this.sizerChildren.splice(o,0,t),void 0!==r&&this.addChildrenMap(r,t),this}var Se=Phaser.Utils.Objects.IsPlainObject,xe=Phaser.Utils.Objects.GetValue,Ce=Phaser.Display.Align.CENTER,Oe={min:0,full:-1},_e={add:ke,addSpace:function(t){var e,i;return void 0===t&&(t=1),ke.call(this,(e=this.scene,(i=e.add.zone(0,0,1,1)).isRexSpace=!0,i),t),this},insert:function(t,e,i,n,s,r,o){return ke.call(this,e,i,n,s,r,o,t),this}},Pe=Phaser.Utils.Array.Remove,Ee=B.prototype.remove,Me=B.prototype.clear,we={remove:function(t,e){return this.getParentSizer(t)!==this||(Pe(this.sizerChildren,t),Ee.call(this,t,e)),this},removeAll:function(t){for(var e=0,i=this.sizerChildren;e<i;e++)this.remove(this.sizerChildren[e],t);return this.sizerChildren.length=0,this},clear:function(t){return this.sizerChildren.length=0,this.backgroundChildren&&(this.backgroundChildren.length=0),Me.call(this,t),this}},Ye={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s=0,r=this.sizerChildren;if(0===this.orientation)for(var o=0,h=r.length;o<h;o++)(e=r[o]).rexSizer.hidden||(n=0===e.rexSizer.proportion||t&&!e.isRexSpace&&0<e.rexSizer.proportion?e.isRexSizer?Math.max(e.minWidth,e.childrenWidth):W(e):0,n+=(i=e.rexSizer.padding).left+i.right,0<o&&(n+=this.space.item),s+=n);else for(o=0,h=r.length;o<h;o++)(e=r[o]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(n=e.isRexSizer?Math.max(e.minWidth,e.childrenWidth):W(e),n+=(i=e.rexSizer.padding).left+i.right,s=Math.max(n,s)));return s+this.space.left+this.space.right},getChildrenHeight:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s=0,r=this.sizerChildren;if(0===this.orientation)for(var o=0,h=r.length;o<h;o++)(e=r[o]).rexSizer.hidden||(n=e.isRexSizer?Math.max(e.minHeight,e.childrenHeight):J(e),n+=(i=e.rexSizer.padding).top+i.bottom,s=Math.max(n,s));else for(o=0,h=r.length;o<h;o++)(e=r[o]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(n=0===e.rexSizer.proportion||t&&!e.isRexSpace&&0<e.rexSizer.proportion?e.isRexSizer?Math.max(e.minHeight,e.childrenHeight):J(e):0,n+=(i=e.rexSizer.padding).top+i.bottom,0<o&&(n+=this.space.item),s+=n));return s+this.space.top+this.space.bottom},getChildrenProportion:function(){for(var t,e,i=0,n=this.sizerChildren,s=0,r=n.length;s<r;s++)(t=n[s]).rexSizer.hidden||0<(e=t.rexSizer.proportion)&&(i+=e);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)(e=i[n]).isRexSizer&&t.push(e);return t},_layout:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;var n;if(this.preLayout(t),void 0===e&&(e=Math.max(this.childrenWidth,this.minWidth)),void 0===i&&(i=Math.max(this.childrenHeight,this.minHeight)),this.resize(e,i),0<this.childrenProportion){var s=0===this.orientation?this.width-this.childrenWidth:this.height-this.childrenHeight;n=0<s?(s=0===this.orientation?this.width-this.getChildrenWidth(!1):this.height-this.getChildrenHeight(!1))/this.childrenProportion:0}else n=0;this.proportionLength=n;for(var r,o,h,a,l,u,c,d,v,f,p,y,g,m,b,k,S,x=this.sizerChildren,C=this.innerLeft,O=this.innerTop,_=this.innerWidth,P=this.innerHeight,E=C,M=O,w=0,Y=x.length;w<Y;w++)(r=x[w]).rexSizer.hidden||(h=(o=r.rexSizer).padding,m=this,b=void 0,k=r.rexSizer,S=k.padding,0===m.orientation?0<k.proportion&&0<m.proportionLength&&(b=k.proportion*m.proportionLength):k.expand&&(b=m.innerWidth-S.left-S.right),d=b,f=this,p=void 0,y=r.rexSizer,g=y.padding,0===f.orientation?y.expand&&(p=f.innerHeight-g.top-g.bottom):0<y.proportion&&0<f.proportionLength&&(p=y.proportion*f.proportionLength),v=p,r.isRexSizer?r._layout(this,d,v):Gt(r,d,v),void 0===d&&(d=W(r)),void 0===v&&(v=J(r)),c=0===this.orientation?(a=E+h.left,u=0===o.proportion||0===n?d:o.proportion*n,l=M+h.top,P-h.top-h.bottom):(a=E+h.left,u=_-h.left-h.right,l=M+h.top,0===o.proportion||0===n?v:o.proportion*n),U.setPosition(a,l).setSize(u,c),yt(r,U,o.align),this.resetChildPositionState(r),0===this.orientation?E+=u+h.left+h.right+this.space.item:M+=c+h.top+h.bottom+this.space.item);return this.layoutBackgrounds(),this.postLayout()},_layoutInit:function(){bt.call(this),this._childrenProportion=void 0}};Object.assign(Ye,_e,we);var De={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},Te=Phaser.Utils.Objects.IsPlainObject,je=Phaser.Utils.Objects.GetValue,ze=function(){t(l,be);var a=e(l);function l(t,e,i,n,s,r,o){var h;return p(this,l),Te(e)?(e=je(o=e,"x",0),i=je(o,"y",0),n=je(o,"width",void 0),s=je(o,"height",void 0),r=je(o,"orientation",0)):Te(n)?(n=je(o=n,"width",void 0),s=je(o,"height",void 0),r=je(o,"orientation",0)):Te(r)&&(r=je(o=r,"orientation",0)),void 0===r&&(r=0),(h=a.call(this,t,e,i,n,s,o)).type="rexSizer",h.sizerChildren=[],h.setOrientation(r),h.setItemSpacing(je(o,"space.item",0)),h.addChildrenMap("items",h.sizerChildren),h}return d(l,[{key:"destroy",value:function(t){this.scene&&(this.sizerChildren.length=0,m(y(l.prototype),"destroy",this).call(this,t))}},{key:"setOrientation",value:function(t){return"string"==typeof t&&(t=De[t]),this.orientation=t,this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=this.getChildrenProportion()),this._childrenProportion}}]),l}();Object.assign(ze.prototype,Ye);function Xe(t){var e=Be(t,"scrollMode",0);return"string"==typeof e&&(e=Fe[e]),e}function Ae(t,e,i){var n,s,r;return t.y===e.y?(n=Math.min(t.x,e.x),s=Math.max(t.x,e.x),r=Ge(i.x,n,s)):t.x===e.x&&(n=Math.min(t.y,e.y),s=Math.max(t.y,e.y),r=Ge(i.y,n,s)),r}function Re(t,e,i){this.enable&&(Ie.x=e,Ie.y=i,this.value=Ae(this.getStartPoint(),this.getEndPoint(),Ie))}function Le(t){this.enable&&t.isDown&&(Ne.x=t.worldX,Ne.y=t.worldY,this.value=Ae(this.getStartPoint(),this.getEndPoint(),Ne))}function Ve(t,e){void 0===e&&(e=He);var i=this.childrenMap.thumb,n=i.x,s=i.y;return yt(i,this,t),e.x=i.x,e.y=i.y,i.x=n,i.y=s,e}var Fe={v:0,vertical:0,h:1,horizontal:1},Be=Phaser.Utils.Objects.GetValue,Ge=Phaser.Math.Percent,Ie={},Ne={},He={},Ue=Phaser.Display.Align.LEFT_CENTER,We=Phaser.Display.Align.TOP_CENTER,Je={},Ke=Phaser.Display.Align.RIGHT_CENTER,qe=Phaser.Display.Align.BOTTOM_CENTER,Ze={},$e=Phaser.Math.Linear,Qe={},ti=Phaser.Display.Align.LEFT_CENTER,ei=Phaser.Display.Align.TOP_CENTER,ii=Phaser.Utils.Objects.GetValue,ni=Phaser.Math.Clamp,si=Phaser.Math.Linear,ri=Phaser.Math.Percent,oi=Phaser.Math.Snap.To,hi=function(){t(c,ze);var u=e(c);function c(t,e){var i;p(this,c),(i=u.call(this,t,e)).type="rexSlider",i.eventEmitter=ii(e,"eventEmitter",g(i));var n=ii(e,"background",void 0),s=ii(e,"track",void 0),r=ii(e,"indicator",void 0),o=ii(e,"thumb",void 0);n&&i.addBackground(n),s&&i.add(s,1,"center",0,!0),r&&i.pin(r),o&&i.pin(o);var h=ii(e,"input",0);switch("string"==typeof h&&(h=ai[h]),h){case 0:o&&(o.setInteractive(),i.scene.input.setDraggable(o),o.on("drag",Re,g(i)));break;case 1:i.setInteractive().on("pointerdown",Le,g(i)).on("pointermove",Le,g(i))}i.addChildrenMap("background",n),i.addChildrenMap("track",s),i.addChildrenMap("indicator",r),i.addChildrenMap("thumb",o);var a=ii(e,"valuechangeCallback",null);if(null!==a){var l=ii(e,"valuechangeCallbackScope",void 0);i.eventEmitter.on("valuechange",a,l)}return i.setEnable(ii(e,"enable",void 0)),i.setGap(ii(e,"gap",void 0)),i.setValue(ii(e,"value",0)),i}return d(c,[{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setGap",value:function(t){return this.gap=t,this}},{key:"setValue",value:function(t,e,i){return null==t||(void 0!==e&&(t=ri(t,e,i)),this.value=t),this}},{key:"addValue",value:function(t,e,i){return void 0!==e&&(t=ri(t,e,i)),this.value+=t,this}},{key:"getValue",value:function(t,e){var i=this.value;return void 0!==t&&(i=si(t,e,i)),i}},{key:"_layout",value:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;var n=this.getElement("track");return 1===this.orientation?Gt(n,void 0,0):Gt(n,0,void 0),m(y(c.prototype),"_layout",this).call(this,t,e,i),this.updateThumb(),this.updateIndicator(),this}},{key:"value",get:function(){return this._value},set:function(t){void 0!==this.gap&&(t=oi(t,this.gap));var e=this._value;this._value=ni(t,0,1),e!==this._value&&(this.updateThumb(this._value),this.updateIndicator(this._value),this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter))}}]),c}(),ai={drag:0,click:1,none:-1},li={getStartPoint:function(t){if(void 0===t&&(t=Je),this.childrenMap.thumb){var e=0===this.orientation?Ue:We;Ve.call(this,e,t)}else 0===this.orientation?(t.x=this.left+1,t.y=this.centerY):(t.x=this.centerX,t.y=this.top+1);return t},getEndPoint:function(t){if(void 0===t&&(t=Ze),this.childrenMap.thumb){var e=0===this.orientation?Ke:qe;Ve.call(this,e,t)}else 0===this.orientation?(t.x=this.right-1,t.y=this.centerY):(t.x=this.centerX,t.y=this.bottom-1);return t},updateThumb:function(t){var e,i,n,s,r=this.childrenMap.thumb;return void 0===r||(void 0===t&&(t=this.value),e=t,i=this.getStartPoint(),n=this.getEndPoint(),void 0===(s=r)&&(s=Qe),s.x=$e(i.x,n.x,e),s.y=$e(i.y,n.y,e),this.resetChildPositionState(r)),this},updateIndicator:function(t){var e,i,n=this.childrenMap.indicator;if(void 0===n)return this;void 0===t&&(t=this.value);var s=this.childrenMap.thumb;if(s)if(0===this.orientation){var r=W(s);e=s.x-r*s.originX+r-this.left}else{var o=J(s);i=s.y-o*s.originY+o-this.top}else 0===this.orientation?e=this.width*t:i=this.height*t;Gt(n,e,i);var h=0===this.orientation?ti:ei;yt(n,this,h),this.resetChildPositionState(n)}};Object.assign(hi.prototype,li);var ui=function(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,o=0;o<n.length;o++){if(!s.hasOwnProperty(n[o])){r=i;break}r=s[n[o]],s=s[n[o]]}return r}return i},ci=function(){function o(t){p(this,o);var e=ui(t,"states",void 0);e&&this.addStates(e);var i=ui(t,"extend",void 0);if(i)for(var n in i)this.hasOwnProperty(n)&&void 0!==this[n]||(this[n]=i[n]);var s=ui(t,"eventEmitter",void 0),r=ui(t,"EventEmitterClass",void 0);this.setEventEmitter(s,r),this._stateLock=!1,this.resetFromJSON(t)}return d(o,[{key:"shutdown",value:function(){this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"resetFromJSON",value:function(t){this.setEnable(ui(t,"enable",!0)),this.start(ui(t,"start",void 0));var e=ui(t,"init",void 0);return e&&e.call(this),this}},{key:"toJSON",value:function(){return{curState:this.state,prevState:this.prevState,enable:this.enable,start:this._start}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"start",value:function(t){return this._start=t,this._prevState=void 0,this._state=t,this}},{key:"goto",value:function(t){return null!=t&&(this.state=t),this}},{key:"next",value:function(){var t,e=this["next_"+this.state];return e&&(t="string"==typeof e?e:e.call(this)),this.goto(t),this}},{key:"addState",value:function(t,e){var i=ui(e,"next",void 0);i&&(this["next_"+t]=i);var n=ui(e,"exit",void 0);n&&(this["exit_"+t]=n);var s=ui(e,"enter",void 0);return s&&(this["enter_"+t]=s),this}},{key:"addStates",value:function(t){for(var e in t)this.addState(e,t[e]);return this}},{key:"update",value:function(t,e,i){void 0===i&&(i="update");var n=this[i+"_"+this.state];n&&n.call(this,t,e)}},{key:"preupdate",value:function(t,e){this.update(t,e,"preupdate")}},{key:"postupdate",value:function(t,e){this.update(t,e,"postupdate")}},{key:"state",set:function(t){if(this.enable&&!this._stateLock&&this._state!==t){if(this._prevState=this._state,this._state=t,this._stateLock=!0,this.emit("statechange",this),null!=this._prevState){var e="exit_"+this._prevState,i=this[e];i&&i.call(this),this.emit(e,this)}if(this._stateLock=!1,null!=this._state){var n="enter_"+this._state,s=this[n];s&&s.call(this),this.emit(n,this)}}},get:function(){return this._state}},{key:"prevState",get:function(){return this._prevState}}]),o}();Object.assign(ci.prototype,jt);var di=function(){t(s,ci);var n=e(s);function s(t,e){var i;return p(this,s),(i=n.call(this,e)).parent=t,i.init(),i}return d(s,[{key:"init",value:function(){this.start("IDLE")}},{key:"next_IDLE",value:function(){var t,e=this.parent;return e.dragState.isDown&&(t=0===e.dragThreshold?"DRAG":"DRAGBEGIN"),t}},{key:"update_IDLE",value:function(){this.next()}},{key:"next_DRAGBEGIN",value:function(){var t=this.parent,e=t.dragState;return e.isDown?e.pointer.getDistance()>=t.dragThreshold?"DRAG":"DRAGBEGIN":"IDLE"}},{key:"update_DRAGBEGIN",value:function(){this.next()}},{key:"next_DRAG",value:function(){var t,e=this.parent;return e.dragState.isUp&&(t=e.outOfBounds?"BACK":e.slidingEnable?"SLIDE":"IDLE"),t}},{key:"update_DRAG",value:function(){var t=this.parent;t.dragState.justMoved&&t.dragging(),this.next()}},{key:"next_SLIDE",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isSliding||(t="IDLE"),t}},{key:"enter_SLIDE",value:function(){this.parent.onSliding()}},{key:"exit_SLIDE",value:function(){this.parent.stop()}},{key:"update_SLIDE",value:function(t,e){this.parent.sliding(t,e),this.next()}},{key:"next_BACK",value:function(){var t,e=this.parent;return e.dragState.isDown?t="DRAG":e.isPullBack||(t="IDLE"),t}},{key:"enter_BACK",value:function(){this.parent.onPullBack()}},{key:"exit_BACK",value:function(){this.parent.stop()}},{key:"update_BACK",value:function(t,e){this.parent.pullBack(t,e),this.next()}}]),s}(),vi=Phaser.Utils.Objects.GetValue,fi=Phaser.Math.Distance.Between,pi=function(){function i(t,e){p(this,i),this.gameObject=t,this.scene=St(t),this.setEventEmitter(vi(e,"eventEmitter",void 0)),this._enable=void 0,t.setInteractive(vi(e,"inputConfig",void 0)),this.resetFromJSON(e),this.boot()}return d(i,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.isInTouched=!1,this.holdStartTime=void 0,this.x=void 0,this.y=void 0,this.preX=void 0,this.preY=void 0,this.localX=void 0,this.localY=void 0,this.justMoved=!1,this.setEnable(vi(t,"enable",!0)),this.holdThreshold=vi(t,"holdThreshold",50),this}},{key:"boot",value:function(){this.gameObject.on("pointerdown",this.onPointIn,this),this.gameObject.on("pointerup",this.onPointOut,this),this.gameObject.on("pointerout",this.onPointOut,this),this.gameObject.on("pointermove",this.onPointerMove,this),this.gameObject.on("destroy",this.destroy,this),this.scene.events.on("preupdate",this.preupdate,this)}},{key:"shutdown",value:function(){this.scene&&this.scene.events.off("preupdate",this.preupdate,this),this.pointer=void 0,this.gameObject=void 0,this.scene=void 0,this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.localX=e,this.localY=i)}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0)}},{key:"onPointerMove",value:function(t,e,i){this.enable&&t.isDown&&this.pointer===t&&(this.localX=e,this.localY=i)}},{key:"preupdate",value:function(t){if(this.enable){var e=this.pointer;this.justMoved=!1,e&&!this.isInTouched?(this.x=e.x,this.y=e.y,this.preX=e.x,this.preY=e.y,this.isInTouched=!0,this.holdStartTime=void 0,this.emit("touchstart",e,this.localX,this.localY)):e&&this.isInTouched?this.x===e.x&&this.y===e.y?void 0===this.holdStartTime?this.holdStartTime=t:t-this.holdStartTime>this.holdThreshold&&(this.preX=this.x,this.preY=this.y):(this.preX=this.x,this.preY=this.y,this.x=e.x,this.y=e.y,this.holdStartTime=void 0,this.justMoved=!0,this.emit("touchmove",e,this.localX,this.localY)):!e&&this.isInTouched&&(this.isInTouched=!1,this.holdStartTime=void 0,this.emit("touchend",e))}}},{key:"enable",get:function(){return this._enable},set:function(t){this._enable!==t&&(t||(this.isInTouched=!1,this.pointer=void 0),this._enable=t)}},{key:"isDown",get:function(){return this.pointer&&this.pointer.isDown}},{key:"isUp",get:function(){return!this.isDown}},{key:"dx",get:function(){return this.x-this.preX}},{key:"dy",get:function(){return this.y-this.preY}},{key:"dt",get:function(){return this.scene.sys.game.loop.delta}},{key:"speed",get:function(){return this.x===this.preX&&this.y===this.preY?0:fi(this.preX,this.preY,this.x,this.y)/(.001*this.dt)}},{key:"speedX",get:function(){return this.dx/(.001*this.dt)}},{key:"speedY",get:function(){return this.dy/(.001*this.dt)}}]),i}();Object.assign(pi.prototype,jt);var yi=Phaser.Utils.Objects.GetValue,gi=function(){function e(t){p(this,e),this.resetFromJSON(t)}return d(e,[{key:"resetFromJSON",value:function(t){return this.setValue(yi(t,"value",0)),this.setSpeed(yi(t,"speed",0)),this.setAcceleration(yi(t,"acceleration",0)),this}},{key:"reset",value:function(){this.setValue(0),this.setSpeed(0),this.setAcceleration(0)}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setSpeed",value:function(t){return this.speed=t,this}},{key:"setAcceleration",value:function(t){return this.acceleration=t,this}},{key:"updateSpeed",value:function(t){return 0!==this.acceleration&&(this.speed+=this.acceleration*t,this.speed<0&&(this.speed=0)),this}},{key:"getDeltaValue",value:function(t){return this.updateSpeed(t),this.speed<=0?0:this.speed*t}},{key:"update",value:function(t){return this.updateSpeed(t),0<this.speed&&(this.value+=this.getDeltaValue(t)),this}},{key:"isMoving",get:function(){return 0<this.speed}}]),e}(),mi=function(){function t(){p(this,t),this.value,this.dir,this.movement=new gi}return d(t,[{key:"init",value:function(t,e,i,n,s){return this.value=t,this.end=s,this.dir=void 0!==s?t<s:e,this.movement.setSpeed(i).setAcceleration(-n),this}},{key:"stop",value:function(){this.movement.reset()}},{key:"update",value:function(t){var e=this.movement.getDeltaValue(t);return this.dir||(e=-e),void 0===this.end?this.value+=e:0===e?this.value=this.end:(this.value+=e,this.dir?this.value>this.end&&(this.value=this.end):this.value<this.end&&(this.value=this.end)),this}},{key:"isMoving",get:function(){return this.movement.isMoving}}]),t}(),bi=Phaser.Utils.Objects.GetValue,ki=function(){function h(t,e){p(this,h),this.gameObject=t,this.scene=St(t),this.setEventEmitter(bi(e,"eventEmitter",void 0));var i=bi(e,"enable",!0),n={enable:i,eventEmitter:!1};this._state=new di(this,n);var s={inputConfig:bi(e,"inputConfig",void 0),enable:i,eventEmitter:!1};this.dragState=new pi(t,s),this._enable=void 0,this._value=void 0,this._slowDown=new mi;var r=bi(e,"valuechangeCallback",null);if(null!==r){var o=bi(e,"valuechangeCallbackScope",void 0);this.on("valuechange",r,o)}if(null!==(r=bi(e,"overmaxCallback",null))){o=bi(e,"overmaxCallbackScope",void 0);this.on("overmax",r,o)}if(null!==(r=bi(e,"overminCallback",null))){o=bi(e,"overminCallbackScope",void 0);this.on("overmin",r,o)}this.resetFromJSON(e),this.boot()}return d(h,[{key:"resetFromJSON",value:function(t){this.setOrientationMode(bi(t,"orientation",0)),this.setDragThreshold(bi(t,"threshold",10)),this.setSlidingDeceleration(bi(t,"slidingDeceleration",5e3)),this.setBackDeceleration(bi(t,"backDeceleration",2e3));var e=bi(t,"bounds",void 0);return e?this.setBounds(e):this.setBounds(bi(t,"max",0),bi(t,"min",0)),this.setValue(bi(t,"value",this.maxValue||0)),this.setEnable(bi(t,"enable",!0)),this}},{key:"boot",value:function(){this.scene.events.on("update",this._state.update,this._state),this.gameObject.on("destroy",this.destroy,this)}},{key:"shutdown",value:function(){this.destroyEventEmitter(),this.scene&&this.scene.events.off("update",this._state.update,this._state),this.gameObject=void 0,this.scene=void 0,this._state.destroy(),this.dragState.destroy()}},{key:"destroy",value:function(){this.shutdown()}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setOrientationMode",value:function(t){return"string"==typeof t&&(t=Si[t]),this.orientationMode=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setSlidingDeceleration",value:function(t){return this.slidingDeceleration=t,this}},{key:"setBackDeceleration",value:function(t){return this.backDeceleration=t,this}},{key:"setBounds",value:function(t,e){if(Array.isArray(t)){var i=t;t=i[0],e=i[1]}return t<e?(this.minValue=t,this.maxValue=e):(this.minValue=e,this.maxValue=t),this}},{key:"setValue",value:function(t){this.value=t}},{key:"overMax",value:function(t){return null!=this.maxValue&&t>this.maxValue}},{key:"overMin",value:function(t){return null!=this.minValue&&t<this.minValue}},{key:"dragging",value:function(){this.value+=this.dragDelta}},{key:"onSliding",value:function(){var t=this.value,e=this.dragSpeed;if(0===e)return this._slowDown.stop(),void this._state.next();var i=this.slidingDeceleration;this._slowDown.init(t,0<e,Math.abs(e),i)}},{key:"sliding",value:function(t,e){e*=.001;var i=this._slowDown.update(e).value;this.overMax(i)?(this.value=this.maxValue,this._slowDown.stop()):this.overMin(i)?(this.value=this.minValue,this._slowDown.stop()):this.value=i}},{key:"onPullBack",value:function(){var t=this.value,e=this.outOfMinBound?this.minValue:this.maxValue,i=Math.abs(e-t),n=this.backDeceleration,s=Math.sqrt(2*n*i);this._slowDown.init(t,void 0,s,n,e)}},{key:"pullBack",value:function(t,e){e*=.001,this.value=this._slowDown.update(e).value,this._slowDown.isMoving||this._state.next()}},{key:"stop",value:function(){this._slowDown.stop()}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return this._enable=t,this._state.setEnable(t),this.dragState.setEnable(t),this}},{key:"value",get:function(){return this._value},set:function(t){if(t!==this._value){var e=this._value,i=this.overMax(t),n=this.overMin(t);i&&this.emit("overmax",t,e),n&&this.emit("overmin",t,e),this.backEnable||(i&&(t=this.maxValue),n&&(t=this.minValue)),this._value=t,this.emit("valuechange",t,e)}}},{key:"state",get:function(){return this._state.state}},{key:"isDragging",get:function(){return this.dragState.isInTouched}},{key:"outOfMaxBound",get:function(){return this.overMax(this.value)}},{key:"outOfMinBound",get:function(){return this.overMin(this.value)}},{key:"outOfBounds",get:function(){return this.outOfMinBound||this.outOfMaxBound}},{key:"backEnable",get:function(){return"number"==typeof this.backDeceleration}},{key:"isPullBack",get:function(){return this._slowDown.isMoving}},{key:"slidingEnable",get:function(){return"number"==typeof this.slidingDeceleration}},{key:"isSliding",get:function(){return this._slowDown.isMoving}},{key:"dragDelta",get:function(){return 0===this.orientationMode?this.dragState.dy:1===this.orientationMode?this.dragState.dx:0}},{key:"dragSpeed",get:function(){return 0===this.orientationMode?this.dragState.speedY:1===this.orientationMode?this.dragState.speedX:0}}]),h}();Object.assign(ki.prototype,jt);var Si={y:0,v:0,vertical:0,x:1,h:1,horizontal:1},xi=Phaser.Utils.Objects.GetValue,Ci={right:0,left:1,bottom:0,top:1},Oi=Phaser.Utils.Objects.GetValue,_i=function(){t(f,ze);var v=e(f);function f(t,e){var i;p(this,f),void 0===e&&(e={});var n=Xe(e);e.orientation=0===n?1:0,(i=v.call(this,t,e)).type=Oi(e,"type","rexScrollable");var s=Oi(e,"background",void 0),r=function(t){var e,i,n,s=this.scene,r=Xe(t),o=new ze(s,{orientation:r}),h=xi(t,"child.gameObject",void 0),a=xi(t,"slider",void 0),l=xi(t,"scroller",!0);if(h){var u,c=xi(t,"space.child",0);if(this.childPadding={},"number"!=typeof c){var d=c;0===r?(c=xi(d,"right",0),this.childPadding.top=xi(d,"top",0),this.childPadding.bottom=xi(d,"bottom",0)):(c=xi(d,"bottom",0),this.childPadding.top=xi(d,"left",0),this.childPadding.bottom=xi(d,"right",0))}else this.childPadding.top=0,this.childPadding.bottom=0;if(a)!0===a&&(a={}),"string"==typeof(i=xi(a,"position",0))&&(i=Ci[i]),u=0===r?0===i?{left:c}:{right:c}:0===i?{top:c}:{bottom:c},a.orientation=0===o.orientation?1:0,e=new hi(s,a);l&&(!0===l&&(l={}),l.orientation=r,n=new ki(h,l)),e&&1===i&&o.add(e,0,"center",u,!0);var v=xi(t,"child.proportion",1),f=xi(t,"child.expand",!0);o.add(h,v,"center",0,f),e&&0===i&&o.add(e,0,"center",u,!0)}return e&&e.on("valuechange",function(t){this.t=t,this.emit("scroll",this)},this),n&&n.on("valuechange",function(t){this.childOY=t,this.emit("scroll",this)},this),this.addChildrenMap("child",h),this.addChildrenMap("slider",e),this.addChildrenMap("scroller",n),o}.call(g(i),e),o=Oi(e,"header",void 0),h=Oi(e,"footer",void 0);if(s&&i.addBackground(s),o){var a=Oi(e,"align.header","center"),l=Oi(e,"space.header",0);c=0===n?{bottom:l}:{right:l};var u=Oi(e,"expand.header",!0);i.add(o,0,a,c,u)}if(r&&i.add(r,1,"center",0,!0),h){a=Oi(e,"align.footer","center");var c,d=Oi(e,"space.footer",0);c=0===n?{top:d}:{left:d};u=Oi(e,"expand.footer",!0);i.add(h,0,a,c,u)}return i.addChildrenMap("background",s),i.addChildrenMap("header",o),i.addChildrenMap("footer",h),i}return d(f,[{key:"_layout",value:function(t,e,i){return this.rexSizer.hidden||!this.dirty||(m(y(f.prototype),"_layout",this).call(this,t,e,i),this.resizeController()),this}},{key:"setChildOY",value:function(t){return this.childOY=t,this}},{key:"setT",value:function(t){return this.t=t,this}},{key:"scrollToTop",value:function(){return this.t=0,this}},{key:"scrollToBottom",value:function(){return this.t=1,this}},{key:"setSliderEnable",value:function(t){return void 0===t&&(t=!0),this.sliderEnable=t,this}},{key:"setScrollerEnable",value:function(t){return void 0===t&&(t=!0),this.scrollerEnable=t,this}},{key:"t",set:function(t){var e=this.childPadding;if(0!==e.top||0!==e.bottom){var i=this.childrenMap.child,n=i.topChildOY-i.bottomChildOY;t=((n+e.top+e.bottom)*t-e.top)/n}this.childrenMap.child.t=t,this.updateController()},get:function(){var t=this.childrenMap.child.t,e=this.childPadding;if(0!==e.top||0!==e.bottom){var i=this.childrenMap.child,n=i.topChildOY-i.bottomChildOY,s=n+e.top+e.bottom;t=(n*t+e.top)/s}return t}},{key:"childOY",set:function(t){this.childrenMap.child.childOY=t,this.updateController()},get:function(){return this.childrenMap.child.childOY}},{key:"topChildOY",get:function(){return this.childrenMap.child.topChildOY+this.childPadding.top}},{key:"bottomChildOY",get:function(){return this.childrenMap.child.bottomChildOY-this.childPadding.bottom}},{key:"sliderEnable",get:function(){var t=this.childrenMap.slider;if(t)return t.enable},set:function(t){var e=this.childrenMap.slider;e&&e.setEnable(t)}},{key:"scrollerEnable",get:function(){var t=this.childrenMap.scroller;if(t)return t.enable},set:function(t){var e=this.childrenMap.scroller;e&&e.setEnable(t)}}]),f}(),Pi={resizeController:function(){var t=this.topChildOY,e=this.bottomChildOY,i=this.childrenMap.scroller,n=this.childrenMap.slider;return i&&i.setBounds(e,t),n&&n.setEnable(e!==t),this.updateController(),this},updateController:function(){var t=this.childrenMap.scroller,e=this.childrenMap.slider;t&&t.setValue(this.childOY),e&&e.setValue(this.t)}};Object.assign(_i.prototype,Pi);function Ei(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask}var Mi=Phaser.Utils.Objects.GetValue,wi=Phaser.Display.Align.TOP_LEFT,Yi={update:0,everyTick:1},Di=Phaser.Geom.Intersects.RectangleToRectangle,Ti=Phaser.Geom.Rectangle.Overlaps,ji=function(t,e){var i=0,n=e.top,s=e.bottom,r=e.left,o=e.right;return i+=t.contains(r,n)?1:0,i+=t.contains(r,s)?1:0,i+=t.contains(o,n)?1:0,i+=t.contains(o,s)?1:0},zi=function(t,e){t.setChildMaskVisible(e,!0),e.clearMask&&e.clearMask()},Xi=function(t,e,i){t.setChildMaskVisible(e,!0),e.setMask&&e.setMask(i)},Ai=function(t,e){t.setChildMaskVisible(e,!1),e.clearMask&&e.clearMask()},Ri=Phaser.GameObjects.Graphics,Li=function(){t(r,Ri);var s=e(r);function r(t,e,i){var n;return p(this,r),void 0===e&&(e=0),"string"==typeof e&&(e=Vi[e]),void 0===i&&(i=0),(n=s.call(this,t.scene)).parent=t,n.shape=e,n.padding=i,n.setPosition().resize(),n}return d(r,[{key:"destroy",value:function(){return this.parent=void 0,m(y(r.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),m(y(r.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;if(void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i&&(i=this.padding),this.widthSave===t&&this.heightSave===e&&this.paddingSave===i)return this;switch(this.clear().fillStyle(16777215),this.shape){case 1:var s=Math.min(t,e)/2;this.fillCircle(0,0,s+i);break;default:this.fillRect(-(t*n.originX)-i,-(e*n.originY)-i,t+2*i,e+2*i)}return this.widthSave=t,this.heightSave=e,this.paddingSave=i,this}}]),r}(),Vi={rectangle:0,circle:1},Fi={addChildMask:function(t,e,i,n){var s=new Li(e,i,n);return t&&!t.isRexSizer&&t.setMask(s.createGeometryMask()),this.pin(s),s},enableChildrenMask:function(t){var e=this.addChildMask(null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},maskChildren:function(t){return void 0===t&&(t=this.getAllChildren()),function(t,e,i){if(e){void 0===i&&(i=t.getAllChildren());for(var n,s,r=t.getBounds(),o=Ei(e),h=0,a=i.length;h<a;h++)if(!(n=i[h]).hasOwnProperty("isRexContainerLite")&&n!==o&&t.getLocalState(n).visible)if(n.getBounds)switch(s=n.getBounds(s),ji(r,s)){case 4:zi(t,n);break;case 0:Di(r,s)||Ti(r,s)?Xi(t,n,e):Ai(t,n);break;default:Xi(t,n,e)}else Xi(t,n,e)}}(this,this.childrenMask,t),this},layoutChildrenMask:function(){if(void 0===this.childrenMask)return this;var t=Ei(this.childrenMask);return t.setPosition().resize(),this.resetChildPositionState(t),this}},Bi={setChild:function(t,e,i){t.setOrigin&&t.setOrigin(0),this.add(t);var n,s,r,o=this.getSizerConfig(t);return o.align=wi,o.expand=e,this.child=t,!0===i?(n=!0,r=s=0):!1===i?n=!1:(n=Mi(i,"mask",!0),s=Mi(i,"padding",0),r=Mi(o,"updateMode",0)),this.maskUpdateMode=r,n&&("string"==typeof r&&(r=Yi[r]),1===r&&this.scene.game.events.on("poststep",this.maskChildren,this),this.enableChildrenMask(s)),this},getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t=this.child;return!t.rexSizer.hidden&&0===this.scrollMode?t.isRexSizer?Math.max(t.minWidth,t.childrenWidth):W(t):0},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t=this.child;return t.rexSizer.hidden||0===this.scrollMode?0:t.isRexSizer?Math.max(t.minHeight,t.childrenHeight):J(t)},getChildrenSizers:function(t){return void 0===t&&(t=[]),this.child&&this.child.isRexSizer&&t.push(this.child),t},resetChildPosition:function(){var t=this.left,e=this.top;0===this.scrollMode?e+=this.childOY:t+=this.childOY,this.child.setPosition(t,e),this.resetChildPositionState(this.child),0===this.maskUpdateMode&&this.maskChildren()},_layout:function(t,e,i){if(this.rexSizer.hidden||!this.dirty)return this;this.preLayout(t),void 0===e&&(e=Math.max(this.childrenWidth,this.minWidth)),void 0===i&&(i=Math.max(this.childrenHeight,this.minHeight)),this.resize(e,i);var n,s,r=this.child;return r.rexSizer.hidden||(0===this.scrollMode?n=this.width:s=this.height,r.isRexSizer?r._layout(this,n,s):Gt(r,n,s),this.layoutChildrenMask(),this.resetChildPosition()),this.postLayout()}};Object.assign(Bi,Fi);var Gi=Phaser.Utils.Objects.IsPlainObject,Ii=Phaser.Utils.Objects.GetValue,Ni=function(){t(c,be);var u=e(c);function c(t,e,i,n,s,r){var o;p(this,c),Gi(e)?(e=Ii(r=e,"x",0),i=Ii(r,"y",0),n=Ii(r,"width",void 0),s=Ii(r,"height",void 0)):Gi(n)&&(n=Ii(r=n,"width",void 0),s=Ii(r,"height",void 0)),(o=u.call(this,t,e,i,n,s,r)).type="rexScrollableBlock",o.child=void 0,o.childrenMask=void 0,o._childOY=0,o.execeedTopState=!1,o.execeedBottomState=!1,o.setScrollMode(Ii(r,"scrollMode",!0)),o.setClampMode(Ii(r,"clamplChildOY",!0));var h=Ii(r,"child",void 0),a=Ii(r,"expand",!0),l=Ii(r,"mask",void 0);return o.setChild(h,a,l),o}return d(c,[{key:"destroy",value:function(t){this.scene&&(1===this.maskUpdateMode&&this.scene.game.events.off("poststep",this.maskChildren,this),this.child=void 0,this.childrenMask&&(this.childrenMask.destroy(),this.childrenMask=void 0),m(y(c.prototype),"destroy",this).call(this,t))}},{key:"setScrollMode",value:function(t){return"string"==typeof t&&(t=Fe[t.toLowerCase()]),this.scrollMode=t,this}},{key:"setClampMode",value:function(t){return this.clampChildOYMode=t,this}},{key:"childOYExceedTop",value:function(t){return void 0===t&&(t=this.childOY),t>this.topChildOY}},{key:"childOYExeceedBottom",value:function(t){return void 0===t&&(t=this.childOY),t<this.bottomChildOY}},{key:"setChildOY",value:function(t){return this.childOY=t,this}},{key:"setChildOYByPercentage",value:function(t){return this.t=t,this}},{key:"instHeight",get:function(){return 0===this.scrollMode?this.height:this.width}},{key:"instWidth",get:function(){return 0===this.scrollMode?this.width:this.height}},{key:"childHeight",get:function(){return(0===this.scrollMode?J:W)(this.child)}},{key:"childWidth",get:function(){return(0===this.scrollMode?W:J)(this.child)}},{key:"topChildOY",get:function(){return 0}},{key:"bottomChildOY",get:function(){return-this.visibleHeight}},{key:"visibleHeight",get:function(){var t=this.childHeight,e=this.instHeight;return e<t?t-e:0}},{key:"childOY",get:function(){return this._childOY},set:function(t){var e=this.topChildOY,i=this.bottomChildOY,n=this.childOYExceedTop(t),s=this.childOYExeceedBottom(t);this.clampChildOYMode&&(this.instHeight>this.childHeight?t=0:n?t=e:s&&(t=i)),this._childOY!==t&&(this._childOY=t,this.resetChildPosition()),n&&(this.execeedTopState||this.emit("execeedtop",this,t,e)),this.execeedTopState=n,s&&(this.execeedBottomState||this.emit("execeedbottom",this,t,i)),this.execeedBottomState=s}},{key:"t",set:function(t){this.childOY=-this.visibleHeight*t},get:function(){var t=this.visibleHeight;return 0===t?0:this.childOY/-t}}]),c}();Object.assign(Ni.prototype,Bi);var Hi=Phaser.Utils.Objects.GetValue;return function(){t(d,_i);var c=e(d);function d(t,e){var i;p(this,d),void 0===e&&(e={});var n=Xe(e),s=Hi(e,"panel",void 0);void 0===s&&(s={}),s.scrollMode=n,s.clamplChildOY=Hi(e,"clamplChildOY",!1);var r=new Ni(t,s);t.add.existing(r);var o,h,a=Hi(s,"width",void 0),l=Hi(s,"height",void 0);h=0===n?(o=void 0===a?1:0,void 0===l):(o=void 0===l?1:0,void 0===a),e.type="rexScrollablePanel",e.child={gameObject:r,proportion:o,expand:h};var u=Hi(e,"space",void 0);return u&&(u.child=u.panel),(i=c.call(this,t,e)).addChildrenMap("panel",i.childrenMap.child.child),i}return d}()});
  