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).rexoverlapsizer=e()}(this,function(){"use strict";function s(t){return(s="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 l(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 t(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}function e(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 c(t){return(c=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 o(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function d(n){var r=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=c(n);if(r){var i=c(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return o(this,t)}}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t}function f(t,e,i){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=u(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(i):r.value}})(t,e,i||t)}function h(t,e,i,n){return(h="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var r,s,o,h,a=u(t,e);if(a){if((r=Object.getOwnPropertyDescriptor(a,e)).set)return r.set.call(n,i),!0;if(!r.writable)return!1}if(r=Object.getOwnPropertyDescriptor(n,e)){if(!r.writable)return!1;r.value=i,Object.defineProperty(n,e,r)}else h=i,(o=e)in(s=n)?Object.defineProperty(s,o,{value:h,enumerable:!0,configurable:!0,writable:!0}):s[o]=h;return!0})(t,e,i,n)}function r(t,e,i,n,r){if(!h(t,e,i,n||t)&&r)throw new Error("failed to set property");return i}function a(t){return function(t){if(Array.isArray(t))return p(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 p(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 p(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 p(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 v=Phaser.GameObjects.Zone,y=Phaser.Utils.Array.Add,g=Phaser.Utils.Array.Remove,m=function(){e(h,v);var o=d(h);function h(t,e,i,n,r){var s;return l(this,h),void 0===n&&(n=1),void 0===r&&(r=1),(s=o.call(this,t,e,i,n,r)).children=[],s}return t(h,[{key:"destroy",value:function(t){this.scene&&(this.clear(!t),f(c(h.prototype),"destroy",this).call(this,t))}},{key:"contains",value:function(t){return-1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return y(this.children,t,0,function(t){t.once("destroy",e.onChildDestroy,e)},this),this}},{key:"remove",value:function(t,e){var i=this;return g(this.children,t,function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()}),this}},{key:"onChildDestroy",value:function(t){this.remove(t,!1)}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i<n;i++)(e=this.children[i]).off("destroy",this.onChildDestroy,this),t&&e.destroy();return this.children.length=0,this}}]),h}(),C=Phaser.GameObjects.Components;Phaser.Class.mixin(m,[C.Alpha,C.Flip]);function b(t){var e;return t.hasOwnProperty("rexContainer")&&(e=t.rexContainer.parent),e}function S(t){return t.hasOwnProperty("rexContainer")||(t.rexContainer={}),t.rexContainer}function k(t){return this.setParent(t),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),w.call(this,t),this}function P(t){this.setParent(t);var e=S(t);return e.x=t.x,e.y=t.y,e.rotation=t.rotation,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.flipX=t.flipX,e.flipY=t.flipY,e.alpha=t.alpha,e.visible=t.visible,e.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),w.call(this,t),this}function x(t,e){return t===e?1:t/e}function E(t){return"[object Array]"===Object.prototype.toString.call(t)}var _={setParent:function(t,e){void 0===e&&(e=this);var i=S(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),b(t)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=b(t);e;)e=b(t=e);return t}(t)}},w=m.prototype.add,O={add:function(t){return Array.isArray(t)?this.addMultiple(t):k.call(this,t),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)k.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):P.call(this,t),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)P.call(this,t[e]);return this}},X=m.prototype.remove,Y=m.prototype.clear,z={remove:function(t,e){return b(t)!==this||(this.setParent(t,null),X.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 Y.call(this,t),this}},A={getLocalState:function(t){return S(t)},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}},M=Phaser.Math.RotateAround,R={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,M(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,M(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=S(t),i=e.parent;return t.x=e.x,t.y=e.y,i.localToWorld(t),t.scaleX=e.scaleX*i.scaleX,t.scaleY=e.scaleY*i.scaleY,void 0!==t.flipX&&(t.flipX=i.flipX?!e.flipX:e.flipX,t.flipY=i.flipY?!e.flipY:e.flipY),t.rotation=e.rotation+i.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=S(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),void 0!==t.flipX&&(e.flipX=t.flipX,e.flipY=t.flipY),e.rotation=t.rotation-i.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=S(t);return n.x=e,n.y=i,this.updateChildPosition(t),this}},D={updateChildRotation:function(t){var e=S(t),i=e.parent;return t.rotation=i.rotation+e.rotation,this},syncRotation:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState:function(t){var e=S(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation:function(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildLocalRotation:function(t,e){return S(t).rotation=e,this.updateChildRotation(t),this}},W={updateChildScale:function(t){var e=S(t),i=e.parent;return t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY,this},syncScale:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState:function(t){var e=S(t),i=e.parent;return e.scaleX=x(t.scaleX,i.scaleX),e.scaleY=x(t.scaleY,i.scaleY),this},setChildScale:function(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildLocalScale:function(t,e,i){void 0===i&&(i=e);var n=S(t);return n.scaleX=e,n.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize:function(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this}},j={updateChildVisible:function(t){var e=S(t),i=e.parent,n=!e.hasOwnProperty("maskVisible")||e.maskVisible;return t.visible=i.visible&&e.visible&&n,this},syncVisible:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState:function(t){var e=S(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),S(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),S(t).maskVisible=e,this.updateChildVisible(t),this}},F={updateChildAlpha:function(t){var e=S(t),i=e.parent;return t.alpha=i.alpha*e.alpha,this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){var e=S(t),i=e.parent;return e.alpha=x(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return S(t).alpha=e,this.updateChildAlpha(t),this}},L={updateChildActive:function(t){var e=S(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState:function(t){return S(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),S(t).active=e,this.updateChildActive(t),this}},H={updateChildScrollFactor:function(t){var e=S(t).parent;return t.setScrollFactor(e.scrollFactorX,e.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},V={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}},N=Phaser.Utils.Array,G={getChildren:function(){return this.children},getAllChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n<r;n++){if(e=i[n],t.push(e),e.hasOwnProperty("isRexContainerLite"))t.push.apply(t,a(e.getAllChildren()))}return t},getAllVisibleChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,r=i.length;n<r;n++){if((e=i[n]).visible)if(t.push(e),e.hasOwnProperty("isRexContainerLite"))t.push.apply(t,a(e.getAllVisibleChildren()))}return t},contains:function(t){var e=b(t);return!!e&&(e===this||this.contains(e))},getByName:function(t,e){if(e){for(var i,n,r=[this];r.length;)for(var s=0,o=(i=r.shift()).children.length;s<o;s++){if((n=i.children[s]).name===t)return n;n.isRexContainerLite&&r.push(n)}return null}return N.GetFirst(this.children,"name",t)},getRandom:function(t,e){return N.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return N.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return N.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return N.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return N.Swap(this.children,t,e),this},moveTo:function(t,e){return N.MoveTo(this.children,t,e),this},setAll:function(t,e,i,n){return N.SetAll(this.children,t,e,i,n),this}},U={tweenChild:function(t){var e=t.targets;E(e)||(e=[e]);for(var i,n,r=[],s=0,o=e.length;s<o;s++)(n=e[s]).hasOwnProperty("rexContainer")&&(i=n.scene,r.push(n.rexContainer));if(i){t.targets=r;var h=i.tweens.add(t);return h.on("update",function(t,e,i){var n=i.parent,r=i.self;switch(e){case"x":case"y":n.updateChildPosition(r);break;case"angle":case"rotation":n.updateChildRotation(r);break;case"scaleX":case"scaleY":n.updateChildScale(r);break;case"alpha":n.updateChildAlpha(r)}}),h}},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},I={};Object.assign(I,_,O,z,A,R,T,D,W,j,F,L,H,V,{setDepth:function(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),n=0,r=i.length;n<r;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}},G,U);var B=function(){e(a,m);var h=d(a);function a(t,e,i,n,r,s){var o;return l(this,a),(o=h.call(this,t,e,i,n,r)).type="rexContainerLite",o.isRexContainerLite=!0,o.syncChildrenEnable=!0,o._active=!0,o._mask=null,o._scrollFactorX=1,o._scrollFactorY=1,s&&o.add(s),o}return t(a,[{key:"destroy",value:function(t){this.scene&&(this.syncChildrenEnable=!1,f(c(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 f(c(a.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(r(c(a.prototype),"rotation",t,this,!0),this.syncPosition())}},{key:"scaleX",get:function(){return f(c(a.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(r(c(a.prototype),"scaleX",t,this,!0),this.syncPosition())}},{key:"scaleY",get:function(){return f(c(a.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(r(c(a.prototype),"scaleY",t,this,!0),this.syncPosition())}},{key:"flipX",get:function(){return f(c(a.prototype),"flipX",this)},set:function(t){f(c(a.prototype),"flipX",this)!==t&&(r(c(a.prototype),"flipX",t,this,!0),this.syncPosition())}},{key:"flipY",get:function(){return f(c(a.prototype),"flipY",this)},set:function(t){f(c(a.prototype),"flipY",this)!==t&&(r(c(a.prototype),"flipY",t,this,!0),this.syncPosition())}},{key:"visible",get:function(){return f(c(a.prototype),"visible",this)},set:function(t){f(c(a.prototype),"visible",this)!==t&&(r(c(a.prototype),"visible",t,this,!0),this.syncVisible())}},{key:"alpha",get:function(){return f(c(a.prototype),"alpha",this)},set:function(t){f(c(a.prototype),"alpha",this)!==t&&(r(c(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,I);function J(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer}function K(){}var Z,q=Phaser.Display.Align,$={center:q.CENTER,left:q.LEFT_CENTER,right:q.RIGHT_CENTER,top:q.TOP_CENTER,bottom:q.BOTTOM_CENTER,"left-top":q.TOP_LEFT,"left-center":q.LEFT_CENTER,"left-bottom":q.BOTTOM_LEFT,"center-top":q.TOP_CENTER,"center-center":q.CENTER,"center-bottom":q.BOTTOM_CENTER,"right-top":q.TOP_RIGHT,"right-center":q.RIGHT_CENTER,"right-bottom":q.BOTTOM_RIGHT},Q=new Phaser.GameObjects.Zone({sys:{queueDepthSort:K,events:{once:K}}},0,0,1,1);Q.setOrigin(0);function tt(t){return void 0!==t.displayWidth?t.displayWidth:t.width}function et(t){return void 0!==t.displayHeight?t.displayHeight:t.height}function it(t){var e=et(t);return t.y+e-e*t.originY}function nt(t){var e=tt(t);return t.x-e*t.originX+.5*e}function rt(t,e){var i=et(t);return t.y=e-i+i*t.originY,t}function st(t,e){var i=tt(t),n=i*t.originX;return t.x=e+n-.5*i,t}function ot(t){var e=tt(t);return t.x-e*t.originX}function ht(t,e){var i=tt(t);return t.x=e+i*t.originX,t}function at(t){var e=tt(t);return t.x+e-e*t.originX}function ut(t,e){var i=tt(t);return t.x=e-i+i*t.originX,t}function lt(t,e){var i=et(t),n=i*t.originY;return t.y=e+n-.5*i,t}function ct(t){var e=et(t);return t.y-e*t.originY+.5*e}function dt(t){var e=et(t);return t.y-e*t.originY}function ft(t,e){var i=et(t);return t.y=e+i*t.originY,t}var pt=0,vt=1,yt=2,gt=4,mt=6,Ct=8,bt=10,St=12,kt=[];kt[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),st(t,nt(e)+i),rt(t,it(e)+n),t},kt[bt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ht(t,ot(e)-i),rt(t,it(e)+n),t},kt[St]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ut(t,at(e)+i),rt(t,it(e)+n),t},kt[mt]=function(t,e,i,n){var r,s,o;return void 0===i&&(i=0),void 0===n&&(n=0),r=t,s=nt(e)+i,o=ct(e)+n,st(r,s),lt(r,o),t},kt[gt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ht(t,ot(e)-i),lt(t,ct(e)+n),t},kt[Ct]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ut(t,at(e)+i),lt(t,ct(e)+n),t},kt[vt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),st(t,nt(e)+i),ft(t,dt(e)-n),t},kt[pt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ht(t,ot(e)-i),ft(t,dt(e)-n),t},kt[yt]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ut(t,at(e)+i),ft(t,dt(e)-n),t};function Pt(t,e,i,n,r){return kt[i](t,e,n,r)}function xt(t,e){return void 0===e&&(e={}),"number"==typeof t?(e.left=t,e.right=t,e.top=t,e.bottom=t):(e.left=Mt(t,"left",0),e.right=Mt(t,"right",0),e.top=Mt(t,"top",0),e.bottom=Mt(t,"bottom",0)),e}function Et(t,e){return void 0===this.childrenMap&&(this.childrenMap={}),this.childrenMap[t]=e,this}function _t(t,e){return void 0===e?t:t[e]}function wt(t,e,i){var n=s(e);"string"===n?t[e]=i:"number"===n?(t.left=e,t.right=e,t.top=e,t.bottom=e):(t.left=Wt(e,"left",0),t.right=Wt(e,"right",0),t.top=Wt(e,"top",0),t.bottom=Wt(e,"bottom",0))}function Ot(t){return t instanceof Lt}var Xt=Phaser.Utils.Objects.GetValue,Yt=Phaser.GameObjects.Group,zt=function(t){return t.add.text(0,0,"")},At=new Phaser.Geom.Rectangle,Mt=Phaser.Utils.Objects.GetValue,Rt=B.prototype.add,Tt={pin:function(t){return Rt.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=xt(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Dt=/(\S+)\[(\d+)\]/i,Wt=Phaser.Utils.Objects.GetValue,jt={getInnerPadding:function(t){return _t(this.space,t)},setInnerPadding:function(t,e){return wt(this.space,t,e),this},getOutterPadding:function(t){return _t(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return wt(this.getSizerConfig(this).padding,t,e),this}},Ft={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):[]}},Lt=Phaser.Scene,Ht=Phaser.Utils.Objects.GetValue,Vt=function(){function n(t,e){var i;l(this,n),this.parent=t,this.scene=null==(i=t)||"object"!==s(i)?null:Ot(i)?i:i.scene&&Ot(i.scene)?i.scene:i.parent&&i.parent.scene&&Ot(i.parent.scene)?i.parent.scene:void 0,this.isShutdown=!1,this.setEventEmitter(Ht(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 t(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(Vt.prototype,Ft);var Nt=Phaser.Geom.Rectangle;Phaser.Scale.Center;function Gt(t){return i=t,n="complete",new Promise(function(t,e){i.once(n,function(){t()})});var i,n}function Ut(t,e,i,n,r){return!(!t||!t.getBounds)&&(!(n&&!n(t,e,i))&&(!!(Pe=t.getBounds(Pe)).contains(e,i)&&!(r&&!r(t,e,i))))}function It(t,e,i,n,r){return Ut(t,e,i,xe(n),Ee(r))}function Bt(t){return!(t.rexSizer&&t.rexSizer.hidden)}function Jt(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 Kt=new Nt,Zt=function(){e(r,Vt);var n=d(r);function r(t,e){var i;return l(this,r),(i=n.call(this,t,{eventEmitter:!1})).resetFromJSON(e),i.boot(),i}return t(r,[{key:"resetFromJSON",value:function(t){var e,i,n,r,s,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,r=t.y):void 0!==t.top?(n=0,r=t.top):void 0!==t.bottom?(n=1,r=t.bottom):void 0!==t.centerY&&(n=.5,r=t.centerY),void 0!==i&&(i=i.replace("left","0%").replace("right","100%").replace("center","50%").split("%"),s=parseFloat(i[0])/100,o=""===i[1]?0:parseFloat(i[1])),void 0!==r&&(r=r.replace("top","0%").replace("bottom","100%").replace("center","50%").split("%"),h=parseFloat(r[0])/100,a=""===r[1]?0:parseFloat(r[1])),this.setAlign(e,n),this.setPercentage(s,h),this.setOffset(o,a),this}},{key:"boot",value:function(){this.scene.scale.on("resize",this.anchor,this),this.anchor()}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.scale.off("resize",this.anchor,this),f(c(r.prototype),"shutdown",this).call(this,t))}},{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 Nt:!0===e&&(e=Kt);var i,n,r=t.scale,s=r.baseSize,o=r.parentSize,h=r.canvasBounds,a=r.displayScale,u=0<=h.x?0:-(h.x*a.x),l=0<=h.y?0:-(h.y*a.y);return i=o.width>=h.width?s.width:s.width-(h.width-o.width)*a.x,n=o.height>=h.height?s.height:s.height-(h.height-o.height)*a.y,e.setTo(u,l,i,n),e}(this.scene,!0),this.updatePosition(),this}},{key:"updatePosition",value:function(){var t=this.parent;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?t.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}}]),r}(),qt=function(){e(n,Vt);var i=d(n);function n(t,e){return l(this,n),void 0===e&&(e={}),e.hasOwnProperty("eventEmitter")||(e.eventEmitter=!1),i.call(this,t,e)}return t(n,[{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),f(c(n.prototype),"shutdown",this).call(this,t))}},{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:"pause",value:function(){return this.tween&&this.tween.pause(),this}},{key:"resume",value:function(){return this.tween&&this.tween.resume(),this}},{key:"complete",value:function(){return this.stop(),this.getEventEmitter()&&this.emit("complete"),this}},{key:"isRunning",get:function(){return!!this.tween}}]),n}(),$t=Phaser.Utils.Objects.GetValue,Qt=Phaser.Utils.Objects.GetAdvancedValue,te=function(){e(r,qt);var n=d(r);function r(t,e){var i;return l(this,r),(i=n.call(this,t)).scaleStart={},i.scaleEnd={},i.resetFromJSON(e),i}return t(r,[{key:"resetFromJSON",value:function(t){return this.setMode($t(t,"mode",0)),this.setScaleRange(Qt(t,"start",void 0),Qt(t,"end",0)),this.setDelay(Qt(t,"delay",0)),this.setDuration(Qt(t,"duration",1e3)),this.setEase($t(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=ee[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return"number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Qt(t,"x",this.parent.scaleX),this.startY=Qt(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Qt(e,"x",void 0),this.endY=Qt(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.parent,delay:this.delay,duration:this.duration,ease:this.ease,yoyo:2==this.mode,repeat:2==this.mode?-1:0,onComplete:function(){1===this.mode&&this.parent.destroy()},onCompleteScope:this};return void 0!==this.startX&&void 0!==this.endX&&(this.parent.scaleX=this.startX,t.scaleX=this.endX),void 0!==this.startY&&void 0!==this.endY&&(this.parent.scaleY=this.startY,t.scaleY=this.endY),f(c(r.prototype),"start",this).call(this,t),this}}]),r}(),ee={stop:0,destroy:1,yoyo:2},ie={},ne=Phaser.Utils.Objects.IsPlainObject,re={popUp:function(t,e,i){if(ne(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease}this._scale=function(t,e,i,n,r){switch(i){case ie.mode=0:case"x":ie.start={x:0};break;case 1:case"y":ie.start={y:0};break;default:ie.start=0}return ie.end=1,ie.duration=e,ie.ease=void 0===n?"Cubic":n,void 0===r?r=new te(t,ie):r.resetFromJSON(ie),r.restart(),r}(this,t,e,i,this._scale),this._scale.once("complete",function(){this.emit("popup.complete",this)},this);var r=this.getParentSizer();if(r){var s=this;this._scale.on("update",function(){r.resetChildPositionState(s)})}return this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Gt(this._scale)},scaleDownDestroy:function(t,e,i,n){if(ne(t)){var r=t;t=r.duration,e=r.orientation,i=r.ease,n=r.destroy}this._scale=function(t,e,i,n,r,s){r instanceof te&&(s=r,r=void 0),void 0===r&&(r=!0);var o={};switch(o.mode=r?1:0,i){case 0:case"x":o.end={x:0};break;case 1:case"y":o.end={y:0};break;default:o.end=0}return o.duration=e,o.ease=void 0===n?"Linear":n,void 0===s?s=new te(t,o):s.resetFromJSON(o),s.restart(),s}(this,t,e,i,n,this._scale),this._scale.once("complete",function(){this.emit("scaledown.complete",this)},this);var s=this.getParentSizer();if(s){var o=this;this._scale.on("update",function(){s.resetChildPositionState(o)})}return this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Gt(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),Gt(this._scale)}},se=Phaser.Utils.Objects.GetValue,oe=Phaser.Utils.Objects.GetAdvancedValue,he=function(){e(r,qt);var n=d(r);function r(t,e){var i;return l(this,r),(i=n.call(this,t)).alphaStart=void 0,i.alphaEnd=void 0,i.resetFromJSON(e),i}return t(r,[{key:"resetFromJSON",value:function(t){return this.setMode(se(t,"mode",0)),this.setAlphaRange(oe(t,"start",this.parent.alpha),oe(t,"end",0)),this.setDelay(oe(t,"delay",0)),this.setDuration(oe(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:"setMode",value:function(t){return"string"==typeof t&&(t=ae[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(){if(this.isRunning)return this;this.parent.setAlpha(this.alphaStart);var t={targets:this.parent,alpha:this.alphaEnd,delay:this.delay,duration:this.duration,ease:"Linear",yoyo:2==this.mode,repeat:2==this.mode?-1:0,onComplete:function(){1===this.mode&&this.parent.destroy()},onCompleteScope:this};return f(c(r.prototype),"start",this).call(this,t),this}}]),r}(),ae={stop:0,destroy:1,yoyo:2},ue=Phaser.Utils.Objects.IsPlainObject,le={},ce={},de=Phaser.Utils.Objects.IsPlainObject,fe={fadeIn:function(t,e){var i,n,r,s,o,h;de(t)&&(t=t.duration);this._fade=(n=t,r=e,s=(i=this)._fade,h=ue(r)?(o=r.start,r.end):r,void 0===o&&(o=0),void 0===h&&(h=i.alpha),le.mode=0,le.start=o,le.end=h,le.duration=n,void 0===s?s=new he(i,le):s.resetFromJSON(le),s.restart(),s),this._fade.once("complete",function(){this.emit("fadein.complete",this)},this);var a=this.getParentSizer();if(a){var u=this;this._fade.on("update",function(){a.resetChildAlphaState(u)})}return this},fadeInPromoise:function(t,e){return this.fadeIn(t,e),Gt(this._fade)},fadeOutDestroy:function(t,e){if(de(t)){var i=t;t=i.duration,e=i.destroy}var n,r,s,o;this._fade=(r=t,s=e,o=(n=this)._fade,s instanceof he&&(o=s,s=void 0),void 0===s&&(s=!0),ce.mode=s?1:0,ce.end=0,ce.duration=r,void 0===o?o=new he(n,ce):o.resetFromJSON(ce),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),Gt(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Gt(this._fade)}},pe=Phaser.Utils.Objects.GetValue,ve=Phaser.Utils.Objects.GetAdvancedValue,ye=function(){e(r,qt);var n=d(r);function r(t,e){var i;return l(this,r),(i=n.call(this,t)).resetFromJSON(e),i}return t(r,[{key:"resetFromJSON",value:function(t){if(this.setMode(pe(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=ve(t,"x",void 0),i=ve(t,"y",void 0);this.setTargetPosition(e,i)}else this.setTargetPosition(t);return this.setDelay(ve(t,"delay",0)),this.setDuration(ve(t,"duration",1e3)),this.setEase(pe(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=ge[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else{var i=t;this.startX=ve(i,"startX",void 0),this.startY=ve(i,"startY",void 0),this.endX=ve(i,"endX",void 0),this.endY=ve(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.parent,delay:this.delay,duration:this.duration,ease:this.ease,yoyo:2==this.mode,repeat:2==this.mode?-1:0,onComplete:function(){1===this.mode&&this.parent.destroy()},onCompleteScope:this};return void 0!==this.startX&&void 0!==this.endX&&(this.parent.setX(this.startX),t.x=this.endX),void 0!==this.startY&&void 0!==this.endY&&(this.parent.setY(this.startY),t.y=this.endY),f(c(r.prototype),"start",this).call(this,t),this}}]),r}(),ge={stop:0,destroy:1,yoyo:2},me=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}},Ce=Phaser.Utils.Objects.IsPlainObject,be={moveFrom:function(t,e,i,n,r){if(Ce(e)){var s=e;e=s.x,i=s.y,t=s.duration,n=s.ease}this._easeMove=function(t,e,i,n,r,s,o){s instanceof ye&&(o=s,s=void 0),void 0===s&&(s=!1);var h={};return h.mode=s?1:0,void 0!==i&&(h.startX=me(i,t.x),h.endX=t.x),void 0!==n&&(h.startY=me(n,t.y),h.endY=t.y),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new ye(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,n,r,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,r){return this.moveFrom(t,e,i,n,r),Gt(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),Gt(this._easeMove)},moveTo:function(t,e,i,n,r){if(Ce(e)){var s=e;e=s.x,i=s.y,t=s.duration,n=s.ease}this._easeMove=function(t,e,i,n,r,s,o){s instanceof ye&&(o=s,s=void 0),void 0===s&&(s=!1);var h={};return h.mode=s?1:0,void 0!==i&&(h.startX=t.x,h.endX=me(i,t.x)),void 0!==n&&(h.startY=t.y,h.endY=me(n,t.y)),h.duration=e,h.ease=void 0===r?"Linear":r,void 0===o?o=new ye(t,h):o.resetFromJSON(h),o.restart(),o}(this,t,e,i,n,r,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,r){return this.moveTo(t,e,i,n,r),Gt(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),Gt(this._easeMove)}},Se=function(t,e){t&&(J(t).hidden=e,t.rexContainer.parent.setChildVisible(t,!e))},ke={show:function(t){return void 0===t&&(t=this),Se(t,!1),this},hide:function(t){return void 0===t&&(t=this),Se(t,!0),this},isShow:function(t){return void 0===t&&(t=this),!!(e=t)&&!J(e).hidden;var e}},Pe=void 0,xe=function(n){return n?function(t,e,i){return!!Bt(t)&&(n(t,e,i),!0)}:Bt},Ee=function(t){return t},_e=Phaser.Display.Align.CENTER,we={getSizerConfig:J,pushIntoBounds:function(t){return void 0===t&&(t=function(t,e){void 0===e&&(void 0===Z&&(Z=new Phaser.Geom.Rectangle),e=Z);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,r,s,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",zt),r=Xt(h,"createTextCallbackScope",void 0),"string"==typeof(s=Xt(h,"align","left-top"))&&(s=$[s]))}if(n&&!t.children){t.children=new Yt(o),t.once("destroy",function(t,e){t.children.destroy(!e),t.children=void 0});var a=t.clear.bind(t);t.clear=function(){a(),t.children.clear(!1,!0)}}for(var u,l,c=this.getAllChildren([this]),d=0,f=c.length;d<f;d++)(u=c[d]).getBounds&&(i&&t.lineStyle(1,i).strokeRectShape(u.getBounds(At)),u.name&&n&&(l=r?n.call(r,o):n(o))&&(l.setText(u.name),t.children.add(l),Q.setPosition(At.x,At.y).setSize(At.width,At.height),Pt(l,Q,s)));return this},resolveWidth:function(t){var e=Math.max(this.childrenWidth,this.minWidth);return void 0===t&&(t=e),t},resolveChildrenWidth:function(t){var e,i;for(var n in this.sizerChildren)(e=this.sizerChildren[n])&&e.isRexSizer&&!e.ignoreLayout&&(i=this.getExpandedChildWidth(e,t),i=e.resolveWidth(i),e.resolveChildrenWidth(i))},resolveHeight:function(t){var e=Math.max(this.childrenHeight,this.minHeight);return void 0===t&&(t=e),t},getChildWidth:function(t){return t.isRexSizer?Math.max(t.minWidth,t.childrenWidth):void 0!==t.minWidth?t.minWidth:tt(t)},getChildHeight:function(t){return t.isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:et(t)},getExpandedChildWidth:function(t,e){return e},getExpandedChildHeight:function(t,e){return e},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:Et,addElement:Et,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 r=i.match(Dt);if(null!=r&&this.childrenMap){var s=this.childrenMap[r[1]];s&&(n=s[r[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,r=e;r<n;r++)i[r].getAllChildrenSizers(t);return t},getChildrenSizers:function(t){return void 0===t&&(t=[]),t},preLayout:function(){this._childrenWidth=void 0,this._childrenHeight=void 0;for(var t,e=this.getChildrenSizers(),i=0,n=e.length;i<n;i++)(t=e[i]).ignoreLayout||t.preLayout()},layout:function(){return this.runLayout(),this},runLayout:function(t,e,i){if(this.ignoreLayout)return this;var n=!t;return n&&this.preLayout(),e=this.resolveWidth(e),n&&(this.resolveChildrenWidth(e),this.runWidthWrap(e)),i=this.resolveHeight(i),this.resize(e,i),this.layoutChildren(),this.layoutBackgrounds(),this.postLayout()},layoutChildren:function(){},runWidthWrap:function(t){var e,i;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||(void 0===(i=this.getExpandedChildWidth(e,t))&&(i=this.resolveWidth(i)),e.runWidthWrap&&e.runWidthWrap(i));return this},layoutBackgrounds:function(){if(void 0!==this.backgroundChildren)for(var t,e,i,n,r,s,o,h=this.backgroundChildren,a=this.left,u=this.top,l=this.width,c=this.height,d=0,f=h.length;d<f;d++)(e=(t=h[d]).rexSizer).hidden||(n=a+(i=e.padding).left,r=u+i.top,s=l-i.left-i.right,o=c-i.top-i.bottom,Jt(t,s,o),Q.setPosition(n,r).setSize(s,o),Pt(t,Q,_e),this.resetChildPositionState(t))},postLayout:function(){return this._anchor&&this._anchor.updatePosition(),this},setAnchor:function(t){return void 0===this._anchor?this._anchor=new Zt(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 Ut(t,e.x,e.y,i,n);for(var r=t.scene.input.manager,s=r.pointersTotal,o=r.pointers,h=0;h<s;h++)if(e=o[h],Ut(t,e.x,e.y,i,n))return!0;return!1}(e,t)},pointToChild:function(t,e,i,n,r){var s;if((s=i)&&"function"==typeof s||(r=i,n=i=void 0),void 0===r&&(r=this.sizerChildren?this.sizerChildren:this.children),E(r)){for(var o,h=0,a=r.length;h<a;h++)if(o=r[h],It(o,t,e,i,n))return o}else for(var u in r)if(o=r[u],It(o,t,e,i,n))return o;return null},setDraggable:function(r,t){var e=s(r);return"string"===e?r=this.getElement(r):void 0!==r&&"object"==e||(t=r,r=this),void 0===t&&(t=!0),r.input&&r.input.hasOwnProperty("draggable")?r.input.draggable=t:t&&(r.setInteractive(),r.scene.input.setDraggable(r),r.on("drag",function(t,e,i){var n=this.getTopmostSizer();n.x+=e-r.x,n.y+=i-r.y},this)),this}};Object.assign(we,jt,Tt,{getParentSizer:function(t){return this.getParent(t)},getTopmostSizer:function(t){return this.getTopmostParent(t)}},re,fe,be,ke);var Oe=Phaser.Utils.Objects.GetValue,Xe=function(){e(u,B);var a=d(u);function u(t,e,i,n,r,s){var o;l(this,u),(o=a.call(this,t,e,i,2,2)).isRexSizer=!0,o.setMinSize(n,r),o.setName(Oe(s,"name","")),o.rexSizer={},o.space={},o.backgroundChildren=void 0,o.sizerChildren=void 0;var h=Oe(s,"anchor",void 0);return h&&o.setAnchor(h),o.setInnerPadding(Oe(s,"space",0)),o.setDraggable(Oe(s,"draggable",!1)),o.setDirty(!0),o}return t(u,[{key:"destroy",value:function(t){this.scene&&(void 0!==this.backgroundChildren&&(this.backgroundChildren.length=0),f(c(u.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:"ignoreLayout",get:function(){return this.rexSizer.hidden||!this.dirty}},{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-tt(this)*this.originX},set:function(t){this.x+=t-this.left}},{key:"alignLeft",value:function(t){return this.left=t,this}},{key:"right",get:function(){return this.left+tt(this)},set:function(t){this.x+=t-this.right}},{key:"alignRight",value:function(t){return this.right=t,this}},{key:"centerX",get:function(){return this.left+tt(this)/2},set:function(t){this.x+=t-this.centerX}},{key:"alignCenterX",value:function(t){return this.centerX=t,this}},{key:"top",get:function(){return this.y-et(this)*this.originY},set:function(t){this.y+=t-this.top}},{key:"alignTop",value:function(t){return this.top=t,this}},{key:"bottom",get:function(){return this.top+et(this)},set:function(t){this.y+=t-this.bottom}},{key:"alignBottom",value:function(t){return this.bottom=t,this}},{key:"centerY",get:function(){return this.top+et(this)/2},set:function(t){this.y+=t-this.centerY}},{key:"alignCenterY",value:function(t){return this.centerY=t,this}},{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}},{key:"minInnerWidth",get:function(){var t=this.minWidth-this.space.left-this.space.right;return Math.max(t,0)}},{key:"minInnerHeigt",get:function(){var t=this.minHeight-this.space.top-this.space.bottom;return Math.max(t,0)}}]),u}();Object.assign(Xe.prototype,we);var Ye=Phaser.Utils.Objects.IsPlainObject,ze=Phaser.Utils.Objects.GetValue,Ae=Phaser.Display.Align.CENTER,Me=Phaser.Utils.String.UUID,Re={add:function(t,e,i,n,r,s,o){var h;this.pin(t),Ye(e)&&(e=ze(h=e,"key",void 0),i=ze(h,"align",Ae),n=ze(h,"padding",0),r=ze(h,"expand",!0),t.isRexSizer||(s=ze(h,"minWidth",t._minWidth),o=ze(h,"minHeight",t._minHeighted)));return void 0===e&&(e=Me()),"string"==typeof i&&(i=$[i]),void 0===i&&(i=Ae),void 0===n&&(n=0),void 0===r&&(r=!0),t.isRexSizer||(void 0===s&&(s=t._minWidth),void 0===o&&(o=t._minHeight)),(h=this.getSizerConfig(t)).align=i,h.padding=xt(n),Ye(r)?(h.expandWidth=ze(r,"width",!1),h.expandHeight=ze(r,"height",!1)):(h.expandWidth=r,h.expandHeight=r),t.isRexSizer||(h.expandWidth?t.minWidth=void 0===s?tt(t):s:t.minWidth=void 0,h.expandHeight?t.minHeight=void 0===o?et(t):o:t.minHeight=void 0),this.sizerChildren.hasOwnProperty(e)&&this.sizerChildren[e].destroy(),this.sizerChildren[e]=t,this}},Te=B.prototype.remove,De=B.prototype.clear,We={remove:function(t,e){var i;if("string"==typeof t){if(i=t,!this.sizerChildren.hasOwnProperty(i))return this}else{if(this.getParentSizer(t)!==this)return this;i=this.childToKey(t)}return delete this.sizerChildren[i],Te.call(this,t,e),this},removeAll:function(t){var e;for(var i in this.sizerChildren)e=this.sizerChildren[i],delete this.sizerChildren[i],Te.call(this,e,t);return this},clear:function(t){return this.removeAll(t),this.backgroundChildren&&(this.backgroundChildren.length=0),De.call(this,t),this}},je={getChildrenWidth:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)e=(t=r[s]).rexSizer.padding,i=this.getChildWidth(t)+e.left+e.right,n=Math.max(i,n);return n+this.space.left+this.space.right},getChildrenHeight:function(){if(this.rexSizer.hidden)return 0;var t,e,i,n=0,r=this.sizerChildren;for(var s in r)i=(t=r[s]).isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:et(t),i+=(e=t.rexSizer.padding).top+e.bottom,n=Math.max(i,n);return n+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer;if(n.expandWidth){var r=e-this.space.left-this.space.right,s=n.padding;i=r-s.left-s.right}return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer;if(n.expandHeight){var r=e-this.space.top-this.space.bottom,s=n.padding;i=r-s.top-s.bottom}return i},getChildrenSizers:function(t){void 0===t&&(t=[]);var e,i=this.sizerChildren;for(var n in i)(e=i[n]).isRexSizer&&t.push(e);return t},layoutChildren:function(){var t,e,i,n,r,s,o,h,a,u=this.innerLeft,l=this.innerTop,c=this.innerWidth,d=this.innerHeight,f=this.sizerChildren;for(var p in f)i=(e=(t=f[p]).rexSizer).padding,t.isRexSizer?t.runLayout(this,this.getExpandedChildWidth(t),this.getExpandedChildHeight(t)):(a=h=void 0,e.expandWidth&&(h=c-i.left-i.right),e.expandHeight&&(a=d-i.top-i.bottom),Jt(t,h,a)),n=u+i.left,s=c-i.left-i.right,r=l+i.top,o=d-i.top-i.bottom,Q.setPosition(n,r).setSize(s,o),Pt(t,Q,e.align),this.resetChildPositionState(t)}};Object.assign(je,Re,We);var Fe=Phaser.Utils.Objects.IsPlainObject,Le=Phaser.Utils.Objects.GetValue,He=function(){e(a,Xe);var h=d(a);function a(t,e,i,n,r,s){var o;return l(this,a),Fe(e)?(e=Le(s=e,"x",0),i=Le(s,"y",0),n=Le(s,"width",void 0),r=Le(s,"height",void 0)):Fe(n)&&(n=Le(s=n,"width",void 0),r=Le(s,"height",void 0)),(o=h.call(this,t,e,i,n,r,s)).type="rexOverlapSizer",o.sizerChildren={},o.addChildrenMap("items",o.sizerChildren),o}return t(a,[{key:"destroy",value:function(t){this.scene&&(function(t){if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}(this.sizerChildren),f(c(a.prototype),"destroy",this).call(this,t))}},{key:"childToKey",value:function(t){if("string"!=typeof t)return function(t,e){if(Array.isArray(t))return t.indexOf(e);for(var i in t)if(t[i]===e)return i;return null}(this.sizerChildren,t);var e=t;return this.sizerChildren.hasOwnPropery(e)?e:null}}]),a}();return Object.assign(He.prototype,je),He});
  