UNPKG

phaser3-rex-plugins

Version:
2 lines 161 kB
!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).rexnamevaluelabel=e();}(undefined,(function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;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,f(n.key),n);}}function n(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e);}function r(t){return r=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},r(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t){var e=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 i,n=r(t);if(e){var s=r(this).constructor;i=Reflect.construct(n,arguments,s);}else i=n.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}(this,i)}}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}function l(){return l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=u(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(arguments.length<3?t:i):s.value}},l.apply(this,arguments)}function c(t,e,i,n){return c="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var s,r=u(t,e);if(r){if((s=Object.getOwnPropertyDescriptor(r,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 !function(t,e,i){(e=f(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i;}(n,e,i);return !0},c(t,e,i,n)}function d(t,e,i,n,s){if(!c(t,e,i,n||t)&&s)throw new TypeError("failed to set property");return i}function v(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}function f(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===e?String:Number)(t)}(t,"string");return "symbol"==typeof e?e:String(e)}var y=!1,g=function(t){y||(void 0===t&&(t=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<t&&console.error("Minimum supported version : 3.".concat(t)),y=!0);};g();var m=Phaser.GameObjects.Zone,k=Phaser.Utils.Array.Add,b=Phaser.Utils.Array.Remove,C=function(t){s(o,t);var i=h(o);function o(t,n,s,r,a){var h;return e(this,o),void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=1),void 0===a&&(a=1),(h=i.call(this,t,n,s,r,a)).children=[],h}return n(o,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e,i=this.children.length-1;i>=0;i--)(e=this.children[i]).parentContainer||e.displayList||e.destroy(t);this.clear(!t),l(r(o.prototype),"destroy",this).call(this,t);}}},{key:"contains",value:function(t){return -1!==this.children.indexOf(t)}},{key:"add",value:function(t){var e=this;return k(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return b(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy();})),this}},{key:"onChildDestroy",value:function(t,e){this.remove(t,!1);}},{key:"clear",value:function(t){for(var e,i=0,n=this.children.length;i<n;i++)(e=this.children[i]).off("destroy",this.onChildDestroy,this),t&&e.destroy();return this.children.length=0,this}}]),o}(m),S=Phaser.GameObjects.Components;Phaser.Class.mixin(C,[S.Alpha,S.Flip]);var x,P=function t(e,i){var n;if(void 0===i)e.hasOwnProperty("rexContainer")&&(n=e.rexContainer.parent);else for(n=t(e);n&&n.name!==i;)n=t(n);return n},w=Phaser.Math.DegToRad,T=Phaser.Math.RadToDeg,_=function(t){if(!t.hasOwnProperty("rexContainer")){var e={parent:null,self:null,layer:null,x:0,y:0,syncPosition:!0,rotation:0,syncRotation:!0,scaleX:0,scaleY:0,syncScale:!0,alpha:0,syncAlpha:!0,visible:!0,active:!0};Object.defineProperty(e,"angle",{get:function(){return T(this.rotation)},set:function(t){this.rotation=w(t);}}),Object.defineProperty(e,"displayWidth",{get:function(){return t.width*this.scaleX},set:function(e){this.scaleX=e/t.width;}}),Object.defineProperty(e,"displayHeight",{get:function(){return t.height*this.scaleY},set:function(e){this.scaleY=e/t.height;}}),t.rexContainer=e;}return t.rexContainer},O={setParent:function(t,e){void 0===e&&(e=this);var i=_(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),P(t,e)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=P(t);e;)t=e,e=P(e);return t}(t)}},E=Phaser.Utils.Objects.GetValue,D=C.prototype.add,M=function(t,e){this.setParent(t);var i=_(t);return L(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),D.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},R=function(t,e){this.setParent(t);var i=_(t);return L(i,e),i.x=t.x,i.y=t.y,i.rotation=t.rotation,i.scaleX=t.scaleX,i.scaleY=t.scaleY,i.alpha=t.alpha,i.visible=t.visible,i.active=t.active,this.updateChildPosition(t).updateChildAlpha(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),D.call(this,t),this.addToRenderLayer(t),this},L=function(t,e){void 0===e&&(e=!0),"boolean"==typeof e?(t.syncPosition=e,t.syncRotation=e,t.syncScale=e,t.syncAlpha=e,t.syncScrollFactor=e):(t.syncPosition=E(e,"syncPosition",!0),t.syncRotation=E(e,"syncRotation",!0),t.syncScale=E(e,"syncScale",!0),t.syncAlpha=E(e,"syncAlpha",!0),t.syncScrollFactor=E(e,"syncScrollFactor",!0));},z={add:function(t){return Array.isArray(t)?this.addMultiple(t):M.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):M.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)M.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):R.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):R.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)R.call(this,t[e]);return this}},A=C.prototype.remove,I=C.prototype.clear,j={remove:function(t,e){return P(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),A.call(this,t,e)),this},unpin:function(t,e){return P(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),A.call(this,t,e)),this},clear:function(t){for(var e=this.children,i=0,n=e.length;i<n;i++){var s=e[i];this.setParent(s,null),t||this.removeFromRenderLayer(s);}return I.call(this,t),this}},X={getLocalState:function(t){return _(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}},N=Phaser.Math.RotateAround,V={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,N(t,0,0,-this.rotation),t.x/=this.scaleX,t.y/=this.scaleY,t},localToWorld:function(t){return t.x*=this.scaleX,t.y*=this.scaleY,N(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},F=function(t,e){return t===e?1:t/e},Y={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=_(t),i=e.parent;return e.syncPosition&&(t.x=e.x,t.y=e.y,i.localToWorld(t)),e.syncRotation&&(t.rotation=e.rotation+i.rotation),e.syncScale&&(t.scaleX=e.scaleX*i.scaleX,t.scaleY=e.scaleY*i.scaleY),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=_(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=F(t.scaleX,i.scaleX),e.scaleY=F(t.scaleY,i.scaleY),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=_(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=_(this).parent;return t&&t.resetChildPositionState(this),this}},G=Phaser.Math.DegToRad,U={updateChildRotation:function(t){var e=_(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState:function(t){var e=_(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation:function(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle:function(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation:function(t,e){return _(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return _(t).rotation=G(e),this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=_(this).parent;return t&&t.resetChildRotationState(this),this}},B={updateChildScale:function(t){var e=_(t),i=e.parent;return e.syncScale&&(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=_(t),i=e.parent;return e.scaleX=F(t.scaleX,i.scaleX),e.scaleY=F(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=_(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},resetLocalScaleState:function(){var t=_(this).parent;return t&&t.resetChildScaleState(this),this}},W={updateChildVisible:function(t){var e=_(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=_(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),_(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),_(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=_(this).parent;return t&&t.resetChildVisibleState(this),this}},H={updateChildAlpha:function(t){var e=_(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState:function(t){var e=_(t),i=e.parent;return e.alpha=F(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return _(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=_(this).parent;return t&&t.resetChildAlphaState(this),this}},J={updateChildActive:function(t){var e=_(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 _(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),_(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=_(this).parent;return t&&t.resetChildActiveState(this),this}},q={updateChildScrollFactor:function(t){var e=_(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor:function(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},Z={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){void 0===t&&(t=!1);var e=this;return this._mask=null,this.setChildMaskVisible(this),this.children.forEach((function(t){t.clearMask&&t.clearMask(!1),t.hasOwnProperty("isRexContainerLite")||e.setChildMaskVisible(t);})),t&&this.mask&&this.mask.destroy(),this}},K=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);var n=t[0];return (i=n.displayList?n.displayList:n.parentContainer?n.parentContainer.list:n.scene.sys.displayList).depthSort&&(i.depthSort(),i=i.list),e?t.sort((function(t,e){return i.indexOf(e)-i.indexOf(t)})):t.sort((function(t,e){return i.indexOf(t)-i.indexOf(e)})),t},$={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},bringToTop:function(){var t=this.displayList,e=this.getAllChildren([this]);K(e,!1);for(var i=0,n=e.length;i<n;i++){var s=e[i];t.exists(s)&&t.bringToTop(s);}return this},moveDepthBelow:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);K(i,!1);for(var n=0,s=i.length;n<s;n++){var r=i[n];if(e.exists(r)){e.moveBelow(t,r);break}}return this},moveDepthAbove:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);K(i,!0);for(var n=0,s=i.length;n<s;n++){var r=i[n];if(e.exists(r)){e.moveAbove(t,r);break}}return this},bringChildToTop:function(t){var e=this.getAllChildren([this]);K(e,!0);var i=e[0];return i===t||i.displayList!==t.displayList||i.displayList.moveAbove(t,i),this},sendChildToBack:function(t){var e=this.getAllChildren([this]);K(e,!1);var i=e[0];return i===t||i.displayList!==t.displayList||i.displayList.moveBelow(t,i),this}},Q=function t(e,i){if(!i(e)&&e.isRexContainerLite)for(var n=e.children,s=0,r=n.length;s<r;s++)t(n[s],i);},tt=function(t,e){for(var i=[t];i.length>0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,v(n.children));}},et=Phaser.Utils.Array,it={getChildren:function(t){if(t)for(var e=0,i=this.children.length;e<i;e++)t.push(this.children[e]);else t=this.children;return t},getAllChildren:function(t){void 0===t&&(t=[]);var e=this;return tt(e,(function(i){i!==e&&t.push(i);})),t},getAllVisibleChildren:function(t){void 0===t&&(t=[]);var e=this;return tt(e,(function(i){if(i!==e)return !i.visible||void t.push(i)})),t},bfs:function(t,e){return void 0===e&&(e=this),tt(e,t),this},dfs:function(t,e){return void 0===e&&(e=this),Q(e,t),this},contains:function(t){var e=P(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 et.GetFirst(this.children,"name",t)},getRandom:function(t,e){return et.GetRandom(this.children,t,e)},getFirst:function(t,e,i,n){return et.GetFirstElement(this.children,t,e,i,n)},getAll:function(t,e,i,n){return et.GetAll(this.children,t,e,i,n)},count:function(t,e,i,n){return et.CountAllMatching(this.children,t,e,i,n)},swap:function(t,e){return et.Swap(this.children,t,e),this},setAll:function(t,e,i,n){return et.SetAll(this.children,t,e,i,n),this}},nt=function(t){for(var e=[],i=0,n=t.length;i<n;i++){var s=t[i];s.hasOwnProperty("rexContainer")&&e.push(s.rexContainer);}return e},st=function(t,e,i){if(i.parent){var n=i.parent,s=i.self;switch(e){case"x":case"y":n.updateChildPosition(s);break;case"angle":case"rotation":n.updateChildRotation(s);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":n.updateChildScale(s);break;case"alpha":n.updateChildAlpha(s);break;default:n.updateChildPosition(s),n.updateChildRotation(s),n.updateChildScale(s),n.updateChildAlpha(s);}}else t.remove();},rt={tweenChild:function(t){var e=t.targets;Array.isArray(e)||(e=[e]);var i=this.scene||function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e].scene;if(n)return n}return null}(e);if(i){t.targets=nt(e);var n=i.tweens.add(t);return n.on("update",st),n}},tweenSelf:function(t){return t.targets=[this],this.tweenChild(t)},createTweenChildConfig:function(t){var e=t.targets;e&&(Array.isArray(e)||(e=[e]),t.targets=nt(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),st(t,void 0,e);},t},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},ot=Phaser.GameObjects.Container,at=Phaser.GameObjects.Layer,ht=function(t){return t instanceof at},ut=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return !!t.displayList||!!t.parentContainer}))},lt=function(t){var e=ut(this);return K(e),t.add(e),this},ct=function(t,e,i){var n=ut(this);return K(n,e),t.remove(n),i&&n.forEach((function(t){t.addToDisplayList();})),this},dt={addToContainer:function(t){return function(t){return t instanceof ot}(t)?(this._setParentContainerFlag=!0,lt.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer:function(t){return ht(t)?(lt.call(this,t),this):this},removeFromContainer:function(){return this.parentContainer?(this._setParentContainerFlag=!0,ct.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer:function(t){return void 0===t&&(t=!0),ht(this.displayList)?(ct.call(this,this.displayList,!1,t),this):this},getParentContainer:function(){if(this.parentContainer)return this.parentContainer;for(var t=this.getParent();t;){var e=t.parentContainer;if(e)return e;t=t.getParent();}return null},addToParentContainer:function(t){if(!t.displayList)return this;var e=this.getParentContainer();return e?(t.isRexContainerLite?t.addToContainer(e):e.add(t),this):this}},vt={hasLayer:function(){return !!this.privateRenderLayer},enableLayer:function(){if(this.hasLayer())return this;var t=this.scene.add.layer();return this.moveDepthBelow(t),this.addToLayer(t),this.privateRenderLayer=t,this},getLayer:function(){return this.hasLayer()||this.enableLayer(),this.privateRenderLayer},getRenderLayer:function(){if(this.hasLayer())return this.privateRenderLayer;for(var t=this.getParent();t;){var e=t.privateRenderLayer;if(e)return e;t=t.getParent();}return null},addToRenderLayer:function(t){if(!t.displayList)return this;var e=this.getRenderLayer();return e?(t.isRexContainerLite?t.addToLayer(e):e.add(t),_(t).layer=e,this):this},removeFromRenderLayer:function(t){var e=_(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},pt=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},ft=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},yt=Phaser.Geom.Rectangle,gt=Phaser.Math.Vector2,mt=Phaser.Math.RotateAround,kt=function(t,e){if(void 0===e?e=new yt:!0===e&&(void 0===bt&&(bt=new yt),e=bt),t.getBounds)return t.getBounds(e);var i,n,s,r,o,a,h,u;if(t.parentContainer){var l=t.parentContainer.getBoundsTransformMatrix();Ct(t,e),l.transformPoint(e.x,e.y,e),i=e.x,n=e.y,St(t,e),l.transformPoint(e.x,e.y,e),s=e.x,r=e.y,xt(t,e),l.transformPoint(e.x,e.y,e),o=e.x,a=e.y,Pt(t,e),l.transformPoint(e.x,e.y,e),h=e.x,u=e.y;}else Ct(t,e),i=e.x,n=e.y,St(t,e),s=e.x,r=e.y,xt(t,e),o=e.x,a=e.y,Pt(t,e),h=e.x,u=e.y;return e.x=Math.min(i,s,o,h),e.y=Math.min(n,r,a,u),e.width=Math.max(i,s,o,h)-e.x,e.height=Math.max(n,r,a,u)-e.y,e},bt=void 0,Ct=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===wt&&(wt=new gt),e=wt),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-pt(t)*t.originX,e.y=t.y-ft(t)*t.originY,Tt(t,e,i))},St=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===wt&&(wt=new gt),e=wt),t.getTopRight?t.getTopRight(e):(e.x=t.x-pt(t)*t.originX+pt(t),e.y=t.y-ft(t)*t.originY,Tt(t,e,i))},xt=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===wt&&(wt=new gt),e=wt),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-pt(t)*t.originX,e.y=t.y-ft(t)*t.originY+ft(t),Tt(t,e,i))},Pt=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===wt&&(wt=new gt),e=wt),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-pt(t)*t.originX+pt(t),e.y=t.y-ft(t)*t.originY+ft(t),Tt(t,e,i))},wt=void 0,Tt=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&mt(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e},_t=Phaser.Geom.Rectangle,Ot=Phaser.Geom.Rectangle.Union,Et=function(e){if("object"!==t(e)||null===e)return e;if(Array.isArray(e))e.length=0;else for(var i in e)delete e[i];return e},Dt=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:Et(e),i){e.length=t.length;for(var n=0,s=t.length;n<s;n++)e[n]=t[n];}else for(var r in t)e[r]=t[r];return e},Mt=Phaser.GameObjects.GameObject,Rt=function(t){return t instanceof Mt},Lt=Phaser.Utils.Objects.GetValue,zt=Phaser.Textures.DynamicTexture,At=Phaser.Utils.String.UUID,It=function(t){if(t){var e,i,n=t.gameObjects,s=t.renderTexture,r=Lt(t,"x",void 0),o=Lt(t,"y",void 0),a=Lt(t,"width",void 0),h=Lt(t,"height",void 0),u=Lt(t,"originX",0),l=Lt(t,"originY",0),c=Lt(t,"padding",0);if(void 0===a||void 0===h||void 0===r||void 0===o){var d=function(t,e){var i;void 0===e?e=new _t:!0===e&&(void 0===x&&(x=new _t),e=x),e.setTo(0,0,0,0);for(var n=!0,s=0,r=t.length;s<r;s++)if((i=t[s]).getBounds){var o=kt(i,!0);n?(e.setTo(o.x,o.y,o.width,o.height),n=!1):Ot(o,e,e);}return e}(n,!0);void 0!==r&&void 0!==o?(a=2*Math.max(r-d.left,d.right-r),h=2*Math.max(o-d.top,d.bottom-o),u=.5,l=.5):(r=d.x,o=d.y,a=d.width,h=d.height,u=0,l=0),e=d.x,i=d.y;}else e=r+(0-u)*a,i=o+(0-l)*h;e-=c,i-=c,a+=2*c,h+=2*c;var v=n[0].scene;p&&!s&&(s=new zt(v.sys.textures,At(),a,h)),s||(s=v.add.renderTexture(0,0,a,h)),s.setPosition&&s.setPosition(r,o),s.width===a&&s.height===h||s.setSize(a,h),s.setOrigin&&s.setOrigin(u,l),s.camera.setScroll(e,i),n=K(Dt(n)),s.draw(n);var p=t.saveTexture;if(p)if(Rt(s))s.saveTexture(p);else {var f=s,y=f.manager;y.exists(f.key)?y.renameTexture(f.key,key):(f.key=key,y.list[key]=f,y.emit("addtexture",key,f),y.emit("addtexture-".concat(key),f));}return s}},jt={snapshot:function(t){var e=this.scaleX,i=this.scaleY,n=1===e&&1===i;n||this.setScale(1),void 0===t&&(t={}),t.gameObjects=this.getAllVisibleChildren(),t.x=this.x,t.y=this.y,t.originX=this.originX,t.originY=this.originY;var s=It(t),r=!!s.scene;return n||(this.setScale(e,i),r&&s.setScale(e,i)),r?s:this}},Xt=Phaser.Utils.Objects.GetValue,Nt=function(t,e,i,n,s,r,o){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===n&&(n=1),void 0===s&&(s=null),void 0===r&&(r=1),void 0===o&&(o=0);var a=Ct(t,Vt[0]);a.x-=o,a.y-=o;var h=St(t,Vt[1]);h.x+=o,h.y-=o;var u=Pt(t,Vt[2]);u.x+=o,u.y+=o;var l=xt(t,Vt[3]);l.x-=o,l.y+=o,null!==s&&e.fillStyle(s,r).fillPoints(Vt,!0,!0),null!==i&&e.lineStyle(n,i).strokePoints(Vt,!0,!0);}},Vt=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ft=Phaser.Utils.Objects.GetValue,Yt=Phaser.Math.RotateAround,Gt={changeOrigin:function(t,e){this.syncChildrenEnable=!1,function(t,e,i){void 0===i&&(i=e);var n={x:(e-t.originX)*t.displayWidth,y:(i-t.originY)*t.displayHeight};Yt(n,0,0,t.rotation),t.originX=e,t.originY=i,t.x=t.x+n.x,t.y=t.y+n.y;}(this,t,e),this.syncChildrenEnable=!0;for(var i=this.getAllChildren(),n=0,s=i.length;n<s;n++)this.resetChildPositionState(i[n]);return this},drawBounds:function(t,e){var i=Ft(e,"drawContainer",!0),n=Ft(e,"children");return void 0===n&&(n=this.getAllVisibleChildren([this])),i||(n=n.filter((function(t){return !t.isRexContainerLite}))),function(t,e,i){var n,s,r,o,a;if("number"==typeof i?n=i:(n=Xt(i,"color"),s=Xt(i,"lineWidth"),r=Xt(i,"fillColor"),o=Xt(i,"fillAlpha",1),a=Xt(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h<u;h++)Nt(t[h],e,n,s,r,o,a);else Nt(t,e,n,s,r,o,a);}(n,t,e),this}};Object.assign(Gt,O,z,j,X,V,Y,U,B,W,H,J,q,Z,$,it,rt,dt,vt,jt);var Ut=function(t){s(o,t);var i=h(o);function o(t,n,s,r,a,h){var u;return e(this,o),Array.isArray(r)&&(h=r,r=void 0,a=void 0),(u=i.call(this,t,n,s,r,a)).type="rexContainerLite",u.isRexContainerLite=!0,u.syncChildrenEnable=!0,u._active=!0,u._mask=null,u._scrollFactorX=1,u._scrollFactorY=1,u.privateRenderLayer=void 0,h&&u.add(h),u}return n(o,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,l(r(o.prototype),"destroy",this).call(this,t),this.privateRenderLayer&&(this.privateRenderLayer.list.length=0,this.privateRenderLayer.destroy()));}},{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 l(r(o.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(d(r(o.prototype),"rotation",t,this,!0),this.syncPosition());}},{key:"scaleX",get:function(){return l(r(o.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(d(r(o.prototype),"scaleX",t,this,!0),this.syncPosition());}},{key:"scaleY",get:function(){return l(r(o.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(d(r(o.prototype),"scaleY",t,this,!0),this.syncPosition());}},{key:"scale",get:function(){return l(r(o.prototype),"scale",this)},set:function(t){this.scale!==t&&(d(r(o.prototype),"scale",t,this,!0),this.syncPosition());}},{key:"visible",get:function(){return l(r(o.prototype),"visible",this)},set:function(t){l(r(o.prototype),"visible",this)!==t&&(d(r(o.prototype),"visible",t,this,!0),this.syncVisible());}},{key:"alpha",get:function(){return l(r(o.prototype),"alpha",this)},set:function(t){l(r(o.prototype),"alpha",this)!==t&&(d(r(o.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}},{key:"parentContainer",get:function(){return this._parentContainer},set:function(t){this._parentContainer||t?this.setParentContainerFlag?this._parentContainer=t:this._parentContainer&&!t?(this.removeFromContainer(),this._parentContainer=t):t?(this._parentContainer=t,this.addToContainer(t)):this._parentContainer=t:this._parentContainer=t;}},{key:"setParentContainerFlag",get:function(){if(this._setParentContainerFlag)return !0;var t=P(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return P(t)}}]),o}(C);Object.assign(Ut.prototype,Gt);var Bt=function(t){return t.hasOwnProperty("rexSizer")||(t.rexSizer={}),t.rexSizer};var Wt=Phaser.Cameras.Scene2D.BaseCamera,Ht=Phaser.Geom.Rectangle,Jt=function(t,e,i){return e instanceof Wt||(i=e,e=void 0),void 0===i?i=new Ht:!0===i&&(i=qt),e?t.scale.getViewPort(e,i):t.scale.getViewPort(i)},qt=new Ht,Zt=Phaser.Display.Align,Kt={center:Zt.CENTER,left:Zt.LEFT_CENTER,right:Zt.RIGHT_CENTER,top:Zt.TOP_CENTER,bottom:Zt.BOTTOM_CENTER,"left-top":Zt.TOP_LEFT,"top-left":Zt.TOP_LEFT,"left-center":Zt.LEFT_CENTER,"center-left":Zt.LEFT_CENTER,"left-bottom":Zt.BOTTOM_LEFT,"bottom-left":Zt.BOTTOM_LEFT,"center-top":Zt.TOP_CENTER,"top-center":Zt.TOP_CENTER,"center-center":Zt.CENTER,"center-bottom":Zt.BOTTOM_CENTER,"bottom-center":Zt.BOTTOM_CENTER,"right-top":Zt.TOP_RIGHT,"top-right":Zt.TOP_RIGHT,"right-center":Zt.RIGHT_CENTER,"center-right":Zt.RIGHT_CENTER,"right-bottom":Zt.BOTTOM_RIGHT,"bottom-right":Zt.BOTTOM_RIGHT},$t=function(){},Qt=new Phaser.GameObjects.Zone({sys:{queueDepthSort:$t,events:{once:$t}}},0,0,1,1);Qt.setOrigin(0);var te=0,ee=1,ie=2,ne=4,se=6,re=8,oe=10,ae=12,he=function(t){var e=ft(t);return t.y+e-e*t.originY},ue=function(t){var e=pt(t);return t.x-e*t.originX+.5*e},le=function(t,e){var i=ft(t);return t.y=e-i+i*t.originY,t},ce=function(t,e){var i=pt(t),n=i*t.originX;return t.x=e+n-.5*i,t},de=function(t){var e=pt(t);return t.x-e*t.originX},ve=function(t,e){var i=pt(t);return t.x=e+i*t.originX,t},pe=function(t){var e=pt(t);return t.x+e-e*t.originX},fe=function(t,e){var i=pt(t);return t.x=e-i+i*t.originX,t},ye=function(t,e){var i=ft(t),n=i*t.originY;return t.y=e+n-.5*i,t},ge=function(t){var e=ft(t);return t.y-e*t.originY+.5*e},me=function(t){var e=ft(t);return t.y-e*t.originY},ke=function(t,e){var i=ft(t);return t.y=e+i*t.originY,t},be=[];be[11]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ce(t,ue(e)+i),le(t,he(e)+n),t},be[oe]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ve(t,de(e)-i),le(t,he(e)+n),t},be[ae]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),fe(t,pe(e)+i),le(t,he(e)+n),t},be[se]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),function(t,e,i){ce(t,e),ye(t,i);}(t,ue(e)+i,ge(e)+n),t},be[ne]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ve(t,de(e)-i),ye(t,ge(e)+n),t},be[re]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),fe(t,pe(e)+i),ye(t,ge(e)+n),t},be[ee]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ce(t,ue(e)+i),ke(t,me(e)-n),t},be[te]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),ve(t,de(e)-i),ke(t,me(e)-n),t},be[ie]=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),fe(t,pe(e)+i),ke(t,me(e)-n),t};var Ce=function(t,e,i,n,s,r){Qt.setPosition(e,i).setSize(n,s),function(t,e,i,n,s){be[i](t,e,n,s);}(t,Qt,r);},Se=Phaser.Utils.Objects.GetValue,xe=Phaser.GameObjects.Group,Pe=function(t,e,i){return t.add.text(0,0,"")},we=void 0,Te=Phaser.Utils.Objects.GetValue,_e=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={}),"number"==typeof t?(e.left=t,e.right=t,e.top=t,e.bottom=t):(e.left=Te(t,"left",0),e.right=Te(t,"right",0),e.top=Te(t,"top",0),e.bottom=Te(t,"bottom",0)),e},Oe=Ut.prototype.add,Ee=function(t){return Oe.call(this,t),this.sizerEventsEnable&&(t.emit("sizer.add",t,this),this.emit("add",t,this)),this},De={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),Ee.call(this,t),this.backgroundChildren.push(t),this.getSizerConfig(t).padding=_e(e),void 0!==i&&this.addChildrenMap(i,t),this},isBackground:function(t){return void 0!==this.backgroundChildren&&-1!==this.backgroundChildren.indexOf(t)}},Me=function t(e,i){var n=null;if(void 0===i)e.hasOwnProperty("rexContainer")&&((n=e.rexContainer.parent)?n.isRexSizer||(n=t(n)):n=null);else for(n=t(e);n&&n.name!==i;)n=t(n);return n},Re={getParentSizer:function(t,e){return "string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),Me(t,e)},getTopmostSizer:function(t){return void 0===t&&(t=this),function(t){for(var e=Me(t);e;)t=e,e=Me(e);return t}(t)},hasParentSizer:function(t,e){void 0===e&&(e=this);for(var i=Me(e);i;){if(i===t)return !0;i=Me(i);}return !1},hasChild:function(t,e){return void 0===e&&(e=this),this.hasParentSizer(e,t)}},Le=Phaser.Utils.Array.Remove,ze=Ut.prototype.remove,Ae=Re.getParentSizer,Ie=function(t,e){for(var i=Ae(t);i;)i.removeChildCallback&&i.removeChildCallback(t,e),i=Ae(i);return this.isBackground(t)&&Le(this.backgroundChildren,t),ze.call(this,t,e),!e&&this.sizerEventsEnable&&(t.emit("sizer.remove",t,this),this.emit("remove",t,this)),this},je=Phaser.Utils.Array.Remove,Xe=Re.getParentSizer,Ne={removeFromParentSizer:function(){var t=Xe(gameObject);return t&&t.remove(this),this},removeBackground:function(t,e){return void 0===this.backgroundChildren||this.getParentSizer(t)!==this||(je(this.backgroundChildren,t),Ie.call(this,t,e)),this},removeAllBackgrounds:function(t){if(void 0===this.backgroundChildren)return this;for(var e=this.backgroundChildren.length-1;e>=0;e--)this.remove(this.backgroundChildren[e],t);return this}},Ve=function(t,e){if("string"==typeof t)this.childrenMap[t]=e;else {var i=t;for(t in i)this.childrenMap[t]=i[t];}return this},Fe=/(\S+)\[(\d+)\]/i,Ye=Phaser.Utils.Objects.GetValue,Ge=function(t,e){return void 0===e?t:t[e]},Ue=function(e,i,n){void 0===e&&(e={}),void 0===i&&(i=0);var s=t(i);return "string"===s?e[i]=n:"number"===s?(e.left=i,e.right=i,e.top=i,e.bottom=i):(e.left=Ye(i,"left",0),e.right=Ye(i,"right",0),e.top=Ye(i,"top",0),e.bottom=Ye(i,"bottom",0)),e},Be={getInnerPadding:function(t){return Ge(this.space,t)},setInnerPadding:function(t,e){return Ue(this.space,t,e),this},getOuterPadding:function(t){return Ge(this.getSizerConfig(this).padding,t)},setOuterPadding:function(t,e){return Ue(this.getSizerConfig(this).padding,t,e),this},getChildOuterPadding:function(t,e){return "string"==typeof t&&(t=this.getElement(t)),Ge(this.getSizerConfig(t).padding,e)},setChildOuterPadding:function(t,e,i){return "string"==typeof t&&(t=this.getElement(t)),Ue(this.getSizerConfig(t).padding,e,i),this}},We=function(t){var e=this.childrenWidth,i=void 0!==this.minWidth?this.minWidth:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") < childrenWidth (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout width warn: ".concat(this.constructor.name,"'s minWidth (").concat(i,") or childrenWidth (").concat(e," > targetWidth ").concat(t,")")),t},He=function(t){var e=this.childrenHeight,i=void 0!==this.minHeight?this.minHeight:0;return void 0===t?(t=Math.max(i,e),this.layoutWarnEnable&&i>0&&e>i&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") < childrenHeight (").concat(e,")"))):this.layoutWarnEnable&&(i>t||e>t)&&console.warn("Layout height warn: ".concat(this.constructor.name,"'s minHeight (").concat(i,") or childrenHeight (").concat(e,") > targetHeight (").concat(t,")")),t},Je={getShownChildren:function(t){void 0===t&&(t=[]);for(var e,i=this.children,n=0,s=i.length;n<s;n++)(e=i[n]).rexSizer&&e.rexSizer.hidden||t.push(e);return t},getAllShownChildren:function(t){void 0===t&&(t=[]);for(var e=[this];e.length>0;){var i=e.shift();i.rexSizer&&i.rexSizer.hidden||(i!==this&&t.push(i),i.isRexContainerLite&&e.push.apply(e,v(i.children)));}return t}},qe=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();},Ze={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},Ke=Phaser.Scene,$e=function(t){return t instanceof Ke},Qe=function(e){return null==e||"object"!==t(e)?null:$e(e)?e:e.scene&&$e(e.scene)?e.scene:e.parent&&e.parent.scene&&$e(e.parent.scene)?e.parent.scene:null},ti=Phaser.Game,ei=function(t){return t instanceof ti},ii=function(e){return null==e||"object"!==t(e)?null:ei(e)?e:ei(e.game)?e.game:$e(e)?e.sys.game:$e(e.scene)?e.scene.sys.game:void 0},ni=Phaser.Utils.Objects.GetValue,si=function(){function t(i,n){e(this,t),this.setParent(i),this.isShutdown=!1,this.setEventEmitter(ni(n,"eventEmitter",!0)),this.parent&&(this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.once("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this));}return n(t,[{key:"shutdown",value:function(t){this.isShutdown||(this.parent&&(this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onEnvDestroy,this):this.parent===this.game?this.game.events.off("shutdown",this.onEnvDestroy,this):this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this)),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.game=void 0,this.isShutdown=!0);}},{key:"destroy",value:function(t){this.shutdown(t);}},{key:"onEnvDestroy",value:function(){this.destroy(!0);}},{key:"onParentDestroy",value:function(t,e){this.destroy(e);}},{key:"setParent",value:function(t){return this.parent=t,this.scene=Qe(t),this.game=ii(t),this}}]),t}();Object.assign(si.prototype,Ze);var ri=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,{eventEmitter:!1})).viewport=void 0,s.resetFromJSON(n),s}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.autoAnchor(!1),this.viewport=void 0,this.onUpdateViewportCallback=void 0,this.onUpdateViewportCallbackScope=void 0,this.onResizeCallback=void 0,this.onResizeCallbackScope=void 0,l(r(o.prototype),"shutdown",this).call(this,t));}},{key:"resetFromJSON",value:function(t){var e,i,n,s,r,o,a,h;void 0===t&&(t={}),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("%"),a=parseFloat(s[0])/100,h=""===s[1]?0:parseFloat(s[1]));var u,l,c=t.width;void 0!==c&&(c=c.split("%"),u=parseFloat(c[0])/100,l=""===c[1]?0:parseFloat(c[1]));var d,v,p=t.height;void 0!==p&&(p=p.split("%"),d=parseFloat(p[0])/100,v=""===p[1]?0:parseFloat(p[1])),this.setAlign(e,n),this.setPercentage(r,a),this.setOffset(o,h),this.setSizePercentage(u,d),this.setSizePadding(l,v);var f=t.onResizeCallback,y=t.onResizeCallbackScope;void 0!==f&&this.setResizeCallback(f,y);var g=t.onUpdateViewportCallback,m=t.onUpdateViewportCallbackScope;return void 0!==g&&this.setUpdateViewportCallback(g,m),this.autoAnchor(t.enable),this}},{key:"autoAnchor",value:function(t){return void 0===t&&(t=!0),t=!!t,this.autoAnchorEnable===t||(t?(this.scene.sys.scale.on("resize",this.anchor,this),this.anchor()):this.scene.sys.scale.off("resize",this.anchor,this),this.autoAnchorEnable=t),this}},{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:"setSizePercentage",value:function(t,e){return this.percentageWidth=t,this.percentageHeight=e,this}},{key:"setSizePadding",value:function(t,e){return this.paddingWidth=t,this.paddingHeight=e,this}},{key:"setResizeCallback",value:function(t,e){return this.onResizeCallback=t,this.onResizeCallbackScope=e,this}},{key:"setUpdateViewportCallback",value:function(t,e){return this.onUpdateViewportCallback=t,this.onUpdateViewportCallbackScope=e,this}},{key:"anchor",value:function(){return this.updateViewport(),this.updateSize(),this.updatePosition(),this}},{key:"updateSize",value:function(){var t=this.onResizeCallback,e=this.onResizeCallbackScope,i=this.anchorWidth,n=this.anchorHeight;if((void 0!==i||void 0!==n)&&t){var s=this.parent;void 0===i&&(i=s.width),void 0===n&&(n=s.height),e?t.call(e,i,n,s,this):t(i,n,s,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}},{key:"anchorWidth",get:function(){if(void 0!==this.percentageWidth)return this.viewport.width*this.percentageWidth+this.paddingWidth}},{key:"anchorHeight",get:function(){if(void 0!==this.percentageHeight)return this.viewport.height*this.percentageHeight+this.paddingHeight}},{key:"updateViewport",value:function(){var t=this.parent.scene.cameras.main;this.viewport=Jt(this.scene,t,this.viewport);var e=this.viewport,i=this.onUpdateViewportCallback,n=this.onUpdateViewportCallbackScope;i&&(n?i.call(n,e,this.parent,this):i(e,this.parent,this));}}]),o}(si),oi=Phaser.Utils.Objects.GetValue,ai=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n))._isRunning=!1,s.isPaused=!1,s.tickingState=!1,s.setTickingMode(oi(n,"tickingMode",1)),s}return n(o,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking();}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),l(r(o.prototype),"shutdown",this).call(this,t));}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=hi[t]),this.tickingMode=t;}},{key:"startTicking",value:function(){this.tickingState=!0;}},{key:"stopTicking",value:function(){this.tickingState=!1;}},{key:"isRunning",get:function(){return this._isRunning},set:function(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()));}},{key:"start",value:function(){return this.isPaused=!1,this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}},{key:"resume",value:function(){return this.isPaused&&(this.isRunning=!0),this}},{key:"stop",value:function(){return this.isPaused=!1,this.isRunning=!1,this}},{key:"complete",value:function(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this);}}]),o}(si),hi={no:0,lazy:1,always:2},ui=Phaser.Utils.Objects.GetValue,li=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=(s=i.call(this,t,n)).scene?"update":"step";return s.tickEventName=ui(n,"tickEventName",r),s.isSceneTicker=!ci(s.tickEventName),s}return n(o,[{key:"startTicking",value:function(){l(r(o.prototype),"startTicking",this).call(this),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this);}},{key:"stopTicking",value:function(){l(r(o.prototype),"stopTicking",this).call(this),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this);}}]),o}(ai),ci=function(t){return "step"===t||"poststep"===t},di=Phaser.Utils.Objects.GetValue,vi=Phaser.Math.Clamp,pi=function(){function t(i){e(this,t),this.resetFromJSON(i);}return n(t,[{key:"resetFromJSON",value:function(t){this.state=di(t,"state",fi),this.timeScale=di(t,"timeScale",1),this.delay=di(t,"delay",0),this.repeat=di(t,"repeat",0),this.repeatCounter=di(t,"repeatCounter",0),this.repeatDelay=di(t,"repeatDelay",0),this.duration=di(t,"duration",0),this.nowTime=di(t,"nowTime",0),this.justRestart=di(t,"justRestart",!1);}},{key:"toJSON",value:function(){return {state:this.state,timeScale:this.timeScale,delay:this.delay,repeat:this.repeat,repeatCounter:this.repeatCounter,repeatDelay:this.repeatDelay,duration:this.duration,nowTime:this.nowTime,justRestart:this.justRestart}}},{key:"destroy",value:function(){}},{key:"setTimeScale",value:function(t){return this.timeScale=t,this}},{key:"setDelay",value:function(t){return void 0===t&&(t=0),this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatInfinity",value:function(){return this.repeat=-1,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"start",value:function(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?gi:yi,this.repeatCounter=0,this}},{key:"stop",value:function(){return this.state=fi,this}},{key:"update",value:function(t,e){this.state!==fi&&this.state!==ki&&0!==e&&0!==this.timeScale&&(this.nowTime+=e*this.timeScale,this.justRestart=!1,this.nowTime>=this.duration?-1===this.repeat||this.repeatCounter<this.repeat?(this.repeatCounter++,this.justRestart=!0,this.nowTime-=this.duration,this.repeatDelay>0&&(this.nowTime-=this.repeatDelay,this.state=mi)):(this.nowTime=this.duration,this.state=ki):this.nowTime>=0&&(this.state=gi));}},{key:"t",get:function(){var t;switch(this.state){case fi:case yi:case mi:t=0;break;case gi:t=this.nowTime/this.duration;break;case ki:t=1;}return vi(t,0,1)},set:function(t){(t=vi(t,-1,1))<0?(this.state=yi,this.nowTime=-this.delay*t):(this.state=gi,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++);}},{key:"setT",value:function(t){return this.t=t,this}},{key:"isIdle",get:function(){return this.state===fi}},{key:"isDelay",get:function(){return this.state===yi}},{key:"isCountDown",get:function(){return this.state===gi}},{key:"isRunning",get:function(){return this.state===yi||this.state===gi}},{key:"isDone",get:function(){return this.state===ki}},{key:"isOddIteration",get:function(){return 1==(1&this.repeatCounter)}},{key:"isEvenIteration",get:function(){return 0==(1&this.repeatCounter)}}]),t}(),fi=0,yi=1,gi=2,mi=3,ki=-1,bi=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).timer=new pi,s}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(l(r(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"start",value:function(){return this.timer.start(),l(r(o.prototype),"start",this).call(this),this}},{key:"stop",value:function(){return this.timer.stop(),l(r(o.prototype),"stop",this).call(this),this}},{key:"complete",value:function(){return this.timer.stop(),l(r(o.prototype),"complete",this).call(this),this}}]),o}(li),Ci=Phaser.Utils.Objects.GetValue,Si=Phaser.Utils.Objects.GetAdvancedValue,xi=Phaser.Tweens.Builders.GetEaseFunction,Pi=function(t){s(o,t);var i=h(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(Ci(t,"timer")),this.setEnable(Ci(t,"enable",!0)),this.setTarget(Ci(t,"target",this.parent)),this.setDelay(Si(t,"delay",0)),this.setDuration(Si(t,"duration",1e3)),this.setEase(Ci(t,"ease","Linear")),this.setRepeat(Ci(t,"repeat",0)),this}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setTarget",value:function(t){return void 0===t&&(t=this.parent),this.target=t,this}},{key:"setDelay",value:function(t){return this.delay=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setRepeat",value:function(t){return this.repeat=t,this}},{key:"setRepeatDelay",value:function(t){return this.repeatDelay=t,this}},{key:"setEase",value:function(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=xi(t),this}},{key:"start",value:function(){return this.timer.isRunning||l(r(o.prototype),"start",this).call(this),this}},{key:"restart",value:function(){return this.timer.stop(),this.start.apply(this,arguments),this}},{key:"stop",value:function(t){return void 0===t&&(t=!1),l(r(o.prototype),"stop",this).call(this),t&&(this.timer.setT(1),this.updateGameObject(this.target,this.timer),this.complete()),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable||!this.parent.active)return this;var i=this.target,n=this.timer;return n.update(t,e),n.isDelay||this.updateGameObject(i,n),this.emit("update",i,this),n.isDone&&this.complete(),this}},{key:"updateGameObject",value:function(t,e){}}]),o}(bi),wi=Phaser.Utils.Objects.GetValue,Ti=Phaser.Utils.Objects.GetAdvancedValue,_i=Phaser.Math.Linear,Oi=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).scaleStart={},s.scaleEnd={},s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(wi(t,"mode",0)),this.setScaleRange(Ti(t,"start",void 0),Ti(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ei[t]),this.mode=t,this}},{key:"setScaleRange",value:function(t,e){return "number"==typeof t?(this.startX=t,this.startY=t):(this.startX=Ti(t,"x",this.parent.scaleX),this.startY=Ti(t,"y",this.parent.scaleY)),"number"==typeof e?(this.endX=e,this.endY=e):(this.endX=Ti(e,"x",void 0),this.endY=Ti(e,"y",void 0)),this.hasScaleX=void 0!==this.startX&&void 0!==this.endX,this.hasScaleY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;this.hasScaleX&&(t.scaleX=this.startX),this.hasScaleY&&(t.scaleY=this.startY);var e=this.repeat;return 2===this.mode&&-1!==e&&(e=2*(e+1)-1),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(e),l(r(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasScaleX&&(t.scaleX=_i(this.startX,this.endX,i)),this.hasScaleY&&(t.scaleY=_i(this.startY,this.endY,i));}},{key:"complete",value:function(){return l(r(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Pi),Ei={stop:0,destroy:1,yoyo:2},Di=function(t,e,i,n,s){var r,o;switch(void 0===n&&(n="Cubic"),i){case 0:case"x":r={x:0},o={x:t.scaleX};break;case 1:case"y":r={y:0},o={y:t.scaleY};break;default:r=0,o=t.scale;}var a={mode:0,start:r,end:o,duration:e,ease:n};return void 0===s?s=new Oi(t,a):s.resetFromJSON(a),s.restart(),s},Mi=function(t,e,i,n,s,r){void 0===n&&(n="Linear"),s instanceof Oi&&(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=n,void 0===r?r=new Oi(t,o):r.resetFromJSON(o),r.restart(),r},Ri=function(t,e){return new Promise((function(i,n){t.once(e,(function(){i();}));}))},Li=function(t){return Ri(t,"complete")},zi=Phaser.Utils.Objects.IsPlainObject,Ai=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Re.getParentSizer(t);e&&e.resetChildPositionState(t);}));},Ii={popUp:function(t,e,i){if(zi(t)){var n=t;t=n.duration,e=n.orientation,i=n.ease;}var s=void 0===this._scaleBehavior;return this._scaleBehavior=Di(this,t,e,i,this._scaleBehavior),s&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="popup.complete",this},popUpPromise:function(t,e,i){return this.popUp(t,e,i),Li(this._scaleBehavior)},scaleDownDestroy:function(t,e,i,n){if(zi(t)){var s=t;t=s.duration,e=s.orientation,i=s.ease,n=s.destroy;}var r=void 0===this._scaleBehavior;return this._scaleBehavior=Mi(this,t,e,i,n,this._scaleBehavior),r&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaledown.complete",this},scaleDownDestroyPromise:function(t,e,i,n){return this.scaleDownDestroy(t,e,i,n),Li(this._scaleBehavior)},scaleDown:function(t,e,i){return this.scaleDownDestroy(t,e,i,!1),this},scaleDownPromise:function(t,e,i){return this.scaleDown(t,e,i),Li(this._scaleBehavior)},scaleYoyo:function(t,e,i,n,s){if(zi(t)){var r=t;t=r.duration,e=r.peakValue,i=r.repeat,n=r.orientation,s=r.ease;}var o=void 0===this._scaleBehavior;return this._scaleBehavior=function(t,e,i,n,s,r,o){var a,h;switch(void 0===i&&(i=1.2),void 0===n&&(n=0),void 0===r&&(r="Cubic"),s){case 0:case"x":a={x:t.scaleX},h={x:i};break;case 1:case"y":a={y:t.scaleX},h={y:i};break;default:a=t.scaleX,h=i;}var u={mode:2,start:a,end:h,duration:e/2,ease:r,repeat:n};return void 0===o?o=new Oi(t,u):o.resetFromJSON(u),o.restart(),o}(this,t,e,i,n,s,this._scaleBehavior),o&&Ai(this,this._scaleBehavior),this._scaleBehavior.completeEventName="scaleyoyo.complete",this},scaleYoyoPromise:function(t,e,i,n,s){return this.scaleYoyo(t,e,i,n,s),Li(this._scaleBehavior)}},ji=Phaser.Utils.Objects.GetValue,Xi=Phaser.Utils.Objects.GetAdvancedValue,Ni=Phaser.Math.Linear,Vi=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(ji(t,"mode",0)),this.setAlphaRange(Xi(t,"start",this.parent.alpha),Xi(t,"end",0)),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Fi[t]),this.mode=t,this}},{key:"setAlphaRange",value:function(t,e){return this.alphaStart=t,this.alphaEnd=e,this}},{key:"start",value:function(){return this.timer.isRunning||(this.parent.setAlpha(this.alphaStart),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),l(r(o.prototype),"start",this).call(this)),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),t.alpha=Ni(this.alphaStart,this.alphaEnd,i);}},{key:"complete",value:function(){return l(r(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Pi),Fi={stop:0,destroy:1,yoyo:2},Yi=Phaser.Utils.Objects.IsPlainObject,Gi=function(t,e,i,n){var s,r;Yi(i)?(s=i.start,r=i.end):r=i,void 0===s&&(s=0),void 0===r&&(r=1);var o={mode:0,start:s,end:r,duration:e};return void 0===n?n=new Vi(t,o):n.resetFromJSON(o),n.restart(),n},Ui=function(t,e,i,n){i instanceof Vi&&(n=i,i=void 0),void 0===i&&(i=!0);var s={mode:i?1:0,end:0,duration:e};return void 0===n?n=new Vi(t,s):n.resetFromJSON(s),n.restart(),n},Bi=Phaser.Utils.Objects.IsPlainObject,Wi=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Re.getParentSizer(t);e&&e.resetChildAlphaState(t);}));},Hi={fadeIn:function(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.alpha;}var n=void 0===this._fade;return this._fade=Gi(this,t,e,this._fade),n&&Wi(this,this._fade),this._fade.completeEventName="fadein.complete",this},fadeInPromise:function(t,e){return this.fadeIn(t,e),Li(this._fade)},fadeOutDestroy:function(t,e){if(Bi(t)){var i=t;t=i.duration,e=i.destroy;}var n=void 0===this._fade;return this._fade=Ui(this,t,e,this._fade),n&&Wi(this,this._fade),this._fade.completeEventName="fadeout.complete",this},fadeOutDestroyPromise:function(t,e){return this.fadeOutDestroy(t,e),Li(this._fade)},fadeOut:function(t){return this.fadeOutDestroy(t,!1),this},fadeOutPromise:function(t){return this.fadeOut(t),Li(this._fade)}},Ji=Phaser.Utils.Objects.GetValue,qi=Phaser.Utils.Objects.GetAdvancedValue,Zi=Phaser.Math.Linear,Ki=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){if(l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setMode(Ji(t,"mode",0)),t&&(t.hasOwnProperty("x")||t.hasOwnProperty("y"))){var e=qi(t,"x",void 0),i=qi(t,"y",void 0);this.setTargetPosition(e,i);}else this.setTargetPosition(t);return this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=$i[t]),this.mode=t,this}},{key:"setTargetPosition",value:function(t,e){if("number"==typeof t||"number"==typeof e)this.startX=this.parent.x,this.startY=this.parent.y,this.endX=t,this.endY=e;else {var i=t;this.startX=qi(i,"startX",void 0),this.startY=qi(i,"startY",void 0),this.endX=qi(i,"endX",void 0),this.endY=qi(i,"endY",void 0);}return this.hasMoveX=void 0!==this.startX&&void 0!==this.endX,this.hasMoveY=void 0!==this.startY&&void 0!==this.endY,this}},{key:"start",value:function(){if(this.timer.isRunning)return this;var t=this.parent;return this.hasMoveX&&(t.x=this.startX),this.hasMoveY&&(t.y=this.startY),this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(2===this.mode?-1:0),l(r(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;e.isOddIteration&&(i=1-i),i=this.easeFn(i),this.hasMoveX&&(t.x=Zi(this.startX,this.endX,i)),this.hasMoveY&&(t.y=Zi(this.startY,this.endY,i));}},{key:"complete",value:function(){return l(r(o.prototype),"complete",this).call(this),1===this.mode&&this.parent.destroy(),this}}]),o}(Pi),$i={stop:0,destroy:1,yoyo:2},Qi=function(t,e){if("number"==typeof t)return t;var i=t[0],n=parseFloat(t.substr(2));switch(i){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n}},tn=Phaser.Utils.Objects.IsPlainObject,en=Phaser.Math.Distance.Between,nn=function(t,e){e.completeEventName=void 0,e.on("complete",(function(){e.completeEventName&&(t.emit(e.completeEventName,t),e.completeEventName=void 0);})),e.on("update",(function(){var e=Re.getParentSizer(t);e&&e.resetChildPositionState(t);}));},sn={moveFrom:function(t,e,i,n,s){if(tn(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*en(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,s,r,o){r instanceof Ki&&(o=r,r=void 0),void 0===r&&(r=!1);var a={};return a.mode=r?1:0,void 0!==i&&(a.startX=Qi(i,t.x),a.endX=t.x),void 0!==n&&(a.startY=Qi(n,t.y),a.endY=t.y),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new Ki(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,s,this._easeMove),o&&nn(this,this._easeMove),this._easeMove.completeEventName="movefrom.complete",this},moveFromPromise:function(t,e,i,n,s){return this.moveFrom(t,e,i,n,s),Li(this._easeMove)},moveFromDestroy:function(t,e,i,n){return this.moveFrom(t,e,i,n,!0),this},moveFromDestroyPromise:function(t,e,i,n){return this.moveFromDestroy(t,e,i,n),Li(this._easeMove)},moveTo:function(t,e,i,n,s){if(tn(t)){var r=t;e=r.x,i=r.y,t=r.hasOwnProperty("speed")?1e3*en(e,i,this.x,this.y)/r.speed:r.duration,n=r.ease;}var o=void 0===this._easeMove;return this._easeMove=function(t,e,i,n,s,r,o){r instanceof Ki&&(o=r,r=void 0),void 0===r&&(r=!1);var a={};return a.mode=r?1:0,void 0!==i&&(a.startX=t.x,a.endX=Qi(i,t.x)),void 0!==n&&(a.startY=t.y,a.endY=Qi(n,t.y)),a.duration=e,a.ease=void 0===s?"Linear":s,void 0===o?o=new Ki(t,a):o.resetFromJSON(a),o.restart(),o}(this,t,e,i,n,s,this._easeMove),o&&nn(this,this._easeMove),this._easeMove.completeEventName="moveto.complete",this},moveToPromise:function(t,e,i,n,s){return this.moveTo(t,e,i,n,s),Li(this._easeMove)},moveToDestroy:function(t,e,i,n){return this.moveTo(t,e,i,n,!0),this},moveToDestroyPromise:function(t,e,i,n){return this.moveToDestroy(t,e,i,n,!0),Li(this._easeMove)},moveStop:function(t){return this._easeMove?(this._easeMove.stop(t),this):this}},rn=Phaser.Utils.Objects.GetValue,on=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).timer=new pi,s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.timer.resetFromJSON(rn(t,"timer")),this.setEnable(rn(t,"enable",!0)),this.setMode(rn(t,"mode",1)),this.isRunning=rn(t,"isRunning",!1),this.setMagnitudeMode(rn(t,"magnitudeMode",1)),this.setAxisMode(rn(t,"axis",0)),this.setDuration(rn(t,"duration",500)),this.setMagnitude(rn(t,"magnitude",10)),this.ox=rn(t,"ox",void 0),this.oy=rn(t,"oy",void 0),this}},{key:"toJSON",value:function(){return {timer:this.timer.toJSON(),enable:this.enable,mode:this.mode,isRunning:this.isRunning,magnitudeMode:magnitudeMode,duration:this.duration,magnitude:this.magnitude,ox:this.ox,oy:this.oy}}},{key:"shutdown",value:function(t){this.isShutdown||(l(r(o.prototype),"shutdown",this).call(this,t),this.timer.destroy(),this.timer=void 0);}},{key:"startTicking",value:function(){l(r(o.prototype),"startTicking",this).call(this),0===this.mode?(this.scene.game.events.on("poststep",this.update,this),this.scene.game.events.on("prestep",this.backToOrigin,this)):this.scene.sys.events.on("preupdate",this.update,this);}},{key:"stopTicking",value:function(){l(r(o.prototype),"stopTicking",this).call(this),this.scene&&(0===this.mode?(this.scene.game.events.off("poststep",this.update,this),this.scene.game.events.off("prestep",this.backToOrigin,this)):this.scene.sys.events.off("preupdate",this.update,this));}},{key:"setEnable",value:function(t){return null==t&&(t=!0),this.enable=t,this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=an[t]),this.mode=t,this}},{key:"setMagnitudeMode",value:function(t){return "string"==typeof t&&(t=un[t]),this.magnitudeMode=t,this}},{key:"setAxisMode",value:function(t){return "string"==typeof t&&(t=hn[t]),this.axisMode=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setMagnitude",value:function(t){return this.magnitude=t,this}},{key:"start",value:function(t,e){if("number"!=typeof t){var i=t;e=rn(i,"magnitude",void 0),t=rn(i,"duration",void 0);}return void 0!==e&&this.setMagnitude(e),void 0!==t&&this.setDuration(t),this.timer.setDuration(this.duration).start(),l(r(o.prototype),"start",this).call(this),this}},{key:"shake",value:function(t,e){return this.start(t,e),this}},{key:"update",value:function(t,e){if(!this.isRunning||!this.enable)return this;var i=this.parent;if(!i.active)return this;if(this.timer.update(t,e),this.timer.isDone)this.backToOrigin(),this.complete();else {void 0===this.ox&&(this.ox=i.x,this.oy=i.y);var n=this.magnitude;1===this.magnitudeMode&&(n*=1-this.timer.t);var s=Math.random()*Math.PI*2,r=this.ox+Math.cos(s)*n,o=this.oy+Math.sin(s)*n;switch(this.axisMode){case 1:i.x=r;break;case 2:i.y=o;break;default:i.x=r,i.y=o;}}return this}},{key:"backToOrigin",value:function(){if(!this.isRunning||!this.enable)return this;if(void 0===this.ox)return this;var t=this.parent;switch(this.axisMode){case 1:t.x=this.ox;break;case 2:t.y=this.oy;break;default:t.x=this.ox,t.y=this.oy;}return this.ox=void 0,this.oy=void 0,this}}]),o}(ai),an={effect:0,behavior:1},hn={both:0,"h&v":0,"x&y":0,horizontal:1,h:1,x:1,vertical:2,v:2,y:2},un={constant:0,decay:1},ln=Phaser.Utils.Objects.IsPlainObject,cn={shake:function(t,e,i){if(ln(t)){var n=t;t=n.duration,e=n.magnitude,i=n.magnitudeMode;}return void 0===this._shake&&(this._shake=new on(this,{mode:0,magnitudeMode:1}),function(t,e){e.on("complete",(function(){t.emit("shake.complete",t);}));}(this,this._shake)),void 0!==t&&this._shake.setDuration(t),void 0!==e&&this._shake.setMagnitude(e),void 0!==i&&this._shake.setMagnitudeMode(i),this._shake.shake(),this},shakePromise:function(t,e){return this.shake(t,e),Li(this._shake)}},dn=Phaser.Utils.Objects.GetValue,vn=Phaser.Math.Linear,pn=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).resetFromJSON(),s.boot(),s}return n(o,[{key:"start",value:function(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=dn(t,"key","value");var i=e[this.propertyKey];return this.fromValue=dn(t,"from",i),this.toValue=dn(t,"to",i),this.setEase(dn(t,"ease",this.ease)),this.setDuration(dn(t,"duration",this.duration)),this.setRepeat(dn(t,"repeat",0)),this.setDelay(dn(t,"delay",0)),this.setRepeatDelay(dn(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,l(r(o.prototype),"start",this).call(this),this}},{key:"updateGameObject",value:function(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=vn(this.fromValue,this.toValue,i);}}]),o}(Pi),fn=Phaser.Utils.Objects.IsPlainObject,yn=function(t){s(r,t);var i=h(r);function r(t,n){var s;return e(this,r),(s=i.call(this,t,n)).parent.setDataEnabled(),s.easeTasks={},s}return n(r,[{key:"complete",value:function(t){this.emit("complete-".concat(t),this.parent,this),this.emit("complete",t,this.parent,this);}},{key:"getEaseTask",value:function(t){var e=this.easeTasks[t];return void 0===e&&(e=new pn(this.parent),this.easeTasks[t]=e,e.setTarget(this.parent.data.values).on("complete",(function(){this.complete(t);}),this)),e}},{key:"easeTo",value:function(t,e,i,n){if(fn(t)){var s=t;t=s.key,e=s.value,i=s.duration,n=s.ease;var r=s.speed;void 0===i&&void 0!==r&&(i=Math.abs(e-this.parent.data.values[t])/r*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,to:e,duration:i,ease:n}),this}},{key:"easeFrom",value:function(t,e,i,n){if(fn(t)){var s=t;t=s.key,e=s.value,i=s.duration,n=s.ease;var r=s.speed;void 0===i&&void 0!==r&&(i=Math.abs(e-this.parent.data.values[t])/r*1e3);}return void 0===i&&(i=1e3),void 0===n&&(n="Linear"),this.getEaseTask(t).restart({key:t,from:e,duration:i,ease:n}),this}},{key:"stopEase",value:function(t,e){void 0===e&&(e=!0);var i=this.easeTasks[t];return i&&i.stop(e),this}},{key:"stopAll",value:function(t){for(var e in void 0===t&&(t=!0),this.easeTasks)this.stopEase(e,t);return this}}]),r}(si),gn={easeDataTo:function(t,e,i,n){return this._easeData||(this._easeData=new yn(this),function(t,e){e.on("complete",(function(e){t.emit("easedata.".concat(e,".complete"),t),t.emit("easedata.complete",e,t);}));}(this,this._easeData)),this._easeData.easeTo(t,e,i,n),this},easeDataToPromise:function(t,e,i,n){return this.easeDataTo(t,e,i,n),Ri(this._easeData,"complete-".concat(t))},stopEaseData:function(t,e){return this._easeData?(this._easeData.stopEase(t,e),this):this},stopAllEaseData:function(t){return this._easeData?(this._easeData.stopAll(t),this):this}},mn=function(t,e){if(t){Bt(t).hidden=e;var i=P(t);i?i.setChildVisible(t,!e):t.setVisible(!e);}},kn={show:function(t){return void 0===t&&(t=this),function(t){mn(t,!1);}(t),this},hide:function(t){return void 0===t&&(t=this),function(t){mn(t,!0);}(t),this},isShow:function(t){return void 0===t&&(t=this),function(t){return !!t&&!Bt(t).hidden}(t)}};function bn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Cn={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1;}function r(t,e,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,r||t,o),h=i?i+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e];}function a(){this._events=new n,this._eventsCount=0;}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return [];if(n.fn)return [n.fn];for(var s=0,r=n.length,o=new Array(r);s<r;s++)o[s]=n[s].fn;return o},a.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,s,r,o){var a=i?i+t:t;if(!this._events[a])return !1;var h,u,l=this._events[a],c=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,n),!0;case 4:return l.fn.call(l.context,e,n,s),!0;case 5:return l.fn.call(l.context,e,n,s,r),!0;case 6:return l.fn.call(l.context,e,n,s,r,o),!0}for(u=1,h=new Array(c-1);u<c;u++)h[u-1]=arguments[u];l.fn.apply(l.context,h);}else {var d,v=l.length;for(u=0;u<v;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),c){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,n);break;case 4:l[u].fn.call(l[u].context,e,n,s);break;default:if(!h)for(d=1,h=new Array(c-1);d<c;d++)h[d-1]=arguments[d];l[u].fn.apply(l[u].context,h);}}return !0},a.prototype.on=function(t,e,i){return r(this,t,e,i,!1)},a.prototype.once=function(t,e,i){return r(this,t,e,i,!0)},a.prototype.removeListener=function(t,e,n,s){var r=i?i+t:t;if(!this._events[r])return this;if(!e)return o(this,r),this;var a=this._events[r];if(a.fn)a.fn!==e||s&&!a.once||n&&a.context!==n||o(this,r);else {for(var h=0,u=[],l=a.length;h<l;h++)(a[h].fn!==e||s&&!a[h].once||n&&a[h].context!==n)&&u.push(a[h]);u.length?this._events[r]=1===u.length?u[0]:u:o(this,r);}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&o(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=i,a.EventEmitter=a,t.exports=a;}(Cn);var Sn=function(t){s(r,t);var i=h(r);function r(){return e(this,r),i.apply(this,arguments)}return n(r,[{key:"shutdown",value:function(){this.removeAllListeners();}},{key:"destroy",value:function(){this.removeAllListeners();}}]),r}(bn(Cn.exports)),xn={setEventEmitter:function(t,e){return void 0===e&&(e=Sn),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},Pn=function(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1!==e.indexOf(".")){for(var n=e.split("."),s=t,r=i,o=0;o<n.length;o++){if(!s.hasOwnProperty(n[o])){r=i;break}r=s[n[o]],s=s[n[o]];}return r}return i}return i},wn=["next","exit","enter"],Tn=function(){function t(i){e(this,t);var n=Pn(i,"states",void 0);n&&this.addStates(n);var s=Pn(i,"extend",void 0);if(s)for(var r in s)this.hasOwnProperty(r)&&void 0!==this[r]||(this[r]=s[r]);var o=Pn(i,"eventEmitter",void 0),a=Pn(i,"EventEmitterClass",void 0);this.setEventEmitter(o,a),this._stateLock=!1,this.resetFromJSON(i);}return n(t,[{key:"shutdown",value:function(){this.destroyEventEmitter();}},{key:"destroy",value:function(){this.shutdown();}},{key:"resetFromJSON",value:function(t){this.setEnable(Pn(t,"enable",!0)),this.start(Pn(t,"start",void 0));var e=Pn(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:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"state",get:function(){return this._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);}}}},{key:"prevState",get:function(){return this._prevState}},{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:"stateProperties",get:function(){return wn}},{key:"addState",value:function(t,e){"string"!=typeof t&&(t=(e=t).name);for(var i=this.stateProperties,n=0,s=i.length;n<s;n++){var r=i[n],o=e[r];o&&(this["".concat(r,"_").concat(t)]=o);}return this}},{key:"addStates",value:function(t){if(Array.isArray(t))for(var e=0,i=t.length;e<i;e++)this.addState(t[e]);else for(var n in t)this.addState(n,t[n]);return this}},{key:"runMethod",value:function(t,e,i,n,s,r){var o=this[t+"_"+this.state];if(o){var a=arguments.length;switch(a){case 1:return o.call(this);case 2:return o.call(this,e);case 3:return o.call(this,e,i);case 4:return o.call(this,e,i,n);case 5:return o.call(this,e,i,n,s);case 6:return o.call(this,e,i,n,s,r)}for(var h=new Array(a-1),u=1;u<a;u++)h[u-1]=arguments[u];return o.apply(this,h)}}}]),t}();Object.assign(Tn.prototype,xn);var _n=function(t,e,i,n,s){void 0===s&&(s=!1);var r=t._events[e];if(!r)return !1;for(var o=0,a=r.length;o<a;o++){var h=r[o];if(h.fn===i&&h.context===n&&h.once===s)return !0}return !1},On=["next","exit","enter","update","preupdate","postupdate"],En=function(t){s(o,t);var i=h(o);function o(){return e(this,o),i.apply(this,arguments)}return n(o,[{key:"shutdown",value:function(){this.stopUpdate(),this.stopPreUpdate(),this.stopPostUpdate(),this._scene=void 0,l(r(o.prototype),"shutdown",this).call(this);}},{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this._scene=Pn(t,"scene",void 0),this}},{key:"stateProperties",get:function(){return On}},{key:"update",value:function(t,e){this.runMethod("update",t,e);}},{key:"preupdate",value:function(t,e){this.runMethod("preupdate",t,e);}},{key:"postupdate",value:function(t,e){this.runMethod("postupdate",t,e);}},{key:"startUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return _n(e,"update",this.update,this)||(this._scene=t,e.on("update",this.update,this)),this}},{key:"stopUpdate",value:function(){return this._scene?(this._scene.sys.events.off("update",this.update,this),this):this}},{key:"startPreUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return _n(e,"preupdate",this.preupdate,this)||(this._scene=t,e.on("preupdate",this.preupdate,this)),this}},{key:"stopPreUpdate",value:function(){return this._scene?(this._scene.sys.events.off("preupdate",this.preupdate,this),this):this}},{key:"startPostUpdate",value:function(t){t||(t=this._scene);var e=t.sys.events;return _n(e,"postupdate",this.postupdate,this)||(this._scene=t,e.on("postupdate",this.postupdate,this)),this}},{key:"stopPostUpdate",value:function(){return this._scene?(this._scene.sys.events.off("postupdate",this.postupdate,this),this):this}}]),o}(Tn),Dn=function(t){s(r,t);var i=h(r);function r(t,n){var s;e(this,r),(s=i.call(this,n)).parent=t;var o=n.initState||"IDLE";return s.start(o),s}return n(r,[{key:"init",value:function(){this.start("IDLE");}},{key:"next_IDLE",value:function(){return "TRANS_OPNE"}},{key:"next_TRANS_OPNE",value:function(){return "OPEN"}},{key:"enter_TRANS_OPNE",value:function(){var t=this.parent;if(t.transitInTime>0){var e=t.runTransitionInCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_OPNE",value:function(){this.parent.removeDelayCall();}},{key:"next_OPEN",value:function(){return "TRANS_CLOSE"}},{key:"enter_OPEN",value:function(){this.parent.onOpen();}},{key:"exit_OPEN",value:function(){this.parent.removeDelayCall();}},{key:"next_TRANS_CLOSE",value:function(){return "CLOSE"}},{key:"enter_TRANS_CLOSE",value:function(){var t=this.parent;if(t.transitOutTime>0){var e=t.runTransitionOutCallback();t.delayCall(e,this.next,this);}else this.next();}},{key:"exit_TRANS_CLOSE",value:function(){this.parent.removeDelayCall();}},{key:"next_CLOSE",value:function(){return "TRANS_OPNE"}},{key:"enter_CLOSE",value:function(){this.parent.onClose();}},{key:"exit_CLOSE",value:function(){}},{key:"canOpen",value:function(){return "IDLE"===this.state||"CLOSE"===this.state}},{key:"canClose",value:function(){return "IDLE"===this.state||"OPEN"===this.state}}]),r}(En),Mn={delayCall:function(t,e,i){return this.delayCallTimer=function(t,e,i,n,s){var r=Qe(t);return r.time.delayedCall(e,(function(){r.game.events.once("poststep",(function(){i.call(n,s);}));}))}(this,t,e,i),this},removeDelayCall:function(){return this.delayCallTimer&&(this.delayCallTimer.remove(!1),this.delayCallTimer=void 0),this}},Rn={setTransitInTime:function(t){return this.transitInTime=t,this},setTransitOutTime:function(t){return this.transitOutTime=t,this},setTransitInCallback:function(t){return t||(t=$t),this.transitInCallback=t,this},setTransitOutCallback:function(t){return t||(t=$t),this.transitOutCallback=t,this}},Ln={runTransitionInCallback:function(){return this.transitInCallback(this.parent,this.transitInTime),this.transitInTime},onOpen:function(){},requestOpen:function(t,e){if(!this._state.canOpen())return this;this.openEventData=arguments.length>0?t:this.parent;var i=this.transitInTime;return void 0!==e&&(this.transitInTime=e),this._state.goto("TRANS_OPNE"),this.transitInTime=i,this}},zn={runTransitionOutCallback:function(){return this.transitOutCallback(this.parent,this.transitOutTime),this.transitOutTime},onClose:function(){this.oneShotMode&&this.parent.destroy();},requestClose:function(t,e){if(!this._state.canClose)return this;this.closeEventData=arguments.length>0?t:this.parent;var i=this.transitOutTime;return void 0!==e&&(this.transitOutTime=e),this._state.goto("TRANS_CLOSE"),this.transitOutTime=i,this}},An={};Object.assign(An,Mn,Rn,Ln,zn);var In=Phaser.Utils.Objects.GetValue,jn=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).setTransitInTime(In(n,"duration.in",200)),s.setTransitOutTime(In(n,"duration.out",200)),s.setTransitInCallback(In(n,"transitIn")),s.setTransitOutCallback(In(n,"transitOut")),s.oneShotMode=In(n,"destroy",!1),s.delayCallTimer=void 0,s._state=new Dn(a(s),{eventEmitter:!1,initState:In(n,"initState","IDLE")}),s.openEventData=void 0,s.closeEventData=void 0,s}return n(o,[{key:"state",get:function(){return this._state.state}},{key:"shutdown",value:function(t){this.isShutdown||(this.transitInCallback=void 0,this.transitOutCallback=void 0,this.openEventData=void 0,this.closeEventData=void 0,this.removeDelayCall(),l(r(o.prototype),"shutdown",this).call(this,t));}}]),o}(si);Object.assign(jn.prototype,An);var Xn=function(t){s(o,t);var i=h(o);function o(t,n,s){var r;return e(this,o),(r=i.call(this,t,0,0,2,2,n,1)).setAlpha(s),r.setScrollFactor(0),r.boot(),r}return n(o,[{key:"boot",value:function(){this.scene.sys.events.on("prerender",this.resize,this);}},{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.scene.sys.events.off("prerender",this.resize,this),l(r(o.prototype),"destroy",this).call(this,t));}},{key:"tint",get:function(){return this.fillColor},set:function(t){this.setFillStyle(t,this.fillAlpha);}},{key:"resize",value:function(){var t=this.scene,e=t.sys.scale.gameSize,i=t.sys.cameras.main,n=e.width,s=e.height,r=1/i.zoom,o=n/2,a=s/2,h=n*r,u=s*r;this.x===o&&this.y===a||this.setPosition(o,a),this.width===h&&this.height===u||this.setSize(h,u).setOrigin(.5);}}]),o}(Phaser.GameObjects.Rectangle),Nn=Phaser.Utils.Objects.GetValue,Vn=function(t){s(r,t);var i=h(r);function r(t,n){var s;return e(this,r),(s=i.call(this,t,{eventEmitter:!1})).resetFromJSON(n),s.boot(),s}return n(r,[{key:"resetFromJSON",value:function(t){return this.setHitAreaMode(Nn(t,"hitAreaMode",0)),this.setEnable(Nn(t,"enable",!0)),this.setStopMode(Nn(t,"stopAllLevels",!0)),this}},{key:"boot",value:function(){this.parent.on("pointerdown",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerup",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointermove",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerover",(function(t,e,i,n){this.stopAllLevels&&n.stopPropagation();}),this).on("pointerout",(function(t,e){this.stopAllLevels&&e.stopPropagation();}),this);}},{key:"setHitAreaMode",value:function(t){"string"==typeof t&&(t=Fn[t]);var e=this.parent;return e.input&&e.removeInteractive(),0===t?e.setInteractive():e.setInteractive({hitArea:{},hitAreaCallback:function(){return !0}}),this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),t?this.parent.setInteractive():this.parent.disableInteractive(),this.enable=t,this}},{key:"setStopMode",value:function(t){return void 0===t&&(t=!0),this.stopAllLevels=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}}]),r}(si),Fn={default:0,fullWindow:1},Yn=Phaser.Utils.Objects.GetValue,Gn=function(t){s(r,t);var i=h(r);function r(t,n){var s;e(this,r);var o=Yn(n,"color",0),h=Yn(n,"alpha",.8);return (s=i.call(this,t,o,h)).touchEventStop=new Vn(a(s),{hitAreaMode:1}),s}return n(r)}(Xn),Un=function(t,e){void 0!==t._modalScaleSave?(t.scaleX=t._modalScaleSave,t.scaleY=t._modalScaleSave):t._modalScaleSave=t.scaleX,Di(t,e);},Bn=function(t,e){Mi(t,e,void 0,void 0,!1);},Wn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e);},Hn=function(t,e){Ui(t,e,!1);},Jn=function(t,e){void 0!==t._modalAlphaSave?t.alpha=t._modalAlphaSave:t._modalAlphaSave=t.alpha,Gi(t,e,t.alpha);},qn=function(t,e){Ui(t,e,!1);},Zn=function(t,e,i,n,s){return !!t&&(!(n&&!n(t,e,i))&&(!!kt(t,!0).contains(e,i)&&!(s&&!s(t,e,i))))},Kn=Phaser.Utils.Objects.GetValue,$n=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o),void 0===n&&(n={}),null==n.transitIn&&(n.transitIn=Qn.popUp),null==n.transitOut&&(n.transitOut=Qn.scaleDown),n.destroy=Kn(n,"destroy",!0),s=i.call(this,t,n);var r=Kn(n,"cover");s.cover=!1!==r?function(t,e){var i=t.scene,n=new Gn(i,e);return i.add.existing(n),t.isRexContainerLite?(t.pin(n,{syncPosition:!1,syncRotation:!1,syncScale:!1,syncAlpha:!1,syncScrollFactor:!1}),t.moveDepthBelow(n)):i.children.moveBelow(n,t),n}(t,r):void 0,s.cover&&(s.setCoverTransitInCallback(Kn(r,"transitIn",Jn)),s.setCoverTransitOutCallback(Kn(r,"transitOut",qn)));var h=Kn(n,"touchOutsideClose",!1),u=Kn(n,"duration.hold",-1),l=Kn(n,"timeOutClose",u>=0),c=Kn(n,"anyTouchClose",!1);return Kn(n,"manualClose",!1)&&(h=!1,c=!1,l=!1),c&&(h=!1),l?s.setDisplayTime(u):s.setDisplayTime(-1),c?s.once("open",s.anyTouchClose,a(s)):h&&s.once("open",s.touchOutsideClose,a(s)),Kn(n,"openOnStart",!0)&&s.delayCall(0,s.requestOpen,a(s)),s}return n(o,[{key:"shutdown",value:function(t){this.isShutdown||(this.cover||this.scene.input.off("pointerup",this.touchCloseCallback,this),this.cover&&!t&&(this.cover.destroy(),this.cover=void 0),l(r(o.prototype),"shutdown",this).call(this,t));}},{key:"touchOutsideClose",value:function(){return this.cover?this.cover.on("pointerup",this.touchCloseCallback,this):this.scene.input.on("pointerup",this.touchCloseCallback,this),this.clickOutsideTest=!0,this}},{key:"anyTouchClose",value:function(){return this.cover?this.cover.once("pointerup",this.touchCloseCallback,this):this.scene.input.once("pointerup",this.touchCloseCallback,this),this}},{key:"touchCloseCallback",value:function(t){this.clickOutsideTest&&Zn(this.parent,t.worldX,t.worldY)||this.requestClose();}},{key:"runTransitionInCallback",value:function(){var t=l(r(o.prototype),"runTransitionInCallback",this).call(this),e=this.cover;return e&&this.coverTransitInCallback&&this.coverTransitInCallback(e,t),t}},{key:"runTransitionOutCallback",value:function(){var t=l(r(o.prototype),"runTransitionOutCallback",this).call(this),e=this.cover;return e&&this.coverTransitOutCallback&&this.coverTransitOutCallback(e,t),t}},{key:"onOpen",value:function(){var t=this.displayTime;t>=0&&this.delayCall(t,this.requestClose,this),this.emit("open",this.parent,this),l(r(o.prototype),"onOpen",this).call(this);}},{key:"onClose",value:function(){this.emit("close",this.closeEventData),l(r(o.prototype),"onClose",this).call(this);}},{key:"setDisplayTime",value:function(t){return this.displayTime=t,this}},{key:"setTransitInCallback",value:function(t){switch("string"==typeof t&&(t=Qn[t]),t){case Qn.popUp:t=Un;break;case Qn.fadeIn:t=Wn;}return l(r(o.prototype),"setTransitInCallback",this).call(this,t),this}},{key:"setTransitOutCallback",value:function(t){switch("string"==typeof t&&(t=Qn[t]),t){case Qn.scaleDown:t=Bn;break;case Qn.fadeOut:t=Hn;}return l(r(o.prototype),"setTransitOutCallback",this).call(this,t),this}},{key:"setCoverTransitInCallback",value:function(t){return this.coverTransitInCallback=t,this}},{key:"setCoverTransitOutCallback",value:function(t){return this.coverTransitOutCallback=t,this}}]),o}(jn),Qn={popUp:0,fadeIn:1,scaleDown:0,fadeOut:1},ts=function(t){return t&&"function"==typeof t},es={modal:function(t,e){return ts(t)&&(e=t,t=void 0),void 0===this._modalBehavior&&(this.onCreateModalBehavior&&this.onCreateModalBehavior(this,t),this._modalBehavior=function(t,e){var i=new $n(t,e);return i.on("open",(function(){t.emit("modal.open",i);})),i.on("close",(function(e){t.emit("modal.close",e,i);})),t.on("modal.requestClose",i.requestClose,i),i}(this,t)),e&&this._modalBehavior.once("close",e),this._modalBehavior.requestOpen(),this},modalPromise:function(t){var e=this;return new Promise((function(i,n){e.modal(t,i);}))},modalClose:function(t){return function(t,e){t.emit("modal.requestClose",e);}(this,t),this}},is=function(t,e,i,n){if(e)return Zn(t,e.worldX,e.worldY,i,n);for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,a=0;a<r;a++)if(e=o[a],Zn(t,e.worldX,e.worldY,i,n))return !0;return !1},ns=function(t,e,i,n,s){return Zn(t,e,i,rs(n),os(s))},ss=function(t){return !(t.rexSizer&&t.rexSizer.hidden)},rs=function(t){return t?function(e,i,n){return !!ss(e)&&(t(e,i,n),!0)}:ss},os=function(t){return t},as=function(t,e,i){!t||void 0===e&&void 0===i||(us(t)?(void 0===e&&(e=t.width),void 0===i&&(i=t.height),t.resize?t.resize(e,i):t.setSize(e,i)):(void 0!==e&&(t.displayWidth=e),void 0!==i&&(t.displayHeight=i)));},hs=[Phaser.GameObjects.Image,Phaser.GameObjects.Sprite,Phaser.GameObjects.Mesh,Phaser.GameObjects.Shader,Phaser.GameObjects.Video],us=function(t){if(t.resize)return !0;if(!t.setSize)return !1;for(var e=0,i=hs.length;e<i;e++){var n=hs[e];if(n&&t instanceof n)return !1}return !0},ls={},cs=function(t){var e,i;this.sizerEventsEnable&&(e=t,void 0===(i=this.getChildPrevState(t))?i={}:!0===i&&(i=ls),i.x=e.x,i.y=e.y,i.scaleX=e.scaleX,i.scaleY=e.scaleY,i.width=e.width,i.height=e.height,i.displayWidth=e.displayWidth,i.displayHeight=e.displayHeight,this.layoutedChildren.push(t));},ds=function(t,e,i,n,s,r,o,a){Ce(t,e,i,n,s,r),void 0!==o&&(t.x+=o),void 0!==a&&(t.y+=a),this.resetChildPositionState(t),this.sizerEventsEnable&&t.emit("sizer.postlayout",t,this);},vs=Phaser.Display.Align.CENTER,ps=Phaser.Utils.Objects.IsPlainObject,fs=Phaser.Utils.Objects.GetValue,ys=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n))._enable=void 0,t.setInteractive(fs(n,"inputConfig",void 0)),s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(fs(t,"enable",!0)),this.setMode(fs(t,"mode",1)),this.setClickInterval(fs(t,"clickInterval",100)),this.setDragThreshold(fs(t,"threshold",void 0)),this}},{key:"boot",value:function(){var t=this.parent;t.on("pointerdown",this.onPress,this),t.on("pointerup",this.onRelease,this),t.on("pointerout",this.onPointOut,this),t.on("pointermove",this.onMove,this),t.on("pointerover",this.onOver,this),t.on("pointerout",this.onOut,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.pointer=null,l(r(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=gs[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"onPress",value:function(t,e,i,n){void 0===this.pointer&&(this.pointer=t,this.emit("down",this,this.parent,t,n),0===this.mode&&this.click(t.downTime,t,n));}},{key:"onRelease",value:function(t,e,i,n){this.pointer===t&&(this.emit("up",this,this.parent,t,n),1===this.mode&&this.click(t.upTime,t,n),this.pointer=void 0);}},{key:"onPointOut",value:function(t,e){this.pointer===t&&this.cancel();}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&t.getDistance()>=this.dragThreshold&&this.cancel();}},{key:"click",value:function(t,e,i){if(!this.enable)return this;if(void 0===t)return this.emit("click",this,this.parent,e,i),this;this.pointer=void 0;var n=this.lastClickTime;return void 0!==n&&t-n<=this.clickInterval||(this.lastClickTime=t,this.emit("click",this,this.parent,e,i)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}},{key:"onOver",value:function(t,e,i,n){return this.enable?(this.emit("over",this,this.parent,t,n),this):this}},{key:"onOut",value:function(t,e){return this.enable?(this.emit("out",this,this.parent,t,e),this):this}}]),o}(si),gs={press:0,pointerdown:0,release:1,pointerup:1},ms={onClick:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._click&&(t._click=new ys(t,n)),t._click.on("click",e,i),this):this},offClick:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._click||t._click.off("click",e,i),this},enableClick:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._click||e._click.setEnable(i),this},disableClick:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._click||e._click.setEnable(!1),this}},ks=function(t,e,i,n){if(e)return !(i&&!i(t,e))&&(!!bs(t,e)&&!(n&&!n(t,e)));for(var s=t.scene.input.manager,r=s.pointersTotal,o=s.pointers,a=0;a<r;a++)if(e=o[a],(!i||i(t,e))&&bs(t,e)&&(!n||n(t,e)))return !0;return !1},bs=function(t,e){for(var i=t.scene,n=i.input.cameras.getCamerasBelowPointer(e),s=i.input.manager,r=[t],o=0,a=n.length;o<a;o++)if(s.hitTest(e,r,n[o],Cs),Cs.length>0)return Cs.length=0,!0;return Cs.length=0,!1},Cs=[],Ss=Phaser.Utils.Objects.GetValue,xs=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o),(s=i.call(this,t,n))._enable=void 0;var r=Ss(n,"inputConfig",void 0);return r&&t.setInteractive(r),s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.lastClickTime=void 0,this.setEnable(Ss(t,"enable",!0)),this.setMode(Ss(t,"mode",1)),this.setClickInterval(Ss(t,"clickInterval",100)),this.setDragThreshold(Ss(t,"threshold",void 0)),this}},{key:"boot",value:function(){var t=this.parent.scene;t.input.on("pointerdown",this.onPress,this),t.input.on("pointerup",this.onRelease,this),t.input.on("pointermove",this.onMove,this);}},{key:"shutdown",value:function(t){if(!this.isShutdown){var e=this.parent.scene;e.input.off("pointerdown",this.onPress,this),e.input.off("pointerup",this.onRelease,this),e.input.off("pointermove",this.onMove,this),this.pointer=null,l(r(o.prototype),"shutdown",this).call(this,t);}}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t){t||this.cancel(),this._enable=t;var e=t?"enable":"disable";this.emit(e,this,this.parent);}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"setMode",value:function(t){return "string"==typeof t&&(t=Ps[t]),this.mode=t,this}},{key:"setClickInterval",value:function(t){return this.clickInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"isPointerInside",value:function(t){var e=this.parent;return (e.input?ks:is)(e,t)}},{key:"onPress",value:function(t){this.parent.willRender(t.camera)&&void 0===this.pointer&&(this.pointer=t,0===this.mode&&(this.isPointerInside(t)||this.click(t.downTime,t)));}},{key:"onRelease",value:function(t){this.parent.willRender(t.camera)&&this.pointer===t&&(1===this.mode&&(this.isPointerInside(t)||this.click(t.upTime,t)),this.pointer=void 0);}},{key:"onMove",value:function(t,e,i,n){this.pointer===t&&void 0!==this.dragThreshold&&1===this.mode&&(t.getDistance()>=this.dragThreshold||this.isPointerInside(t))&&this.cancel();}},{key:"click",value:function(t,e){if(!this.enable)return this;if(void 0===t)return this.emit("clickoutside",this,this.parent,e),this;this.pointer=void 0;var i=this.lastClickTime;return void 0!==i&&t-i<=this.clickInterval||(this.lastClickTime=t,this.emit("clickoutside",this,this.parent,e)),this}},{key:"cancel",value:function(){return this.pointer=void 0,this}}]),o}(si),Ps={press:0,pointerdown:0,release:1,pointerup:1},ws={onClickOutside:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._clickOutside&&(t._clickOutside=new xs(t,n)),t._clickOutside.on("clickoutside",e,i),this):this},offClickOutside:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._clickOutside||t._clickOutside.off("clickoutside",e,i),this},enableClickOutside:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._clickOutside||e._clickOutside.setEnable(i),this},disableClickOutside:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._clickOutside||e._clickOutside.setEnable(!1),this}},Ts=function(t){s(r,t);var i=h(r);function r(){var t;return e(this,r),(t=i.call(this,{eventEmitter:!1})).goto("IDLE"),t}return n(r,[{key:"setCooldownTime",value:function(t){return this.cooldownTime=t,this.cooldownMode=void 0!==t,this}},{key:"request",value:function(){return this.runMethod("request")}},{key:"update_IDLE",value:function(){this.compensationTime=0;}},{key:"request_IDLE",value:function(){return this.next(),!0}},{key:"next_IDLE",value:function(){if(this.cooldownMode)return "COOLDOWN"}},{key:"enter_COOLDOWN",value:function(){this.remainderTime=this.cooldownTime+this.compensationTime;}},{key:"update_COOLDOWN",value:function(t,e){this.remainderTime-=e,this.remainderTime<0&&(this.compensationTime=this.cooldownTime>e?-this.remainderTime:0,this.goto("IDLE"));}},{key:"request_COOLDOWN",value:function(){return !1}}]),r}(En),_s=Phaser.Utils.Objects.GetValue,Os=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n))._enable=void 0,s.cooldown=new Ts,s.parent.setInteractive(_s(n,"inputConfig",void 0)),s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.pointer=void 0,this.prevIsInTouch=!1,this.isInTouching=!1,this.setEnable(_s(t,"enable",!0)),this.setCooldown(_s(t,"cooldown",void 0)),this}},{key:"boot",value:function(){var t=this.parent;t.on("pointerdown",this.onPointIn,this),t.on("pointerover",this.onPointIn,this),t.on("pointerup",this.onPointOut,this),t.on("pointerout",this.onPointOut,this),this.scene.sys.events.on("preupdate",this.preupdate,this);}},{key:"shutdown",value:function(t){this.isShutdown||(this.scene.sys.events.off("preupdate",this.preupdate,this),this.pointer=void 0,l(r(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||(this.prevIsInTouch=!1,this.isInTouching=!1,this.pointer=void 0),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"cooldownTime",get:function(){return this.cooldown.cooldownTime},set:function(t){this.cooldown.setCooldownTime(t);}},{key:"setCooldown",value:function(t){return this.cooldownTime=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointIn",value:function(t,e,i){this.enable&&t.isDown&&void 0===this.pointer&&(this.pointer=t,this.isInTouching=!0);}},{key:"onPointOut",value:function(t){this.enable&&this.pointer===t&&(this.pointer=void 0,this.isInTouching=!1);}},{key:"preupdate",value:function(t,e){this.cooldown.update(t,e),!this.prevIsInTouch&&this.isInTouching&&this.emit("touchstart",this,this.parent),this.isInTouching&&this.cooldown.request()&&this.emit("intouch",this,this.parent,this.pointer),this.prevIsInTouch&&!this.isInTouching&&this.emit("touchend",this,this.parent),this.prevIsInTouch=this.isInTouching;}}]),o}(si),Es={isPointerInBounds:function(t){return void 0===t?t=this:"string"==typeof t&&(t=this.getElement(t)),!!t&&is(t)},onTouching:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Os(t,n)),t._inTouching.on("intouch",e,i),this):this},offTouching:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("intouch",e,i),this},onTouchingEnd:function(t,e,i,n){return t?("function"==typeof t&&(n=i,i=e,e=t,t=this),void 0===t._inTouching&&(t._inTouching=new Os(t,n)),t._inTouching.on("touchend",e,i),this):this},offTouchingEnd:function(t,e,i){return "function"==typeof t&&(i=e,e=t,t=this),void 0===t._inTouching||t._inTouching.off("touchend",e,i),this},enableTouching:function(e,i){return e&&"object"!==t(e)&&(i=e,e=this),void 0===e._inTouching||e._inTouching.setEnable(i),this},disableTouching:function(e){return e&&"object"!==t(e)&&(e=this),void 0===e._inTouching||e._inTouching.setEnable(!1),this}},Ds=function(t,e,i){for(var n,s=0,r=t.length;s<r;s++)if(n=t[s],ns(n,e,i))return n.pointToChild(e,i);return null},Ms=function(t,e,i,n,s,r,o){var a;(a=void 0===s?n:Ds(i,n,s))&&t.emit(e,a,r,o);},Rs=Phaser.Utils.Objects.GetValue,Ls=function(t){var e=Rs(t,"down",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerdown",zs,this));},zs=function(t,e,i,n){var s=this._childrenInteractive;Ms(s.eventEmitter,"".concat(s.eventNamePrefix,"down"),s.targetSizers,t.worldX,t.worldY,t,n);},As=Phaser.Utils.Objects.GetValue,Is=function(t){var e=As(t,"up",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointerup",js,this));},js=function(t,e,i,n){var s=this._childrenInteractive;Ms(s.eventEmitter,"".concat(s.eventNamePrefix,"up"),s.targetSizers,t.worldX,t.worldY,t,n);},Xs=Phaser.Utils.Objects.GetValue,Ns=function(t){var e=Xs(t,"over",void 0);!1!==e&&(!0===e&&(e=void 0),this.on("pointermove",Vs,this).on("pointerover",Vs,this).on("pointerout",Fs,this));},Vs=function(t,e,i,n){var s=this._childrenInteractive,r=Ds(s.targetSizers,t.worldX,t.worldY),o=s.lastOverChild;r&&o&&r===o||(s.lastOverChild=r,Ms(s.eventEmitter,"".concat(s.eventNamePrefix,"out"),s.targetSizers,o,void 0,t,n),Ms(s.eventEmitter,"".concat(s.eventNamePrefix,"over"),s.targetSizers,r,void 0,t,n));},Fs=function(t,e){var i=this._childrenInteractive,n=i.lastOverChild;i.lastOverChild=null,Ms(i.eventEmitter,"".concat(i.eventNamePrefix,"out"),i.targetSizers,n,void 0,t,e);},Ys=Phaser.Utils.Objects.GetValue,Gs=function(t){var e=Ys(t,"click",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("threshold")||(e.threshold=10);var i=this._childrenInteractive;this._click=new ys(this,e),this._click.on("click",(function(t,e,n,s){Ms(i.eventEmitter,"".concat(i.eventNamePrefix,"click"),i.targetSizers,n.worldX,n.worldY,n,s);}),this);}},Us=Phaser.Utils.Objects.GetValue,Bs=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=Qe(t);return r===t&&(t=void 0),(s=i.call(this,r,n)).gameObject=t,t&&t.setInteractive(Us(n,"inputConfig",void 0)),s._enable=void 0,s.resetFromJSON(n),s.boot(),s}return n(o,[{key:"resetFromJSON",value:function(t){return this.setEnable(Us(t,"enable",!0)),this.setDetectBounds(),void 0===this.gameObject?this.setDetectBounds(Us(t,"bounds",void 0)):this.setDetectBounds(),this.tracerState=Ws,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){l(r(o.prototype),"boot",this).call(this),this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this);}},{key:"shutdown",value:function(t){this.scene&&(this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.gameObject=void 0,this.bounds=void 0,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,l(r(o.prototype),"shutdown",this).call(this,t));}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setDetectBounds",value:function(t){return this.bounds=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(t,e){this.enable&&(void 0===this.pointer&&(!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer!==t&&(this.pointer=t,this.lastPointer=t,this.movedState=!1,this.tracerState=Hs,void 0===this.gameObject&&(this.isTouchingAnyObject=e.length>0),this.onDragStart()));}},{key:"onPointerUp",value:function(t){this.enable&&((!this.bounds||this.bounds.contains(t.x,t.y))&&this.pointer===t&&(this.pointer=void 0,this.movedState=!1,this.tracerState=Ws,this.onDragEnd()));}},{key:"onPointerMove",value:function(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()));}}},{key:"dragCancel",value:function(){return this.tracerState===Hs&&this.onDragEnd(),this.pointer=void 0,this.tracerState=Ws,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this);}},{key:"onDragEnd",value:function(){this.emit("dragend",this);}},{key:"onDrag",value:function(){this.emit("drag",this);}},{key:"preUpdate",value:function(t,e){}},{key:"postUpdate",value:function(t,e){}},{key:"startTicking",value:function(){l(r(o.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this);}},{key:"stopTicking",value:function(){l(r(o.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this));}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Js,this}}]),o}(ai),Ws=0,Hs=1,Js="IDLE",qs=Phaser.Utils.Objects.GetValue,Zs=Phaser.Math.Distance.Between,Ks=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=a(s=i.call(this,t,n)),h={states:{IDLE:{enter:function(){r.stop(),r.tapsCount=0,r.x=0,r.y=0,r.worldX=0,r.worldY=0;},exit:function(){var t=r.lastPointer;r.x=t.x,r.y=t.y,r.worldX=t.worldX,r.worldY=t.worldY;}},BEGIN:{enter:function(){r.start(),r.tapsCount=0,r.emit("tappingstart",r,r.gameObject,r.lastPointer);}},RECOGNIZED:{enter:function(){r.start(),r.emit("tap",r,r.gameObject,r.lastPointer),r.emit("".concat(r.tapsCount,"tap"),r,r.gameObject,r.lastPointer);}}},init:function(){this.state=$s;},eventEmitter:!1};return s.setRecongizedStateObject(new En(h)),s}return n(o,[{key:"resetFromJSON",value:function(t){l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setHoldTime(qs(t,"time",250)),this.setTapInterval(qs(t,"tapInterval",200)),this.setDragThreshold(qs(t,"threshold",9)),this.setTapOffset(qs(t,"tapOffset",10));var e=qs(t,"taps",void 0);return void 0!==e?this.setTaps(e):(this.setMaxTaps(qs(t,"maxTaps",void 0)),this.setMinTaps(qs(t,"minTaps",void 0))),this}},{key:"onDragStart",value:function(){switch(this.state){case $s:this.state=Qs;break;case Qs:var t=this.lastPointer;Zs(t.upX,t.upY,t.x,t.y)>this.tapOffset&&(this.state=tr,this.state=Qs);break;case tr:this.state=Qs;}}},{key:"onDragEnd",value:function(){this.state===Qs&&(this.tapsCount++,this.emit("tapping",this,this.gameObject,this.lastPointer),void 0!==this.maxTaps&&this.tapsCount===this.maxTaps&&(this.state=tr));}},{key:"onDrag",value:function(){this.state!==$s&&this.pointer.getDistance()>this.dragThreshold&&(this.state=$s);}},{key:"preUpdate",value:function(t,e){if(this.isRunning&&this.enable&&this.state===Qs){var i=this.lastPointer;if(i.isDown)t-i.downTime>this.holdTime&&(this.state=$s);else t-i.upTime>this.tapInterval&&(void 0===this.minTaps||this.tapsCount>=this.minTaps?this.state=tr:this.state=$s);}}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===tr&&(this.state=$s);}},{key:"isTapped",get:function(){return this.state===tr}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setTapInterval",value:function(t){return this.tapInterval=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setTapOffset",value:function(t){return this.tapOffset=t,this}},{key:"setMaxTaps",value:function(t){return this.maxTaps=t,this}},{key:"setMinTaps",value:function(t){return this.minTaps=t,this}},{key:"setTaps",value:function(t,e){return void 0===e&&(e=t),this.setMinTaps(t).setMaxTaps(e),this}}]),o}(Bs),$s="IDLE",Qs="BEGIN",tr="RECOGNIZED",er=Phaser.Utils.Objects.GetValue,ir=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=a(s=i.call(this,t,n)),h={states:{IDLE:{enter:function(){r.x=0,r.y=0,r.worldX=0,r.worldY=0;},exit:function(){var t=r.lastPointer;r.x=t.x,r.y=t.y,r.worldX=t.worldX,r.worldY=t.worldY;}},BEGIN:{enter:function(){r.start();},exit:function(){r.stop();}},RECOGNIZED:{enter:function(){r.emit("pressstart",r,r.gameObject,r.lastPointer);},exit:function(){r.emit("pressend",r,r.gameObject,r.lastPointer);}}},init:function(){this.state=nr;},eventEmitter:!1};return s.setRecongizedStateObject(new En(h)),s}return n(o,[{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(er(t,"threshold",9)),this.setHoldTime(er(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=sr,0===this.holdTime&&(this.state=rr);}},{key:"onDragEnd",value:function(){this.state=nr;}},{key:"onDrag",value:function(){this.state!==nr&&this.pointer.getDistance()>this.dragThreshold&&(this.state=nr);}},{key:"preUpdate",value:function(t,e){this.isRunning&&this.enable&&(this.state===sr&&t-this.pointer.downTime>=this.holdTime&&(this.state=rr));}},{key:"isPressed",get:function(){return this.state===rr}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Bs),nr="IDLE",sr="BEGIN",rr="RECOGNIZED";Phaser.Utils.Objects.GetValue;var or=Phaser.Math.Distance.Between,ar=Phaser.Math.Angle.Between,hr={getDt:function(){var t;return t=this.scene,ii(t).loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return or(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return ar(e.x,e.y,t.x,t.y)}},ur={"up&down":0,"left&right":1,"4dir":2,"8dir":3},lr={},cr=Phaser.Utils.Objects.GetValue,dr=Phaser.Math.RadToDeg,vr=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=a(s=i.call(this,t,n)),h={states:{IDLE:{enter:function(){r.x=0,r.y=0,r.worldX=0,r.worldY=0;},exit:function(){var t=r.lastPointer;r.x=t.x,r.y=t.y,r.worldX=t.worldX,r.worldY=t.worldY;}},BEGIN:{enter:function(){r.validDrag=!1;}},RECOGNIZED:{enter:function(){r.start(),r.updateDirectionStates(),r.emit("swipe",r,r.gameObject,r.lastPointer);},exit:function(){r.stop(),r.clearDirectionStates();}}},init:function(){this.state=pr;},eventEmitter:!1};return s.setRecongizedStateObject(new En(h)),s.clearDirectionStates(),s}return n(o,[{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(cr(t,"threshold",10)),this.setVelocityThreshold(cr(t,"velocityThreshold",1e3)),this.setDirectionMode(cr(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=fr;}},{key:"onDragEnd",value:function(){this.state=pr;}},{key:"onDrag",value:function(){this.state===fr&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=yr));}},{key:"postUpdate",value:function(t,e){this.isRunning&&this.enable&&this.state===yr&&(this.state=pr);}},{key:"isSwiped",get:function(){return this.state===yr}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity();}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return "string"==typeof t&&(t=ur[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=lr),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:t>90&&t<=270?i.left=!0:i.right=!0;break;case 2:t>45&&t<=135?i.down=!0:t>135&&t<=225?i.left=!0:t>225&&t<=315?i.up=!0:i.right=!0;break;case 3:t>22.5&&t<=67.5?(i.down=!0,i.right=!0):t>67.5&&t<=112.5?i.down=!0:t>112.5&&t<=157.5?(i.down=!0,i.left=!0):t>157.5&&t<=202.5?i.left=!0:t>202.5&&t<=247.5?(i.left=!0,i.up=!0):t>247.5&&t<=292.5?i.up=!0:t>292.5&&t<=337.5?(i.up=!0,i.right=!0):i.right=!0;}}(dr(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}(Bs);Object.assign(vr.prototype,hr);var pr="IDLE",fr="BEGIN",yr="RECOGNIZED",gr=Phaser.Utils.Objects.GetValue,mr=Phaser.Utils.Array.SpliceOne,kr=Phaser.Math.Distance.Between,br=Phaser.Math.Angle.Between,Cr=function(){function t(i,n){e(this,t);var s=i.input.manager.pointersTotal-1;s<2&&i.input.addPointer(2-s),this.scene=i,this.setEventEmitter(gr(n,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(n),this.boot();}return n(t,[{key:"resetFromJSON",value:function(t){return this.setEnable(gr(t,"enable",!0)),this.bounds=gr(t,"bounds",void 0),this.tracerState=xr,this.pointers.length=0,Et(this.movedState),this}},{key:"boot",value:function(){this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("gameout",this.dragCancel,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this);}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,Et(this.movedState),this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("gameout",this.dragCancel,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0);}},{key:"destroy",value:function(){this.shutdown();}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.tracerState){case xr:this.tracerState=Pr,this.onDrag1Start();break;case Pr:this.tracerState=wr,this.onDrag2Start();}}},{key:"onPointerUp",value:function(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],mr(this.pointers,e),this.tracerState){case Pr:this.tracerState=xr,this.onDrag1End();break;case wr:this.tracerState=Pr,this.onDrag2End(),this.onDrag1Start();}}}},{key:"onPointerMove",value:function(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(!i&&e);else if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case Pr:this.onDrag1();break;case wr:this.onDrag2();}}}},{key:"dragCancel",value:function(){return this.tracerState===wr&&this.onDrag2End(),this.pointers.length=0,Et(this.movedState),this.tracerState=xr,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this);}},{key:"onDrag1End",value:function(){this.emit("drag1end",this);}},{key:"onDrag1",value:function(){this.emit("drag1",this);}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this);}},{key:"onDrag2End",value:function(){this.emit("drag2end",this);}},{key:"onDrag2",value:function(){this.emit("drag2",this);}},{key:"distanceBetween",get:function(){if(this.tracerState!==wr)return 0;var t=this.pointers[0],e=this.pointers[1];return kr(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==wr)return 0;var t=this.pointers[0],e=this.pointers[1];return br(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;Sr.x=e.x-i.x,Sr.y=e.y-i.y;}else Sr.x=0,Sr.y=0;return Sr}},{key:"centerX",get:function(){if(this.tracerState!==wr)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==wr)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return (t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==wr)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return (t.x+e.x)/2}},{key:"prevCenterY",get:function(){if(this.tracerState!==wr)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return (t.y+e.y)/2}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t;}},{key:"cancel",value:function(){return this.state=Tr,this}}]),t}();Object.assign(Cr.prototype,Ze);var Sr={},xr=0,Pr=1,wr=2,Tr="IDLE";Phaser.Utils.Objects.GetValue;var _r=Phaser.Math.RotateAround,Or=function(t,e,i,n){return _r(t,e,i,n),t.rotation+=n,t},Er={},Dr=Phaser.Utils.Objects.GetValue,Mr=Phaser.Math.Angle.WrapDegrees,Rr=Phaser.Math.Angle.ShortestBetween,Lr=Phaser.Math.RadToDeg,zr=Phaser.Math.DegToRad,Ar=function(t){s(o,t);var i=h(o);function o(t,n){var s;e(this,o);var r=a(s=i.call(this,t,n)),h={states:{IDLE:{enter:function(){r.prevAngle=void 0,r.angle=0;}},BEGIN:{},RECOGNIZED:{enter:function(){r.emit("rotatestart",r);},exit:function(){r.emit("rotateend",r);}}},init:function(){this.state=jr;},eventEmitter:!1};return s.setRecongizedStateObject(new En(h)),s}return n(o,[{key:"resetFromJSON",value:function(t){return l(r(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(Dr(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=Mr(Lr(this.angleBetween)),this.state=Xr,0===this.dragThreshold&&(this.state=Nr);}},{key:"onDrag2End",value:function(){this.state=jr;}},{key:"onDrag2",value:function(){switch(this.state){case Xr:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=Mr(Lr(this.angleBetween));this.angle=Rr(this.prevAngle,t),this.prevAngle=t,this.state=Nr;}break;case Nr:t=Mr(Lr(this.angleBetween));this.angle=Rr(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this);}}},{key:"isRotated",get:function(){return this.state===Nr}},{key:"rotation",get:function(){return zr(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(Cr),Ir={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i=this.movementCenterX,n=this.movementCenterY,s=function(t,e,i,n){return void 0===n?n={}:!0===n&&(n=Er),i.getWorldPoint(t,e,n),n}(this.centerX,this.centerY,e,!0),r=s.x,o=s.y,a=this.rotation;if(Array.isArray(t))for(var h=t,u=0,l=h.length;u<l;u++)(t=h[u]).x+=i,t.y+=n,Or(t,r,o,a);else t.x+=i,t.y+=n,Or(t,r,o,a);return this}};Object.assign(Ar.prototype,Ir);var jr="IDLE",Xr="BEGIN",Nr="RECOGNIZED",Vr=Phaser.Utils.Objects.GetValue,Fr=function(t){var e=Vr(t,"tap",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._tap=new Ks(this,e),this._tap.on("tap",(function(t,e,n){Ms(i.eventEmitter,"".concat(i.eventNamePrefix).concat(t.tapsCount,"tap"),i.targetSizers,t.worldX,t.worldY,n);}),this);}},Yr=Phaser.Utils.Objects.GetValue,Gr=function(t){var e=Yr(t,"press",void 0);if(!1!==e){!0===e&&(e=void 0);var i=this._childrenInteractive;this._press=new ir(this,e),this._press.on("pressstart",(function(t,e,n){Ms(i.eventEmitter,"".concat(i.eventNamePrefix,"pressstart"),i.targetSizers,t.worldX,t.worldY,n);}),this).on("pressend",(function(t,e,n){Ms(i.eventEmitter,"".concat(i.eventNamePrefix,"pressend"),i.targetSizers,t.worldX,t.worldY,n);}),this);}},Ur=Phaser.Utils.Objects.GetValue,Br=function(t){var e=Ur(t,"swipe",void 0);if(!1!==e){!0===e&&(e=void 0),void 0===e&&(e={}),e.hasOwnProperty("dir")||(e.dir="4dir");var i=this._childrenInteractive;this._swipe=new vr(this,e),this._swipe.on("swipe",(function(t,e,n){var s=t.left?"left":t.right?"right":t.up?"up":"down";Ms(i.eventEmitter,"".concat(i.eventNamePrefix,"swipe").concat(s),i.targetSizers,t.worldX,t.worldY,n);}),this);}},Wr=Phaser.Utils.Objects.GetValue,Hr=function(t,e){return t.setInteractive(),Wr(e,"dropZone",!1)&&(t.input.dropZone=!0),t._childrenInteractive={targetSizers:Wr(e,"targets",[t]),eventEmitter:Wr(e,"eventEmitter",t),eventNamePrefix:Wr(e,"inputEventPrefix","child.")},Ls.call(t,e),Is.call(t,e),Ns.call(t,e),Gs.call(t,e),Fr.call(t,e),Gr.call(t,e),Br.call(t,e),t},Jr={getSizerConfig:function(t){return void 0===t&&(t=this),Bt(t)},getChildPrevState:function(t){var e=Bt(t);return e.hasOwnProperty("prevState")||(e.prevState={}),e.prevState},pushIntoBounds:function(t){return void 0===t&&(t=Jt(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,a=t.scene;if("number"==typeof e)i=e;else {i=Se(e,"color"),n=Se(e,"lineWidth");var h=Se(e,"name",!1);h&&(s=Se(h,"createTextCallback",Pe),r=Se(h,"createTextCallbackScope",void 0),"string"==typeof(o=Se(h,"align","left-top"))&&(o=Kt[o]));}if(void 0===i&&(i=16777215),void 0===n&&(n=1),s&&!t.children){t.children=new xe(a),t.once("destroy",(function(t,e){t.children.destroy(!e),t.children=void 0;}));var u=t.clear.bind(t);t.clear=function(){u(),t.children.clear(!1,!0);};}for(var l,c,d=this.getAllShownChildren([this]),v=0,p=d.length;v<p;v++)((l=d[v]).getBounds||void 0!==l.width&&void 0!==l.height)&&(we=kt(l,we),null!=i&&t.lineStyle(n,i).strokeRectShape(we),l.name&&s&&(c=r?s.call(r,a):s(a))&&(c.setText(l.name),t.children.add(c),Ce(c,we.x,we.y,we.width,we.height,o)));return this},resolveWidth:We,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:He,postResolveSize:function(t,e){},getChildWidth:function(t){return t.isRexSizer?Math.max(t.minWidth,t.childrenWidth):void 0!==t.minWidth?t.minWidth:pt(t)},getChildHeight:function(t){return t.isRexSizer?Math.max(t.minHeight,t.childrenHeight):void 0!==t.minHeight?t.minHeight:ft(t)},getExpandedChildWidth:function(t,e){return e},getExpandedChildHeight:function(t,e){return e},getChildrenWidth:function(){return 0},getChildrenHeight:function(){return 0},addChildrenMap:Ve,addElement:Ve,removeChildrenMap:function(e){if("object"===t(e)){var i=e;for(var e in this.childrenMap)if(this.childrenMap[e]===i)return delete this.childrenMap[e],this}return delete this.childrenMap[e],this},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(Fe);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}},getChildIndex:function(t){if(Array.isArray(this.sizerChildren)){var e=this.sizerChildren.indexOf(t);return -1===e&&(e=null),e}if(this.getParentSizer(t)!==this)return null;for(var i in this.sizerChildren)if(this.sizerChildre[i]===t)return i;return 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:qe,layout:function(){var t=this.scaleX,e=this.scaleY,i=1===t&&1===e;return i||this.setScale(1),this.runLayout(),this.postLayout(),this._postLayout(),i||this.setScale(t,e),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.postResolveSize(e,i),this.resize(e,i),this.sizerEventsEnable&&void 0===this.layoutedChildren&&(this.layoutedChildren=[]),this.layoutChildren(),this.layoutBackgrounds(),this.sizerEventsEnable&&(this.emit("postlayout",this.layoutedChildren,this),this.layoutedChildren.length=0),this},layoutChildren:function(){},runWidthWrap:function(t){var e,i;for(var n in this.sizerChildren)!(e=this.sizerChildren[n])||e.isRexSizer&&e.ignoreLayout||!e.runWidthWrap||(i=this.getExpandedChildWidth(e,t),e.isRexSizer&&(i=e.resolveWidth(i)),e.runWidthWrap(i));return this},layoutBackgrounds:function(){if(void 0!==this.backgroundChildren)for(var t,e,i,n,s,r,o,a=this.backgroundChildren,h=this.left,u=this.top,l=this.width,c=this.height,d=0,v=a.length;d<v;d++)(e=(t=a[d]).rexSizer).hidden||(i=e.padding,cs.call(this,t),n=h+i.left,s=u+i.top,r=l-i.left-i.right,o=c-i.top-i.bottom,as(t,r,o),ds.call(this,t,n,s,r,o,vs));},postLayout:function(t,e,i){return this},_postLayout:function(t,e,i){return this._anchor&&this._anchor.updatePosition(),this},setAnchor:function(t){void 0===t&&(t={});var e=t.hasOwnProperty("width"),i=t.hasOwnProperty("height"),n=t.hasOwnProperty("onResizeCallback");return !e&&!i||n||(t.onResizeCallback=function(t,n,s){e&&s.setMinWidth(t),i&&s.setMinHeight(n),s.layout();}),void 0===this._anchor?this._anchor=new ri(this,t):this._anchor.resetFromJSON(t),this},isInTouching:function(t,e){return (Rt(t)||"string"==typeof t)&&(e=t,t=void 0),void 0===e?e=this:"string"==typeof e&&(e=this.getElement(e)),is(e,t)},pointToChild:function(t,e,i,n,s){var r;if(ts(i)||(s=i,i=void 0,n=void 0),void 0===s&&(s=this.sizerChildren?this.sizerChildren:this.children),r=s,"[object Array]"===Object.prototype.toString.call(r)){for(var o,a=0,h=s.length;a<h;a++)if(o=s[a],ns(o,t,e,i,n))return o}else for(var u in s)if(o=s[u],ns(o,t,e,i,n))return o;return null},setDraggable:function(e,i,n){if(ps(e)){var s=e;e=s.sensor,n=s.target,i=s.draggable;}else "boolean"!=typeof i&&(n=i,i=void 0);var r=t(e);if("string"===r){var o=e;if(!(e=this.getElement(o)))return console.error("Can get element '".concat(o,"'")),this}else void 0!==e&&"object"==r||(i=e,e=this);return void 0===i&&(i=!0),e.input&&e.input._rexUIDragSizer?e.input.draggable=i:i&&(e.setInteractive(),e.scene.input.setDraggable(e),e.on("drag",(function(t,i,s){var r=void 0===n?this.getTopmostSizer():n;r.x+=i-e.x,r.y+=s-e.y,r.emit("sizer.drag",t,i,s);}),this).on("dragstart",(function(t,e,i){(void 0===n?this.getTopmostSizer():n).emit("sizer.dragstart",t,e,i);}),this).on("dragend",(function(t,e,i,s){(void 0===n?this.getTopmostSizer():n).emit("sizer.dragend",t,e,i,s);}),this).on("drop",(function(t,e){(void 0===n?this.getTopmostSizer():n).emit("sizer.drop",t,e);})),e.input._rexUIDragSizer=!0),this},setChildrenInteractive:function(t){return Hr(this,t),this},broadcastEvent:function(){for(var t=this.getAllChildren([this]),e=0,i=t.length;e<i;e++){var n=t[e];n.emit.apply(n,arguments);}return this}};Object.assign(Jr,Be,De,Ne,Re,Ii,Hi,sn,cn,gn,ms,ws,Es,kn,es,Je);var qr=Phaser.Utils.Objects.GetValue,Zr=function(t){s(o,t);var i=h(o);function o(t,n,s,r,a,h){var u;e(this,o),(u=i.call(this,t,n,s,1,1)).isRexSizer=!0,u.setMinSize(r,a),u.setName(qr(h,"name","")),u.rexSizer={},u.space={},u.backgroundChildren=void 0,u.sizerChildren=void 0,u.childrenMap={},u.layoutedChildren=void 0,u.enableLayoutWarn();var l=qr(h,"anchor",void 0);l&&u.setAnchor(l),u.setInnerPadding(qr(h,"space",0));var c=qr(h,"draggable",!1);return c&&u.setDraggable(c),u.setSizerEventsEnable(qr(h,"sizerEvents",!1)),u.setDirty(!0),qr(h,"enableLayer",!1)&&u.enableLayer(),u}return n(o,[{key:"destroy",value:function(t){if(this.scene&&!this.ignoreDestroy){if(t)for(var e=this.getAllChildrenSizers([this]),i=0,n=e.length;i<n;i++)e[i].sizerEventsEnable=!1;l(r(o.prototype),"destroy",this).call(this,t),Et(this.backgroundChildren),Et(this.sizerChildren),this.childrenMap=void 0,this.space=void 0,this.rexSizer=void 0,this.layoutedChildren=void 0;}}},{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:"setSizerEventsEnable",value:function(t){return void 0===t&&(t=!0),this.sizerEventsEnable=t,this}},{key:"enableLayoutWarn",value:function(t){return void 0===t&&(t=!0),this.layoutWarnEnable=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-pt(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+pt(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+pt(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-ft(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+ft(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+ft(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*this.scaleX}},{key:"innerRight",get:function(){return this.right-this.space.right*this.scaleX}},{key:"innerTop",get:function(){return this.top+this.space.top*this.scaleY}},{key:"innerBottom",get:function(){return this.bottom-this.space.bottom*this.scaleY}},{key:"innerWidth",get:function(){return (this.width-this.space.left-this.space.right)*this.scaleX}},{key:"innerHeight",get:function(){return (this.height-this.space.top-this.space.bottom)*this.scaleY}},{key:"minInnerWidth",get:function(){var t=(this.minWidth-this.space.left-this.space.right)*this.scaleX;return Math.max(t,0)}},{key:"minInnerHeight",get:function(){var t=(this.minHeight-this.space.top-this.space.bottom)*this.scaleY;return Math.max(t,0)}}]),o}(Ut);Object.assign(Zr.prototype,Jr);var Kr=function(t,e){t.width<t.childrenWidth&&console.warn("Layout width error: Parent=".concat(e.constructor.name,", Child=").concat(t.constructor.name)),t.height<t.childrenHeight&&console.warn("Layout height error: Parent=".concat(e.constructor.name,", Child=").concat(t.constructor.name));},$r=Phaser.Math.Wrap,Qr=function(t){s(r,t);var i=h(r);function r(t){var n;return e(this,r),(n=i.call(this,t,0,0,1,1)).isRexSpace=!0,n}return n(r)}(Phaser.GameObjects.Zone),to=function(t,e){var i=this.sizerChildren;if(0===i.length)return -1;for(var n=-1,s=1/0,r=0,o=i.length;r<o;r++){var a=i[r];s>(h=0===this.orientation?Math.abs(a.left-t):Math.abs(a.top-e))&&(s=h,n=r);}var h;a=i[i.length-1];return s>(h=0===this.orientation?Math.abs(a.right-t):Math.abs(a.bottom-e))&&(s=h,n=r+1),n},eo=Phaser.Utils.Objects.IsPlainObject,io=Phaser.Utils.Objects.GetValue,no=Phaser.Display.Align.CENTER,so={min:0,full:-1},ro=function(e,i,n,s,r,o,a,h,u,l){Ee.call(this,e);var c=e.isRexSpace,d=t(i);if(null===i)return this;if("number"===d);else if("string"===d)i=so[i];else if(eo(i)){var v;i=io(v=i,"proportion",void 0),n=io(v,"align",no),s=io(v,"padding",0),r=io(v,"expand",!1),o=io(v,"key",void 0),a=io(v,"index",void 0),e.isRexSizer||(h=io(v,"minWidth",void 0),u=io(v,"minHeight",void 0)),l=io(v,"fitRatio",0);}return "string"==typeof n&&(n=Kt[n]),void 0===i&&(i=c?1:0),void 0===n&&(n=no),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===h&&(c?h=0:e.isRexSizer||(h=e._minWidth)),void 0===u&&(c?u=0:e.isRexSizer||(u=e._minHeight)),void 0===l&&(l=0),(v=this.getSizerConfig(e)).proportion=i,v.align=n,v.padding=_e(s),v.expand=r,v.fitRatio=0===i?l:0,void 0===a||a>=this.sizerChildren.length?this.sizerChildren.push(e):this.sizerChildren.splice(a,0,e),e.isRexSizer||(i>0&&(0===this.orientation?e.minWidth=void 0===h?pt(e):h:e.minHeight=void 0===u?ft(e):u),r&&(0===this.orientation?e.minHeight=u:e.minWidth=h)),void 0!==o&&this.addChildrenMap(o,e),this},oo={add:ro,addSpace:function(t){return this.insertSpace(void 0,t),this},insertSpace:function(t,e){return void 0===e&&(e=1),ro.call(this,new Qr(this.scene),{proportion:e,minWidth:0,minHeight:0,index:t}),this},insert:function(t,e,i,n,s,r,o,a){return eo(i)&&(i.index=t),ro.call(this,e,i,n,s,r,o,t,a),this},insertAtPosition:function(t,e,i,n,s,r,o,a,h){var u=to.call(this,t,e);return -1===u&&(u=void 0),this.insert(u,i,n,s,r,o,a,h),this}},ao=Ut.prototype.clear,ho=function(t){this.backgroundChildren&&(this.backgroundChildren.length=0);var e,i=!t&&this.sizerEventsEnable;if(i&&(e=this.getChildren([])),ao.call(this,t),i)for(var n,s=0,r=e.length;s<r;s++)(n=e[s]).emit("sizer.remove",n,this),this.emit("remove",n,this);return this},uo=Phaser.Utils.Array.Remove,lo={remove:function(t,e){return this.getParentSizer(t)!==this||(uo(this.sizerChildren,t),Ie.call(this,t,e)),this},removeAll:function(t){for(var e=this.sizerChildren.length-1;e>=0;e--)this.remove(this.sizerChildren[e],t);return this},clear:function(t){return this.sizerChildren.length=0,ho.call(this,t),this}},co={getChildAlign:function(t){return this.getSizerConfig(t).align},setChildAlign:function(t,e){return "string"==typeof e&&(e=Kt[e]),this.getSizerConfig(t).align=e,this}},vo={getChildrenWidth:function(t){if(this.rexSizer.hidden)return 0;void 0===t&&(t=!0);var e,i,n,s=0,r=this.sizerChildren;if(0===this.orientation)for(var o=this.space.item,a=!0,h=0,u=r.length;h<u;h++)(e=r[h]).rexSizer.hidden||(n=0===e.rexSizer.proportion||t?this.getChildWidth(e):0,n+=(i=e.rexSizer.padding).left+i.right,a?a=!1:n+=o,s+=n);else for(h=0,u=r.length;h<u;h++)(e=r[h]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(i=e.rexSizer.padding,n=this.getChildWidth(e)+i.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,a=r.length;o<a;o++)(e=r[o]).rexSizer.hidden||(i=e.rexSizer.padding,n=this.getChildHeight(e)+i.top+i.bottom,s=Math.max(n,s));else {var h=this.space.item,u=!0;for(o=0,a=r.length;o<a;o++)(e=r[o]).hasOwnProperty("rexSizer")&&(e.rexSizer.hidden||(n=0===e.rexSizer.proportion||t?this.getChildHeight(e):0,n+=(i=e.rexSizer.padding).top+i.bottom,u?u=!1:n+=h,s+=n));}return s+this.space.top+this.space.bottom},getExpandedChildWidth:function(t,e){var i;void 0===e&&(e=this.width);var n=t.rexSizer,s=n.padding;0===this.orientation?n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength):n.expand&&(i=e-this.space.left-this.space.right-s.left-s.right);return i},getExpandedChildHeight:function(t,e){var i;void 0===e&&(e=this.height);var n=t.rexSizer,s=n.padding;0===this.orientation?n.expand&&(i=e-this.space.top-this.space.bottom-s.top-s.bottom):n.proportion>0&&this.proportionLength>0&&(i=n.proportion*this.proportionLength);return i},getChildrenSizers:function(t){void 0===t&&(t=[]);for(var e,i=this.sizerChildren,n=0,s=i.length;n<s;n++)(e=i[n]).isRexSizer&&t.push(e);return t},preLayout:function(){this.hasRatioFitChild=!1;for(var t=this.sizerChildren,e=0,i=t.length;e<i;e++){var n=t[e];n.rexSizer.hidden||n.rexSizer.fitRatio&&(as(n,1,1),this.hasRatioFitChild=!0);}return this._childrenProportion=void 0,this.proportionLength=void 0,qe.call(this),this},postResolveSize:function(t,e){if(this.hasRatioFitChild){var i;0===this.orientation?i=e-this.getInnerPadding("top")-this.getInnerPadding("bottom"):(this.getInnerPadding("left"),this.getInnerPadding("right"));for(var n,s,r=this.sizerChildren,o=0,a=r.length;o<a;o++){var h=r[o];if(!h.rexSizer.hidden){var u=h.rexSizer.fitRatio;u&&(0===this.orientation?n=(s=i-this.getChildOuterPadding(h,"top")-this.getChildOuterPadding(h,"bottom"))*u:s=(n=i-this.getChildOuterPadding(h,"top")-this.getChildOuterPadding(h,"bottom"))/u,as(h,n,s),h.isRexSizer&&h.setMinSize(n,s));}}this.proportionLength=void 0,this._childrenWidth=void 0,this.resolveWidth(t,!0);}},layoutChildren:function(){for(var t,e,i,n,s,r,o,a,h,u,l=this.sizerChildren,c=this.innerLeft,d=this.innerTop,v=this.innerWidth,p=this.innerHeight,f=c,y=d,g=this.startChildIndex,m=0,k=l.length;m<k;m++)u=0===g?m:$r(m+g,0,k),this.rtl&&(u=k-u-1),(t=l[u]).rexSizer.hidden||(i=(e=t.rexSizer).padding,cs.call(this,t),t.isRexSpace?(a=0,h=0):(a=this.getExpandedChildWidth(t),h=this.getExpandedChildHeight(t)),t.isRexSizer?(t.runLayout(this,a,h),Kr(t,this)):as(t,a,h),void 0===a&&(a=pt(t)),void 0===h&&(h=ft(t)),0===this.orientation?(n=f+i.left,r=0===e.proportion||0===this.proportionLength?a:e.proportion*this.proportionLength,s=y+i.top,o=p-i.top-i.bottom):(n=f+i.left,r=v-i.left-i.right,s=y+i.top,o=0===e.proportion||0===this.proportionLength?h:e.proportion*this.proportionLength),ds.call(this,t,n,s,r,o,e.align),0===this.orientation?f+=r+i.left+i.right+this.space.item:y+=o+i.top+i.bottom+this.space.item);},resolveWidth:function(t){t=We.call(this,t);if(void 0===this.proportionLength&&0===this.orientation){var e=t-this.childrenWidth;e>0?(e=t-this.getChildrenWidth(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t},resolveHeight:function(t){t=He.call(this,t);if(void 0===this.proportionLength&&1===this.orientation){var e=t-this.childrenHeight;e>0?(e=t-this.getChildrenHeight(!1),this.proportionLength=e/this.childrenProportion):this.proportionLength=0;}return t}};Object.assign(vo,oo,lo,co,{getChildProportion:function(t){return this.getSizerConfig(t).proportion},setChildProportion:function(t,e){return this.getSizerConfig(t).proportion=e,this}},{getChildExpand:function(t){return this.getSizerConfig(t).expand},setChildExpand:function(t,e){return this.getSizerConfig(t).expand=e,this}});var po=function(){for(var t,e,i=0,n=this.sizerChildren,s=0,r=n.length;s<r;s++)(t=n[s]).rexSizer.hidden||(e=t.rexSizer.proportion)>0&&(i+=e);return i},fo={x:0,h:0,horizontal:0,"left-to-right":0,y:1,v:1,vertical:1,"top-to-bottom":1},yo=Phaser.Utils.Objects.IsPlainObject,go=Phaser.Utils.Objects.GetValue,mo=function(t){s(r,t);var i=h(r);function r(t,n,s,o,a,h,u){var l;return e(this,r),yo(n)?(n=go(u=n,"x",0),s=go(u,"y",0),o=go(u,"width",void 0),a=go(u,"height",void 0),h=go(u,"orientation",0)):yo(o)?(o=go(u=o,"width",void 0),a=go(u,"height",void 0),h=go(u,"orientation",0)):yo(h)&&(h=go(u=h,"orientation",0)),void 0===h&&(h=0),(l=i.call(this,t,n,s,o,a,u)).type="rexSizer",l.sizerChildren=[],l.setOrientation(h),l.setItemSpacing(go(u,"space.item",0)),l.setStartChildIndex(go(u,"startChildIndex",0)),l.setRTL(go(u,"rtl",!1)),l.addChildrenMap("items",l.sizerChildren),l}return n(r,[{key:"setOrientation",value:function(t){return this.orientation=function(t){return "string"==typeof t&&(t=fo[t]),t}(t),this}},{key:"setItemSpacing",value:function(t){return this.space.item=t,this}},{key:"setStartChildIndex",value:function(t){return this.startChildIndex=t,this}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"childrenProportion",get:function(){return void 0===this._childrenProportion&&(this._childrenProportion=po.call(this)),this._childrenProportion}}]),r}(Zr);Object.assign(mo.prototype,vo);var ko=Phaser.Renderer.WebGL.Utils,bo={renderWebGL:function(t,e,i,n){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.addToRenderList(e);var s=e.frame,r=s.width,o=s.height,a=ko.getTintAppendFloatAlpha,h=t.pipelines.set(e.pipeline,e),u=h.setTexture2D(s.glTexture,e);t.pipelines.preBatch(e),h.batchTexture(e,s.glTexture,r,o,e.x,e.y,r/e.resolution,o/e.resolution,e.scaleX,e.scaleY,e.rotation,e.flipX,e.flipY,e.scrollFactorX,e.scrollFactorY,e.displayOriginX,e.displayOriginY,0,0,r,o,a(e.tintTopLeft,i.alpha*e._alphaTL),a(e.tintTopRight,i.alpha*e._alphaTR),a(e.tintBottomLeft,i.alpha*e._alphaBL),a(e.tintBottomRight,i.alpha*e._alphaBR),e.tintFill,0,0,i,n,!1,u),t.pipelines.postBatch(e);}},renderCanvas:function(t,e,i,n){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,n));}},Co=Phaser.Display.Color,So={clear:function(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill:function(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame:function(t,e,i,n,s,r,o,a,h,u){var l=this.scene.sys.textures.getFrame(t,e);if(!l)return this;var c=l.cutWidth,d=l.cutHeight;void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=c),void 0===r&&(r=d),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=c),void 0===u&&(u=d);var v=l.cutX+o,p=l.cutY+a;return this.context.drawImage(l.source.image,v,p,h,u,i,n,s,r),this.dirty=!0,this},getDataURL:function(t,e){return this.canvas.toDataURL(t,e)},getPixel:function(t,e,i){void 0===i&&(i=new Co);var n=this.context.getImageData(t,e,1,1);return i.setTo(n.data[0],n.data[1],n.data[2],n.data[3]),i},setPixel:function(t,e,i,n,s,r){if("number"!=typeof i){var o=i;i=o.red,n=o.green,s=o.blue,r=o.alpha;}void 0===r&&(r=0!==i||0!==n||0!==s?255:0);var a=this.context.createImageData(1,1);return a.data[0]=i,a.data[1]=n,a.data[2]=s,a.data[3]=r,this.context.putImageData(a,t,e),this.dirty=!0,this}},xo={updateTexture:function(t,e){t&&(e?t.call(e,this.canvas,this.context):t(this.canvas,this.context)),this.canvas.width===this.frame.width&&this.canvas.height===this.frame.height||this.frame.setSize(this.canvas.width,this.canvas.height),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(this.canvas,this.frame.source.glTexture,!0),this.frame.glTexture=this.frame.source.glTexture),this.dirty=!1;var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=this.width,i.hitArea.height=this.height),this},generateTexture:function(t,e,i,n,s){var r=this.canvas;return void 0===n?n=r.width:n*=this.resolution,void 0===s?s=r.height:s*=this.resolution,function(t,e,i,n,s,r,o){var a,h=t.sys.textures,u=t.renderer;void 0===n&&(n=0),void 0===s&&(s=0),void 0===r&&(r=e.width),void 0===o&&(o=e.height);var l=(a=h.exists(i)?h.get(i):h.createCanvas(i,r,o)).getSourceImage();l.width!==r&&(l.width=r),l.height!==o&&(l.height=o);var c=l.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,r,o),c.drawImage(e,n,s,r,o),u.gl&&a&&u.canvasToTexture(l,a.source[0].glTexture,!0,0);}(this.scene,r,t,e,i,n,s),this},loadTexture:function(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};g();var Po=Phaser.Display.Canvas.CanvasPool,wo=function(t){s(r,t);var i=h(r);function r(t,n,s,o,h){var u;return e(this,r),void 0===n&&(n=0),void 0===s&&(s=0),void 0===o&&(o=1),void 0===h&&(h=1),(u=i.call(this,t,"rexCanvas")).renderer=t.sys.game.renderer,u.resolution=1,u._width=o,u._height=h,o=Math.max(Math.ceil(o*u.resolution),1),h=Math.max(Math.ceil(h*u.resolution),1),u.canvas=Po.create(a(u),o,h),u.context=u.canvas.getContext("2d",{willReadFrequently:!0}),u.dirty=!1,u.setPosition(n,s),u.setOrigin(.5,.5),u.initPipeline(),u.initPostPipeline(!0),u._crop=u.resetCropObject(),u.texture=t.sys.textures.addCanvas(null,u.canvas,!0),u.frame=u.texture.get(),u.frame.source.resolution=u.resolution,u.renderer&&u.renderer.gl&&(u.renderer.deleteTexture(u.frame.source.glTexture),u.frame.source.glTexture=null),u.dirty=!0,u}return n(r,[{key:"preDestroy",value:function(){Po.remove(this.canvas),this.texture.destroy(),this.canvas=null,this.context=null;}},{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height);}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t);}},{key:"setCanvasSize",value:function(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.dirty=!0),this}},{key:"setSize",value:function(t,e){return this.setCanvasSize(t,e),this}},{key:"displayWidth",get:function(){return this.scaleX*this._width},set:function(t){this.scaleX=t/this._width;}},{key:"displayHeight",get:function(){return this.scaleY*this._height},set:function(t){this.scaleY=t/this._height;}},{key:"setDisplaySize",value:function(t,e){return this.displayWidth=t,this.displayHeight=e,this}},{key:"getCanvas",value:function(t){return t||(this.dirty=!0),this.canvas}},{key:"getContext",value:function(t){return t||(this.dirty=!0),this.context}},{key:"needRedraw",value:function(){return this.dirty=!0,this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}}]),r}(Phaser.GameObjects.GameObject),To=Phaser.GameObjects.Components;Phaser.Class.mixin(wo,[To.Alpha,To.BlendMode,To.Crop,To.Depth,To.Flip,To.GetBounds,To.Mask,To.Origin,To.Pipeline,To.PostPipeline,To.ScrollFactor,To.Tint,To.Transform,To.Visible,bo,So,xo]);var _o=Phaser.Math.Linear,Oo=Phaser.Math.Percent,Eo={setValue:function(t,e,i){return null==t||(void 0!==e&&(t=Oo(t,e,i)),this.value=t),this},addValue:function(t,e,i){return void 0!==e&&(t=Oo(t,e,i)),this.value+=t,this},getValue:function(t,e){var i=this.value;return void 0!==t&&(i=_o(t,e,i)),i}},Do=Phaser.Math.Percent,Mo={setEaseValuePropName:function(t){return this.easeValuePropName=t,this},setEaseValueDuration:function(t){return this.easeValueDuration=t,this},setEaseValueFunction:function(t){return this.easeFunction=t,this},stopEaseValue:function(){return this.easeValueTask&&this.easeValueTask.stop(),this},easeValueTo:function(t,e,i){return null==t||(void 0!==e&&(t=Do(t,e,i)),void 0===this.easeValueTask&&(this.easeValueTask=new pn(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,to:t,duration:this.easeValueDuration,ease:this.easeFunction})),this},easeValueRepeat:function(t,e,i,n){return void 0===i&&(i=-1),void 0===n&&(n=0),void 0===this.easeValueTask&&(this.easeValueTask=new pn(this,{eventEmitter:null})),this.easeValueTask.restart({key:this.easeValuePropName,from:t,to:e,duration:this.easeValueDuration,ease:this.easeFunction,repeat:i,repeatDelay:n}),this}},Ro=Phaser.Utils.Objects.GetValue,Lo=Phaser.Math.Clamp;var zo=Phaser.Utils.String.Pad,Ao=function(e,i,n){if(null==e)return e;switch(t(e)){case"string":default:return e;case"number":return "#".concat(zo(Math.floor(e).toString(16),6,"0",1));case"function":return e(i,n);case"object":return e.hasOwnProperty("r")?e.hasOwnProperty("a")?"rgba(".concat(e.r,",").concat(e.g,",").concat(e.b,",").concat(e.a,")"):"rgb(".concat(e.r,",").concat(e.g,",").concat(e.b,")"):e.hasOwnProperty("h")?e.hasOwnProperty("a")?"hsla(".concat(e.h,",").concat(e.s,",").concat(e.l,",").concat(e.a,")"):"hsl(".concat(e.h,",").concat(e.s,",").concat(e.l,")"):e}},Io=function(t,e,i,n,s,r,o){void 0===o&&(o="round"),function(t,e){t.save(),t.beginPath();var i=e[0];t.moveTo(i.x,i.y);for(var n=1,s=e.length;n<s;n++)i=e[n],t.lineTo(i.x,i.y);t.closePath(),t.restore();}(e,i),e.lineJoin=o,null!=n&&(e.fillStyle=n,e.fill()),null!=s&&(e.strokeStyle=s,e.lineWidth=r,e.stroke());},jo=function(){var t,e,i=this.skewX,n=this.width-Math.abs(i),s=this.height,r=(this.canvas,this.context);if((this.trackColor||this.trackStrokeColor)&&Xo(0,0,n,s,i,this.trackPoints),this.barColor&&(this.rtl?(t=n*(1-this.value),e=n):(t=0,e=n*this.value),Xo(t,0,e,s,i,this.barPoints)),this.trackColor&&(r.save(),Io(0,r,this.trackPoints,this.trackColor),r.restore()),this.barColor){var o;if(r.save(),this.barColor2){var a;if(this.isHorizontalGradient){var h=s/2;a=r.createLinearGradient(t,h,e,h);}else {var u=n/2;a=r.createLinearGradient(u,0,u,s);}a.addColorStop(0,this.rtl?this.barColor:this.barColor2),a.addColorStop(1,this.rtl?this.barColor2:this.barColor),o=a;}else o=this.barColor;Io(0,r,this.barPoints,o),r.restore();}this.trackStrokeColor&&this.trackStrokeThickness>0&&(r.save(),Io(0,r,this.trackPoints,void 0,this.trackStrokeColor,this.trackStrokeThickness),r.restore());},Xo=function(t,e,i,n,s,r){void 0===r&&(r=[]),r.length=4;for(var o=0;o<4;o++)r[o]||(r[o]={});var a;return s>=0?((a=r[0]).x=t+s,a.y=e,(a=r[1]).x=i+s,a.y=e,(a=r[2]).x=i,a.y=n,(a=r[3]).x=t,a.y=n):((a=r[0]).x=t,a.y=e,(a=r[1]).x=i,a.y=e,(a=r[2]).x=i-s,a.y=n,(a=r[3]).x=t-s,a.y=n),r},No=Phaser.Utils.Objects.GetValue,Vo=Phaser.Utils.Objects.IsPlainObject,Fo=function(t){s(o,t);var i=h(o);function o(t,n,s,r,a,h,u,l){var c;return e(this,o),Vo(n)?(n=No(l=n,"x",0),s=No(l,"y",0),r=No(l,"width",2),a=No(l,"height",2),h=No(l,"barColor",void 0),u=No(l,"value",0)):Vo(r)?(r=No(l=r,"width",2),a=No(l,"height",2),h=No(l,"barColor",void 0),u=No(l,"value",0)):Vo(h)&&(h=No(l=h,"barColor",void 0),u=No(l,"value",0)),(c=i.call(this,t,n,s,r,a)).type="rexLineProgressCanvas",c.trackPoints=[],c.barPoints=[],c.bootProgressBase(l),c.setTrackColor(No(l,"trackColor",void 0)),c.setBarColor(h,No(l,"barColor2",void 0),No(l,"isHorizontalGradient",void 0)),c.setTrackStroke(No(l,"trackStrokeThickness",2),No(l,"trackStrokeColor",void 0)),c.setSkewX(No(l,"skewX",0)),c.setRTL(No(l,"rtl",!1)),c.setValue(u),c}return n(o,[{key:"trackColor",get:function(){return this._trackColor},set:function(t){t=Ao(t,this.canvas,this.context),this.dirty=this.dirty||this._trackColor!=t,this._trackColor=t;}},{key:"setTrackColor",value:function(t){return this.trackColor=t,this}},{key:"trackStrokeColor",get:function(){return this._trackStrokeColor},set:function(t){t=Ao(t,this.canvas,this.context),this.dirty=this.dirty||this._trackStrokeColor!=t,this._trackStrokeColor=t;}},{key:"trackStrokeThickness",get:function(){return this._trackStrokeThickness},set:function(t){this.dirty=this.dirty||this._trackStrokeThickness!=t,this._trackStrokeThickness=t;}},{key:"setTrackStroke",value:function(t,e){return this.trackStrokeThickness=t,this.trackStrokeColor=e,this}},{key:"barColor",get:function(){return this._barColor},set:function(t){t=Ao(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor!=t,this._barColor=t;}},{key:"barColor2",get:function(){return this._barColor2},set:function(t){t=Ao(t,this.canvas,this.context),this.dirty=this.dirty||this._barColor2!=t,this._barColor2=t;}},{key:"isHorizontalGradient",get:function(){return this._isHorizontalGradient},set:function(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t;}},{key:"setBarColor",value:function(t,e,i){return void 0===i&&(i=!0),this.barColor=t,this.barColor2=e,this.isHorizontalGradient=i,this}},{key:"skewX",get:function(){return this._skewX},set:function(t){this.dirty=this.dirty||this._skewX!=t,this._skewX=t;}},{key:"setSkewX",value:function(t){return this.skewX=t,this}},{key:"rtl",get:function(){return this._rtl},set:function(t){t=!!t,this.dirty=this.dirty||this._rtl!=t,this._rtl=t;}},{key:"setRTL",value:function(t){return void 0===t&&(t=!0),this.rtl=t,this}},{key:"updateTexture",value:function(){return this.clear(),jo.call(this),l(r(o.prototype),"updateTexture",this).call(this),this}}]),o}(function(t){var i=function(t){s(r,t);var i=h(r);function r(){return e(this,r),i.apply(this,arguments)}return n(r,[{key:"bootProgressBase",value:function(t){this.eventEmitter=Ro(t,"eventEmitter",this);var e=Ro(t,"valuechangeCallback",null);if(null!==e){var i=Ro(t,"valuechangeCallbackScope",void 0);this.eventEmitter.on("valuechange",e,i);}return this.setEaseValuePropName("value").setEaseValueDuration(Ro(t,"easeValue.duration",0)).setEaseValueFunction(Ro(t,"easeValue.ease","Linear")),this}},{key:"value",get:function(){return this._value},set:function(t){t=Lo(t,0,1);var e=this._value,i=e!=t;this.dirty=this.dirty||i,this._value=t,i&&this.eventEmitter.emit("valuechange",this._value,e,this.eventEmitter);}}]),r}(t);return Object.assign(i.prototype,Eo,Mo),i}(wo)),Yo=function(t,e,i,n,s){if(this.clear().fillStyle(16777215),1===this.shapeType){i=i.left;var r=Math.min(t,e)/2;this.fillCircle(-t*(n-.5),-e*(s-.5),r+i);}else this.fillRect(-t*n-i.left,-e*s-i.top,t+i.left+i.right,e+i.top+i.bottom);},Go=function(t){s(o,t);var i=h(o);function o(t,n,s){var r;return e(this,o),void 0===n&&(n=0),"string"==typeof n&&(n=Uo[n]),(r=i.call(this,t.scene)).parent=t,r.shapeType=n,r.padding=_e(s),r.setPosition().resize().setVisible(!1),r}return n(o,[{key:"destroy",value:function(){return this.parent=void 0,l(r(o.prototype),"destroy",this).call(this),this}},{key:"setPosition",value:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),l(r(o.prototype),"setPosition",this).call(this,t,e),this}},{key:"resize",value:function(t,e,i){var n=this.parent;void 0===t&&(t=n.width),void 0===e&&(e=n.height),void 0===i?i=this.padding:"number"==typeof i&&(i=_e(i));var s=this.width!==t||this.height!==e,r=this.padding!==i&&!function(t,e){for(var i in t){if(!(i in e))return !1;if(t[i]!==e[i])return !1}for(var i in e)if(!(i in t))return !1;return !0}(this.padding,i);return s||r?(this.width=t,this.height=e,r&&Dt(i,this.padding),this.originX=n.originX,this.originY=n.originY,Yo.call(this,t,e,i,n.originX,n.originY),this):this}},{key:"setOrigin",value:function(t,e){void 0===e&&(e=t);var i=this.parent;return void 0===t&&(t=i.originX),void 0===e&&(e=i.originY),this.originX===t&&this.originY===e||(this.originX=t,this.originY=e,Yo.call(this,this.width,this.height,this.padding,t,e)),this}}]),o}(Phaser.GameObjects.Graphics),Uo={rectangle:0,circle:1},Bo=function(t,e,i,n){var s=new Go(e,i,n);if(t&&!t.isRexSizer){var r=s.createGeometryMask();t.setMask(r),this.once("destroy",(function(){t.setMask(),r.destroy();}));}return this.pin(s),s},Wo=Phaser.Utils.Objects.GetValue,Ho=Phaser.Utils.Objects.IsPlainObject,Jo=function(t,e){var i=Wo(e,"background",void 0),n=Wo(e,"icon",void 0),s=Wo(e,"iconMask",void 0),r=Wo(e,"nameText",void 0),o=Wo(e,"valueText",void 0),a=Wo(e,"bar",void 0),h=Wo(e,"action",void 0),u=Wo(e,"actionMask",void 0);Ho(a)&&(a=new Fo(t,a),t.add.existing(a),r&&t.children.moveBelow(a,r),o&&t.children.moveBelow(a,o));var l=r||o||a;if(i&&this.addBackground(i),n){var c=void 0;0===this.orientation?(l||h)&&(c={right:Wo(e,"space.icon",0),top:Wo(e,"space.iconTop",0),bottom:Wo(e,"space.iconBottom",0)}):(l||h)&&(c={bottom:Wo(e,"space.icon",0),left:Wo(e,"space.iconLeft",0),right:Wo(e,"space.iconRight",0)}),this.add(n,{proportion:0,padding:c}),s&&(s=Bo.call(this,n,n,1));}if(l){var d,v=new mo(t,{orientation:1});if(r||o){if(d=new mo(t,{orientation:0}),r){""===r.text&&r.setText(" "),r.setOrigin(0,r.originY);var c={left:Wo(e,"space.name",0)};d.add(r,{padding:c});}if(o){""===o.text&&o.setText(" "),o.setOrigin(1,o.originY),d.addSpace();c={right:Wo(e,"space.value",0)};d.add(o,{padding:c}),this.setValueTextFormatCallback(Wo(e,"valueTextFormatCallback",qo),Wo(e,"valueTextFormatCallbackScope",void 0));}v.add(d,{expand:!0});}if(a){c={top:d?Wo(e,"space.bar",0):0,bottom:Wo(e,"space.barBottom",0),left:Wo(e,"space.barLeft",0),right:Wo(e,"space.barRight",0)};v.add(a,{expand:!0,padding:c});}c=void 0;h&&(c={right:Wo(e,"space.text",0)});var p=Wo(e,"align.text","bottom");this.add(v,{proportion:1,align:p,padding:c});}h&&(c=0===this.orientation?{top:Wo(e,"space.actionTop",0),bottom:Wo(e,"space.actionBottom",0)}:{left:Wo(e,"space.actionLeft",0),right:Wo(e,"space.actionRight",0)},this.add(h,{proportion:0,padding:c}),u&&(u=Bo.call(this,h,h,1)));this.addChildrenMap("background",i),this.addChildrenMap("icon",n),this.addChildrenMap("iconMask",s),this.addChildrenMap("name",r),this.addChildrenMap("value",o),this.addChildrenMap("bar",a),this.addChildrenMap("action",h),this.addChildrenMap("actionMask",u);},qo=function(t,e,i){return t.toString()},Zo=Phaser.Math.Clamp,Ko={setValueTextFormatCallback:function(t,e){return this.valueTextFormatCallback=t,this.valueTextFormatCallbackScope=e,this},getFormatValueText:function(t,e,i){return void 0===t&&(t=this.value),void 0===e&&(e=this.minValue),void 0===i&&(i=this.maxValue),this.valueTextFormatCallbackScope?this.valueTextFormatCallback(t,e,i):this.valueTextFormatCallback.call(this.valueTextFormatCallbackScope,t,e,i)},updateValueText:function(t,e,i){var n=this.childrenMap.value;return n&&this.valueTextFormatCallback&&(n.setText(this.getFormatValueText(t,e,i)),n.layout&&n.layout()),this},setValue:function(t,e,i){return t=Zo(t,e,i),this.value=t,this.minValue=e,this.maxValue=i,this.updateValueText(t,e,i),this.setBarValue(t,e,i),this}},$o=function(t){s(o,t);var i=h(o);function o(t,n){var s;return e(this,o),(s=i.call(this,t,n)).type="rexNameValueLabel",Jo.call(a(s),t,n),s}return n(o,[{key:"nameText",get:function(){var t=this.childrenMap.name;return void 0===t?"":t.text},set:function(t){var e=this.childrenMap.name;void 0!==e&&e.setText(t);}},{key:"setNameText",value:function(t){return this.nameText=t,this}},{key:"valueText",get:function(){var t=this.childrenMap.value;return void 0===t?"":t.text},set:function(t){var e=this.childrenMap.value;void 0!==e&&e.setText(t);}},{key:"setValueText",value:function(t){return this.valueText=t,this}},{key:"barValue",get:function(){var t=this.childrenMap.bar;if(void 0!==t)return t.value},set:function(t){var e=this.childrenMap.bar;void 0!==e&&e.setValue(t);}},{key:"setBarValue",value:function(t,e,i){var n=this.childrenMap.bar;return void 0===n||n.setValue(t,e,i),this}},{key:"easeBarValueTo",value:function(t,e,i){var n=this.childrenMap.bar;return void 0===n||n.easeValueTo(t,e,i),this}},{key:"setTexture",value:function(t,e){var i=this.childrenMap.icon;if(void 0!==i)return i.setTexture(t,e),this}},{key:"texture",get:function(){var t=this.childrenMap.icon;if(void 0!==t)return t.texture}},{key:"frame",get:function(){var t=this.childrenMap.icon;if(void 0!==t)return t.frame}},{key:"postLayout",value:function(t,e,i){var n=this.childrenMap.iconMask;n&&(n.setPosition(),this.resetChildPositionState(n));var s=this.childrenMap.actionMask;return s&&(s.setPosition(),this.resetChildPositionState(s)),this}},{key:"resize",value:function(t,e){l(r(o.prototype),"resize",this).call(this,t,e);var i=this.childrenMap.iconMask;i&&i.resize();var n=this.childrenMap.actionMask;return n&&n.resize(),this}}]),o}(mo);return Object.assign($o.prototype,Ko),$o}));