UNPKG

phaser3-rex-plugins

Version:
2 lines (1 loc) 30.6 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).rexcontainerliteplugin=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,p(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 r(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&&a(t,e);}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function a(t,e){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},a(t,e)}function o(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 function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function l(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=s(t);if(e){var r=s(this).constructor;i=Reflect.construct(n,arguments,r);}else i=n.apply(this,arguments);return o(this,i)}}function h(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var n=h(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?t:i):r.value}},c.apply(this,arguments)}function u(t,e,i,n){return u="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,i,n){var r,s=h(t,e);if(s){if((r=Object.getOwnPropertyDescriptor(s,e)).set)return r.set.call(n,i),!0;if(!r.writable)return !1}if(r=Object.getOwnPropertyDescriptor(n,e)){if(!r.writable)return !1;r.value=i,Object.defineProperty(n,e,r);}else !function(t,e,i){(e=p(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i;}(n,e,i);return !0},u(t,e,i,n)}function d(t,e,i,n,r){if(!u(t,e,i,n||t)&&r)throw new TypeError("failed to set property");return i}function f(t){return function(t){if(Array.isArray(t))return y(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 y(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 y(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 y(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 p(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 v,g=!1;g||(void 0===v&&(v=60),parseInt(Phaser.VERSION.match(/\.(\d+)\./)[1])<v&&console.error("Minimum supported version : 3.".concat(v)),g=!0);var C=Phaser.GameObjects.Zone,b=Phaser.Utils.Array.Add,m=Phaser.Utils.Array.Remove,P=function(t){r(a,t);var i=l(a);function a(t,n,r,s,o){var l;return e(this,a),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===o&&(o=1),(l=i.call(this,t,n,r,s,o)).children=[],l}return n(a,[{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),c(s(a.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 b(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e);}),this),this}},{key:"remove",value:function(t,e){var i=this;return m(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}}]),a}(C),x=Phaser.GameObjects.Components;Phaser.Class.mixin(P,[x.Alpha,x.Flip]);var S,A=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},L=Phaser.Math.DegToRad,k=Phaser.Math.RadToDeg,w=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 k(this.rotation)},set:function(t){this.rotation=L(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},R={setParent:function(t,e){void 0===e&&(e=this);var i=w(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),A(t,e)},getTopmostParent:function(t){return void 0===t&&(t=this),function(t){for(var e=A(t);e;)t=e,e=A(e);return t}(t)}},O=Phaser.Utils.Objects.GetValue,T=P.prototype.add,j=function(t,e){this.setParent(t);var i=w(t);return _(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t),T.call(this,t),this.addToParentContainer(t),this.addToRenderLayer(t),this},F=function(t,e){this.setParent(t);var i=w(t);return _(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),T.call(this,t),this.addToRenderLayer(t),this},_=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=O(e,"syncPosition",!0),t.syncRotation=O(e,"syncRotation",!0),t.syncScale=O(e,"syncScale",!0),t.syncAlpha=O(e,"syncAlpha",!0),t.syncScrollFactor=O(e,"syncScrollFactor",!0));},X={add:function(t){return Array.isArray(t)?this.addMultiple(t):j.call(this,t),this},pin:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):j.call(this,t,e),this},addMultiple:function(t){for(var e=0,i=t.length;e<i;e++)j.call(this,t[e]);return this},addLocal:function(t){return Array.isArray(t)?this.addMultiple(t):F.call(this,t),this},pinLocal:function(t,e){return Array.isArray(t)?this.addMultiple(t,e):F.call(this,t,e),this},addLocalMultiple:function(t){for(var e=0,i=t.length;e<i;e++)F.call(this,t[e]);return this}},Y=P.prototype.remove,M=P.prototype.clear,E={remove:function(t,e){return A(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),Y.call(this,t,e)),this},unpin:function(t,e){return A(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),Y.call(this,t,e)),this},clear:function(t){for(var e=this.children,i=0,n=e.length;i<n;i++){var r=e[i];this.setParent(r,null),t||this.removeFromRenderLayer(r);}return M.call(this,t),this}},V={getLocalState:function(t){return w(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}},D=Phaser.Math.RotateAround,G={worldToLocal:function(t){return t.x-=this.x,t.y-=this.y,D(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,D(t,0,0,this.rotation),t.x+=this.x,t.y+=this.y,t}},B=function(t,e){return t===e?1:t/e},U={updateChildPosition:function(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=w(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=w(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=B(t.scaleX,i.scaleX),e.scaleY=B(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=w(t);return n.x=e,n.y=i,this.updateChildPosition(t),this},resetLocalPositionState:function(){var t=w(this).parent;return t&&t.resetChildPositionState(this),this}},W=Phaser.Math.DegToRad,I={updateChildRotation:function(t){var e=w(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=w(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 w(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle:function(t,e){return w(t).rotation=W(e),this.updateChildRotation(t),this},resetLocalRotationState:function(){var t=w(this).parent;return t&&t.resetChildRotationState(this),this}},z={updateChildScale:function(t){var e=w(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=w(t),i=e.parent;return e.scaleX=B(t.scaleX,i.scaleX),e.scaleY=B(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=w(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=w(this).parent;return t&&t.resetChildScaleState(this),this}},H={updateChildVisible:function(t){var e=w(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=w(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),w(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible:function(t,e){return void 0===e&&(e=!0),w(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState:function(){var t=w(this).parent;return t&&t.resetChildVisibleState(this),this}},N={updateChildAlpha:function(t){var e=w(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=w(t),i=e.parent;return e.alpha=B(t.alpha,i.alpha),this},setChildAlpha:function(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha:function(t,e){return w(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState:function(){var t=w(this).parent;return t&&t.resetChildAlphaState(this),this}},Z={updateChildActive:function(t){var e=w(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 w(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),w(t).active=e,this.updateChildActive(t),this},resetLocalActiveState:function(){var t=w(this).parent;return t&&t.resetChildActiveState(this),this}},$={updateChildScrollFactor:function(t){var e=w(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}},q={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}},J=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},K={setDepth:function(t,e){if(this.depth=t,!e&&this.children)for(var i=this.getAllChildren(),n=0,r=i.length;n<r;n++)i[n].depth=t;return this},swapDepth:function(t){var e=this.depth,i=t.depth;return this.setDepth(i),t.setDepth(e),this},incDepth:function(t){if(this.depth+=t,this.children)for(var e=this.getAllChildren(),i=0,n=e.length;i<n;i++)e[i].depth+=t;return this},bringToTop:function(){var t=this.displayList,e=this.getAllChildren([this]);J(e,!1);for(var i=0,n=e.length;i<n;i++){var r=e[i];t.exists(r)&&t.bringToTop(r);}return this},moveDepthBelow:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);J(i,!1);for(var n=0,r=i.length;n<r;n++){var s=i[n];if(e.exists(s)){e.moveBelow(t,s);break}}return this},moveDepthAbove:function(t){var e=this.displayList;if(t.displayList!==e)return this;var i=this.getAllChildren([this]);J(i,!0);for(var n=0,r=i.length;n<r;n++){var s=i[n];if(e.exists(s)){e.moveAbove(t,s);break}}return this},bringChildToTop:function(t){var e=this.getAllChildren([this]);J(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]);J(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,r=0,s=n.length;r<s;r++)t(n[r],i);},tt=function(t,e){for(var i=[t];i.length>0;){var n=i.shift();!e(n)&&n.isRexContainerLite&&i.push.apply(i,f(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=A(t);return !!e&&(e===this||this.contains(e))},getByName:function(t,e){if(e){for(var i,n,r=[this];r.length;)for(var s=0,a=(i=r.shift()).children.length;s<a;s++){if((n=i.children[s]).name===t)return n;n.isRexContainerLite&&r.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 r=t[i];r.hasOwnProperty("rexContainer")&&e.push(r.rexContainer);}return e},rt=function(t,e,i){if(i.parent){var n=i.parent,r=i.self;switch(e){case"x":case"y":n.updateChildPosition(r);break;case"angle":case"rotation":n.updateChildRotation(r);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":n.updateChildScale(r);break;case"alpha":n.updateChildAlpha(r);break;default:n.updateChildPosition(r),n.updateChildRotation(r),n.updateChildScale(r),n.updateChildAlpha(r);}}else t.remove();},st={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",rt),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),rt(t,void 0,e);},t},tween:function(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}},at=Phaser.GameObjects.Container,ot=Phaser.GameObjects.Layer,lt=function(t){return t instanceof ot},ht=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return !!t.displayList||!!t.parentContainer}))},ct=function(t){var e=ht(this);return J(e),t.add(e),this},ut=function(t,e,i){var n=ht(this);return J(n,e),t.remove(n),i&&n.forEach((function(t){t.addToDisplayList();})),this},dt={addToContainer:function(t){return t instanceof at?(this._setParentContainerFlag=!0,ct.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer:function(t){return lt(t)?(ct.call(this,t),this):this},removeFromContainer:function(){return this.parentContainer?(this._setParentContainerFlag=!0,ut.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer:function(t){return void 0===t&&(t=!0),lt(this.displayList)?(ut.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}},ft={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),w(t).layer=e,this):this},removeFromRenderLayer:function(t){var e=w(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},yt=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},pt=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height},vt=Phaser.Geom.Rectangle,gt=Phaser.Math.Vector2,Ct=Phaser.Math.RotateAround,bt=function(t,e){if(void 0===e?e=new vt:!0===e&&(void 0===mt&&(mt=new vt),e=mt),t.getBounds)return t.getBounds(e);var i,n,r,s,a,o,l,h;if(t.parentContainer){var c=t.parentContainer.getBoundsTransformMatrix();Pt(t,e),c.transformPoint(e.x,e.y,e),i=e.x,n=e.y,xt(t,e),c.transformPoint(e.x,e.y,e),r=e.x,s=e.y,St(t,e),c.transformPoint(e.x,e.y,e),a=e.x,o=e.y,At(t,e),c.transformPoint(e.x,e.y,e),l=e.x,h=e.y;}else Pt(t,e),i=e.x,n=e.y,xt(t,e),r=e.x,s=e.y,St(t,e),a=e.x,o=e.y,At(t,e),l=e.x,h=e.y;return e.x=Math.min(i,r,a,l),e.y=Math.min(n,s,o,h),e.width=Math.max(i,r,a,l)-e.x,e.height=Math.max(n,s,o,h)-e.y,e},mt=void 0,Pt=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===Lt&&(Lt=new gt),e=Lt),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-yt(t)*t.originX,e.y=t.y-pt(t)*t.originY,kt(t,e,i))},xt=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===Lt&&(Lt=new gt),e=Lt),t.getTopRight?t.getTopRight(e):(e.x=t.x-yt(t)*t.originX+yt(t),e.y=t.y-pt(t)*t.originY,kt(t,e,i))},St=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===Lt&&(Lt=new gt),e=Lt),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-yt(t)*t.originX,e.y=t.y-pt(t)*t.originY+pt(t),kt(t,e,i))},At=function(t,e,i){return void 0===e?e=new gt:!0===e&&(void 0===Lt&&(Lt=new gt),e=Lt),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-yt(t)*t.originX+yt(t),e.y=t.y-pt(t)*t.originY+pt(t),kt(t,e,i))},Lt=void 0,kt=function(t,e,i){(void 0===i&&(i=!1),0!==t.rotation&&Ct(e,t.x,t.y,t.rotation),i&&t.parentContainer)&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e);return e},wt=Phaser.Geom.Rectangle,Rt=Phaser.Geom.Rectangle.Union,Ot=function(e,i){var n=Array.isArray(e);if(void 0===i?i=n?[]:{}: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];}(i),n){i.length=e.length;for(var r=0,s=e.length;r<s;r++)i[r]=e[r];}else for(var a in e)i[a]=e[a];return i},Tt=Phaser.GameObjects.GameObject,jt=Phaser.Utils.Objects.GetValue,Ft=Phaser.Textures.DynamicTexture,_t=Phaser.Utils.String.UUID,Xt=function(t){if(t){var e,i,n=t.gameObjects,r=t.renderTexture,s=jt(t,"x",void 0),a=jt(t,"y",void 0),o=jt(t,"width",void 0),l=jt(t,"height",void 0),h=jt(t,"originX",0),c=jt(t,"originY",0),u=jt(t,"padding",0);if(void 0===o||void 0===l||void 0===s||void 0===a){var d=function(t,e){var i;void 0===e?e=new wt:!0===e&&(void 0===S&&(S=new wt),e=S),e.setTo(0,0,0,0);for(var n=!0,r=0,s=t.length;r<s;r++)if((i=t[r]).getBounds){var a=bt(i,!0);n?(e.setTo(a.x,a.y,a.width,a.height),n=!1):Rt(a,e,e);}return e}(n,!0);void 0!==s&&void 0!==a?(o=2*Math.max(s-d.left,d.right-s),l=2*Math.max(a-d.top,d.bottom-a),h=.5,c=.5):(s=d.x,a=d.y,o=d.width,l=d.height,h=0,c=0),e=d.x,i=d.y;}else e=s+(0-h)*o,i=a+(0-c)*l;e-=u,i-=u,o+=2*u,l+=2*u;var f=n[0].scene;y&&!r&&(r=new Ft(f.sys.textures,_t(),o,l)),r||(r=f.add.renderTexture(0,0,o,l)),r.setPosition&&r.setPosition(s,a),r.width===o&&r.height===l||r.setSize(o,l),r.setOrigin&&r.setOrigin(h,c),r.camera.setScroll(e,i),n=J(Ot(n)),r.draw(n);var y=t.saveTexture;if(y)if(r instanceof Tt)r.saveTexture(y);else {var p=r,v=p.manager;v.exists(p.key)?v.renameTexture(p.key,key):(p.key=key,v.list[key]=p,v.emit("addtexture",key,p),v.emit("addtexture-".concat(key),p));}return r}},Yt={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 r=Xt(t),s=!!r.scene;return n||(this.setScale(e,i),s&&r.setScale(e,i)),s?r:this}},Mt=Phaser.Utils.Objects.GetValue,Et=function(t,e,i,n,r,s,a){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===n&&(n=1),void 0===r&&(r=null),void 0===s&&(s=1),void 0===a&&(a=0);var o=Pt(t,Vt[0]);o.x-=a,o.y-=a;var l=xt(t,Vt[1]);l.x+=a,l.y-=a;var h=At(t,Vt[2]);h.x+=a,h.y+=a;var c=St(t,Vt[3]);c.x-=a,c.y+=a,null!==r&&e.fillStyle(r,s).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}],Dt=Phaser.Utils.Objects.GetValue,Gt=Phaser.Math.RotateAround,Bt={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};Gt(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,r=i.length;n<r;n++)this.resetChildPositionState(i[n]);return this},drawBounds:function(t,e){var i=Dt(e,"drawContainer",!0),n=Dt(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,r,s,a,o;if("number"==typeof i?n=i:(n=Mt(i,"color"),r=Mt(i,"lineWidth"),s=Mt(i,"fillColor"),a=Mt(i,"fillAlpha",1),o=Mt(i,"padding",0)),Array.isArray(t))for(var l=0,h=t.length;l<h;l++)Et(t[l],e,n,r,s,a,o);else Et(t,e,n,r,s,a,o);}(n,t,e),this}};Object.assign(Bt,R,X,E,V,G,U,I,z,H,N,Z,$,q,K,it,st,dt,ft,Yt);var Ut=function(t){r(a,t);var i=l(a);function a(t,n,r,s,o,l){var h;return e(this,a),Array.isArray(s)&&(l=s,s=void 0,o=void 0),(h=i.call(this,t,n,r,s,o)).type="rexContainerLite",h.isRexContainerLite=!0,h.syncChildrenEnable=!0,h._active=!0,h._mask=null,h._scrollFactorX=1,h._scrollFactorY=1,h.privateRenderLayer=void 0,l&&h.add(l),h}return n(a,[{key:"destroy",value:function(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,c(s(a.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 c(s(a.prototype),"rotation",this)},set:function(t){this.rotation!==t&&(d(s(a.prototype),"rotation",t,this,!0),this.syncPosition());}},{key:"scaleX",get:function(){return c(s(a.prototype),"scaleX",this)},set:function(t){this.scaleX!==t&&(d(s(a.prototype),"scaleX",t,this,!0),this.syncPosition());}},{key:"scaleY",get:function(){return c(s(a.prototype),"scaleY",this)},set:function(t){this.scaleY!==t&&(d(s(a.prototype),"scaleY",t,this,!0),this.syncPosition());}},{key:"scale",get:function(){return c(s(a.prototype),"scale",this)},set:function(t){this.scale!==t&&(d(s(a.prototype),"scale",t,this,!0),this.syncPosition());}},{key:"visible",get:function(){return c(s(a.prototype),"visible",this)},set:function(t){c(s(a.prototype),"visible",this)!==t&&(d(s(a.prototype),"visible",t,this,!0),this.syncVisible());}},{key:"alpha",get:function(){return c(s(a.prototype),"alpha",this)},set:function(t){c(s(a.prototype),"alpha",this)!==t&&(d(s(a.prototype),"alpha",t,this,!0),this.syncAlpha());}},{key:"active",get:function(){return this._active},set:function(t){this._active!==t&&(this._active=t,this.syncActive());}},{key:"mask",get:function(){return this._mask},set:function(t){this._mask!==t&&(this._mask=t,this.syncMask());}},{key:"scrollFactorX",get:function(){return this._scrollFactorX},set:function(t){this._scrollFactorX!==t&&(this._scrollFactorX=t,this.syncScrollFactor());}},{key:"scrollFactorY",get:function(){return this._scrollFactorY},set:function(t){this._scrollFactorY!==t&&(this._scrollFactorY=t,this.syncScrollFactor());}},{key:"list",get:function(){return this.children}},{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=A(this);return !!t&&t.setParentContainerFlag}}],[{key:"GetParent",value:function(t){return A(t)}}]),a}(P);function Wt(t,e,i,n,r){var s=new Ut(this.scene,t,e,i,n,r);return this.scene.add.existing(s),s}Object.assign(Ut.prototype,Bt);var It=Phaser.Utils.Objects.GetAdvancedValue,zt=Phaser.Utils.Objects.GetValue,Ht=Phaser.GameObjects.BuildGameObject;function Nt(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=It(t,"width",1),n=It(t,"height",i),r=zt(t,"children",void 0),s=new Ut(this.scene,0,0,i,n);return s.syncChildrenEnable=!1,Ht(this.scene,s,t),s.syncChildrenEnable=!0,s.add(r),s}var Zt=function(t){return null==t||""===t||0===t.length},$t=function(t){r(s,Phaser.Plugins.BasePlugin);var i=l(s);function s(t){var n;return e(this,s),n=i.call(this,t),t.registerGameObject("rexContainerLite",Wt,Nt),n}return n(s,[{key:"start",value:function(){this.game.events.on("destroy",this.destroy,this);}},{key:"getParent",value:function(t){return Ut.GetParent(t)}}]),s}();return function(e,i,n,r){if(void 0===r&&(r="."),"object"===t(e)){if(Zt(i)){if(null==n)return;"object"===t(n)&&(e=n);}else {"string"==typeof i&&(i=i.split(r));var s=i.pop(),a=function(e,i,n){var r=e;if(Zt(i));else {var s;"string"==typeof i&&(i=i.split("."));for(var a=0,o=i.length;a<o;a++){var l;null!=r[s=i[a]]&&"object"===t(r[s])||(l=a===o-1?void 0===n?{}:n:{},r[s]=l),r=r[s];}}return r}(e,i);a[s]=n;}}}(window,"RexPlugins.GameObjects.ContainerLite",Ut),$t}));