UNPKG

phaser3-rex-plugins

Version:
1 lines 57.4 kB
var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,this.displayList=t.sys.displayList,this.updateList=t.sys.updateList,t.events.once("destroy",this.destroy,this)}destroy(){this.scene=null,this.displayList=null,this.updateList=null}static register(e,s){t.prototype[e]=s}}const e=Phaser.GameObjects.GetCalcMatrix,s=Phaser.Renderer.Canvas.SetTransform;var i={renderWebGL:function(t,s,i,r){s.updateData(),i.addToRenderList(s);var h=t.pipelines.set(s.pipeline),a=e(s,i,r),n=h.calcMatrix.copyFrom(a.calc),o=s._displayOriginX,u=s._displayOriginY,l=i.alpha*s.alpha;t.pipelines.preBatch(s);for(var d,c=s.geom,p=0,v=c.length;p<v;p++)(d=c[p]).visible&&d.webglRender(h,n,l,o,u);t.pipelines.postBatch(s)},renderCanvas:function(t,e,i,r){e.updateData(),i.addToRenderList(e);var h=t.currentContext;if(s(t,h,e,i,r)){for(var a,n=e._displayOriginX,o=e._displayOriginY,u=e.geom,l=0,d=u.length;l<d;l++)(a=u[l]).visible&&a.canvasRender(h,n,o);h.restore()}}},r=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};const h=Phaser.GameObjects.Shape,a=Phaser.Utils.Array.Remove;class n extends h{constructor(t,e,s,i,r){void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=2),void 0===r&&(r=i),super(t,"rexShapes",[]),this._width=-1,this._height=-1,this.dirty=!0,this.isSizeChanged=!0,this.shapes={},this.setPosition(e,s),this.setSize(i,r),this.updateDisplayOrigin()}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setDirty(t){return void 0===t&&(t=!0),this.dirty=t,this}setSize(t,e){this.isSizeChanged=this.isSizeChanged||this._width!==t||this._height!==e,this.dirty=this.dirty||this.isSizeChanged,this._width=t,this._height=e,this.updateDisplayOrigin();var s=this.input;return s&&!s.customHitArea&&(s.hitArea.width=t,s.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}get fillColor(){return this._fillColor}set fillColor(t){this.setFillStyle(t,this._fillAlpha)}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this.setFillStyle(this._fillColor,t)}setFillStyle(t,e){return void 0===e&&(e=1),this.dirty=this.dirty||this.fillColor!==t||this.fillAlpha!==e,this._fillColor=t,this._fillAlpha=e,this}get lineWidth(){return this._lineWidth}set lineWidth(t){this.setStrokeStyle(t,this._strokeColor,this._strokeAlpha)}get strokeColor(){return this._strokeColor}set strokeColor(t){this.setStrokeStyle(this._lineWidth,t,this._strokeAlpha)}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this.setStrokeStyle(this._lineWidth,this._strokeColor,t)}setStrokeStyle(t,e,s){return void 0===s&&(s=1),this.dirty=this.dirty||this.lineWidth!==t||this.strokeColor!==e||this.strokeAlpha!==s,this._lineWidth=t,this._strokeColor=e,this._strokeAlpha=s,this}updateShapes(){}updateData(){if(!this.dirty)return this;this.updateShapes();for(var t=this.geom,e=0,s=t.length;e<s;e++){var i=t[e];i.dirty&&i.updateData()}return this.isSizeChanged=!1,this.dirty=!1,this}clear(){return this.geom.length=0,r(this.shapes),this.dirty=!0,this}getShape(t){return this.shapes[t]}getShapes(){return this.geom}addShape(t){this.geom.push(t);var e=t.name;return e&&(this.shapes[e]=t),this.dirty=!0,this}deleteShape(t){var e=this.getShape(t);return e&&(delete this.shapes[t],a(this.geom,e)),this}}Object.assign(n.prototype,i);var o={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 u=Phaser.Scene;var l=function(t){return t instanceof u};const d=Phaser.Game;var c=function(t){return t instanceof d};const p=Phaser.Utils.Objects.GetValue;class v{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(p(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:l(e)?e:e.scene&&l(e.scene)?e.scene:e.parent&&e.parent.scene&&l(e.parent.scene)?e.parent.scene:null,this.game=function(t){return null==t||"object"!=typeof t?null:c(t)?t:c(t.game)?t.game:l(t)?t.sys.game:l(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(v.prototype,o);const g=Phaser.Utils.Objects.GetValue;class y extends v{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(g(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=f[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 f={no:0,lazy:1,always:2},S=Phaser.Utils.Objects.GetValue;class P extends y{constructor(t,e){super(t,e);var s=this.scene?"update":"step";this.tickEventName=S(e,"tickEventName",s),this.isSceneTicker=!m(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 m=function(t){return"step"===t||"poststep"===t};const D=Phaser.Utils.Objects.GetValue,x=Phaser.Math.Clamp;class b{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=D(t,"state",w),this.timeScale=D(t,"timeScale",1),this.delay=D(t,"delay",0),this.repeat=D(t,"repeat",0),this.repeatCounter=D(t,"repeatCounter",0),this.repeatDelay=D(t,"repeatDelay",0),this.duration=D(t,"duration",0),this.nowTime=D(t,"nowTime",0),this.justRestart=D(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?k:_,this.repeatCounter=0,this}stop(){return this.state=w,this}update(t,e){this.state!==w&&this.state!==R&&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=T)):(this.nowTime=this.duration,this.state=R):this.nowTime>=0&&(this.state=k))}get t(){var t;switch(this.state){case w:case _:case T:t=0;break;case k:t=this.nowTime/this.duration;break;case R:t=1}return x(t,0,1)}set t(t){(t=x(t,-1,1))<0?(this.state=_,this.nowTime=-this.delay*t):(this.state=k,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===w}get isDelay(){return this.state===_}get isCountDown(){return this.state===k}get isRunning(){return this.state===_||this.state===k}get isDone(){return this.state===R}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const w=0,_=1,k=2,T=3,R=-1;class M extends P{constructor(t,e){super(t,e),this.timer=new b}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 A=Phaser.Utils.Objects.GetValue,C=Phaser.Utils.Objects.GetAdvancedValue,E=Phaser.Tweens.Builders.GetEaseFunction;class L extends M{resetFromJSON(t){return this.timer.resetFromJSON(A(t,"timer")),this.setEnable(A(t,"enable",!0)),this.setTarget(A(t,"target",this.parent)),this.setDelay(C(t,"delay",0)),this.setDuration(C(t,"duration",1e3)),this.setEase(A(t,"ease","Linear")),this.setRepeat(A(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=E(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 s=this.target,i=this.timer;return i.update(t,e),i.isDelay||this.updateTarget(s,i),this.emit("update",s,this),i.isDone&&this.complete(),this}updateTarget(t,e){}}const O=Phaser.Utils.Objects.GetValue,j=Phaser.Math.Linear;class X extends L{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=O(t,"key","value");var s=e[this.propertyKey];return this.fromValue=O(t,"from",s),this.toValue=O(t,"to",s),this.setEase(O(t,"ease",this.ease)),this.setDuration(O(t,"duration",this.duration)),this.setRepeat(O(t,"repeat",0)),this.setDelay(O(t,"delay",0)),this.setRepeatDelay(O(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 s=e.t;s=this.easeFn(s),t[this.propertyKey]=j(this.fromValue,this.toValue,s)}}var Y={start:function(t){return this.easeValueTask||(this.easeValueTask=new X(this,{eventEmitter:null})),void 0!==t&&(this.duration=t,this.easeValueTask.stop()),this.easeValueTask.isRunning||(this.easeValueTask.restart({key:"value",from:0,to:1,duration:this.duration,ease:this.ease,repeat:-1,delay:this.delay,repeatDelay:this.repeatDelay}),this.setDirty()),this},stop:function(){return this.easeValueTask?(this.easeValueTask.stop(),this.setDirty(),this):this},pause:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this},resume:function(){return this.easeValueTask?(this.easeValueTask.pause(),this.setDirty(),this):this}};const B=Phaser.Utils.Objects.GetValue;class I extends n{constructor(t,e){super(t,B(e,"x",0),B(e,"y",0),B(e,"width",64),B(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),B(e,"start",!0)&&this.start()}resetFromConfig(t,e){var s;return void 0===e&&(e=!1),s=e?1e3:this.duration,this.setDuration(B(t,"duration",s)),s=e?"Linear":this.ease,this.setEase(B(t,"ease",s)),s=e?0:this.delay,this.setDelay(B(t,"delay",s)),s=e?0:this.repeatDelay,this.setRepeatDelay(B(t,"repeatDelay",s)),s=e?16777215:this.color,this.setColor(B(t,"color",s)),s=e?0:this.value,this.setValue(B(t,"value",s)),this}buildShapes(){}get centerX(){return this.width/2}get centerY(){return this.height/2}get radius(){return Math.min(this.centerX,this.centerY)}get color(){return this._color}set color(t){this.isColorChanged=this.isColorChanged||this._color!==t,this.dirty=this.dirty||this.isColorChanged,this._color=t,this.setShapesColor(t)}setColor(t){return this.color=t,this}setShapesColor(t){}get value(){return this._value}set value(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}setValue(t){return this.value=t,this}setDuration(t){return this.duration=t,this}setDelay(t){return this.delay=t,this}setRepeatDelay(t){return this.repeatDelay=t,this}setEase(t){return this.ease=t,this}get isRunning(){return!!this.tweenTask&&this.tweenTask.isRunning}}Object.assign(I.prototype,Y);var V={fillStyle:function(t,e){return null==t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,s){return null==t||null==e?this.isStroked=!1:(void 0===s&&(s=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=s),this}},z=function(t,e,s){for(var i=t,r=s,h=0,a=e.length;h<a;h++){var n=e[h];if(!i||"object"!=typeof i&&"function"!=typeof i||!(n in i))return F.found=!1,F;i=r=i[n]}return F.found=!0,F.value=r,F},F={},N={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var s=t;for(t in s)this.data[t]=s[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:function(t,e,s,i){var r=t&&("object"==typeof t||"function"==typeof t),h=i&&("object"==typeof i||"function"==typeof i);if(!r&&!h)return s;var a=String(e);if(r&&a in t)return t[a];if(h&&a in i)return i[a];if(-1===a.indexOf("."))return s;var n=a.split(".");if(r){var o=z(t,n,s);if(o.found)return o.value}if(h){var u=z(i,n,s);if(u.found)return u.value}return s}(this.data,t,e)},incData(t,e,s){return void 0===s&&(s=0),this.enableData(),this.setData(t,this.getData(t,s)+e),this},mulData(t,e,s){return void 0===s&&(s=0),this.enableData(),this.setData(t,this.getData(t,s)*e),this},clearData(){return this.data&&r(this.data),this}};class G{constructor(){this.name=void 0,this.dirty=!0,this.visible=!0,this.data=void 0,this.isFilled=!1,this.fillColor=void 0,this.fillAlpha=1,this.isStroked=!1,this.lineWidth=1,this.strokeColor=void 0,this.strokeAlpha=1}setName(t){return this.name=t,this}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}reset(){return this.setVisible().fillStyle().lineStyle(),this}webglRender(t,e,s,i,r){}canvasRender(t,e,s){}updateData(){this.dirty=!1}}Object.assign(G.prototype,V,N);var U=Phaser.Renderer.WebGL.Utils,W=function(t,e,s,i,r,h){for(var a=U.getTintAppendFloatAlpha(s.fillColor,s.fillAlpha*i),n=s.pathData,o=s.pathIndexes,u=0;u<o.length;u+=3){var l=2*o[u],d=2*o[u+1],c=2*o[u+2],p=n[l+0]-r,v=n[l+1]-h,g=n[d+0]-r,y=n[d+1]-h,f=n[c+0]-r,S=n[c+1]-h,P=e.getX(p,v),m=e.getY(p,v),D=e.getX(g,y),x=e.getY(g,y),b=e.getX(f,S),w=e.getY(f,S);t.batchTri(s,P,m,D,x,b,w,0,0,1,1,a,a,a,2)}},H=Phaser.Renderer.WebGL.Utils,J=function(t,e,s,i,r){var h=t.strokeTint,a=H.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*s);h.TL=a,h.TR=a,h.BL=a,h.BR=a;var n,o,u=e.isDashed&&!!e.strokePathData,l=u?e.strokePathData:e.pathData,d=l.length-1,c=e.lineWidth,p=c/2,v=l[0]-i,g=l[1]-r;if(e.closePath||(d-=2),u){var y=e.strokePathMask,f=0,S=0;for(P=2;P<d;P+=2)n=l[P]-i,o=l[P+1]-r,y[f]?(t.batchLine(v,g,n,o,p,p,c,S,!1),S++):S=0,v=n,g=o,f++}else for(var P=2;P<d;P+=2)n=l[P]-i,o=l[P+1]-r,t.batchLine(v,g,n,o,p,p,c,P-2,!!e.closePath&&P===d-1),v=n,g=o},q=function(t,e,s,i){var r=s||e.fillColor,h=i||e.fillAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.fillStyle="rgba("+a+","+n+","+o+","+h+")"},K=function(t,e,s,i){var r=e.pathData;if(r&&!(r.length<4)){var h=r.length-1,a=r[0]-s,n=r[1]-i;t.beginPath(),t.moveTo(a,n),e.closePath||(h-=2);for(var o=2;o<h;o+=2){var u=r[o]-s,l=r[o+1]-i;t.lineTo(u,l)}e.closePath&&t.closePath(),q(t,e),t.fill()}},Q=function(t,e,s,i){var r=e.isDashed&&!!e.strokePathData,h=r?e.strokePathData:e.pathData;if(h&&!(h.length<4)){var a=h.length-1,n=h[0]-s,o=h[1]-i;if(function(t,e,s,i){var r=s||e.strokeColor,h=i||e.strokeAlpha,a=(16711680&r)>>>16,n=(65280&r)>>>8,o=255&r;t.strokeStyle="rgba("+a+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth}(t,e),t.beginPath(),e.closePath||(a-=2),r){var u=e.strokePathMask,l=0;for(d=2;d<a;d+=2)c=h[d]-s,p=h[d+1]-i,u[l]&&(t.moveTo(n,o),t.lineTo(c,p)),n=c,o=p,l++}else{t.moveTo(n,o);for(var d=2;d<a;d+=2){var c=h[d]-s,p=h[d+1]-i;t.lineTo(c,p)}e.closePath&&t.closePath()}t.stroke()}};const $=1e-6,Z=10,tt=.5;var et=function(t,e){return function(t){if(!Array.isArray(t))return null;for(var e=[],s=0,i=t.length;s<i;s++){var r=Number(t[s]);isFinite(r)&&r>0&&e.push(r)}return e.length>0?e:null}(t)||function(t,e){var{segments:s=Z,drawRatio:i=tt}=t;if(s=Math.round(s),!isFinite(s)||s<=0)return null;if(!(e>$))return null;var r=e/s;if(!(r>$))return null;if((i=Math.max(0,Math.min(1,i)))>=.999999)return null;var h=r*i;h<=$&&(h=$);var a=r-h;return a<=$?null:[h,a]}(t,e)},st=function(t,e,s){if(t&&!(t.length<4)){var i=t.length-1;if(e||(i-=2),!(i<2))for(var r=t[0],h=t[1],a=2;a<i;a+=2){var n=t[a],o=t[a+1];s(r,h,n,o),r=n,h=o}}},it=function(t,e,s){void 0===e&&(e={}),void 0===s&&(s={});var{closePath:i=!1,dashPattern:r,dashOffset:h=0}=e,a=function(t,e){var s=0;return st(t,e,(function(t,e,i,r){var h=i-t,a=r-e;s+=Math.sqrt(h*h+a*a)})),s}(t,i);if(null===(r=et(r,a)))return null;for(var n=[],o=[],u=0,l=0,d=r.length;l<d;l++)u+=r[l];if(u<=$)return s.strokePathData=t?t.slice():[],s.strokePathMask=void 0,s;for(var c=0,p=!0,v=r[c],g=function(){c=(c+1)%r.length,p=!p,v=r[c]},y=function(t,e){return isFinite(t)||(t=0),(t%=e)<0&&(t+=e),t}(h,u);y>$;)y<v-$?(v-=y,y=0):(y-=v,g());var f=function(t,e,s,i,r){if(0===n.length)n.push(t,e);else{var h=n[n.length-2],a=n[n.length-1];h===t&&a===e||n.push(t,e)}n.push(s,i),o.push(r?1:0)};return st(t,i,(function(t,e,s,i){var r=s-t,h=i-e,a=Math.sqrt(r*r+h*h);if(!(a<=$))for(var n=0;n<a-$;){var o=Math.min(v,a-n);if(o<=$)g();else{var u=n/a,l=(n+o)/a;f(t+r*u,e+h*u,t+r*l,e+h*l,p),n+=o,(v-=o)<=$&&g()}}})),!i&&n.length>=2&&n.push(n[n.length-2],n[n.length-1]),s.strokePathData=n,s.strokePathMask=o,s},rt={setDashPattern:function(t,e){return this.dashPattern=t,this.dashOffset=e||0,this.isDashed=!!t,this},clearDashPattern:function(){return this.setDashPattern(),this},setDashed:function(t){return void 0===t&&(t=!0),this.isDashed=t,this}},ht={buildStrokePath:function(){if(this.isDashed){var t=it(this.pathData,{closePath:this.closePath,dashPattern:this.dashPattern,dashOffset:this.dashOffset},this);t?(this.strokePathData=t.strokePathData,this.strokePathMask=t.strokePathMask):this.isDashed=!1}return this}};Object.assign(ht,rt);const at=Phaser.Geom.Polygon.Earcut;class nt extends G{constructor(){super(),this.pathData=[],this.isDashed=!1,this.strokePathData=void 0,this.strokePathMask=void 0,this.dashPattern=void 0,this.dashOffset=0,this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=at(this.pathData),super.updateData(),this.buildStrokePath(),this}webglRender(t,e,s,i,r){this.isFilled&&W(t,e,this,s,i,r),this.isStroked&&J(t,this,s,i,r)}canvasRender(t,e,s){this.isFilled&&K(t,this,e,s),this.isStroked&&Q(t,this,e,s)}}Object.assign(nt.prototype,ht);var ot=function(t,e,s){var i=s.length;if(i>=2){var r=s[i-2],h=s[i-1];if(t===r&&e===h)return s}return s.push(t,e),s};const ut=Phaser.Math.DegToRad;var lt=function(t,e,s,i,r,h,a,n,o){a&&h>r?h-=360:!a&&h<r&&(h+=360);var u=ut(h-r)/n;r=ut(r);for(var l=0;l<=n;l++){var d=r+u*l,c=t+s*Math.cos(d),p=e+i*Math.sin(d);ot(c,p,o)}return o};const dt=Phaser.Math.Interpolation.QuadraticBezier,ct=Phaser.Math.Interpolation.CubicBezier,pt=Phaser.Math.Interpolation.CatmullRom;var vt=function(t){var e=t.length;if(e<2)return t;var s=t[e-2],i=t[e-1];return t.push(s),t.push(i),t},gt={clear(){return this.start(),this},start(){return this.startAt(),this},startAt(t,e){return this.restorePathData(),this.accumulationLengths=void 0,function(t,e,s){s.length=0,null!=t&&s.push(t,e)}(t,e,this.pathData),this.firstPointX=t,this.firstPointY=e,this.lastPointX=t,this.lastPointY=e,this},lineTo(t,e,s){return void 0===s&&(s=!1),s&&(t+=this.lastPointX,e+=this.lastPointY),ot(t,e,this.pathData),this.lastPointX=t,this.lastPointY=e,this},verticalLineTo(t,e){return this.lineTo(t,this.lastPointY,e),this},horizontalLineTo(t,e){return this.lineTo(this.lastPointX,t,e),this},ellipticalArc(t,e,s,i,r,h,a){return void 0===a&&(a=!1),lt(t,e,s,i,r,h,a,this.iterations,this.pathData),this.lastPointX=this.pathData[this.pathData.length-2],this.lastPointY=this.pathData[this.pathData.length-1],this},arc(t,e,s,i,r,h){return this.ellipticalArc(t,e,s,s,i,r,h),this},quadraticBezierTo(t,e,s,i){return function(t,e,s,i,r,h){for(var a=h.length,n=h[a-2],o=h[a-1],u=1,l=r-1;u<=l;u++){var d=u/l;h.push(dt(d,n,t,s),dt(d,o,e,i))}}(t,e,s,i,this.iterations,this.pathData),this.lastPointX=s,this.lastPointY=i,this},cubicBezierTo(t,e,s,i,r,h){return function(t,e,s,i,r,h,a,n){for(var o=n.length,u=n[o-2],l=n[o-1],d=1,c=a-1;d<=c;d++){var p=d/c;n.push(ct(p,u,t,s,r),ct(p,l,e,i,h))}}(t,e,s,i,r,h,this.iterations,this.pathData),this.lastPointX=r,this.lastPointY=h,this},catmullRomTo(...t){return function(t,e,s){for(var i=s.length,r=[s[i-2]],h=[s[i-1]],a=0,n=t.length;a<n;a+=2)r.push(t[a]),h.push(t[a+1]);a=1;for(var o=e-1;a<=o;a++){var u=a/o;s.push(pt(r,u),pt(h,u))}}(t,this.iterations,this.pathData),this.lastPointX=t[t.length-2],this.lastPointY=t[t.length-1],this},close(){var t=this.pathData[0],e=this.pathData[1];return t===this.lastPointX&&e===this.lastPointY||this.lineTo(t,e),this.closePath=!0,this},end(){return vt(this.pathData),this}};const yt=Phaser.Math.RotateAround;var ft=function(t,e,s){for(var i=0,r=s.length-1;i<r;i+=2)s[i]+=t,s[i+1]+=e;return s};const St=Phaser.Math.DegToRad;Phaser.Math.RotateAround;var Pt={rotateAround(t,e,s){if(0===this.pathData.length)return this;!function(t,e,s,i){for(var r={x:0,y:0},h=0,a=i.length-1;h<a;h+=2)r.x=i[h],r.y=i[h+1],yt(r,t,e,s),i[h]=r.x,i[h+1]=r.y}(t,e,s=St(s),this.pathData);var i=this.pathData.length;return this.lastPointX=this.pathData[i-2],this.lastPointY=this.pathData[i-1],this},scale(t,e,s,i){return 0===this.pathData.length||(function(t,e,s,i,r){for(var h=0,a=r.length-1;h<a;h+=2){var n=r[h]-t,o=r[h+1]-e;n*=s,o*=i,r[h]=n+t,r[h+1]=o+e}}(t,e,s,i,this.pathData),this.lastPointX=this.pathData[pathDataCnt-2],this.lastPointY=this.pathData[pathDataCnt-1]),this},offset(t,e){return ft(t,e,this.pathData),this}},mt={savePathData(){return this.pathDataSaved||(this.pathDataSave=[...this.pathData],this.pathData.length=0,this.pathDataSaved=!0),this},restorePathData(){return this.pathDataSaved?(function(t,e,s,i){void 0===s&&(s=0),void 0===i&&(i=e.length),t.length=i-s;for(var r=0,h=t.length;r<h;r++)t[r]=e[r+s]}(this.pathData,this.pathDataSave),this.pathDataSave=void 0,this.pathDataSaved=!1,this):this}};const Dt=Phaser.Math.Distance.Between,xt=Phaser.Math.Wrap,bt=Phaser.Math.Linear;var wt=function(t,e,s,i,r){if(void 0===i&&(i=s,s=0),(s=Tt(s))!==(i=Tt(i))){var h=e[e.length-1],a=h*s,n=h*i;s<i?_t(t,e,a,n,r):(_t(t,e,a,h,r),_t(t,e,0,n,r)),vt(r)}},_t=function(t,e,s,i,r){for(var h=s>0,a=0,n=e.length;a<n;a++){var o=2*a,u=e[a];if(h){if(u<s)continue;if(u==s)h=!1;else{var l=1-(u-s)/(u-e[a-1]);r.push(kt(t,o-2,o,l)),r.push(kt(t,o-1,o+1,l)),h=!1}}if(!(u<=i)){l=1-(u-i)/(u-e[a-1]),r.push(kt(t,o-2,o,l)),r.push(kt(t,o-1,o+1,l));break}if(r.push(t[o]),r.push(t[o+1]),u===i)break}},kt=function(t,e,s,i){var r=t[e],h=t[s];return bt(r,h,i)},Tt=function(t){return 0===t?0:t%1==0?1:xt(t,0,1)},Rt={updateAccumulationLengths(){if(null==this.accumulationLengths)this.accumulationLengths=[];else if(this.accumulationLengths.length===this.pathData.length/2)return this;for(var t,e,s,i,r=this.accumulationLengths,h=this.pathData,a=0,n=0,o=h.length;n<o;n+=2)s=h[n],i=h[n+1],a+=void 0===t?0:Dt(t,e,s,i),r.push(a),t=s,e=i;return this.totalPathLength=a,this},setDisplayPathSegment(t,e){return this.pathDataSaved||(this.updateAccumulationLengths(),this.savePathData()),this.pathData.length=0,wt(this.pathDataSave,this.accumulationLengths,t,e,this.pathData),this},appendFromPathSegment(t,e,s){return void 0===e?this.pathData.push(...t.pathData):(t.updateAccumulationLengths(),wt(t.pathData,t.accumulationLengths,e,s,this.pathData)),this.firstPointX=this.pathData[0],this.firstPointY=this.pathData[1],this.lastPointX=this.pathData[this.pathData.length-2],this.lastPointY=this.pathData[this.pathData.length-1],this}},Mt={draw(t,e,s){var i=this.toPoints();return e&&t.fillPoints(i,this.closePath,this.closePath),s&&t.strokePoints(i,this.closePath,this.closePath),this}};const At=Phaser.Geom.Polygon;class Ct{constructor(t){void 0===t&&(t=[]),this.pathData=t,this.closePath=!1,this.setIterations(32),this.firstPointX=void 0,this.firstPointY=void 0,this.lastPointX=void 0,this.lastPointY=void 0,this.accumulationLengths=void 0}setIterations(t){return this.iterations=t,this}toPoints(){return function(t,e){void 0===e&&(e=[]);for(var s=0,i=t.length-1;s<i;s+=2)e.push({x:t[s],y:t[s+1]});return e}(this.pathData)}toPolygon(t){return function(t,e){return void 0===e&&(e=new At),e.setTo(t),e}(this.pathData,t)}}Object.assign(Ct.prototype,gt,Pt,mt,Rt,Mt);class Et extends nt{constructor(){super(),this.builder=new Ct(this.pathData)}get iterations(){return this.builder.iterations}set iterations(t){this.dirty=this.dirty||this.builder.iterations!==t,this.builder.setIterations(t)}setIterations(t){return this.iterations=t,this}get lastPointX(){return this.builder.lastPointX}get lastPointY(){return this.builder.lastPointY}start(){return this.builder.start(),this.dirty=!0,this}startAt(t,e){return this.builder.startAt(t,e),this.dirty=!0,this}lineTo(t,e,s){return this.builder.lineTo(t,e,s),this.dirty=!0,this}verticalLineTo(t,e){return this.builder.verticalLineTo(t,e),this.dirty=!0,this}horizontalLineTo(t,e){return this.builder.horizontalLineTo(t,e),this.dirty=!0,this}ellipticalArc(t,e,s,i,r,h,a){return this.builder.ellipticalArc(t,e,s,i,r,h,a),this.dirty=!0,this}arc(t,e,s,i,r,h){return this.builder.arc(t,e,s,i,r,h),this.dirty=!0,this}quadraticBezierTo(t,e,s,i){return this.builder.quadraticBezierTo(t,e,s,i),this.dirty=!0,this}cubicBezierTo(t,e,s,i,r,h){return this.builder.cubicBezierTo(t,e,s,i,r,h),this.dirty=!0,this}catmullRomTo(...t){return this.builder.catmullRomTo(...t),this.dirty=!0,this}close(){return this.builder.close(),this.closePath=this.builder.closePath,this.dirty=!0,this}end(){return this.builder.end(),this.dirty=!0,this}rotateAround(t,e,s){return this.builder.rotateAround(t,e,s),this.dirty=!0,this}scale(t,e,s,i){return this.builder.scale(t,e,s,i),this.dirty=!0,this}offset(t,e){return this.builder.offset(t,e),this.dirty=!0,this}toPolygon(t){return this.builder.toPolygon(t)}appendPathFrom(t,e,s){return this.builder.appendFromPathSegment(t.builder,e,s),this}copyPathFrom(t,e,s){return this.builder.clear().appendFromPathSegment(t.builder,e,s),this}setDisplayPathSegment(t,e){return this.builder.setDisplayPathSegment(t,e),this}}var Lt=function(t,e){return void 0===e&&(e=.5),t<=e?t/=e:t=1-(t-e)/(1-e),t};const Ot=Phaser.Math.DegToRad,jt=Phaser.Math.Linear,Xt=Phaser.Math.Easing.Expo.In,Yt={right:0,down:1,left:2,up:3};var Bt=function(t,e,s,i,r,h,a,n,o,u,l){var d=Vt(e,0,i,r,h,a,n,o,u,l);t.startAt(d.x,d.y);var c=Vt(s,0,i,r,h,a,n,o,u,l);t.lineTo(c.x,c.y);var p=Vt(s,s,i,r,h,a,n,o,u,l);t.lineTo(p.x,p.y);var v=Vt(0,s,i,r,h,a,n,o,u,l);t.lineTo(v.x,v.y);var g=Vt(0,e,i,r,h,a,n,o,u,l);t.lineTo(g.x,g.y);var y=Vt(e,e,i,r,h,a,n,o,u,l);t.lineTo(y.x,y.y),t.close()},It={},Vt=function(t,e,s,i,r,h,a,n,o,u){var l=t*s,d=e*i;return It.x=a*l+n*d+r,It.y=o*l+u*d+h,It},zt={setDirection(t){return"string"==typeof t&&(t=Yt[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new Et)},updateShapes(){var t,e,s,i,r,h;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var a=Ot(315);s=Math.cos(a),i=Math.sin(a);var n=Ot(45);r=Math.cos(n),h=Math.sin(n);break;case 3:t=this.centerX,e=this.centerY+this.radius,a=Ot(135),s=Math.cos(a),i=Math.sin(a),n=Ot(225),r=Math.cos(n),h=Math.sin(n);break;case 2:t=this.centerX+this.radius,e=this.centerY,a=Ot(225),s=Math.cos(a),i=Math.sin(a),n=Ot(315),r=Math.cos(n),h=Math.sin(n);break;default:t=this.centerX-this.radius,e=this.centerY,a=Ot(45),s=Math.cos(a),i=Math.sin(a),n=Ot(135),r=Math.cos(n),h=Math.sin(n)}for(var o=this.radius/7,u=this.getShapes(),l=0,d=u.length;l<d;l++){var c=u[l],p=(this.value+.1*(d-l))%1;p=Xt(Lt(p));var v=jt(.25,1,p);c.fillStyle(this.color,v);var g=3*l+1;Bt(c,g,g+2,o,o,t,e,s,i,r,h)}}};class Ft extends nt{constructor(t,e,s,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=0),super(),this.setP0(t,e),this.setP1(s,i)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x0,this.y0),super.updateData(),this}}const Nt=Phaser.Math.Linear;var Gt={buildShapes(){for(var t=0;t<4;t++)this.addShape(new Ft);this.prevValue=void 0},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,r=e+s,h=2*s,a=this.getShapes(),n=a.length,o=2*s/n,u=.7*o;if(void 0===this.prevValue||this.prevValue>this.value)for(var l=0;l<n;l++){var d=a[l],c=void 0===this.prevValue?Math.random():d.getData("to");d.setData("from",c).setData("to",Math.random())}for(this.prevValue=this.value,l=0;l<n;l++){c=(d=a[l]).getData("from");var p=d.getData("to"),v=Nt(c,p,this.value)*h,g=i+o*(l+.5);d.lineStyle(u,this.color,1).setP0(g,r).setP1(g,r-v)}}};Phaser.Math.DegToRad;class Ut extends nt{constructor(t,e,s,i,r,h,a,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===h&&(h=360),void 0===a&&(a=!1),void 0===n&&(n=!1),super(),this.setCenterPosition(t,e),this.setRadius(s,i),this.setAngle(r,h,a),this.setPie(n),this.setIterations(32)}get x(){return this._x}set x(t){this.dirty=this.dirty||this._x!==t,this._x=t}get y(){return this._y}set y(t){this.dirty=this.dirty||this._y!==t,this._y=t}setCenterPosition(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this}get radiusX(){return this._radiusX}set radiusX(t){this.dirty=this.dirty||this._radiusX!==t,this._radiusX=t}get radiusY(){return this._radiusY}set radiusY(t){this.dirty=this.dirty||this._radiusY!==t,this._radiusY=t}setRadius(t,e){return void 0===e&&(e=t),this.radiusX=t,this.radiusY=e,this}get startAngle(){return this._startAngle}set startAngle(t){this.dirty=this.dirty||this._startAngle!==t,this._startAngle=t}get endAngle(){return this._endAngle}set endAngle(t){this.dirty=this.dirty||this._endAngle!==t,this._endAngle=t}get anticlockwise(){return this._anticlockwise}set anticlockwise(t){this.dirty=this.dirty||this._anticlockwise!==t,this._anticlockwise=t}setAngle(t,e,s){return void 0===s&&(s=!1),this.startAngle=t,this.endAngle=e,this.anticlockwise=s,this}get pie(){return this._pie}set pie(t){this.dirty=this.dirty||this._pie!==t,this._pie=t}setPie(t){return void 0===t&&(t=!0),this.pie=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){return this.pathData.length=0,this.pie&&this.pathData.push(this.x,this.y),lt(this.x,this.y,this.radiusX,this.radiusY,this.startAngle,this.endAngle,this.anticlockwise,this.iterations,this.pathData),this.pie&&this.pathData.push(this.x,this.y),this.pathData.push(this.pathData[0],this.pathData[1]),super.updateData(),this}}class Wt extends Ut{constructor(t,e,s){super(t,e,s,s,0,360)}}const Ht=Phaser.Math.Linear;var Jt={buildShapes(){for(var t=0;t<3;t++)this.addShape(new Wt)},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=.1*s,r=Math.ceil(.25*i),h=1-Lt(this.value),a=Ht(.3,.9,h)*s,n=this.getShapes(),o=0,u=n.length;o<u;o++){var l=n[o],d=(h=(this.value+o/u)%1,2*Math.PI*h);l.lineStyle(r,this.color).setRadius(i).setCenterPosition(t+Math.cos(d)*a,e+Math.sin(d)*a)}}};const qt=Phaser.Math.Linear,Kt=Phaser.Math.Easing.Expo.In;var Qt={buildShapes(){for(var t=0;t<5;t++){var e=new Ft;this.addShape(e);var s=Lt(t/4)/2;e.setData("offset",s)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,r=2*s,h=this.getShapes(),a=h.length,n=2*s/a,o=.7*n,u=0;u<a;u++){var l=h[u],d=(this.value+l.getData("offset"))%1;d=Kt(Lt(d));var c=qt(.4,1,d)*r,p=i+n*(u+.5);l.lineStyle(o,this.color,1).setP0(p,e-c/2).setP1(p,e+c/2)}}},$t={buildShapes(){this.addShape((new Et).setName("border")),this.addShape((new Et).setName("fill"))},updateShapes(){var t=this.centerX,e=this.centerY,s=.7*this.radius,i=t-s,r=e-s,h=2*s;if(this.getShape("border").lineStyle(2,this.color,1).startAt(i,r).lineTo(h,0,!0).lineTo(0,h,!0).lineTo(-h,0,!0).lineTo(0,-h,!0).close(),this.value<.5){var a=h*(2*(.5-this.value));this.getShape("fill").fillStyle(this.color,1).startAt(i,r).lineTo(h,0,!0).lineTo(0,a,!0).lineTo(-h,0,!0).lineTo(0,-a,!0).close()}else{var n=2*(this.value-.5)*180;this.getShape("border").rotateAround(t,e,n),this.getShape("fill").fillStyle().lineStyle()}}};const Zt=Phaser.Math.RadToDeg,te=Phaser.Math.Angle.WrapDegrees,ee=Phaser.Math.Angle.Wrap,se=Phaser.Math.Angle.ShortestBetween,ie=Phaser.Math.DegToRad,re=Phaser.Math.DegToRad(270);var he={buildShapes(){this.addShape((new Wt).setName("border")),this.addShape((new Ft).setName("minuteHand")),this.addShape((new Ft).setName("hourHand")),this.minuteHandAngle=0,this.hourHandAngle=0},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),r=s-i/2,h=.8*s,a=.5*s,n=this.minuteHandAngle;this.minuteHandAngle=2*Math.PI*this.value;var o=te(Zt(n)),u=te(Zt(this.minuteHandAngle)),l=se(o,u);this.hourHandAngle=ee(this.hourHandAngle+ie(l)/12),this.getShape("border").lineStyle(i,this.color).setRadius(r).setCenterPosition(t,e);var d=this.minuteHandAngle+re;this.getShape("minuteHand").lineStyle(i,this.color).setP0(t,e).setP1(t+Math.cos(d)*h,e+Math.sin(d)*h),d=this.hourHandAngle+re,this.getShape("hourHand").lineStyle(i,this.color).setP0(t,e).setP1(t+Math.cos(d)*a,e+Math.sin(d)*a)}};const ae=Phaser.Math.Linear,ne=Phaser.Math.Easing.Expo.In;var oe={buildShapes(){for(var t=0;t<4;t++){var e=new Ft;this.addShape(e)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,r=e-s,h=2*s/2,a=2*s/2,n=this.getShapes(),o=n.length,u=0;u<o;u++){var l=i+h*(u%2+.5),d=r+a*(Math.floor(u/2)+.5),c=n[u],p=(this.value+.1*(o-u))%1;p=ne(Lt(p));var v=(o-u)/o,g=ae(.7,1,p)*a,y=ae(.7,1,p)*h;c.lineStyle(y,this.color,v).setP0(l-g/2,d).setP1(l+g/2,d)}}};const ue=Phaser.Math.Linear;var le={buildShapes(){for(var t=0;t<3;t++){var e=new Wt;this.addShape(e);var s=Lt(t/2)/2;e.setData("offset",s)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,r=this.getShapes(),h=r.length,a=2*s/h,n=a/2,o=0;o<h;o++){var u=r[o],l=(this.value+u.getData("offset"))%1;l=Lt(l);var d=ue(.25,1,l),c=ue(.5,1,l)*n;u.fillStyle(this.color,d).setRadius(c).setCenterPosition(i+a*(o+.5),e)}}};const de=Phaser.Math.Linear,ce=Phaser.Math.Easing.Expo.In;var pe={buildShapes(){for(var t=0;t<3;t++){var e=new Ft;this.addShape(e)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,r=this.getShapes(),h=r.length,a=2*s/h,n=2*s,o=0;o<h;o++){var u=r[o],l=(this.value+.1*(h-o))%1;l=ce(Lt(l));var d=(o+1)/h,c=de(.7,1,l)*n,p=de(.7,1,l)*a,v=i+a*(o+.5);u.lineStyle(p,this.color,d).setP0(v,e-c/2).setP1(v,e+c/2)}}};const ve=Phaser.Math.Linear;var ge={buildShapes(){for(var t=0;t<9;t++){var e=new Wt;this.addShape(e),e.setData("offset",Math.random())}this.isInitialize=!0},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=this.isInitialize||this.isSizeChanged,r=t-s,h=e-s,a=2*s/3,n=2*s/3,o=Math.min(a,n)/2*.8,u=this.getShapes(),l=0,d=u.length;l<d;l++){var c=r+a*(l%3+.5),p=h+n*(Math.floor(l/3)+.5),v=u[l],g=(this.value+v.getData("offset"))%1;g=Lt(g),v.fillStyle(this.color,ve(.25,1,g)),i&&v.setRadius(o).setCenterPosition(c,p)}this.isInitialize=!1}},ye={buildShapes(){for(var t=0;t<2;t++)this.addShape(new Et)},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),r=s-i,h=.6*r,a=.7*r,n=1.2*r,o=this.getShapes(),u=0,l=o.length;u<l;u++){var d=o[u],c=(this.value+u/l)%1,p=Lt(c),v=t,g=e-15*c,y=r*c,f=h*c,S=a*c,P=n*c;d.lineStyle(i,this.color,p).startAt(v,g).cubicBezierTo(v,g-f,v-y,g-f,v-y,g).cubicBezierTo(v-y,g+f,v,g+S,v,g+P).cubicBezierTo(v,g+S,v+y,g+f,v+y,g).cubicBezierTo(v+y,g-f,v,g-f,v,g).close()}}};const fe=Phaser.Math.Linear;var Se={buildShapes(){for(var t=0;t<12;t++)this.addShape(new Ft);this.isInitialize=!0},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.isInitialize||this.isSizeChanged,i=this.radius,r=i/2,h=Math.ceil(i/20),a=this.getShapes(),n=0,o=a.length;n<o;n++){var u=a[n],l=n/o,d=2*Math.PI*l,c=fe(.25,1,(1-this.value+l)%1);u.lineStyle(h,this.color,c),s&&u.setP0(t+Math.cos(d)*r,e+Math.sin(d)*r).setP1(t+Math.cos(d)*i,e+Math.sin(d)*i)}this.isInitialize=!1}},Pe={buildShapes(){this.addShape((new Wt).setName("track")),this.addShape((new Wt).setName("thumb"))},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=.9*s,r=Math.ceil(i/25),h=.1*s,a=2*Math.PI*this.value;this.getShape("track").lineStyle(r,this.color,.7).setRadius(i).setCenterPosition(t,e),this.getShape("thumb").fillStyle(this.color).setRadius(h).setCenterPosition(t+Math.cos(a)*i,e+Math.sin(a)*i)}},me={buildShapes(){this.addShape((new Wt).setName("track")),this.addShape((new Ut).setName("arc"))},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),r=s-i/2;this.getShape("track").lineStyle(i,this.color,.5).setRadius(r).setCenterPosition(t,e);var h=360*this.value,a=h+60;this.getShape("arc").lineStyle(i,this.color,1).setRadius(r).setCenterPosition(t,e).setAngle(h,a)}};const De=Phaser.Math.Linear;var xe={buildShapes(){for(var t=0;t<4;t++){var e=(new Ut).setPie();this.addShape(e),e.setData("speed",De(180,360,Math.random()))}this.prevValue=void 0},updateShapes(){var t,e=this.centerX,s=this.centerY,i=this.radius;void 0!==this.prevValue&&(t=this.value-this.prevValue,this.prevValue>this.value&&(t+=1));for(var r=this.getShapes(),h=0,a=r.length;h<a;h++){var n=r[h],o=(h+1)/a;if(void 0===this.prevValue){var u=90+(l=h/a*360);n.fillStyle(this.color,o).setRadius(i).setCenterPosition(e,s).setAngle(l,u).setData("angle",l)}else{var l=n.getData("angle")+n.getData("speed")*t;u=90+(l%=360),n.fillStyle(this.color,o).setRadius(i).setCenterPosition(e,s).setAngle(l,u).setData("angle",l)}}this.prevValue=this.value}},be={buildShapes(){this.addShape(new Wt)},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=s*this.value,r=Math.ceil(s/25),h=Lt(this.value);this.getShapes()[0].lineStyle(r,this.color,h).setRadius(i).setCenterPosition(t,e)}};const we=Phaser.Math.Linear,_e=Phaser.Math.Easing.Expo.In;var ke={buildShapes(){this.addShape((new Wt).setName("center")),this.addShape((new Et).setName("arc0")),this.addShape((new Et).setName("arc1")),this.isInitialize=!0},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=this.isInitialize||this.isSizeChanged,r=2*s/6,h=t-s+r,a=e+s-r,n=this.getShapes(),o=0,u=n.length;o<u;o++){var l=n[o],d=(this.value+.1*(u-o))%1;d=_e(Lt(d));var c=we(.25,1,d);switch(l.name){case"center":l.fillStyle(this.color,c),i&&l.setRadius(r).setCenterPosition(h,a);break;case"arc0":if(l.fillStyle(this.color,c),i){var p=2*r,v=3*r;l.startAt(h,a-p).lineTo(h,a-v).setIterations(8).arc(h,a,v,270,360).lineTo(h+p,a).setIterations(6).arc(h,a,p,360,270,!0).close()}break;case"arc1":l.fillStyle(this.color,c),i&&(p=4*r,v=5*r,l.startAt(h,a-p).lineTo(h,a-v).setIterations(8).arc(h,a,v,270,360).lineTo(h+p,a).setIterations(6).arc(h,a,p,360,270,!0).close())}}this.isInitialize=!1}},Te={buildShapes(){for(var t=0;t<2;t++)this.addShape(new Wt)},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),r=s-i,h=this.getShapes(),a=0,n=h.length;a<n;a++){var o=h[a],u=(this.value+a/n)%1,l=Lt(u);o.lineStyle(i,this.color,l).setRadius(u*r).setCenterPosition(t,e)}}},Re={buildShapes(){this.addShape((new Ut).setName("arc"))},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/10),r=s-i,h=720*this.value,a=h-180*Lt(this.value);this.getShape("arc").lineStyle(i,this.color,1).setRadius(r).setCenterPosition(t,e).setAngle(a+315,h+315)}};Phaser.Utils.Objects.GetValue;const Me={leftArrow:zt,rightArrow:zt,upArrow:zt,downArrow:zt,audio:Gt,ball:Jt,bars:Qt,box:$t,clock:he,cube:oe,dots:le,facebook:pe,grid:ge,hearts:ye,ios:Se,oribit:Pe,oval:me,pie:xe,puff:be,radio:ke,rings:Te,spinner:Re},Ae=[];for(var Ce in Me)Ae.push(Ce);const Ee=Phaser.Utils.Array.GetRandom;var Le={setAnimationMode(t,e){Me.hasOwnProperty(t)||(t=Ee(Ae)),this.animationMode=t;var s=Me[t];switch(e&&this.resetFromConfig(e),t){case"leftArrow":s.setDirection.call(this,"left");break;case"rightArrow":s.setDirection.call(this,"right");break;case"upArrow":s.setDirection.call(this,"up");break;case"downArrow":s.setDirection.call(this,"down")}return this.clear(),s.buildShapes.call(this),this.updateShapes=s.updateShapes.bind(this),this.stop().start(),this},setRandomAnimationMode(t){var e=Ee(Ae);return this.setAnimationMode(e,t),this}};const Oe=Phaser.Utils.Objects.GetValue;class je extends I{constructor(t,e){super(t,e),this.type="rexSpinnerAIO",this.setAnimationMode(Oe(e,"animationMode"))}}Object.assign(je.prototype,Le);var Xe=function(t){return null!==t&&"object"==typeof t},Ye=function(t,e,s,i="."){if(!Xe(t))return t;if(function(t){return null==t}(e)||""===e||Array.isArray(e)&&0===e.length)return t;if("string"==typeof e&&-1===e.indexOf(i)||"number"==typeof e)return t[e]=s,t;var r=function(t,e){return Array.isArray(t)||(t="string"!=typeof t||""===t.trim()?[]:t.split(e).filter(Boolean)),t}(e,i);if(0===r.length)return t;for(var h=t,a=r.length,n=0;n<a-1;n++){var o=r[n],u=h[o];Xe(u)||(h[o]={}),h=h[o]}return h[r[a-1]]=s,t};t.register("aio",(function(t){var e=new je(this.scene,t);return this.scene.add.existing(e),e})),Ye(window,"RexPlugins.Spinner.AIO",je);class Be extends I{constructor(t,e){super(t,e),this.type="rexSpinnerAudio"}}Object.assign(Be.prototype,Gt),t.register("audio",(function(t){var e=new Be(this.scene,t);return this.scene.add.existing(e),e})),Ye(window,"RexPlugins.Spinner.Audio",Be);const Ie=Phaser.Utils.Objects.GetValue;class Ve extends I{constructor(t,e){super(t,e),this.type="rexSpinnerArrow"}resetFromConfig(t,e){var s;return void 0===e&&(e=!1),super.resetFromConfig(t,e),s=e?"down":this.direction,this.setDirection(Ie(t,"direction",s)),this}}Object.assign(Ve.prototype,zt),t.register("arrow",(function(t){var e=new Ve(this.scene,t);return this.scene.add.existing(e),e}));const ze=["left","right","up","down"];for(var Fe=0,Ne=ze.length;Fe<Ne;Fe++){let e=ze[Fe];t.register(`${e}Arrow`,(function(t){void 0===t&&(t={}),t.direction=e;var s=new Ve(this.scene,t);return this.scene.add.existing(s),s}))}Ye(window,"RexPlugins.Spinner.Arrow",Ve);class Ge extends I{constructor(t,e){super(t,e),this.type="rexSpinnerBall"}}Object.assign(Ge.prototype,Jt),t.register("ball",(function(t){var e=new Ge(this.scene,t);return this.scene.add.existing(e),e})),Ye(window,"RexPlugins.Spinner.Ball",Ge);class Ue extends I{constructor(t,e){super(t,e),this.type="rexSpinnerBars"}}Object.assign(Ue.prototype,Qt),t.register("bars",(function(t){var e=new Ue(this.scene,t);return this.scene.add.existing(e),e})),Ye(window,"RexPlugins.Spinner.Bars",Ue);class We extends I{constructor(t,e){super(t,e),this.type="rexSpinnerBox"}}Object.assign(We.prototype,$t),t.register("box",(function(t){var e=new We(this.scene,t);return this.scene.add.existing(e),e})),Ye(window,"RexPlugins.Spinner.Box",We);class He extends I{constructor(t,e){super(t,e),this.type="rexSpinnerClock"}}Object.assign(He.prototype,he),t.register("clock",(function(t){var e=new He(this.scene,t);return this.scene.add.existing(e),e})),Ye(window,"RexPlugins.Spinner.Clock",He);class Je extends I{constructor(t,e){super(t,e),this.type="rexSpinnerCube"}}Object.assign(Je.prototype,oe),t.register("cube",(function(t){var e=new Je(this.scene,t);return this.scene.add.existing(e),e})),Ye(window,"RexPlugins.Spinner.Cube",Je);const qe=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;class Ke extends G{constructor(t,e,s,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=s),super(),this.pathData=[],this.isDashed=!1,this.strokePathData=void 0,this.strokePathMask=void 0,this.dashPattern=void 0,this.dashOffset=0,this.closePath=!0,this.setTopLeftPosition(t,e),this.setSize(s,i)}get x(){return this._x}set x(t){this.dirty=this.dirty||this._x!==t,this._x=t}get y(){return this._y}set y(t){this.dirty=this.dirty||this._y!==t,this._y=t}setTopLeftPosition(t,e){return this.x=t,this.y=e,this}get width(){return this._width}set width(t){this.dirty=this.dirty||this._width!==t,this._width=t}get height(){return this._height}set height(t){this.dirty=this.dirty||this._height!==t,this._height=t}setSize(t,e){return this.width=t,this.height=e,this}get centerX(){return this.x+this.width/2}set centerX(t){this.x=t-this.width/2}get centerY(){return this.y+this.height/2}set centerY(t){this.y=t-this.height/2}setCenterPosition(t,e){return this.centerX=t,this.centerY=e,this}updateData(){this.pathData.length=0;var t=this.x,e=t+this.width,s=this.y,i=s+this.height;return this.pathData.push(t,s),this.pathData.push(e,s),this.pathData.push(e,i),this.pathData.push(t,i),this.pathData.push(t,s),super.updateData(),this.buildStrokePath(),this}webglRender(t,e,s,i,r){if(this.isFilled){var h=t.fillTint,a=qe(this.fillColor,this.fillAlpha*s);h.TL=a,h.TR=a,h.BL=a,h.BR=a,t.batchFillRect(-i+this.x,-r+this.y,this.width,this.height)}this.isStroked&&J(t,this,s,i,r)}canvasRender(t,e,s){this.isFilled&&(q(t,this),t.fillRect(-e,-s,this.width,this.height)),this.isStroked&&Q(t,this,e,s)}}Object.assign(Ke.prototype,ht);const Qe=Phaser.Utils.Objects.GetValue,$e=Phaser.Geom.Polygon.Earcut;class Ze extends G{constructor(t,e,s,i,r,h){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===h&&(h=0),super(),this.pathData=[],this.isDashed=!1,this.strokePathData=void 0,this.strokePathMask=void 0,this.dashPattern=void 0,this.dashOffset=0,this.pathIndexes=[],this.closePath=!0,this.setP0(t,e),this.setP1(s,i),this.setP2(r,h)}get x0(){return this._x0}set x0(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}get y0(){return this._y0}set y0(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}setP0(t,e){return this.x0=t,this.y0=e,this}get x1(){return this._x1}set x1(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}get y1(){return this._y1}set y1(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}setP1(t,e){return this.x1=t,this.y1=e,this}get x2(){return this._x2}set x2(t){this.dirty=this.dirty||this._x2!==t,this._x2=t}get y2(){return this._y2}set y2(t){this.dirty=this.dirty||this._y2!==t,this._y2=t}setP2(t,e){return this.dirty=this.dirty||this.x2!==t||this.y2!==e,this.x2=t,this.y2=e,this}updateData(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x2,this.y2),this.pathData.push(this.x0,this.y0),this.pathIndexes=$e(this.pathData),super.updateData(),this.buildStrokePath(),this}webglRender(t,e,s,i,r){this.isFilled&&W(t,e,this,s,i,r),this.isStroked&&J(t,this,s,i,r)}canvasRender(t,e,s){this.isFilled&&K(t,this,e,s),this.isStroked&&Q(t,this,e,s)}}Object.assign(Ze.prototype,ht);const ts={arc:Ut,circle:Wt,curve:class extends nt{constructor(t){super(),this.setCurve(t),this.setIterations(32)}get curve(){return this._curve}set curve(t){this.dirty=this.dirty||this._curve!==t,this._curve=t}setCurve(t){return this.curve=t,this}get iterations(){return this._iterations}set iterations(t){this.dirty=this.dirty||this._iterations!==t,this._iterations=t}setIterations(t){return this.iterations=t,this}updateData(){this.pathData.length=0;for(var t=this.curve.getPoints(this.iterations),e=0,s=t.length;e<s;e++)this.pathData.push(t[e].x,t[e].y);return this.pathData.push(t[0].x,t[0].y),super.updateData(),this}},ellipse:class extends Ut{constructor(t,e,s,i){super(t,e,s,i