UNPKG

phaser3-rex-plugins

Version:
1 lines 56.1 kB
var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.Mesh;class e extends t{get tint(){return 0===this.vertices.length?16777215:this.vertices[0].color}forceUpdate(){return this.dirtyCache[10]=1,this}}const i=Phaser.Math.Vector3,s=Phaser.Math.Matrix4;var r=new i,n=new i,a=new s;const h=Phaser.Utils.Objects.IsPlainObject,o=Phaser.Utils.Objects.GetValue,l=Phaser.Geom.Mesh.GenerateGridVerts,c=Phaser.Math.RadToDeg,d=Phaser.Math.DegToRad,u=1+1/Math.sin(d(45));class p extends e{constructor(t,e,i,s,r,n){h(e)&&(e=o(n=e,"x",0),i=o(n,"y",0),s=o(n,"key",null),r=o(n,"frame",null)),super(t,e,i,s,r),this.type="rexPerspectiveImage",this.setSizeToFrame(),this.resetPerspective(),this.panZ(u),this.hideCCW=o(n,"hideCCW",!0);var a=o(n,"gridWidth",0),l=o(n,"gridHeight",a);this.resetVerts(a,l),this.prevFrame=this.frame}preUpdate(t,e){this.prevFrame!==this.frame&&(this.prevFrame=this.frame,this.syncSize()),super.preUpdate(t,e)}get originX(){return.5}get originY(){return.5}resetPerspective(){return this.setPerspective(this.width,this.height,45),this}resetVerts(t,e){if(void 0!==t&&(this.gridWidth=t),void 0!==e&&(this.gridHeight=e),this.clear(),this.dirtyCache[9]=-1,0===this.width||0===this.height)return this;var i=this.frame.cutWidth,s=this.frame.cutHeight;0===this.gridWidth?t=Math.max(i/8,32):e=this.gridWidth,e=0===this.gridHeight?Math.max(s/8,32):this.gridHeight,l({mesh:this,width:i/this.height,height:s/this.height,widthSegments:Math.ceil(i/t),heightSegments:Math.ceil(s/e)});var r=this.transformInfo;return r&&this.transformVerts(r.x,r.y,r.z,r.rotateX,r.rotateY,r.rotateZ),this}syncSize(){return this.setSizeToFrame(),this.resetPerspective(),this.resetVerts(),this}get rotationX(){return this.modelRotation.x}set rotationX(t){this.modelRotation.x=t}get angleX(){return c(this.rotationX)}set angleX(t){this.rotationX=d(t)}get rotationY(){return this.modelRotation.y}set rotationY(t){this.modelRotation.y=t}get angleY(){return c(this.rotationY)}set angleY(t){this.rotationY=d(t)}get rotationZ(){return this.modelRotation.z}set rotationZ(t){this.modelRotation.z=t}get angleZ(){return c(this.rotationZ)}set angleZ(t){this.rotationZ=d(t)}transformVerts(t,e,i,s,h,o){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),this.transformInfo||(this.transformInfo={}),this.transformInfo.x=t,this.transformInfo.y=e,this.transformInfo.rotateX=s,this.transformInfo.rotateY=h,this.transformInfo.rotateZ=o,function(t,e,i,s,h,o,l){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===h&&(h=0),void 0===o&&(o=0),void 0===l&&(l=0),r.set(e,i,s),n.set(h,o,l),a.fromRotationXYTranslation(n,r,!0);for(var c=0,d=t.vertices.length;c<d;c++)t.vertices[c].transformMat4(a)}(this,t,e,i,s,h,o),this}}function v(t,e,i,s,r){var n=new p(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n}const g=Phaser.Utils.Objects.GetAdvancedValue,y=Phaser.GameObjects.BuildGameObject;function f(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=g(t,"key",null),s=g(t,"frame",null),r=new p(this.scene,0,0,i,s,t);return y(this.scene,r,t),r}const m=Phaser.Textures.DynamicTexture;var C=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},b=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};const x=Phaser.Geom.Rectangle,P=Phaser.Math.Vector2,R=Phaser.Math.RotateAround,S=Phaser.GameObjects.Container;var w=function(t,e){if(void 0===e?e=new x:!0===e&&(void 0===A&&(A=new x),e=A),t.getBounds&&!(t instanceof S))return t.getBounds(e);var i,s,r,n,a,h,o,l;if(t.parentContainer){var c=t.parentContainer.getBoundsTransformMatrix();E(t,e),c.transformPoint(e.x,e.y,e),i=e.x,s=e.y,F(t,e),c.transformPoint(e.x,e.y,e),r=e.x,n=e.y,T(t,e),c.transformPoint(e.x,e.y,e),a=e.x,h=e.y,L(t,e),c.transformPoint(e.x,e.y,e),o=e.x,l=e.y}else E(t,e),i=e.x,s=e.y,F(t,e),r=e.x,n=e.y,T(t,e),a=e.x,h=e.y,L(t,e),o=e.x,l=e.y;return e.x=Math.min(i,r,a,o),e.y=Math.min(s,n,h,l),e.width=Math.max(i,r,a,o)-e.x,e.height=Math.max(s,n,h,l)-e.y,e},A=void 0,E=function(t,e,i){return void 0===e?e=new P:!0===e&&(void 0===k&&(k=new P),e=k),t.getTopLeft?t.getTopLeft(e,i):(e.x=t.x-C(t)*t.originX,e.y=t.y-b(t)*t.originY,O(t,e,i))},F=function(t,e,i){return void 0===e?e=new P:!0===e&&(void 0===k&&(k=new P),e=k),t.getTopRight?t.getTopRight(e,i):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-b(t)*t.originY,O(t,e,i))},T=function(t,e,i){return void 0===e?e=new P:!0===e&&(void 0===k&&(k=new P),e=k),t.getBottomLeft?t.getBottomLeft(e,i):(e.x=t.x-C(t)*t.originX,e.y=t.y-b(t)*t.originY+b(t),O(t,e,i))},L=function(t,e,i){return void 0===e?e=new P:!0===e&&(void 0===k&&(k=new P),e=k),t.getBottomRight?t.getBottomRight(e,i):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-b(t)*t.originY+b(t),O(t,e,i))},k=void 0,O=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&R(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const D=Phaser.Geom.Rectangle,M=Phaser.Geom.Rectangle.Union;var Y,j=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}: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]}(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},_=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};const X=Phaser.GameObjects.GameObject,G=Phaser.GameObjects.Layer;var V=Phaser.Utils.Objects.GetValue,I=function(t){if(t){var e,i,s=t.gameObjects,r=t.renderTexture,n=t.saveTexture,a=V(t,"x",void 0),h=V(t,"y",void 0),o=V(t,"width",void 0),l=V(t,"height",void 0),c=V(t,"originX",0),d=V(t,"originY",0),u=V(t,"padding",0);if(void 0===o||void 0===l||void 0===a||void 0===h){var p=function(t,e){var i;void 0===e?e=new D:!0===e&&(void 0===Y&&(Y=new D),e=Y),e.setTo(0,0,0,0);for(var s=!0,r=0,n=t.length;r<n;r++)if((i=t[r]).getBounds){var a=w(i,!0);s?(e.setTo(a.x,a.y,a.width,a.height),s=!1):M(a,e,e)}return e}(s,!0);void 0!==a&&void 0!==h?(o=2*Math.max(a-p.left,p.right-a),l=2*Math.max(h-p.top,p.bottom-h),c=.5,d=.5):(a=p.x,h=p.y,o=p.width,l=p.height,c=0,d=0),e=p.x,i=p.y}else e=a+(0-c)*o,i=h+(0-d)*l;e-=u,i-=u,o+=2*u,l+=2*u;var v,g=s[0].scene,y=g.sys.textures;return n&&!r&&(r=y.addDynamicTexture(n,o,l)),r||(r=g.add.renderTexture(0,0,o,l)),r.setPosition&&r.setPosition(a,h),r.width===o&&r.height===l||r.setSize(o,l),r.setOrigin&&r.setOrigin(c,d),r.camera.setScroll(e,i),s=_(j(s)),r.draw(s),n&&((v=r)instanceof X||v instanceof G?r.saveTexture(n):r.key!==n&&y.renameTexture(r.key,key)),r}};const B=Phaser.Utils.Objects.IsPlainObject,U=Phaser.Utils.Objects.GetValue;let N=class extends p{constructor(t,e,i,s,r,n){B(e)&&(e=U(n=e,"x",0),i=U(n,"y",0),s=U(n,"width",32),r=U(n,"height",32));var a=function(t,e,i){return void 0===e&&(e=2),void 0===i&&(i=2),new m(t.sys.textures,null,e,i)}(t,s,r);super(t,e,i,a,null,n),this.type="rexPerspectiveRenderTexture",this.rt=this.texture}destroy(t){this.scene&&!this.ignoreDestroy&&(super.destroy(t),this.rt.destroy(),this.rt=null)}snapshot(t,e){return void 0===e&&(e={}),e.gameObjects=t,e.renderTexture=this.rt,I(e),this.width===this.frame.realWidth&&this.height===this.frame.realHeight||this.syncSize(),this}};function W(t,e,i,s,r){var n=new N(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n}const Z=Phaser.Utils.Objects.GetAdvancedValue,z=Phaser.GameObjects.BuildGameObject;function H(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=Z(t,"width",32),s=Z(t,"height",32),r=new N(this.scene,0,0,i,s,t);return z(this.scene,r,t),r}const J=Phaser.Animations.AnimationState,q=Phaser.Utils.Objects.IsPlainObject,$=Phaser.Utils.Objects.GetValue;class K extends p{constructor(t,e,i,s,r,n){q(e)&&(e=$(n=e,"x",0),i=$(n,"y",0),s=$(n,"key",null),r=$(n,"frame",null)),super(t,e,i,s,r,n),this.type="rexPerspectiveSprite",this.anims=new J(this)}preDestroy(){super.preDestroy(),this.anims.destroy(),this.anims=void 0}preUpdate(t,e){this.anims.update(t,e),super.preUpdate(t,e)}play(t,e,i){return this.anims.play(t,e,i)}playReverse(t,e){return this.anims.playReverse(t,e)}playAfterDelay(t,e){return this.anims.playAfterDelay(t,e)}playAfterRepeat(t,e){return this.anims.playAfterRepeat(t,e)}chain(t){return this.anims.chain(t)}stop(){return this.anims.stop()}stopAfterDelay(t){return this.anims.stopAfterDelay(t)}stopAfterRepeat(t){return this.anims.stopAfterRepeat(t)}stopOnFrame(t){return this.anims.stopOnFrame(t)}}function Q(t,e,i,s,r){var n=new K(this.scene,t,e,i,s,r);return this.scene.add.existing(n),n}const tt=Phaser.Utils.Objects.GetAdvancedValue,et=Phaser.GameObjects.BuildGameObject;function it(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=tt(t,"key",null),s=tt(t,"frame",null),r=new K(this.scene,0,0,i,s,t);return et(this.scene,r,t),r}var st=!1,rt={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 a=-1!==e.blendMode;a||t.setBlendMode(0);for(var h=0;h<n;h++){var o=r[h];if(o.willRender(i)){a||o.blendMode===t.currentBlendMode||t.setBlendMode(o.blendMode);var l=o.mask;l&&l.preRenderWebGL(t,o,i);var c=o.type;c!==t.currentType&&(t.newType=!0,t.currentType=c),t.nextTypeMatch=h<n-1&&r[h+1].type===t.currentType,o.renderWebGL(t,o,i),l&&l.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 a=0;a<r.length;a++){var h=r[a];h.willRender(i)&&(n||h.blendMode===t.currentBlendMode||t.setBlendMode(h.blendMode),h.renderCanvas(t,h,i))}e.mask&&e.mask.postRenderCanvas(t)}}}}};const nt=Phaser.Structs.List,at=Phaser.Utils.Array.StableSort,ht=Phaser.GameObjects.Events,ot=Phaser.Scenes.Events;class lt extends nt{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(ht.ADDED_TO_SCENE,t,this.scene),this.events.emit(ot.ADDED_TO_SCENE,t,this.scene))}removeChildCallback(t){this.queueDepthSort(),t.displayList===this&&(t.displayList=null),t.emit(ht.REMOVED_FROM_SCENE,t,this.scene),this.events.emit(ot.REMOVED_FROM_SCENE,t,this.scene)}queueDepthSort(){return this.sortChildrenFlag=!0,this}depthSort(){return!this.sortChildrenFlag||this.list.length<2?(this.sortChildrenFlag=!1,this):(at(this.list,this.sortByDepth),this.sortChildrenFlag=!1,this)}sortByDepth(t,e){return t._depth-e._depth}}!function(t){if(!st){void 0===t&&(t=60);var e=Phaser.VERSION.split("."),i=parseInt(e[0]);if(3===i){var s=parseInt(e[1]);s<t&&console.error(`Minimum supported version : ${i}.${s}`)}else console.error(`Can't supported version : ${i}`);st=!0}}();const ct=Phaser.GameObjects.Zone,dt=Phaser.Utils.Array.Add,ut=Phaser.Utils.Array.Remove;class pt extends ct{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 dt(this.children,t,0,(function(t){t.once("destroy",this.onChildDestroy,this),this.addChildCallback(t)}),this),this}remove(t,e){return ut(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 lt(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 vt=Phaser.GameObjects.Components;Phaser.Class.mixin(pt,[vt.Alpha,vt.Flip]),Object.assign(pt.prototype,rt);var gt=function(t,e){var i;if(void 0===e)t.hasOwnProperty("rexContainer")&&(i=t.rexContainer.parent);else for(i=gt(t);i&&i.name!==e;)i=gt(i);return i};const yt=Phaser.Math.DegToRad,ft=Phaser.Math.RadToDeg;var mt=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 ft(this.rotation)},set:function(t){this.rotation=yt(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},Ct={setParent(t,e){void 0===e&&(e=this);var i=mt(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),gt(t,e)},getTopmostParent(t){return void 0===t&&(t=this),function(t){for(var e=gt(t);e;)t=e,e=gt(e);return t}(t)}};const bt=Phaser.Utils.Objects.GetValue,xt=pt.prototype.add;var Pt=function(t,e){this.setParent(t);var i=mt(t);return St(i,e),this.resetChildState(t).updateChildVisible(t).updateChildActive(t).updateChildScrollFactor(t).updateChildMask(t).updateCameraFilter(t),xt.call(this,t),wt.call(this,t,i),this},Rt=function(t,e){this.setParent(t);var i=mt(t);return St(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),xt.call(this,t),wt.call(this,t,i),this},St=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=bt(e,"syncPosition",!0),t.syncRotation=bt(e,"syncRotation",!0),t.syncScale=bt(e,"syncScale",!0),t.syncAlpha=bt(e,"syncAlpha",!0),t.syncScrollFactor=bt(e,"syncScrollFactor",!0),t.syncCameraFilter=bt(e,"syncCameraFilter",!0),t.syncDisplayList=bt(e,"syncDisplayList",!0))},wt=function(t,e){this.addToParentContainer(t),e.syncDisplayList&&this.addToPatentLayer(t)},At={add(t){return Array.isArray(t)?this.addMultiple(t):Pt.call(this,t),this},pin(t,e){return Array.isArray(t)?this.addMultiple(t,e):Pt.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):Rt.call(this,t),this},pinLocal(t,e){return Array.isArray(t)?this.addMultiple(t,e):Rt.call(this,t,e),this},addLocalMultiple(t){for(var e=0,i=t.length;e<i;e++)Rt.call(this,t[e]);return this}};const Et=pt.prototype.remove,Ft=pt.prototype.clear;var Tt={remove(t,e){return gt(t)!==this||(this.setParent(t,null),Et.call(this,t,e)),this},unpin(t,e){return gt(t)!==this||(this.setParent(t,null),Et.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 Ft.call(this,t),this}},Lt={getLocalState:t=>mt(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}},kt={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}},Ot=function(t,e){return t===e?1:t/e},Dt={updateChildPosition(t){t.isRexContainerLite&&(t.syncChildrenEnable=!1);var e=mt(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=mt(t),i=e.parent;return e.x=t.x,e.y=t.y,i.worldToLocal(e),e.scaleX=Ot(t.scaleX,i.scaleX),e.scaleY=Ot(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=mt(t);return s.x=e,s.y=i,this.updateChildPosition(t),this},resetLocalPositionState(){var t=mt(this).parent;return t&&t.resetChildPositionState(this),this},getChildLocalX:t=>mt(t).x,getChildLocalY:t=>mt(t).y};const Mt=Phaser.Math.DegToRad;var Yt={updateChildRotation(t){var e=mt(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=mt(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 mt(t).rotation=e,this.updateChildRotation(t),this},setChildLocalAngle(t,e){return mt(t).rotation=Mt(e),this.updateChildRotation(t),this},resetLocalRotationState(){var t=mt(this).parent;return t&&t.resetChildRotationState(this),this},getChildLocalRotation:t=>mt(t).rotation},jt={updateChildScale(t){var e=mt(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=mt(t),i=e.parent;return e.scaleX=Ot(t.scaleX,i.scaleX),e.scaleY=Ot(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=mt(t);return s.scaleX=e,s.scaleY=i,this.updateChildScale(t),this},setChildLocalScaleX(t,e){return mt(t).scaleX=e,this.updateChildScale(t),this},setChildLocalScaleY(t,e){return mt(t).scaleY=e,this.updateChildScale(t),this},setChildDisplaySize(t,e,i){return t.setDisplaySize(e,i),this.resetChildScaleState(t),this},resetLocalScaleState(){var t=mt(this).parent;return t&&t.resetChildScaleState(this),this},getChildLocalScaleX:t=>mt(t).scaleX,getChildLocalScaleY:t=>mt(t).scaleY},_t={updateChildVisible(t){var e=mt(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=mt(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),mt(t).visible=e,this.updateChildVisible(t),this},setChildMaskVisible(t,e){return void 0===e&&(e=!0),mt(t).maskVisible=e,this.updateChildVisible(t),this},resetLocalVisibleState(){var t=mt(this).parent;return t&&t.resetChildVisibleState(this),this},getChildLocalVisible:t=>mt(t).visible},Xt={updateChildAlpha(t){var e=mt(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=mt(t),i=e.parent;return e.alpha=Ot(t.alpha,i.alpha),this},setChildAlpha(t,e){return t.alpha=e,this.resetChildAlphaState(t),this},setChildLocalAlpha(t,e){return mt(t).alpha=e,this.updateChildAlpha(t),this},resetLocalAlphaState(){var t=mt(this).parent;return t&&t.resetChildAlphaState(this),this},getChildLocalAlpha:t=>mt(t).alpha},Gt={updateChildActive(t){var e=mt(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 mt(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),mt(t).active=e,this.updateChildActive(t),this},resetLocalActiveState(){var t=mt(this).parent;return t&&t.resetChildActiveState(this),this},getChildLocalActive:t=>mt(t).active},Vt={updateChildScrollFactor(t){var e=mt(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}},It={updateCameraFilter(t){var e=mt(t),i=e.parent;return e.syncCameraFilter&&(t.cameraFilter=i.cameraFilter),this},syncCameraFilter(){return this.syncChildrenEnable&&this.children.forEach(this.updateCameraFilter,this),this}},Bt={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}},Ut=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))}))},Nt={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]);_(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]);_(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]);_(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]);_(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=Ut(e,t),e=_(e,!1)):e=[t],this.layerRendererEnable)i=this;else{var s=this.getAllChildren([this]);s=Ut(s,t),i=(s=_(s,!1))[s.length-1]}for(var r=0,n=e.length;r<n;r++){var a=e[r];i!==a&&(a!==this&&i.displayList!==a.displayList||(i.displayList.moveAbove(a,i),i=a))}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=Ut(e,t),e=_(e,!1)):e=[t],this.layerRendererEnable)i=this;else{var s=this.getAllChildren([this]);s=Ut(s,t),i=(s=_(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}},Wt=function(t,e){if(!e(t)&&t.isRexContainerLite)for(var i=t.children,s=0,r=i.length;s<r;s++)Wt(i[s],e)},Zt=function(t,e){for(var i=[t];i.length>0;){var s=i.shift();!e(s)&&s.isRexContainerLite&&i.push(...s.children)}};const zt=Phaser.Utils.Array;var Ht={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 Zt(e,(function(i){i!==e&&t.push(i)})),t},getAllVisibleChildren(t){void 0===t&&(t=[]);var e=this;return Zt(e,(function(i){if(i!==e)return!i.visible||void t.push(i)})),t},bfs(t,e){return void 0===e&&(e=this),Zt(e,t),this},dfs(t,e){return void 0===e&&(e=this),Wt(e,t),this},contains(t){var e=gt(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,a=(i=r.shift()).children.length;n<a;n++){if((s=i.children[n]).name===t)return s;s.isRexContainerLite&&r.push(s)}return null}return zt.GetFirst(this.children,"name",t)},getRandom(t,e){return zt.GetRandom(this.children,t,e)},getFirst(t,e,i,s){return zt.GetFirstElement(this.children,t,e,i,s)},getAll(t,e,i,s){return zt.GetAll(this.children,t,e,i,s)},count(t,e,i,s){return zt.CountAllMatching(this.children,t,e,i,s)},swap(t,e){return zt.Swap(this.children,t,e),this},setAll(t,e,i,s){return zt.SetAll(this.children,t,e,i,s),this}},Jt=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},qt=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()},$t={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=Jt(e);var s=i.tweens.add(t);return s.on("update",qt),s}},tweenSelf(t){return t.targets=[this],this.tweenChild(t)},createTweenChildConfig(t){var e=t.targets;e&&(Array.isArray(e)||(e=[e]),t.targets=Jt(e));var i=t.onUpdate;return t.onUpdate=function(t,e){i&&i(t,e),qt(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 Kt=Phaser.GameObjects.Layer;var Qt=function(t){return t instanceof Kt},te=function(t){var e=t.getAllChildren([t]);return e=e.filter((function(t){return!!t.displayList||!!t.parentContainer}))},ee=function(t){var e=te(this);-1===e.indexOf(this)&&e.push(this),_(e),t.add(e)},ie=function(t,e,i){if(this.scene){var s=te(this);_(s,e),t.remove(s),i&&s.forEach((function(t){t.addToDisplayList()}))}},se={addToContainer(t){return this._setParentContainerFlag=!0,ee.call(this,t),this._setParentContainerFlag=!1,this},addToLayer(t){return ee.call(this,t),this},removeFromContainer(){return this.parentContainer?(this._setParentContainerFlag=!0,ie.call(this,this.parentContainer,!0,!1),this._setParentContainerFlag=!1,this):this},removeFromLayer(t){return void 0===t&&(t=!0),Qt(this.displayList)?(ie.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||Qt(e)&&(t.isRexContainerLite?t.addToLayer(e):e.add(t)),this}},re=function(){if(this.rendererLayer)return this.rendererLayer;for(var t=this.getParent();t;){if(t.rendererLayer)return t.rendererLayer;t=t.getParent()}return null},ne={hasLayer(){return this.layerRendererEnable},enableLayer(){return this.enableLayerRenderer(),this},getLayer(){return this.enableLayerRenderer(),this},addChildCallback(t){if(t.displayList){var e=re.call(this);e&&e!==t.displayList&&(t.isRexContainerLite?t.addToLayer(e):e.add(t),mt(t).layer=e)}},removeChildCallback(t,e){var i=mt(t),s=i.layer;s&&(t.isRexContainerLite?t.removeFromLayer(!0):s.remove(t),i.layer=null)}},ae={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=I(t),n=!!r.scene;return s||(this.setScale(e,i),n&&r.setScale(e,i)),n?r:this}};const he=Phaser.Utils.Objects.GetValue;var oe=function(t,e,i,s,r,n,a,h){if(t.getBounds||void 0!==t.width&&void 0!==t.height){var o=E(t,le[0],h);o.x-=a,o.y-=a;var l=F(t,le[1],h);l.x+=a,l.y-=a;var c=L(t,le[2],h);c.x+=a,c.y+=a;var d=T(t,le[3],h);d.x-=a,d.y+=a,null!==r&&e.fillStyle(r,n).fillPoints(le,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(le,!0,!0)}},le=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}];const ce=Phaser.Utils.Objects.GetValue,de=Phaser.Math.RotateAround;var ue={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};de(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=ce(e,"drawContainer",!0),s=ce(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,a,h,o;if("number"==typeof i?s=i:(s=he(i,"color"),r=he(i,"lineWidth"),n=he(i,"fillColor"),a=he(i,"fillAlpha"),h=he(i,"padding"),o=he(i,"includeParent")),void 0===s&&(s=16777215),void 0===r&&(r=1),void 0===n&&(n=null),void 0===a&&(a=1),void 0===h&&(h=0),void 0===o&&(o=!0),Array.isArray(t))for(var l=0,c=t.length;l<c;l++)oe(t[l],e,s,r,n,a,h,o);else oe(t,e,s,r,n,a,h,o)}(s,t,e),this}};Object.assign(ue,Ct,At,Tt,Lt,kt,Dt,Yt,jt,_t,Xt,Gt,Vt,It,Bt,Nt,Ht,$t,se,ne,ae);class pe extends pt{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 gt(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=gt(this);return!!t&&t.setParentContainerFlag}}Object.assign(pe.prototype,ue);var ve=function(t,e,i,s){if(Array.isArray(t))for(var r=0,n=t.length;r<n;r++){var a=t[r];if((!s||a)&&(i?e.call(i,a,r,t):e(a,r,t)))return}else for(var h in t)if(a=t[h],(!s||a)&&(i?e.call(i,a,h,t):e(a,h,t)))return};const ge=Phaser.Math.RadToDeg,ye=Phaser.Math.DegToRad;class fe extends pe{constructor(t,e,i,s,r,n){super(t,e,i,s,r),this.faces=n,ve(n,(function(t){t.setPosition(e,i),this.add(t)}),this,!0)}get rotationX(){return 0}set rotationX(t){}get angleX(){return ge(this.rotationX)}set angleX(t){this.rotationX=ye(t)}get rotateX(){return ge(this.rotationX)}set rotateX(t){this.rotationX=ye(t)}get rotationY(){return 0}set rotationY(t){}get angleY(){return ge(this.rotationY)}set angleY(t){this.rotationY=ye(t)}get rotateY(){return ge(this.rotationY)}set rotateY(t){this.rotationY=ye(t)}get rotationZ(){return 0}set rotationZ(t){}get angleZ(){return ge(this.rotationZ)}set angleZ(t){this.rotationZ=ye(t)}get rotateZ(){return ge(this.rotationZ)}set rotateZ(t){this.rotationZ=ye(t)}setDebug(t,e){return ve(this.faces,(function(i){i.setDebug(t,e)}),null,!0),this}panX(t){return ve(this.faces,(function(e){e.panX(t)}),null,!0),this}panY(t){return ve(this.faces,(function(e){e.panY(t)}),null,!0),this}panZ(t){return ve(this.faces,(function(e){e.panZ(t)}),null,!0),this}transformVerts(t,e,i,s,r,n){return ve(this.faces,(function(a){a.transformVerts(t,e,i,s,r,n)}),null,!0),this}forEachFace(t,e,i){return ve(this.faces,t,e,i),this}}const me=Phaser.Utils.Objects.IsPlainObject,Ce={key:"__WHITE"},be={image:p,rendertexture:N};var xe=function(t,e){var i;return void 0===e&&(e=Ce),me(e)?(e.hasOwnProperty("type")||(e.hasOwnProperty("key")?e.type="image":e.hasOwnProperty("width")&&(e.type="rendertexture")),i=new be[e.type](t,e),t.add.existing(i)):i=e,i},Pe=function(t,e,i){var s;if(void 0===i){var r;s=[];for(var n=0,a=e.length;n<a;n++)h=(r=e[n])?xe(t,r):null,s.push(h)}else{var h,o;for(s={},n=0,a=i.length;n<a;n++)o=i[n],h=e.hasOwnProperty(o)?xe(t,e[o]):null,s[o]=h}return s};const Re=(0,Phaser.Math.DegToRad)(180);var Se={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 we=Phaser.Scene;var Ae=function(t){return t instanceof we};const Ee=Phaser.Game;var Fe=function(t){return t instanceof Ee};const Te=Phaser.Utils.Objects.GetValue;class Le{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(Te(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){var e;return this.parent=t,this.scene=null==(e=t)||"object"!=typeof e?null:Ae(e)?e:e.scene&&Ae(e.scene)?e.scene:e.parent&&e.parent.scene&&Ae(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:Fe(t)?t:Fe(t.game)?t.game:Ae(t)?t.sys.game:Ae(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(Le.prototype,Se);const ke=Phaser.Utils.Objects.GetValue;class Oe extends Le{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(ke(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=De[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 De={no:0,lazy:1,always:2},Me=Phaser.Utils.Objects.GetValue;class Ye extends Oe{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=Me(e,"tickEventName",i),this.isSceneTicker=!je(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 je=function(t){return"step"===t||"poststep"===t};const _e=Phaser.Utils.Objects.GetValue,Xe=Phaser.Math.Clamp;class Ge{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=_e(t,"state",Ve),this.timeScale=_e(t,"timeScale",1),this.delay=_e(t,"delay",0),this.repeat=_e(t,"repeat",0),this.repeatCounter=_e(t,"repeatCounter",0),this.repeatDelay=_e(t,"repeatDelay",0),this.duration=_e(t,"duration",0),this.nowTime=_e(t,"nowTime",0),this.justRestart=_e(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?Be:Ie,this.repeatCounter=0,this}stop(){return this.state=Ve,this}update(t,e){this.state!==Ve&&this.state!==Ne&&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=Ue)):(this.nowTime=this.duration,this.state=Ne):this.nowTime>=0&&(this.state=Be))}get t(){var t;switch(this.state){case Ve:case Ie:case Ue:t=0;break;case Be:t=this.nowTime/this.duration;break;case Ne:t=1}return Xe(t,0,1)}set t(t){(t=Xe(t,-1,1))<0?(this.state=Ie,this.nowTime=-this.delay*t):(this.state=Be,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===Ve}get isDelay(){return this.state===Ie}get isCountDown(){return this.state===Be}get isRunning(){return this.state===Ie||this.state===Be}get isDone(){return this.state===Ne}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const Ve=0,Ie=1,Be=2,Ue=3,Ne=-1;class We extends Ye{constructor(t,e){super(t,e),this.timer=new Ge}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 Ze=Phaser.Utils.Objects.GetValue,ze=Phaser.Utils.Objects.GetAdvancedValue,He=Phaser.Tweens.Builders.GetEaseFunction;class Je extends We{resetFromJSON(t){return this.timer.resetFromJSON(Ze(t,"timer")),this.setEnable(Ze(t,"enable",!0)),this.setTarget(Ze(t,"target",this.parent)),this.setDelay(ze(t,"delay",0)),this.setDuration(ze(t,"duration",1e3)),this.setEase(Ze(t,"ease","Linear")),this.setRepeat(Ze(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=He(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 qe=Phaser.Utils.Objects.GetValue,$e=Phaser.Math.Linear;class Ke extends Je{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setEase(qe(t,"ease","Cubic")),this.setFrontToBackDirection(qe(t,"frontToBack",0)),this.setBackToFrontDirection(qe(t,"backToFront",1)),this}setFrontToBackDirection(t){return"string"==typeof t&&(t=Qe[t]),this.endAngleFB=0===t?180:-180,this}setBackToFrontDirection(t){return"string"==typeof t&&(t=Qe[t]),this.endAngleBF=0===t?-180:180,this}start(t,e){if(this.timer.isRunning)return this;this.timer.setDelay(this.delay).setDuration(t);var i=e+1;return 0===this.parent.face?(this.startAngle=0,this.endAngle=this.endAngleFB*i):(this.startAngle=this.endAngleBF,this.endAngle=this.startAngle-this.endAngleBF*i),super.start(),this}flip(t,e){return this.isRunning||(void 0===t&&(t=this.duration),void 0===e&&(e=0),this.start(t,e),this.emit("start",this.parent,this),this.parent.currentFaceIndex=(this.parent.currentFaceIndex+e+1)%2),this}flipRight(t,e){return 0===this.parent.currentFaceIndex?this.setFrontToBackDirection(0):this.setBackToFrontDirection(0),this.flip(t,e),this}flipLeft(t,e){return 0===this.parent.currentFaceIndex?this.setFrontToBackDirection(1):this.setBackToFrontDirection(1),this.flip(t,e),this}updateTarget(t,e){var i=this.easeFn(e.t),s=$e(this.startAngle,this.endAngle,i);0===t.orientation?t.angleY=s:t.angleX=s}}const Qe={right:0,"left-to-right":0,left:1,"right-to-left":1},ti=Phaser.Utils.Objects.IsPlainObject,ei=Phaser.Utils.Objects.GetValue,ii=["back","front"];class si extends fe{constructor(t,e,i,s){ti(e)&&(e=ei(s=e,"x",0),i=ei(s,"y",0));var r=Pe(t,s,ii),n=r.back,a=r.front,h=ei(s,"width"),o=ei(s,"height");if(void 0===h||void 0===o){if(void 0===h){var l=a?a.width:0,c=n?n.width:0;h=Math.max(l,c)}if(void 0===o){var d=a?a.height:0,u=n?n.height:0;o=Math.max(d,u)}}super(t,e,i,h,o,r),this.type="rexPerspectiveCard",this.frontFaceRotationX=0,this.frontFaceRotationY=0,this.frontFaceRotationZ=0,ve(r,(function(t,e){this[`${e}Face`]=t}),this);var p=ei(s,"flip",void 0);!1!==p&&(this.flip=new Ke(this,p)),this.setOrientation(ei(s,"orientation",0)),function(t,e){var i=e.back;i&&(0===t.orientation?i.transformVerts(0,0,0,0,Re,0):i.transformVerts(0,0,0,Re,0,0))}(this,r),this.setFace(ei(s,"face",0))}get rotationX(){return this.frontFaceRotationX}set rotationX(t){this.frontFaceRotationX!==t&&(this.frontFaceRotationX=t,ve(this.faces,(function(e){e.rotationX=t}),null,!0))}get rotationY(){return this.frontFaceRotationY}set rotationY(t){this.frontFaceRotationY!==t&&(this.frontFaceRotationY=t,ve(this.faces,(function(e){e.rotationY=t}),null,!0))}get rotationZ(){return this.frontFaceRotationZ}set rotationZ(t){this.frontFaceRotationZ!==t&&(this.frontFaceRotationZ=t,ve(this.faces,(function(e){e.rotationZ=t}),null,!0))}setOrientation(t){return"string"==typeof t&&(t=ri[t]),this.orientation=t,this}get face(){return this.currentFaceIndex}set face(t){"string"==typeof t&&(t=ni[t]),this.currentFaceIndex=t;var e=1===t?180:0;0===this.orientation?this.angleY=e:this.angleX=e}setFace(t){return this.face=t,this}toggleFace(){var t=0===this.face?1:0;return this.setFace(t),this}}const ri={x:0,horizontal:0,h:0,y:1,vertical:1,v:1},ni={front:0,back:1};function ai(t,e,i){var s=new si(this.scene,t,e,i);return this.scene.add.existing(s),s}const hi=Phaser.GameObjects.BuildGameObject;function oi(t,e){void 0===t&&(t={}),void 0!==e&&(t.add=e);var i=new si(this.scene,0,0,t);return hi(this.scene,i,t),i}var li=function(t,e){for(var i=0,s=t.length;i<s;i++)if(face&&face.name===e)return i;return-1};const ci=Phaser.Utils.Objects.GetValue,di=Phaser.Math.RadToDeg,ui=Phaser.Math.DegToRad,pi=Phaser.Math.Angle.WrapDegrees,vi=Phaser.Math.Angle.ShortestBetween,gi=Phaser.Math.Wrap,yi=Phaser.Math.Linear;let fi=class extends Je{constructor(t,e){super(t,e),this.resetFromJSON(e),this.boot()}resetFromJSON(t){return super.resetFromJSON(t),this.setEase(ci(t,"ease","Cubic")),this}start(t){if(this.timer.isRunning)return this;this.timer.setDelay(this.delay).setDuration(this.duration);var e=this.parent;return this.startRotationY=e.rotationY,this.endRotationY=this.startRotationY+t,super.start(),this}to(t,e){if(this.isRunning)return this;var i=this.parent;"string"==typeof t&&-1===(t=li(i.faces,t))&&(t=0),t=gi(t,0,i.faces.length),void 0!==e&&this.setDuration(e);var s=pi(di(i.rotationY)),r=pi(di((i.rtl?1:-1)*i.faceAngle*t)),n=vi(s,r);return this.start(ui(n)),i.currentFaceIndex=t,this}toNext(t){var e=this.parent.currentFaceIndex+1;return this.to(e,t),this}toPrevious(t){var e=this.parent.currentFaceIndex-1;return this.to(e,t),this}toRight(t){return this.parent.rtl?this.toPrevious(t):this.toNext(t),this}toLeft(t){return this.parent.rtl?this.toNext(t):this.toPrevious(t),this}updateTarget(t,e){var i=this.easeFn(e.t);t.rotationY=yi(this.startRotationY,this.endRotationY,i)}};const mi=Phaser.Utils.Objects.IsPlainObject,Ci=Phaser.Utils.Objects.GetValue,bi=Phaser.Math.DegToRad,xi=Phaser.Math.RadToDeg,Pi=Phaser.Math.Angle.WrapDegrees,Ri=Phaser.Math.Linear,Si=Phaser.Math.Wrap;class wi extends fe{constructor(t,e,i,s){mi(e)&&(e=Ci(s=e,"x",0),i=Ci(s,"y",0));var r=Ci(s,"faces",void 0);r||(r=[]);var n=Pe(t,r),a=function(t){for(var e,i=0,s=t.length;i<s&&!(e=t[i]);i++);return e}(n),h=Ci(s,"width"),o=Ci(s,"height");void 0===h&&(h=a?a.width:0),void 0===o&&(o=a?a.height:0),super(t,e,i,h,o,n),this.type="rexPerspectiveCarousel",this.face0RotationY=void 0;var l=n.length;this.faceAngle=l>0