phaser4-rex-plugins
Version:
2 lines (1 loc) • 40.2 kB
JavaScript
var t,e;t=void 0,e=function(){const t=Phaser.GameObjects.GetCalcMatrix,e=Phaser.Renderer.Canvas.SetTransform;var s={renderWebGL:function(e,s,i,a){s.updateData();var h=i.camera;h.addToRenderList(s);for(var r,n=t(s,h,a,!i.useCanvas).calc,o=s._displayOriginX,l=s._displayOriginY,u=s.alpha,d=s.customRenderNodes.Submitter||s.defaultRenderNodes.Submitter,p=s.geom,c=0,v=p.length;c<v;c++)(r=p[c]).visible&&r.webglRender(i,d,n,s,u,o,l)},renderCanvas:function(t,s,i,a){s.updateData(),i.addToRenderList(s);var h=t.currentContext;if(e(t,h,s,i,a)){for(var r,n=s._displayOriginX,o=s._displayOriginY,l=s.geom,u=0,d=l.length;u<d;u++)(r=l[u]).visible&&r.canvasRender(h,n,o);h.restore()}}},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];return t};const a=Phaser.GameObjects.Shape,h=Phaser.Utils.Array.Remove;class r extends a{constructor(t,e,s,i,a){void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=2),void 0===a&&(a=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,a),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,i(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],h(this.geom,e)),this}}Object.assign(r.prototype,s);var n={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 o=Phaser.Scene;var l=function(t){return t instanceof o};const u=Phaser.Game;var d=function(t){return t instanceof u};const p=Phaser.Utils.Objects.GetValue;class c{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:d(t)?t:d(t.game)?t.game:l(t)?t.sys.game:l(t.scene)?t.scene.sys.game:void 0}(t),this}}Object.assign(c.prototype,n);const v=Phaser.Utils.Objects.GetValue;class g extends c{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(v(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=y[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 y={no:0,lazy:1,always:2},f=Phaser.Utils.Objects.GetValue;class m extends g{constructor(t,e){super(t,e);var s=this.scene?"update":"step";this.tickEventName=f(e,"tickEventName",s),this.isSceneTicker=!S(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 S=function(t){return"step"===t||"poststep"===t};const P=Phaser.Utils.Objects.GetValue,D=Phaser.Math.Clamp;class b{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=P(t,"state",_),this.timeScale=P(t,"timeScale",1),this.delay=P(t,"delay",0),this.repeat=P(t,"repeat",0),this.repeatCounter=P(t,"repeatCounter",0),this.repeatDelay=P(t,"repeatDelay",0),this.duration=P(t,"duration",0),this.nowTime=P(t,"nowTime",0),this.justRestart=P(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:T,this.repeatCounter=0,this}stop(){return this.state=_,this}update(t,e){this.state!==_&&this.state!==A&&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=w)):(this.nowTime=this.duration,this.state=A):this.nowTime>=0&&(this.state=k))}get t(){var t;switch(this.state){case _:case T:case w:t=0;break;case k:t=this.nowTime/this.duration;break;case A:t=1}return D(t,0,1)}set t(t){(t=D(t,-1,1))<0?(this.state=T,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===_}get isDelay(){return this.state===T}get isCountDown(){return this.state===k}get isRunning(){return this.state===T||this.state===k}get isDone(){return this.state===A}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}}const _=0,T=1,k=2,w=3,A=-1;class M extends m{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 E=Phaser.Utils.Objects.GetValue,R=Phaser.Utils.Objects.GetAdvancedValue,C=Phaser.Tweens.Builders.GetEaseFunction;class x extends M{resetFromJSON(t){return this.timer.resetFromJSON(E(t,"timer")),this.setEnable(E(t,"enable",!0)),this.setTarget(E(t,"target",this.parent)),this.setDelay(R(t,"delay",0)),this.setDuration(R(t,"duration",1e3)),this.setEase(E(t,"ease","Linear")),this.setRepeat(E(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=C(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 X=Phaser.Utils.Objects.GetValue,Y=Phaser.Math.Linear;class L extends x{constructor(t,e){super(t,e),this.resetFromJSON(),this.boot()}start(t){if(this.timer.isRunning)return this;var e=this.target;this.propertyKey=X(t,"key","value");var s=e[this.propertyKey];return this.fromValue=X(t,"from",s),this.toValue=X(t,"to",s),this.setEase(X(t,"ease",this.ease)),this.setDuration(X(t,"duration",this.duration)),this.setRepeat(X(t,"repeat",0)),this.setDelay(X(t,"delay",0)),this.setRepeatDelay(X(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]=Y(this.fromValue,this.toValue,s)}}var V={start:function(t){return this.easeValueTask||(this.easeValueTask=new L(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 z=Phaser.Utils.Objects.GetValue;class I extends r{constructor(t,e){super(t,z(e,"x",0),z(e,"y",0),z(e,"width",64),z(e,"height",64)),this.resetFromConfig(e,!0),this.buildShapes(e),z(e,"start",!0)&&this.start()}resetFromConfig(t,e){var s;return void 0===e&&(e=!1),s=e?1e3:this.duration,this.setDuration(z(t,"duration",s)),s=e?"Linear":this.ease,this.setEase(z(t,"ease",s)),s=e?0:this.delay,this.setDelay(z(t,"delay",s)),s=e?0:this.repeatDelay,this.setRepeatDelay(z(t,"repeatDelay",s)),s=e?16777215:this.color,this.setColor(z(t,"color",s)),s=e?0:this.value,this.setValue(z(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,V);var O={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}},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){if(!t||"number"==typeof t)return s;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return s;e=e.split(".")}for(var i=e,a=t,h=s,r=0;r<i.length;r++){if(e=i[r],!a.hasOwnProperty(e)){h=s;break}a=h=a[e]}return h}(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&&i(this.data),this}};class j{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,a,h,r){}canvasRender(t,e,s){}updateData(){this.dirty=!1}}Object.assign(j.prototype,O,N);var F=Phaser.Renderer.WebGL.Utils,G=Phaser.Renderer.WebGL.Utils,W=function(t,e,s,i){var a=s||e.fillColor,h=i||e.fillAlpha,r=(16711680&a)>>>16,n=(65280&a)>>>8,o=255&a;t.fillStyle="rgba("+r+","+n+","+o+","+h+")"},B=function(t,e,s,i){var a=s||e.strokeColor,h=i||e.strokeAlpha,r=(16711680&a)>>>16,n=(65280&a)>>>8,o=255&a;t.strokeStyle="rgba("+r+","+n+","+o+","+h+")",t.lineWidth=e.lineWidth};const H=Phaser.Geom.Polygon.Earcut;class U extends j{constructor(){super(),this.pathData=[],this.pathIndexes=[],this.closePath=!1}updateData(){return this.pathIndexes=H(this.pathData),super.updateData(),this}webglRender(t,e,s,i,a,h,r){this.isFilled&&function(t,e,s,i,a,h,r,n){var o,l,u,d,p,c=F.getTintAppendFloatAlpha(a.fillColor,a.fillAlpha*h),v=a.pathData,g=a.pathIndexes,y=v.length,f=Array(2*y),m=Array(y),S=0,P=0;for(o=0;o<y;o+=2)l=v[o]-r,u=v[o+1]-n,d=s.getX(l,u),p=s.getY(l,u),f[S++]=d,f[S++]=p,m[P++]=c;e.batch(t,g,f,m)}(t,e,s,0,this,a,h,r),this.isStroked&&function(t,e,s,i,a,h,r,n){var o=G.getTintAppendFloatAlpha(a.strokeColor,a.strokeAlpha*h),l=a.pathData,u=l.length-1,d=a.lineWidth,p=!a.closePath,c=i.customRenderNodes.StrokePath||i.defaultRenderNodes.StrokePath,v=[];p&&(u-=2);for(var g=0;g<u;g+=2){var y=l[g]-r,f=l[g+1]-n;g>0&&y===l[g-2]&&f===l[g-1]||v.push({x:y,y:f,width:d})}c.run(t,e,v,d,p,s,o,o,o,o)}(t,e,s,i,this,a,h,r)}canvasRender(t,e,s){var i=this.pathData,a=i.length-1,h=i[0]-e,r=i[1]-s;t.beginPath(),t.moveTo(h,r),this.closePath||(a-=2);for(var n=2;n<a;n+=2){var o=i[n]-e,l=i[n+1]-s;t.lineTo(o,l)}this.closePath&&t.closePath(),this.isFilled&&(W(t,this),t.fill()),this.isStroked&&(B(t,this),t.stroke())}}var J=function(t,e,s){var i=s.length;if(i>=2){var a=s[i-2],h=s[i-1];if(t===a&&e===h)return s}return s.push(t,e),s};const K=Phaser.Math.DegToRad;var q=function(t,e,s,i,a,h,r,n,o){r&&h>a?h-=360:!r&&h<a&&(h+=360);var l=K(h-a)/n;a=K(a);for(var u=0;u<=n;u++){var d=a+l*u,p=t+s*Math.cos(d),c=e+i*Math.sin(d);J(p,c,o)}return o};const Q=Phaser.Math.Interpolation.QuadraticBezier,Z=Phaser.Math.Interpolation.CubicBezier,$=Phaser.Math.Interpolation.CatmullRom;var tt=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},et={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),J(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,a,h,r){return void 0===r&&(r=!1),q(t,e,s,i,a,h,r,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,a,h){return this.ellipticalArc(t,e,s,s,i,a,h),this},quadraticBezierTo(t,e,s,i){return function(t,e,s,i,a,h){for(var r=h.length,n=h[r-2],o=h[r-1],l=1,u=a-1;l<=u;l++){var d=l/u;h.push(Q(d,n,t,s),Q(d,o,e,i))}}(t,e,s,i,this.iterations,this.pathData),this.lastPointX=s,this.lastPointY=i,this},cubicBezierTo(t,e,s,i,a,h){return function(t,e,s,i,a,h,r,n){for(var o=n.length,l=n[o-2],u=n[o-1],d=1,p=r-1;d<=p;d++){var c=d/p;n.push(Z(c,l,t,s,a),Z(c,u,e,i,h))}}(t,e,s,i,a,h,this.iterations,this.pathData),this.lastPointX=a,this.lastPointY=h,this},catmullRomTo(...t){return function(t,e,s){for(var i=s.length,a=[s[i-2]],h=[s[i-1]],r=0,n=t.length;r<n;r+=2)a.push(t[r]),h.push(t[r+1]);r=1;for(var o=e-1;r<=o;r++){var l=r/o;s.push($(a,l),$(h,l))}}(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 tt(this.pathData),this}};const st=Phaser.Math.RotateAround,it=Phaser.Math.DegToRad;Phaser.Math.RotateAround;var at={rotateAround(t,e,s){if(0===this.pathData.length)return this;!function(t,e,s,i){for(var a={x:0,y:0},h=0,r=i.length-1;h<r;h+=2)a.x=i[h],a.y=i[h+1],st(a,t,e,s),i[h]=a.x,i[h+1]=a.y}(t,e,s=it(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,a){for(var h=0,r=a.length-1;h<r;h+=2){var n=a[h]-t,o=a[h+1]-e;n*=s,o*=i,a[h]=n+t,a[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 function(t,e,s){for(var i=0,a=s.length-1;i<a;i+=2)s[i]+=t,s[i+1]+=e}(t,e,this.pathData),this}},ht={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 a=0,h=t.length;a<h;a++)t[a]=e[a+s]}(this.pathData,this.pathDataSave),this.pathDataSave=void 0,this.pathDataSaved=!1,this):this}};const rt=Phaser.Math.Distance.Between,nt=Phaser.Math.Wrap,ot=Phaser.Math.Linear;var lt=function(t,e,s,i,a){if(void 0===i&&(i=s,s=0),(s=pt(s))!==(i=pt(i))){var h=e[e.length-1],r=h*s,n=h*i;s<i?ut(t,e,r,n,a):(ut(t,e,r,h,a),ut(t,e,0,n,a)),tt(a)}},ut=function(t,e,s,i,a){for(var h=s>0,r=0,n=e.length;r<n;r++){var o=2*r,l=e[r];if(h){if(l<s)continue;if(l==s)h=!1;else{var u=1-(l-s)/(l-e[r-1]);a.push(dt(t,o-2,o,u)),a.push(dt(t,o-1,o+1,u)),h=!1}}if(!(l<=i)){u=1-(l-i)/(l-e[r-1]),a.push(dt(t,o-2,o,u)),a.push(dt(t,o-1,o+1,u));break}if(a.push(t[o]),a.push(t[o+1]),l===i)break}},dt=function(t,e,s,i){var a=t[e],h=t[s];return ot(a,h,i)},pt=function(t){return 0===t?0:t%1==0?1:nt(t,0,1)},ct={updateAccumulationLengths(){if(null==this.accumulationLengths)this.accumulationLengths=[];else if(this.accumulationLengths.length===this.pathData.length/2)return this;for(var t,e,s,i,a=this.accumulationLengths,h=this.pathData,r=0,n=0,o=h.length;n<o;n+=2)s=h[n],i=h[n+1],r+=void 0===t?0:rt(t,e,s,i),a.push(r),t=s,e=i;return this.totalPathLength=r,this},setDisplayPathSegment(t,e){return this.pathDataSaved||(this.updateAccumulationLengths(),this.savePathData()),this.pathData.length=0,lt(this.pathDataSave,this.accumulationLengths,t,e,this.pathData),this},appendFromPathSegment(t,e,s){return void 0===e?this.pathData.push(...t.pathData):(t.updateAccumulationLengths(),lt(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}},vt={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 gt=Phaser.Geom.Polygon;class yt{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 gt),e.setTo(t),e}(this.pathData,t)}}Object.assign(yt.prototype,et,at,ht,ct,vt);class ft extends U{constructor(){super(),this.builder=new yt(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,a,h,r){return this.builder.ellipticalArc(t,e,s,i,a,h,r),this.dirty=!0,this}arc(t,e,s,i,a,h){return this.builder.arc(t,e,s,i,a,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,a,h){return this.builder.cubicBezierTo(t,e,s,i,a,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 mt=function(t,e){return void 0===e&&(e=.5),t<=e?t/=e:t=1-(t-e)/(1-e),t};const St=Phaser.Math.DegToRad,Pt=Phaser.Math.Linear,Dt=Phaser.Math.Easing.Expo.In,bt={right:0,down:1,left:2,up:3};var _t=function(t,e,s,i,a,h,r,n,o,l,u){var d=kt(e,0,i,a,h,r,n,o,l,u);t.startAt(d.x,d.y);var p=kt(s,0,i,a,h,r,n,o,l,u);t.lineTo(p.x,p.y);var c=kt(s,s,i,a,h,r,n,o,l,u);t.lineTo(c.x,c.y);var v=kt(0,s,i,a,h,r,n,o,l,u);t.lineTo(v.x,v.y);var g=kt(0,e,i,a,h,r,n,o,l,u);t.lineTo(g.x,g.y);var y=kt(e,e,i,a,h,r,n,o,l,u);t.lineTo(y.x,y.y),t.close()},Tt={},kt=function(t,e,s,i,a,h,r,n,o,l){var u=t*s,d=e*i;return Tt.x=r*u+n*d+a,Tt.y=o*u+l*d+h,Tt},wt={setDirection(t){return"string"==typeof t&&(t=bt[t]),this.direction=t,this},buildShapes(){for(var t=0;t<3;t++)this.addShape(new ft)},updateShapes(){var t,e,s,i,a,h;switch(this.direction){case 1:t=this.centerX,e=this.centerY-this.radius;var r=St(315);s=Math.cos(r),i=Math.sin(r);var n=St(45);a=Math.cos(n),h=Math.sin(n);break;case 3:t=this.centerX,e=this.centerY+this.radius,r=St(135),s=Math.cos(r),i=Math.sin(r),n=St(225),a=Math.cos(n),h=Math.sin(n);break;case 2:t=this.centerX+this.radius,e=this.centerY,r=St(225),s=Math.cos(r),i=Math.sin(r),n=St(315),a=Math.cos(n),h=Math.sin(n);break;default:t=this.centerX-this.radius,e=this.centerY,r=St(45),s=Math.cos(r),i=Math.sin(r),n=St(135),a=Math.cos(n),h=Math.sin(n)}for(var o=this.radius/7,l=this.getShapes(),u=0,d=l.length;u<d;u++){var p=l[u],c=(this.value+.1*(d-u))%1;c=Dt(mt(c));var v=Pt(.25,1,c);p.fillStyle(this.color,v);var g=3*u+1;_t(p,g,g+2,o,o,t,e,s,i,a,h)}}};class At extends U{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 Mt=Phaser.Math.Linear;var Et={buildShapes(){for(var t=0;t<4;t++)this.addShape(new At);this.prevValue=void 0},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=e+s,h=2*s,r=this.getShapes(),n=r.length,o=2*s/n,l=.7*o;if(void 0===this.prevValue||this.prevValue>this.value)for(var u=0;u<n;u++){var d=r[u],p=void 0===this.prevValue?Math.random():d.getData("to");d.setData("from",p).setData("to",Math.random())}for(this.prevValue=this.value,u=0;u<n;u++){p=(d=r[u]).getData("from");var c=d.getData("to"),v=Mt(p,c,this.value)*h,g=i+o*(u+.5);d.lineStyle(l,this.color,1).setP0(g,a).setP1(g,a-v)}}};const Rt=Phaser.Math.DegToRad;class Ct extends U{constructor(t,e,s,i,a,h,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===s&&(s=0),void 0===i&&(i=0),void 0===a&&(a=0),void 0===h&&(h=360),void 0===r&&(r=!1),void 0===n&&(n=!1),super(),this.setCenterPosition(t,e),this.setRadius(s,i),this.setAngle(a,h,r),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),q(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}canvasRender(t,e,s){t.beginPath();var i=this.x-e,a=this.y-s,h=Rt(this.startAngle),r=Rt(this.endAngle);this.pie&&(t.moveTo(i,a),t.lineTo(i+Math.cos(h)*this.radiusX,a+Math.sin(h)*this.radiusY)),t.ellipse(i,a,this.radiusX,this.radiusY,0,h,r,this.anticlockwise),this.pie&&t.lineTo(i,a),this.isFilled&&(W(t,this),t.fill()),this.isStroked&&(B(t,this),t.stroke())}}class xt extends Ct{constructor(t,e,s){super(t,e,s,s,0,360)}}const Xt=Phaser.Math.Linear;var Yt={buildShapes(){for(var t=0;t<3;t++)this.addShape(new xt)},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=.1*s,a=Math.ceil(.25*i),h=1-mt(this.value),r=Xt(.3,.9,h)*s,n=this.getShapes(),o=0,l=n.length;o<l;o++){var u=n[o],d=(h=(this.value+o/l)%1,2*Math.PI*h);u.lineStyle(a,this.color).setRadius(i).setCenterPosition(t+Math.cos(d)*r,e+Math.sin(d)*r)}}};const Lt=Phaser.Math.Linear,Vt=Phaser.Math.Easing.Expo.In;var zt={buildShapes(){for(var t=0;t<5;t++){var e=new At;this.addShape(e);var s=mt(t/4)/2;e.setData("offset",s)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=2*s,h=this.getShapes(),r=h.length,n=2*s/r,o=.7*n,l=0;l<r;l++){var u=h[l],d=(this.value+u.getData("offset"))%1;d=Vt(mt(d));var p=Lt(.4,1,d)*a,c=i+n*(l+.5);u.lineStyle(o,this.color,1).setP0(c,e-p/2).setP1(c,e+p/2)}}},It={buildShapes(){this.addShape((new ft).setName("border")),this.addShape((new ft).setName("fill"))},updateShapes(){var t=this.centerX,e=this.centerY,s=.7*this.radius,i=t-s,a=e-s,h=2*s;if(this.getShape("border").lineStyle(2,this.color,1).startAt(i,a).lineTo(h,0,!0).lineTo(0,h,!0).lineTo(-h,0,!0).lineTo(0,-h,!0).close(),this.value<.5){var r=h*(2*(.5-this.value));this.getShape("fill").fillStyle(this.color,1).startAt(i,a).lineTo(h,0,!0).lineTo(0,r,!0).lineTo(-h,0,!0).lineTo(0,-r,!0).close()}else{var n=2*(this.value-.5)*180;this.getShape("border").rotateAround(t,e,n),this.getShape("fill").fillStyle().lineStyle()}}};const Ot=Phaser.Math.RadToDeg,Nt=Phaser.Math.Angle.WrapDegrees,jt=Phaser.Math.Angle.Wrap,Ft=Phaser.Math.Angle.ShortestBetween,Gt=Phaser.Math.DegToRad,Wt=Phaser.Math.DegToRad(270);var Bt={buildShapes(){this.addShape((new xt).setName("border")),this.addShape((new At).setName("minuteHand")),this.addShape((new At).setName("hourHand")),this.minuteHandAngle=0,this.hourHandAngle=0},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),a=s-i/2,h=.8*s,r=.5*s,n=this.minuteHandAngle;this.minuteHandAngle=2*Math.PI*this.value;var o=Nt(Ot(n)),l=Nt(Ot(this.minuteHandAngle)),u=Ft(o,l);this.hourHandAngle=jt(this.hourHandAngle+Gt(u)/12),this.getShape("border").lineStyle(i,this.color).setRadius(a).setCenterPosition(t,e);var d=this.minuteHandAngle+Wt;this.getShape("minuteHand").lineStyle(i,this.color).setP0(t,e).setP1(t+Math.cos(d)*h,e+Math.sin(d)*h),d=this.hourHandAngle+Wt,this.getShape("hourHand").lineStyle(i,this.color).setP0(t,e).setP1(t+Math.cos(d)*r,e+Math.sin(d)*r)}};const Ht=Phaser.Math.Linear,Ut=Phaser.Math.Easing.Expo.In;var Jt={buildShapes(){for(var t=0;t<4;t++){var e=new At;this.addShape(e)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=e-s,h=2*s/2,r=2*s/2,n=this.getShapes(),o=n.length,l=0;l<o;l++){var u=i+h*(l%2+.5),d=a+r*(Math.floor(l/2)+.5),p=n[l],c=(this.value+.1*(o-l))%1;c=Ut(mt(c));var v=(o-l)/o,g=Ht(.7,1,c)*r,y=Ht(.7,1,c)*h;p.lineStyle(y,this.color,v).setP0(u-g/2,d).setP1(u+g/2,d)}}};const Kt=Phaser.Math.Linear;var qt={buildShapes(){for(var t=0;t<3;t++){var e=new xt;this.addShape(e);var s=mt(t/2)/2;e.setData("offset",s)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=this.getShapes(),h=a.length,r=2*s/h,n=r/2,o=0;o<h;o++){var l=a[o],u=(this.value+l.getData("offset"))%1;u=mt(u);var d=Kt(.25,1,u),p=Kt(.5,1,u)*n;l.fillStyle(this.color,d).setRadius(p).setCenterPosition(i+r*(o+.5),e)}}};const Qt=Phaser.Math.Linear,Zt=Phaser.Math.Easing.Expo.In;var $t={buildShapes(){for(var t=0;t<3;t++){var e=new At;this.addShape(e)}},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=t-s,a=this.getShapes(),h=a.length,r=2*s/h,n=2*s,o=0;o<h;o++){var l=a[o],u=(this.value+.1*(h-o))%1;u=Zt(mt(u));var d=(o+1)/h,p=Qt(.7,1,u)*n,c=Qt(.7,1,u)*r,v=i+r*(o+.5);l.lineStyle(c,this.color,d).setP0(v,e-p/2).setP1(v,e+p/2)}}};const te=Phaser.Math.Linear;var ee={buildShapes(){for(var t=0;t<9;t++){var e=new xt;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,a=t-s,h=e-s,r=2*s/3,n=2*s/3,o=Math.min(r,n)/2*.8,l=this.getShapes(),u=0,d=l.length;u<d;u++){var p=a+r*(u%3+.5),c=h+n*(Math.floor(u/3)+.5),v=l[u],g=(this.value+v.getData("offset"))%1;g=mt(g),v.fillStyle(this.color,te(.25,1,g)),i&&v.setRadius(o).setCenterPosition(p,c)}this.isInitialize=!1}},se={buildShapes(){for(var t=0;t<2;t++)this.addShape(new ft)},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),a=s-i,h=.6*a,r=.7*a,n=1.2*a,o=this.getShapes(),l=0,u=o.length;l<u;l++){var d=o[l],p=(this.value+l/u)%1,c=mt(p),v=t,g=e-15*p,y=a*p,f=h*p,m=r*p,S=n*p;d.lineStyle(i,this.color,c).startAt(v,g).cubicBezierTo(v,g-f,v-y,g-f,v-y,g).cubicBezierTo(v-y,g+f,v,g+m,v,g+S).cubicBezierTo(v,g+m,v+y,g+f,v+y,g).cubicBezierTo(v+y,g-f,v,g-f,v,g).close()}}};const ie=Phaser.Math.Linear;var ae={buildShapes(){for(var t=0;t<12;t++)this.addShape(new At);this.isInitialize=!0},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.isInitialize||this.isSizeChanged,i=this.radius,a=i/2,h=Math.ceil(i/20),r=this.getShapes(),n=0,o=r.length;n<o;n++){var l=r[n],u=n/o,d=2*Math.PI*u,p=ie(.25,1,(1-this.value+u)%1);l.lineStyle(h,this.color,p),s&&l.setP0(t+Math.cos(d)*a,e+Math.sin(d)*a).setP1(t+Math.cos(d)*i,e+Math.sin(d)*i)}this.isInitialize=!1}},he={buildShapes(){this.addShape((new xt).setName("track")),this.addShape((new xt).setName("thumb"))},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=.9*s,a=Math.ceil(i/25),h=.1*s,r=2*Math.PI*this.value;this.getShape("track").lineStyle(a,this.color,.7).setRadius(i).setCenterPosition(t,e),this.getShape("thumb").fillStyle(this.color).setRadius(h).setCenterPosition(t+Math.cos(r)*i,e+Math.sin(r)*i)}},re={buildShapes(){this.addShape((new xt).setName("track")),this.addShape((new Ct).setName("arc"))},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),a=s-i/2;this.getShape("track").lineStyle(i,this.color,.5).setRadius(a).setCenterPosition(t,e);var h=360*this.value,r=h+60;this.getShape("arc").lineStyle(i,this.color,1).setRadius(a).setCenterPosition(t,e).setAngle(h,r)}};const ne=Phaser.Math.Linear;var oe={buildShapes(){for(var t=0;t<4;t++){var e=(new Ct).setPie();this.addShape(e),e.setData("speed",ne(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 a=this.getShapes(),h=0,r=a.length;h<r;h++){var n=a[h],o=(h+1)/r;if(void 0===this.prevValue){var l=90+(u=h/r*360);n.fillStyle(this.color,o).setRadius(i).setCenterPosition(e,s).setAngle(u,l).setData("angle",u)}else{var u=n.getData("angle")+n.getData("speed")*t;l=90+(u%=360),n.fillStyle(this.color,o).setRadius(i).setCenterPosition(e,s).setAngle(u,l).setData("angle",u)}}this.prevValue=this.value}},le={buildShapes(){this.addShape(new xt)},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=s*this.value,a=Math.ceil(s/25),h=mt(this.value);this.getShapes()[0].lineStyle(a,this.color,h).setRadius(i).setCenterPosition(t,e)}};const ue=Phaser.Math.Linear,de=Phaser.Math.Easing.Expo.In;var pe={buildShapes(){this.addShape((new xt).setName("center")),this.addShape((new ft).setName("arc0")),this.addShape((new ft).setName("arc1")),this.isInitialize=!0},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=this.isInitialize||this.isSizeChanged,a=2*s/6,h=t-s+a,r=e+s-a,n=this.getShapes(),o=0,l=n.length;o<l;o++){var u=n[o],d=(this.value+.1*(l-o))%1;d=de(mt(d));var p=ue(.25,1,d);switch(u.name){case"center":u.fillStyle(this.color,p),i&&u.setRadius(a).setCenterPosition(h,r);break;case"arc0":if(u.fillStyle(this.color,p),i){var c=2*a,v=3*a;u.startAt(h,r-c).lineTo(h,r-v).setIterations(8).arc(h,r,v,270,360).lineTo(h+c,r).setIterations(6).arc(h,r,c,360,270,!0).close()}break;case"arc1":u.fillStyle(this.color,p),i&&(c=4*a,v=5*a,u.startAt(h,r-c).lineTo(h,r-v).setIterations(8).arc(h,r,v,270,360).lineTo(h+c,r).setIterations(6).arc(h,r,c,360,270,!0).close())}}this.isInitialize=!1}},ce={buildShapes(){for(var t=0;t<2;t++)this.addShape(new xt)},updateShapes(){for(var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/25),a=s-i,h=this.getShapes(),r=0,n=h.length;r<n;r++){var o=h[r],l=(this.value+r/n)%1,u=mt(l);o.lineStyle(i,this.color,u).setRadius(l*a).setCenterPosition(t,e)}}},ve={buildShapes(){this.addShape((new Ct).setName("arc"))},updateShapes(){var t=this.centerX,e=this.centerY,s=this.radius,i=Math.ceil(s/10),a=s-i,h=720*this.value,r=h-180*mt(this.value);this.getShape("arc").lineStyle(i,this.color,1).setRadius(a).setCenterPosition(t,e).setAngle(r+315,h+315)}};Phaser.Utils.Objects.GetValue;const ge={leftArrow:wt,rightArrow:wt,upArrow:wt,downArrow:wt,audio:Et,ball:Yt,bars:zt,box:It,clock:Bt,cube:Jt,dots:qt,facebook:$t,grid:ee,hearts:se,ios:ae,oribit:he,oval:re,pie:oe,puff:le,radio:pe,rings:ce,spinner:ve},ye=[];for(var fe in ge)ye.push(fe);const me=Phaser.Utils.Array.GetRandom;var Se={setAnimationMode(t,e){ge.hasOwnProperty(t)||(t=me(ye)),this.animationMode=t;var s=ge[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=me(ye);return this.setAnimationMode(e,t),this}};const Pe=Phaser.Utils.Objects.GetValue;class De extends I{constructor(t,e){super(t,e),this.type="rexSpinnerAIO",this.setAnimationMode(Pe(e,"animationMode"))}}return Object.assign(De.prototype,Se),De},"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexaiospinner=e();