UNPKG

@petkoneo/phaser3-rex-plugins

Version:
1 lines 163 kB
var t,e;t=void 0,e=function(){var t={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):[]}},e={hasProperty(t){var e=this.gameObject;return!!e.hasOwnProperty(t)||void 0!==e[t]},getProperty(t){return this.gameObject[t]},setProperty(t,e){return this.gameObject[t]=e,this},easeProperty(t){var e=t.property,i=t.value,s=t.duration,r=t.delay,n=t.ease,a=t.repeat,o=t.yoyo,h=t.from,u=t.complete,c=t.target;if(void 0===s&&(s=1e3),void 0===r&&(r=0),void 0===n&&(n="Linear"),void 0===a&&(a=0),void 0===o&&(o=!1),void 0===c&&(c=this.gameObject),h){var l=i;i=c[e],c[e]=l}return(t={targets:c,duration:s,delay:r,ease:n,repeat:a,yoyo:o,onComplete:u})[e]=i,this.addTweenTask(e,t),this},addTweenTask(t,e){var i=this.tweens,s=i[t];s&&s.remove();var r=e.onComplete;return e.onComplete=function(){i[t].remove(),i[t]=null,r&&r(e.targets,t)},(s=this.scene.tweens.add(e)).timeScale=this.timeScale,i[t]=s,this},getTweenTask(t){return this.tweens[t]},freeTweens(){var t,e=this.tweens;for(var i in e)(t=e[i])&&t.remove(),e[i]=null;return this}},i={hasMethod(t){return"function"==typeof this.gameObject[t]},call(t,...e){if(!this.hasMethod(t))return console.warn(`[GameObjectManager] Game object '${this.name}' does not have method '${t}'`),this;var i=this.gameObject;return i[t].apply(i,e),this}},s={hasData(t){var e=this.gameObject;return!!e.data&&e.data.has(t)},getData(t){return this.gameObject.getData(t)},setData(t,e){return this.gameObject.setData(t,e),this}};class r{constructor(t,e,i){this.GOManager=t,this.tweens={},this.effects={},this.setGO(e,i)}get scene(){return this.GOManager.scene}get timeScale(){return this.GOManager.timeScale}destroy(){this.freeGO(),this.GOManager=void 0}freeGO(){return this.freeTweens(),this.gameObject.bob=void 0,this.gameObject.destroy(),this.gameObject=void 0,this}setGO(t,e){return t.goName=e,t.goType=this.GOManager.name,t.bob=this,this.gameObject=t,this.name=e,this.freeTweens(),this}setTimeScale(t){var e=this.tweens;for(var i in e){var s=e[i];s&&(s.timeScale=t)}return this}}Object.assign(r.prototype,e,i,s);var n=function(t){return t&&"!"!==t.charAt(0)},a={has(t){return this.bobs.hasOwnProperty(t)},exists(t){return this.bobs.hasOwnProperty(t)},get(t,e){if(n(t))return this.bobs[t];for(var i in void 0===e&&(e=[]),t&&(t=t.substring(1)),this.bobs)t&&i===t||e.push(this.bobs[i]);return e},getFitst(t){for(var e in t&&"!"===t.charAt(0)&&(t=t.substring(1)),this.bobs)if(!t||t!==e)return this.bobs[e];return null},getGO(t,e){var i=this.get(t);return i?Array.isArray(i)?(void 0===e&&(e=[]),i.forEach((function(t){e.push(t.gameObject)})),e):i.gameObject:null},forEachGO(t,e){for(var i in this.bobs){var s=this.bobs[i].gameObject;if(e?t.call(e,s,i,this):t(s,i,this))break}return this},getAllGO(t){for(var e in void 0===t&&(t=[]),this.bobs){var i=this.bobs[e].gameObject;t.push(i)}return t}},o=function(t){return t>>16&255},h=function(t){return t>>8&255},u=function(t){return 255&t};const c=Phaser.Events.EventEmitter;var l=function(t,e,i,s,r,n){return void 0===n?n={}:!0===n&&(n=d),"number"!=typeof i&&(i=0,s=0),n.x=r.x+r.width*t+i,n.y=r.y+r.height*e+s,n},d={},f=function(t,e,i,s,r,n,a){if(t.hasOwnProperty("vp"))return t;"function"==typeof i&&(a=i,i=void 0),"function"==typeof r&&(a=r,r=void 0),void 0===i&&(i=.5),void 0===s&&(s=.5),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=l),function(t){if(t.events)return t;var e=new c,i=t.x;Object.defineProperty(t,"x",{get:function(){return i},set:function(s){i!==s&&(i=s,e.emit("update",t))}});var s=t.y;Object.defineProperty(t,"y",{get:function(){return s},set:function(i){s!==i&&(s=i,e.emit("update",t))}});var r=t.width;Object.defineProperty(t,"width",{get:function(){return r},set:function(i){r!==i&&(r=i,e.emit("update",t))}});var n=t.height;Object.defineProperty(t,"height",{get:function(){return n},set:function(i){n!==i&&(n=i,e.emit("update",t))}}),t.events=e}(e);var o=e.events;t.vp=e;var h=function(){a(i,s,r,n,e,t)};o.on("update",h),t.once("destroy",(function(){o.off("update",h),t.vp=void 0})),Object.defineProperty(t,"vpx",{get:function(){return i},set:function(t){i!==t&&(i=t,h())}}),Object.defineProperty(t,"vpy",{get:function(){return s},set:function(t){s!==t&&(s=t,h())}}),Object.defineProperty(t,"vpxOffset",{get:function(){return r},set:function(t){r!==t&&(r=t,h())}}),Object.defineProperty(t,"vpyOffset",{get:function(){return n},set:function(t){n!==t&&(n=t,h())}}),h()},g=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},p=function(t){return t.preFX?t.preFX:t.postFX?t.postFX:null},v=function(t,e){t._effectSwitchNames||(t._effectSwitchNames=[],t.clearAllEffects=function(){for(var e=t._effectSwitchNames,i=0,s=e.length;i<s;i++)t[e[i]]=null;return t},t.on("destroy",t.clearAllEffects,t)),t._effectSwitchNames.push(e)},m=function(t,e,i){if(g(t,e))return t;var s=p(t);if(!s)return t;var r,n=`_${e}Effect`;return Object.defineProperty(t,e,{get:function(){return r},set:function(a){r!==a&&(null===(r=a)||!1===r?t[n]&&(s.remove(t[n]),t[n]=void 0):(t[n]||(t[n]=s.addColorMatrix()),t[n][e](1===i?a:void 0)))}}),t[e]=null,v(t,e),t};const y={barrel:function(t){if(g(t,"barrel"))return t;var e,i=p(t);return i?(Object.defineProperty(t,"barrel",{get:function(){return e},set:function(s){e!==s&&(null===(e=s)||!1===e?t._barrelEffect&&(i.remove(t._barrelEffect),t._barrelEffect=void 0):(t._barrelEffect||(t._barrelEffect=i.addBarrel()),t._barrelEffect.amount=e))}}),t.barrel=null,v(t,"barrel"),t):t},blackWhite:function(t){return m(t,"blackWhite"),t},bloom:function(t){if(g(t,"bloomColor"))return t;var e=p(t);if(!e)return t;var i,s=1,r=1,n=1,a=1,o=4;return Object.defineProperty(t,"bloomColor",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._bloom&&(e.remove(t._bloom),t._bloom=void 0,e.setPadding(0)):(t._bloom||(t._bloom=e.addBloom(i,s,r,n,a,o),e.setPadding(Math.max(s,r)+1)),t._bloom.color=i))}}),Object.defineProperty(t,"bloomOffsetX",{get:function(){return s},set:function(i){if(s!==i&&(s=i,t._bloom)){var n=Math.max(s,r);e.setPadding(n+1),t._bloom.offsetX=s}}}),Object.defineProperty(t,"bloomOffsetY",{get:function(){return r},set:function(i){if(r!==i&&(r=i,t._bloom)){var n=Math.max(s,r);e.setPadding(n+1),t._bloom.offsetY=r}}}),Object.defineProperty(t,"bloomBlurStrength",{get:function(){return n},set:function(e){n!==e&&(n=e,t._bloom&&(t._bloom.blurStrength=n))}}),Object.defineProperty(t,"bloomStrength",{get:function(){return a},set:function(e){a!==e&&(a=e,t._bloom&&(t._bloom.strength=a))}}),Object.defineProperty(t,"bloomSteps",{get:function(){return o},set:function(e){o!==e&&(o=e,t._bloom&&(t._bloom.steps=o))}}),t.bloomColor=null,v(t,"bloomColor"),t},blur:function(t){if(g(t,"blurColor"))return t;var e=p(t);if(!e)return t;var i,s=0,r=1,n=1,a=1,o=4;return Object.defineProperty(t,"blurColor",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._blur&&(e.remove(t._blur),t._blur=void 0,e.setPadding(0)):(t._blur||(t._blur=e.addBlur(s,r,n,a,i,o),e.setPadding(Math.max(r,n)+1)),t._blur.color=i))}}),Object.defineProperty(t,"blurQuality",{get:function(){return s},set:function(e){s!==e&&(s=e,t._blur&&(t._blur.quality=s))}}),Object.defineProperty(t,"blurX",{get:function(){return r},set:function(i){if(r!==i&&(r=i,t._blur)){var s=Math.max(r,n);e.setPadding(s+1),t._blur.x=r}}}),Object.defineProperty(t,"blurY",{get:function(){return n},set:function(i){if(n!==i&&(n=i,t._blur)){var s=Math.max(r,n);e.setPadding(s+1),t._blur.y=n}}}),Object.defineProperty(t,"blurStrength",{get:function(){return a},set:function(e){a!==e&&(a=e,t._blur&&(t._blur.strength=a))}}),Object.defineProperty(t,"blurSteps",{get:function(){return o},set:function(e){o!==e&&(o=e,t._blur&&(t._blur.steps=o))}}),t.blurColor=null,v(t,"blurColor"),t},bokeh:function(t){if(g(t,"bokehRadius"))return t;var e=p(t);if(!e)return t;var i,s=1,r=.2;return Object.defineProperty(t,"bokehRadius",{get:function(){return i},set:function(n){i!==n&&(null===(i=n)||!1===i?t._bokeh&&(e.remove(t._bokeh),t._bokeh=void 0):(t._bokeh||(t._bokeh=e.addBokeh(i,s,r)),t._bokeh.radius=i))}}),Object.defineProperty(t,"bokehAmount",{get:function(){return s},set:function(e){s!==e&&(s=e,t._bokeh&&(t._bokeh.amount=s))}}),Object.defineProperty(t,"bokehContrast",{get:function(){return r},set:function(e){r!==e&&(r=e,t._bokeh&&(t._bokeh.contrast=r))}}),t.bokehRadius=null,v(t,"bokehRadius"),t},brightness:function(t){return m(t,"brightness",1),t},brown:function(t){return m(t,"brown"),t},circle:function(t){if(g(t,"circleColor"))return t;var e=p(t);if(!e)return t;var i,s=8,r=0,n=.4,a=1,o=.005;return Object.defineProperty(t,"circleColor",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._circle&&(e.remove(t._circle),t._circle=void 0):(t._circle||(t._circle=e.addCircle(s,i,r,a,o),t.circleBackgroundAlpha=n),t._circle.color=i))}}),Object.defineProperty(t,"circleThickness",{get:function(){return s},set:function(e){s!==e&&(s=e,t._circle&&(t._circle.thickness=s))}}),Object.defineProperty(t,"circleBackgroundColor",{get:function(){return r},set:function(e){r!==e&&(r=e,t._circle&&(t._circle.backgroundColor=r))}}),Object.defineProperty(t,"circleBackgroundAlpha",{get:function(){return n},set:function(e){n!==e&&(n=e,t._circle&&(t._circle.glcolor2[3]=n))}}),Object.defineProperty(t,"circleScale",{get:function(){return a},set:function(e){a!==e&&(a=e,t._circle&&(t._circle.scale=a))}}),Object.defineProperty(t,"circleFeather",{get:function(){return o},set:function(e){o!==e&&(o=e,t._circle&&(t._circle.feather=o))}}),t.circleColor=null,v(t,"circleColor"),t},contrast:function(t){return m(t,"contrast",1),t},desaturate:function(t){return m(t,"desaturate",1),t},desaturateLuminance:function(t){return m(t,"desaturateLuminance"),t},displacement:function(t){if(g(t,"displacementKey"))return t;var e=p(t);if(!e)return t;var i,s=.005,r=.005;return Object.defineProperty(t,"displacementKey",{get:function(){return i},set:function(n){i!==n&&(null===(i=n)||!1===i?t._displacement&&(e.remove(t._displacement),t._displacement=void 0):(t._displacement||(t._displacement=e.addDisplacement(i,s,r)),t._displacement.setTexture(i)))}}),Object.defineProperty(t,"displacementX",{get:function(){return s},set:function(e){s!==e&&(s=e,t._displacement&&(t._displacement.x=s))}}),Object.defineProperty(t,"displacementY",{get:function(){return r},set:function(e){r!==e&&(r=e,t._displacement&&(t._displacement.y=r))}}),t.displacementKey=null,v(t,"displacementKey"),t},glow:function(t){if(g(t,"glowColor"))return t;var e=p(t);if(!e)return t;var i,s=4,r=0;return Object.defineProperty(t,"glowColor",{get:function(){return i},set:function(n){i!==n&&(null===(i=n)||!1===i?t._glow&&(e.remove(t._glow),t._glow=void 0,e.setPadding(0)):(t._glow||(t._glow=e.addGlow(i,s,r),e.setPadding(s+1)),t._glow.color=i))}}),Object.defineProperty(t,"glowOuterStrength",{get:function(){return s},set:function(i){s!==i&&(s=i,t._glow&&(e.setPadding(s+1),t._glow.outerStrength=s))}}),Object.defineProperty(t,"glowInnerStrength",{get:function(){return r},set:function(e){r!==e&&(r=e,t._glow&&(t._glow.innerStrength=r))}}),t.glowColor=null,v(t,"glowColor"),t},gradient:function(t){if(g(t,"gradientColor"))return t;var e=p(t);if(!e)return t;var i,s,r=.5,n=0,a=0,o=0,h=1,u=0;return Object.defineProperty(t,"gradientColor",{get:function(){return[i,s]},set:function(c){var l,d;null===c||!1===c?(l=null,d=null):(l=c[0],d=c[1]),i===l&&s===d||(s=d,null===(i=l)||!1===i?t._gradient&&(e.remove(t._gradient),t._gradient=void 0):(t._gradient||(t._gradient=e.addGradient(i,s,r,n,a,o,h,u)),t._gradient.color1=i,t._gradient.color2=s))}}),Object.defineProperty(t,"gradientColor1",{get:function(){return i},set:function(e){null!==e&&!1!==e?i!==e&&(i=e,t._gradient&&(t._gradient.color1=i)):t.gradientColor=e}}),Object.defineProperty(t,"gradientColor2",{get:function(){return s},set:function(e){null!==e&&!1!==e?s!==e&&(s=e,t._gradient&&(t._gradient.color2=s)):t.gradientColor=e}}),Object.defineProperty(t,"gradientAlpha",{get:function(){return r},set:function(e){r!==e&&(r=e,t._gradient&&(t._gradient.alpha=r))}}),Object.defineProperty(t,"gradientFromX",{get:function(){return n},set:function(e){n!==e&&(n=e,t._gradient&&(t._gradient.fromX=n))}}),Object.defineProperty(t,"gradientFromY",{get:function(){return a},set:function(e){a!==e&&(a=e,t._gradient&&(t._gradient.fromY=a))}}),Object.defineProperty(t,"gradientToX",{get:function(){return o},set:function(e){o!==e&&(o=e,t._gradient&&(t._gradient.toX=o))}}),Object.defineProperty(t,"gradientToY",{get:function(){return h},set:function(e){h!==e&&(h=e,t._gradient&&(t._gradient.toY=h))}}),Object.defineProperty(t,"gradientSize",{get:function(){return u},set:function(e){u!==e&&(u=e,t._gradient&&(t._gradient.size=u))}}),t.gradientColor=null,v(t,"gradientColor"),t},grayscale:function(t){return m(t,"grayscale",1),t},hue:function(t){return m(t,"hue",1),t},kodachrome:function(t){return m(t,"kodachrome"),t},lsd:function(t){return m(t,"lsd"),t},negative:function(t){return m(t,"negative"),t},pixelate:function(t){if(g(t,"pixelate"))return t;var e,i=p(t);return i?(Object.defineProperty(t,"pixelate",{get:function(){return e},set:function(s){e!==s&&(null===(e=s)||!1===e?t._pixelateEffect&&(i.remove(t._pixelateEffect),t._pixelateEffect=void 0):(t._pixelateEffect||(t._pixelateEffect=i.addPixelate()),t._pixelateEffect.amount=e))}}),t.pixelate=null,v(t,"pixelate"),t):t},polaroid:function(t){return m(t,"polaroid"),t},reveal:function(t){if(g(t,"revealLeft"))return t;var e=p(t);if(!e)return t;var i,s,r,n,a=.1,o=function(){i=null,s=null,r=null,n=null},h=function(t){t._revealEffect&&(e.remove(t._revealEffect),t._revealEffect=void 0)};return Object.defineProperty(t,"revealLeft",{get:function(){return i},set:function(s){i!==s&&(o(),null===(i=s)||!1===i?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(a,0,0)),t._revealEffect.direction=1,t._revealEffect.axis=0,t._revealEffect.progress=i))}}),Object.defineProperty(t,"revealRight",{get:function(){return s},set:function(i){s!==i&&(o(),null===(s=i)||!1===s?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(a,0,0)),t._revealEffect.direction=0,t._revealEffect.axis=0,t._revealEffect.progress=s))}}),Object.defineProperty(t,"revealUp",{get:function(){return r},set:function(i){r!==i&&(o(),null===(r=i)||!1===r?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(a,0,0)),t._revealEffect.direction=1,t._revealEffect.axis=1,t._revealEffect.progress=r))}}),Object.defineProperty(t,"revealDown",{get:function(){return n},set:function(i){n!==i&&(o(),null===(n=i)||!1===n?h(t):(t._revealEffect||(t._revealEffect=e.addReveal(a,0,0)),t._revealEffect.direction=0,t._revealEffect.axis=1,t._revealEffect.progress=n))}}),Object.defineProperty(t,"revealWidth",{get:function(){return a},set:function(e){a!==e&&(a=e,t._revealEffect&&(t._revealEffect.wipeWidth=a))}}),t.revealLeft=null,v(t,"revealLeft"),v(t,"revealRight"),v(t,"revealUp"),v(t,"revealDown"),t},saturate:function(t){return m(t,"saturate",1),t},sepia:function(t){return m(t,"sepia"),t},shadow:function(t){if(g(t,"shadowColor"))return t;var e=p(t);if(!e)return t;var i,s=0,r=0,n=.1,a=1,o=6,h=1;return Object.defineProperty(t,"shadowColor",{get:function(){return i},set:function(u){i!==u&&(null===(i=u)||!1===i?t._shadow&&(e.remove(t._shadow),t._shadow=void 0):(t._shadow||(t._shadow=e.addShadow(s,r,n,a,i,o,h)),t._shadow.color=i))}}),Object.defineProperty(t,"shadowX",{get:function(){return s},set:function(e){s!==e&&(s=e,t._shadow&&(t._shadow.x=s))}}),Object.defineProperty(t,"shadowY",{get:function(){return r},set:function(e){r!==e&&(r=e,t._shadow&&(t._shadow.y=r))}}),Object.defineProperty(t,"decay",{get:function(){return n},set:function(e){n!==e&&(n=e,t._shadow&&(t._shadow.decay=n))}}),Object.defineProperty(t,"shadowPower",{get:function(){return a},set:function(e){a!==e&&(a=e,t._shadow&&(t._shadow.power=a))}}),Object.defineProperty(t,"shadowSamples",{get:function(){return o},set:function(e){o!==e&&(o=e,t._shadow&&(t._shadow.samples=o))}}),Object.defineProperty(t,"shadowIntensity",{get:function(){return h},set:function(e){h!==e&&(h=e,t._shadow&&(t._shadow.intensity=h))}}),t.shadowColor=null,v(t,"shadowColor"),t},shiftToBGR:function(t){return m(t,"shiftToBGR"),t},shine:function(t){if(g(t,"shineSpeed"))return t;var e=p(t);if(!e)return t;var i,s=.5,r=3;return Object.defineProperty(t,"shineSpeed",{get:function(){return i},set:function(n){i!==n&&(null===(i=n)||!1===i?t._shine&&(e.remove(t._shine),t._shine=void 0):(t._shine||(t._shine=e.addShine(i,s,r)),t._shine.speed=i))}}),Object.defineProperty(t,"shineLineWidth",{get:function(){return s},set:function(e){s!==e&&(s=e,t._shine&&(t._shine.lineWidth=s))}}),Object.defineProperty(t,"shineGradient",{get:function(){return r},set:function(e){r!==e&&(r=e,t._shine&&(t._shine.gradient=r))}}),t.shineSpeed=null,v(t,"shineSpeed"),t},technicolor:function(t){return m(t,"technicolor"),t},tiltShift:function(t){if(g(t,"tiltShiftRadius"))return t;var e=p(t);if(!e)return t;var i,s=1,r=.2,n=1,a=1,o=1;return Object.defineProperty(t,"tiltShiftRadius",{get:function(){return i},set:function(h){i!==h&&(null===(i=h)||!1===i?t._tiltShift&&(e.remove(t._tiltShift),t._tiltShift=void 0):(t._tiltShift||(t._tiltShift=e.addTiltShift(i,s,r,n,a,o)),t._tiltShift.radius=i))}}),Object.defineProperty(t,"tiltShiftAmount",{get:function(){return s},set:function(e){s!==e&&(s=e,t._tiltShift&&(t._tiltShift.amount=s))}}),Object.defineProperty(t,"tiltShiftContrast",{get:function(){return r},set:function(e){r!==e&&(r=e,t._tiltShift&&(t._tiltShift.contrast=r))}}),Object.defineProperty(t,"tiltShiftBlurX",{get:function(){return n},set:function(e){n!==e&&(n=e,t._tiltShift&&(t._tiltShift.blurX=n))}}),Object.defineProperty(t,"tiltShiftBlurY",{get:function(){return a},set:function(e){a!==e&&(a=e,t._tiltShift&&(t._tiltShift.blurY=a))}}),Object.defineProperty(t,"tiltShiftStrength",{get:function(){return o},set:function(e){o!==e&&(o=e,t._tiltShift&&(t._tiltShift.strength=o))}}),t.tiltShiftRadius=null,v(t,"tiltShiftRadius"),t},vignette:function(t){if(g(t,"vignetteRadius"))return t;var e=p(t);if(!e)return t;var i,s=.5,r=.5,n=.5;return Object.defineProperty(t,"vignetteRadius",{get:function(){return i},set:function(a){i!==a&&(null===(i=a)||!1===i?t._vignette&&(e.remove(t._vignette),t._vignette=void 0):(t._vignette||(t._vignette=e.addVignette(s,r,i,n)),t._vignette.radius=i))}}),Object.defineProperty(t,"vignetteX",{get:function(){return s},set:function(e){s!==e&&(s=e,t._vignette&&(t._vignette.x=s))}}),Object.defineProperty(t,"vignetteY",{get:function(){return r},set:function(e){r!==e&&(r=e,t._vignette&&(t._vignette.y=r))}}),Object.defineProperty(t,"vignetteStrength",{get:function(){return n},set:function(e){n!==e&&(n=e,t._vignette&&(t._vignette.strength=n))}}),t.vignetteRadius=null,v(t,"vignetteRadius"),t},vintagePinhole:function(t){return m(t,"vintagePinhole"),t},wipe:function(t){if(g(t,"wipeLeft"))return t;var e=p(t);if(!e)return t;var i,s,r,n,a=.1,o=function(){i=null,s=null,r=null,n=null},h=function(t){t._wipeEffect&&(e.remove(t._wipeEffect),t._wipeEffect=void 0)};return Object.defineProperty(t,"wipeLeft",{get:function(){return i},set:function(s){i!==s&&(o(),null===(i=s)||!1===i?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(a,0,0)),t._wipeEffect.direction=1,t._wipeEffect.axis=0,t._wipeEffect.progress=i))}}),Object.defineProperty(t,"wipeRight",{get:function(){return s},set:function(i){s!==i&&(o(),null===(s=i)||!1===s?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(a,0,0)),t._wipeEffect.direction=0,t._wipeEffect.axis=0,t._wipeEffect.progress=s))}}),Object.defineProperty(t,"wipeUp",{get:function(){return r},set:function(i){r!==i&&(o(),null===(r=i)||!1===r?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(a,0,0)),t._wipeEffect.direction=1,t._wipeEffect.axis=1,t._wipeEffect.progress=r))}}),Object.defineProperty(t,"wipeDown",{get:function(){return n},set:function(i){n!==i&&(o(),null===(n=i)||!1===n?h(t):(t._wipeEffect||(t._wipeEffect=e.addWipe(a,0,0)),t._wipeEffect.direction=0,t._wipeEffect.axis=1,t._wipeEffect.progress=n))}}),Object.defineProperty(t,"wipeWidth",{get:function(){return a},set:function(e){a!==e&&(a=e,t._wipeEffect&&(t._wipeEffect.wipeWidth=a))}}),t.wipeLeft=null,v(t,"wipeLeft"),v(t,"wipeRight"),v(t,"wipeUp"),v(t,"wipeDown"),t}};var b=function(t,e){if(void 0===e)e=!0;else if("string"==typeof e)e={config:!0};else if(Array.isArray(e))for(var i=e,s=(e={},0),r=i.length;s<r;s++)e[i[s]]=!0;if(!0===e)for(var n in y)y[n](t);else for(var n in e)e[n]&&y[n]&&y[n](t);return t};const k=Phaser.Utils.Array.Remove;var w={addGO(t,e){this.remove(t,!0),this.useTintFadeEffect(e)&&function(t,e){if(t.hasOwnProperty("tintR"))return t;void 0===e&&(e=16777215);var i=o(e),s=h(e),r=u(e);Object.defineProperty(t,"tint",{get:function(){return e},set:function(n){n=16777215&Math.floor(n),t.setTint&&t.setTint(n),e!==n&&(i=o(e=n),s=h(e),r=u(e))}}),Object.defineProperty(t,"tintR",{get:function(){return i},set:function(s){s=255&Math.floor(s),i!==s&&(i=s,t.tint=(255&s)<<16|65535&e)}}),Object.defineProperty(t,"tintG",{get:function(){return s},set:function(i){i=255&Math.floor(i),s!==i&&(s=i,t.tint=(255&i)<<8|16711935&e)}}),Object.defineProperty(t,"tintB",{get:function(){return r},set:function(i){i=255&Math.floor(i),r!==i&&(r=i,t.tint=255&i|16776960&e)}}),Object.defineProperty(t,"tintGray",{get:function(){return Math.floor((i+s+r)/3)},set:function(e){e=255&Math.floor(e),i===e&&s===e&&r===e||(i=e,s=e,r=e,t.tint=(255&e)<<16|(255&e)<<8|255&e)}}),t.tint=e}(e),this.viewportCoordinateEnable&&f(e,this.viewport),this.effectPropertiesConfig&&b(e,this.effectPropertiesConfig),e.setName(t).once("destroy",(function(){k(this.removedGOs,e),this.isEmpty&&this.emit("empty")}),this);var i=new this.BobClass(this,e,t);return this.bobs[t]=i,this},add(t,...e){var i=this.createGameObjectCallback,s=this.createGameObjectScope,r=i.call(s,this.scene,...e);this.addGO(t,r),null!=this.gameObjectDepth&&r.setDepth(this.gameObjectDepth);var n=this.get(t);return this.fadeBob(n,0,1),this}},E={remove(t,e){var i=this.get(t);if(!i)return this;Array.isArray(i)||(i=[i]);var s=this;return i.forEach((function(t){delete s.bobs[t.name];var i=t.gameObject;s.removedGOs.push(i),i.setName(),e?t.destroy():s.fadeBob(t,void 0,0,(function(){t.destroy()}))})),this},removeAll(){var t=this.bobs;for(var e in t)this.remove(e);return this},clear(t){void 0===t&&(t=!0);var e=this.bobs;for(var i in e)t&&e[i].destroy(),delete e[i];return this.removedGOs.length=0,this}},S={hasProperty(t,e){var i=n(t)?this.get(t):this.getFitst(t);return!!i&&i.hasProperty(e)},getProperty(t,e){var i=n(t)?this.get(t):this.getFitst(t);if(i)return i.getProperty(e)},isNumberProperty(t,e){return"number"==typeof this.getProperty(t,e)},setProperty(t,e,i){var s=this.get(t);return s?(Array.isArray(s)||(s=[s]),this.symbols&&"string"==typeof i&&this.isNumberProperty(t,e)&&(i in this.symbols?i=this.symbols[i]:console.warn(`Can't find symbol ${i}`)),s.forEach((function(t){t.setProperty(e,i)})),this):this},easeProperty(t,e){var i=this.get(t);if(!i)return this;Array.isArray(i)||(i=[i]);var s=e.value,r=e.property;return this.symbols&&"string"==typeof s&&this.isNumberProperty(t,r)&&s in this.symbols&&(e.value=this.symbols[s]),i.forEach((function(t){t.easeProperty(e)})),this},hasTweenTask(t,e){var i=n(t)?this.get(t):this.getFitst(t);return!!i&&i.tweens.hasOwnProperty(e)},getTweenTask(t,e){var i=n(t)?this.get(t):this.getFitst(t);return i&&i.tweens[e]||null}},x={hasMethod(t,e){var i=n(t)?this.get(t):this.getFitst(t);return!!i&&i.hasMethod(e)},call(t,e,...i){var s=this.get(t);return s?(Array.isArray(s)||(s=[s]),s.forEach((function(t){t.call(e,...i)})),this):this}},O={hasData(t,e){var i=n(t)?this.get(t):this.getFitst(t);return!!i&&i.hasData(e)},getData(t,e){if(this.has(t))return this.get(t).getData(e)},setData(t,e,i){var s=this.get(t);return s?(Array.isArray(s)||(s=[s]),s.forEach((function(t){t.setData(e,i)})),this):this}};const M={tint:0,alpha:1,revealUp:2,revealDown:3,revealLeft:4,revealRight:5};var T={setGOFadeMode(t){return"string"==typeof t&&(t=M[t]),this.fadeMode=t,this},setGOFadeTime(t){return this.fadeTime=t,this},useTintFadeEffect(t){return(void 0===this.fadeMode||0===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setTint},useAlphaFadeEffect(t){return(void 0===this.fadeMode||1===this.fadeMode)&&this.fadeTime>0&&void 0!==t.setAlpha},useRevealEffect(t){return this.fadeMode>=2&&this.fadeMode<=5&&this.fadeTime>0&&(t.preFX||t.postFX)},fadeBob(t,e,i,s){var r=t.gameObject;if(this.useTintFadeEffect(r))void 0!==e&&t.setProperty("tintGray",255*e),t.easeProperty({property:"tintGray",value:Math.floor(255*i),duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useAlphaFadeEffect(r))void 0!==e&&t.setProperty("alpha",e),t.easeProperty({property:"alpha",value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s});else if(this.useRevealEffect(r)){var n;switch(b(r,"reveal"),this.fadeMode){case 2:n="revealUp";break;case 3:n="revealDown";break;case 4:n="revealLeft";break;case 5:n="revealRight"}void 0===e&&(e=0),r[n]=e,t.easeProperty({property:n,value:i,duration:this.fadeTime,delay:0,ease:"Linear",repeat:0,yoyo:!1,from:!1,complete:s}),t.getTweenTask(n).once("complete",(function(){r[n]=null}))}else s&&s(r);return this}},C=function(t){return void 0!==t.displayWidth?t.displayWidth:t.width},P=function(t){return void 0!==t.displayHeight?t.displayHeight:t.height};Phaser.Geom.Rectangle;const _=Phaser.Math.Vector2,j=Phaser.Math.RotateAround;Phaser.GameObjects.Container;var L=void 0,R=function(t,e,i){return void 0===i&&(i=!1),0!==t.rotation&&j(e,t.x,t.y,t.rotation),i&&t.parentContainer&&t.parentContainer.getBoundsTransformMatrix().transformPoint(e.x,e.y,e),e};const B=Phaser.Utils.Objects.GetValue;var A=function(t,e,i,s,r,n,a){if(t.getBounds||void 0!==t.width&&void 0!==t.height){void 0===i&&(i=16777215),void 0===s&&(s=1),void 0===r&&(r=null),void 0===n&&(n=1),void 0===a&&(a=0);var o=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getTopLeft?t.getTopLeft(e):(e.x=t.x-C(t)*t.originX,e.y=t.y-P(t)*t.originY,R(t,e,i))}(t,G[0]);o.x-=a,o.y-=a;var h=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getTopRight?t.getTopRight(e):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-P(t)*t.originY,R(t,e,i))}(t,G[1]);h.x+=a,h.y-=a;var u=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getBottomRight?t.getBottomRight(e):(e.x=t.x-C(t)*t.originX+C(t),e.y=t.y-P(t)*t.originY+P(t),R(t,e,i))}(t,G[2]);u.x+=a,u.y+=a;var c=function(t,e,i){return void 0===e?e=new _:!0===e&&(void 0===L&&(L=new _),e=L),t.getBottomLeft?t.getBottomLeft(e):(e.x=t.x-C(t)*t.originX,e.y=t.y-P(t)*t.originY+P(t),R(t,e,i))}(t,G[3]);c.x-=a,c.y+=a,null!==r&&e.fillStyle(r,n).fillPoints(G,!0,!0),null!==i&&e.lineStyle(s,i).strokePoints(G,!0,!0)}},G=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],F=function(t,e){var i,s=t.cameras;if(void 0===e)i=s.main;else switch(typeof e){case"string":i=s.getCamera(e);break;case"number":i=s.cameras[e];break;default:i=e}return i},D={setCamera(t,e){var i=this.get(t);if(!i)return this;var s=F(this.scene,e);return s?(i.gameObject.cameraFilter=4294967295^s.id,i.camera=s,this):this},getCamera(t){var e=this.get(t);return e?e.camera:null}},W={drawGameObjectsBounds:function(t,e){return this.forEachGO((function(i){i.drawBounds?i.drawBounds(t,e):function(t,e,i){var s,r,n,a,o;if("number"==typeof i?s=i:(s=B(i,"color"),r=B(i,"lineWidth"),n=B(i,"fillColor"),a=B(i,"fillAlpha",1),o=B(i,"padding",0)),Array.isArray(t))for(var h=0,u=t.length;h<u;h++)A(t[h],e,s,r,n,a,o);else A(t,e,s,r,n,a,o)}(i,t,e)})),this}};Object.assign(W,a,w,E,S,x,O,T,D);const X=Phaser.Cameras.Scene2D.BaseCamera,$=Phaser.Geom.Rectangle;var Y=function(t,e,i){return e instanceof X||(i=e,e=void 0),void 0===i?i=new $:!0===i&&(i=I),e?t.scale.getViewPort(e,i):t.scale.getViewPort(i)},I=new $;const V=Phaser.Utils.Objects.GetValue;class N{constructor(t,e){this.scene=t,this.BobClass=V(e,"BobClass",r),this.setCreateGameObjectCallback(V(e,"createGameObject"),V(e,"createGameObjectScope")),this.setEventEmitter(V(e,"eventEmitter",void 0)),this.setGameObjectDepth(V(e,"depth",void 0));var i=V(e,"fade",500);"number"==typeof i?(this.setGOFadeMode(),this.setGOFadeTime(i)):(this.setGOFadeMode(V(i,"mode")),this.setGOFadeTime(V(i,"time",500)));var s=V(e,"viewportCoordinate",!1);!1!==s?(this.setViewportCoordinateEnable(V(e,"enable",!0)),this.setViewport(V(s,"viewport"))):this.setViewportCoordinateEnable(!1);var n=V(e,"effectProperties",!1);this.setEffectPropertiesConfig(n),this.setSymbols(V(e,"symbols")),this.bobs={},this.removedGOs=[],this._timeScale=1,this.name=V(e,"name")}destroy(t){this.clear(!t),this.createGameObjectCallback=void 0,this.viewport=void 0,this.scene=void 0}set timeScale(t){if(this._timeScale!==t){this._timeScale=t;var e=this.bobs;for(var i in e)e[i].setTimeScale(t)}}get timeScale(){return this._timeScale}setTimeScale(t){return this.timeScale=t,this}setCreateGameObjectCallback(t,e){return this.createGameObjectCallback=t,this.createGameObjectScope=e,this}setGameObjectDepth(t){return this.gameObjectDepth=t,this}setViewportCoordinateEnable(t){return void 0===t&&(t=!0),this.viewportCoordinateEnable=t,this}setEffectPropertiesConfig(t){return void 0===t&&(t=!0),this.effectPropertiesConfig=t,this}setViewport(t){return void 0===t&&(t=Y(this.scene,this.scene.cameras.main)),this.viewport=t,this}setSymbols(t){return this.symbols=t,this}get isEmpty(){return function(t){for(var e in t)return!1;return!0}(this.bobs)&&0===this.removedGOs.length}}Object.assign(N.prototype,t,W);const z=Phaser.GameObjects.GameObject,U=Phaser.GameObjects.Layer,H=Phaser.GameObjects.Layer;var K=function(t){var e=t.displayList;return function(t){return t instanceof H}(e)?e:null},J={getLayer(t){return this.getGO(t)},getLayers(t){return void 0===t&&(t=[]),this.forEachGO((function(e){t.push(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}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,!1),t},addToLayer(t,e){var i=this.getGO(t);if(i){Array.isArray(e)||(e=[e]);for(var s=0,r=e.length;s<r;s++){var n=e[s];n.isRexContainerLite?n.addToLayer(i):i.add(n)}return void 0!==i.scrollFactorX&&n.setScrollFactor(i.scrollFactorX,i.scrollFactorY),this}console.warn(`[LayerManager] Can't get layer "${t}"`)},addToBottomLayer(t){var e=this.getLayers()[0];return this.addToLayer(e.goName,t),this},addToTopLayer(t){var e=this.getLayers(),i=e[e.length-1];return this.addToLayer(i.goName,t),this},removeFromLayer(t,e,i){var s=this.getGO(t);if(s)return void 0===i&&(i=!0),e.isRexContainerLite?e.removeFromLayer(s,i):(s.remove(e),i&&e.addToDisplayList()),this;console.warn(`[LayerManager] Can't get layer "${t}"`)},clearLayer(t,e){void 0===e&&(e=!0);var i=this.getGO(t);if(i){if(e)for(var s=i.getAll(),r=0,n=s.length;r<n;r++)s[r].destroy();else i.removeAll();return this}console.warn(`Can't get layer "${t}"`)}},q={setScrollFactor(t,e,i){void 0===i&&(i=e);var s=this.getLayer(t);if(!s)return this;s.scrollFactorX=e,s.scrollFactorY=i;for(var r=s.getAll(),n=0,a=r.length;n<a;n++)r[n].setScrollFactor(e,i);return this}};const Q=Phaser.Utils.Array;var Z={bringMeToTop:function(){var t;return this.parentContainer?t=this.parentContainer.list:this.displayList&&(t=this.displayList.list),t?(Q.BringToTop(t,this),this):this},sendMeToBack:function(){var t;return this.parentContainer?t=this.parentContainer.list:this.displayList&&(t=this.displayList.list),t?(Q.SendToBack(t,this),this):this},moveMyDepthBelow:function(t){var e;return t.parentContainer?-1===(e=t.parentContainer.list).indexOf(this)&&t.parentContainer.add(this):t.displayList&&-1===(e=t.displayList.list).indexOf(this)&&t.displayList.add(this),e?(Q.MoveBelow(e,this,t),this):this},moveMyDepthAbove:function(t){var e;return t.parentContainer?-1===(e=t.parentContainer.list).indexOf(this)&&(t.isRexContainerLite?t.addToContainer(t.parentContainer):t.parentContainer.add(t)):t.displayList&&-1===(e=t.displayList.list).indexOf(this)&&(t.isRexContainerLite?t.addToLayer(t.displayList):t.displayList.add(t)),e?(Q.MoveAbove(e,this,t),this):this}},tt={bringLayerToTop(t){var e=this.getLayer(t);return e?(Z.bringMeToTop.call(e),this):this},sendLayerToBack(t){var e=this.getLayer(t);return e?(Z.sendMeToBack.call(e),this):this},moveLayerBelow(t,e){if(t===e)return this;var i=this.getLayer(t),s=this.getLayer(e);return i&&s?(Z.moveMyDepthBelow.call(i,s),this):this},moveLayerAbove(t,e){if(t===e)return this;var i=this.getLayer(t),s=this.getLayer(e);return i&&s?(Z.moveMyDepthAbove.call(i,s),this):this}};const et=N.prototype.setCamera;var it={setCamera(t,e){var i=F(this.scene,e);return i||(i=this.scene.cameras.add(void 0,void 0,void 0,void 0,!1,e)),et.call(this,t,i),this}},st={};Object.assign(st,J,q,tt,it);const rt=Phaser.Utils.Objects.GetValue;class nt extends N{constructor(t,e){void 0===e?e={}:Array.isArray(e)&&(e={layers:e}),e.hasOwnProperty("fade")||(e.fade=0),e.viewportCoordinate=!1,super(t,e);var i=rt(e,"rootLayer");this.setRootLayer(i);var s=rt(e,"layers");if(s)for(var r=0,n=s.length;r<n;r++){var a=s[r];if("string"==typeof a)this.add(a);else{var o=a.name;this.add(o);var h=a.scrollFactor,u=rt(a,"scrollFactorX",h),c=rt(a,"scrollFactorY",h);void 0!==u&&this.setScrollFactor(o,u,c),this.setCamera(o,a.cameraName)}}}setCreateGameObjectCallback(t,e){return t||(t=at),super.setCreateGameObjectCallback(t,e),this}setRootLayer(t){if(t===this.rootLayer)return this;var e=this.getAllGO();return t?t.add(e):this.scene.displayList.add(e),this.rootLayer=t,this}addGO(t,e){return super.addGO(t,e),e.name=t,this.rootLayer&&this.rootLayer.add(e),this}get(t,e){if((s=t)instanceof z||s instanceof U){var i=K(t);if(!i)return;if(!(t=i.name))return}var s;return super.get(t,e)}}var at=function(t,e){var i=t.add.layer();return void 0!==e&&i.setDepth(e),i};Object.assign(nt.prototype,st);const ot=Phaser.Scene;var ht=function(t){return t instanceof ot},ut=function(t){return null==t||"object"!=typeof t?null:ht(t)?t:t.scene&&ht(t.scene)?t.scene:t.parent&&t.parent.scene&&ht(t.parent.scene)?t.parent.scene:null};const ct=Phaser.Game;var lt=function(t){return t instanceof ct};const dt=Phaser.Utils.Objects.GetValue;class ft{constructor(t,e){this.setParent(t),this.isShutdown=!1,this.setEventEmitter(dt(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=ut(t),this.game=null==(e=t)||"object"!=typeof e?null:lt(e)?e:lt(e.game)?e.game:ht(e)?e.sys.game:ht(e.scene)?e.scene.sys.game:void 0,this}}Object.assign(ft.prototype,t);const gt=Phaser.Utils.Objects.GetValue;class pt extends ft{constructor(t,e){super(t,e),this._isRunning=!1,this.isPaused=!1,this.tickingState=!1,this.setTickingMode(gt(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=vt[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 vt={no:0,lazy:1,always:2},mt=Phaser.Utils.Objects.GetValue;class yt extends pt{constructor(t,e){super(t,e);var i=this.scene?"update":"step";this.tickEventName=mt(e,"tickEventName",i),this.isSceneTicker=!bt(this.tickEventName)}startTicking(){super.startTicking(),this.isSceneTicker?this.scene.sys.events.on(this.tickEventName,this.update,this):this.game.events.on(this.tickEventName,this.update,this)}stopTicking(){super.stopTicking(),this.isSceneTicker&&this.scene?this.scene.sys.events.off(this.tickEventName,this.update,this):this.game&&this.game.events.off(this.tickEventName,this.update,this)}}var bt=function(t){return"step"===t||"poststep"===t};const kt=Phaser.Utils.Objects.GetValue,wt=Phaser.Math.Clamp;let Et=class{constructor(t){this.resetFromJSON(t)}resetFromJSON(t){this.state=kt(t,"state",St),this.timeScale=kt(t,"timeScale",1),this.delay=kt(t,"delay",0),this.repeat=kt(t,"repeat",0),this.repeatCounter=kt(t,"repeatCounter",0),this.repeatDelay=kt(t,"repeatDelay",0),this.duration=kt(t,"duration",0),this.nowTime=kt(t,"nowTime",0),this.justRestart=kt(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?Ot:xt,this.repeatCounter=0,this}stop(){return this.state=St,this}update(t,e){this.state!==St&&this.state!==Tt&&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=Mt)):(this.nowTime=this.duration,this.state=Tt):this.nowTime>=0&&(this.state=Ot))}get t(){var t;switch(this.state){case St:case xt:case Mt:t=0;break;case Ot:t=this.nowTime/this.duration;break;case Tt:t=1}return wt(t,0,1)}set t(t){(t=wt(t,-1,1))<0?(this.state=xt,this.nowTime=-this.delay*t):(this.state=Ot,this.nowTime=this.duration*t,1===t&&0!==this.repeat&&this.repeatCounter++)}setT(t){return this.t=t,this}get isIdle(){return this.state===St}get isDelay(){return this.state===xt}get isCountDown(){return this.state===Ot}get isRunning(){return this.state===xt||this.state===Ot}get isDone(){return this.state===Tt}get isOddIteration(){return!(1&~this.repeatCounter)}get isEvenIteration(){return!(1&this.repeatCounter)}};const St=0,xt=1,Ot=2,Mt=3,Tt=-1;class Ct extends yt{constructor(t,e){super(t,e),this.timer=new Et}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 Pt=Phaser.Utils.Objects.GetValue,_t=Phaser.Utils.Objects.GetAdvancedValue,jt=Phaser.Tweens.Builders.GetEaseFunction;class Lt extends Ct{resetFromJSON(t){return this.timer.resetFromJSON(Pt(t,"timer")),this.setEnable(Pt(t,"enable",!0)),this.setTarget(Pt(t,"target",this.parent)),this.setDelay(_t(t,"delay",0)),this.setDuration(_t(t,"duration",1e3)),this.setEase(Pt(t,"ease","Linear")),this.setRepeat(Pt(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=jt(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 Rt=Phaser.Sound.BaseSound;var Bt=function(t){return t instanceof Rt};const At=Phaser.Utils.Objects.GetValue,Gt=Phaser.Utils.Objects.GetAdvancedValue,Ft=Phaser.Math.Linear;class Dt extends Lt{constructor(t,e,i){Bt(t)&&(i=e,e=t,t=void 0),e.active=!0,e.scene=t,e.game=e.manager.game,super(e,i),this.volume={},this.resetFromJSON(i)}resetFromJSON(t){return super.resetFromJSON(t),this.setMode(At(t,"mode",0)),this.setEnable(At(t,"enable",!0)),this.setVolumeRange(Gt(t,"volume.start",this.parent.volume),Gt(t,"volume.end",0)),this}setMode(t){return"string"==typeof t&&(t=Wt[t]),this.mode=t,this}setVolumeRange(t,e){return this.volume.start=t,this.volume.end=e,this}start(){return this.timer.isRunning||(this.parent.setVolume(this.volume.start),this.timer.setDelay(this.delay).setDuration(this.duration),super.start()),this}updateTarget(t,e){t.volume=Ft(this.volume.start,this.volume.end,e.t)}complete(){switch(super.complete(),this.mode){case 1:this.parent.stop();break;case 2:this.parent.stop(),this.parent.destroy()}return this}}const Wt={stop:1,destroy:2};var Xt=function(t,e,i,s,r){Bt(t)&&(r=s,s=i,i=e,e=t,t=void 0),void 0===s&&(s=1),void 0===r&&(r=0);var n,a={mode:0,volume:{start:r,end:s},duration:i};return"string"==typeof e&&(e=t.sys.sound.add(e)),e.hasOwnProperty("_fade")?(n=e._fade).stop().resetFromJSON(a):(n=new Dt(t,e,a),e._fade=n),n.start(),e.isPlaying||e.setVolume(r).play(),e},$t=function(t,e,i,s){Bt(t)&&(s=i,i=e,e=t,t=void 0),void 0===s&&(s=!0);var r,n={mode:s?2:1,volume:{start:e.volume,end:0},duration:i};return e.hasOwnProperty("_fade")?(r=e._fade).stop().resetFromJSON(n):(r=new Dt(t,e,n),e._fade=r),r.start(),e.isPlaying||e.play(),e};const Yt=Phaser.Utils.Objects.GetValue;var It={setBackgroundMusicLoop(t){return void 0===t&&(t=!0),this.backgroundMusicLoop=t,this},setBackgroundMusicFadeTime(t){return this.backgroundMusicFadeTime=t,this},getBackgroundMusic(){return this.backgroundMusic},setCurrentBackgroundMusic(t){return this.backgroundMusic=t,t&&(t.once("complete",(function(){this.backgroundMusic===t&&(this.backgroundMusic.destroy(),this.backgroundMusic=void 0)}),this).once("destroy",(function(){this.backgroundMusic===t&&(this.backgroundMusic=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic&&this.backgroundMusic.key===t)return this;this.stopBackgroundMusic();var i=this.sound.add(t,{loop:Yt(e,"loop",this.backgroundMusicLoop),mute:Yt(e,"mute",this.backgroundMusicMute),volume:Yt(e,"volume",this.backgroundMusicVolume),detune:Yt(e,"detune",0),rate:Yt(e,"rate",1)});return this.setCurrentBackgroundMusic(i),this.backgroundMusicFadeTime>0&&this.fadeInBackgroundMusic(this.backgroundMusicFadeTime),this},pauseBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.pause(),this},resumeBackgroundMusic(){return this.backgroundMusic&&this.backgroundMusic.resume(),this},stopBackgroundMusic(){return this.backgroundMusic&&(this.backgroundMusicFadeTime>0?this.fadeOutBackgroundMusic(this.backgroundMusicFadeTime,!0):(this.backgroundMusic.stop(),this.backgroundMusic.destroy(),this.backgroundMusic=void 0)),this},fadeInBackgroundMusic(t){return this.backgroundMusic&&Xt(this.backgroundMusic,t,this.backgroundMusicVolume,0),this},fadeOutBackgroundMusic(t,e){return this.backgroundMusic&&$t(this.backgroundMusic,t,e),this},crossFadeBackgroundMusic(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusicFadeTime;return this.backgroundMusicFadeTime=0,this.fadeOutBackgroundMusic(e,!0).playBackgroundMusic(t).fadeInBackgroundMusic(e),this.backgroundMusicFadeTime=i,this},setBackgroundMusicMute(t){return void 0===t&&(t=!0),this.backgroundMusicMute=t,this},setBackgroundMusicVolume(t){return this.backgroundMusicVolume=t,this},setBackgroundMusicRate(t){return this.backgroundMusic&&this.backgroundMusic.setRate(t),this},setBackgroundMusicDetune(t){return this.backgroundMusic&&this.backgroundMusic.setDetune(t),this}};const Vt=Phaser.Utils.Objects.GetValue;var Nt={setBackgroundMusic2Loop(t){return void 0===t&&(t=!0),this.backgroundMusic2Loop=t,this},setBackgroundMusic2FadeTime(t){return this.backgroundMusic2FadeTime=t,this},getBackgroundMusic2(){return this.backgroundMusic2},setCurrentBackgroundMusic2(t){return this.backgroundMusic2=t,t&&(t.once("complete",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)}),this).once("destroy",(function(){this.backgroundMusic2===t&&(this.backgroundMusic2=void 0)}),this),t.isPlaying||t.play()),this},playBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;if(this.backgroundMusic2&&this.backgroundMusic2.key===t)return this;this.stopBackgroundMusic2();var i=this.sound.add(t,{loop:Vt(e,"loop",this.backgroundMusicLoop),mute:Vt(e,"mute",this.backgroundMusic2Mute),volume:Vt(e,"volume",this.backgroundMusic2Volume),detune:Vt(e,"detune",0),rate:Vt(e,"rate",1)});return this.setCurrentBackgroundMusic2(i),this.backgroundMusic2FadeTime>0&&this.fadeInBackgroundMusic2(this.backgroundMusic2FadeTime),this},pauseBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.pause(),this},resumeBackgroundMusic2(){return this.backgroundMusic2&&this.backgroundMusic2.resume(),this},stopBackgroundMusic2(){return this.backgroundMusic2&&(this.backgroundMusic2FadeTime>0?this.fadeOutBackgroundMusic2(this.backgroundMusic2FadeTime,!0):(this.backgroundMusic2.stop(),this.backgroundMusic2.destroy(),this.backgroundMusic2=void 0)),this},fadeInBackgroundMusic2(t){return this.backgroundMusic2&&Xt(this.backgroundMusic2,t,this.backgroundMusic2Volume,0),this},fadeOutBackgroundMusic2(t,e){return this.backgroundMusic2&&$t(this.backgroundMusic2,t,e),this},crossFadeBackgroundMusic2(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.backgroundMusic2FadeTime;return this.backgroundMusic2FadeTime=0,this.fadeOutBackgroundMusic2(e,!0).playBackgroundMusic2(t).fadeInBackgroundMusic2(e),this.backgroundMusic2FadeTime=i,this},setBackgroundMusic2Mute(t){return void 0===t&&(t=!0),this.backgroundMusic2Mute=t,this},setBackgroundMusic2Volume(t){return this.backgroundMusic2Volume=t,this},setBackgroundMusic2Rate(t){return this.backgroundMusic2&&this.backgroundMusic2.setRate(t),this},setBackgroundMusic2Detune(t){return this.backgroundMusic2&&this.backgroundMusic2.setDetune(t),this}};const zt=Phaser.Utils.Array.Remove,Ut=Phaser.Utils.Objects.GetValue;var Ht={getSoundEffects(){return this.soundEffects},getLastSoundEffect(){return this.soundEffects[this.soundEffects.length-1]},playSoundEffect(t,e){if(!this.hasAudio(t))return console.error(`[Sound manager] Audio key'${t}' is not existed`),this;var i=this.sound.add(t,{mute:Ut(e,"mute",this.soundEffectsMute),volume:Ut(e,"volume",this.soundEffectsVolume),detune:Ut(e,"detune",0),rate:Ut(e,"rate",1)});return this.soundEffects.push(i),i.once("complete",(function(){i.destroy(),this.sound&&zt(this.soundEffects,i)}),this).once("destroy",(function(){this.sound&&zt(this.soundEffects,i)}),this).play(),this},stopAllSoundEffects(){for(var t=this.soundEffects.length-1;t>=0;t--){var e=this.soundEffects[t];e.stop(),e.destroy()}return this},fadeInSoundEffect(t){var e=this.getLastSoundEffect();return e&&Xt(e,t,this.soundEffectsVolume,0),this},fadeOutSoundEffect(t,e){var i=this.getLastSoundEffect();return i&&$t(i,t,e),this},fadeOutAllSoundEffects(t,e){for(var i=this.soundEffects.length-1;i>=0;i--)$t(this.soundEffects[i],t,e);return this},setSoundEffectMute(t,e){if(void 0===t&&(t=!0),void 0===e&&(e=!1),e){var i=this.getLastSoundEffect();i&&i.setMute(t)}else this.soundEffectsMute