text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.rexsoundfadeplugin=t():e.rexsoundfadeplugin=t()}(window,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=304)}({173:function(e,t,n){"use strict";function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var r=Phaser.Utils.Objects.GetValue,i=Phaser.Utils.Objects.GetAdvancedValue,u=function(){function e(t,n,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sound=n,this.scene=t,this.volume={},this.tween=void 0,this.resetFromJSON(o),this.boot()}var t,n,u;return t=e,(n=[{key:"resetFromJSON",value:function(e){return this.setMode(r(e,"mode",0)),this.setVolumeRange(i(e,"volume.start",this.sound.volume),i(e,"volume.end",0)),this.setDelay(i(e,"delay",0)),this.setFadeOutTime(i(e,"duration",1e3)),this}},{key:"toJSON",value:function(){return{mode:this.mode,volume:this.volume,delay:this.delay,duration:this.duration}}},{key:"boot",value:function(){this.scene.events.once("shutdown",this.destroy,this),this.sound.once("destroy",this.destroy,this)}},{key:"shutdown",value:function(){this.stop(),this.scene.events.off("destroy",this.destroy,this),this.sound.off("destroy",this.destroy,this),this.sound=void 0,this.scene=void 0}},{key:"destroy",value:function(){this.shutdown()}},{key:"setMode",value:function(e){return"string"==typeof e&&(e=s[e]),this.mode=e,this}},{key:"setVolumeRange",value:function(e,t){return this.volume.start=e,this.volume.end=t,this}},{key:"setDelay",value:function(e){return this.delay=e,this}},{key:"setFadeOutTime",value:function(e){return this.duration=e,this}},{key:"start",value:function(){if(!this.tween)return 0===this.duration?(this.sound.setVolume(this.volume.end),this.complete(),this):(this.sound.setVolume(this.volume.start),this.tween=this.scene.tweens.add({targets:this.sound,volume:this.volume.end,delay:this.delay,duration:this.duration,ease:"Linear",onComplete:this.complete,onCompleteScope:this}),this)}},{key:"stop",value:function(){if(this.tween)return this.tween.remove(),this.tween=void 0,this}},{key:"complete",value:function(){switch(this.stop(),this.mode){case 1:this.sound.stop();break;case 2:this.sound.destroy()}}}])&&o(t.prototype,n),u&&o(t,u),e}(),s={stop:1,destroy:2},a=u,l={volume:{}},f=function(e,t,n,o,r){var i;return void 0===o&&(o=1),void 0===r&&(r=0),l.mode=0,l.volume.start=r,l.volume.end=o,l.duration=n,"string"==typeof t&&(t=e.sound.add(t)),t.hasOwnProperty("_fade")?(i=t._fade).stop().resetFromJSON(l):(i=new a(e,t,l),t._fade=i),i.start(),t.isPlaying||t.setVolume(r).play(),t},d={volume:{}},c=function(e,t,n,o){var r;return void 0===o&&(o=!0),d.mode=o?2:1,d.volume.start=t.volume,d.volume.end=0,d.duration=n,t.hasOwnProperty("_fade")?(r=t._fade).stop().resetFromJSON(d):(r=new a(e,t,d),t._fade=r),r.start(),t.isPlaying||t.play(),t};t.a={fadeIn:f,fadeOut:c}},304:function(e,t,n){"use strict";n.r(t);var o=n(173);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function u(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var l=o.a.fadeIn,f=o.a.fadeOut,d=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,s(t).call(this,e))}var n,o,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(t,Phaser.Plugins.BasePlugin),n=t,(o=[{key:"start",value:function(){this.game.events.once("destroy",this.destroy,this)}},{key:"fadeIn",value:function(e,t,n,o,r){return l(e,t,n,o,r)}},{key:"fadeOut",value:function(e,t,n,o){return f(e,t,n,o)}}])&&i(n.prototype,o),r&&i(n,r),t}();t.default=d}}).default});