phaser4-rex-plugins
Version:
1 lines • 103 kB
JavaScript
var t,e;t=void 0,e=function(){var t=!1;!function(e){if(!t){void 0===e&&(e=0);var i=Phaser.VERSION.split("."),s=parseInt(i[0]);if(4===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 e=Phaser.GameObjects.Zone,i=Phaser.Utils.Array.Add,s=Phaser.Utils.Array.Remove;class r extends e{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=[]}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.destroy(t);this.clear(!t),super.destroy(t)}}contains(t){return-1!==this.children.indexOf(t)}add(t){var e=this;return i(this.children,t,0,(function(t){t.once("destroy",e.onChildDestroy,e)}),this),this}remove(t,e){var i=this;return s(this.children,t,(function(t){t.off("destroy",i.onChildDestroy,i),e&&t.destroy()})),this}onChildDestroy(t,e){this.remove(t,!1)}clear(t){for(var e,i=0,s=this.children.length;i<s;i++)(e=this.children[i]).off("destroy",this.onChildDestroy,this),t&&e.destroy();return this.children.length=0,this}}const a=Phaser.GameObjects.Components;Phaser.Class.mixin(r,[a.Alpha,a.Flip]);var n=function(t,e){var i;if(void 0===e)t.hasOwnProperty("rexContainer")&&(i=t.rexContainer.parent);else for(i=n(t);i&&i.name!==e;)i=n(i);return i};const h=Phaser.Math.DegToRad,o=Phaser.Math.RadToDeg;var l=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 o(this.rotation)},set:function(t){this.rotation=h(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},d={setParent(t,e){void 0===e&&(e=this);var i=l(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),n(t,e)},getTopmostParent(t){return void 0===t&&(t=this),function(t){for(var e=n(t);e;)t=e,e=n(e);return t}(t)}};const c=Phaser.Utils.Objects.GetValue,u=r.prototype.add;var p=function(t,e){this.setParent(t);var i=l(t);return v(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t).updateCameraFilter(t),u.call(this,t),f.call(this,t,i),this},g=function(t,e){this.setParent(t);var i=l(t);return v(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),u.call(this,t),f.call(this,t,i),this},v=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=c(e,"syncPosition",!0),t.syncRotation=c(e,"syncRotation",!0),t.syncScale=c(e,"syncScale",!0),t.syncAlpha=c(e,"syncAlpha",!0),t.syncScrollFactor=c(e,"syncScrollFactor",!0),t.syncCameraFilter=c(e,"syncCameraFilter",!0),t.syncDisplayList=c(e,"syncDisplayList",!0))},f=function(t,e){this.addToParentContainer(t),e.syncDisplayList&&this.addToPatentLayer(t),this.addToRenderLayer(t)},m={add(t){return Array.isArray(t)?this.addMultiple(t):p.call(this,t),this},pin(t,e){return Array.isArray(t)?this.addMultiple(t,e):p.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):g.call(this,t),this},pinLocal(t,e){return Array.isArray(t)?this.addMultiple(t,e):g.call(this,t,e),this},addLocalMultiple(t){for(var e=0,i=t.length;e<i;e++)g.call(this,t[e]);return this}};const y=r.prototype.remove,C=r.prototype.clear;var b={remove(t,e){return n(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),y.call(this,t,e)),this},unpin(t,e){return n(t)!==this||(this.setParent(t,null),e||this.removeFromRenderLayer(t),y.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),t||this.removeFromRenderLayer(r)}return C.call(this,t),this}},P={getLocalState:t=>l(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}},x={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},S={updateChildPosition(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=l(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=l(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=l(t);return s.x=e,s.y=i,this.updateChildPosition(t),this},resetLocalPositionState(){var t=l(this).parent;return t&&t.resetChildPositionState(this),this},getChildLocalX:t=>l(t).x,getChildLocalY:t=>l(t).y};const T=Phaser.Math.DegToRad;var L={updateChildRotation(t){var e=l(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=l(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 l(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return l(t).rotation=T(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=l(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>l(t).rotation},_={updateChildScale(t){var e=l(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=l(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},setChildLocalScale(t,e,i){void 0===i&&(i=e);var s=l(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=l(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>l(t).scaleX,getChildLocalScaleY:t=>l(t).scaleY},w={updateChildVisible(t){var e=l(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=l(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),l(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),l(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=l(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>l(t).visible},M={updateChildAlpha(t){var e=l(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=l(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 l(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=l(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>l(t).alpha},D={updateChildActive(t){var e=l(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 l(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),l(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=l(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>l(t).active},R={updateChildScrollFactor(t){var e=l(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}},E={updateCameraFilter(t){var e=l(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},A={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},clearMask(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}},O=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 a=t[s];if(a.displayList?i=a.displayList:a.parentContainer&&(i=a.parentContainer.list),i)break}return i||(i=a.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},F=function(t){return t.filter((function(t){return!!t.displayList||!!t.parentContainer||void 0}))},j={setDepth(t,e){if(this.depth=t,!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.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;var e=this.getAllChildren([this]);O(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;var e=this.getAllChildren([this]);O(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;var i=this.getAllChildren([this]);O(i,!1);for(var s=0,r=i.length;s<r;s++){var a=i[s];if(e.exists(a)){e.moveBelow(t,a);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;var i=this.getAllChildren([this]);O(i,!0);for(var s=0,r=i.length;s<r;s++){var a=i[s];if(e.exists(a)){e.moveAbove(t,a);break}}return this},moveMyDepthAbove(t){return this.moveDepthAbove(t)},bringChildToTop(t){var e;t!==this&&t.isRexContainerLite?(e=t.getAllChildren([t]),e=F(e),e=O(e,!1)):e=[t];var i=this.getAllChildren([this]);i=F(i);for(var s=(i=O(i,!1))[i.length-1],r=0,a=e.length;r<a;r++){var n=e[r];s!==n&&(n!==this&&s.displayList!==n.displayList||(s.displayList.moveAbove(n,s),s=n))}return this},sendChildToBack(t){var e;t!==this&&t.isRexContainerLite?(e=t.getAllChildren([t]),e=F(e),e=O(e,!1)):e=[t];var i=this.getAllChildren([this]);i=F(i);for(var s=(i=O(i,!1))[0],r=e.length-1;r>=0;r--){var a=e[r];s!==a&&(a!==this&&s.displayList!==a.displayList||(s.displayList.moveBelow(a,s),s=a))}return this}},V=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s<r;s++)V(i[s],e)},G=function(t,e){for(var i=[t];i.length>0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const I=Phaser.Utils.Array;var X={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 G(e,(function(i){i!==e&&t.push(i)})),t},getAllVisibleChildren(t){void 0===t&&(t=[]);var e=this;return G(e,(function(i){if(i!==e)return!i.visible||void t.push(i)})),t},bfs(t,e){return void 0===e&&(e=this),G(e,t),this},dfs(t,e){return void 0===e&&(e=this),V(e,t),this},contains(t){var e=n(t);return!!e&&(e===this||this.contains(e))},getByName(t,e){if(e){for(var i,s,r=[this];r.length;)for(var a=0,n=(i=r.shift()).children.length;a<n;a++){if((s=i.children[a]).name===t)return s;s.isRexContainerLite&&r.push(s)}return null}return I.GetFirst(this.children,"name",t)},getRandom(t,e){return I.GetRandom(this.children,t,e)},getFirst(t,e,i,s){return I.GetFirstElement(this.children,t,e,i,s)},getAll(t,e,i,s){return I.GetAll(this.children,t,e,i,s)},count(t,e,i,s){return I.CountAllMatching(this.children,t,e,i,s)},swap(t,e){return I.Swap(this.children,t,e),this},setAll(t,e,i,s){return I.SetAll(this.children,t,e,i,s),this}},Y=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()},W={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=Y(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=Y(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)}};const U=Phaser.GameObjects.Container,B=Phaser.GameObjects.Layer;var N=function(t){return t instanceof B},H=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return!!t.displayList||!!t.parentContainer}))},J=function(t){var e=H(this);-1===e.indexOf(this)&&e.push(this),O(e),t.add(e)},$=function(t,e,i){if(this.scene){var s=H(this);O(s,e),t.remove(s),i&&s.forEach((function(t){t.addToDisplayList()}))}},Z={addToContainer(t){return t instanceof U?(this._setParentContainerFlag=!0,J.call(this,t),this._setParentContainerFlag=!1,this):this},addToLayer(t){return N(t)?(J.call(this,t),this):this},removeFromContainer(){return this.parentContainer?(this._setParentContainerFlag=!0,$.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer(t){return void 0===t&&(t=!0),N(this.displayList)?($.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||N(e)&&(t.isRexContainerLite?t.addToLayer(e):e.add(t)),this}},q={hasLayer(){return!!this.privateRenderLayer},enableLayer(){if(this.hasLayer())return this;var t=this.scene.add.layer();return this.moveDepthBelow(t),this.addToLayer(t),this.privateRenderLayer=t,this},getLayer(){return this.hasLayer()||this.enableLayer(),this.privateRenderLayer},getRenderLayer(){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(t){if(!t.displayList)return this;var e=this.getRenderLayer();return e?(e===t.displayList||(t.isRexContainerLite?t.addToLayer(e):e.add(t),l(t).layer=e),this):this},removeFromRenderLayer(t){var e=l(t),i=e.layer;return i?(t.isRexContainerLite?t.removeFromLayer(!0):i.remove(t),e.layer=null,this):this}},K=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},Q=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const tt=Phaser.Geom.Rectangle,et=Phaser.Math.Vector2,it=Phaser.Math.RotateAround,st=Phaser.GameObjects.Container;var rt=function(t,e){if(void 0===e?e=new tt:!0===e&&(void 0===at&&(at=new tt),e=at),t.getBounds&&!(t instanceof st))return t.getBounds(e);var i,s,r,a,n,h,o,l;if(t.parentContainer){var d=t.parentContainer.getBoundsTransformMatrix();nt(t,e),d.transformPoint(e.x,e.y,e),i=e.x,s=e.y,ht(t,e),d.transformPoint(e.x,e.y,e),r=e.x,a=e.y,ot(t,e),d.transformPoint(e.x,e.y,e),n=e.x,h=e.y,lt(t,e),d.transformPoint(e.x,e.y,e),o=e.x,l=e.y}else nt(t,e),i=e.x,s=e.y,ht(t,e),r=e.x,a=e.y,ot(t,e),n=e.x,h=e.y,lt(t,e),o=e.x,l=e.y;return e.x=Math.min(i,r,n,o),e.y=Math.min(s,a,h,l),e.width=Math.max(i,r,n,o)-e.x,e.height=Math.max(s,a,h,l)-e.y,e},at=void 0,nt=function(t,e,i){return void 0===e?e=new et:!0===e&&(void 0===dt&&(dt=new et),e=dt),t.getTopLeft?t.getTopLeft(e,i):(e.x=t.x-K(t)*t.originX,e.y=t.y-Q(t)*t.originY,ct(t,e,i))},ht=function(t,e,i){return void 0===e?e=new et:!0===e&&(void 0===dt&&(dt=new et),e=dt),t.getTopRight?t.getTopRight(e,i):(e.x=t.x-K(t)*t.originX+K(t),e.y=t.y-Q(t)*t.originY,ct(t,e,i))},ot=function(t,e,i){return void 0===e?e=new et:!0===e&&(void 0===dt&&(dt=new et),e=dt),t.getBottomLeft?t.getBottomLeft(e,i):(e.x=t.x-K(t)*t.originX,e.y=t.y-Q(t)*t.originY+Q(t),ct(t,e,i))},lt=function(t,e,i){return void 0===e?e=new et:!0===e&&(void 0===dt&&(dt=new et),e=dt),t.getBottomRight?t.getBottomRight(e,i):(e.x=t.x-K(t)*t.originX+K(t),e.y=t.y-Q(t)*t.originY+Q(t),ct(t,e,i))},dt=void 0,ct=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&it(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const ut=Phaser.Geom.Rectangle,pt=Phaser.Geom.Rectangle.Union;var gt,vt=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},ft=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:vt(e),i){e.length=t.length;for(var s=0,r=t.length;s<r;s++)e[s]=t[s]}else for(var a in t)e[a]=t[a];return e};const mt=Phaser.GameObjects.GameObject,yt=Phaser.GameObjects.Layer;var Ct=function(t){return t instanceof mt||t instanceof yt},bt=Phaser.Utils.Objects.GetValue,Pt=function(t){if(t){var e=t.gameObjects;Array.isArray(e)||(e=[e]);var i,s,r=t.renderTexture,a=t.saveTexture,n=bt(t,"x",void 0),h=bt(t,"y",void 0),o=bt(t,"width",void 0),l=bt(t,"height",void 0),d=bt(t,"originX",0),c=bt(t,"originY",0),u=bt(t,"padding",0);if(void 0===o||void 0===l||void 0===n||void 0===h){var p=function(t,e){var i;void 0===e?e=new ut:!0===e&&(void 0===gt&&(gt=new ut),e=gt),e.setTo(0,0,0,0);for(var s=!0,r=0,a=t.length;r<a;r++)if((i=t[r]).getBounds){var n=rt(i,!0);s?(e.setTo(n.x,n.y,n.width,n.height),s=!1):pt(n,e,e)}return e}(e,!0);void 0!==n&&void 0!==h?(o=2*Math.max(n-p.left,p.right-n),l=2*Math.max(h-p.top,p.bottom-h),d=.5,c=.5):(n=p.x,h=p.y,o=p.width,l=p.height,d=0,c=0),i=p.x,s=p.y}else i=n+(0-d)*o,s=h+(0-c)*l;i-=u,s-=u,o+=2*u,l+=2*u;var g=e[0].scene,v=g.sys.textures;return a&&!r&&(r=v.addDynamicTexture(a,o,l)),r||(r=g.add.renderTexture(0,0,o,l)),r.setPosition&&r.setPosition(n,h),r.width===o&&r.height===l||r.setSize(o,l),r.setOrigin&&r.setOrigin(d,c),r.camera.setScroll(i,s),e=O(ft(e)),r.draw(e).render(),a&&(Ct(r)?r.saveTexture(a):r.key!==a&&v.renameTexture(r.key,key)),r}},xt={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=Pt(t),a=!!r.scene;return s||(this.setScale(e,i),a&&r.setScale(e,i)),a?r:this}};const kt=Phaser.Utils.Objects.GetValue;var St=function(t,e,i,s,r,a,n,h){if(t.getBounds||void 0!==t.width&&void 0!==t.height){var o=nt(t,Tt[0],h);o.x-=n,o.y-=n;var l=ht(t,Tt[1],h);l.x+=n,l.y-=n;var d=lt(t,Tt[2],h);d.x+=n,d.y+=n;var c=ot(t,Tt[3],h);c.x-=n,c.y+=n,null!==r&&e.fillStyle(r,a).fillPoints(Tt,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(Tt,!0,!0)}},Tt=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];const Lt=Phaser.Utils.Objects.GetValue,_t=Phaser.Math.RotateAround;var wt={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};_t(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=Lt(e,"drawContainer",!0),s=Lt(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,a,n,h,o;if("number"==typeof i?s=i:(s=kt(i,"color"),r=kt(i,"lineWidth"),a=kt(i,"fillColor"),n=kt(i,"fillAlpha"),h=kt(i,"padding"),o=kt(i,"includeParent")),void 0===s&&(s=16777215),void 0===r&&(r=1),void 0===a&&(a=null),void 0===n&&(n=1),void 0===h&&(h=0),void 0===o&&(o=!0),Array.isArray(t))for(var l=0,d=t.length;l<d;l++)St(t[l],e,s,r,a,n,h,o);else St(t,e,s,r,a,n,h,o)}(s,t,e),this}};Object.assign(wt,d,m,b,P,x,S,L,_,w,M,D,R,E,A,j,X,W,Z,q,xt);class Mt extends r{constructor(t,e,i,s,r,a){Array.isArray(s)&&(a=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,this.privateRenderLayer=void 0,a&&this.add(a)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.syncChildrenEnable=!1,super.destroy(t),this.privateRenderLayer&&this.privateRenderLayer.scene&&(this.privateRenderLayer.list.length=0,this.privateRenderLayer.destroy()))}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.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 n(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=n(this);return!!t&&t.setParentContainerFlag}}Object.assign(Mt.prototype,wt);var Dt={setTransitionStartCallback(t,e){return this.onStartCallback=t,this.onStartCallbackScope=e,this},setTransitionProgressCallback(t,e){return this.onProgressCallback=t,this.onProgressCallbackScope=e,this},setTransitionCompleteCallback(t,e){return this.onCompleteCallback=t,this.onCompleteCallbackScope=e,this}},Rt={setEventEmitter(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(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter(){return this._eventEmitter},on(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}};const Et=Phaser.Scene;var At=function(t){return t instanceof Et},Ot=function(t){return null==t||"object"!=typeof t?null:At(t)?t:t.scene&&At(t.scene)?t.scene:t.parent&&t.parent.scene&&At(t.parent.scene)?t.parent.scene:null};const Ft=Phaser.Game;var jt=function(t){return t instanceof Ft},Vt=function(t){return null==t||"object"!=typeof t?null:jt(t)?t:jt(t.game)?t.game:At(t)?t.sys.game:At(t.scene)?t.scene.sys.game:void 0};const Gt=Phaser.Utils.Objects.GetValue;class It{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(Gt(e,"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))}shutdown(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)}destroy(t){this.shutdown(t)}onEnvDestroy(){this.destroy(!0)}onParentDestroy(t,e){this.destroy(e)}setParent(t){return this.parent=t,this.scene=Ot(t),this.game=Vt(t),this}}Object.assign(It.prototype,Rt);const Xt=Phaser.Utils.Objects.GetValue;class Yt extends It{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(Xt(e,"tickingMode",1))}boot(){2!==this.tickingMode||this.tickingState||this.startTicking()}shutdown(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),super.shutdown(t))}setTickingMode(t){"string"==typeof t&&(t=zt[t]),this.tickingMode=t}startTicking(){this.tickingState=!0}stopTicking(){this.tickingState=!1}get isRunning(){return this._isRunning}set isRunning(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}start(){return this.isPaused=!1,this.isRunning=!0,this}pause(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}resume(){return this.isPaused&&(this.isPaused=!1,this.isRunning=!0),this}stop(){return this.isPaused=!1,this.isRunning=!1,this}complete(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}const zt={no:0,lazy:1,always:2},Wt=Phaser.Utils.Objects.GetValue;class Ut extends Yt{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=Wt(e,"tickEventName",i),this.isSceneTicker=!Bt(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),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)}}var Bt=function(t){return"step"===t||"poststep"===t};const Nt=Phaser.Utils.Objects.GetValue,Ht=Phaser.Math.Clamp;class Jt{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=Nt(t,"state",$t),this.timeScale=Nt(t,"timeScale",1),this.delay=Nt(t,"delay",0),this.repeat=Nt(t,"repeat",0),this.repeatCounter=Nt(t,"repeatCounter",0),this.repeatDelay=Nt(t,"repeatDelay",0),this.duration=Nt(t,"duration",0),this.nowTime=Nt(t,"nowTime",0),this.justRestart=Nt(t,"justRestart",!1)}toJSON(){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}}destroy(){}setTimeScale(t){return this.timeScale=t,this}setDelay(t){return void 0===t&&(t=0),this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatInfinity(){return this.repeat=-1,this}setRepeatDelay(t){return this.repeatDelay=t,this}start(){return this.nowTime=this.delay>0?-this.delay:0,this.state=this.nowTime>=0?qt:Zt,this.repeatCounter=0,this}stop(){return this.state=$t,this}update(t,e){this.state!==$t&&this.state!==Qt&&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=Kt)):(this.nowTime=this.duration,this.state=Qt):this.nowTime>=0&&(this.state=qt))}get t(){var t;switch(this.state){case $t:case Zt:case Kt:t=0;break;case qt:t=this.nowTime/this.duration;break;case Qt:t=1}return Ht(t,0,1)}set t(t){(t=Ht(t,-1,1))<0?(this.state=Zt,this.nowTime=-this.delay*t):(this.state=qt,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===$t}get isDelay(){return this.state===Zt}get isCountDown(){return this.state===qt}get isRunning(){return this.state===Zt||this.state===qt}get isDone(){return this.state===Qt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const $t=0,Zt=1,qt=2,Kt=3,Qt=-1;class te extends Ut{constructor(t,e){super(t,e),this.timer=new Jt}shutdown(t){this.isShutdown||(super.shutdown(t),this.timer.destroy(),this.timer=void 0)}start(){return this.timer.start(),super.start(),this}stop(){return this.timer.stop(),super.stop(),this}complete(){return this.timer.stop(),super.complete(),this}}const ee=Phaser.Utils.Objects.GetValue,ie=Phaser.Utils.Objects.GetAdvancedValue,se=Phaser.Tweens.Builders.GetEaseFunction;class re extends te{resetFromJSON(t){return this.timer.resetFromJSON(ee(t,"timer")),this.setEnable(ee(t,"enable",!0)),this.setTarget(ee(t,"target",this.parent)),this.setDelay(ie(t,"delay",0)),this.setDuration(ie(t,"duration",1e3)),this.setEase(ee(t,"ease","Linear")),this.setRepeat(ee(t,"repeat",0)),this}setEnable(t){return null==t&&(t=!0),this.enable=t,this}setTarget(t){return void 0===t&&(t=this.parent),this.target=t,this}setDelay(t){return this.delay=t,this}setDuration(t){return this.duration=t,this}setRepeat(t){return this.repeat=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return void 0===t&&(t="Linear"),this.ease=t,this.easeFn=se(t),this}start(){return this.timer.isRunning||super.start(),this}restart(){return this.timer.stop(),this.start.apply(this,arguments),this}stop(t){return void 0===t&&(t=!1),super.stop(),t&&(this.timer.setT(1),this.updateTarget(this.target,this.timer),this.complete()),this}update(t,e){if(!this.isRunning||!this.enable||this.parent.hasOwnProperty("active")&&!this.parent.active)return this;var i=this.target,s=this.timer;return s.update(t,e),s.isDelay||this.updateTarget(i,s),this.emit("update",i,this),s.isDone&&this.complete(),this}updateTarget(t,e){}}const ae=Phaser.Utils.Objects.GetValue,ne=Phaser.Math.Linear;class he extends re{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=ae(t,"key","value");var i=e[this.propertyKey];return this.fromValue=ae(t,"from",i),this.toValue=ae(t,"to",i),this.setEase(ae(t,"ease",this.ease)),this.setDuration(ae(t,"duration",this.duration)),this.setRepeat(ae(t,"repeat",0)),this.setDelay(ae(t,"delay",0)),this.setRepeatDelay(ae(t,"repeatDelay",0)),this.timer.setDuration(this.duration).setRepeat(this.repeat).setDelay(this.delay).setRepeatDelay(this.repeatDelay),e[this.propertyKey]=this.fromValue,super.start(),this}updateTarget(t,e){var i=e.t;i=this.easeFn(i),t[this.propertyKey]=ne(this.fromValue,this.toValue,i)}}var oe=[Phaser.GameObjects.Image,Phaser.GameObjects.Sprite,Phaser.GameObjects.Mesh,Phaser.GameObjects.Shader,Phaser.GameObjects.Video],le=[Phaser.GameObjects.BitmapText],de=function(t,e,i){if(t&&(void 0!==e||void 0!==i))if(function(t){if(t.resize)return!0;if(!t.setSize)return!1;for(var e=0,i=oe.length;e<i;e++){var s=oe[e];if(s&&t instanceof s)return!1}return!0}(t)){var s,r;s=void 0===e?t.width:e/t.scaleX,r=void 0===i?t.height:i/t.scaleY,t.resize?t.resize(s,r):t.setSize(s,r)}else{var a=function(t){if(void 0===t.displayWidth)return!1;for(var e=0,i=le.length;e<i;e++){var s=le[e];if(s&&t instanceof s)return!1}return!0}(t);void 0!==e&&(a?t.displayWidth=e:t.scaleX=e/t.width),void 0!==i&&(a?t.displayHeight=i:t.scaleY=i/t.height)}},ce=function(t,e,i,s){if(void 0===i)i=0;else{var r=typeof i;"boolean"===r?(s=i,i=0):"string"===r&&(i=ue[i])}void 0===s?s={}:!0===s&&(s=pe);var a=e.width/t.width,n=e.height/t.height,h=i?Math.max(a,n):Math.min(a,n),o=t.width*h,l=t.height*h;return Ct(s)?de(s,o,l):(s.width=o,s.height=l),s};const ue={fit:0,FIT:0,envelop:1,ENVELOP:1};var pe={},ge=function(){for(var t=this.scaleMode-1,e=0,i=this.images.length;e<i;e++){var s=this.images[e],r=ce(s,this,t,!0).width/s.width;this.setChildLocalScale(s,r),s.biasScale=r}},ve=function(t){0===this.scaleMode?this.resize(t.width,t.height):ge.call(this)};const fe=Phaser.Utils.Objects.IsPlainObject,me=Phaser.Utils.Objects.GetValue,ye=Phaser.Utils.Array.GetRandom;var Ce={out:0,in:1},be=function(t,e,...i){for(var s=0,r=i.length;s<r;s++){var a=i[s];if(a&&a.hasOwnProperty(t))return a[t]}return e},Pe={setTransitionDirection(t){return"string"==typeof t&&(t=Ce[t]),this.dir=t,this},setDuration(t){return this.duration=t,this},setEaseFunction(t){return this.easeFunction=t,this},setNextTexture(t,e){return this.nextImage.setTexture(t,e),ve.call(this,this.nextImage),this},transit(t,e,i){if(this.isRunning&&(this.ignoreCompleteEvent=!0,this.stop(),this.ignoreCompleteEvent=!1),void 0!==i&&(t={key:t,frame:e,mode:i}),this.currentTransitionMode=void 0,fe(t)){var s,r=t;t=me(r,"key",void 0),e=me(r,"frame",void 0),i=me(r,"mode"),Array.isArray(i)&&(i=ye(i)),this.transitionModes&&this.transitionModes.hasOwnProperty(i)&&(s=this.transitionModes[i],this.currentTransitionMode=i),this.setDuration(be("duration",this.duration,r,s)).setEaseFunction(be("ease",this.easeFunction,r,s)).setTransitionDirection(be("dir",this.dir,r,s));var a=be("mask",void 0,r,s);a&&this.setMaskGameObject(a),this.setMaskEnable(!0===a);var n=be("onStart",void 0,r,s),h=be("onProgress",void 0,r,s),o=be("onComplete",void 0,r,s);void 0===n&&void 0===h&&void 0===o||this.setTransitionStartCallback(n,be("onStartScope",void 0,r,s)).setTransitionProgressCallback(h,be("onProgressScope",void 0,r,s)).setTransitionCompleteCallback(o,be("onCompleteScope",void 0,r,s))}return this.setNextTexture(t,e),this.start(),this},addTransitionMode(t,e){return void 0===this.transitionModes&&(this.transitionModes={}),fe(t)&&(t=(e=t).name,delete e.name),this.transitionModes[t]=e,this},start(){return void 0===this.easeValueTask&&(this.easeValueTask=new he(this,{eventEmitter:null})),this.easeValueTask.restart({key:"t",from:0,to:1,duration:this.duration,ease:this.easeFunction}),this},pause(){return this.easeValueTask&&this.easeValueTask.pause(),this},resume(){return this.easeValueTask&&this.easeValueTask.resume(),this},stop(){return this.easeValueTask&&this.easeValueTask.stop(),this.setT(1),this}};const xe=Phaser.GameObjects.Graphics.prototype.setPosition,ke=Phaser.Geom.Rectangle,Se=Phaser.Geom.Circle;var Te=function(t,e,i,s,r){this.geom=function(t,e,i,s,r,a,n){if(1===t){s=s.left;var h=-e*(r-.5),o=-i*(a-.5),l=Math.min(e,i)/2+s;void 0!==n&&n instanceof Se||(n=new Se),n.setTo(h,o,l)}else{var d=-e*r-s.left,c=-i*a-s.top,u=e+s.left+s.right,p=i+s.top+s.bottom;void 0!==n&&n instanceof ke||(n=new ke),n.setTo(d,c,u,p)}return n}(this.shapeType,t,e,i,s,r,this.geom),this.clear().fillStyle(16777215),1===this.shapeType?this.fillCircleShape(this.geom):this.fillRectShape(this.geom)},Le={setPosition:function(t,e){var i=this.parent;return void 0===t&&(t=i.x),void 0===e&&(e=i.y),xe.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,a=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||a?(this.width=t,this.height=e,a&&ft(i,this.padding),this.originX=s.originX,this.originY=s.originY,Te.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,Te.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 _e=Phaser.Utils.Objects.GetValue,we=Phaser.GameObjects.Graphics;class Me extends we{constructor(t,e,i){var s,r;void 0===e&&(e=0),"string"==typeof e&&(e=De[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=_e(s,"left",0),r.right=_e(s,"right",0),r.top=_e(s,"top",0),r.bottom=_e(s,"bottom",0)),r),this.setPosition().resize().setVisible(!1),t.parentContainer?t.parentContainer.add(this):t.scene.add.existing(this)}destroy(){return this.parent=void 0,super.destroy(),this}}const De={rectangle:0,circle:1};Object.assign(Me.prototype,Le);var Re=function(t){var e=function(t){return(t=Ot(t))?t.sys.renderer:null}(t);return!!e&&!!e.gl};const Ee=Phaser.Filters.Mask;var Ae=function(t,e,i){var s=function(t,e){var i=t._maskObject;return i?(void 0!==e&&void 0!==i.invert&&(i.invert=e),i):(i=Re(t)?new Ee(t.scene.cameras.main,t,e):t.createGeometryMask(),t._maskObject=i,t.once("destroy",(function(){i.destroy(),t._maskObject=void 0})),i)}(e,i);if(t.mask!==s){if(Re(t)){if(!t.filters){if(!t.enableFilters)return;t.enableFilters()}var r=t.filters.external.list;if(t.mask){var a=r.indexOf(t.mask);r[a]=e}else r.push(s)}else if(!t.setMask)return;t.mask=s}},Oe=function(t){if(t.mask){if(Re(t)){var e=t.filters.external.list,i=e.indexOf(t.mask);e.splice(i,1)}else if(!t.clearMask)return;t.mask=null}},Fe={setMaskGameObject(t){if(!t)return this.removeMaskGameObject(),this;if(this.maskGameObject){if(!0===t&&this.maskGameObject instanceof Me)return this;if(this.maskGameObject===t)return this;this.removeMaskGameObject()}return!0===t&&(t=new Me(this)),t.resize(this.width,this.height).setOrigin(this.originX,this.originY).setPosition(0,0).setScale(1).setVisible(!1),this.addLocal(t),this.maskGameObject=t,this},removeMaskGameObject(t){return void 0===t&&(t=!0),Oe(this.backImage),Oe(this.frontImage),this.remove(this.maskGameObject,t),this.maskGameObject=void 0,this},setImageMaskEnable(t,e,i){return void 0===e&&(e=!0),void 0===i&&(i=!1),e?(this.maskGameObject||this.setMaskGameObject(!0),Ae(t,this.maskGameObject,i)):Oe(t),this},setCurrentImageMaskEnable(t,e){return this.setImageMaskEnable(this.currentImage,t,e),this},setNextImageMaskEnable(t,e){return this.setImageMaskEnable(this.nextImage,t,e),this},setCellImagesMaskEnable(t,e){for(var i=this.getCellImages(),s=0,r=i.length;s<r;s++)this.setImageMaskEnable(i[s],t,e);return this},setMaskEnable(t,e){return this.setImageMaskEnable(this.backImage,t,e),this.setImageMaskEnable(this.frontImage,t,e),this.setCellImagesMaskEnable(t,e),this}};const je=Phaser.Utils.Objects.GetValue,Ve=Phaser.GameObjects.Image,Ge=Phaser.Utils.Objects.IsPlainObject,Ie=Phaser.Math.RotateAround;var Xe={gridCutImage(t,e,i,s){void 0===s&&(s={}),s.objectPool=this.imagesPool;for(var r,a=function(t,e,i,s){Ge(e)&&(e=je(s=e,"columns",1),i=je(s,"rows",1));var r=je(s,"createImageCallback");if(!r){var a=je(s,"ImageClass",Ve);r=function(t,e,i){return new a(t,0,0,e,i)}}for(var n=je(s,"originX",.5),h=je(s,"originY",.5),o=je(s,"add",!0),l=je(s,"align",o),d=je(s,"objectPool",void 0),c=t.scene,u=t.texture,p=function(t,e,i,s,r,a){var n,h;null==i&&(i="__BASE"),a||(h=a,"object"==typeof(n=i)&&(n=n.name),void 0===h&&(h=","),a="__BASE"===n?function(t,e){return`${t}${h}${e}`}:function(t,e){return`${n}_${t}${h}${e}`});for(var o,l,d,c=t.sys.textures.get(e),u="object"==typeof i?i:c.get(i),p=u.width/s,g=u.height/r,v=u.cutX,f=u.cutY,m=0,y=0,C=0;C<r;C++){m=0;for(var b=0;b<s;b++)d=a(b,C),o=m+v,l=y+f,c.add(d,0,o,l,p,g),m+=p;y+=g}return{getFrameNameCallback:a,cellWidth:p,cellHeight:g,columns:s,rows:r}}(c,u,t.frame,e,i),g=p.getFrameNameCallback,v=t.scaleX,f=t.scaleY,m=t.rotation,y=t.getTopLeft(),C=y.x,b=y.y,P=[],x=p.cellWidth*v,k=p.cellHeight*f,S=0;S<i;S++)for(var T=0;T<e;T++){var L,_=g(T,S);if(L=d&&d.length>0?d.pop().setTexture(u,_):r(c,u,_),o&&c.add.existing(L),l){var w=C+x*T+n*x,M=b+k*S+h*k;L.setOrigin(n,h).setPosition(w,M).setScale(v,f).setRotation(m),Ie(L,C,b,m)}P.push(L)}return P}(t,e,i,s),n=0,h=a.length;n<h;n++)(r=a[n]).setVisible(!0),this.add(r);return this.cellImages=a,this.setChildLocalVisible(t,!1),a},gridCutCurrentImage(t,e,i){return this.gridCutImage(this.currentImage,t,e,i)},gridCutNextImage(t,e,i){return this.gridCutImage(this.nextImage,t,e,i)},getCellImages(){return this.cellImages},freeCellImages(){if(0===this.cellImages.length)return this;for(var t,e,i=this.cellImages[0].texture,s=this.cellImages,r=0,a=s.length;r<a;r++)t=s[r],this.setChildLocalAlpha(t,1).setChildLocalScale(t,1).setChildLocalVisible(t,!1),t.clearMask(),e=t.frame.name,t.setTexture(),i.remove(e);return this.imagesPool.push(...s),s.length=0,this}},Ye={setFlipX(t){return this.flipX=t,this},setFlipY(t){return this.flipY=t,this},toggleFlipX(){return this.flipX=!this.flipX,this},toggleFlipY(){return this.flipY=!this.flipY,this},setFlip(t,e){return this.flipX=t,this.flipY=e,this},resetFlip(){return this.flipX=!1,this.flipY=!1,this}},ze={};Object.assign(ze,Dt,Pe,Fe,Xe,Ye);var We=function(t,e,i,s){},Ue=function(t,e,i,s){t.setChildLocalAlpha(e,1-s).setChildLocalAlpha(i,s)},Be=function(t,e,i,s){t.setChildLocalAlpha(e,1)};const Ne=Phaser.Utils.Objects.IsPlainObject,He=Phaser.Utils.Objects.GetValue,Je=Phaser.Math.Clamp;class $e extends Mt{constructor(t,e,i,s,r,a){Ne(e)?(e=He(a=e,"x",0),i=He(a,"y",0),s=He(a,"key",void 0),r=He(a,"frame",void 0)):Ne(r)&&(a=r,r=void 0);var n=He(a,"back",void 0),h=He(a,"front",void 0);n||(n=t.add.image(e,i,s,r)),h||(h=t.add.image(e,i,s,r));var o=He(a,"width",void 0),l=He(a,"height",void 0),d=void 0!==o&&void 0!==l?1:0;void 0===o&&(o=h.width),void 0===l&&(l=h.height),super(t,e,i,o,l),this.type="rexTransitionImage",this._flipX=!1,this._flipY=!1,"string"==typeof(d=He(a,"scaleMode",d))&&(d=qe[d]),this.scaleMode=d,n.setVisible(!1),this.addMultiple([n,h]),this.backImage=n,this.frontImage=h,this.images=[this.backImage,this.frontImage],this.maskGameObject=void 0,this.cellImages=[],this.imagesPool=[],this.transitionModes=void 0,this.currentTransitionMode=void 0;var c=He(a,"onStart",void 0),u=He(a,"onProgress",void 0),p=He(a,"onComplete",void 0),g=He(a,"dir",0);void 0===c&&void 0===u&&void 0===p&&(c=We,u=Ue,p=Be,g=0),this.setTransitionStartCallback(c,He(a,"onStartScope",void 0)).setTransitionProgressCallback(u,He(a,"onProgressScope",void 0)).setTransitionCompleteCallback(p,He(a,"onCompleteScope",void 0)).setTransitionDirection(g).setDuration(He(a,"duration",1e3)).setEaseFunction(He(a,"ease","Linear"));var v=He(a,"mask",void 0);v&&this.setMaskGameObject(v),this.setMaskEnable(!1),this.ignoreCompleteEvent=!1,ve.call(this,this.frontImage)}destroy(t){this.scene&&!this.ignoreDestroy&&(this.backImage=void 0,this.frontImage=void 0,this.images.length=0,this.maskGameObject=void 0,this.cellImages.length=0,this.imagesPool.length=0,this.transitionModes=void 0,super.destroy(t),this.onStartCallback=void 0,this.onStartCallbackScope=void 0,this.onProgressCallback=void 0,this.onProgressCallbackScope=void 0,this.onCompleteCallback=void 0,this.onCompleteCallbackScope=void 0,this.easeValueTask=void 0)}get currentImage(){return 0===this.dir?this.frontImage:this.backImage}get nextImage(){return 0===this.dir?this.backImage:this.frontImage}get texture(){return this.nextImage.texture}get frame(){return this.nextImage.frame}get tint(){return this._tint}set tint(t){this._tint!==t&&(this._tint=t,this.backImage.setTint(t),this.frontImage.setTint(t))}setTint(t){return this.tint=t,this}get flipX(){return this._flipX}set flipX(t){this._flipX!==t&&(this._flipX=t,this.backImage.setFlipX(t),this.frontImage.setFlipX(t))}setFlipX(t){return this.flipX=t,this}toggleFlipX(){return this.flipX=!this.flipX,this}get flipY(){return this._flipY}set flipY(t){this._flipY!==t&&(this._flipY=t,this.backImage.setFlipY(t),this.frontImage.setFlipY(t))}setFlipY(t){return this.flipY=t,this}toggleFlipY(){return this.flipY=!this.flipY,this}setFlip(t,e){return this.flipX=t,this.flipY=e,this}get t(){return this._t}set t(t){if(t=Je(t,0,1),this._t!==t){this._t=t;var e=this.currentImage,i=this.nextImage;if(0===t&&(this.setChildVisible(this.frontImage,!0).setChildVisible(this.backImage,!0),Ze.call(this,this.onStartCallback,this.onStartCallbackScope,this,e,i,t)),Ze.call(this,this.onProgressCallback,this.onProgressCallbackScope,this,e,i,t),1===t){Ze.call(this,this.onCompleteCallback,this.onCompleteCallbackScope,this,e,i,t);var s=i.texture.key,r=i.frame.name;this.frontImage.setTexture(s,r),this.backImage.setTexture(s,r),ve.call(this,i),this.setChildVisible(this.frontImage,!0).setChildVisible(this.backImage,!1).setMaskEnable(!1).freeCellImages()}1!==t||this.ignoreCompleteEvent||this.emit("complete")}}setT(t){return this.t=t,this}get isRunning(){return!!this.easeValueTask&&this.easeValueTask.isRunning}setOrigin(t,e){return super.setOrigin(t,e),this.backImage.setOrigin(t,e),this.frontImage.setOrigin(t,e),this.maskGameObject&&this.maskGameObject.setOrigin(t,e),this}setTexture(t,e){return this.frontImage.setTexture(t,e),this.backImage.setTexture(t,e).setVisible(!1),ve.call(this,this.frontImage),this}setSize(t,e){return super.setSize(t,e),this.scaleMode&&ge.call(this),this}}var Ze=function(t,e,i,s,r,a){var n;t&&(this.scaleMode&&(s.biasScale>0&&(n=this.getChildLocalScaleX(s),n/=s.biasScale,this.setChildLocalScale(s,n)),r.biasScale&&(n=this.getChildLocalScaleX(r),n/=r.biasScale,this.setChildLocalScale(r,n))),e?t.call(e,i,s,r,a):t(i,s,r,a),this.scaleMode&&(s.biasScale>0&&(n=this.getChildLocalScaleX(s),n*=s.biasScale,this.setChildLocalScale(s,n)),r.biasScale&&(n=this.getChildLocalScaleX(r),n*=r.biasScale,this.setChildLocalScale(r,n))))};Object.assign($e.prototype,ze);const qe={fit:1,FIT:1,envelop:2,ENVELOP:2};var Ke=function(t,e){return void 0===e&&(e=.5),t<=e?t/=e:t=1-(t-e)/(1-e),t};const Qe=Phaser.GameObjects.GetCalcMatrix,ti=Phaser.Renderer.Canvas.SetTransform;var ei={renderWebGL:function(t,e,i,s){e.updateData();var r=i.camera;r.addToRenderList(e);for(var