UNPKG

phaser3-rex-plugins

Version:
1 lines 56.7 kB
var t,e;t=void 0,e=function(){var t=!1,e={renderWebGL:function(t,e,i){if(i.addToRenderList(e),e.layerRendererEnable){var s=e.rendererLayer;if(s){var r=s.list,n=r.length;if(0!==n){s.depthSort(),t.pipelines.preBatch(e);var l=-1!==e.blendMode;l||t.setBlendMode(0);for(var a=0;a<n;a++){var h=r[a];if(h.willRender(i)){l||h.blendMode===t.currentBlendMode||t.setBlendMode(h.blendMode);var o=h.mask;o&&o.preRenderWebGL(t,h,i);var d=h.type;d!==t.currentType&&(t.newType=!0,t.currentType=d),t.nextTypeMatch=a<n-1&&r[a+1].type===t.currentType,h.renderWebGL(t,h,i),o&&o.postRenderWebGL(t,i),t.newType=!1}}t.pipelines.postBatch(e)}}}},renderCanvas:function(t,e,i){if(i.addToRenderList(e),e.layerRendererEnable){var s=e.rendererLayer;if(s){var r=s.list;if(0!==r.length){s.depthSort();var n=-1!==e.blendMode;n||t.setBlendMode(0),e.mask&&e.mask.preRenderCanvas(t,null,i);for(var l=0;l<r.length;l++){var a=r[l];a.willRender(i)&&(n||a.blendMode===t.currentBlendMode||t.setBlendMode(a.blendMode),a.renderCanvas(t,a,i))}e.mask&&e.mask.postRenderCanvas(t)}}}}};const i=Phaser.Structs.List,s=Phaser.Utils.Array.StableSort,r=Phaser.GameObjects.Events,n=Phaser.Scenes.Events;class l extends i{constructor(t){super(t.scene),this.parent=t,this.scene=t.scene,this.events=this.scene.sys.events,this.active=!1,this.sortChildrenFlag=!1,this.addCallback=this.addChildCallback,this.removeCallback=this.removeChildCallback}addChildCallback(t){var e=t.displayList;e&&e!==this&&t.removeFromDisplayList(),t.parentContainer&&t.parentContainer.remove(t),t.displayList||(this.queueDepthSort(),t.displayList=this,t.emit(r.ADDED_TO_SCENE,t,this.scene),this.events.emit(n.ADDED_TO_SCENE,t,this.scene))}removeChildCallback(t){this.queueDepthSort(),t.displayList===this&&(t.displayList=null),t.emit(r.REMOVED_FROM_SCENE,t,this.scene),this.events.emit(n.REMOVED_FROM_SCENE,t,this.scene)}queueDepthSort(){return this.sortChildrenFlag=!0,this}depthSort(){return!this.sortChildrenFlag||this.list.length<2?(this.sortChildrenFlag=!1,this):(s(this.list,this.sortByDepth),this.sortChildrenFlag=!1,this)}sortByDepth(t,e){return t._depth-e._depth}}!function(e){if(!t){void 0===e&&(e=60);var i=Phaser.VERSION.split("."),s=parseInt(i[0]);if(3===s){var r=parseInt(i[1]);r<e&&console.error(`Minimum supported version : ${s}.${r}`)}else console.error(`Can't supported version : ${s}`);t=!0}}();const a=Phaser.GameObjects.Zone,h=Phaser.Utils.Array.Add,o=Phaser.Utils.Array.Remove;class d extends a{constructor(t,e,i,s,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),super(t,e,i,s,r),this.children=[],this.layerRendererEnable=!1,this.rendererLayer=void 0}destroy(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.displayList!==this.rendererLayer||e.destroy(t);this.clear(!t),super.destroy(t),this.rendererLayer=void 0}}contains(t){return-1!==this.children.indexOf(t)}add(t){return h(this.children,t,0,(function(t){t.once("destroy",this.onChildDestroy,this),this.addChildCallback(t)}),this),this}remove(t,e){return o(this.children,t,(function(t){t.off("destroy",this.onChildDestroy,this),this.removeChildCallback(t,e),e&&t.destroy()}),this),this}addChildCallback(t){var e=this.rendererLayer;e&&e.add(t)}removeChildCallback(t,e){var i=this.rendererLayer;i&&i.remove(t)}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=this.children.slice(),s=0,r=i.length;s<r;s++)(e=i[s])&&(e.off("destroy",this.onChildDestroy,this),this.removeChildCallback(e,t),t&&e.destroy());return this.children.length=0,this}enableLayerRenderer(){if(this.layerRendererEnable)return this;this.layerRendererEnable=!0;var t=new l(this);this.rendererLayer=t;for(var e=0,i=this.children.length;e<i;e++)this.addChildCallback(this.children[e]);return t.queueDepthSort(),this}}const c=Phaser.GameObjects.Components;Phaser.Class.mixin(d,[c.Alpha,c.Flip]),Object.assign(d.prototype,e);var u=function(t,e){var i;if(void 0===e)t.hasOwnProperty("rexContainer")&&(i=t.rexContainer.parent);else for(i=u(t);i&&i.name!==e;)i=u(i);return i};const C=Phaser.Math.DegToRad,v=Phaser.Math.RadToDeg;var p=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,syncScrollFactor:!0,syncCameraFilter:!0,syncDisplayList:!0,visible:!0,active:!0};Object.defineProperty(e,"angle",{get:function(){return v(this.rotation)},set:function(t){this.rotation=C(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},g={setParent(t,e){void 0===e&&(e=this);var i=p(t);return e?(i.parent=e,i.self=t):(i.parent=null,i.self=null),this},getParent(t,e){return"string"==typeof t&&(e=t,t=void 0),void 0===t&&(t=this),u(t,e)},getTopmostParent(t){return void 0===t&&(t=this),function(t){for(var e=u(t);e;)t=e,e=u(e);return t}(t)}};const f=Phaser.Utils.Objects.GetValue,y=d.prototype.add;var b=function(t,e){this.setParent(t);var i=p(t);return x(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t).updateCameraFilter(t),y.call(this,t),T.call(this,t,i),this},m=function(t,e){this.setParent(t);var i=p(t);return x(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),y.call(this,t),T.call(this,t,i),this},x=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.syncCameraFilter=e,t.syncDisplayList=e):(t.syncPosition=f(e,"syncPosition",!0),t.syncRotation=f(e,"syncRotation",!0),t.syncScale=f(e,"syncScale",!0),t.syncAlpha=f(e,"syncAlpha",!0),t.syncScrollFactor=f(e,"syncScrollFactor",!0),t.syncCameraFilter=f(e,"syncCameraFilter",!0),t.syncDisplayList=f(e,"syncDisplayList",!0))},T=function(t,e){this.addToParentContainer(t),e.syncDisplayList&&this.addToPatentLayer(t)},M={add(t){return Array.isArray(t)?this.addMultiple(t):b.call(this,t),this},pin(t,e){return Array.isArray(t)?this.addMultiple(t,e):b.call(this,t,e),this},addMultiple(t){for(var e=Array.from(arguments),i=0,s=t.length;i<s;i++)e[0]=t[i],this.add.apply(this,e);return this},addLocal(t){return Array.isArray(t)?this.addMultiple(t):m.call(this,t),this},pinLocal(t,e){return Array.isArray(t)?this.addMultiple(t,e):m.call(this,t,e),this},addLocalMultiple(t){for(var e=0,i=t.length;e<i;e++)m.call(this,t[e]);return this}};const P=d.prototype.remove,O=d.prototype.clear;var R={remove(t,e){return u(t)!==this||(this.setParent(t,null),P.call(this,t,e)),this},unpin(t,e){return u(t)!==this||(this.setParent(t,null),P.call(this,t,e)),this},clear(t){for(var e=this.children,i=0,s=e.length;i<s;i++){var r=e[i];this.setParent(r,null)}return O.call(this,t),this}},S={getLocalState:t=>p(t),resetChildState(t){return this.resetChildPositionState(t).resetChildVisibleState(t).resetChildAlphaState(t).resetChildActiveState(t),this},resetChildrenState(t){for(var e=0,i=t.length;e<i;e++)this.resetChildState(t[e]);return this},syncProperties(){return this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask(),this}},L={worldToLocal(t){t.x-=this.x,t.y-=this.y;var e=Math.cos(-this.rotation),i=Math.sin(-this.rotation),s=t.x,r=t.y;return t.x=s*e-r*i,t.y=s*i+r*e,t.x/=this.scaleX,t.y/=this.scaleY,t},localToWorld(t){t.x*=this.scaleX,t.y*=this.scaleY;var e=Math.cos(this.rotation),i=Math.sin(this.rotation),s=t.x,r=t.y;return t.x=s*e-r*i,t.y=s*i+r*e,t.x+=this.x,t.y+=this.y,t}},k=function(t,e){return t===e?1:t/e},w={updateChildPosition(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=p(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(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildPosition,this),this},resetChildPositionState(t){var e=p(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),e.rotation=t.rotation-i.rotation,this},setChildPosition(t,e,i){return t.x=e,t.y=i,this.resetChildPositionState(t),this},setChildLocalPosition(t,e,i){var s=p(t);return s.x=e,s.y=i,this.updateChildPosition(t),this},resetLocalPositionState(){var t=p(this).parent;return t&&t.resetChildPositionState(this),this},getChildLocalX:t=>p(t).x,getChildLocalY:t=>p(t).y};const A=Phaser.Math.DegToRad;var Y={updateChildRotation(t){var e=p(t),i=e.parent;return e.syncRotation&&(t.rotation=i.rotation+e.rotation),this},syncRotation(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildRotation,this),this},resetChildRotationState(t){var e=p(t),i=e.parent;return e.rotation=t.rotation-i.rotation,this},setChildRotation(t,e){return t.rotation=e,this.resetChildRotationState(t),this},setChildAngle(t,e){return t.angle=e,this.resetChildRotationState(t),this},setChildLocalRotation(t,e){return p(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return p(t).rotation=A(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=p(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>p(t).rotation},X={updateChildScale(t){var e=p(t),i=e.parent;return e.syncScale&&(t.scaleX=i.scaleX*e.scaleX,t.scaleY=i.scaleY*e.scaleY),this},syncScale(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScale,this),this},resetChildScaleState(t){var e=p(t),i=e.parent;return e.scaleX=k(t.scaleX,i.scaleX),e.scaleY=k(t.scaleY,i.scaleY),this},setChildScale(t,e,i){return void 0===i&&(i=e),t.scaleX=e,t.scaleY=i,this.resetChildScaleState(t),this},setChildScaleX(t,e){return t.scaleX=e,this.resetChildScaleState(t),this},setChildScaleY(t,e){return t.scaleY=e,this.resetChildScaleState(t),this},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=p(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildLocalScaleX(t,e){return p(t).scaleX=e,this.updateChildScale(t),this},setChildLocalScaleY(t,e){return p(t).scaleY=e,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=p(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>p(t).scaleX,getChildLocalScaleY:t=>p(t).scaleY},E={updateChildVisible(t){var e=p(t),i=e.parent,s=!e.hasOwnProperty("maskVisible")||e.maskVisible,r=!i||i.visible;return t.visible=r&&e.visible&&s,this},syncVisible(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildVisible,this),this},resetChildVisibleState(t){var e=p(t);return e.hasOwnProperty("maskVisible")&&delete e.maskVisible,e.visible=t.visible,this},setChildVisible(t,e){return this.setChildLocalVisible(t,e),this},setChildLocalVisible(t,e){return void 0===e&&(e=!0),p(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),p(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=p(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>p(t).visible},H={updateChildAlpha(t){var e=p(t),i=e.parent;return e.syncAlpha&&(t.alpha=i.alpha*e.alpha),this},syncAlpha(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildAlpha,this),this},resetChildAlphaState(t){var e=p(t),i=e.parent;return e.alpha=k(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return p(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=p(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>p(t).alpha},F={updateChildActive(t){var e=p(t),i=e.parent;return t.active=i.active&&e.active,this},syncActive(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildActive,this),this},resetChildActiveState(t){return p(t).active=t.active,this},setChildActive(t,e){return t.active=e,this.resetChildActiveState(t),this},setChildLocalActive(t,e){return void 0===e&&(e=!0),p(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=p(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>p(t).active},_={updateChildScrollFactor(t){var e=p(t),i=e.parent;return e.syncScrollFactor&&(t.scrollFactorX=i.scrollFactorX,t.scrollFactorY=i.scrollFactorY),this},syncScrollFactor(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildScrollFactor,this),this}},V={updateCameraFilter(t){var e=p(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},D={updateChildMask(t){return null==this.mask||(this.mask.hasOwnProperty("geometryMask")?this.mask.geometryMask:this.mask.bitmapMask)!==t&&(t.mask=this.mask),this},syncMask(){return this.syncChildrenEnable&&this.children.forEach(this.updateChildMask,this),this},setMask(t){return this.mask=t,this},clearChildrenMask(){for(var t=this.children,e=0,i=t.length;e<i;e++){var s=t[e];s.clearMask&&s.clearMask(!1),s.hasOwnProperty("isRexContainerLite")||this.setChildMaskVisible(s)}return this},clearMask(t){return void 0===t&&(t=!1),t&&this.mask&&mask.destroy(),this._mask=null,this.setChildMaskVisible(this),this.clearChildrenMask(),this}},G=function(t,e){if(t.length<=1)return t;var i;void 0===e&&(e=!1);for(var s=0,r=t.length;s<r;s++){var n=t[s];if(n.displayList?i=n.displayList:n.parentContainer&&(i=n.parentContainer.list),i)break}return i||(i=n.scene.sys.displayList),i.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},B=function(t,e){var i=e?e.displayList:void 0,s=e?e.parentContainer:void 0;return t.filter((function(t){var r=t.displayList,n=t.parentContainer;return!(!r&&!n||e&&(r?r!==i:!n||n!==s))}))},I={setDepth(t,e){if(this.depth=t,!this.layerRendererEnable&&!e&&this.children)for(var i=this.getAllChildren(),s=0,r=i.length;s<r;s++)i[s].depth=t;return this},swapDepth(t){var e=this.depth,i=t.depth;return this.setDepth(i),t.setDepth(e),this},incDepth(t){if(this.depth+=t,!this.layerRendererEnable&&this.children)for(var e=this.getAllChildren(),i=0,s=e.length;i<s;i++)e[i].depth+=t;return this},bringToTop(){var t=this.displayList;if(!t)return this;if(this.layerRendererEnable)t.exists(this)&&t.bringToTop(this);else{var e=this.getAllChildren([this]);G(e,!1);for(var i=0,s=e.length;i<s;i++){var r=e[i];t.exists(r)&&t.bringToTop(r)}}return this},bringMeToTop(){return this.bringToTop()},sendToBack(){var t=this.displayList;if(!t)return this;if(this.layerRendererEnable)t.exists(this)&&t.sendToBack(this);else{var e=this.getAllChildren([this]);G(e,!0);for(var i=0,s=e.length;i<s;i++){var r=e[i];t.exists(r)&&t.sendToBack(r)}}return this},sendMeToBack(){return this.sendToBack()},moveDepthBelow(t){var e=this.displayList;if(!e)return this;if(t.displayList!==e)return this;if(this.layerRendererEnable)e.exists(this)&&e.moveBelow(t,this);else{var i=this.getAllChildren([this]);G(i,!1);for(var s=0,r=i.length;s<r;s++){var n=i[s];if(e.exists(n)){e.moveBelow(t,n);break}}}return this},moveMyDepthBelow(t){return this.moveDepthBelow(t)},moveDepthAbove(t){var e=this.displayList;if(!e)return this;if(t.displayList!==e)return this;if(this.layerRendererEnable)e.exists(this)&&e.moveAbove(t,this);else{var i=this.getAllChildren([this]);G(i,!0);for(var s=0,r=i.length;s<r;s++){var n=i[s];if(e.exists(n)){e.moveAbove(t,n);break}}}return this},moveMyDepthAbove(t){return this.moveDepthAbove(t)},bringChildToTop(t){if(t===this&&this.layerRendererEnable)return this;var e,i;if(t!==this&&t.isRexContainerLite&&!t.layerRendererEnable?(e=t.getAllChildren([t]),e=B(e,t),e=G(e,!1)):e=[t],this.layerRendererEnable)i=this;else{var s=this.getAllChildren([this]);s=B(s,t),i=(s=G(s,!1))[s.length-1]}for(var r=0,n=e.length;r<n;r++){var l=e[r];i!==l&&(l!==this&&i.displayList!==l.displayList||(i.displayList.moveAbove(l,i),i=l))}return this},sendChildToBack(t){if(t===this&&this.layerRendererEnable)return this;var e,i;if(t!==this&&t.isRexContainerLite&&!t.layerRendererEnable?(e=t.getAllChildren([t]),e=B(e,t),e=G(e,!1)):e=[t],this.layerRendererEnable)i=this;else{var s=this.getAllChildren([this]);s=B(s,t),i=(s=G(s,!1))[0]}for(var r=e.length-1;r>=0;r--){var n=e[r];i!==n&&(n!==this&&i.displayList!==n.displayList||(i.displayList.moveBelow(n,i),i=n))}return this}},W=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s<r;s++)W(i[s],e)},j=function(t,e){for(var i=[t];i.length>0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const z=Phaser.Utils.Array;var N={getChildren(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(t){void 0===t&&(t=[]);var e=this;return j(e,(function(i){i!==e&&t.push(i)})),t},getAllVisibleChildren(t){void 0===t&&(t=[]);var e=this;return j(e,(function(i){if(i!==e)return!i.visible||void t.push(i)})),t},bfs(t,e){return void 0===e&&(e=this),j(e,t),this},dfs(t,e){return void 0===e&&(e=this),W(e,t),this},contains(t){var e=u(t);return!!e&&(e===this||this.contains(e))},getByName(t,e){if(e){for(var i,s,r=[this];r.length;)for(var n=0,l=(i=r.shift()).children.length;n<l;n++){if((s=i.children[n]).name===t)return s;s.isRexContainerLite&&r.push(s)}return null}return z.GetFirst(this.children,"name",t)},getRandom(t,e){return z.GetRandom(this.children,t,e)},getFirst(t,e,i,s){return z.GetFirstElement(this.children,t,e,i,s)},getAll(t,e,i,s){return z.GetAll(this.children,t,e,i,s)},count(t,e,i,s){return z.CountAllMatching(this.children,t,e,i,s)},swap(t,e){return z.Swap(this.children,t,e),this},setAll(t,e,i,s){return z.SetAll(this.children,t,e,i,s),this}},U=function(t){for(var e=[],i=0,s=t.length;i<s;i++){var r=t[i];r.hasOwnProperty("rexContainer")&&e.push(r.rexContainer)}return e},Z=function(t,e,i){if(i.parent){var s=i.parent,r=i.self;switch(e){case"x":case"y":s.updateChildPosition(r);break;case"angle":case"rotation":s.updateChildRotation(r);break;case"scaleX":case"scaleY":case"displayWidth":case"displayHeight":s.updateChildScale(r);break;case"alpha":s.updateChildAlpha(r);break;default:s.updateChildPosition(r),s.updateChildRotation(r),s.updateChildScale(r),s.updateChildAlpha(r)}}else t.remove()},q={tweenChild(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 s=t[e].scene;if(s)return s}return null}(e);if(i){t.targets=U(e);var s=i.tweens.add(t);return s.on("update",Z),s}},tweenSelf(t){return t.targets=[this],this.tweenChild(t)},createTweenChildConfig(t){var e=t.targets;e&&(Array.isArray(e)||(e=[e]),t.targets=U(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),Z(t,void 0,e)},t},tween(t){var e=this.scene;return t.targets||(t.targets=this),e.tweens.add(t)}};Phaser.GameObjects.Container;const $=Phaser.GameObjects.Layer;var J=function(t){return t instanceof $},K=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return!!t.displayList||!!t.parentContainer}))},Q=function(t){var e=K(this);-1===e.indexOf(this)&&e.push(this),G(e),t.add(e)},tt=function(t,e,i){if(this.scene){var s=K(this);G(s,e),t.remove(s),i&&s.forEach((function(t){t.addToDisplayList()}))}},et={addToContainer(t){return this._setParentContainerFlag=!0,Q.call(this,t),this._setParentContainerFlag=!1,this},addToLayer(t){return Q.call(this,t),this},removeFromContainer(){return this.parentContainer?(this._setParentContainerFlag=!0,tt.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer(t){return void 0===t&&(t=!0),J(this.displayList)?(tt.call(this,this.displayList,!1,t),this):this},getParentContainer(){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(t){if(!t.displayList)return this;var e=this.getParentContainer();return e?(t.isRexContainerLite?t.addToContainer(e):e.add(t),this):this},addToPatentLayer(t){if(!t.displayList)return this;var e=this.displayList;return e===t.displayList||J(e)&&(t.isRexContainerLite?t.addToLayer(e):e.add(t)),this}},it=function(){if(this.rendererLayer)return this.rendererLayer;for(var t=this.getParent();t;){if(t.rendererLayer)return t.rendererLayer;t=t.getParent()}return null},st={hasLayer(){return this.layerRendererEnable},enableLayer(){return this.enableLayerRenderer(),this},getLayer(){return this.enableLayerRenderer(),this},addChildCallback(t){if(t.displayList){var e=it.call(this);e&&e!==t.displayList&&(t.isRexContainerLite?t.addToLayer(e):e.add(t),p(t).layer=e)}},removeChildCallback(t,e){var i=p(t),s=i.layer;s&&(t.isRexContainerLite?t.removeFromLayer(!0):s.remove(t),i.layer=null)}},rt=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},nt=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const lt=Phaser.Geom.Rectangle,at=Phaser.Math.Vector2,ht=Phaser.Math.RotateAround,ot=Phaser.GameObjects.Container;var dt=function(t,e){if(void 0===e?e=new lt:!0===e&&(void 0===ct&&(ct=new lt),e=ct),t.getBounds&&!(t instanceof ot))return t.getBounds(e);var i,s,r,n,l,a,h,o;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();ut(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,Ct(t,e),d.transformPoint(e.x,e.y,e),r=e.x,n=e.y,vt(t,e),d.transformPoint(e.x,e.y,e),l=e.x,a=e.y,pt(t,e),d.transformPoint(e.x,e.y,e),h=e.x,o=e.y}else ut(t,e),i=e.x,s=e.y,Ct(t,e),r=e.x,n=e.y,vt(t,e),l=e.x,a=e.y,pt(t,e),h=e.x,o=e.y;return e.x=Math.min(i,r,l,h),e.y=Math.min(s,n,a,o),e.width=Math.max(i,r,l,h)-e.x,e.height=Math.max(s,n,a,o)-e.y,e},ct=void 0,ut=function(t,e,i){return void 0===e?e=new at:!0===e&&(void 0===gt&&(gt=new at),e=gt),t.getTopLeft?t.getTopLeft(e,i):(e.x=t.x-rt(t)*t.originX,e.y=t.y-nt(t)*t.originY,ft(t,e,i))},Ct=function(t,e,i){return void 0===e?e=new at:!0===e&&(void 0===gt&&(gt=new at),e=gt),t.getTopRight?t.getTopRight(e,i):(e.x=t.x-rt(t)*t.originX+rt(t),e.y=t.y-nt(t)*t.originY,ft(t,e,i))},vt=function(t,e,i){return void 0===e?e=new at:!0===e&&(void 0===gt&&(gt=new at),e=gt),t.getBottomLeft?t.getBottomLeft(e,i):(e.x=t.x-rt(t)*t.originX,e.y=t.y-nt(t)*t.originY+nt(t),ft(t,e,i))},pt=function(t,e,i){return void 0===e?e=new at:!0===e&&(void 0===gt&&(gt=new at),e=gt),t.getBottomRight?t.getBottomRight(e,i):(e.x=t.x-rt(t)*t.originX+rt(t),e.y=t.y-nt(t)*t.originY+nt(t),ft(t,e,i))},gt=void 0,ft=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&ht(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const yt=Phaser.Geom.Rectangle,bt=Phaser.Geom.Rectangle.Union;var mt,xt=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},Tt=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:xt(e),i){e.length=t.length;for(var s=0,r=t.length;s<r;s++)e[s]=t[s]}else for(var n in t)e[n]=t[n];return e};const Mt=Phaser.GameObjects.GameObject,Pt=Phaser.GameObjects.Layer;var Ot=Phaser.Utils.Objects.GetValue,Rt=function(t){if(t){var e,i,s=t.gameObjects,r=t.renderTexture,n=t.saveTexture,l=Ot(t,"x",void 0),a=Ot(t,"y",void 0),h=Ot(t,"width",void 0),o=Ot(t,"height",void 0),d=Ot(t,"originX",0),c=Ot(t,"originY",0),u=Ot(t,"padding",0);if(void 0===h||void 0===o||void 0===l||void 0===a){var C=function(t,e){var i;void 0===e?e=new yt:!0===e&&(void 0===mt&&(mt=new yt),e=mt),e.setTo(0,0,0,0);for(var s=!0,r=0,n=t.length;r<n;r++)if((i=t[r]).getBounds){var l=dt(i,!0);s?(e.setTo(l.x,l.y,l.width,l.height),s=!1):bt(l,e,e)}return e}(s,!0);void 0!==l&&void 0!==a?(h=2*Math.max(l-C.left,C.right-l),o=2*Math.max(a-C.top,C.bottom-a),d=.5,c=.5):(l=C.x,a=C.y,h=C.width,o=C.height,d=0,c=0),e=C.x,i=C.y}else e=l+(0-d)*h,i=a+(0-c)*o;e-=u,i-=u,h+=2*u,o+=2*u;var v,p=s[0].scene,g=p.sys.textures;return n&&!r&&(r=g.addDynamicTexture(n,h,o)),r||(r=p.add.renderTexture(0,0,h,o)),r.setPosition&&r.setPosition(l,a),r.width===h&&r.height===o||r.setSize(h,o),r.setOrigin&&r.setOrigin(d,c),r.camera.setScroll(e,i),s=G(Tt(s)),r.draw(s),n&&((v=r)instanceof Mt||v instanceof Pt?r.saveTexture(n):r.key!==n&&g.renameTexture(r.key,key)),r}},St={snapshot(t){var e=this.scaleX,i=this.scaleY,s=1===e&&1===i;s||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=Rt(t),n=!!r.scene;return s||(this.setScale(e,i),n&&r.setScale(e,i)),n?r:this}};const Lt=Phaser.Utils.Objects.GetValue;var kt=function(t,e,i,s,r,n,l,a){if(t.getBounds||void 0!==t.width&&void 0!==t.height){var h=ut(t,wt[0],a);h.x-=l,h.y-=l;var o=Ct(t,wt[1],a);o.x+=l,o.y-=l;var d=pt(t,wt[2],a);d.x+=l,d.y+=l;var c=vt(t,wt[3],a);c.x-=l,c.y+=l,null!==r&&e.fillStyle(r,n).fillPoints(wt,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(wt,!0,!0)}},wt=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];const At=Phaser.Utils.Objects.GetValue,Yt=Phaser.Math.RotateAround;var Xt={changeOrigin:function(t,e){this.syncChildrenEnable=!1,function(t,e,i){void 0===i&&(i=e);var s={x:(e-t.originX)*t.displayWidth,y:(i-t.originY)*t.displayHeight};Yt(s,0,0,t.rotation),t.originX=e,t.originY=i,t.x=t.x+s.x,t.y=t.y+s.y}(this,t,e),this.syncChildrenEnable=!0;for(var i=this.getAllChildren(),s=0,r=i.length;s<r;s++)this.resetChildPositionState(i[s]);return this},drawBounds:function(t,e){var i=At(e,"drawContainer",!0),s=At(e,"children");return void 0===s&&(s=this.getAllVisibleChildren([this])),i||(s=s.filter((function(t){return!t.isRexContainerLite}))),function(t,e,i){var s,r,n,l,a,h;if("number"==typeof i?s=i:(s=Lt(i,"color"),r=Lt(i,"lineWidth"),n=Lt(i,"fillColor"),l=Lt(i,"fillAlpha"),a=Lt(i,"padding"),h=Lt(i,"includeParent")),void 0===s&&(s=16777215),void 0===r&&(r=1),void 0===n&&(n=null),void 0===l&&(l=1),void 0===a&&(a=0),void 0===h&&(h=!0),Array.isArray(t))for(var o=0,d=t.length;o<d;o++)kt(t[o],e,s,r,n,l,a,h);else kt(t,e,s,r,n,l,a,h)}(s,t,e),this}};Object.assign(Xt,g,M,R,S,L,w,Y,X,E,H,F,_,V,D,I,N,q,et,st,St);class Et extends d{constructor(t,e,i,s,r,n){Array.isArray(s)&&(n=s,s=void 0,r=void 0),super(t,e,i,s,r),this.type="rexContainerLite",this.isRexContainerLite=!0,this.syncChildrenEnable=!0,this._active=!0,this._mask=null,this._scrollFactorX=1,this._scrollFactorY=1,this._cameraFilter=0,n&&this.add(n)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,super.destroy(t))}resize(t,e){return this.setSize(t,e),this}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.syncPosition())}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.syncPosition())}get rotation(){return super.rotation}set rotation(t){this.rotation!==t&&(super.rotation=t,this.syncPosition())}get scaleX(){return super.scaleX}set scaleX(t){this.scaleX!==t&&(super.scaleX=t,this.syncPosition())}get scaleY(){return super.scaleY}set scaleY(t){this.scaleY!==t&&(super.scaleY=t,this.syncPosition())}get scale(){return super.scale}set scale(t){this.scale!==t&&(super.scale=t,this.syncPosition())}get visible(){return super.visible}set visible(t){super.visible!==t&&(super.visible=t,this.syncVisible())}get alpha(){return super.alpha}set alpha(t){super.alpha!==t&&(super.alpha=t,this.syncAlpha())}get active(){return this._active}set active(t){this._active!==t&&(this._active=t,this.syncActive())}get mask(){return this._mask}set mask(t){this._mask!==t&&(this._mask=t,this.layerRendererEnable||this.syncMask())}get scrollFactorX(){return this._scrollFactorX}set scrollFactorX(t){this._scrollFactorX!==t&&(this._scrollFactorX=t,this.syncScrollFactor())}get scrollFactorY(){return this._scrollFactorY}set scrollFactorY(t){this._scrollFactorY!==t&&(this._scrollFactorY=t,this.syncScrollFactor())}get cameraFilter(){return this._cameraFilter}set cameraFilter(t){this._cameraFilter!==t&&(this._cameraFilter=t,this.syncCameraFilter())}get list(){return this.children}static GetParent(t){return u(t)}get parentContainer(){return this._parentContainer}set parentContainer(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}get setParentContainerFlag(){if(this._setParentContainerFlag)return!0;var t=u(this);return!!t&&t.setParentContainerFlag}}Object.assign(Et.prototype,Xt);var Ht=function(t,e,i){for(var s=t,r=i,n=0,l=e.length;n<l;n++){var a=e[n];if(!s||"object"!=typeof s&&"function"!=typeof s||!(a in s))return Ft.found=!1,Ft;s=r=s[a]}return Ft.found=!0,Ft.value=r,Ft},Ft={},_t={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,i,s){var r=t&&("object"==typeof t||"function"==typeof t),n=s&&("object"==typeof s||"function"==typeof s);if(!r&&!n)return i;var l=String(e);if(r&&l in t)return t[l];if(n&&l in s)return s[l];if(-1===l.indexOf("."))return i;var a=l.split(".");if(r){var h=Ht(t,a,i);if(h.found)return h.value}if(n){var o=Ht(s,a,i);if(o.found)return o.value}return i}(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&xt(this.data),this}};const Vt=Phaser.Display.Align;var Dt={center:Vt.CENTER,left:Vt.LEFT_CENTER,right:Vt.RIGHT_CENTER,top:Vt.TOP_CENTER,bottom:Vt.BOTTOM_CENTER,"left-top":Vt.TOP_LEFT,"top-left":Vt.TOP_LEFT,"left-center":Vt.LEFT_CENTER,"center-left":Vt.LEFT_CENTER,"left-bottom":Vt.BOTTOM_LEFT,"bottom-left":Vt.BOTTOM_LEFT,"center-top":Vt.TOP_CENTER,"top-center":Vt.TOP_CENTER,"center-center":Vt.CENTER,"center-bottom":Vt.BOTTOM_CENTER,"bottom-center":Vt.BOTTOM_CENTER,"right-top":Vt.TOP_RIGHT,"top-right":Vt.TOP_RIGHT,"right-center":Vt.RIGHT_CENTER,"center-right":Vt.RIGHT_CENTER,"right-bottom":Vt.BOTTOM_RIGHT,"bottom-right":Vt.BOTTOM_RIGHT};class Gt{constructor(t,e){this.container=null,this._deltaHeight=0,this.setParent(t)}setParent(t){this.parent=t,this.parentContainer=t.getParentContainer()}destroy(t){void 0===t&&(t=!1),t||this.destroyContainer(),this.deltaHeight=0,this.data=void 0,this.container=null,this.parent=void 0,this.parentContainer=void 0}get table(){return this.parent}get scrollMode(){return this.parentContainer.scrollMode}get colIndx(){return this.parent.cellIndxeToColIndex(this.index)}get rowIndx(){return this.parent.cellIndxeToRowIndex(this.index)}getContainer(){return this.container}setContainer(t){return t?(this.container&&this.container.destroy(),this.container=t,this.parentContainer.add(t),this):(this.destroyContainer(),this)}destroyContainer(){return this.container&&(this.container.destroy(),this.container=null),this}popContainer(){if(this.container){var t=this.container;return this.container=null,this.parentContainer.remove(t),t}return null}setXY(t,e){return this.container&&this.parentContainer.setChildLocalPosition(this.container,t,e),this}setCellContainerAlign(t){return"string"==typeof t&&(t=Dt[t]),this.cellContainerAlign=t,this}get deltaHeight(){return this._deltaHeight}set deltaHeight(t){null==t&&(t=0);var e=this.parent;0===this._deltaHeight&&0!==t?e.nonZeroDeltaHeightCount++:0!==this._deltaHeight&&0===t&&e.nonZeroDeltaHeightCount--;var i=this._deltaHeight!==t;if(this._deltaHeight=t,i){e.resetTotalRowsHeight();var s=0===this.scrollMode?"cellheightchange":"cellwidthchange";this.parentContainer.emit(s,this,this.container,this.parentContainer)}}get deltaWidth(){return this.deltaHeight}set deltaWidth(t){this.deltaHeight=t}setDeltaHeight(t){return this.deltaHeight=t,this}setDeltaWidth(t){return this.deltaHeight=t,this}get height(){return 0===this.scrollMode?this.deltaHeight+this.parent.defaultCellHeight:this.parent.defaultCellWidth}set height(t){1!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight)}setHeight(t){return this.height=t,this}get width(){return 0===this.scrollMode?this.parent.defaultCellWidth:this.deltaHeight+this.parent.defaultCellHeight}set width(t){0!==this.scrollMode&&this.setDeltaHeight(t-this.parent.defaultCellHeight)}setWidth(t){return this.width=t,this}get scene(){return this.parentContainer.scene}}Object.assign(Gt.prototype,_t);class Bt{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const It=Phaser.Utils.Objects.GetValue,Wt=Phaser.Utils.Array.SpliceOne;class jt{constructor(t,e){this.parent=t,this.cells=[],this.cellPool=new Bt,this.resetFromJSON(e)}resetFromJSON(t){void 0===t&&(t={}),this.colCount=void 0,this.nonZeroDeltaHeightCount=0,this.resetTotalRowsHeight();var e=t.cellHeight;void 0===e&&(e=60);var i=t.cellWidth;return void 0===i&&(i=60),this.setDefaultCellHeight(e),this.setDefaultCellWidth(i),this.initCells(It(t,"cellsCount",0)),this.setColumnCount(It(t,"columns",1)),this}destroy(t){this.cellPool.destroy(),this.cells=void 0,this.parent=void 0}get defaultCellHeightMode(){return 0===this.nonZeroDeltaHeightCount}setDefaultCellHeight(t){return this.defaultCellHeight=t,this}setDefaultCellWidth(t){return this.defaultCellWidth=t,this}initCells(t){var e=this.cells;e.length=t;for(var i=0;i<t;i++)e[i]=null;return this}insertNewCells(t,e){var i=this.cells;if(t===i.length){var s=t+e;i.legth=s;for(var r=t;r<s;r++)i[r]=null}else{var n=[];for(n.length=e,r=0;r<e;r++)n[r]=null;this.cells.splice(t,0,...n)}return this.resetTotalRowsHeight(),this}removeCells(t,e){for(var i=t+e,s=t;s<i;s++)this.freeCell(s);return i===this.cells.length?this.cells.length=t:(1===e?Wt(this.cells,t):this.cells.splice(t,e),this.buildCellIndex(t)),this.resetTotalRowsHeight(),this}setColumnCount(t){this.colCount=t,this.resetTotalRowsHeight();var e=this.parent;if(e.expandCellSize){var i=(0===e.scrollMode?e.width:e.height)/t;this.setDefaultCellWidth(i)}return this}get rowCount(){return Math.ceil(this.cells.length/this.colCount)}get cellsCount(){return this.cells.length}isValidCellIdx(t){return t>=0&&t<this.cells.length}heightToRowIndex(t,e){if(void 0===e&&(e=0),0===t)return 0;if(this.defaultCellHeightMode){var i=t/this.defaultCellHeight;return i=1===e?Math.ceil(i):Math.floor(i)}var s,r=this.rowCount,n=t;for(i=0;;){if(s=i>=0&&i<r,!((n-=this.getRowHeight(i))>0&&s)){if(0===n)return 2===e&&(i+=1),i;if(1===e){var l=i;(s=(i+=1)>=0&&i<r)||(i=l)}return i}i+=1}}widthToColIndex(t,e){if(0===t)return 0;var i=t/this.defaultCellWidth;return i=e?Math.ceil(i):Math.floor(i)}colRowToCellIndex(t,e){return t<0||t>=this.colCount||e<0||e>=this.rowCount?null:e*this.colCount+t}rowIndexToHeight(t,e){if(this.defaultCellHeightMode)return(e-t+1)*this.defaultCellHeight;for(var i=0,s=t;s<=e;s++)i+=this.getRowHeight(s);return i}colIndexToWidth(t,e){return(e-t+1)*this.defaultCellWidth}getRowHeight(t){var e=this.colCount;if(e<=1)return this.getCellHeight(this.colRowToCellIndex(0,t));for(var i,s=0,r=0;r<e;r++)s<(i=this.getCellHeight(this.colRowToCellIndex(r,t)))&&(s=i);return s}getColWidth(t){return this.defaultCellWidth}getCellHeight(t){if(!this.isValidCellIdx(t))return 0;var e;if(this.defaultCellHeightMode)e=this.defaultCellHeight;else{var i=this.getCell(t,!1),s=i?i.deltaHeight:0;e=this.defaultCellHeight+s}return e}resetTotalRowsHeight(){this._totalRowsHeight=null}get totalRowsHeight(){return null===this._totalRowsHeight&&(this._totalRowsHeight=this.rowIndexToHeight(0,this.rowCount-1)),this._totalRowsHeight}get totalColumnWidth(){return this.colCount*this.defaultCellWidth}cellIndxeToColIndex(t){return t%this.colCount}cellIndxeToRowIndex(t){return Math.floor(t/this.colCount)}getCell(t,e){if(!this.isValidCellIdx(t))return null;if(void 0===e&&(e=!0),null===this.cells[t]&&e){var i=this.newCell(t);this.cells[t]=i}return this.cells[t]}newCell(t){var e=this.cellPool.pop();return null===e?e=new Gt(this):e.setParent(this),e.index=t,e}buildCellIndex(t){void 0===t&&(t=0);for(var e,i=this.cells,s=t,r=i.length;s<r;s++)(e=i[s])&&(e.index=s);return this}getParentContainer(){return this.parent}freeCell(t){return"number"==typeof t&&(t=this.cells[t]),t?(t.destroy(),this.cellPool.push(t),this):this}}var zt=function(t){return t.hasOwnProperty("geometryMask")?t.geometryMask:t.bitmapMask};const Nt=Phaser.Geom.Intersects.RectangleToRectangle,Ut=Phaser.Geom.Rectangle.Overlaps;var Zt=function(t){if(!t.displayList)return!1;for(;;){var e=t.rexContainer;if(e){if(e.visible){var i=e.parent;if(i){t=i;continue}return!0}return!1}return t.visible}},qt=function(t,e){var i=e.top,s=e.bottom,r=e.left,n=e.right,l=0;return l+=t.contains(r,i)?1:0,l+=t.contains(r,s)?1:0,l+=t.contains(n,i)?1:0,l+=t.contains(n,s)?1:0},$t=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!0))},Jt=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!0),e.syncChildrenEnable=!0):(e.setMask&&e.setMask(i),t.setChildMaskVisible(e,!0))},Kt=function(t,e,i){e.hasOwnProperty("isRexContainerLite")?(e.syncChildrenEnable=!1,t.setChildMaskVisible(e,!1),e.syncChildrenEnable=!0):(e.clearMask&&e.clearMask(),t.setChildMaskVisible(e,!1))};const Qt=Phaser.GameObjects.Graphics.prototype.setPosition,te=Phaser.Geom.Rectangle,ee=Phaser.Geom.Circle;var ie=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,n,l){if(1===t){s=s.left;var a=-e*(r-.5),h=-i*(n-.5),o=Math.min(e,i)/2+s;void 0!==l&&l instanceof ee||(l=new ee),l.setTo(a,h,o)}else{var d=-e*r-s.left,c=-i*n-s.top,u=e+s.left+s.right,C=i+s.top+s.bottom;void 0!==l&&l instanceof te||(l=new te),l.setTo(d,c,u,C)}return l}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},se={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),Qt.call(this,t,e),this},resize:function(t,e,i){var s=this.parent;void 0===t&&(t=s.width),void 0===e&&(e=s.height),void 0===i?i=this.padding:"number"==typeof i&&(i=GetBoundsConfig(i));var r=this.width!==t||this.height!==e,n=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 r||n?(this.width=t,this.height=e,n&&Tt(i,this.padding),this.originX=s.originX,this.originY=s.originY,ie.call(this,t,e,i,s.originX,s.originY),this):this},setOrigin: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,ie.call(this,this.width,this.height,this.padding,t,e)),this},contains:function(t,e){return t-=this.x,e-=this.y,this.geom.contains(t,e)}};const re=Phaser.Utils.Objects.GetValue,ne=Phaser.GameObjects.Graphics;class le extends ne{constructor(t,e,i){var s,r;void 0===e&&(e=0),"string"==typeof e&&(e=ae[e]),super(t.scene),this.parent=t,this.shapeType=e,this.padding=(void 0===(s=i)&&(s=0),void 0===r&&(r={}),"number"==typeof s?(r.left=s,r.right=s,r.top=s,r.bottom=s):(r.left=re(s,"left",0),r.right=re(s,"right",0),r.top=re(s,"top",0),r.bottom=re(s,"bottom",0)),r),this.setPosition().resize().setVisible(!1)}destroy(){return this.parent=void 0,super.destroy(),this}}const ae={rectangle:0,circle:1};Object.assign(le.prototype,se);var he=function(t,e,i,s){var r=new le(e,i,s);if(t&&!t.isRexSizer){var n=r.createGeometryMask();t.setMask(n),this.once("destroy",(function(){t.setMask(),n.destroy()}))}return this.pin(r),r};const oe=Phaser.Utils.Objects.GetValue,de={update:0,everyTick:1};var ce={setupChildrenMask(t){return!1===t||(this.setMaskUpdateMode(oe(t,"updateMode",0)),this.enableChildrenMask(oe(t,"padding",0)),this.onMaskGameObjectVisible=oe(t,"onVisible"),this.onMaskGameObjectInvisible=oe(t,"onInvisible"),this.maskGameObjectCallbackScope=oe(t,"scope"),this.startMaskUpdate()),this},destroyChildrenMask(){return this.childrenMask?(this.stopMaskUpdate(),this.childrenMask.destroy(),this.childrenMask=void 0,this.onMaskGameObjectVisible=null,this.onMaskGameObjectInvisible=null,this.maskGameObjectCallbackScope=null,this):this},setMaskUpdateMode(t){return"string"==typeof t&&(t=de[t]),this.maskUpdateMode=t,this},startMaskUpdate(){this.scene.game.events.on("poststep",this.maskChildren,this)},stopMaskUpdate(){this.scene.game.events.off("poststep",this.maskChildren,this)},enableChildrenMask(t){var e=he.call(this,null,this,0,t);return this.childrenMask=e.createGeometryMask(),this},setMaskChildrenFlag(t){return void 0===t&&(t=!0),this.maskChildrenFlag=t,this},maskChildren(){return this.childrenMask&&this.maskChildrenFlag&&0!==this.alpha&&this.visible?(this.layerRendererEnable?this.setMask(this.childrenMask):function({parent:t,mask:e,children:i,onVisible:s,onInvisible:r,scope:n}){if(e){void 0===i&&(i=t.getAllChildren());for(var l,a,h,o=!!s||!!r,d=t.getBounds(),c=zt(e),u=0,C=i.length;u<C;u++)if((l=i[u])!==c&&Zt(l)){if(h=l.visible,l.getBounds)switch(a=l.getBounds(a),qt(d,a)){case 4:$t(t,l);break;case 0:Nt(d,a)||Ut(d,a)?Jt(t,l,e):Kt(t,l);break;default:Jt(t,l,e)}else Jt(t,l,e);if(o&&l.visible!==h){var v=l.visible?s:r;v&&(n?v.call(n,l,t):v(l,t))}}}}({parent:this,mask:this.childrenMask,onVisible:this.onMaskGameObjectVisible,onInvisible:this.onMaskGameObjectInvisible,scope:this.maskGameObjectCallbackScope}),0===this.maskUpdateMode&&(this.maskChildrenFlag=!1),this):this},layoutChildrenMask(){if(!this.childrenMask)return this;var t=zt(this.childrenMask);return t.setPosition().resize(),this.resetChildPositionState(t),this}},ue=function(){},Ce=new Phaser.GameObjects.Zone({sys:{queueDepthSort:ue,events:{once:ue}}},0,0,1,1);Ce.setOrigin(0);var ve=0,pe=1,ge=2,fe=4,ye=6,be=8,me=10,xe=12,Te=function(t){var e=nt(t);return t.y+e-e*t.originY},Me=function(t){var e=rt(t);return t.x-e*t.originX+.5*e},Pe=function(t,e){var i=nt(t);return t.y=e-i+i*t.originY,t},Oe=function(t,e){var i=rt(t),s=i*t.originX;return t.x=e+s-.5*i,t},Re=function(t){var e=rt(t);return t.x-e*t.originX},Se=function(t,e){var i=rt(t);return t.x=e+i*t.originX,t},Le=function(t){var e=rt(t);return t.x+e-e*t.originX},ke=function(t,e){var i=rt(t);return t.x=e-i+i*t.originX,t},we=function(t,e){var i=nt(t),s=i*t.originY;return t.y=e+s-.5*i,t},Ae=function(t){var e=nt(t);return t.y-e*t.originY+.5*e},Ye=function(t){var e=nt(t);return t.y-e*t.originY},Xe=function(t,e){var i=nt(t);return t.y=e+i*t.originY,t},Ee=[];Ee[11]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Oe(t,Me(e)+i),Pe(t,Te(e)+s),t},Ee[me]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Se(t,Re(e)-i),Pe(t,Te(e)+s),t},Ee[xe]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),ke(t,Le(e)+i),Pe(t,Te(e)+s),t},Ee[ye]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),function(t,e,i){Oe(t,e),we(t,i)}(t,Me(e)+i,Ae(e)+s),t},Ee[fe]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Se(t,Re(e)-i),we(t,Ae(e)+s),t},Ee[be]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),ke(t,Le(e)+i),we(t,Ae(e)+s),t},Ee[pe]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Oe(t,Me(e)+i),Xe(t,Ye(e)-s),t},Ee[ve]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),Se(t,Re(e)-i),Xe(t,Ye(e)-s),t},Ee[ge]=function(t,e,i,s){return void 0===i&&(i=0),void 0===s&&(s=0),ke(t,Le(e)+i),Xe(t,Ye(e)-s),t};var He=function(t,e,i,s,r,n){Ce.setPosition(e,i).setSize(s,r),function(t,e,i,s,r){Ee[i](t,e,s,r)}(t,Ce,n)},Fe=function(t){var e,i=null;(e=t.getContainer())?(i=e,t.popContainer()):this.cellContainersPool&&null!==(i=this.cellContainersPool.getFirstDead())&&i.setActive(!0).setVisible(!0),this.emit("cellvisible",t,i,this),this.cellContainersPool&&((e=t.getContainer())?null===i?this.cellContainersPool.add(e):i!==e&&(this.cellContainersPool.add(e),this.cellContainersPool.killAndHide(i)):null!==i&&this.cellContainersPool.killAndHide(i))},_e=function(t){if(this.emit("cellinvisible",t),this.cellContainersPool){var e=t.popContainer();e&&(e.setScale(1).setAlpha(1),this.cellContainersPool.killAndHide(e))}t.destroyContainer()},Ve=function(){var t=this.preVisibleCells;this.preVisibleCells=this.visibleCells,this.visibleCells=t,this.visibleCells.clear()},De=function(t,e){if(e-=this.y+this.topLeftY,(t-=this.x+this.topLeftX)<0||t>=this.displayWidth||e<0||e>=this.displayHeight)return null;var i=this.tableOY-(0===this.scrollMode?e:t),s=this.tableOX-(0===this.scrollMode?t:e),r=this.table,n=r.heightToRowIndex(-i,0),l=r.widthToColIndex(-s),a=r.colRowToCellIndex(l,n);return null===a?null:this.isCellVisible(a)?a:null};const Ge=Phaser.Math.Clamp;var Be=function(t,e,i){var s=t[e];return void 0===s&&(s=t[i]),"number"!=typeof s||!isFinite(s)||s<=0?null:Math.ceil(s)},Ie={setTableOY:function(t){var e=this.table,i=this.topTableOY,s=this.bottomTableOY,r=t>i,n=t<s;return this.clampTableOXY&&(e.rowCount<e.heightToRowIndex(this.instHeight,1)?t=0:r?t=i:n&&(t=s)),this._tableOY!==t&&(this._tableOY=t),r&&(this.execeedTopState||this.emit("execeedtop",this,t,i)),this.execeedTopState=r,n&&(this.execeedBottomState||this.emit("execeedbottom",this,t,s)),this.execeedBottomState=n,this},setTableOX:function(t){var e=this.table,i=this.leftTableOX,s=this.rightTableOX,r=t>this.leftTableOX,n=t<this.rightTableOX;return this.clampTableOXY&&(e.colCount<e.widthToColIndex(this.instWidth,!0)?t=0:r?t=i:n&&(t=s)),this._tableOX!==t&&(this._tableOX=t),r&&(this.execeedLeftState||this.emit("execeedleft",this,t,i)),this.execeedLeftState=r,n&&(this.execeedRightState||this.emit("execeedright",this,t,s)),this.execeedRightState=n,this},showCells:function(){if(0!==this.cellsCount){var t=this.scaleX,e=this.scaleY,i=1===t&&1===e;i||this.setScale(1);var s=this.table,r=this.tableOYOffset,n=this.tableOY+r,l=this.tableOX;this.startRowIndex=Math.max(s.heightToRowIndex(-n,2),0);for(var a=this.startRowIndex,h=Math.max(s.widthToColIndex(-l),0),o=h,d=s.colRowToCellIndex(o,a),c=this.bottomBound,u=this.rightBound,C=s.cellsCount-1,v=s.colCount-1,p=this.getCellTLX(o),g=p,f=this.getCellTLY(a)+r;f<c&&null!==d&&d<=C;){var y,b,m=s.getCell(d,!0);if(this.visibleCells.set(m),this.preVisibleCells.contains(m)||this.showCell(m),0===this.scrollMode?(y=g,b=f):(y=f,b=g),null==m.cellContainerAlign)m.setXY(y,b);else{var x=m.getContainer();He(x,y,b,m.width,m.height,m.cellContainerAlign),m.setXY(x.x,x.y)}g<u&&o<v?(g+=s.getColWidth(o),o+=1):(g=p,f+=s.getRowHeight(a),o=h,a+=1),d=s.colRowToCellIndex(o,a)}i||this.setScale(t,e)}},showCell:Fe,getCellTLX:function(t){var e=0===this.scrollMode?this.topLeftX:this.topLeftY;return this.tableOX+this.table.colIndexToWidth(0,t-1)+e},getCellTLY:function(t){var e=0===this.scrollMode?this.topLeftY:this.topLeftX;return this.tableOY+this.table.rowIndexToHeight(0,t-1)+e},hideCells:function(){var t=this.preVisibleCells,e=this.visibleCells;t.iterate((function(t){e.contains(t)||this.hideCell(t)}),this)},hideCell:_e,updateTable:function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=!1),t&&(Ve.call(this),this.hideCells()),Ve.call(this),this.showCells(),this.hideCells(),this.setMaskChildrenFlag(),e&&(this.layoutChildrenMask(),this.maskChildren()),this},isCellVisible:function(t){var e=this.table.getCell(t,!1);return e&&this.visibleCells.contains(e)},pointToCellIndex:De,pointToCellContainer:function(t,e){var i=De.call(this,t,e);if(null!==i)return this.getCellContainer(i)},eachVisibleCell:function(t,e){return this.visibleCells.each(t,e),this},iterateVisibleCell:function(t,e){return this.visibleCells.iterate(t,e),this},eachCell:function(t,e){return this.table.cells.slice().forEach(t,e),this},iterateCell:function(t,e){return this.table.cells.forEach(t,e),this},setCellsCount:function(t){var e=this.cellsCount;return e===t||(e>t?this.removeCells(t,e-t):this.insertNewCells(e,t-e)),this},insertNewCells:function(t,e){return"object"==typeof t&&(t=t.index),void 0===e&&(e=1),e<=0||(t=Ge(t,0,this.cellsCount),this.table.insertNewCells(t,e)),this},removeCells:function(t,e){if("object"==typeof t&&(t=t.index),void 0===e&&(e=1),t<0&&(e+=t,t=0),e<=0)return this;if(t>this.cellsCount)return this;for(var i,s=t,r=t+e;s<r;s++)(i=this.getCell(s,!1))&&(this.visibleCells.contains(i)&&(_e.call(this,i),this.visibleCells.delete(i)),this.preVisibleCells.delete(i));return this.table.removeCells(t,e),this},setColumnCount:function(t){return this.table.colCount===t||this.table.setColumnCount(t),this},setGridSize:function(t,e){return this.setCellsCount(t*e),this.table.setColumnCount(t),this},updateVisibleCell:function(t){var e=this.table.getCell(t,!1);return e&&e.container?(Fe.call(this,e),this):this},resetCellSizeFromCell:function(t){if(void 0===t&&(t=0),this._isResetCellSizeFromCell)return this;this._isResetCellSizeFromCell=!0;var e=this.table.getCell(t,!0);if(!e)return this._isResetCellSizeFromCell=!1,this;this.showCell(e);var i=e.getContainer();if(!i)return this._isResetCellSizeFromCell=!1,this;var s=Be(i,"displayWidth","width"),r=Be(i,"displayHeight","height");return this.hideCell(e),null!==s&&null!==r&&this.resetAllCellsSize(s,r),this._isResetCellSizeFromCell=!1,this}};Object.assign(Ie,ce);const We=Phaser.GameObjects.Group,je=Phaser.Structs.Set,ze=Phaser.Utils.Objects.GetValue;class Ne extends Et{constructor(t,e,i,s,r,n){void 0===n&&(n={}),super(t,e,i,s,r),this.type="rexGridTable",this._tableOX=0,this._tableOY=0,this.visibleCells=new je,this.preVisibleCells=new je,this.execeed