xsound 2.27.0 → 3.0.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -29
- package/build/types/AudioModule/index.d.ts +198 -0
- package/build/types/AudioModule/index.d.ts.map +1 -0
- package/build/types/MIDI/index.d.ts +48 -0
- package/build/types/MIDI/index.d.ts.map +1 -0
- package/build/types/MML/Part.d.ts +78 -0
- package/build/types/MML/Part.d.ts.map +1 -0
- package/build/types/MML/Sequence.d.ts +66 -0
- package/build/types/MML/Sequence.d.ts.map +1 -0
- package/build/types/MML/Sequencer.d.ts +34 -0
- package/build/types/MML/Sequencer.d.ts.map +1 -0
- package/build/types/MML/Token.d.ts +40 -0
- package/build/types/MML/Token.d.ts.map +1 -0
- package/build/types/MML/Tokenizer.d.ts +21 -0
- package/build/types/MML/Tokenizer.d.ts.map +1 -0
- package/build/types/MML/Tree.d.ts +60 -0
- package/build/types/MML/Tree.d.ts.map +1 -0
- package/build/types/MML/TreeConstructor.d.ts +25 -0
- package/build/types/MML/TreeConstructor.d.ts.map +1 -0
- package/build/types/MML/index.d.ts +115 -0
- package/build/types/MML/index.d.ts.map +1 -0
- package/build/types/MediaModule/index.d.ts +223 -0
- package/build/types/MediaModule/index.d.ts.map +1 -0
- package/build/types/MixerModule/index.d.ts +99 -0
- package/build/types/MixerModule/index.d.ts.map +1 -0
- package/build/types/NoiseModule/index.d.ts +106 -0
- package/build/types/NoiseModule/index.d.ts.map +1 -0
- package/build/types/OneshotModule/index.d.ts +176 -0
- package/build/types/OneshotModule/index.d.ts.map +1 -0
- package/build/types/OscillatorModule/Glide.d.ts +47 -0
- package/build/types/OscillatorModule/Glide.d.ts.map +1 -0
- package/build/types/OscillatorModule/Oscillator.d.ts +77 -0
- package/build/types/OscillatorModule/Oscillator.d.ts.map +1 -0
- package/build/types/OscillatorModule/index.d.ts +138 -0
- package/build/types/OscillatorModule/index.d.ts.map +1 -0
- package/build/types/ProcessorModule/index.d.ts +124 -0
- package/build/types/ProcessorModule/index.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/FFT.d.ts +61 -0
- package/build/types/SoundModule/Analyser/FFT.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/Time.d.ts +54 -0
- package/build/types/SoundModule/Analyser/Time.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/TimeOverview.d.ts +132 -0
- package/build/types/SoundModule/Analyser/TimeOverview.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/Visualizer.d.ts +150 -0
- package/build/types/SoundModule/Analyser/Visualizer.d.ts.map +1 -0
- package/build/types/SoundModule/Analyser/index.d.ts +85 -0
- package/build/types/SoundModule/Analyser/index.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Autopanner.d.ts +39 -0
- package/build/types/SoundModule/Effectors/Autopanner.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Chorus.d.ts +51 -0
- package/build/types/SoundModule/Effectors/Chorus.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Compressor.d.ts +43 -0
- package/build/types/SoundModule/Effectors/Compressor.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Delay.d.ts +48 -0
- package/build/types/SoundModule/Effectors/Delay.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Distortion.d.ts +90 -0
- package/build/types/SoundModule/Effectors/Distortion.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Effector.d.ts +79 -0
- package/build/types/SoundModule/Effectors/Effector.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/EnvelopeGenerator.d.ts +90 -0
- package/build/types/SoundModule/Effectors/EnvelopeGenerator.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Equalizer.d.ts +44 -0
- package/build/types/SoundModule/Effectors/Equalizer.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Filter.d.ts +61 -0
- package/build/types/SoundModule/Effectors/Filter.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Flanger.d.ts +51 -0
- package/build/types/SoundModule/Effectors/Flanger.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Listener.d.ts +47 -0
- package/build/types/SoundModule/Effectors/Listener.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Panner.d.ts +68 -0
- package/build/types/SoundModule/Effectors/Panner.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Phaser.d.ts +55 -0
- package/build/types/SoundModule/Effectors/Phaser.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/PitchShifter.d.ts +42 -0
- package/build/types/SoundModule/Effectors/PitchShifter.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Reverb.d.ts +81 -0
- package/build/types/SoundModule/Effectors/Reverb.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Ringmodulator.d.ts +39 -0
- package/build/types/SoundModule/Effectors/Ringmodulator.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Stereo.d.ts +45 -0
- package/build/types/SoundModule/Effectors/Stereo.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Tremolo.d.ts +41 -0
- package/build/types/SoundModule/Effectors/Tremolo.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/VocalCanceler.d.ts +31 -0
- package/build/types/SoundModule/Effectors/VocalCanceler.d.ts.map +1 -0
- package/build/types/SoundModule/Effectors/Wah.d.ts +49 -0
- package/build/types/SoundModule/Effectors/Wah.d.ts.map +1 -0
- package/build/types/SoundModule/Recorder/Channel.d.ts +44 -0
- package/build/types/SoundModule/Recorder/Channel.d.ts.map +1 -0
- package/build/types/SoundModule/Recorder/Track.d.ts +36 -0
- package/build/types/SoundModule/Recorder/Track.d.ts.map +1 -0
- package/build/types/SoundModule/Recorder/index.d.ts +118 -0
- package/build/types/SoundModule/Recorder/index.d.ts.map +1 -0
- package/build/types/SoundModule/Session/Room.d.ts +69 -0
- package/build/types/SoundModule/Session/Room.d.ts.map +1 -0
- package/build/types/SoundModule/Session/index.d.ts +94 -0
- package/build/types/SoundModule/Session/index.d.ts.map +1 -0
- package/build/types/SoundModule/index.d.ts +147 -0
- package/build/types/SoundModule/index.d.ts.map +1 -0
- package/build/types/StreamModule/NoiseGate.d.ts +29 -0
- package/build/types/StreamModule/NoiseGate.d.ts.map +1 -0
- package/build/types/StreamModule/NoiseSuppressor.d.ts +30 -0
- package/build/types/StreamModule/NoiseSuppressor.d.ts.map +1 -0
- package/build/types/StreamModule/index.d.ts +175 -0
- package/build/types/StreamModule/index.d.ts.map +1 -0
- package/build/types/XSound/index.d.ts +155 -0
- package/build/types/XSound/index.d.ts.map +1 -0
- package/build/types/interfaces.d.ts +23 -0
- package/build/types/interfaces.d.ts.map +1 -0
- package/build/types/main.d.ts +117 -0
- package/build/types/main.d.ts.map +1 -0
- package/build/types/types.d.ts +10 -0
- package/build/types/types.d.ts.map +1 -0
- package/build/xsound.js +1 -1
- package/build/xsound.js.LICENSE.txt +1 -1
- package/build/xsound.js.map +1 -1
- package/build/xsound.min.js +3 -0
- package/build/xsound.min.js.LICENSE.txt +1 -0
- package/build/xsound.min.js.map +1 -0
- package/package.json +38 -33
- package/build/xsound.d.ts +0 -3
package/build/xsound.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see xsound.js.LICENSE.txt */
|
|
2
|
-
(()=>{"use strict";function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var e=function(){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e)}var r,n;return r=e,(n=[{key:"INPUT",value:function(){}},{key:"OUTPUT",value:function(){}}])&&t(r.prototype,n),e}();function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw s}}}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sampleRate=e,this.isActive=!1,this.graphics="",this.canvas=null,this.context=null,this.svg=null,this.interval=1e3,this.timerid=null,this.styles={shape:"line",grad:[{offset:0,color:"rgba(0, 128, 255, 1.0)"},{offset:1,color:"rgba(0, 0, 255, 1.0)"}],wave:"rgba(0, 0, 255, 1.0)",grid:"rgba(255, 0, 0, 1.0)",text:"rgba(255, 255, 255, 1.0)",font:{family:"Arial",size:"13px",style:"normal"},width:1.5,cap:"round",join:"miter",top:15,right:30,bottom:15,left:30}}var e,n;return e=t,(n=[{key:"setup",value:function(e){return e instanceof HTMLCanvasElement?(this.graphics=t.CANVAS,this.canvas=e,this.context=this.canvas.getContext("2d")):e instanceof SVGElement&&(this.graphics=t.SVG,this.svg=e),this}},{key:"param",value:function(t,e){var n=String(t).replace(/-/g,"").toLowerCase(),i=null;switch(n){case"interval":if(void 0===e)return this.interval;"auto"===String(e).toLowerCase()?this.interval="auto":(i=parseFloat(e))>=0&&(this.interval=i);break;case"shape":if(void 0===e)return this.styles.shape;"line"!==(i=String(e).toLowerCase())&&"rect"!==i||(this.styles.shape="gradient"!==this.styles.wave?i:"rect");break;case"grad":if(void 0===e)return this.styles.grad;Array.isArray(e)||(e=[e]);var o,s=!1,a=r(e);try{for(a.s();!(o=a.n()).done;){var c=o.value;if(!("offset"in c)||!("color"in c)){s=!0;break}var u=parseFloat(c.offset);if(isNaN(u)||u<0||u>1){s=!0;break}}}catch(t){a.e(t)}finally{a.f()}s||(this.styles.grad=e);break;case"font":if(void 0===e)return this.styles[n];if("[object Object]"===Object.prototype.toString.call(e))for(var l in e)/(?:family|size|style)/i.test(l)&&(this.styles.font[l]=String(e[l]));break;case"wave":case"grid":case"text":case"cap":case"join":if(void 0===e)return this.styles[n];"string"==typeof e&&("wave"===n&&"gradient"===e&&(this.styles.shape="rect"),this.styles[n]=e.toLowerCase());break;case"width":case"top":case"right":case"bottom":case"left":if(void 0===e)return this.styles[n];(i="width"===n?parseFloat(e):parseInt(e,10))>=0&&(this.styles[n]=i)}}},{key:"start",value:function(e,r,n){switch(this.graphics){case t.CANVAS:this.drawOnCanvas(e,r,n);break;case t.SVG:this.drawBySVG(e,r,n)}return this}},{key:"create",value:function(){switch(this.graphics){case t.CANVAS:return this.canvas.toDataURL("image/png").replace("image/png","image/octet-stream");case t.SVG:return this.svg.outerHTML;default:return this}}},{key:"state",value:function(t){return void 0===t?this.isActive:("toggle"===String(t).toLowerCase()?this.isActive=!this.isActive:this.isActive=Boolean(t),this)}},{key:"drawTimeDomainFloat32ArrayOnCanvas",value:function(t,e,n,i,o,s){if(!(t instanceof CanvasRenderingContext2D))return this;if(!(e instanceof Float32Array))return this;var a=parseInt(n,10),c=parseInt(i,10),u=parseInt(o,10);switch(isNaN(a)&&(a=0),isNaN(c)&&(c=0),isNaN(u)&&(u=0),this.styles.shape){case"line":t.strokeStyle=this.styles.wave,t.lineWidth=this.styles.width,t.lineCap=this.styles.cap,t.lineJoin=this.styles.join,t.beginPath();for(var l=0,f=e.length;l<f;l++)if(null==s||l%s==0){var h=l/f*a+this.styles.left,p=(1-e[l])*(c/2)+this.styles.top;0===l?t.moveTo(h+this.styles.width/2,p):t.lineTo(h,p)}t.stroke();break;case"rect":"gradient"!==this.styles.wave&&(t.fillStyle=this.styles.wave);for(var y=0,v=e.length;y<v;y++)if(null==s||y%s==0){var d=y/v*a+this.styles.left,b=e[y]*(c/2)*-1;if("gradient"===this.styles.wave){var m,g=i/2+this.styles.top,w=t.createLinearGradient(0,g,0,g+b),S=r(this.styles.grad);try{for(S.s();!(m=S.n()).done;){var O=m.value;w.addColorStop(O.offset,O.color)}}catch(t){S.e(t)}finally{S.f()}t.fillStyle=w}t.fillRect(d,u,this.styles.width,b)}}return this}},{key:"drawTimeDomainFloat32ArrayBySVG",value:function(e,r,n,i,o,s){var a=parseInt(r,10),c=parseInt(n,10),u=parseInt(i,10);switch(isNaN(a)&&(a=0),isNaN(c)&&(c=0),isNaN(u)&&(u=0),this.styles.shape){case"line":for(var l=document.createElementNS(t.XMLNS,"path"),f="",h=0,p=e.length;h<p;h++)if(null==o||h%o==0){var y=h/p*a+this.styles.left,v=(1-e[h])*(c/2)+this.styles.top;f+=0===h?"M".concat(y+this.styles.width/2," ").concat(v):" L".concat(y," ").concat(v)}return l.setAttribute("d",f),l.setAttribute("stroke",this.styles.wave),l.setAttribute("fill","none"),l.setAttribute("stroke-width",this.styles.width),l.setAttribute("stroke-linecap",this.styles.cap),l.setAttribute("stroke-linejoin",this.styles.join),l;case"rect":var d=null;"gradient"===this.styles.wave&&(d=this.createSVGLinearGradient(s));var b=document.createElementNS(t.XMLNS,"g");null!==d&&b.appendChild(d);for(var m=0,g=e.length;m<g;m++)if(null==o||m%o==0){var w=document.createElementNS(t.XMLNS,"rect"),S=m/g*a+this.styles.left,O=e[m]*(n/2);w.setAttribute("x",S),w.setAttribute("y",u),w.setAttribute("width",this.styles.width),O<0?w.setAttribute("height",-O):(w.setAttribute("height",O),w.setAttribute("transform","rotate(180 ".concat(S+this.styles.width/2," ").concat(u,")"))),w.setAttribute("stroke","none"),w.setAttribute("fill",null===d?this.styles.wave:"url(#".concat(s,")")),b.appendChild(w)}return b;default:return null}}},{key:"createSVGLinearGradient",value:function(e){var n=document.createElementNS(t.XMLNS,"defs"),i=document.createElementNS(t.XMLNS,"linearGradient");i.setAttribute("id",String(e)),i.setAttribute("x1","0%"),i.setAttribute("y1","0%"),i.setAttribute("x2","0%"),i.setAttribute("y2","100%");var o,s=r(this.styles.grad);try{for(s.s();!(o=s.n()).done;){var a=o.value,c=document.createElementNS(t.XMLNS,"stop");c.setAttribute("offset",a.offset),c.setAttribute("stop-color",a.color),i.appendChild(c)}}catch(t){s.e(t)}finally{s.f()}return n.appendChild(i),n}},{key:"createFontString",value:function(){var t=this.styles.font,e=t.size,r=t.style,n=t.family;return"".concat(r," ").concat(e,' "').concat(n,'"')}},{key:"drawOnCanvas",value:function(){return this}},{key:"drawBySVG",value:function(){return this}},{key:"clear",value:function(){if(this.context){var t=this.canvas,e=t.width,r=t.height;this.context.clearRect(0,0,e,r)}return this.svg&&(this.svg.innerHTML=""),this}},{key:"toString",value:function(){return"[SoundModule Analyser Visualizer]"}}])&&i(e.prototype,n),t}();function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(t,e,r){return u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},u(t,e,r||t)}function l(t,e){return l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},l(t,e)}function f(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return h(t)}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function y(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}o(s,"CANVAS","canvas"),o(s,"SVG","svg"),o(s,"XMLNS","http://www.w3.org/2000/svg"),o(s,"XLINK","http://www.w3.org/1999/xlink"),o(s,"SVG_LINEAR_GRADIENT_ID_TIME_OVERVIEW","svg-linear-gradient-time-overview"),o(s,"SVG_LINEAR_GRADIENT_ID_TIME","svg-linear-gradient-time"),o(s,"SVG_LINEAR_GRADIENT_ID_FFT","svg-linear-gradient-fft");var v=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}(a,t);var e,r,n,i,o=(n=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=p(n);if(i){var r=p(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return f(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=o.call(this,t)).savedImage=null,e.length=0,e.currentTime="rgba(0, 0, 0, 0.5)",e.sprite="rgba(255, 255, 255, 0.25)",e.plotInterval=.0625,e.textInterval=60,e.isDown=!1,e.mode=a.DRAG_MODE_UPDATE,e.offsetX=0,e.startTime=0,e.endTime=0,e.onStart=e.onStart.bind(h(e)),e.onMove=e.onMove.bind(h(e)),e.onEnd=e.onEnd.bind(h(e)),e}return e=a,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=u(p(a.prototype),"param",this).call(this,n,e);if(void 0!==i)return i;var o=null;switch(n){case"currenttime":if(void 0===e)return this.currentTime;this.currentTime=String(e).toLowerCase();break;case"sprite":if(void 0===e)return this.sprite;this.sprite=String(e).toLowerCase();break;case"plotinterval":case"textinterval":if(void 0===e)return this[n.replace("interval","Interval")];(o=parseFloat(e))>0&&(this[n.replace("interval","Interval")]=o);break;case"mode":if(void 0===e)return this.mode;if(((o=String(e).toLowerCase())===a.DRAG_MODE_UPDATE||o===a.DRAG_MODE_SPRITE)&&(this.mode=o,this.offsetX=0,this.startTime=0,this.endTime=0,this.svg instanceof SVGElement)){var s=this.svg.querySelector(".".concat(a.SVG_SPRITE_CLASS_NAME));s instanceof SVGElement&&this.svg.removeChild(s)}}}return this}},{key:"drawOnCanvas",value:function(t){if(!(this.canvas instanceof HTMLCanvasElement&&this.isActive))return this;var e=this.context,r=this.canvas,n=r.width,i=r.height,o=n-(this.styles.left+this.styles.right),s=i-(this.styles.top+this.styles.bottom),a=Math.floor(s/2)+this.styles.top,c=Math.floor(this.plotInterval*this.sampleRate),u=Math.floor(this.textInterval*this.sampleRate);if(e.clearRect(0,0,n,i),this.drawTimeDomainFloat32ArrayOnCanvas(e,t,o,s,a,c),"none"!==this.styles.grid||"none"!==this.styles.text){for(var l=0,f=t.length;l<f;l++)if(l%u==0){var h=Math.floor(l/f*o)+this.styles.left,p="".concat(Math.floor(l/this.sampleRate/60)," min");"none"!==this.styles.grid&&(e.fillStyle=this.styles.grid,e.fillRect(h,this.styles.top,1,s)),"none"!==this.styles.text&&(e.fillStyle=this.styles.text,e.font=this.createFontString(),e.fillText(p,h-e.measureText(p).width/2,this.styles.top+s+parseInt(this.styles.font.size,10)))}for(var y=0,v=["-1.00","-0.50"," 0.00"," 0.50"," 1.00"];y<v.length;y++){var d=v[y],b=Math.floor(this.styles.left-e.measureText(d).width),m=Math.floor((1-parseFloat(d.trim()))*(s/2))+this.styles.top;"none"!==this.styles.grid&&(e.fillStyle=this.styles.grid,e.fillRect(this.styles.left,m,o,1)),"none"!==this.styles.text&&(e.fillStyle=this.styles.text,e.font=this.createFontString(),e.fillText(d,b,m-Math.floor(parseInt(this.styles.font.size,10)/4)))}}return this.savedImage=e.getImageData(0,0,n,i),this.length=t.length,e.fillStyle=this.currentTime,e.fillRect(this.styles.left,this.styles.top,1,s),this}},{key:"drawBySVG",value:function(t){if(!(this.svg instanceof SVGElement&&this.isActive))return this;var e=this.svg,r=parseInt(e.getAttribute("width"),10),n=parseInt(e.getAttribute("height"),10),i=r-(this.styles.left+this.styles.right),o=n-(this.styles.top+this.styles.bottom),c=Math.floor(o/2)+this.styles.top,u=Math.floor(this.plotInterval*this.sampleRate),l=Math.floor(this.textInterval*this.sampleRate);if(e.innerHTML="",e.appendChild(this.drawTimeDomainFloat32ArrayBySVG(t,i,o,c,u,s.SVG_LINEAR_GRADIENT_ID_TIME_OVERVIEW)),"none"!==this.styles.grid||"none"!==this.styles.text){for(var f=0,h=t.length;f<h;f++)if(f%l==0){var p=Math.floor(f/h*i)+this.styles.left,y=Math.floor(f/this.sampleRate/60)+" min";if("none"!==this.styles.grid){var v=document.createElementNS(s.XMLNS,"rect");v.setAttribute("x",p),v.setAttribute("y",this.styles.top),v.setAttribute("width",1),v.setAttribute("height",o),v.setAttribute("stroke","none"),v.setAttribute("fill",this.styles.grid),e.appendChild(v)}if("none"!==this.styles.text){var d=document.createElementNS(s.XMLNS,"text");d.textContent=y,d.setAttribute("x",p),d.setAttribute("y",this.styles.top+o+parseInt(this.styles.font.size,10)),d.setAttribute("text-anchor","middle"),d.setAttribute("stroke","none"),d.setAttribute("fill",this.styles.text),d.setAttribute("font-family",this.styles.font.family),d.setAttribute("font-size",this.styles.font.size),d.setAttribute("font-style",this.styles.font.style),d.setAttribute("font-weight",this.styles.font.weight),e.appendChild(d)}}for(var b=0,m=["-1.00","-0.50"," 0.00"," 0.50"," 1.00"];b<m.length;b++){var g=m[b],w=this.styles.left,S=Math.floor((1-parseFloat(g.trim()))*(o/2))+this.styles.top;if("none"!==this.styles.grid){var O=document.createElementNS(s.XMLNS,"rect");O.setAttribute("x",w),O.setAttribute("y",S),O.setAttribute("width",i),O.setAttribute("height",1),O.setAttribute("stroke","none"),O.setAttribute("fill",this.styles.grid),e.appendChild(O)}if("none"!==this.styles.text){var A=document.createElementNS(s.XMLNS,"text");A.textContent=g,A.setAttribute("x",w),A.setAttribute("y",S-Math.floor(parseInt(this.styles.font.size,10)/4)),A.setAttribute("text-anchor","end"),A.setAttribute("stroke","none"),A.setAttribute("fill",this.styles.text),A.setAttribute("font-family",this.styles.font.family),A.setAttribute("font-size",this.styles.font.size),A.setAttribute("font-style",this.styles.font.style),A.setAttribute("font-weight",this.styles.font.weight),e.appendChild(A)}}}var k=document.createElementNS(s.XMLNS,"rect");return k.classList.add(a.SVG_CURRENT_TIME_CLASS_NAME),k.setAttribute("y",this.styles.top+1),k.setAttribute("height",o-1),k.setAttribute("stroke","none"),k.setAttribute("fill",this.currentTime),e.appendChild(k),this.savedImage=e,this.length=t.length,this}},{key:"update",value:function(t){var e=parseFloat(t);if(isNaN(e)||e<0)return this;switch(this.graphics){case s.CANVAS:if(this.savedImage instanceof ImageData){var r=this.context,n=this.canvas,i=n.width,o=n.height,c=i-(this.styles.left+this.styles.right),u=o-(this.styles.top+this.styles.bottom),l=e*this.sampleRate/this.length*c;if(r.clearRect(0,0,i,o),r.putImageData(this.savedImage,0,0),this.mode===a.DRAG_MODE_UPDATE)r.fillStyle=this.currentTime,r.fillRect(this.styles.left,this.styles.top+1,l,u-1);else if(this.mode===a.DRAG_MODE_SPRITE){if(0!==this.endTime){var f=Math.floor(Math.abs(this.endTime-this.startTime)*this.sampleRate/this.length*c);r.fillStyle=this.sprite,l>=this.offsetX?r.fillRect(this.styles.left+this.offsetX,this.styles.top+1,f,u-1):r.fillRect(this.styles.left+this.offsetX-f,this.styles.top+1,f,u-1)}r.fillStyle=this.currentTime,l>=this.offsetX?r.fillRect(this.styles.left+this.offsetX,this.styles.top+1,Math.abs(l-this.offsetX),u-1):r.fillRect(this.styles.left+l,this.styles.top+1,Math.abs(l-this.offsetX),u-1)}}break;case s.SVG:var h=this.svg.querySelector(".".concat(a.SVG_CURRENT_TIME_CLASS_NAME));if(h instanceof SVGElement){var p=parseInt(this.svg.getAttribute("width"),10)-(this.styles.left+this.styles.right),y=e*this.sampleRate/this.length*p;if(this.mode===a.DRAG_MODE_UPDATE)h.setAttribute("x",this.styles.left),h.setAttribute("width",y),h.setAttribute("aria-label","current time");else if(this.mode===a.DRAG_MODE_SPRITE){if(0!==this.endTime){var v=document.createElementNS(s.XMLNS,"rect");v.classList.add(a.SVG_SPRITE_CLASS_NAME),this.svg.lastElementChild.previousElementSibling instanceof SVGElement&&this.svg.removeChild(this.svg.lastElementChild.previousElementSibling);var d=Math.floor(Math.abs(this.endTime-this.startTime)*this.sampleRate/this.length*p);v.setAttribute("y",this.styles.top+1),v.setAttribute("height",h.getAttribute("height")),v.setAttribute("stroke","none"),v.setAttribute("fill",this.sprite),v.setAttribute("aria-label","current time"),y>=this.offsetX?v.setAttribute("x",this.styles.left+this.offsetX):v.setAttribute("x",this.styles.left+this.offsetX-d),v.setAttribute("width",d),this.svg.appendChild(v),this.svg.appendChild(h)}y>=this.offsetX?h.setAttribute("x",this.styles.left+this.offsetX):h.setAttribute("x",this.styles.left+y),h.setAttribute("width",Math.abs(y-this.offsetX)),h.setAttribute("aria-label","sprite time")}}}return this}},{key:"drag",value:function(t){var e=null,r="",n="",i="";switch(/iPhone|iPad|iPod|Android/.test(navigator.userAgent)?(r="touchstart",n="touchmove",i="touchend"):(r="mousedown",n="mousemove",i="mouseup"),this.graphics){case s.CANVAS:e=this.canvas;break;case s.SVG:e=this.svg;break;default:return this}return this.callback="[object Function]"===Object.prototype.toString.call(t)?t:function(){},e.removeEventListener(r,this.onStart,!0),e.removeEventListener(n,this.onMove,!0),window.removeEventListener(i,this.onEnd,!0),e.addEventListener(r,this.onStart,!0),e.addEventListener(n,this.onMove,!0),window.addEventListener(i,this.onEnd,!0),this}},{key:"draw",value:function(t,e,r){var n=0,i=0;switch(this.graphics){case s.CANVAS:n=this.canvas.offsetLeft,i=this.canvas.width;break;case s.SVG:n=this.svg.parentNode.offsetLeft,i=parseInt(this.svg.getAttribute("width"),10)}var o=r-(n+this.styles.left);this.canvas.parentNode instanceof Element&&(o+=this.canvas.parentNode.scrollLeft),o<0&&(o=0),o>(i-=this.styles.left+this.styles.right)&&(o=i);var a=o/i*this.length/this.sampleRate;return"mousedown"!==e&&"touchstart"!==e||(this.offsetX=o,this.startTime=a,this.endTime=0),"mouseup"!==e&&"touchend"!==e||(this.endTime=a),this.update(a),this.startTime<=a?this.callback(t,this.startTime,a,this.mode,!0):this.startTime>a&&this.callback(t,a,this.startTime,this.mode,!1),this}},{key:"onStart",value:function(t){this.draw(t,t.type,this.getOffsetX(t)),this.isDown=!0}},{key:"onMove",value:function(t){this.isDown&&(t.preventDefault(),this.draw(t,t.type,this.getOffsetX(t)))}},{key:"onEnd",value:function(t){this.isDown&&(this.draw(t,t.type,this.getOffsetX(t)),this.isDown=!1)}},{key:"getOffsetX",value:function(t){return t.pageX?t.pageX:t.touches[0]?t.touches[0].pageX:this}},{key:"toString",value:function(){return"[SoundModule Analyser TimeOverview]"}}],r&&c(e.prototype,r),a}(s);function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function b(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return m(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function g(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function w(t,e,r){return w="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=A(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},w(t,e,r||t)}function S(t,e){return S=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},S(t,e)}function O(t,e){if(e&&("object"===d(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function A(t){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},A(t)}function k(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}y(v,"SVG_CURRENT_TIME_CLASS_NAME","xsound-svg-current-time"),y(v,"SVG_SPRITE_CLASS_NAME","xsound-svg-sprite"),y(v,"DRAG_MODE_UPDATE","update"),y(v,"DRAG_MODE_SPRITE","sprite");var T=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&S(t,e)}(a,t);var e,r,n,i,o=(n=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=A(n);if(i){var r=A(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return O(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=o.call(this,t)).type=a.UINT,e.textInterval=.005,e}return e=a,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=w(A(a.prototype),"param",this).call(this,n,e);if(void 0!==i)return i;var o=null;switch(n){case"type":if(void 0===e)return this.type;(o=String(e).toLowerCase())!==a.UINT&&o!==a.FLOAT||(this.type=o);break;case"textinterval":if(void 0===e)return this.textInterval;(o=parseFloat(e))>0&&(this.textInterval=o)}}return this}},{key:"drawOnCanvas",value:function(t){if(!(this.canvas instanceof HTMLCanvasElement&&this.isActive))return this;var e=this.context,r=this.canvas,n=r.width,i=r.height,o=n-(this.styles.left+this.styles.right),s=i-(this.styles.top+this.styles.bottom),c=Math.floor(s/2)+this.styles.top,u=Math.floor(this.textInterval*this.sampleRate);switch(e.clearRect(0,0,n,i),this.type){case a.FLOAT:this.drawTimeDomainFloat32ArrayOnCanvas(e,t,o,s,c);break;case a.UINT:default:switch(this.styles.shape){case"line":e.strokeStyle=this.styles.wave,e.lineWidth=this.styles.width,e.lineCap=this.styles.cap,e.lineJoin=this.styles.join,e.beginPath();for(var l=0,f=t.length;l<f;l++){var h=l/f*o+this.styles.left,p=(1-t[l]/255)*s+this.styles.top;0===l?e.moveTo(h+this.styles.width/2,p):e.lineTo(h,p)}e.stroke();break;case"rect":"gradient"!==this.styles.wave&&(e.fillStyle=this.styles.wave);for(var y=0,v=t.length;y<v;y++){var d=y/v*o+this.styles.left,m=(.5-t[y]/255)*s;if("gradient"===this.styles.wave){var g,w=s/2+this.styles.top,S=e.createLinearGradient(0,w,0,w+m),O=b(this.styles.grad);try{for(O.s();!(g=O.n()).done;){var A=g.value;S.addColorStop(A.offset,A.color)}}catch(t){O.e(t)}finally{O.f()}e.fillStyle=S}e.fillRect(d,c,this.styles.width,m)}}}if("none"!==this.styles.grid||"none"!==this.styles.text){for(var k=0,T=t.length;k<T;k++)if(k%u==0){var E=Math.ceil(k/T*o)+this.styles.left,j="".concat(Math.ceil(k/this.sampleRate*1e3)," ms");"none"!==this.styles.grid&&(e.fillStyle=this.styles.grid,e.fillRect(E,this.styles.top,1,s)),"none"!==this.styles.text&&(e.fillStyle=this.styles.text,e.font=this.createFontString(),e.fillText(j,E-e.measureText(j).width/2,this.styles.top+s+parseInt(this.styles.font.size,10)))}for(var R=0,P=["-1.00","-0.50"," 0.00"," 0.50"," 1.00"];R<P.length;R++){var x=P[R],_=Math.floor(this.styles.left-e.measureText(x).width),M=Math.floor((1-parseFloat(x.trim()))*(s/2))+this.styles.top;"none"!==this.styles.grid&&(e.fillStyle=this.styles.grid,e.fillRect(this.styles.left,M,o,1)),"none"!==this.styles.text&&(e.fillStyle=this.styles.text,e.font=this.createFontString(),e.fillText(x,_,M-Math.floor(parseInt(this.styles.font.size,10)/4)))}}return this}},{key:"drawBySVG",value:function(t){if(!(this.svg instanceof SVGElement&&this.isActive))return this;var e=this.svg,r=parseInt(e.getAttribute("width"),10),n=parseInt(e.getAttribute("height"),10),i=r-(this.styles.left+this.styles.right),o=n-(this.styles.top+this.styles.bottom),c=Math.floor(o/2)+this.styles.top,u=Math.floor(this.textInterval*this.sampleRate);switch(e.innerHTML="",this.type){case a.FLOAT:e.appendChild(this.drawTimeDomainFloat32ArrayBySVG(t,i,o,c,null,s.SVG_LINEAR_GRADIENT_ID_TIME));break;case a.UINT:default:switch(this.styles.shape){case"line":for(var l=document.createElementNS(s.XMLNS,"path"),f="",h=0,p=t.length;h<p;h++){var y=h/p*i+this.styles.left,v=(1-t[h]/255)*o+this.styles.top;f+=0===h?"M".concat(y+this.styles.width/2," ").concat(v):" L".concat(y," ").concat(v)}l.setAttribute("d",f),l.setAttribute("stroke",this.styles.wave),l.setAttribute("fill","none"),l.setAttribute("stroke-width",this.styles.width),l.setAttribute("stroke-linecap",this.styles.cap),l.setAttribute("stroke-linejoin",this.styles.join),e.appendChild(l);break;case"rect":var d=null;"gradient"===this.styles.wave&&(d=this.createSVGLinearGradient(s.SVG_LINEAR_GRADIENT_ID_TIME));var b=document.createElementNS(s.XMLNS,"g");null!==d&&b.appendChild(d);for(var m=0,g=t.length;m<g;m++){var w=document.createElementNS(s.XMLNS,"rect"),S=m/g*i+this.styles.left,O=(t[m]/255-.5)*o;w.setAttribute("x",S),w.setAttribute("y",c),w.setAttribute("width",this.styles.width),O<0?w.setAttribute("height",-O):(w.setAttribute("height",O),w.setAttribute("transform","rotate(180 ".concat(S+this.styles.width/2," ").concat(c,")"))),w.setAttribute("stroke","none"),w.setAttribute("fill",null===d?this.styles.wave:"url(#".concat(s.SVG_LINEAR_GRADIENT_ID_TIME,")")),b.appendChild(w)}e.appendChild(b)}}if("none"!==this.styles.grid||"none"!==this.styles.text){for(var A=0,k=t.length;A<k;A++)if(A%u==0){var T=Math.ceil(A/k*i)+this.styles.left,E="".concat(Math.ceil(A/this.sampleRate*1e3)," ms");if("none"!==this.styles.grid){var j=document.createElementNS(s.XMLNS,"rect");j.setAttribute("x",T),j.setAttribute("y",this.styles.top),j.setAttribute("width",1),j.setAttribute("height",o),j.setAttribute("stroke","none"),j.setAttribute("fill",this.styles.grid),e.appendChild(j)}if("none"!==this.styles.text){var R=document.createElementNS(s.XMLNS,"text");R.textContent=E,R.setAttribute("x",T),R.setAttribute("y",this.styles.top+o+parseInt(this.styles.font.size,10)),R.setAttribute("text-anchor","middle"),R.setAttribute("stroke","none"),R.setAttribute("fill",this.styles.text),R.setAttribute("font-family",this.styles.font.family),R.setAttribute("font-size",this.styles.font.size),R.setAttribute("font-style",this.styles.font.style),R.setAttribute("font-weight",this.styles.font.weight),e.appendChild(R)}}for(var P=0,x=["-1.00","-0.50"," 0.00"," 0.50"," 1.00"];P<x.length;P++){var _=x[P],M=this.styles.left,F=Math.floor((1-parseFloat(_.trim()))*(o/2))+this.styles.top;if("none"!==this.styles.grid){var C=document.createElementNS(s.XMLNS,"rect");C.setAttribute("x",M),C.setAttribute("y",F),C.setAttribute("width",i),C.setAttribute("height",1),C.setAttribute("stroke","none"),C.setAttribute("fill",this.styles.grid),e.appendChild(C)}if("none"!==this.styles.text){var I=document.createElementNS(s.XMLNS,"text");I.textContent=_,I.setAttribute("x",M),I.setAttribute("y",F-Math.floor(parseInt(this.styles.font.size,10)/4)),I.setAttribute("text-anchor","end"),I.setAttribute("stroke","none"),I.setAttribute("fill",this.styles.text),I.setAttribute("font-family",this.styles.font.family),I.setAttribute("font-size",this.styles.font.size),I.setAttribute("font-style",this.styles.font.style),I.setAttribute("font-weight",this.styles.font.weight),e.appendChild(I)}}}return this}},{key:"toString",value:function(){return"[SoundModule Analyser Time]"}}],r&&g(e.prototype,r),a}(s);function E(t){return E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(t)}function j(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return R(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?R(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function P(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function x(t,e,r){return x="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=F(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},x(t,e,r||t)}function _(t,e){return _=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},_(t,e)}function M(t,e){if(e&&("object"===E(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function F(t){return F=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},F(t)}function C(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}k(T,"UINT","uint"),k(T,"FLOAT","float");var I=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_(t,e)}(a,t);var e,r,n,i,o=(n=a,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=F(n);if(i){var r=F(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return M(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(e=o.call(this,t)).type=a.UINT,e.size=256,e.textInterval=1e3,e}return e=a,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=x(F(a.prototype),"param",this).call(this,n,e);if(void 0!==i)return i;var o=null,s=null;switch(n){case"type":if(void 0===e)return this.type;(o=String(e).toLowerCase())!==a.UINT&&o!==a.FLOAT||(this.type=o);break;case"size":if(void 0===e)return this.size;s=1024,(o=parseInt(e,10))>0&&o<=s&&(this.size=o);break;case"textinterval":if(void 0===e)return this.textInterval;(o=parseFloat(e))>0&&(this.textInterval=o)}}return this}},{key:"drawOnCanvas",value:function(t,e,r){if(!(this.canvas instanceof HTMLCanvasElement&&this.isActive))return this;var n=parseFloat(e),i=parseFloat(r),o=i-n,s=this.context,c=this.canvas,u=c.width,l=c.height,f=u-(this.styles.left+this.styles.right),h=l-(this.styles.top+this.styles.bottom),p=this.size>t.length?t.length:this.size,y=this.sampleRate/(2*t.length),v=Math.floor(this.textInterval/y);switch(s.clearRect(0,0,u,l),this.type){case a.FLOAT:s.strokeStyle="gradient"!==this.styles.wave?this.styles.wave:"rgba(0, 0, 255, 1.0)",s.lineWidth=this.styles.width,s.lineCap=this.styles.cap,s.lineJoin=this.styles.join,s.beginPath();for(var d=0;d<p;d++){var b=d/p*f+this.styles.left,m=Math.abs(t[d]-i)*(h/o)+this.styles.top;0===d?s.moveTo(b+this.styles.width/2,m):s.lineTo(b,m)}s.stroke();break;case a.UINT:default:switch(this.styles.shape){case"line":s.strokeStyle=this.styles.wave,s.lineWidth=this.styles.width,s.lineCap=this.styles.cap,s.lineJoin=this.styles.join,s.beginPath();for(var g=0;g<p;g++){var w=g/p*f+this.styles.left,S=(1-t[g]/255)*h+this.styles.top;0===g?s.moveTo(w+this.styles.width/2,S):s.lineTo(w,S)}s.stroke();break;case"rect":"gradient"!==this.styles.wave&&(s.fillStyle=this.styles.wave);for(var O=0;O<p;O++){var A=O/p*f+this.styles.left,k=t[O]/255*h*-1;if("gradient"===this.styles.wave){var T,E=h+this.styles.top,R=s.createLinearGradient(0,E,0,E+k),P=j(this.styles.grad);try{for(P.s();!(T=P.n()).done;){var x=T.value;R.addColorStop(x.offset,x.color)}}catch(t){P.e(t)}finally{P.f()}s.fillStyle=R}s.fillRect(A,h+this.styles.top,this.styles.width,k)}}}if("none"!==this.styles.grid||"none"!==this.styles.text){for(var _=0;_<p;_++)if(_%v==0){var M=Math.floor(_/p*f)+this.styles.left,F=Math.floor(this.textInterval*(_/v)),C=F<1e3?"".concat(F," Hz"):"".concat(String(F/1e3).slice(0,3)," kHz");"none"!==this.styles.grid&&(s.fillStyle=this.styles.grid,s.fillRect(M,this.styles.top,1,h)),"none"!==this.styles.text&&(s.fillStyle=this.styles.text,s.font=this.createFontString(),s.fillText(C,M-s.measureText(C).width/2,this.styles.top+h+parseInt(this.styles.font.size,10)))}switch(this.type){case a.FLOAT:for(var I=n;I<=i;I+=10){var N="".concat(I," dB"),L=Math.floor(this.styles.left-s.measureText(N).width),B=Math.floor(-1*(I-i)/o*h)+this.styles.top;"none"!==this.styles.grid&&(s.fillStyle=this.styles.grid,s.fillRect(this.styles.left,B,f,1)),"none"!==this.styles.text&&(s.fillStyle=this.styles.text,s.font=this.createFontString(),s.fillText(N,L,B-Math.floor(parseInt(this.styles.font.size,10)/4)))}break;case a.UINT:default:for(var D=0,U=["0.00","0.25","0.50","0.75","1.00"];D<U.length;D++){var q=U[D],G=Math.floor(this.styles.left-s.measureText(q).width),V=(1-parseFloat(q))*h+this.styles.top;"none"!==this.styles.grid&&(s.fillStyle=this.styles.grid,s.fillRect(this.styles.left,V,f,1)),"none"!==this.styles.text&&(s.fillStyle=this.styles.text,s.font=this.createFontString(),s.fillText(q,G,V-Math.floor(parseInt(this.styles.font.size,10)/4)))}}}return this}},{key:"drawBySVG",value:function(t,e,r){if(!(this.svg instanceof SVGElement&&this.isActive))return this;var n=parseFloat(e),i=parseFloat(r),o=i-n,c=this.svg,u=parseInt(c.getAttribute("width"),10),l=parseInt(c.getAttribute("height"),10),f=u-(this.styles.left+this.styles.right),h=l-(this.styles.top+this.styles.bottom),p=this.size>t.length?t.length:this.size,y=this.sampleRate/(2*t.length),v=Math.floor(this.textInterval/y);switch(c.innerHTML="",this.type){case a.FLOAT:for(var d=document.createElementNS(s.XMLNS,"path"),b="",m=0;m<p;m++){var g=Math.floor(m/p*f)+this.styles.left,w=Math.floor(-1*(t[m]-i)*(h/o))+this.styles.top;b+=0===m?"M".concat(g+this.styles.width/2," ").concat(w):" L".concat(g," ").concat(w)}d.setAttribute("d",b),d.setAttribute("stroke","gradient"!==this.styles.wave?this.styles.wave:"rgba(0, 0, 255, 1.0)"),d.setAttribute("fill","none"),d.setAttribute("stroke-width",this.styles.width),d.setAttribute("stroke-linecap",this.styles.cap),d.setAttribute("stroke-linejoin",this.styles.join),c.appendChild(d);break;case a.UINT:default:switch(this.styles.shape){case"line":for(var S=document.createElementNS(s.XMLNS,"path"),O="",A=0;A<p;A++){var k=Math.floor(A/p*f)+this.styles.left,T=Math.floor((1-t[A]/255)*h)+this.styles.top;O+=0===A?"M".concat(k+this.styles.width/2," ").concat(T):" L".concat(k," ").concat(T)}S.setAttribute("d",O),S.setAttribute("stroke",this.styles.wave),S.setAttribute("fill","none"),S.setAttribute("stroke-width",this.styles.width),S.setAttribute("stroke-linecap",this.styles.cap),S.setAttribute("stroke-linejoin",this.styles.join),c.appendChild(S);break;case"rect":var E=null;"gradient"===this.styles.wave&&(E=this.createSVGLinearGradient(s.SVG_LINEAR_GRADIENT_ID_FFT));var j=document.createElementNS(s.XMLNS,"g");null!==E&&j.appendChild(E);for(var R=0;R<p;R++){var P=document.createElementNS(s.XMLNS,"rect"),x=Math.floor(R/p*f)+this.styles.left,_=Math.floor(t[R]/255*h);P.setAttribute("x",x),P.setAttribute("y",this.styles.top+h),P.setAttribute("width",this.styles.width),_<0?P.setAttribute("height",-_):(P.setAttribute("height",_),P.setAttribute("transform","rotate(180 ".concat(x+this.styles.width/2," ").concat(this.styles.top+h,")"))),P.setAttribute("stroke","none"),P.setAttribute("fill",null===E?this.styles.wave:"url(#".concat(s.SVG_LINEAR_GRADIENT_ID_FFT,")")),j.appendChild(P)}c.appendChild(j)}}if("none"!==this.styles.grid||"none"!==this.styles.text){for(var M=0;M<p;M++)if(M%v==0){var F=Math.floor(M/p*f)+this.styles.left,C=Math.floor(this.textInterval*(M/v)),I=C<1e3?"".concat(C," Hz"):"".concat(String(C/1e3).slice(0,3)," kHz");if("none"!==this.styles.grid){var N=document.createElementNS(s.XMLNS,"rect");N.setAttribute("x",F),N.setAttribute("y",this.styles.top),N.setAttribute("width",1),N.setAttribute("height",h),N.setAttribute("stroke","none"),N.setAttribute("fill",this.styles.grid),c.appendChild(N)}if("none"!==this.styles.text){var L=document.createElementNS(s.XMLNS,"text");L.textContent=I,L.setAttribute("x",F),L.setAttribute("y",this.styles.top+h+parseInt(this.styles.font.size,10)),L.setAttribute("text-anchor","middle"),L.setAttribute("stroke","none"),L.setAttribute("fill",this.styles.text),L.setAttribute("font-family",this.styles.font.family),L.setAttribute("font-size",this.styles.font.size),L.setAttribute("font-style",this.styles.font.style),L.setAttribute("font-weight",this.styles.font.weight),c.appendChild(L)}}switch(this.type){case a.FLOAT:for(var B=n;B<=i;B+=10){var D="".concat(B,"dB"),U=this.styles.left,q=Math.floor(-1*(B-i)/o*h)+this.styles.top;if("none"!==this.styles.grid){var G=document.createElementNS(s.XMLNS,"rect");G.setAttribute("x",U),G.setAttribute("y",q),G.setAttribute("width",f),G.setAttribute("height",1),G.setAttribute("stroke","none"),G.setAttribute("fill",this.styles.grid),c.appendChild(G)}if("none"!==this.styles.text){var V=document.createElementNS(s.XMLNS,"text");V.textContent=D,V.setAttribute("x",U),V.setAttribute("y",q-Math.floor(parseInt(this.styles.font.size,10)/4)),V.setAttribute("text-anchor","end"),V.setAttribute("stroke","none"),V.setAttribute("fill",this.styles.text),V.setAttribute("font-family",this.styles.font.family),V.setAttribute("font-size",this.styles.font.size),V.setAttribute("font-style",this.styles.font.style),V.setAttribute("font-weight",this.styles.font.weight),c.appendChild(V)}}break;case a.UINT:default:for(var z=0,X=["0.00","0.25","0.50","0.75","1.00"];z<X.length;z++){var W=X[z],Q=this.styles.left,H=(1-parseFloat(W))*h+this.styles.top;if("none"!==this.styles.grid){var Y=document.createElementNS(s.XMLNS,"rect");Y.setAttribute("x",Q),Y.setAttribute("y",H),Y.setAttribute("width",f),Y.setAttribute("height",1),Y.setAttribute("stroke","none"),Y.setAttribute("fill",this.styles.grid),c.appendChild(Y)}if("none"!==this.styles.text){var Z=document.createElementNS(s.XMLNS,"text");Z.textContent=W,Z.setAttribute("x",Q),Z.setAttribute("y",H-Math.floor(parseInt(this.styles.font.size,10)/4)),Z.setAttribute("text-anchor","end"),Z.setAttribute("stroke","none"),Z.setAttribute("fill",this.styles.text),Z.setAttribute("font-family",this.styles.font.family),Z.setAttribute("font-size",this.styles.font.size),Z.setAttribute("font-style",this.styles.font.style),Z.setAttribute("font-weight",this.styles.font.weight),c.appendChild(Z)}}}}return this}},{key:"toString",value:function(){return"[SoundModule Analyser FFT]"}}],r&&P(e.prototype,r),a}(s);function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function L(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function B(t,e){return B=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},B(t,e)}function D(t,e){if(e&&("object"===N(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function U(t){return U=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},U(t)}C(I,"UINT","uint"),C(I,"FLOAT","float");var q=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&B(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=U(n);if(i){var r=U(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return D(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=o.call(this)).analyser=t.createAnalyser(),e.input=t.createGain(),e.input.connect(e.analyser),e.timeOverviewL=new v(t.sampleRate),e.timeOverviewR=new v(t.sampleRate),e.time=new T(t.sampleRate),e.fft=new I(t.sampleRate),e.analyser.fftSize=2048,e.analyser.minDecibels=-100,e.analyser.maxDecibels=-30,e.analyser.smoothingTimeConstant=.8,e}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null;switch(n){case"fftsize":if(void 0===e)return this.analyser.fftSize;switch(i=parseInt(e,10)){case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:this.analyser.fftSize=i}break;case"frequencybincount":return this.analyser.frequencyBinCount;case"mindecibels":if(void 0===e)return this.analyser.minDecibels;(i=parseFloat(e))<(o=-30)&&(this.analyser.minDecibels=i);break;case"maxdecibels":if(void 0===e)return this.analyser.maxDecibels;(i=parseFloat(e))>-100&&(this.analyser.maxDecibels=i);break;case"smoothingtimeconstant":if(void 0===e)return this.analyser.smoothingTimeConstant;o=1,(i=parseFloat(e))>=0&&i<=o&&(this.analyser.smoothingTimeConstant=i)}}return this}},{key:"start",value:function(t,e,r){var n=this,i=String(t).replace(/-/g,"").toLowerCase(),o=parseInt(e,10),s=null;switch(i){case"timeoverview":switch(o){case 0:r instanceof AudioBuffer&&r.numberOfChannels>o&&((s=new Float32Array(r.length)).set(r.getChannelData(o)),this.timeOverviewL.start(s));break;case 1:r instanceof AudioBuffer&&r.numberOfChannels>o&&((s=new Float32Array(r.length)).set(r.getChannelData(o)),this.timeOverviewR.start(s))}break;case"timeoverviewl":r instanceof AudioBuffer&&r.numberOfChannels>0&&((s=new Float32Array(r.length)).set(r.getChannelData(0)),this.timeOverviewL.start(s));break;case"timeoverviewr":r instanceof AudioBuffer&&r.numberOfChannels>1&&((s=new Float32Array(r.length)).set(r.getChannelData(1)),this.timeOverviewR.start(s));break;case"time":"uint"===this.time.param("type")?(s=new Uint8Array(this.analyser.fftSize),this.analyser.getByteTimeDomainData(s),this.time.start(s)):(s=new Float32Array(this.analyser.fftSize),this.analyser.getFloatTimeDomainData(s),this.time.start(s)),"auto"===this.time.param("interval")?this.time.timerid=window.requestAnimationFrame((function(){n.start(t)})):this.time.timerid=window.setTimeout((function(){n.start(t)}),this.time.param("interval"));break;case"fft":"uint"===this.fft.param("type")?(s=new Uint8Array(this.analyser.frequencyBinCount),this.analyser.getByteFrequencyData(s),this.fft.start(s)):(s=new Float32Array(this.analyser.frequencyBinCount),this.analyser.getFloatFrequencyData(s),this.fft.start(s,this.analyser.minDecibels,this.analyser.maxDecibels)),"auto"===this.fft.param("interval")?this.fft.timerid=window.requestAnimationFrame((function(){n.start(t)})):this.fft.timerid=window.setTimeout((function(){n.start(t)}),this.fft.param("interval"))}return this}},{key:"stop",value:function(t){switch(String(t).replace(/-/g,"").toLowerCase()){default:break;case"time":"auto"===this.time.param("interval")?window.cancelAnimationFrame(this.time.timerid):window.clearTimeout(this.time.timerid),this.time.timerid=null;break;case"fft":"auto"===this.fft.param("interval")?window.cancelAnimationFrame(this.fft.timerid):window.clearTimeout(this.fft.timerid),this.fft.timerid=null}return this}},{key:"domain",value:function(t,e){var r=String(t).replace(/-/g,"").toLowerCase(),n=parseInt(e,10);switch(r){case"timeoverview":switch(n){case 0:return this.timeOverviewL;case 1:return this.timeOverviewR;default:return this}case"timeoverviewl":case"timeoverviewr":return this["timeOverview".concat(r.slice(-1).toUpperCase())];case"time":case"fft":return this[r];default:return this}}},{key:"get",value:function(){return this.analyser}},{key:"INPUT",get:function(){return this.input}},{key:"OUTPUT",get:function(){return this.input}},{key:"toString",value:function(){return"[SoundModule Analyser]"}}],r&&L(e.prototype,r),s}(e);function G(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var V=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.trackNumber=e>=0?e:0,this.dataBlocks=[]}var e,r;return e=t,(r=[{key:"get",value:function(){return this.dataBlocks}},{key:"append",value:function(t){t instanceof Float32Array&&this.dataBlocks.push(t)}},{key:"has",value:function(){return this.dataBlocks.length>0}},{key:"clear",value:function(){this.dataBlocks.length=0}}])&&G(e.prototype,r),t}();function z(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var X=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.channelNumber=e>=0?e:0,this.tracks=[],this.channelGain=1}var e,r;return e=t,(r=[{key:"get",value:function(t){var e=parseInt(t,10);return e>=0&&e<this.tracks.length?this.tracks[e]:this.tracks}},{key:"append",value:function(t){t instanceof V&&this.tracks.push(t)}},{key:"length",value:function(){return this.tracks.length}},{key:"gain",value:function(t){if(void 0===t)return this.channelGain;var e=parseFloat(t);e>=0&&e<=1&&(this.channelGain=e)}}])&&z(e.prototype,r),t}();function W(t){return W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W(t)}function Q(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return H(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?H(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Z(t,e){return Z=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Z(t,e)}function $(t,e){if(e&&("object"===W(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function J(t){return J=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},J(t)}var K=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Z(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=J(n);if(i){var r=J(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return $(this,t)});function s(t,e,r,n){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(i=o.call(this)).sampleRate=t.sampleRate,i.context=t,i.processor=t.createScriptProcessor(e,r,n),i.channels=[],i.activeTrack=-1,i.paused=!0,i}return e=s,r=[{key:"setup",value:function(t,e){var r=parseInt(e,10),n=r>0?r:1;this.channels.push(new X(0)),this.channels.push(new X(1));var i,o=Q(this.channels);try{for(o.s();!(i=o.n()).done;)for(var s=i.value,a=0;a<n;a++)s.append(new V(a))}catch(t){o.e(t)}finally{o.f()}return this}},{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase();switch(n){case"0":case"left":if(void 0===e)return this.channels[0].gain();this.channels[0].gain(e);break;case"1":case"right":if(void 0===e)return this.channels[1].gain();this.channels[1].gain(e)}}return this}},{key:"ready",value:function(t){return this.hasTrack(t)?this.activeTrack=t:this.activeTrack=-1,this}},{key:"start",value:function(){var t=this;if(-1!==this.activeTrack&&this.paused){this.paused=!1;var e=this.channels[0].gain(),r=this.channels[1].gain(),n=this.channels[0].get(this.activeTrack),i=this.channels[1].get(this.activeTrack),o=this.processor.bufferSize;this.processor.onaudioprocess=function(s){if(-1!==t.activeTrack){for(var a=s.inputBuffer.getChannelData(0),c=s.inputBuffer.getChannelData(1),u=new Float32Array(o),l=new Float32Array(o),f=0;f<o;f++)u[f]=e*a[f],l[f]=r*c[f];n.append(u),i.append(l)}else t.processor.disconnect(0),t.processor.onaudioprocess=null}}return this}},{key:"stop",value:function(){return this.activeTrack=-1,this.paused=!0,this.processor.disconnect(0),this.processor.onaudioprocess=null,this}},{key:"hasChannel",value:function(t){var e=parseInt(t,10);return e>=0&&e<this.channels.length}},{key:"hasTrack",value:function(t){var e=parseInt(t,10);return e>=0&&this.channels.every((function(t){return e<t.length()}))}},{key:"has",value:function(t,e){if(!this.hasChannel(t))return this.channels.some((function(t){return t.get().some((function(t){return t.has()}))}));var r=parseInt(t,10),n=this.channels[r].get();return this.hasTrack(e)?n[parseInt(e,10)].has():n.some((function(t){return t.has()}))}},{key:"get",value:function(){return this.activeTrack}},{key:"flatTrack",value:function(t,e){if(!this.hasChannel(t)||!this.hasTrack(e))return null;for(var r=this.channels[t].get(e).get(),n=this.processor.bufferSize,i=new Float32Array(r.length*n),o=0,s=r.length;o<s;o++)for(var a=r[o],c=0;c<n;c++)i[o*n+c]=a[c];return i}},{key:"mixTrack",value:function(t){if(!this.hasChannel(t))return null;var e,r=this.channels[t].get(),n=this.processor.bufferSize,i=0,o=0,s=0,a=0,c=0,u=Q(r);try{for(u.s();!(e=u.n()).done;){var l=e.value.get();c<l.length&&(c=l.length)}}catch(t){u.e(t)}finally{u.f()}for(var f=new Float32Array(c*n);;){for(var h=0,p=r.length;h<p;h++){var y=r[h].get()[s];y instanceof Float32Array&&(i+=y[a],o++)}if(o<=0)return f;f[s*n+a]=i/o,i=0,o=0,a<n-1?a++:(s++,a=0)}}},{key:"clear",value:function(t){-1!==this.activeTrack&&this.stop();var e=parseInt(t,10);if(-1===e){var r,n=Q(this.channels);try{for(n.s();!(r=n.n()).done;){var i,o=Q(r.value.get());try{for(o.s();!(i=o.n()).done;)i.value.clear()}catch(t){o.e(t)}finally{o.f()}}}catch(t){n.e(t)}finally{n.f()}}else if(this.hasTrack(e)){var s,a=Q(this.channels);try{for(a.s();!(s=a.n()).done;)s.value.get(e).clear()}catch(t){a.e(t)}finally{a.f()}}return this}},{key:"create",value:function(t,e,r,n){-1!==this.activeTrack&&this.stop();var i=null,o=null;if(-1===t&&this.has())i=this.mixTrack(0),o=this.mixTrack(1);else{if(!this.has(0,t)||!this.has(1,t))return"";i=this.flatTrack(0,t),o=this.flatTrack(1,t)}var s=1===e?1:2,a=8===r?8:16,c=1===s?Math.min(i.length,o.length):2*Math.min(i.length,o.length),u=36+c*(a/8),l=8+c*(a/8)+28+8,f=this.sampleRate,h=f*s*(a/8),p=c*(a/8),y=null;switch(a){case 8:y=new Uint8Array(c);for(var v=0;v<c;v++){var d=0;(d=v%s==0?(i[Math.floor(v/s)]+1)/2*(Math.pow(2,8)-1):(o[Math.floor(v/s)]+1)/2*(Math.pow(2,8)-1))>Math.pow(2,8)-1&&(d=Math.pow(2,8)-1),d<Math.pow(2,0)-1&&(d=Math.pow(2,0)-1),y[v]=d}break;case 16:y=new Int16Array(c);for(var b=0;b<c;b++){var m=0;(m=b%s==0?i[Math.floor(b/s)]*Math.pow(2,15):o[Math.floor(b/s)]*Math.pow(2,15))>+Math.pow(2,15)-1&&(m=+Math.pow(2,15)-1),m<-Math.pow(2,15)-0&&(m=-Math.pow(2,15)-0),y[b]=m}}var g=new Uint8Array(44+p);g[0]=82,g[1]=73,g[2]=70,g[3]=70,g[4]=u>>0&255,g[5]=u>>8&255,g[6]=u>>16&255,g[7]=u>>24&255,g[8]=87,g[9]=65,g[10]=86,g[11]=69,g[12]=102,g[13]=109,g[14]=116,g[15]=32,g[16]=16,g[17]=0,g[18]=0,g[19]=0,g[20]=1,g[21]=0,g[22]=s,g[23]=0,g[24]=f>>0&255,g[25]=f>>8&255,g[26]=f>>16&255,g[27]=f>>24&255,g[28]=h>>0&255,g[29]=h>>8&255,g[30]=h>>16&255,g[31]=h>>24&255,g[32]=s*(a/8),g[33]=0,g[34]=a,g[35]=0,g[36]=100,g[37]=97,g[38]=116,g[39]=97,g[40]=p>>0&255,g[41]=p>>8&255,g[42]=p>>16&255,g[43]=p>>24&255;for(var w=0;w<c;w++)switch(a){case 8:g[l-p+w]=y[w];break;case 16:g[l-p+2*w+0]=y[w]>>0&255,g[l-p+2*w+1]=y[w]>>8&255}var S=String(n).toLowerCase(),O=window.btoa(Array.from(g).map((function(t){return String.fromCodePoint(t)})).join("")),A=new Blob([g],{type:"audio/wav"});switch(S){case"base64":case"dataurl":return"base64"===S?O:"data:audio/wav;base64,".concat(O);default:return"blob"===S?A:window.URL.createObjectURL(A)}}},{key:"INPUT",get:function(){return this.processor}},{key:"OUTPUT",get:function(){return this.processor}},{key:"toString",value:function(){return"[SoundModule Recorder]"}}],r&&Y(e.prototype,r),s}(e);function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function rt(t,e){return rt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},rt(t,e)}function nt(t,e){if(e&&("object"===tt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function it(t){return it=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},it(t)}var ot,st,at=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&rt(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=it(n);if(i){var r=it(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return nt(this,t)});function s(t,e,r,n,i){var a;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(a=o.call(this)).isActive=!1,a.context=t,a.analyser=i,a.sender=t.createScriptProcessor(s.BUFFER_SIZE,r,n),a.receiver=t.createScriptProcessor(s.BUFFER_SIZE,r,n),a.websocket=null,a.paused=!0,a}return e=s,r=[{key:"setup",value:function(t,e,r,n,i,o,s){var a=this;if("[object Object]"===Object.prototype.toString.call(arguments[0])){var c=arguments[0];"tls"in c&&(t=c.tls),"host"in c&&(e=c.host),"port"in c&&(r=c.port),"path"in c&&(n=c.path),"open"in c&&(i=c.open),"close"in c&&(o=c.close),"error"in c&&(s=c.error)}var u=t?"wss://":"ws://";"/"!==n.charAt(0)&&(n="/".concat(n));var l=parseInt(r,10);return isNaN(l)||l<0||l>65535||(this.websocket=new WebSocket("".concat(u).concat(e,":").concat(l).concat(n)),this.websocket.binaryType="arraybuffer",this.websocket.onopen=function(t){"[object Function]"===Object.prototype.toString.call(i)&&i(t)},this.websocket.onclose=function(t){a.isActive=!1,a.paused=!0,a.connect(),"[object Function]"===Object.prototype.toString.call(o)&&o(t)},this.websocket.onerror=function(t){a.isActive=!1,a.paused=!0,a.connect(),"[object Function]"===Object.prototype.toString.call(s)&&s(t)},this.websocket.onmessage=function(t){if(!a.isActive)return a.analyser.stop("time"),void a.analyser.stop("fft");if(t.data instanceof ArrayBuffer){var e=t.data.byteLength/Float32Array.BYTES_PER_ELEMENT,r=Math.floor(e/2),n=r*Float32Array.BYTES_PER_ELEMENT,i=new Float32Array(t.data,0,r),o=new Float32Array(t.data,n,r);a.analyser.start("time"),a.analyser.start("fft"),a.receiver.onaudioprocess=function(t){var e=t.outputBuffer.getChannelData(0),r=t.outputBuffer.getChannelData(1);i instanceof Float32Array&&e.set(i),o instanceof Float32Array&&r.set(o),a.isActive&&null!==a.websocket||(a.analyser.stop("time"),a.analyser.stop("fft"))}}}),this}},{key:"connect",value:function(){return this.receiver.disconnect(0),this.sender.disconnect(0),this.receiver.onaudioprocess=null,this.sender.onaudioprocess=null,this.isActive?(this.receiver.connect(this.analyser.input),this.receiver.connect(this.context.destination)):this.paused=!0,this}},{key:"start",value:function(){var t=this;if(this.isActive&&this.isConnected()&&this.paused){this.paused=!1;var e=this.sender.bufferSize;this.sender.onaudioprocess=function(r){if(t.isActive&&t.isConnected()){for(var n=r.inputBuffer.getChannelData(0),i=r.inputBuffer.getChannelData(1),o=new Float32Array(2*e),s=parseInt(o.length/2,10),a=0;a<e;a++)o[a]=n[a],o[s+a]=i[a];0===t.websocket.bufferedAmount&&t.websocket.send(o)}}}return this}},{key:"close",value:function(){return this.websocket instanceof WebSocket&&(this.isActive=!1,this.paused=!0,this.connect(),this.websocket.close(),this.websocket=null),this}},{key:"isConnected",value:function(){return this.websocket instanceof WebSocket&&this.websocket.readyState===WebSocket.OPEN}},{key:"state",value:function(t,e,r){var n=this;if(void 0===t)return this.isActive;"[object Function]"===Object.prototype.toString.call(r)&&r();var i=window.setInterval((function(){n.websocket instanceof WebSocket&&0!==n.websocket.bufferedAmount||("toggle"===String(t).toLowerCase()?n.isActive=!n.isActive:n.isActive=Boolean(t),n.connect(),"[object Function]"===Object.prototype.toString.call(e)&&e(),window.clearInterval(i))}),10);return this}},{key:"get",value:function(){return this.websocket}},{key:"INPUT",get:function(){return this.sender}},{key:"OUTPUT",get:function(){return this.sender}},{key:"toString",value:function(){return"[SoundModule Session]"}}],r&&et(e.prototype,r),s}(e);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ut(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function lt(t,e){return lt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},lt(t,e)}function ft(t,e){if(e&&("object"===ct(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ht(t){return ht=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ht(t)}(st="BUFFER_SIZE")in(ot=at)?Object.defineProperty(ot,st,{value:2048,enumerable:!0,configurable:!0,writable:!0}):ot[st]=2048;var pt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&<(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=ht(n);if(i){var r=ht(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return ft(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this)).isActive=!0,r.context=t,r.input=t.createGain(),r.output=t.createGain(),r.lfo=t.createOscillator(),r.depth=t.createGain(),r.rate=r.lfo.frequency,r.processor=t.createScriptProcessor(e,2,2),r.lfo.start=r.lfo.start||r.lfo.noteOn,r.lfo.stop=r.lfo.stop||r.lfo.noteOff,r.values={},r.isStop=!0,r}return e=s,(r=[{key:"param",value:function(){return this}},{key:"connect",value:function(){return this}},{key:"start",value:function(t){if(this.isActive&&this.isStop){var e=parseFloat(t);(isNaN(e)||e<this.context.currentTime)&&(e=this.context.currentTime),this.lfo.start(e),this.isStop=!1}return this}},{key:"stop",value:function(t,e){if(this.isActive&&!this.isStop){var r=parseFloat(t),n=parseFloat(e);(isNaN(r)||r<this.context.currentTime)&&(r=this.context.currentTime),(isNaN(n)||n<0)&&(n=0);var i=this.lfo.type,o=this.lfo.frequency.value;this.lfo.stop(r+n),this.lfo=this.context.createOscillator(),this.lfo.start=this.lfo.start||this.lfo.noteOn,this.lfo.stop=this.lfo.stop||this.lfo.noteOff,this.lfo.type=i,this.lfo.frequency.value=o,this.rate=this.lfo.frequency,this.isStop=!0}return this}},{key:"state",value:function(t){return void 0===t?this.isActive:("toggle"===String(t).toLowerCase()?this.isActive=!this.isActive:this.isActive=Boolean(t),this.connect(),this.start(this.context.currentTime),this)}},{key:"params",value:function(){return{}}},{key:"toJSON",value:function(){return JSON.stringify(this.params())}},{key:"INPUT",get:function(){return this.input}},{key:"OUTPUT",get:function(){return this.output}},{key:"toString",value:function(){return"[SoundModule Effector]"}}])&&ut(e.prototype,r),s}(e);function yt(t){return yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(t)}function vt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function dt(t,e,r){return dt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=gt(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},dt(t,e,r||t)}function bt(t,e){return bt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},bt(t,e)}function mt(t,e){if(e&&("object"===yt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function gt(t){return gt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},gt(t)}var wt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&bt(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=gt(n);if(i){var r=gt(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return mt(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).panner=t.createStereoPanner(),r.panner.pan.value=0,r.depth.gain.value=0,r.rate.value=0,r.state(!1),r.lfo.connect(r.depth),r.depth.connect(r.panner.pan),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,s=null;switch(n){case"depth":if(void 0===e)return this.depth.gain.value;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this.depth.gain.value=i);break;case"rate":if(void 0===e)return this.rate.value;i=parseFloat(e),o=0,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.rate.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.panner.disconnect(0),this.isActive?(this.input.connect(this.panner),this.panner.connect(this.output)):this.input.connect(this.output),this}},{key:"stop",value:function(t,e){return dt(gt(s.prototype),"stop",this).call(this,t,e),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.panner.pan)),this}},{key:"params",value:function(){return{state:this.isActive,depth:this.depth.gain.value,rate:this.rate.value}}},{key:"toString",value:function(){return"[SoundModule Autopanner]"}}],r&&vt(e.prototype,r),s}(pt);function St(t){return St="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},St(t)}function Ot(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function At(t,e,r){return At="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Et(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},At(t,e,r||t)}function kt(t,e){return kt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},kt(t,e)}function Tt(t,e){if(e&&("object"===St(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Et(t){return Et=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Et(t)}var jt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&kt(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Et(n);if(i){var r=Et(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Tt(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).amplitudeL=t.createGain(),r.amplitudeR=t.createGain(),r.splitter=t.createChannelSplitter(2),r.merger=t.createChannelMerger(2),r.amplitudeL.gain.value=1,r.amplitudeR.gain.value=1,r.depth.gain.value=0,r.rate.value=0,r.state(!1),r.lfoSplitter=t.createChannelSplitter(2),r.lfo.connect(r.depth),r.depth.connect(r.processor),r.processor.connect(r.lfoSplitter),r.lfoSplitter.connect(r.amplitudeL.gain,0),r.lfoSplitter.connect(r.amplitudeR.gain,1),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,s=null;switch(n){case"depth":if(void 0===e)return this.depth.gain.value;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this.depth.gain.value=i);break;case"rate":if(void 0===e)return this.rate.value;i=parseFloat(e),o=0,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.rate.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.amplitudeL.disconnect(0),this.amplitudeR.disconnect(0),this.splitter.disconnect(0),this.splitter.disconnect(1),this.merger.disconnect(0),this.isActive?(this.input.connect(this.splitter),this.splitter.connect(this.amplitudeL,0,0),this.splitter.connect(this.amplitudeR,1,0),this.amplitudeL.connect(this.merger,0,0),this.amplitudeR.connect(this.merger,0,1),this.merger.connect(this.output)):this.input.connect(this.output),this}},{key:"start",value:function(t){var e=this;if(this.isActive&&this.isStop){var r=parseFloat(t);(isNaN(r)||r<this.context.currentTime)&&(r=this.context.currentTime),this.lfo.start(r),this.isStop=!1;var n=this.processor.bufferSize;this.processor.onaudioprocess=function(t){var r=t.inputBuffer.getChannelData(0),i=t.outputBuffer.getChannelData(0),o=t.outputBuffer.getChannelData(1);if(e.isActive&&0!==e.depth.gain.value&&0!==e.rate.value)for(var s=0;s<n;s++)i[s]=r[s],o[s]=-r[s];else for(var a=0;a<n;a++)i[a]=0,o[a]=0}}return this}},{key:"stop",value:function(t,e){return At(Et(s.prototype),"stop",this).call(this,t,e),this.isActive&&(this.processor.disconnect(0),this.processor.onaudioprocess=null,this.lfo.connect(this.depth),this.depth.connect(this.processor),this.processor.connect(this.lfoSplitter),this.lfoSplitter.connect(this.amplitudeL.gain,0),this.lfoSplitter.connect(this.amplitudeR.gain,1)),this}},{key:"params",value:function(){return{state:this.isActive,depth:this.depth.gain.value,rate:this.rate.value}}},{key:"toString",value:function(){return"[SoundModule AutopannerFallback]"}}],r&&Ot(e.prototype,r),s}(pt);function Rt(t){return Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rt(t)}function Pt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function xt(t,e,r){return xt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ft(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},xt(t,e,r||t)}function _t(t,e){return _t=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},_t(t,e)}function Mt(t,e){if(e&&("object"===Rt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Ft(t){return Ft=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ft(t)}var Ct=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_t(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Ft(n);if(i){var r=Ft(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Mt(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).delay=t.createDelay(),r.mix=t.createGain(),r.tone=t.createBiquadFilter(),r.feedback=t.createGain(),r.delay.delayTime.value=0,r.depth.gain.value=0,r.rate.value=0,r.mix.gain.value=0,r.tone.type="string"==typeof r.tone.type?"lowpass":r.tone.LOWPASS||0,r.tone.frequency.value=350,r.tone.Q.value=Math.SQRT1_2,r.tone.gain.value=0,r.feedback.gain.value=0,r.depthRate=0,r.state(!1),r.lfo.connect(r.depth),r.depth.connect(r.delay.delayTime),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,s=null;switch(n){case"delaytime":case"time":if(void 0===e)return this.delay.delayTime.value;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this.delay.delayTime.value=i,this.depth.gain.value=this.delay.delayTime.value*this.depthRate);break;case"depth":if(void 0===e)return this.depthRate;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this.depth.gain.value=this.delay.delayTime.value*i,this.depthRate=i);break;case"rate":if(void 0===e)return this.rate.value;i=parseFloat(e),o=0,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.rate.value=i);break;case"mix":case"feedback":if(void 0===e)return this[n].gain.value;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this[n].gain.value=i);break;case"tone":if(void 0===e)return this.tone.frequency.value;i=parseFloat(e),o=10,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.tone.frequency.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.delay.disconnect(0),this.mix.disconnect(0),this.tone.disconnect(0),this.feedback.disconnect(0),this.input.connect(this.output),this.isActive&&(this.input.connect(this.tone),this.tone.connect(this.delay),this.delay.connect(this.mix),this.mix.connect(this.output),this.delay.connect(this.feedback),this.feedback.connect(this.delay)),this}},{key:"stop",value:function(t,e){return xt(Ft(s.prototype),"stop",this).call(this,t,e),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.delay.delayTime)),this}},{key:"params",value:function(){return{state:this.isActive,time:this.delay.delayTime.value,depth:this.depthRate,rate:this.rate.value,mix:this.mix.gain.value,tone:this.tone.frequency.value,feedback:this.feedback.gain.value}}},{key:"toString",value:function(){return"[SoundModule Chorus]"}}],r&&Pt(e.prototype,r),s}(pt);function It(t){return It="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},It(t)}function Nt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Lt(t,e){return Lt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Lt(t,e)}function Bt(t,e){if(e&&("object"===It(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Dt(t){return Dt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Dt(t)}var Ut=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Lt(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Dt(n);if(i){var r=Dt(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Bt(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).compressor=t.createDynamicsCompressor(),r.compressor.threshold.value=-24,r.compressor.knee.value=30,r.compressor.ratio.value=12,r.compressor.attack.value=.003,r.compressor.release.value=.25,r.state(!0),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase();if(n in this.compressor){if(void 0===e)return this.compressor[n].value;var i=parseFloat(e),o={threshold:-100,knee:0,ratio:1,attack:0,release:0},s={threshold:0,knee:40,ratio:20,attack:1,release:1},a=o[n],c=s[n];i>=a&&i<=c&&(this.compressor[n].value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.compressor.disconnect(0),this.isActive?(this.input.connect(this.compressor),this.compressor.connect(this.output)):this.input.connect(this.output),this}},{key:"params",value:function(){return{state:this.isActive,threshold:this.compressor.threshold.value,knee:this.compressor.knee.value,ratio:this.compressor.ratio.value,attack:this.compressor.attack.value,release:this.compressor.release.value}}},{key:"toString",value:function(){return"[SoundModule Compressor]"}}],r&&Nt(e.prototype,r),s}(pt);function qt(t){return qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qt(t)}function Gt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Vt(t,e){return Vt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Vt(t,e)}function zt(t,e){if(e&&("object"===qt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Xt(t){return Xt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Xt(t)}var Wt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Vt(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Xt(n);if(i){var r=Xt(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return zt(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).delay=t.createDelay(s.MAX_DELAY_TIME),r.dry=t.createGain(),r.wet=t.createGain(),r.tone=t.createBiquadFilter(),r.feedback=t.createGain(),r.delay.delayTime.value=0,r.dry.gain.value=1,r.wet.gain.value=0,r.tone.type="string"==typeof r.tone.type?"lowpass":r.tone.LOWPASS||0,r.tone.frequency.value=350,r.tone.Q.value=Math.SQRT1_2,r.tone.gain.value=0,r.feedback.gain.value=0,r.state(!1),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,a=null;switch(n){case"delaytime":case"time":if(void 0===e)return this.delay.delayTime.value;i=parseFloat(e),o=0,a=s.MAX_DELAY_TIME,i>=o&&i<=a&&(this.delay.delayTime.value=i);break;case"dry":case"wet":case"feedback":if(void 0===e)return this[n].gain.value;a=1,(i=parseFloat(e))>=(o=0)&&i<=a&&(this[n].gain.value=i);break;case"tone":if(void 0===e)return this.tone.frequency.value;i=parseFloat(e),o=10,a=this.context.sampleRate/2,i>=o&&i<=a&&(this.tone.frequency.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.delay.disconnect(0),this.dry.disconnect(0),this.wet.disconnect(0),this.tone.disconnect(0),this.feedback.disconnect(0),this.isActive?(this.input.connect(this.dry),this.dry.connect(this.output),this.input.connect(this.tone),this.tone.connect(this.delay),this.delay.connect(this.wet),this.wet.connect(this.output),this.delay.connect(this.feedback),this.feedback.connect(this.delay)):this.input.connect(this.output),this}},{key:"params",value:function(){return{state:this.isActive,time:this.delay.delayTime.value,dry:this.dry.gain.value,wet:this.wet.gain.value,tone:this.tone.frequency.value,feedback:this.feedback.gain.value}}},{key:"toString",value:function(){return"[SoundModule Delay]"}}],r&&Gt(e.prototype,r),s}(pt);function Qt(t){return Qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qt(t)}function Ht(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Zt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function $t(t,e,r){return e&&Zt(t.prototype,e),r&&Zt(t,r),t}function Jt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Kt(t,e)}function Kt(t,e){return Kt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Kt(t,e)}function te(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=re(t);if(e){var i=re(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return ee(this,r)}}function ee(t,e){if(e&&("object"===Qt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function re(t){return re=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},re(t)}!function(t,e,r){e in t?Object.defineProperty(t,e,{value:5,enumerable:!0,configurable:!0,writable:!0}):t[e]=5}(Wt,"MAX_DELAY_TIME");var ne=function(t){Jt(r,t);var e=te(r);function r(t){var n;return Yt(this,r),(n=e.call(this,t,0)).preAmp=t.createWaveShaper(),n.gain=t.createGain(),n.leadGain=t.createGain(),n.lowpass=t.createBiquadFilter(),n.highpass1=t.createBiquadFilter(),n.highpass2=t.createBiquadFilter(),n.highpass3=t.createBiquadFilter(),n.gain.gain.value=.5,n.leadGain.gain.value=.5,n.lowpass.type="string"==typeof n.lowpass.type?"lowpass":n.lowpass.LOWPASS||0,n.lowpass.frequency.value=3200,n.lowpass.Q.value=Math.SQRT1_2,n.lowpass.gain.value=0,n.highpass1.type="string"==typeof n.highpass1.type?"highpass":n.highpass1.HIGHPASS||1,n.highpass1.frequency.value=80,n.highpass1.Q.value=Math.SQRT1_2,n.highpass1.gain.value=0,n.highpass2.type="string"==typeof n.highpass2.type?"highpass":n.highpass2.HIGHPASS||1,n.highpass2.frequency.value=640,n.highpass2.Q.value=Math.SQRT1_2,n.highpass2.gain.value=0,n.highpass3.type="string"==typeof n.highpass3.type?"highpass":n.highpass3.HIGHPASS||1,n.highpass3.frequency.value=80,n.highpass3.Q.value=Math.SQRT1_2,n.highpass3.gain.value=0,n.state(!1),n}return $t(r,[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null;switch(n){case"curve":if(void 0===e)return this.preAmp.curve;this.preAmp.curve=e;break;case"gain":if(void 0===e)return this.gain.gain.value;(i=parseFloat(e))>=0&&i<=1&&(this.gain.gain.value=i);break;case"lead":if(void 0===e)return this.leadGain.gain.value;(i=parseFloat(e))>=0&&i<=1&&(this.leadGain.gain.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.isActive?(this.input.connect(this.highpass1),this.highpass1.connect(this.gain),this.gain.connect(this.highpass3),this.input.connect(this.highpass2),this.highpass2.connect(this.leadGain),this.leadGain.connect(this.highpass3),this.highpass3.connect(this.preAmp),this.preAmp.connect(this.output)):this.input.connect(this.output),this}}]),r}(pt),ie=function(t){Jt(r,t);var e=te(r);function r(t){var n;return Yt(this,r),(n=e.call(this,t,0)).distortion=t.createWaveShaper(),n.bass=t.createBiquadFilter(),n.middle=t.createBiquadFilter(),n.treble=t.createBiquadFilter(),n.bass.type="string"==typeof n.bass.type?"lowshelf":n.bass.LOWSHELF||3,n.middle.type="string"==typeof n.middle.type?"peaking":n.middle.PEAKING||5,n.treble.type="string"==typeof n.treble.type?"highshelf":n.treble.HIGHSHELF||4,n.bass.frequency.value=240,n.middle.frequency.value=500,n.treble.frequency.value=1600,n.middle.Q.value=Math.SQRT1_2,n.bass.gain.value=0,n.middle.gain.value=0,n.treble.gain.value=0,n.lowpass=t.createBiquadFilter(),n.highpass=t.createBiquadFilter(),n.lowpass.type="string"==typeof n.lowpass.type?"lowpass":n.lowpass.LOWPASS||0,n.lowpass.frequency.value=24e3,n.lowpass.Q.value=Math.SQRT1_2,n.lowpass.gain.value=0,n.highpass.type="string"==typeof n.highpass.type?"highpass":n.highpass.HIGHPASS||1,n.highpass.frequency.value=40,n.highpass.Q.value=Math.SQRT1_2,n.highpass.gain.value=0,n.state(!1),n}return $t(r,[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,s=null;switch(n){case"curve":if(void 0===e)return this.distortion.curve;this.distortion.curve=e;break;case"bass":case"middle":case"treble":if(void 0===e)return this[n].gain.value;s=40,(i=parseFloat(e))>=(o=-40)&&i<=s&&(this[n].gain.value=i);break;case"frequency":if(void 0===e)return this.middle.frequency.value;i=parseFloat(e),o=10,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.middle.frequency.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.isActive?(this.input.connect(this.lowpass),this.lowpass.connect(this.highpass),this.highpass.connect(this.distortion),this.distortion.connect(this.bass),this.bass.connect(this.middle),this.middle.connect(this.treble),this.treble.connect(this.output)):this.input.connect(this.output),this}}]),r}(pt),oe=function(t){Jt(r,t);var e=te(r);function r(t,n){var i;return Yt(this,r),(i=e.call(this,t,n)).distortion=t.createWaveShaper(),i.preEQ=new ne(t),i.postEQ=new ie(t),i.type=r.CLEAN,i.numberOfSamples=256,i.param("curve",r.CLEAN),i.state(!1),i}return $t(r,[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var n in arguments[0])this.param(n,arguments[0][n]);else{var i=String(t).replace(/-/g,"").toLowerCase(),o=null;switch(i){case"curve":var s=null;switch(String(e).toLowerCase()){case r.CLEAN:this.type=r.CLEAN,s=r.createCurve(0,this.numberOfSamples);break;case r.CRUNCH:this.type=r.CRUNCH,s=r.createCurve(3,this.numberOfSamples);break;case r.OVERDRIVE:this.type=r.OVERDRIVE,s=r.createCurve(5,this.numberOfSamples);break;case r.DISTORTION:this.type=r.DISTORTION,s=r.createCurve(8,this.numberOfSamples);break;case r.FUZZ:this.type=r.FUZZ,s=r.createCurve(10,this.numberOfSamples);break;default:if(void 0===e)return this.postEQ.param("curve");e instanceof Float32Array&&(s=e)}this.preEQ.param("curve",s),this.postEQ.param("curve",s);break;case"samples":if(void 0===e)return this.numberOfSamples;(o=parseInt(e,10))>=0&&(this.numberOfSamples=o,this.param("curve",this.type));break;case"pre":if(void 0===e)return this.preEQ.state();this.preEQ.state(e);break;case"gain":case"lead":if(void 0===e)return this.preEQ.param(i);this.preEQ.param(i,e);break;case"post":if(void 0===e)return this.postEQ.state();this.postEQ.state(e);break;case"bass":case"middle":case"treble":case"frequency":if(void 0===e)return this.postEQ.param(i);this.postEQ.param(i,e)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.isActive?(this.input.connect(this.preEQ.INPUT),this.preEQ.OUTPUT.connect(this.postEQ.INPUT),this.postEQ.OUTPUT.connect(this.output)):this.input.connect(this.output),this}},{key:"params",value:function(){return{state:this.isActive,curve:this.type,samples:this.numberOfSamples,pre:this.preEQ.state(),gain:this.preEQ.param("gain"),lead:this.preEQ.param("lead"),post:this.postEQ.state(),bass:this.postEQ.param("bass"),middle:this.postEQ.param("middle"),treble:this.postEQ.param("treble"),frequency:this.postEQ.param("frequency")}}},{key:"toString",value:function(){return"[SoundModule Distortion]"}}],[{key:"createCurve",value:function(t,e){var r=Math.floor((e-1)/2),n=new Float32Array(e),i=(Math.pow(10,t/5-1)-.1)/5+1,o=.4;1===i?o=1:i>1&&i<1.04&&(o=-15.5*i+16.52);for(var s=0;s<r;s++)n[r+s]=o*(1-Math.pow(i,-s)+s*Math.pow(i,-r)/r),n[r-s]=o*(-1+Math.pow(i,-s)-s*Math.pow(i,-r)/r);return n[r]=0,n}}]),r}(pt);function se(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ae(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ae(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function ae(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ce(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}Ht(oe,"CLEAN","clean"),Ht(oe,"CRUNCH","crunch"),Ht(oe,"OVERDRIVE","overdrive"),Ht(oe,"DISTORTION","distortion"),Ht(oe,"FUZZ","fuzz");var ue=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.generators=[],this.activeIndexes=[],this.activeCounter=0,this.attack=.01,this.decay=.3,this.sustain=.5,this.release=1}var e,r;return e=t,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null;switch(n){case"attack":case"sustain":if(void 0===e)return this[n];(i=parseFloat(e))>=0&&(this[n]=i);break;case"decay":case"release":if(void 0===e)return this[n];(i=parseFloat(e))>0&&(this[n]=i)}}return this}},{key:"ready",value:function(t,e,r){var n=parseInt(t,10)>=0?parseInt(t,10):0;return e instanceof AudioNode&&r instanceof AudioNode?(e.connect(this.generators[n]),this.generators[n].connect(r)):e instanceof AudioNode?e.connect(this.generators[n]):r instanceof AudioNode&&this.generators[n].connect(r),this.activeIndexes[n]=n,this.activeCounter++,this}},{key:"start",value:function(t){var e=parseFloat(t);(isNaN(e)||e<this.context.currentTime)&&(e=this.context.currentTime);var r,n=e,i=n+this.attack,o=this.decay,s=this.sustain,a=se(this.activeIndexes);try{for(a.s();!(r=a.n()).done;){var c=r.value;void 0!==c&&(this.generators[c].gain.cancelScheduledValues(n),this.generators[c].gain.setValueAtTime(0,n),this.generators[c].gain.linearRampToValueAtTime(1,i),this.generators[c].gain.setTargetAtTime(s,i,o))}}catch(t){a.e(t)}finally{a.f()}return this}},{key:"stop",value:function(t,e){var r=parseFloat(t)-this.release;(isNaN(r)||r<this.context.currentTime)&&(r=this.context.currentTime);var n,i=r,o=this.release,s=se(this.activeIndexes);try{for(s.s();!(n=s.n()).done;){var a=n.value;void 0!==a&&(this.generators[a].gain.cancelScheduledValues(i),e?this.generators[a].gain.setValueCurveAtTime(new Float32Array([1,.5,.25,0]),i,o):this.generators[a].gain.setTargetAtTime(0,i,o))}}catch(t){s.e(t)}finally{s.f()}return this}},{key:"getGenerator",value:function(t){var e=parseInt(t,10)>=0?parseInt(t,10):0;return this.generators[e]}},{key:"setGenerator",value:function(t){var e=parseInt(t,10)>=0?parseInt(t,10):0;return this.generators[e]=this.context.createGain(),this.generators[e].gain.setTargetAtTime=this.generators[e].gain.setTargetAtTime||this.generators[e].gain.setTargetValueAtTime,this}},{key:"isStop",value:function(){var e,r=0,n=se(this.activeIndexes);try{for(n.s();!(e=n.n()).done;){var i=e.value;if(void 0!==i){if(this.generators[i].gain.value>t.MIN_GAIN)return!1;if(++r===this.activeCounter)return!0}}}catch(t){n.e(t)}finally{n.f()}}},{key:"clear",value:function(t){this.activeIndexes.length=0,this.activeCounter=0;var e,r=se(this.generators);try{for(r.s();!(e=r.n()).done;){var n=e.value;n.gain.cancelScheduledValues(this.context.currentTime),n.gain.value=1,t&&n.disconnect(0)}}catch(t){r.e(t)}finally{r.f()}return this}},{key:"params",value:function(){return{attack:this.attack,decay:this.decay,sustain:this.sustain,release:this.release}}},{key:"toJSON",value:function(){return JSON.stringify(this.params())}},{key:"toString",value:function(){return"[SoundModule EnvelopeGenerator]"}}],r&&ce(e.prototype,r),t}();function le(t){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},le(t)}function fe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function he(t,e){return he=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},he(t,e)}function pe(t,e){if(e&&("object"===le(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ye(t){return ye=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ye(t)}!function(t,e,r){e in t?Object.defineProperty(t,e,{value:.001,enumerable:!0,configurable:!0,writable:!0}):t[e]=.001}(ue,"MIN_GAIN");var ve=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&he(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=ye(n);if(i){var r=ye(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return pe(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).bass=t.createBiquadFilter(),r.middle=t.createBiquadFilter(),r.treble=t.createBiquadFilter(),r.presence=t.createBiquadFilter(),r.bass.type="string"==typeof r.bass.type?"lowshelf":r.bass.LOWSHELF||3,r.middle.type="string"==typeof r.middle.type?"peaking":r.middle.PEAKING||5,r.treble.type="string"==typeof r.treble.type?"peaking":r.treble.PEAKING||5,r.presence.type="string"==typeof r.presence.type?"highshelf":r.presence.HIGHSHELF||4,r.bass.frequency.value=500,r.middle.frequency.value=1e3,r.treble.frequency.value=2e3,r.presence.frequency.value=4e3,r.middle.Q.value=Math.SQRT1_2,r.treble.Q.value=Math.SQRT1_2,r.bass.gain.value=0,r.middle.gain.value=0,r.treble.gain.value=0,r.presence.gain.value=0,r.state(!1),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null;switch(n){case"bass":case"middle":case"treble":case"presence":if(void 0===e)return this[n].gain.value;o=40,(i=parseFloat(e))>=-40&&i<=o&&(this[n].gain.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.bass.disconnect(0),this.middle.disconnect(0),this.treble.disconnect(0),this.presence.disconnect(0),this.isActive?(this.input.connect(this.bass),this.bass.connect(this.middle),this.middle.connect(this.treble),this.treble.connect(this.presence),this.presence.connect(this.output)):this.input.connect(this.output),this}},{key:"params",value:function(){return{state:this.isActive,bass:this.bass.gain.value,middle:this.middle.gain.value,treble:this.treble.gain.value,presence:this.presence.gain.value}}},{key:"toString",value:function(){return"[SoundModule Equalizer]"}}],r&&fe(e.prototype,r),s}(pt);function de(t){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},de(t)}function be(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function me(t,e){return me=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},me(t,e)}function ge(t,e){if(e&&("object"===de(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function we(t){return we=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},we(t)}var Se=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&me(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=we(n);if(i){var r=we(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return ge(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).filter=t.createBiquadFilter(),r.filter.frequency.setTargetAtTime=r.filter.frequency.setTargetAtTime||r.filter.frequency.setTargetValueAtTime,r.filter.type="string"==typeof r.filter.type?"lowpass":r.filter.LOWPASS||0,r.filter.frequency.value=350,r.filter.Q.value=1,r.filter.gain.value=0,r.maxFrequency=r.filter.frequency.value,r.range=.1,r.attack=.01,r.decay=.3,r.sustain=1,r.release=1,r.state(!1),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,a=null;switch(n){case"type":if(void 0===e)return this.filter.type;(i=String(e).toLowerCase())in s.FILTER_TYPES&&(this.filter.type="string"==typeof this.filter.type?i:s.FILTER_TYPES[i]);break;case"frequency":case"cutoff":if(void 0===e)return this.filter.frequency.value;i=parseFloat(e),o=10,a=this.context.sampleRate/2,i>=o&&i<=a&&(this.maxFrequency=i,this.filter.frequency.value=i);break;case"gain":if(void 0===e)return this.filter.gain.value;a=40,(i=parseFloat(e))>=(o=-40)&&i<=a&&(this.filter.gain.value=i);break;case"q":if(void 0===e)return this.filter.Q.value;a=1e3,(i=parseFloat(e))>=(o=1e-4)&&i<=a&&(this.filter.Q.value=i);break;case"range":if(void 0===e)return this.range;a=1,(i=parseFloat(e))>=(o=0)&&i<=a&&(this.range=i);break;case"attack":case"sustain":if(void 0===e)return this[n];(i=parseFloat(e))>=0&&(this[n]=i);break;case"decay":case"release":if(void 0===e)return this[n];(i=parseFloat(e))>0&&(this[n]=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.filter.disconnect(0),this.isActive?(this.input.connect(this.filter),this.filter.connect(this.output)):this.input.connect(this.output),this}},{key:"start",value:function(t){if(this.isActive){var e=parseFloat(t);(isNaN(e)||e<this.context.currentTime)&&(e=this.context.currentTime);var r=e,n=r+this.attack,i=this.decay,o=this.sustain*this.maxFrequency,s=this.maxFrequency*this.range;this.filter.frequency.cancelScheduledValues(r),this.filter.frequency.setValueAtTime(s,r),this.filter.frequency.linearRampToValueAtTime(this.maxFrequency,n),this.filter.frequency.setTargetAtTime(o,n,i)}return this}},{key:"stop",value:function(t){if(this.isActive){var e=parseFloat(t)-this.release;(isNaN(e)||e<this.context.currentTime)&&(e=this.context.currentTime);var r=e,n=this.release,i=this.maxFrequency*this.range;this.filter.frequency.cancelScheduledValues(r),this.filter.frequency.setValueAtTime(this.filter.frequency.value,r),this.filter.frequency.setTargetAtTime(i,r,n)}return this}},{key:"state",value:function(t){return void 0===t?this.isActive:("toggle"===String(t).toLowerCase()?this.isActive=!this.isActive:this.isActive=Boolean(t),this.connect(),this)}},{key:"params",value:function(){return{state:this.isActive,type:this.filter.type,frequency:this.filter.frequency.value,Q:this.filter.Q.value,gain:this.filter.gain.value,range:this.range,attack:this.attack,decay:this.decay,sustain:this.sustain,release:this.release}}},{key:"toString",value:function(){return"[SoundModule Filter]"}}],r&&be(e.prototype,r),s}(pt);function Oe(t){return Oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oe(t)}function Ae(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ke(t,e,r){return ke="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=je(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},ke(t,e,r||t)}function Te(t,e){return Te=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Te(t,e)}function Ee(t,e){if(e&&("object"===Oe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function je(t){return je=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},je(t)}!function(t,e,r){e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r}(Se,"FILTER_TYPES",{lowpass:0,highpass:1,bandpass:2,lowshelf:3,highshelf:4,peaking:5,notch:6,allpass:7});var Re=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Te(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=je(n);if(i){var r=je(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Ee(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).delay=t.createDelay(),r.mix=t.createGain(),r.tone=t.createBiquadFilter(),r.feedback=t.createGain(),r.delay.delayTime.value=0,r.depth.gain.value=0,r.rate.value=0,r.mix.gain.value=0,r.tone.type="string"==typeof r.tone.type?"lowpass":r.tone.LOWPASS||0,r.tone.frequency.value=350,r.tone.Q.value=Math.SQRT1_2,r.tone.gain.value=0,r.feedback.gain.value=0,r.depthRate=0,r.state(!1),r.lfo.connect(r.depth),r.depth.connect(r.delay.delayTime),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,s=null;switch(n){case"delaytime":case"time":if(void 0===e)return this.delay.delayTime.value;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this.delay.delayTime.value=i,this.depth.gain.value=this.delay.delayTime.value*this.depthRate);break;case"depth":if(void 0===e)return this.depthRate;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this.depth.gain.value=this.delay.delayTime.value*i,this.depthRate=i);break;case"rate":if(void 0===e)return this.rate.value;i=parseFloat(e),o=0,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.rate.value=i);break;case"mix":case"feedback":if(void 0===e)return this[n].gain.value;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this[n].gain.value=i);break;case"tone":if(void 0===e)return this.tone.frequency.value;i=parseFloat(e),o=10,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.tone.frequency.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.delay.disconnect(0),this.mix.disconnect(0),this.tone.disconnect(0),this.feedback.disconnect(0),this.input.connect(this.output),this.isActive&&(this.input.connect(this.tone),this.tone.connect(this.delay),this.delay.connect(this.mix),this.mix.connect(this.output),this.delay.connect(this.feedback),this.feedback.connect(this.delay)),this}},{key:"stop",value:function(t,e){return ke(je(s.prototype),"stop",this).call(this,t,e),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.delay.delayTime)),this}},{key:"params",value:function(){return{state:this.isActive,time:this.delay.delayTime.value,depth:this.depthRate,rate:this.rate.value,mix:this.mix.gain.value,tone:this.tone.frequency.value,feedback:this.feedback.gain.value}}},{key:"toString",value:function(){return"[SoundModule Flanger]"}}],r&&Ae(e.prototype,r),s}(pt);function Pe(t){return Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pe(t)}function xe(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _e(t,e){return _e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},_e(t,e)}function Me(t,e){if(e&&("object"===Pe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Fe(t){return Fe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Fe(t)}var Ce=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_e(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Fe(n);if(i){var r=Fe(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Me(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).listener=t.listener,r.positions={x:0,y:0,z:0},r.forwards={x:0,y:0,z:-1},r.ups={x:0,y:1,z:0},r.listener.positionX instanceof AudioParam&&r.listener.positionY instanceof AudioParam&&r.listener.positionZ instanceof AudioParam?(r.listener.positionX.setValueAtTime(r.positions.x,t.currentTime),r.listener.positionY.setValueAtTime(r.positions.y,t.currentTime),r.listener.positionZ.setValueAtTime(r.positions.z,t.currentTime)):r.listener.setPosition(r.positions.x,r.positions.y,r.positions.z),r.listener.forwardX instanceof AudioParam&&r.listener.forwardY instanceof AudioParam&&r.listener.forwardZ instanceof AudioParam&&r.listener.upX instanceof AudioParam&&r.listener.upY instanceof AudioParam&&r.listener.upZ instanceof AudioParam?(r.listener.forwardX.setValueAtTime(r.forwards.x,t.currentTime),r.listener.forwardY.setValueAtTime(r.forwards.y,t.currentTime),r.listener.forwardZ.setValueAtTime(r.forwards.z,t.currentTime),r.listener.upX.setValueAtTime(r.ups.x,t.currentTime),r.listener.upY.setValueAtTime(r.ups.y,t.currentTime),r.listener.upZ.setValueAtTime(r.ups.z,t.currentTime)):r.listener.setOrientation(r.forwards.x,r.forwards.y,r.forwards.z,r.ups.x,r.ups.y,r.ups.z),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null;switch(n){case"x":case"y":case"z":if(void 0===e)return this.positions[n];i=parseFloat(e),isNaN(i)||(this.positions[n]=i,this.listener.positionX instanceof AudioParam&&this.listener.positionY instanceof AudioParam&&this.listener.positionZ instanceof AudioParam?(this.listener.positionX.setValueAtTime(this.positions.x,this.context.currentTime),this.listener.positionY.setValueAtTime(this.positions.y,this.context.currentTime),this.listener.positionZ.setValueAtTime(this.positions.z,this.context.currentTime)):this.listener.setPosition(this.positions.x,this.positions.y,this.positions.z));break;case"fx":case"fy":case"fz":if(void 0===e)return this.forwards[n.charAt(1)];i=parseFloat(e),isNaN(i)||(this.forwards[n.charAt(1)]=i,this.listener.forwardX instanceof AudioParam&&this.listener.forwardY instanceof AudioParam&&this.listener.forwardZ instanceof AudioParam&&this.listener.upX instanceof AudioParam&&this.listener.upY instanceof AudioParam&&this.listener.upZ instanceof AudioParam?(this.listener.forwardX.setValueAtTime(this.forwards.x,this.context.currentTime),this.listener.forwardY.setValueAtTime(this.forwards.y,this.context.currentTime),this.listener.forwardZ.setValueAtTime(this.forwards.z,this.context.currentTime),this.listener.upX.setValueAtTime(this.ups.x,this.context.currentTime),this.listener.upY.setValueAtTime(this.ups.y,this.context.currentTime),this.listener.upZ.setValueAtTime(this.ups.z,this.context.currentTime)):this.listener.setOrientation(this.forwards.x,this.forwards.y,this.forwards.z,this.ups.x,this.ups.y,this.ups.z));break;case"ux":case"uy":case"uz":if(void 0===e)return this.ups[n.charAt(1)];i=parseFloat(e),isNaN(i)||(this.ups[n.charAt(1)]=i,this.listener.forwardX instanceof AudioParam&&this.listener.forwardY instanceof AudioParam&&this.listener.forwardZ instanceof AudioParam&&this.listener.upX instanceof AudioParam&&this.listener.upY instanceof AudioParam&&this.listener.upZ instanceof AudioParam?(this.listener.forwardX.setValueAtTime(this.forwards.x,this.context.currentTime),this.listener.forwardY.setValueAtTime(this.forwards.y,this.context.currentTime),this.listener.forwardZ.setValueAtTime(this.forwards.z,this.context.currentTime),this.listener.upX.setValueAtTime(this.ups.x,this.context.currentTime),this.listener.upY.setValueAtTime(this.ups.y,this.context.currentTime),this.listener.upZ.setValueAtTime(this.ups.z,this.context.currentTime)):this.listener.setOrientation(this.forwards.x,this.forwards.y,this.forwards.z,this.ups.x,this.ups.y,this.ups.z))}}return this}},{key:"params",value:function(){return{state:this.isActive,positions:this.positions,forwards:this.forwards,ups:this.ups}}},{key:"toJSON",value:function(){return JSON.stringify(this.params())}},{key:"toString",value:function(){return"[SoundModule Listener]"}}],r&&xe(e.prototype,r),s}(pt);function Ie(t){return Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ie(t)}function Ne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Le(t,e){return Le=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Le(t,e)}function Be(t,e){if(e&&("object"===Ie(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function De(t){return De=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},De(t)}function Ue(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var qe=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Le(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=De(n);if(i){var r=De(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Be(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).panner=t.createPanner(),r.positions={x:0,y:0,z:0},r.orientations={x:1,y:0,z:0},r.panner.refDistance=1,r.panner.maxDistance=1e4,r.panner.rolloffFactor=1,r.panner.coneInnerAngle=360,r.panner.coneOuterAngle=360,r.panner.coneOuterGain=0,r.panner.panningModel="string"==typeof r.panner.panningModel?"HRTF":r.panner.HRTF||1,r.panner.distanceModel="string"==typeof r.panner.distanceModel?"inverse":r.panner.INVERSE_DISTANCE||1,r.panner.positionX instanceof AudioParam&&r.panner.positionY instanceof AudioParam&&r.panner.positionZ instanceof AudioParam?(r.panner.positionX.setValueAtTime(r.positions.x,t.currentTime),r.panner.positionY.setValueAtTime(r.positions.y,t.currentTime),r.panner.positionZ.setValueAtTime(r.positions.z,t.currentTime)):r.panner.setPosition(r.positions.x,r.positions.y,r.positions.z),r.panner.orientationX instanceof AudioParam&&r.panner.orientationY instanceof AudioParam&&r.panner.orientationZ instanceof AudioParam?(r.panner.orientationX.setValueAtTime(r.orientations.x,t.currentTime),r.panner.orientationY.setValueAtTime(r.orientations.y,t.currentTime),r.panner.orientationZ.setValueAtTime(r.orientations.z,t.currentTime)):r.panner.setOrientation(r.orientations.x,r.orientations.y,r.orientations.z),r.state(!1),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null;switch(n){case"x":case"y":case"z":if(void 0===e)return this.positions[n];i=parseFloat(e),isNaN(i)||(this.positions[n]=i,this.panner.positionX instanceof AudioParam&&this.panner.positionY instanceof AudioParam&&this.panner.positionZ instanceof AudioParam?(this.panner.positionX.setValueAtTime(this.positions.x,this.context.currentTime),this.panner.positionY.setValueAtTime(this.positions.y,this.context.currentTime),this.panner.positionZ.setValueAtTime(this.positions.z,this.context.currentTime)):this.panner.setPosition(this.positions.x,this.positions.y,this.positions.z));break;case"ox":case"oy":case"oz":if(void 0===e)return this.orientations[n.charAt(1)];i=parseFloat(e),isNaN(i)||(this.orientations[n.charAt(1)]=i,this.panner.orientationX instanceof AudioParam&&this.panner.orientationY instanceof AudioParam&&this.panner.orientationZ instanceof AudioParam?(this.panner.orientationX.setValueAtTime(this.orientations.x,this.context.currentTime),this.panner.orientationY.setValueAtTime(this.orientations.y,this.context.currentTime),this.panner.orientationZ.setValueAtTime(this.orientations.z,this.context.currentTime)):this.panner.setOrientation(this.orientations.x,this.orientations.y,this.orientations.z));break;case"refdistance":if(void 0===e)return this.panner.refDistance;(i=parseFloat(e))>=0&&(this.panner.refDistance=i);break;case"maxdistance":if(void 0===e)return this.panner.maxDistance;(i=parseFloat(e))>0&&(this.panner.maxDistance=i);break;case"rollofffactor":if(void 0===e)return this.panner.rolloffFactor;(i=parseFloat(e))>=0&&(this.panner.rolloffFactor=i);break;case"coneinnerangle":if(void 0===e)return this.panner.coneInnerAngle;(i=parseFloat(e))>=0&&i<=360&&(this.panner.coneInnerAngle=i);break;case"coneouterangle":if(void 0===e)return this.panner.coneOuterAngle;(i=parseFloat(e))>=0&&i<=360&&(this.panner.coneOuterAngle=i);break;case"coneoutergain":if(i>=0&&i<=1)return this.panner.coneOuterGain;i=parseFloat(e),isNaN(i)||(this.panner.coneOuterGain=i);break;case"panningmodel":if(void 0===e)return this.panner.panningModel;(i=/HRTF/i.test(e)?String(e).toUpperCase():String(e).toLowerCase())in s.PANNING_MODELS&&(this.panner.panningModel="string"==typeof this.panner.panningModel?i:s.PANNING_MODELS[i]);break;case"distancemodel":if(void 0===e)return this.panner.distanceModel;(i=String(e).replace(/-/g,"").toLowerCase())in s.DISTANCE_MODELS&&(this.panner.distanceModel="string"==typeof this.panner.distanceModel?i:s.DISTANCE_MODELS[i])}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.panner.disconnect(0),this.isActive?(this.input.connect(this.panner),this.panner.connect(this.output)):this.input.connect(this.output),this}},{key:"params",value:function(){return{state:this.isActive,positions:this.positions,orientations:this.orientations,refDistance:this.panner.refDistance,maxDistance:this.panner.maxDistance,rolloffFactor:this.panner.rolloffFactor,coneInnerAngle:this.panner.coneInnerAngle,coneOuterAngle:this.panner.coneOuterAngle,coneOuterGain:this.panner.coneOuterGain,panningModel:this.panner.panningModel,distanceModel:this.panner.distanceModel}}},{key:"toString",value:function(){return"[SoundModule Panner]"}}],r&&Ne(e.prototype,r),s}(pt);function Ge(t){return Ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ge(t)}function Ve(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ze(t,e,r){return ze="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Qe(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},ze(t,e,r||t)}function Xe(t,e){return Xe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Xe(t,e)}function We(t,e){if(e&&("object"===Ge(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Qe(t){return Qe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Qe(t)}Ue(qe,"PANNING_MODELS",{equalpower:0,HRTF:1}),Ue(qe,"DISTANCE_MODELS",{linear:0,inverse:1,exponential:2});var He=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Xe(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Qe(n);if(i){var r=Qe(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return We(this,t)});function s(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).numberOfStages=12,r.filters=new Array(s.MAXIMUM_STAGES);for(var n=0;n<s.MAXIMUM_STAGES;n++)r.filters[n]=t.createBiquadFilter(),r.filters[n].type="string"==typeof r.filters[n].type?"allpass":r.filters[n].ALLPASS||7,r.filters[n].frequency.value=350,r.filters[n].Q.value=1,r.filters[n].gain.value=0;r.mix=t.createGain(),r.feedback=t.createGain(),r.depth.gain.value=0,r.rate.value=0,r.mix.gain.value=0,r.feedback.gain.value=0,r.depthRate=0,r.state(!1),r.lfo.connect(r.depth);for(var i=0;i<s.MAXIMUM_STAGES;i++)r.depth.connect(r.filters[i].frequency);return r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,a=null;switch(n){case"stage":if(void 0===e)return this.numberOfStages;switch(i=parseInt(e,10)){case 0:case 2:case 4:case 8:case 12:case 24:this.numberOfStages=i,this.connect()}break;case"frequency":case"cutoff":if(void 0===e)return this.filters[0].frequency.value;if(i=parseFloat(e),o=10,a=this.context.sampleRate/2,i>=o&&i<=a){for(var c=0;c<s.MAXIMUM_STAGES;c++)this.filters[c].frequency.value=i;this.depth.gain.value=this.filters[0].frequency.value*this.depthRate}break;case"resonance":if(void 0===e)return this.filters[0].Q.value;if(a=1e3,(i=parseFloat(e))>=(o=1e-4)&&i<=a)for(var u=0;u<s.MAXIMUM_STAGES;u++)this.filters[0].Q.value=i;break;case"depth":if(void 0===e)return this.depthRate;a=1,(i=parseFloat(e))>=(o=0)&&i<=a&&(this.depth.gain.value=this.filters[0].frequency.value*i,this.depthRate=i);break;case"rate":if(void 0===e)return this.rate.value;i=parseFloat(e),o=0,a=this.context.sampleRate/2,i>=o&&i<=a&&(this.rate.value=i);break;case"mix":case"feedback":if(void 0===e)return this[n].gain.value;a=1,(i=parseFloat(e))>=(o=0)&&i<=a&&(this[n].gain.value=i)}}return this}},{key:"connect",value:function(){this.input.disconnect(0);for(var t=0;t<s.MAXIMUM_STAGES;t++)this.filters[t].disconnect(0);if(this.mix.disconnect(0),this.feedback.disconnect(0),this.input.connect(this.output),this.isActive&&this.numberOfStages>0){this.input.connect(this.filters[0]);for(var e=0;e<this.numberOfStages;e++)e<this.numberOfStages-1?this.filters[e].connect(this.filters[e+1]):(this.filters[e].connect(this.mix),this.mix.connect(this.output),this.filters[e].connect(this.feedback),this.feedback.connect(this.filters[0]))}return this}},{key:"stop",value:function(t,e){if(ze(Qe(s.prototype),"stop",this).call(this,t,e),this.isActive){this.lfo.connect(this.depth);for(var r=0;r<s.MAXIMUM_STAGES;r++)this.depth.connect(this.filters[r].frequency)}return this}},{key:"params",value:function(){return{state:this.isActive,stage:this.numberOfStages,frequency:this.filters[0].frequency.value,resonance:this.filters[0].Q.value,depth:this.depthRate,rate:this.rate.value,mix:this.mix.gain.value,feedback:this.feedback.gain.value}}},{key:"toString",value:function(){return"[SoundModule Phaser]"}}],r&&Ve(e.prototype,r),s}(pt);function Ye(t){return Ye="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ye(t)}function Ze(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function $e(t,e){return $e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},$e(t,e)}function Je(t,e){if(e&&("object"===Ye(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Ke(t){return Ke=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ke(t)}!function(t,e,r){e in t?Object.defineProperty(t,e,{value:24,enumerable:!0,configurable:!0,writable:!0}):t[e]=24}(He,"MAXIMUM_STAGES");var tr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&$e(t,e)}(a,t);var e,r,n,i,o,s=(i=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Ke(i);if(o){var r=Ke(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Je(this,t)});function a(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),(r=s.call(this,t,e)).pitch=1,r.state(!1),r.connect(),r}return e=a,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null;if("pitch"===n){if(void 0===e)return this.pitch;(i=parseFloat(e))>0&&(this.pitch=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.processor.disconnect(0),this.isActive?(this.input.connect(this.processor),this.processor.connect(this.output)):this.input.connect(this.output),this}},{key:"start",value:function(){var t=this;if(this.isActive&&this.isStop){this.isStop=!1;var e=this.processor.bufferSize;this.processor.onaudioprocess=function(r){var n=r.inputBuffer.getChannelData(0),i=r.inputBuffer.getChannelData(1),o=r.outputBuffer.getChannelData(0),s=r.outputBuffer.getChannelData(1);if(t.isActive&&1!==t.pitch){var c=new Float32Array(n),u=new Float32Array(i),l=new Float32Array(e),f=new Float32Array(e);a.FFT(c,l,e),a.FFT(u,f,e);for(var h=new Float32Array(e),p=new Float32Array(e),y=new Float32Array(e),v=new Float32Array(e),d=0;d<e;d++){var b=Math.floor(t.pitch*d),m=1;d>e/2&&(m=0),b>=0&&b<e&&(h[b]+=m*c[d],y[b]+=m*l[d],p[b]+=m*u[d],v[b]+=m*f[d])}a.IFFT(h,y,e),a.IFFT(p,v,e),o.set(h),s.set(p)}else o.set(n),s.set(i)}}return this}},{key:"stop",value:function(){return this.isActive&&(this.processor.disconnect(0),this.processor.onaudioprocess=null,this.connect()),this}},{key:"params",value:function(){return{state:this.isActive,pitch:this.pitch}}},{key:"toString",value:function(){return"[SoundModule PitchShifter]"}}],n=[{key:"FFT",value:function(t,e,r){for(var n=function(t){return Math.pow(2,t)},i=new Float32Array(r),o=Math.log2(r),s=1;s<=o;s++)for(var a=0;a<n(s-1);a++)for(var c=o-s,u=0;u<n(c);u++){var l=a*n(c+1)+u,f=n(c)+l,h=u*n(s-1),p=t[l],y=e[l],v=t[f],d=e[f],b=Math.cos(2*Math.PI*h/r),m=-1*Math.sin(2*Math.PI*h/r);s<o?(t[l]=p+v,e[l]=y+d,t[f]=b*(p-v)-m*(y-d),e[f]=b*(y-d)+m*(p-v)):(t[l]=p+v,e[l]=y+d,t[f]=p-v,e[f]=y-d)}for(var g=1;g<=o;g++)for(var w=o-g,S=0;S<n(g-1);S++)i[n(g-1)+S]=i[S]+n(w);for(var O=0;O<r;O++)if(!(i[O]<=O)){var A=t[i[O]],k=e[i[O]];t[i[O]]=t[O],e[i[O]]=e[O],t[O]=A,e[O]=k}}},{key:"IFFT",value:function(t,e,r){for(var n=function(t){return Math.pow(2,t)},i=new Float32Array(r),o=Math.log2(r),s=1;s<=o;s++)for(var a=0;a<n(s-1);a++)for(var c=o-s,u=0;u<n(c);u++){var l=a*n(c+1)+u,f=n(c)+l,h=u*n(s-1),p=t[l],y=e[l],v=t[f],d=e[f],b=Math.cos(2*Math.PI*h/r),m=Math.sin(2*Math.PI*h/r);s<o?(t[l]=p+v,e[l]=y+d,t[f]=b*(p-v)-m*(y-d),e[f]=b*(y-d)+m*(p-v)):(t[l]=p+v,e[l]=y+d,t[f]=p-v,e[f]=y-d)}for(var g=1;g<=o;g++)for(var w=o-g,S=0;S<n(g-1);S++)i[n(g-1)+S]=i[S]+n(w);for(var O=0;O<r;O++)if(!(i[O]<=O)){var A=t[i[O]],k=e[i[O]];t[i[O]]=t[O],e[i[O]]=e[O],t[O]=A,e[O]=k}for(var T=0;T<r;T++)t[T]/=r,e[T]/=r}}],r&&Ze(e.prototype,r),n&&Ze(e,n),a}(pt);function er(t){return er="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},er(t)}function rr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function nr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ir(t,e){return ir=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ir(t,e)}function or(t,e){if(e&&("object"===er(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function sr(t){return sr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},sr(t)}function ar(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var cr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ir(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=sr(n);if(i){var r=sr(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return or(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).isLoadError=!1,r.rirs=[],r.convolver=t.createConvolver(),r.dry=t.createGain(),r.wet=t.createGain(),r.tone=t.createBiquadFilter(),r.dry.gain.value=1,r.wet.gain.value=0,r.tone.type="string"==typeof r.tone.type?"lowpass":r.tone.LOWPASS||0,r.tone.frequency.value=350,r.tone.Q.value=Math.SQRT1_2,r.tone.gain.value=0,r.state(!1),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,s=null;switch(n){case"type":if(void 0===e)return this.convolver.buffer;i=parseInt(e,10),o=0,s=this.rirs.length-1,null===e?(this.convolver.buffer=null,this.input.disconnect(0),this.input.connect(this.output)):i>=o&&i<=s&&(this.convolver.buffer=this.rirs[i],this.connect());break;case"dry":case"wet":if(void 0===e)return this[n].gain.value;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this[n].gain.value=i);break;case"tone":if(void 0===e)return this.tone.frequency.value;i=parseFloat(e),o=10,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.tone.frequency.value=i);break;case"rirs":return this.rirs}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.convolver.disconnect(0),this.dry.disconnect(0),this.wet.disconnect(0),this.tone.disconnect(0),this.isActive?(this.input.connect(this.dry),this.dry.connect(this.output),this.input.connect(this.tone),this.tone.connect(this.convolver),this.convolver.connect(this.wet),this.wet.connect(this.output)):this.input.connect(this.output),this}},{key:"start",value:function(t,e){var r=this;return t instanceof AudioBuffer||null===t?(this.convolver.buffer=t,this.rirs.push(t)):t instanceof ArrayBuffer&&("[object Function]"!==Object.prototype.toString.call(e)&&(e=function(){}),this.context.decodeAudioData(t,(function(t){r.convolver.buffer=t,r.rirs.push(t)}),e)),this}},{key:"preset",value:function(t,e,r,n,i){if("[object Object]"===Object.prototype.toString.call(arguments[0])){var o=arguments[0];"rirs"in o&&(t=o.rirs),"timeout"in o&&(e=o.timeout),"success"in o&&(r=o.success),"error"in o&&(n=o.error),"progress"in o&&(i=o.progress)}Array.isArray(t)||(t=[t]),this.rirs=new Array(t.length);for(var s=parseInt(e,10),a=0,c=t.length;a<c;a++)"string"==typeof t[a]?this.load(t[a],a,s,r,n,i):t[a]instanceof AudioBuffer&&(this.rirs[a]=t[a]);return this}},{key:"load",value:function(t,e,r,n,i,o){var a=this,c=new XMLHttpRequest;return c.timeout=r>0?r:6e4,c.ontimeout=function(t){a.isLoadError||"[object Function]"!==Object.prototype.toString.call(i)||i(t,s.ERROR_AJAX_TIMEOUT),a.isLoadError=!0},c.onprogress=function(t){a.isLoadError?c.abort():"[object Function]"===Object.prototype.toString.call(o)&&o(t)},c.onerror=function(t){a.isLoadError||"[object Function]"!==Object.prototype.toString.call(i)||i(t,s.ERROR_AJAX),a.isLoadError=!0},c.onload=function(t){if(200===c.status){var r=c.response;if(!(r instanceof ArrayBuffer))return;a.context.decodeAudioData(r,(function(r){a.rirs[e]=r;var i,o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return rr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(a.rirs);try{for(o.s();!(i=o.n()).done;)if(void 0===i.value)return}catch(t){o.e(t)}finally{o.f()}"[object Function]"===Object.prototype.toString.call(n)&&n(t)}),(function(t){"[object Function]"===Object.prototype.toString.call(i)&&i(t,s.ERROR_DECODE)}))}},c.open("GET",t,!0),c.responseType="arraybuffer",c.send(null),this}},{key:"state",value:function(t){return void 0===t?this.isActive:("toggle"===String(t).toLowerCase()?this.isActive=!this.isActive:this.isActive=Boolean(t),this.connect(),this)}},{key:"params",value:function(){return{state:this.isActive,dry:this.dry.gain.value,wet:this.wet.gain.value,tone:this.tone.frequency.value}}},{key:"toString",value:function(){return"[SoundModule Reverb]"}}],r&&nr(e.prototype,r),s}(pt);function ur(t){return ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ur(t)}function lr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function fr(t,e,r){return fr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=yr(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},fr(t,e,r||t)}function hr(t,e){return hr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},hr(t,e)}function pr(t,e){if(e&&("object"===ur(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function yr(t){return yr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},yr(t)}ar(cr,"ERROR_AJAX","error"),ar(cr,"ERROR_AJAX_TIMEOUT","timeout"),ar(cr,"ERROR_DECODE","decode");var vr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&hr(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=yr(n);if(i){var r=yr(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return pr(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).amplitude=t.createGain(),r.amplitude.gain.value=0,r.depth.gain.value=1,r.rate.value=0,r.state(!1),r.lfo.connect(r.depth),r.depth.connect(r.amplitude.gain),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,s=null;switch(n){case"depth":if(void 0===e)return this.depth.gain.value;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this.depth.gain.value=i);break;case"rate":if(void 0===e)return this.rate.value;i=parseFloat(e),o=0,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.rate.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.amplitude.disconnect(0),this.isActive?(this.input.connect(this.amplitude),this.amplitude.connect(this.output)):this.input.connect(this.output),this}},{key:"stop",value:function(t,e){return fr(yr(s.prototype),"stop",this).call(this,t,e),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.amplitude.gain)),this}},{key:"params",value:function(){return{state:this.isActive,depth:this.depth.gain.value,rate:this.rate.value}}},{key:"toString",value:function(){return"[SoundModule Ringmodulator]"}}],r&&lr(e.prototype,r),s}(pt);function dr(t){return dr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dr(t)}function br(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function mr(t,e){return mr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},mr(t,e)}function gr(t,e){if(e&&("object"===dr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function wr(t){return wr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},wr(t)}var Sr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&mr(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=wr(n);if(i){var r=wr(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return gr(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).splitter=t.createChannelSplitter(2),r.merger=t.createScriptProcessor(e,2,2),r.delayL=t.createDelay(s.MAX_DELAY_TIME),r.delayR=t.createDelay(s.MAX_DELAY_TIME),r.delayL.delayTime.value=0,r.delayR.delayTime.value=0,r.state(!1),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,a=null;switch(n){case"delaytime":case"time":if(void 0===e)return this.delayL.delayTime.value;i=parseFloat(e),o=0,a=s.MAX_DELAY_TIME,i>=o&&i<=a&&(this.delayL.delayTime.value=i,this.delayR.delayTime.value=i)}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.splitter.disconnect(0),this.delayL.disconnect(0),this.delayR.disconnect(0),this.merger.disconnect(0),this.isActive?(this.input.connect(this.splitter),this.splitter.connect(this.delayL,0,0),this.splitter.connect(this.delayR,1,0),this.delayL.connect(this.merger),this.delayR.connect(this.merger),this.merger.connect(this.output)):this.input.connect(this.output),this}},{key:"start",value:function(){var t=this;if(this.isActive&&this.isStop){this.isStop=!1;var e=this.merger.bufferSize;this.merger.onaudioprocess=function(r){var n=r.inputBuffer.getChannelData(0),i=r.inputBuffer.getChannelData(1),o=r.outputBuffer.getChannelData(0),s=r.outputBuffer.getChannelData(1);if(t.isActive&&0!==t.delayL.delayTime.value&&0!==t.delayR.delayTime.value)for(var a=0;a<e;a++)o[a]=n[a],s[a]=-i[a];else o.set(n),s.set(i)}}return this}},{key:"stop",value:function(){return this.isActive&&(this.merger.disconnect(0),this.merger.onaudioprocess=null),this}},{key:"params",value:function(){return{state:this.isActive,time:this.delayL.delayTime.value}}},{key:"toString",value:function(){return"[SoundModule Stereo]"}}],r&&br(e.prototype,r),s}(pt);function Or(t){return Or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Or(t)}function Ar(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function kr(t,e,r){return kr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=jr(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},kr(t,e,r||t)}function Tr(t,e){return Tr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Tr(t,e)}function Er(t,e){if(e&&("object"===Or(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function jr(t){return jr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},jr(t)}!function(t,e,r){e in t?Object.defineProperty(t,e,{value:1,enumerable:!0,configurable:!0,writable:!0}):t[e]=1}(Sr,"MAX_DELAY_TIME");var Rr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Tr(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=jr(n);if(i){var r=jr(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Er(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).amplitude=t.createGain(),r.amplitude.gain.value=1,r.depth.gain.value=0,r.rate.value=0,r.state(!1),r.lfo.connect(r.depth),r.depth.connect(r.amplitude.gain),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,a=null;switch(n){case"depth":if(void 0===e)return this.depth.gain.value;a=1,(i=parseFloat(e))>=(o=0)&&i<=a&&(this.depth.gain.value=i);break;case"rate":if(void 0===e)return this.rate.value;i=parseFloat(e),o=0,a=this.context.sampleRate/2,i>=o&&i<=a&&(this.rate.value=i);break;case"wave":if(void 0===e)return this.lfo.type;(i=String(e).toLowerCase())in s.WAVE_TYPES&&(this.lfo.type="string"==typeof this.lfo.type?i:s.WAVE_TYPES[i])}}return this}},{key:"connect",value:function(){return this.input.disconnect(0),this.amplitude.disconnect(0),this.isActive?(this.input.connect(this.amplitude),this.amplitude.connect(this.output)):this.input.connect(this.output),this}},{key:"stop",value:function(t,e){return kr(jr(s.prototype),"stop",this).call(this,t,e),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.amplitude.gain)),this}},{key:"params",value:function(){return{state:this.isActive,depth:this.depth.gain.value,rate:this.rate.value,wave:this.lfo.type}}},{key:"toString",value:function(){return"[SoundModule Tremolo]"}}],r&&Ar(e.prototype,r),s}(pt);function Pr(t){return Pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pr(t)}function xr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function _r(t,e,r){return _r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Cr(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},_r(t,e,r||t)}function Mr(t,e){return Mr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Mr(t,e)}function Fr(t,e){if(e&&("object"===Pr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Cr(t){return Cr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Cr(t)}!function(t,e,r){e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r}(Rr,"WAVE_TYPES",{sine:0,square:1,sawtooth:2,triangle:3});var Ir=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Mr(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Cr(n);if(i){var r=Cr(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Fr(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).autoWah=!1,r.lowpass=t.createBiquadFilter(),r.envelopeFollower=t.createWaveShaper(),r.sensitivity=t.createBiquadFilter(),r.lowpass.type="string"==typeof r.lowpass.type?"lowpass":r.lowpass.LOWPASS||0,r.lowpass.frequency.value=r.autoWah?20:350,r.lowpass.Q.value=1,r.lowpass.gain.value=0,r.envelopeFollower.curve=new Float32Array([1,0,1]),r.sensitivity.type="string"==typeof r.lowpass.type?"lowpass":r.lowpass.LOWPASS||0,r.sensitivity.frequency.value=350,r.sensitivity.Q.value=1,r.sensitivity.gain.value=0,r.depth.gain.value=0,r.rate.value=0,r.depthRate=0,r.state(!1),r.connect(),r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null,s=null;switch(n){case"auto":if(void 0===e)return this.autoWah;this.autoWah=Boolean(e),this.connect();break;case"frequency":case"cutoff":if(void 0===e)return this.autoWah?this.sensitivity.frequency.value:this.lowpass.frequency.value;i=parseFloat(e),o=10,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.autoWah?(this.sensitivity.frequency.value=i,this.lowpass.frequency.value=20):this.lowpass.frequency.value=i);break;case"depth":if(void 0===e)return this.depthRate;s=1,(i=parseFloat(e))>=(o=0)&&i<=s&&(this.depth.gain.value=this.autoWah?1e4*i:this.lowpass.frequency.value*i,this.depthRate=i);break;case"rate":if(void 0===e)return this.rate.value;i=parseFloat(e),o=0,s=this.context.sampleRate/2,i>=o&&i<=s&&(this.rate.value=i);break;case"resonance":if(void 0===e)return this.autoWah?this.sensitivity.Q.value:this.lowpass.Q.value;s=1e3,(i=parseFloat(e))>=(o=1e-4)&&i<=s&&(this.autoWah?(this.sensitivity.Q.value=i,this.lowpass.Q.value=1):this.lowpass.Q.value=i)}}return this}},{key:"stop",value:function(t,e){return _r(Cr(s.prototype),"stop",this).call(this,t,e),!this.autoWah&&this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.lowpass.frequency)),this}},{key:"connect",value:function(){return this.input.disconnect(0),this.sensitivity.disconnect(0),this.envelopeFollower.disconnect(0),this.lowpass.disconnect(0),this.depth.disconnect(0),this.isActive?this.autoWah?(this.input.connect(this.sensitivity),this.sensitivity.connect(this.output),this.input.connect(this.envelopeFollower),this.envelopeFollower.connect(this.lowpass),this.lowpass.connect(this.depth),this.depth.connect(this.sensitivity.frequency)):(this.input.connect(this.lowpass),this.lowpass.connect(this.output),this.lfo.connect(this.depth),this.depth.connect(this.lowpass.frequency)):this.input.connect(this.output),this}},{key:"params",value:function(){return{state:this.isActive,auto:this.autoWah,cutoff:this.autoWah?this.sensitivity.frequency.value:this.lowpass.frequency.value,depth:this.autoWah?this.depth.gain.value:this.depthRate,rate:this.rate.value,resonance:this.autoWah?this.sensitivity.Q.value:this.lowpass.Q.value}}},{key:"toString",value:function(){return"[SoundModule Wah]"}}],r&&xr(e.prototype,r),s}(pt);function Nr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Lr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Br=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.init(e,r)}var e,r;return e=t,r=[{key:"init",value:function(e,r){Array.isArray(this.modules)&&this.modules.length>0&&(this.mastervolume.disconnect(0),this.mastervolume=null,this.processor.disconnect(0),this.processor=null,this.analyser.INPUT.disconnect(0),this.analyser=null,this.recorder.INPUT.disconnect(0),this.recorder=null,this.session.INPUT.disconnect(0),this.session=null,this.modules.forEach((function(t){t.INPUT.disconnect(0),t.OUTPUT.disconnect(0),t=null})),this.modules=[]),this.context=e,this.sampleRate=e.sampleRate;var n=parseInt(r,10);switch(n){case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:break;default:n=0}this.mastervolume=e.createGain(),this.processor=e.createScriptProcessor(n,t.NUMBER_OF_INPUTS,t.NUMBER_OF_OUTPUTS),this.analyser=new q(e),this.recorder=new K(e,n,t.NUMBER_OF_INPUTS,t.NUMBER_OF_OUTPUTS),this.session=new at(e,n,t.NUMBER_OF_INPUTS,t.NUMBER_OF_OUTPUTS,this.analyser),this.stereo=new Sr(e,n),this.compressor=new Ut(e,n),this.distortion=new oe(e,n),this.wah=new Ir(e,n),this.pitchshifter=new tr(e,n),this.equalizer=new ve(e,n),this.filter=new Se(e,n),this.autopanner=e.createStereoPanner?new wt(e,n):new jt(e,n),this.tremolo=new Rr(e,n),this.ringmodulator=new vr(e,n),this.phaser=new He(e,n),this.flanger=new Re(e,n),this.chorus=new Ct(e,n),this.delay=new Wt(e,n),this.reverb=new cr(e,n),this.panner=new qe(e,n),this.listener=new Ce(e,n),this.envelopegenerator=new ue(e),this.modules=[this.stereo,this.compressor,this.distortion,this.wah,this.pitchshifter,this.equalizer,this.filter,this.autopanner,this.tremolo,this.ringmodulator,this.phaser,this.flanger,this.chorus,this.delay,this.reverb,this.panner]}},{key:"setup",value:function(){return this}},{key:"param",value:function(t,e){var r=null;if("mastervolume"===String(t).replace(/-/g,"").toLowerCase()){if(void 0===e)return this.mastervolume.gain.value;(r=parseFloat(e))>=0&&r<=1&&(this.mastervolume.gain.value=r)}}},{key:"ready",value:function(){return this}},{key:"start",value:function(){return this}},{key:"stop",value:function(){return this}},{key:"get",value:function(){return this}},{key:"resize",value:function(t){return this.init(this.context,t),this}},{key:"getBufferSize",value:function(){return this.processor.bufferSize}},{key:"install",value:function(t,e){return e instanceof pt?(String(t)in this||(this[t]=e,this.modules.every((function(t){return t!==e}))&&this.modules.push(e)),this):this}},{key:"connect",value:function(t,e){Array.isArray(e)&&(this.modules=e),t.disconnect(0),this.modules.length>0?t.connect(this.modules[0].INPUT):t.connect(this.mastervolume);for(var r=0,n=this.modules.length;r<n;r++)this.modules[r].OUTPUT.disconnect(0),r<this.modules.length-1?this.modules[r].OUTPUT.connect(this.modules[r+1].INPUT):this.modules[r].OUTPUT.connect(this.mastervolume);return this.mastervolume.connect(this.context.destination),this.mastervolume.connect(this.analyser.INPUT),this.mastervolume.connect(this.recorder.INPUT),this.recorder.INPUT.connect(this.context.destination),this.mastervolume.connect(this.session.INPUT),this.session.INPUT.connect(this.context.destination),this}},{key:"module",value:function(t){var e=String(t).replace(/-/g,"").toLowerCase();switch(e){case"analyser":case"recorder":case"session":case"stereo":case"compressor":case"distortion":case"wah":case"pitchshifter":case"equalizer":case"filter":case"autopanner":case"tremolo":case"ringmodulator":case"phaser":case"flanger":case"chorus":case"delay":case"reverb":case"panner":case"listener":return this[e];case"envelopegenerator":case"eg":return this.envelopegenerator;case"glide":if(e in this)return this[e];case"vocalcanceler":if(e in this)return this[e];case"noisegate":case"noisesuppressor":if(e in this)return this[e];default:return this[e]}}},{key:"on",value:function(t){var e=parseFloat(t);return(isNaN(e)||e<this.context.currentTime)&&(e=this.context.currentTime),this.stereo.start(e),this.chorus.start(e),this.flanger.start(e),this.phaser.start(e),this.autopanner.start(e),this.tremolo.start(e),this.ringmodulator.start(e),this.wah.start(e),this.filter.start(e),this}},{key:"off",value:function(t){var e=parseFloat(t);return(isNaN(e)||e<this.context.currentTime)&&(e=this.context.currentTime),this.stereo.stop(e),this.chorus.stop(e),this.flanger.stop(e),this.phaser.stop(e),this.autopanner.stop(e),this.tremolo.stop(e),this.ringmodulator.stop(e),this.wah.stop(e),this}},{key:"params",value:function(){var t={};for(var e in this)if("[object Function]"!==Object.prototype.toString.call(this[e])){var r=e.toLowerCase();"mastervolume"===r?t[r]=this[e].gain.value:"[object Object]"===Object.prototype.toString.call(this[e])&&"params"in this[e]&&(t[r]=this[e].params())}return t}},{key:"toJSON",value:function(){return JSON.stringify(this.params())}},{key:"toString",value:function(){return"[SoundModule]"}}],r&&Nr(e.prototype,r),t}();function Dr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ur(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Lr(Br,"NUMBER_OF_INPUTS",2),Lr(Br,"NUMBER_OF_OUTPUTS",2);var qr=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.isActive=r,this.context=e,this.source=e.createOscillator(),this.source.setPeriodicWave=this.source.setPeriodicWave||this.source.setWaveTable,this.source.start=this.source.start||this.source.noteOn,this.source.stop=this.source.stop||this.source.noteOff,this.volume=e.createGain(),this.isStop=!0,this.octave=0,this.fine=0,this.customs={real:new Float32Array([0,1]),imag:new Float32Array([0,1])}}var e,r;return e=t,r=[{key:"param",value:function(e,r){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var n in arguments[0])this.param(n,arguments[0][n]);else{var i=String(e).replace(/-/g,"").toLowerCase(),o=null,s=null,a=null;switch(i){case"type":if(void 0===r)return this.source.type;if("[object Object]"!==Object.prototype.toString.call(r))(o=String(r).toLowerCase())in t.WAVE_TYPES&&(this.source.type="string"==typeof this.source.type?o:t.WAVE_TYPES[o]);else if("real"in r&&"imag"in r){var c=null,u=null;if(r.real instanceof Float32Array?c=r.real:Array.isArray(r.real)&&(c=new Float32Array(r.real)),r.imag instanceof Float32Array?u=r.imag:Array.isArray(r.imag)&&(u=new Float32Array(r.imag)),c instanceof Float32Array&&u instanceof Float32Array){var l=4096;c.length>l&&(c=c.subarray(0,l)),u.length>l&&(u=u.subarray(0,l)),0!==c[0]&&(c[0]=0),0!==u[0]&&(u[0]=0);var f=this.context.createPeriodicWave(c,u);this.source.setPeriodicWave(f),this.customs.real=c,this.customs.imag=u}}break;case"octave":if(void 0===r)return this.octave;o=parseFloat(r),s=-4800/t.OCTAVE,a=4800/t.OCTAVE,o>=s&&o<=a&&(this.octave=o,this.source.detune.value=this.fine+o*t.OCTAVE);break;case"fine":if(void 0===r)return this.fine;o=parseFloat(r),s=-t.OCTAVE,a=t.OCTAVE,o>=s&&o<=a&&(this.fine=o,this.source.detune.value=o+this.octave*t.OCTAVE);break;case"volume":case"gain":if(void 0===r)return this.volume.gain.value;a=1,(o=parseFloat(r))>=(s=0)&&o<=a&&(this.volume.gain.value=o)}}return this}},{key:"ready",value:function(t){if(this.isActive){var e={type:this.source.type,frequency:this.source.frequency.value,detune:this.source.detune.value};if(this.isStop||(this.source.stop(this.context.currentTime),this.source.disconnect(0)),this.source=this.context.createOscillator(),this.source.setPeriodicWave=this.source.setPeriodicWave||this.source.setWaveTable,this.source.start=this.source.start||this.source.noteOn,this.source.stop=this.source.stop||this.source.noteOff,"custom"===e.type){var r=this.customs.real,n=this.customs.imag,i=this.context.createPeriodicWave(r,n);this.source.setPeriodicWave(i)}else this.source.type=e.type;this.source.frequency.value=e.frequency,this.source.detune.value=e.detune,this.volume.connect(t)}return this}},{key:"start",value:function(t){return this.isActive?(this.source.start(t),this.isStop=!1):(this.isStop||(this.source.stop(this.context.currentTime),this.isStop=!0),this.source.disconnect(0)),this}},{key:"stop",value:function(t){return this.isStop||(this.source.stop(t),this.source.disconnect(0),this.isStop=!0),this}},{key:"state",value:function(t){return void 0===t?this.isActive:("toggle"===String(t).toLowerCase()?this.isActive=!this.isActive:this.isActive=Boolean(t),this)}},{key:"get",value:function(){return this.source}},{key:"toString",value:function(){return"[OscillatorModule Oscillator]"}}],r&&Dr(e.prototype,r),t}();function Gr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Vr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Ur(qr,"OCTAVE",1200),Ur(qr,"WAVE_TYPES",{sine:0,square:1,sawtooth:2,triangle:3});var zr=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.frequencies={start:-1,end:0},this.time=0,this.type=t.LINEAR}var e,r;return e=t,r=[{key:"param",value:function(e,r){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var n in arguments[0])this.param(n,arguments[0][n]);else{var i=String(e).replace(/-/g,"").toLowerCase(),o=null;switch(i){case"time":if(void 0===r)return this.time;(o=parseFloat(r))>=0&&(this.time=o);break;case"type":if(void 0===r)return this.type;(o=String(r).toLowerCase())!==t.LINEAR&&o!==t.EXPONENTIAL||(this.type=o)}}return this}},{key:"ready",value:function(t){this.frequencies.end=t;var e=-1===this.frequencies.start?0:this.frequencies.end-this.frequencies.start;return-1!==this.frequencies.start&&0!==this.time&&0!==e||(this.frequencies.start=this.frequencies.end),this}},{key:"start",value:function(t,e){var r=parseFloat(e);(isNaN(r)||r<this.context.currentTime)&&(r=this.context.currentTime);var n=r,i=n+this.time;return t.frequency.cancelScheduledValues(n),t.frequency.setValueAtTime(this.frequencies.start,n),t.frequency["".concat(this.type,"RampToValueAtTime")](this.frequencies.end,i),this}},{key:"stop",value:function(){return this.frequencies.start=this.frequencies.end,this}},{key:"toString",value:function(){return"[OscillatorModule Glide]"}}],r&&Gr(e.prototype,r),t}();function Xr(t){return Xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xr(t)}function Wr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Qr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Hr(t,e,r){return Hr="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=$r(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},Hr(t,e,r||t)}function Yr(t,e){return Yr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Yr(t,e)}function Zr(t,e){if(e&&("object"===Xr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function $r(t){return $r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},$r(t)}Vr(zr,"LINEAR","linear"),Vr(zr,"EXPONENTIAL","exponential");var Jr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Yr(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=$r(n);if(i){var r=$r(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Zr(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).sources=[],r.times={start:0,duration:0},r.isAnalyser=!1,r.glide=new zr(t),r}return e=s,r=[{key:"setup",value:function(t){this.sources.length=0,Array.isArray(t)||(t=[t]);for(var e=0,r=t.length;e<r;e++)this.sources[e]=new qr(this.context,Boolean(t[e])),this.envelopegenerator.setGenerator(e);return this}},{key:"param",value:function(t,e){if("[object Object]"!==Object.prototype.toString.call(arguments[0])){var r=String(t).replace(/-/g,"").toLowerCase(),n=Hr($r(s.prototype),"param",this).call(this,r,e);return void 0===n?this:n}for(var i in arguments[0])this.param(i,arguments[0][i])}},{key:"ready",value:function(t,e){var r=parseFloat(t),n=parseFloat(e);return this.times.start=r>=0?r:0,this.times.duration=n>=0?n:0,this.envelopegenerator.clear(!0),this}},{key:"start",value:function(t,e,r){var n=this,i=this.context.currentTime+this.times.start;Array.isArray(t)||(t=[t]);for(var o=0,s=t.length;o<s;o++){var a=parseFloat(t[o]);t[o]=a>=0?a:0}this.envelopegenerator.clear(!0),this.processor.disconnect(0),this.processor.onaudioprocess=null,this.connect(this.processor,e);for(var c=0,u=t.length;c<u&&!(c>=this.sources.length);c++){var l=this.sources[c],f=t[c];l.ready(this.processor),this.envelopegenerator.ready(c,l.source,l.volume),this.glide.ready(f).start(l.source,i),l.start(i)}return this.envelopegenerator.start(i),this.on(i),this.isAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.isAnalyser=!0),"[object Function]"===Object.prototype.toString.call(r)?this.processor.onaudioprocess=r:this.processor.onaudioprocess=function(t){var e=t.inputBuffer.getChannelData(0),r=t.inputBuffer.getChannelData(1),i=t.outputBuffer.getChannelData(0),o=t.outputBuffer.getChannelData(1);if(n.envelopegenerator.isStop()){var s,a=n.context.currentTime,c=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Wr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Wr(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(n.sources);try{for(c.s();!(s=c.n()).done;)s.value.stop(a)}catch(t){c.e(t)}finally{c.f()}n.off(a),n.analyser.stop("time"),n.analyser.stop("fft"),n.isAnalyser=!1,n.processor.disconnect(0),n.processor.onaudioprocess=null}else i.set(e),o.set(r)},this}},{key:"stop",value:function(){var t=this.context.currentTime+this.times.start+this.times.duration;return this.envelopegenerator.stop(t),this.glide.stop(),this.filter.stop(t),this}},{key:"get",value:function(t){var e=parseInt(t,10);return e>=0&&e<this.sources.length?this.sources[e]:this.sources}},{key:"length",value:function(){return this.sources.length}},{key:"params",value:function(){var t=Hr($r(s.prototype),"params",this).call(this);t.oscillator={glide:{type:this.glide.param("type"),time:this.glide.param("time")}};for(var e=0,r=this.sources.length;e<r;e++){var n=this.sources[e];t.oscillator["oscillator".concat(e)]={state:n.state(),gain:n.param("gain"),type:n.param("type"),octave:n.param("octave"),fine:n.param("fine")}}return t}},{key:"toString",value:function(){return"[OscillatorModule]"}}],r&&Qr(e.prototype,r),s}(Br);function Kr(t){return Kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kr(t)}function tn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function en(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function rn(t,e,r){return rn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=sn(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},rn(t,e,r||t)}function nn(t,e){return nn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},nn(t,e)}function on(t,e){if(e&&("object"===Kr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function sn(t){return sn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},sn(t)}function an(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var cn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&nn(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=sn(n);if(i){var r=sn(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return on(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).sources=[],r.resources=[],r.buffers=[],r.volumes=[],r.isStops=[],r.settings=[],r.times={start:0,duration:0},r.transpose=1,r.isStop=!0,r.isLoadError=!1,r.isAnalyser=!1,r}return e=s,r=[{key:"setup",value:function(t,e,r,n,i,o){if("[object Object]"===Object.prototype.toString.call(arguments[0])){var s=arguments[0];"resources"in s&&(t=s.resources),"settings"in s&&(e=s.settings),"timeout"in s&&(r=s.timeout),"success"in s&&(n=s.success),"error"in s&&(i=s.error),"progress"in s&&(o=s.progress)}Array.isArray(t)||(t=[t]),this.resources=t,Array.isArray(e)||(e=[e]),this.buffers.length=t.length;for(var a=0,c=e.length;a<c;a++){if(!("buffer"in e[a]))return this;var u=parseInt(e[a].buffer,10);if(!(u>=0&&u<this.buffers.length))return this;e[a].buffer=u,e[a].rate="rate"in e[a]&&e[a].rate>=0?parseFloat(e[a].rate):1,e[a].loop="loop"in e[a]&&Boolean(e[a].loop),e[a].start="start"in e[a]&&e[a].start>=0?parseFloat(e[a].start):0,e[a].end="end"in e[a]&&e[a].end>=0?parseFloat(e[a].end):0,e[a].volume="volume"in e[a]&&e[a].volume>=0&&e[a].volume<=1?parseFloat(e[a].volume):1,this.isStops[a]=!0,this.volumes[a]=this.context.createGain(),this.envelopegenerator.setGenerator(a)}this.settings=e;for(var l=parseInt(r,10),f=0,h=this.resources.length;f<h;f++)"string"==typeof this.resources[f]?this.load(this.resources[f],f,l,n,i,o):this.resources[f]instanceof AudioBuffer&&(this.buffers[f]=this.resources[f]);return this}},{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=rn(sn(s.prototype),"param",this).call(this,n,e);if(void 0!==i)return i;var o=null;if("transpose"===n){if(void 0===e)return this.transpose;(o=parseFloat(e))>0&&(this.transpose=o)}}return this}},{key:"ready",value:function(t,e){var r=parseFloat(t),n=parseFloat(e);return this.times.start=r>=0?r:0,this.times.duration=n>=0?n:0,this.envelopegenerator.clear(!1),this}},{key:"start",value:function(t,e,r){var n=this,i=parseInt(t,10);if(isNaN(i)||i<0||i>=this.settings.length)return this;var o=this.settings[i].buffer,s=this.settings[i].rate,a=this.settings[i].loop,c=this.settings[i].start,u=this.settings[i].end,l=this.settings[i].volume;if(!(this.buffers[o]instanceof AudioBuffer))return this;var f=this.context.createBufferSource();f.start=f.start||f.noteGrainOn,f.stop=f.stop||f.noteOff,f.buffer=this.buffers[o],f.playbackRate.value=s*this.transpose,f.loop=a,f.loopStart=c,f.loopEnd=u,this.volumes[i].gain.value=l,this.envelopegenerator.clear(!1),this.envelopegenerator.ready(i,f,this.volumes[i]),this.volumes[i].connect(this.processor),this.connect(this.processor,e);var h=this.context.currentTime+this.times.start;return f.loop?f.start(h,h+f.loopStart,f.loopEnd-h):f.start(h),this.sources[i]=f,this.envelopegenerator.start(h),this.on(h),this.isAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.isAnalyser=!0),this.isStops[i]=!1,this.times.stop>0&&window.setTimeout((function(){n.stop(i)}),1e3*this.times.stop),f.onended=function(){n.isStops[i]=!0},"[object Function]"===Object.prototype.toString.call(r)?this.processor.onaudioprocess=r:this.processor.onaudioprocess=function(t){if(n.isStop=n.isStops.every((function(t){return t})),n.isStop)n.off(n.context.currentTime),n.envelopegenerator.clear(!1),n.analyser.stop("time"),n.analyser.stop("fft"),n.isAnalyser=!1,n.processor.disconnect(0),n.processor.onaudioprocess=null;else{var e=t.inputBuffer.getChannelData(0),r=t.inputBuffer.getChannelData(1),i=t.outputBuffer.getChannelData(0),o=t.outputBuffer.getChannelData(1);i.set(e),o.set(r)}},this}},{key:"stop",value:function(t){var e=parseInt(t,10);if(isNaN(e)||e<0||e>=this.settings.length)return this;var r=this.settings[e].buffer;if(!(this.buffers[r]instanceof AudioBuffer&&this.sources[e]instanceof AudioBufferSourceNode))return this;var n=this.context.currentTime+this.times.start+this.times.duration;return this.envelopegenerator.stop(n),this.filter.stop(n),this}},{key:"get",value:function(t){var e=parseInt(t,10);return e>=0&&e<this.buffers.length?this.buffers[e]:this.buffers}},{key:"params",value:function(){var t=rn(sn(s.prototype),"params",this).call(this);return t.oneshot={transpose:this.transpose},t}},{key:"load",value:function(t,e,r,n,i,o){var a=this,c=new XMLHttpRequest;return c.timeout=r>0?r:6e4,c.ontimeout=function(t){a.isLoadError||"[object Function]"!==Object.prototype.toString.call(i)||i(t,s.ERROR_AJAX_TIMEOUT),a.isLoadError=!0},c.onprogress=function(t){a.isLoadError?c.abort():"[object Function]"===Object.prototype.toString.call(o)&&o(t)},c.onerror=function(t){a.isLoadError||"[object Function]"!==Object.prototype.toString.call(i)||i(t,s.ERROR_AJAX),a.isLoadError=!0},c.onload=function(t){if(200===c.status){var r=c.response;if(!(r instanceof ArrayBuffer))return;a.context.decodeAudioData(r,(function(r){a.buffers[e]=r;var i,o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return tn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(a.buffers);try{for(o.s();!(i=o.n()).done;)if(void 0===i.value)return}catch(t){o.e(t)}finally{o.f()}"[object Function]"===Object.prototype.toString.call(n)&&n(t,a.buffers)}),(function(t){"[object Function]"===Object.prototype.toString.call(i)&&i(t,s.ERROR_DECODE)}))}},c.open("GET",t,!0),c.responseType="arraybuffer",c.send(null),this}},{key:"reset",value:function(t,e,r){var n=parseInt(t,10);return String(e).toLowerCase()in this.settings[n]&&(this.settings[n][e.toLowerCase()]=r),this}},{key:"toString",value:function(){return"[OneshotModule]"}}],r&&en(e.prototype,r),s}(Br);function un(t){return un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},un(t)}function ln(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function fn(t,e,r){return fn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=yn(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},fn(t,e,r||t)}function hn(t,e){return hn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},hn(t,e)}function pn(t,e){if(e&&("object"===un(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function yn(t){return yn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},yn(t)}function vn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}an(cn,"ERROR_AJAX","error"),an(cn,"ERROR_AJAX_TIMEOUT","timeout"),an(cn,"ERROR_DECODE","decode");var dn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&hn(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=yn(n);if(i){var r=yn(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return pn(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).type=s.WHITE_NOISE,r.envelopegenerator.setGenerator(0),r.isAnalyser=!1,r}return e=s,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=fn(yn(s.prototype),"param",this).call(this,n,e);if(void 0!==i)return i;var o="";if("type"===n){if(void 0===e)return this.type;(o=String(e).toLowerCase())!==s.WHITE_NOISE&&o!==s.PINK_NOISE&&o!==s.BROWNIAN_NOISE||(this.type=o)}}return this}},{key:"start",value:function(t){var e=this,r=this.context.currentTime;this.envelopegenerator.clear(!0),this.processor.disconnect(0),this.processor.onaudioprocess=null,this.connect(this.envelopegenerator.getGenerator(0),t),this.envelopegenerator.ready(0,this.processor),this.envelopegenerator.start(r),this.isAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.isAnalyser=!0),this.on(r);var n=this.processor.bufferSize,i=0;return this.processor.onaudioprocess=function(t){var r=t.outputBuffer.getChannelData(0),o=t.outputBuffer.getChannelData(1);if(e.envelopegenerator.isStop())e.processor.disconnect(0),e.processor.onaudioprocess=null,e.analyser.stop("time"),e.analyser.stop("fft"),e.isAnalyser=!1;else switch(e.type){case s.WHITE_NOISE:for(var a=0;a<n;a++)r[a]=2*(Math.random()-.5),o[a]=2*(Math.random()-.5);break;case s.PINK_NOISE:for(var c=0,u=0,l=0,f=0,h=0,p=0,y=0,v=0;v<n;v++){var d=2*Math.random()-1;c=.99886*c+.0555179*d,u=.99332*u+.0750759*d,l=.969*l+.153852*d,f=.8665*f+.3104856*d,h=.55*h+.5329522*d,p=-.7616*p-.016898*d,r[v]=c+u+l+f+h+p+y+.5362*d,o[v]=c+u+l+f+h+p+y+.5362*d,r[v]*=.11,o[v]*=.11,y=.115926*d}break;case s.BROWNIAN_NOISE:for(var b=0;b<n;b++){var m=2*Math.random()-1;r[b]=(i+.02*m)/1.02,o[b]=(i+.02*m)/1.02,i=(i+.02*m)/1.02,r[b]*=3.5,o[b]*=3.5}}},this}},{key:"stop",value:function(){var t=this.context.currentTime;return this.envelopegenerator.stop(t),this.off(t),this}},{key:"toString",value:function(){return"[NoiseModule]"}}],r&&ln(e.prototype,r),s}(Br);function bn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}vn(dn,"WHITE_NOISE","whitenoise"),vn(dn,"PINK_NOISE","pinknoise"),vn(dn,"BROWNIAN_NOISE","browniannoise");var mn=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.depth=0}var e,r;return e=t,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null;if("depth"===n){if(void 0===e)return this.depth;o=1,(i=parseFloat(e))>=0&&i<=o&&(this.depth=i)}}return this}},{key:"start",value:function(t,e){return t-this.depth*e}},{key:"toString",value:function(){return"[AudioModule VocalCanceler]"}}],r&&bn(e.prototype,r),t}();function gn(t){return gn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gn(t)}function wn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Sn(t,e,r){return Sn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=kn(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},Sn(t,e,r||t)}function On(t,e){return On=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},On(t,e)}function An(t,e){if(e&&("object"===gn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function kn(t){return kn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},kn(t)}var Tn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&On(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=kn(n);if(i){var r=kn(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return An(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).source=t.createBufferSource(),r.buffer=null,r.currentTime=0,r.paused=!0,r.callbacks={decode:function(){},ready:function(){},start:function(){},stop:function(){},update:function(){},ended:function(){},error:function(){}},r.vocalcanceler=new mn,r}return e=s,r=[{key:"setup",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.setup(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase();n in this.callbacks&&"[object Function]"===Object.prototype.toString.call(e)&&(this.callbacks[n]=e)}return this.envelopegenerator.setGenerator(0),this.envelopegenerator.param({attack:0,decay:.01,sustain:1,release:.01}),this}},{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=Sn(kn(s.prototype),"param",this).call(this,n,e);if(void 0!==i)return i;var o=0,a=0;switch(n){case"playbackrate":if(void 0===e)return this.source.playbackRate.value;if(a=1024,(o=parseFloat(e))>=0&&o<=a){this.source.playbackRate.value=o;var c=this.context.currentTime,u=this.param("currentTime"),l=this.param("duration");this.envelopegenerator.start(c),this.envelopegenerator.stop(c+(l-u)/o,!0)}break;case"loop":case"looping":if(void 0===e)return this.source.loop;this.source.loop=Boolean(e);break;case"currenttime":if(void 0===e)return this.currentTime;this.buffer instanceof AudioBuffer?(o=parseFloat(e),a=this.buffer.duration,o>=0&&o<=a&&(this.paused?this.currentTime=o:(this.stop(),this.start(o)))):this.currentTime=0;break;case"duration":return this.buffer instanceof AudioBuffer?this.buffer.duration:0;case"samplerate":return this.buffer instanceof AudioBuffer?this.buffer.sampleRate:this.sampleRate;case"channels":return this.buffer instanceof AudioBuffer?this.buffer.numberOfChannels:0}}return this}},{key:"ready",value:function(t){var e=this;return t instanceof ArrayBuffer?(this.buffer=null,this.context.decodeAudioData(t,(function(t){e.buffer=t,e.analyser.start("timeoverview",0,e.buffer),e.analyser.start("timeoverview",1,e.buffer),e.callbacks.ready(e.buffer)}),this.callbacks.error),this.callbacks.decode(t)):t instanceof AudioBuffer&&(this.buffer=t),this}},{key:"start",value:function(t,e,r,n){var i=this;if(this.buffer instanceof AudioBuffer&&this.paused){var o=this.context.currentTime,s=parseFloat(t),a=parseFloat(e);this.currentTime=a>=0?s>=0&&s<=a?s:0:s>=0&&s<=this.buffer.duration?s:0;var c=this.source.playbackRate.value,u=this.source.loop;this.source=this.context.createBufferSource(),this.source.start=this.source.start||this.source.noteGrainOn,this.source.stop=this.source.stop||this.source.noteOff,this.source.buffer=this.buffer,this.source.playbackRate.value=c,this.source.loop=u,this.source.loopStart=this.currentTime,this.source.loopEnd=a>=0?a:this.buffer.duration,this.envelopegenerator.ready(0,this.source,this.processor),this.connect(this.processor,r),isNaN(s)?this.source.start(o):a>=0?this.source.start(o,this.currentTime,a-s):this.source.start(o,this.currentTime,this.buffer.duration-this.currentTime),this.analyser.start("time"),this.analyser.start("fft"),this.paused=!1,this.envelopegenerator.start(o),a>=0?this.envelopegenerator.stop(o+(a-s)/this.source.playbackRate.value,!0):this.envelopegenerator.stop(o+(this.buffer.duration-s)/this.source.playbackRate.value,!0),this.on(o),this.callbacks.start(this.source,this.currentTime);var l=this.processor.bufferSize;"[object Function]"===Object.prototype.toString.call(n)?this.processor.onaudioprocess=n:this.processor.onaudioprocess=function(t){var e=t.inputBuffer.getChannelData(0),o=t.inputBuffer.getChannelData(1),s=t.outputBuffer.getChannelData(0),a=t.outputBuffer.getChannelData(1);if(i.currentTime<Math.floor(i.source.loopEnd)){for(var c=0;c<l;c++)s[c]=i.vocalcanceler.start(e[c],o[c]),a[c]=i.vocalcanceler.start(o[c],e[c]),i.currentTime+=1*i.source.playbackRate.value/i.source.buffer.sampleRate,i.callbacks.update(i.source,i.currentTime);i.analyser.domain("timeoverview",0).update(i.currentTime),i.analyser.domain("timeoverview",1).update(i.currentTime)}else i.source.loop?(i.stop(),"sprite"===i.analyser.domain("timeoverview",0).param("mode")||"sprite"===i.analyser.domain("timeoverview",1).param("mode")?i.start(i.source.loopStart,i.source.loopEnd,r,n):i.start(0,i.buffer.duration,r,n)):i.end()}}return this}},{key:"stop",value:function(){if(this.buffer instanceof AudioBuffer&&!this.paused){var t=this.context.currentTime;this.source.stop(t),this.off(t),this.analyser.stop("time"),this.analyser.stop("fft"),this.processor.disconnect(0),this.processor.onaudioprocess=null,this.paused=!0,this.callbacks.stop(this.source,this.currentTime)}return this}},{key:"get",value:function(){return this.source}},{key:"toggle",value:function(t,e,r,n){return this.paused?this.start(t,e,r,n):this.stop(),this}},{key:"end",value:function(){return this.stop(),this.currentTime=0,this.callbacks.ended(this.source,this.currentTime),this}},{key:"isBuffer",value:function(){return this.buffer instanceof AudioBuffer}},{key:"isSource",value:function(){return this.source instanceof AudioBufferSourceNode&&this.source.buffer instanceof AudioBuffer}},{key:"isPaused",value:function(){return this.paused}},{key:"fadeIn",value:function(t){if(void 0===t)return this.envelopegenerator.param("attack");this.envelopegenerator.param("attack",t);var e=this.context.currentTime,r=this.param("currentTime"),n=this.param("duration"),i=this.param("playbackRate");return this.envelopegenerator.start(e),this.envelopegenerator.stop(e+(n-r)/i,!0),this}},{key:"fadeOut",value:function(t){if(void 0===t)return this.envelopegenerator.param("release");this.envelopegenerator.param("release",t);var e=this.context.currentTime,r=this.param("currentTime"),n=this.param("duration"),i=this.param("playbackRate");return this.envelopegenerator.start(e),this.envelopegenerator.stop(e+(n-r)/i,!0),this}},{key:"slice",value:function(t,e){if(!this.isBuffer())return null;var r=this.buffer,n=r.sampleRate,i=r.length,o=r.numberOfChannels,s=Math.floor(t*n),a=Math.floor(e*n);(isNaN(s)||s<0)&&(s=0),(isNaN(a)||a>i)&&(a=i);var c=null,u=null;o>0&&(c=this.buffer.getChannelData(0)),o>1&&(u=this.buffer.getChannelData(1));var l=null,f=null,h=null,p=a-s;switch(o){case 1:l=new Float32Array(p);for(var y=s;y<a;y++)l[y-s]=c[y];return(h=this.context.createBuffer(1,p,n)).copyToChannel(l,0),h;case 2:l=new Float32Array(p),f=new Float32Array(p);for(var v=s;v<a;v++)l[v-s]=c[v],f[v-s]=u[v];return(h=this.context.createBuffer(2,p,n)).copyToChannel(l,0),h.copyToChannel(f,1),h;default:return null}}},{key:"sprite",value:function(t){var e=this;return this.isBuffer()?"[object Object]"!==Object.prototype.toString.call(t)?null:Object.keys(t).reduce((function(r,n){var i=t[n];return Array.isArray(i)&&2===i.length?(r[n]=e.slice(parseFloat(i[0]),parseFloat(i[1])),r):r}),{}):null}},{key:"params",value:function(){var t=Sn(kn(s.prototype),"params",this).call(this);return t.audio={playbackrate:this.isSource()?this.source.playbackRate.value:1,vocalcanceler:{depth:this.vocalcanceler.param("depth")}},t}},{key:"toString",value:function(){return"[AudioModule]"}}],r&&wn(e.prototype,r),s}(Br);function En(t){return En="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(t)}function jn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Rn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function Rn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Pn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function xn(t,e,r){return xn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Fn(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},xn(t,e,r||t)}function _n(t,e){return _n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},_n(t,e)}function Mn(t,e){if(e&&("object"===En(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Fn(t){return Fn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Fn(t)}function Cn(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var In=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_n(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Fn(n);if(i){var r=Fn(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Mn(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).source=null,r.media=null,r.ext="",r.mse=null,r.sb=null,r.file="",r.mimeType="",r.playbackRate=1,r.controls=!1,r.loop=!1,r.muted=!1,r.autoplay=!1,r.listeners={},r}return e=s,r=[{key:"setup",value:function(t,e,r,n){var i=this;if(this.envelopegenerator.setGenerator(0),this.envelopegenerator.param({attack:0,decay:.01,sustain:1,release:.01}),"[object Object]"===Object.prototype.toString.call(arguments[0])){var o=arguments[0];"media"in o&&(t=o.media),"formats"in o&&(e=o.formats),"listeners"in o&&(r=o.listeners),"autoplay"in o&&(n=o.autoplay)}var a="";if(t instanceof HTMLAudioElement)a=s.AUDIO;else{if(!(t instanceof HTMLVideoElement))return this;a=s.VIDEO}this.media=t,Array.isArray(e)||(e=[e]);var c,u=jn(e);try{for(u.s();!(c=u.n()).done;){var l=c.value,f="".concat(a,"/").concat(String(l).toLowerCase());if(/^(?:maybe|probably)/.test(this.media.canPlayType(f))){this.ext=l;break}}}catch(t){u.e(t)}finally{u.f()}if("[object Object]"===Object.prototype.toString.call(r))for(var h in r)this.listeners[h.toLowerCase()]="[object Function]"===Object.prototype.toString.call(r[h])?r[h]:function(){};for(var p in this.autoplay=Boolean(n),!this.autoplay||this.source instanceof MediaElementAudioSourceNode||(this.source=this.context.createMediaElementSource(this.media)),this.autoplay&&this.media.src&&this.context.resume().then((function(){i.start(i.media.currentTime)})).catch((function(){throw new Error("Autoplay is failed")})),this.media.addEventListener("loadstart",(function(t){i.source instanceof MediaElementAudioSourceNode||(i.source=i.context.createMediaElementSource(i.media)),"loadstart"in i.listeners&&i.listeners.loadstart(t)}),!1),this.media.addEventListener("ended",(function(t){i.media.pause(),i.off(i.context.currentTime),i.analyser.stop("time"),i.analyser.stop("fft"),i.processor.disconnect(0),i.processor.onaudioprocess=null,"ended"in i.listeners&&i.listeners.ended(t)}),!1),this.listeners)this.media.addEventListener(p,(function(t){i.listeners[t.type.toLowerCase()](t)}),!1);return this}},{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n,i=String(t).replace(/-/g,"").toLowerCase();if("mastervolume"===i&&(n=xn(Fn(s.prototype),"param",this).call(this,i,e)),void 0!==n)return n;var o=null,a=null,c=null;switch(i){case"playbackrate":if(void 0===e)return this.media instanceof HTMLMediaElement?this.media.playbackRate:this.playbackRate;if((o=parseFloat(e))>=(a=.5)){this.media instanceof HTMLMediaElement&&(this.media.playbackRate=o),this.playbackRate=o;var u=this.context.currentTime,l=this.param("currentTime"),f=this.param("duration");this.envelopegenerator.start(u),isFinite(f)&&this.envelopegenerator.stop(u+(f-l)/o,!0)}break;case"currenttime":if(void 0===e)return this.media instanceof HTMLMediaElement?this.media.currentTime:0;if(this.media instanceof HTMLMediaElement&&(o=parseFloat(e),a=0,c=this.media.duration,o>=a&&o<=c)){this.media.currentTime=o;var h=this.context.currentTime,p=this.param("duration"),y=this.param("playbackRate");this.envelopegenerator.start(h),isFinite(p)&&this.envelopegenerator.stop(h+(p-o)/y,!0)}break;case"loop":case"muted":case"controls":if(void 0===e)return this.media instanceof HTMLMediaElement?this.media[i]:this[i];this.media instanceof HTMLMediaElement&&(this.media[i]=Boolean(e)),this[i]=Boolean(e);break;case"width":case"height":if(void 0===e)return this.media instanceof HTMLVideoElement?this.media[i]:0;(o=parseInt(e,10))>=(a=0)&&this.media instanceof HTMLVideoElement&&(this.media[i]=o);break;case"duration":return this.media&&this.media.duration?this.media.duration:0;case"channels":return this.source instanceof MediaElementAudioSourceNode?this.source.channelCount:0}}return this}},{key:"ready",value:function(t,e){var r=String(t);this.mse&&"open"===this.mse.readyState&&(this.mse.endOfStream(),window.URL.revokeObjectURL(this.media.src),this.mse.removeEventListener("sourceopen",this.onSourceOpen,!1),this.mse.removeEventListener("sourceended",this.onSourceEnded,!1),this.mse.removeEventListener("sourceclose",this.onSourceClose,!1),this.sb.removeEventListener("updateend",this.onSourceBufferUpdateEnd,!1),this.sb.removeEventListener("error",this.onSourceBufferError,!1));try{if(e){if(!MediaSource||!MediaSource.isTypeSupported(e))throw new Error("This Browser does not support `MediaSource` or MIME type");this.media.removeAttribute("src"),this.media.load(),this.mse=new MediaSource,this.media.src=window.URL.createObjectURL(this.mse),this.mimeType=e,this.file=r,this.onSourceOpen=this.onSourceOpen.bind(this),this.onSourceEnded=this.onSourceEnded.bind(this),this.onSourceClose=this.onSourceClose.bind(this),this.mse.addEventListener("sourceopen",this.onSourceOpen,!1),this.mse.addEventListener("sourceended",this.onSourceEnded,!1),this.mse.addEventListener("sourceclose",this.onSourceClose,!1)}else-1!==r.indexOf("data:")||-1!==r.indexOf("blob:")||""===this.ext?this.media.src=r:this.media.src="".concat(r,".").concat(this.ext)}catch(t){throw new Error(t.message)}return this}},{key:"start",value:function(t,e,r){var n=this;return this.source instanceof MediaElementAudioSourceNode&&(this.envelopegenerator.ready(0,this.source,this.processor),this.connect(this.processor,e),this.media.play().then((function(){var e=n.context.currentTime,i=parseFloat(t);n.media.currentTime=i>=0&&i<=n.media.duration?i:0,n.media.playbackRate=n.playbackRate,n.media.controls=n.controls,n.media.loop=n.loop,n.media.muted=n.muted,n.envelopegenerator.start(e),isFinite(n.media.duration)&&n.envelopegenerator.stop(e+(n.media.duration-i)/n.media.playbackRate,!0),n.on(e),n.analyser.start("time"),n.analyser.start("fft");var o=n.processor.bufferSize;"[object Function]"===Object.prototype.toString.call(r)?n.processor.onaudioprocess=r:n.processor.onaudioprocess=function(t){for(var e=t.inputBuffer.getChannelData(0),r=t.inputBuffer.getChannelData(1),i=t.outputBuffer.getChannelData(0),s=t.outputBuffer.getChannelData(1),a=0;a<o;a++)i[a]=n.vocalcanceler.start(e[a],r[a]),s[a]=n.vocalcanceler.start(r[a],e[a])}})).catch((function(){n.stop((function(){n.autoplay&&(n.media.muted=n.muted=!0,n.media.volume=0),n.start(t,e,r)}),(function(){}))}))),this}},{key:"stop",value:function(t,e){var r=this;return this.source instanceof MediaElementAudioSourceNode&&this.media.play().then((function(){return r.media.pause(),r.off(r.context.currentTime),r.analyser.stop("time"),r.analyser.stop("fft"),r.processor.disconnect(0),r.processor.onaudioprocess=null,"[object Function]"===Object.prototype.toString.call(t)&&t(),Promise.resolve()})).catch((function(t){return"[object Function]"===Object.prototype.toString.call(e)&&e(t),Promise.reject(t)})),this}},{key:"get",value:function(){return this.source}},{key:"toggle",value:function(t,e,r){return this.media.paused?this.start(t,e,r):this.stop(),this}},{key:"isMedia",value:function(){return this.media instanceof HTMLMediaElement}},{key:"isSource",value:function(){return this.source instanceof MediaElementAudioSourceNode}},{key:"isPaused",value:function(){return!(this.media instanceof HTMLMediaElement)||this.media.paused}},{key:"onSourceOpen",value:function(t){var e=this;this.sb=this.mse.addSourceBuffer(this.mimeType),this.sb.mode="sequence",this.onSourceBufferUpdateEnd=this.onSourceBufferUpdateEnd.bind(this),this.onSourceBufferError=this.onSourceBufferError.bind(this),this.sb.addEventListener("updateend",this.onSourceBufferUpdateEnd,!1),this.sb.addEventListener("error",this.onSourceBufferError,!1),"sourceopen"in this.listeners&&this.listeners.sourceopen(t);var r=new Request(this.file);fetch(r).then((function(t){return t.arrayBuffer()})).then((function(t){e.sb.appendBuffer(t)})).catch((function(r){"error"in e.listeners&&e.listeners.error(t,r)}))}},{key:"onSourceEnded",value:function(t){"sourceended"in this.listeners&&this.listeners.sourceended(t)}},{key:"onSourceClose",value:function(t){"sourceclose"in this.listeners&&this.listeners.sourceclose(t)}},{key:"onSourceBufferUpdateEnd",value:function(t){"updateend"in this.listeners&&this.listeners.updateend(t)}},{key:"onSourceBufferError",value:function(t){"error"in this.listeners&&this.listeners.error(t)}},{key:"params",value:function(){var t=xn(Fn(s.prototype),"params",this).call(this);return t.media={playbackrate:this.playbackRate,vocalcanceler:{depth:this.vocalcanceler.param("depth")}},delete t.audio,t}},{key:"requestPictureInPicture",value:function(){return this.media instanceof HTMLVideoElement&&"pictureInPictureEnabled"in document&&document.pictureInPictureEnabled?this.media.disablePictureInPicture||0===this.media.readyState||this.media===document.pictureInPictureElement?Promise.reject():this.media.requestPictureInPicture():Promise.reject()}},{key:"exitPictureInPicture",value:function(){return this.media instanceof HTMLVideoElement&&"pictureInPictureEnabled"in document&&document.pictureInPictureEnabled?this.media.disablePictureInPicture||0===this.media.readyState||this.media!==document.pictureInPictureElement?Promise.reject():document.exitPictureInPicture():Promise.reject()}},{key:"toString",value:function(){return"[MediaModule]"}}],r&&Pn(e.prototype,r),s}(Tn);function Nn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}Cn(In,"AUDIO","audio"),Cn(In,"VIDEO","video");var Ln=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.level=0}var e,r;return e=t,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null;if("level"===n){if(void 0===e)return this.level;o=1,(i=parseFloat(e))>=0&&i<=o&&(this.level=i)}}return this}},{key:"start",value:function(t){return Math.abs(parseFloat(t))>this.level?t:0}},{key:"toString",value:function(){return"[StreamModule NoiseGate]"}}],r&&Nn(e.prototype,r),t}();function Bn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Dn=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.threshold=0}var e,r,n;return e=t,r=[{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=null,o=null;if("threshold"===n){if(void 0===e)return this.threshold;o=1,(i=parseFloat(e))>=0&&i<=o&&(this.threshold=i)}}return this}},{key:"start",value:function(e,r,n){if(this.threshold>0){var i=new Float32Array(e),o=new Float32Array(n),s=new Float32Array(n),a=new Float32Array(n),c=new Float32Array(n),u=new Float32Array(n);t.FFT(i,o,n);for(var l=0;l<n;l++)c[l]=Math.sqrt(Math.pow(i[l],2)+Math.pow(o[l],2)),0!==i[l]&&0!==o[l]&&(u[l]=Math.atan2(o[l],i[l])),c[l]-=this.threshold,c[l]<0&&(c[l]=0),s[l]=c[l]*Math.cos(u[l]),a[l]=c[l]*Math.sin(u[l]);t.IFFT(s,a,n),r.set(s)}else r.set(e);return this}},{key:"toString",value:function(){return"[StreamModule NoiseSuppressor]"}}],n=[{key:"FFT",value:function(t,e,r){for(var n=function(t){return Math.pow(2,t)},i=new Float32Array(r),o=Math.log2(r),s=1;s<=o;s++)for(var a=0;a<n(s-1);a++)for(var c=o-s,u=0;u<n(c);u++){var l=a*n(c+1)+u,f=n(c)+l,h=u*n(s-1),p=t[l],y=e[l],v=t[f],d=e[f],b=Math.cos(2*Math.PI*h/r),m=-1*Math.sin(2*Math.PI*h/r);s<o?(t[l]=p+v,e[l]=y+d,t[f]=b*(p-v)-m*(y-d),e[f]=b*(y-d)+m*(p-v)):(t[l]=p+v,e[l]=y+d,t[f]=p-v,e[f]=y-d)}for(var g=1;g<=o;g++)for(var w=o-g,S=0;S<n(g-1);S++)i[n(g-1)+S]=i[S]+n(w);for(var O=0;O<r;O++)if(!(i[O]<=O)){var A=t[i[O]],k=e[i[O]];t[i[O]]=t[O],e[i[O]]=e[O],t[O]=A,e[O]=k}}},{key:"IFFT",value:function(t,e,r){for(var n=function(t){return Math.pow(2,t)},i=new Float32Array(r),o=Math.log2(r),s=1;s<=o;s++)for(var a=0;a<n(s-1);a++)for(var c=o-s,u=0;u<n(c);u++){var l=a*n(c+1)+u,f=n(c)+l,h=u*n(s-1),p=t[l],y=e[l],v=t[f],d=e[f],b=Math.cos(2*Math.PI*h/r),m=Math.sin(2*Math.PI*h/r);s<o?(t[l]=p+v,e[l]=y+d,t[f]=b*(p-v)-m*(y-d),e[f]=b*(y-d)+m*(p-v)):(t[l]=p+v,e[l]=y+d,t[f]=p-v,e[f]=y-d)}for(var g=1;g<=o;g++)for(var w=o-g,S=0;S<n(g-1);S++)i[n(g-1)+S]=i[S]+n(w);for(var O=0;O<r;O++)if(!(i[O]<=O)){var A=t[i[O]],k=e[i[O]];t[i[O]]=t[O],e[i[O]]=e[O],t[O]=A,e[O]=k}for(var T=0;T<r;T++)t[T]/=r,e[T]/=r}}],r&&Bn(e.prototype,r),n&&Bn(e,n),t}();function Un(t){return Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Un(t)}function qn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Gn(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function Gn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Vn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function zn(t,e,r){return zn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Qn(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(r):i.value}},zn(t,e,r||t)}function Xn(t,e){return Xn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Xn(t,e)}function Wn(t,e){if(e&&("object"===Un(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Qn(t){return Qn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Qn(t)}var Hn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Xn(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=Qn(n);if(i){var r=Qn(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Wn(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).sources=[],r.stream=null,r.constraints={audio:!0,video:!1},r.callbacks={stream:function(){},error:function(){}},r.each=!1,r.output=!0,r.isStop=!0,r.noisegate=new Ln,r.noisesuppressor=new Dn,r}return e=s,r=[{key:"setup",value:function(t,e,r){return"[object Object]"===Object.prototype.toString.call(t)&&(this.constraints=t),"[object Function]"===Object.prototype.toString.call(e)&&(this.callbacks.stream=e),"[object Function]"===Object.prototype.toString.call(r)&&(this.callbacks.error=r),this}},{key:"param",value:function(t,e){if("[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.param(r,arguments[0][r]);else{var n=String(t).replace(/-/g,"").toLowerCase(),i=zn(Qn(s.prototype),"param",this).call(this,n,e);if(void 0!==i)return i;switch(n){case"each":if(void 0===e)return this.each;this.each=Boolean(e);break;case"output":if(void 0===e)return this.output;this.output=Boolean(e)}}return this}},{key:"ready",value:function(t){var e=this;return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&window.MediaStream?(this.isStop=!1,t instanceof MediaStream?(this.stream=t,Promise.resolve()):navigator.mediaDevices.getUserMedia(this.constraints).then((function(t){e.isStop||(e.stream=t,e.callbacks.stream(t))})).catch((function(t){e.callbacks.error(t)}))):Promise.reject("Cannot use WebRTC.")}},{key:"start",value:function(t,e){var r=this;if(null===this.stream)return this;var n=this.processor.bufferSize,i=!1;if(this.each)for(var o=this.stream.getAudioTracks(),s=0,a=o.length;s<a;s++)this.sources[s]=this.context.createMediaStreamTrackSource(o[s]),this.sources[s].connect(this.processor),this.connect(this.processor,t);else this.sources[0]=this.context.createMediaStreamSource(this.stream),this.sources[0].connect(this.processor),this.connect(this.processor,t);return this.output||(this.mastervolume.disconnect(0),this.mastervolume.connect(this.analyser.input),this.mastervolume.connect(this.recorder.processor),this.recorder.processor.connect(this.context.destination),this.mastervolume.connect(this.session.sender),this.session.sender.connect(this.context.destination)),this.on(this.context.currentTime),i||(this.analyser.start("time"),this.analyser.start("fft"),i=!0),"[object Function]"===Object.prototype.toString.call(e)?this.processor.onaudioprocess=e:this.processor.onaudioprocess=function(t){for(var e=t.inputBuffer.getChannelData(0),i=t.inputBuffer.getChannelData(1),o=t.outputBuffer.getChannelData(0),s=t.outputBuffer.getChannelData(1),a=0;a<n;a++)o[a]=r.noisegate.start(e[a]),s[a]=r.noisegate.start(i[a]);r.noisesuppressor.start(e,o,n),r.noisesuppressor.start(i,s,n)},this}},{key:"stop",value:function(){return this.sources.length=0,this.off(this.context.currentTime,!0),this.analyser.stop("time"),this.analyser.stop("fft"),this.processor.disconnect(0),this.processor.onaudioprocess=null,this.isStop=!0,this}},{key:"get",value:function(t){var e=parseInt(t,10);return e>=0&&e<this.sources.length?this.sources[e]:this.sources}},{key:"getStream",value:function(){return this.stream}},{key:"toggle",value:function(t,e){return this.isStreaming()?this.stop():this.start(t,e),this}},{key:"clear",value:function(){return this.stop(),this.clearAudio(),this.clearVideo(),this.stream=null,this}},{key:"clearAudio",value:function(){if(null===this.stream)return this;this.stop();var t,e=qn(this.stream.getAudioTracks());try{for(e.s();!(t=e.n()).done;)t.value.stop()}catch(t){e.e(t)}finally{e.f()}return this}},{key:"clearVideo",value:function(){if(null===this.stream)return this;this.stop();var t,e=qn(this.stream.getVideoTracks());try{for(e.s();!(t=e.n()).done;)t.value.stop()}catch(t){e.e(t)}finally{e.f()}return this.stream=null,this}},{key:"devices",value:function(){return navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices?navigator.mediaDevices.enumerateDevices():Promise.reject("No devices.")}},{key:"isStreaming",value:function(){return!this.isStop}},{key:"params",value:function(){var t=zn(Qn(s.prototype),"params",this).call(this);return t.stream={output:this.output,noisegate:{level:this.noisegate.param("level")},noisesuppressor:{threshold:this.noisesuppressor.param("threshold")}},t}},{key:"toString",value:function(){return"[StreamModule]"}}],r&&Vn(e.prototype,r),s}(Br);function Yn(t){return Yn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yn(t)}function Zn(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return $n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function $n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Jn(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Kn(t,e){return Kn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Kn(t,e)}function ti(t,e){if(e&&("object"===Yn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ei(t){return ei=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ei(t)}var ri=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Kn(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=ei(n);if(i){var r=ei(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return ti(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).sources=[],r.isAnalyser=!1,r}return e=s,r=[{key:"mix",value:function(t){var e=this;Array.isArray(t)||(t=[t]),this.sources=t;var r,n=Zn(this.sources);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(!(i instanceof Jr||i instanceof cn||i instanceof Tn||i instanceof In||i instanceof Hn))return this;var o=this.context.currentTime;this.off(o,!1),i.analyser.stop("time"),i.analyser.stop("fft"),i.isAnalyser=!1,i.recorder.stop(),i.session.close(),i.processor.disconnect(0),i.processor.connect(this.processor)}}catch(t){n.e(t)}finally{n.f()}this.connect(this.processor);var s=this.context.currentTime;return this.on(s),this.isAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.isAnalyser=!0),this.processor.onaudioprocess=function(r){var n,i=r.inputBuffer.getChannelData(0),o=r.inputBuffer.getChannelData(1),s=r.outputBuffer.getChannelData(0),a=r.outputBuffer.getChannelData(1),c=!1,u=Zn(t);try{for(u.s();!(n=u.n()).done;){var l=n.value;(l instanceof Jr&&l.envelopegenerator.isStop()||l instanceof cn&&l.isStop||l instanceof Tn&&l.paused||l instanceof In&&l.media.paused||l instanceof Hn&&l.isStop)&&(c=!0)}}catch(t){u.e(t)}finally{u.f()}if(c){var f=e.context.currentTime;e.on(f,!0),e.analyser.stop("time"),e.analyser.stop("fft"),e.isAnalyser=!1,e.processor.disconnect(0),e.processor.onaudioprocess=null}else s.set(i),a.set(o)},this}},{key:"get",value:function(t){var e=parseInt(t,10);return e>=0&&e<this.sources.length?this.sources[e]:this.sources}},{key:"toString",value:function(){return"[MixerModule]"}}],r&&Jn(e.prototype,r),s}(Br);function ni(t){return ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ni(t)}function ii(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function oi(t,e){return oi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},oi(t,e)}function si(t,e){if(e&&("object"===ni(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ai(t){return ai=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ai(t)}var ci=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&oi(t,e)}(s,t);var e,r,n,i,o=(n=s,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=ai(n);if(i){var r=ai(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return si(this,t)});function s(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(r=o.call(this,t,e)).envelopegenerator.setGenerator(0),r.processor=null,r.name="",r.options={},r.moduleURL="",r.promise=null,r.map=null,r.runAnalyser=!1,r}return e=s,r=[{key:"setup",value:function(t,e){return this.name=String(t),"[object Object]"===Object.prototype.toString.call(e)&&(this.options=e),window.AudioWorkletNode||(this.processor=this.context.createScriptProcessor(this.bufferSize,Br.NUMBER_OF_INPUTS,Br.NUMBER_OF_OUTPUTS),this.map=new Map),this}},{key:"ready",value:function(t,e){var r=this;return window.AudioWorkletNode?(this.moduleURL=String(t),"[object Object]"===Object.prototype.toString.call(e)?this.promise=this.context.audioWorklet.addModule(this.moduleURL,e):this.promise=this.context.audioWorklet.addModule(this.moduleURL),this.promise.then((function(){Object.keys(r.options).length>0?r.processor=new AudioWorkletNode(r.context,r.name,r.options):r.processor=new AudioWorkletNode(r.context,r.name)}))):Promise.reject("Cannot use AudioWorklet")}},{key:"start",value:function(t,e){var r=this.context.currentTime;return this.envelopegenerator.clear(!0),this.processor.disconnect(0),this.processor.onaudioprocess instanceof ScriptProcessorNode&&(this.processor.onaudioprocess=null),this.connect(this.envelopegenerator.getGenerator(0),e),this.envelopegenerator.ready(0,this.processor),this.envelopegenerator.start(r),this.runAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.runAnalyser=!0),this.on(r),this.processor instanceof ScriptProcessorNode&&"[object Function]"===Object.prototype.toString.call(t)&&(this.processor.onaudioprocess=t),this}},{key:"stop",value:function(t){var e=this.context.currentTime;return this.processor.disconnect(0),this.envelopegenerator.stop(e),this.off(e),this.processor instanceof ScriptProcessorNode&&"[object Function]"===Object.prototype.toString.call(t)&&(this.processor.onaudioprocess=t),this}},{key:"postMessage",value:function(t){return this.processor instanceof AudioWorkletNode&&this.processor.port.postMessage(t),this}},{key:"onMessage",value:function(t){return this.processor instanceof AudioWorkletNode&&("[object Function]"!==Object.prototype.toString.call(t)&&null!==t||(this.processor.port.onmessage=t)),this}},{key:"onMessageError",value:function(t){return this.processor instanceof AudioWorkletNode&&("[object Function]"!==Object.prototype.toString.call(t)&&null!==t||(this.processor.port.onmessageerror=t)),this}},{key:"map",value:function(){return this.processor instanceof AudioWorkletNode?this.processor.parameters:this.map}},{key:"param",value:function(t){return this.processor instanceof AudioWorkletNode?this.processor.parameters.get(t):null}},{key:"get",value:function(){return this.processor}},{key:"toString",value:function(){return"[ProcessorModule]"}}],r&&ii(e.prototype,r),s}(Br);function ui(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var li=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.midiAccess=null,this.inputs=[],this.outputs=[]}var e,r;return e=t,(r=[{key:"setup",value:function(t,e,r){var n=this;if(!navigator.requestMIDIAccess)throw new Error("Cannot use Web MIDI API.");return navigator.requestMIDIAccess({sysex:Boolean(t)}).then((function(t){if(n.midiAccess=t,"[object Function]"===Object.prototype.toString.call(t))n.inputs=t.inputs(),n.outputs=t.outputs();else{for(var r=t.inputs.values(),i=t.outputs.values(),o=r.next();!o.done;o=r.next())n.inputs.push(o.value);for(var s=i.next();!s.done;s=i.next())n.outputs.push(s.value)}"[object Function]"===Object.prototype.toString.call(e)&&e(n.midiAccess,n.inputs,n.outputs)})).catch((function(t){"[object Function]"===Object.prototype.toString.call(r)&&r(t)})),this}},{key:"get",value:function(){return this.midiAccess}},{key:"toString",value:function(){return"[MIDI]"}}])&&ui(e.prototype,r),t}();function fi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var hi=new Map([["T","TEMPO"],["O","OCTAVE"],["C","NOTE"],["D","NOTE"],["E","NOTE"],["F","NOTE"],["G","NOTE"],["A","NOTE"],["B","NOTE"],["+","NOTE"],["-","NOTE"],["#","NOTE"],["R","REST"],["0","NUMBER"],["1","NUMBER"],["2","NUMBER"],["3","NUMBER"],["4","NUMBER"],["5","NUMBER"],["6","NUMBER"],["7","NUMBER"],["8","NUMBER"],["9","NUMBER"],[".","NUMBER"],["&","TIE"],[" ","SPACE"],[void 0,"EOS"]]),pi={TEMPO:1,OCTAVE:2,NOTE:3,REST:4,NUMBER:5,TIE:6,SPACE:7,EOS:8,UNKNOWN:9},yi=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.type=e,this.token=r,this.value=parseInt(r,10)}var e,r;return e=t,(r=[{key:"getType",value:function(){return this.type||null}},{key:"getToken",value:function(){return this.token}},{key:"getValue",value:function(){return isNaN(this.value)?null:this.value}}])&&fi(e.prototype,r),t}();function vi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var di=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.tokens="string"==typeof e?e.trim().toUpperCase().split("").reverse():[],this.notes=[],this.numbers=[]}var e,r;return e=t,(r=[{key:"get",value:function(){for(var t=this.tokens.pop();pi[hi.get(t)]===pi.SPACE;)t=this.tokens.pop();if(pi[hi.get(t)]===pi.EOS)return new yi(pi.EOS,t);switch(this.notes.length=0,this.numbers.length=0,pi[hi.get(t)]){case pi.TEMPO:return new yi(pi.TEMPO,t);case pi.OCTAVE:return new yi(pi.OCTAVE,t);case pi.NOTE:for(this.notes.push(t),t=this.tokens.pop();pi[hi.get(t)]===pi.NOTE;)this.notes.push(t),t=this.tokens.pop();return this.tokens.push(t),new yi(pi.NOTE,this.notes.join(""));case pi.REST:return new yi(pi.REST,t);case pi.NUMBER:for(this.numbers.push(t),t=this.tokens.pop();pi[hi.get(t)]===pi.NUMBER;)this.numbers.push(t),t=this.tokens.pop();return this.tokens.push(t),new yi(pi.NUMBER,this.numbers.join(""));case pi.TIE:return new yi(pi.TIE,t);default:return new yi(pi.UNKNOWN,t)}}}])&&vi(e.prototype,r),t}();function bi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var mi=function(){function t(e,r,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.operator=e,this.left=r,this.right=n}var e,r;return e=t,(r=[{key:"concat",value:function(t){this.right=t}},{key:"getOperator",value:function(){return this.operator}},{key:"getLeft",value:function(){return this.left}},{key:"getRight",value:function(){return this.right}},{key:"toString",value:function(){for(var e="",r=0;r<t.indent;r++)e+=" ";return t.indent++,"\n ".concat(e," ").concat(this.operator.getToken(),"\n ").concat(e," /\\\n ").concat(e).concat(null!==this.left?this.left.getOperator().getToken():"","\n ").concat(e).concat(null!==this.right&&void 0!==this.right.getOperator().getToken()?this.toString.call(this.right):"EOS","\n ")}}])&&bi(e.prototype,r),t}();function gi(t){return gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gi(t)}function wi(t,e){if(e&&("object"===gi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Si(t){var e="function"==typeof Map?new Map:void 0;return Si=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return Oi(t,arguments,Ti(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ki(n,t)},Si(t)}function Oi(t,e,r){return Oi=Ai()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&ki(i,r.prototype),i},Oi.apply(null,arguments)}function Ai(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function ki(t,e){return ki=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},ki(t,e)}function Ti(t){return Ti=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ti(t)}function Ei(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ji(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}!function(t,e,r){e in t?Object.defineProperty(t,e,{value:0,enumerable:!0,configurable:!0,writable:!0}):t[e]=0}(mi,"indent");var Ri=function(){function t(e){Ei(this,t),this.tokenizer=e,this.syntaxTree=[]}var e,r;return e=t,(r=[{key:"parse",value:function(){for(var t=this.tokenizer.get(),e=this.tokenizer.get();;){switch(t.getType()){case pi.TEMPO:if(e.getType()===pi.NUMBER){var r=new mi(e,null,null),n=new mi(t,r,null);this.syntaxTree.push(n);break}return new Pi(Pi.ERRORS.TEMPO,t);case pi.OCTAVE:if(this.syntaxTree.length>0&&e.getType()===pi.NUMBER){var i=new mi(e,null,null),o=new mi(t,i,null);this.syntaxTree[this.syntaxTree.length-1].concat(o),this.syntaxTree.push(o);break}return new Pi(Pi.ERRORS.OCTAVE,t);case pi.NOTE:if(this.syntaxTree.length>0&&e.getType()===pi.NUMBER){var s=new mi(e,null,null),a=new mi(t,s,null);this.syntaxTree[this.syntaxTree.length-1].concat(a),this.syntaxTree.push(a);break}return new Pi(Pi.ERRORS.NOTE,t);case pi.REST:if(this.syntaxTree.length>0&&e.getType()===pi.NUMBER){var c=new mi(e,null,null),u=new mi(t,c,null);this.syntaxTree[this.syntaxTree.length-1].concat(u),this.syntaxTree.push(u);break}return new Pi(Pi.ERRORS.REST,t);case pi.NUMBER:break;case pi.TIE:if(this.syntaxTree.length>0){var l=new mi(t,null,null);this.syntaxTree[this.syntaxTree.length-1].concat(l),this.syntaxTree.push(l);break}return new Pi(Pi.ERRORS.TIE,t);case pi.EOS:if(this.syntaxTree.length>0){var f=new mi(t,null,null);this.syntaxTree[this.syntaxTree.length-1].concat(f),this.syntaxTree.push(f)}else{var h=new mi(t,null,null);this.syntaxTree.push(h)}return this.syntaxTree;default:return new Pi(Pi.ERRORS.UNKNOWN,t)}t=e,e=this.tokenizer.get()}}},{key:"free",value:function(){this.syntaxTree.length=0}}])&&ji(e.prototype,r),t}(),Pi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ki(t,e)}(i,t);var e,r,n=(e=i,r=Ai(),function(){var t,n=Ti(e);if(r){var i=Ti(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return wi(this,t)});function i(t,e){var r;return Ei(this,i),(r=n.call(this,t)).token=e,r.error=t,r}return i}(Si(Error));function xi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}!function(t,e,r){e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r}(Pi,"ERRORS",{TEMPO:"tempo",OCTAVE:"octave",NOTE:"note",REST:"rest",TIE:"tie",UNKNOWN:"unknown"});var _i=function(){function t(e,r,n,i,o,s){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.note=e,this.indexes=r,this.frequencies=n,this.start=i,this.stop=o,this.duration=s}var e,r;return e=t,(r=[{key:"concat",value:function(t){var e=t.toPlainObject();this.note+="&".concat(e.note),this.duration+=e.duration,this.stop=this.start+this.duration}},{key:"toPlainObject",value:function(){return{note:this.note,indexes:this.indexes,frequencies:this.frequencies,start:this.start,stop:this.stop,duration:this.duration}}}])&&xi(e.prototype,r),t}();function Mi(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Fi(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Ci=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequences=[],this.treeConstructor=e,this.timeOf4note=0,this.octave=-1,this.currentTime=0}var e,r,n;return e=t,r=[{key:"get",value:function(){var t=this.treeConstructor.parse();this.timeOf4note=0,this.octave=-1,this.currentTime=0;for(var e=t[0];null!==e;){if(!(e instanceof mi))return e instanceof Pi?e:new Pi(Pi.ERRORS.UNKNOWN,null);var r=e.getOperator(),n=r.getType(),i=e.getLeft(),o=e.getRight(),s=null!==i?i.getOperator().getValue():-1;switch(n){case pi.TEMPO:if(s<=0)return new Pi(Pi.ERRORS.TEMPO,r.getToken());this.timeOf4note=60/s,e=o;break;case pi.OCTAVE:if(s<0)return new Pi(Pi.ERRORS.OCTAVE,r.getToken());this.octave=s,e=o;break;case pi.NOTE:case pi.REST:case pi.TIE:var a=this.push(n===pi.TIE?o:e);if(a instanceof Pi)return a;n===pi.TIE?(this.concat(),e=o.getRight()):e=o;break;case pi.EOS:e=o;break;default:return new Pi(Pi.ERRORS.UNKNOWN,null)}}return this.treeConstructor.free(),this.sequences}},{key:"push",value:function(e){var r=e.getLeft(),n=e.getRight();if(null!==r&&null!==n){var i=r.getOperator(),o=n.getOperator();if(!(i instanceof yi||o instanceof yi))return this.push(r),void this.push(n);for(var s=e.getOperator().getToken(),a=i.getValue(),c=i.getToken(),u=[],l=[],f=0,h=s.length;f<h;f++){var p=s.charAt(f),y=t.computeIndex(this.octave,p);switch(s.charAt(f+1)){case t.HALF_UP:case t.SHARP:y++,f++;break;case t.HALF_DOWN:y--,f++}if(y>=u[0]&&(y-=t.EQUAL_TEMPERAMENT),-1!==y&&y<0)return void console.assert();u.push(y)}for(var v=0,d=u;v<d.length;v++){var b=d[v],m=t.computeFrequency(b);if(m<0)return void console.assert();l.push(m)}var g=0;switch(a){case 1:case 2:case 4:case 8:case 16:case 32:case 64:case 128:case 256:var w=t.QUARTER_NOTE/a;c.includes(t.DOT)?g+=w*this.timeOf4note*1.5:g+=w*this.timeOf4note;break;case 6:g+=2*this.timeOf4note/3;break;case 12:g+=this.timeOf4note/3;break;case 18:g+=2*this.timeOf4note/9;break;case 24:g+=.5*this.timeOf4note/3;break;case 36:g+=this.timeOf4note/9;break;case 48:g+=.25*this.timeOf4note/3;break;case 72:g+=.5*this.timeOf4note/9;break;case 96:g+=.125*this.timeOf4note/3;break;case 144:g+=.25*this.timeOf4note/9;break;case 192:g+=.0625*this.timeOf4note/3;break;default:console.assert()}this.sequences.push(new _i("".concat(s).concat(c),u,l,this.currentTime,this.currentTime+g,g)),this.currentTime+=g}}},{key:"concat",value:function(){var t=this.sequences.pop(),e=this.sequences.pop();e.concat(t),this.sequences.push(e)}}],n=[{key:"computeIndex",value:function(e,r){var n=0;switch(r){case t.C:n=3;break;case t.D:n=5;break;case t.E:n=7;break;case t.F:n=8;break;case t.G:n=10;break;case t.A:n=12;break;case t.B:n=14;break;case t.R:return-1;default:console.assert()}var i=t.EQUAL_TEMPERAMENT*(e-1)+n;return i>=0?i:-1}},{key:"computeFrequency",value:function(e){return e>=0?t.MIN_A*Math.pow(t.FREQUENCY_RATIO,e):0}}],r&&Mi(e.prototype,r),n&&Mi(e,n),t}();function Ii(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ni(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}Fi(Ci,"FREQUENCY_RATIO",Math.pow(2,1/12)),Fi(Ci,"MIN_A",27.5),Fi(Ci,"EQUAL_TEMPERAMENT",12),Fi(Ci,"QUARTER_NOTE",4),Fi(Ci,"C","C"),Fi(Ci,"D","D"),Fi(Ci,"E","E"),Fi(Ci,"F","F"),Fi(Ci,"G","G"),Fi(Ci,"A","A"),Fi(Ci,"B","B"),Fi(Ci,"R","R"),Fi(Ci,"SHARP","#"),Fi(Ci,"HALF_UP","+"),Fi(Ci,"HALF_DOWN","-"),Fi(Ci,"DOT",".");var Li=function(){function t(e,r,n,i){var o=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.source=null,this.mml="",this.previous=null,this.timerid=null,this.currentIndex=0,this.currentPosition=0,this.offset=0,(e instanceof Jr||e instanceof cn||e instanceof dn)&&(this.source=e),"string"==typeof r&&(this.mml=r),this.callbacks={start:function(){},stop:function(){},ended:function(){},error:function(){}},"[object Object]"===Object.prototype.toString.call(n)&&Object.keys(n).forEach((function(t){var e=t.toLowerCase();e in o.callbacks&&"[object Function]"===Object.prototype.toString.call(n[e])&&(o.callbacks[e]=n[e])}));var s=parseInt(i,10);!isNaN(s)&&s>=0&&(this.offset=s);var a=new di(r),c=new Ri(a),u=new Ci(c);this.sequences=u.get(),this.sequences instanceof Pi&&this.callbacks.error&&this.callbacks.error(this.sequences)}var e,r;return e=t,(r=[{key:"start",value:function(t,e){var r=this;if(!this.sequences[this.currentIndex])return this.stop(),void this.callbacks.ended();var n=this.sequences[this.currentIndex++].toPlainObject();if(t){var i=this.mml.slice(0,this.currentPosition),o=this.mml.slice(this.currentPosition).replace(n.note,'<span class="x-highlight">'.concat(n.note,"</span>"));this.mml="".concat(i).concat(o),this.currentPosition+=this.mml.slice(this.currentPosition).indexOf("</span>")+"</span>".length}else{var s=this.mml.slice(0,this.currentPosition),a=n.note;this.mml="".concat(s).concat(a),this.currentPosition+=a.length}if(this.source instanceof Jr)this.source.ready(0,n.duration).start(n.frequencies),this.callbacks.start(n);else if(this.source instanceof cn){for(var c=0,u=n.indexes.length;c<u;c++)-1!==n.indexes[c]&&this.source.ready(0,n.duration).start(n.indexes[c]+this.offset);this.callbacks.start(n,this.offset)}else this.source instanceof dn&&(this.source.start(e),this.callbacks.start(n));this.timerid=window.setTimeout((function(){r.source instanceof Jr?r.callbacks.stop(n):r.source instanceof cn?r.callbacks.stop(n,r.offset):r.source instanceof dn&&(r.source.stop(),r.callbacks.stop(n)),r.previous=n,r.start(t,e)}),1e3*n.duration)}},{key:"stop",value:function(){if(null!==this.previous){if(this.source instanceof Jr)this.source.stop(),this.callbacks.stop(this.previous);else if(this.source instanceof cn){var t,e=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Ii(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ii(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(this.previous.indexes);try{for(e.s();!(t=e.n()).done;){var r=t.value;-1!==r&&this.source.stop(r+this.offset)}}catch(t){e.e(t)}finally{e.f()}this.callbacks.stop(this.previous,this.offset)}else this.source instanceof dn&&(this.source.stop(),this.callbacks.stop(this.previous));window.clearTimeout(this.timerid),this.timerid=null}}},{key:"getMML",value:function(){return this.mml}},{key:"getSequence",value:function(){return this.sequences}},{key:"hasSequence",value:function(){return this.sequences.length>0}},{key:"paused",value:function(){return null===this.timerid}},{key:"getCurrentIndex",value:function(){return this.currentIndex}},{key:"setCurrentIndex",value:function(t){var e=parseInt(t,10);e>=0&&e<this.sequences.length&&(this.currentIndex=e)}}])&&Ni(e.prototype,r),t}();function Bi(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Di(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Di(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function Di(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ui(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var qi=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.parts=[],this.callbacks={start:function(){},stop:function(){},ended:function(){},error:function(){}}}var e,r;return e=t,r=[{key:"setup",value:function(t,e){if(arguments.length>0&&"[object Object]"===Object.prototype.toString.call(arguments[0]))for(var r in arguments[0])this.setup(r,arguments[0][r]);else if(arguments.length>1){var n=String(t).toLowerCase();n in this.callbacks&&"[object Function]"===Object.prototype.toString.call(e)&&(this.callbacks[n]=e)}return this}},{key:"ready",value:function(t,e,r){if(Array.isArray(e)||"string"!=typeof e||(e=[e]),!Array.isArray(e))return this;this.stop(),this.clear(),this.mmls=e;var n,i=Bi(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;this.parts.push(new Li(t,o,this.callbacks,r))}}catch(t){i.e(t)}finally{i.f()}return this}},{key:"start",value:function(t,e,r){var n=parseInt(t,10);return n>=0&&n<this.parts.length&&this.parts[n].start(e,r),this}},{key:"stop",value:function(){var t,e=Bi(this.parts);try{for(e.s();!(t=e.n()).done;)t.value.stop()}catch(t){e.e(t)}finally{e.f()}return this}},{key:"get",value:function(t,e){var r,n=parseInt(t,10),i=[],o=[],s=Bi(this.parts);try{for(s.s();!(r=s.n()).done;){var a=r.value;i.push(a.getMML()),o.push(a.getSequence())}}catch(t){s.e(t)}finally{s.f()}return e?n>=0&&n<this.parts.length?this.parts[n].getMML():i:n>=0&&n<this.parts.length?this.parts[n].getSequence():o}},{key:"toggle",value:function(t,e,r){return this.isPaused()?this.start(t,e,r):this.stop(),this}},{key:"isSequences",value:function(){return this.parts.length>0&&this.parts.every((function(t){return t.hasSequence()}))}},{key:"isPaused",value:function(){return 0===this.parts.length||this.parts.every((function(t){return t.paused()}))}},{key:"currentIndex",value:function(t,e){var r=parseInt(t,10);return r<0||r>=this.parts.length?this:void 0===e?this.parts[r].getCurrentIndex():(this.parts[r].setCurrentIndex(e),this)}},{key:"toABC",value:function(t,e,r,n,i,o){var s="";s+="X:".concat(e||1,"\n"),s+="T:".concat(r||"","\n"),s+="M:".concat(n||"4/4","\n"),s+="L:".concat(i||"1/256","\n"),s+="K:".concat(o||"","\n");var a=t.match(/\s*(?:T\d+)\s*|\s*(?:O\d+)\s*|\s*(?:(?:[CDEFGABR][#+-]?)+(?:256|192|144|128|96|72|64|48|36|32|24|18|16|12|8|6|4|2|1)\.?)(?:&(?:[CDEFGABR][#+-]?)+(?:256|192|144|128|96|72|64|48|36|32|24|18|16|12|8|6|4|2|1)\.?)*\s*/gi);if(null===a)return s;for(var c=null,u=0;a.length>0;){var l=a.shift().trim();if(/T\d+/i.test(l)){var f=parseInt(l.slice(1),10);if(f<=0)return s;s+="Q:1/4=".concat(f,"\n")}else if(/O\d+/i.test(l)){if((c=parseInt(l.slice(1),10))<0)return s}else if(/(?:(?:[CDEFGABR][#+-]?)+)(?:256|192|144|128|96|72|64|48|36|32|24|18|16|12|8|6|4|2|1)(?:&(?:[CDEFGABR][#+-]?)+(?:256|192|144|128|96|72|64|48|36|32|24|18|16|12|8|6|4|2|1)\.?)*/i.test(l)){if(null===c)return s;var h=null;h=-1===l.indexOf("&")?[l]:l.split("&");for(var p="";h.length>0;){var y=h.shift(),v="",d=0;switch(parseInt(y.replace(/^.+?(\d+)\.*$/,"$1"),10)){case 1:v=y.replace("1","256");break;case 2:v=y.replace("2","128");break;case 4:v=y.replace("4","64");break;case 8:v=y.replace("8","32");break;case 16:v=y.replace("16","16");break;case 32:v=y.replace("32","8");break;case 64:v=y.replace("64","4");break;case 128:v=y.replace("128","2");break;case 256:v=y.replace("256","1");break;case 6:v="(3".concat(y.replace("6","128")),d=128/3;break;case 12:v="(3".concat(y.replace("12","64")),d=64/3;break;case 18:v="(9".concat(y.replace("18","128")),d=128/9;break;case 24:v="(3".concat(y.replace("24","32")),d=32/3;break;case 36:v="(9".concat(y.replace("36","64")),d=64/9;break;case 48:v="(3".concat(y.replace("48","16")),d=16/3;break;case 72:v="(9".concat(y.replace("72","32")),d=32/9;break;case 96:v="(3".concat(y.replace("96","8")),d=8/3;break;case 144:v="(9".concat(y.replace("144","16")),d=16/9;break;case 192:v="(3".concat(y.replace("192","4")),d=4/3;break;default:return s}if(-1!==v.indexOf(".")&&(v=v.replace(/^(.+?)\d+\.+$/,"$1".concat(1.5*parseInt(v.replace(/^.+?(\d+)\.+$/,"$1"),10)))),-1===v.indexOf("(")?u+=parseInt(v.replace(/^.+?(\d+)\.*$/i,"$1"),10):u+=d,u>=256&&(v+=" | ",u=0),/R/i.test(v))s+="".concat(v," ");else{var b="";switch(c){case 0:b=",,,,";break;case 1:b=",,,";break;case 2:b=",,";break;case 3:b=",";break;case 5:b="'";break;case 6:b="''";break;case 7:b="'''"}var m=v.match(/^(\(\d+)?((?:[CDEFGAB][#+-]?)+)(.*)$/i);if(null===m)return s;var g=m[1]?m[1]:"",w=m[2].length,S=m[3]?m[3]:"",O=0;if(g.length>0&&(v=v.replace(/^(?:\(\d+)?((?:[CDEFGAB][#+-]?)+)(.*)$/i,"$1$2")),1===w)p+="".concat(g).concat(v.slice(0,1)).concat(b).concat(S);else if(2===w&&/[#+-]/.test(v.charAt(1)))p+="".concat(g).concat(v.slice(1,2)).concat(v.slice(0,1)).concat(b).concat(S);else for(;O<w;)0===O&&(p+="".concat(g,"[")),/[#+-]/.test(v.charAt(O+1))?(p+="".concat(v.slice(O+1,O+2)).concat(v.slice(O,O+1)).concat(b),O+=2):(p+="".concat(v.slice(O,O+1)).concat(b),O++),O===w&&(p+="]".concat(S));h.length>0?p+="&":s+="".concat(p," ")}}}}return s.replace(/R/gi,"z").replace(/[#+]/g,"^").replace(/-/g,"_").replace(/&/g,"-").replace(/\s{2}/g," ").trim()}},{key:"clear",value:function(){var t,e=Bi(this.parts);try{for(e.s();!(t=e.n()).done;)t.value.stop()}catch(t){e.e(t)}finally{e.f()}return this.parts.length=0,this}},{key:"toString",value:function(){return"[MML]"}}],r&&Ui(e.prototype,r),t}();function Gi(t,e,r,n,i){if("[object Object]"===Object.prototype.toString.call(arguments[0])){var o=arguments[0];"file"in o&&(t=o.file),"type"in o&&(e=o.type),"success"in o&&(r=o.success),"error"in o&&(n=o.error),"progress"in o&&(i=o.progress)}if(t instanceof Blob){var s=new FileReader;s.onprogress=function(t){"[object Function]"===Object.prototype.toString.call(i)&&i(t)},s.onerror=function(t){if("[object Function]"===Object.prototype.toString.call(n)){var e="";switch(s.error.code){case s.error.NOT_FOUND_ERR:e="NOT_FOUND_ERR";break;case s.error.SECURITY_ERR:e="SECURITY_ERR";break;case s.error.ABORT_ERR:e="ABORT_ERR";break;case s.error.NOT_READABLE_ERR:e="NOT_READABLE_ERR";break;case s.error.ENCODING_ERR:e="ENCODING_ERR";break;default:e="ERR"}n(t,e)}},s.onload=function(t){if("[object Function]"===Object.prototype.toString.call(r)){var e=s.result;"string"!=typeof e||e.includes("data:")||e.indexOf("blob:")||(e=e.replace(/<(\/?script.*?)>/gi,"<$1>")),r(t,e)}},/arraybuffer/i.test(e)?s.readAsArrayBuffer(t):/dataurl/i.test(e)?s.readAsDataURL(t):/text|json/i.test(e)&&s.readAsText(t,"UTF-8")}else"[object Function]"===Object.prototype.toString.call(n)&&n(null,"FILE_IS_NOT_BLOB")}function Vi(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return zi(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zi(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function zi(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Xi,Wi="undefined"!=typeof window?window:{};Wi.AudioContext=Wi.AudioContext||Wi.webkitAudioContext,Wi.MediaSource=Wi.MediaSource||Wi.WebkitMediaSource,Wi.URL=Wi.URL||Wi.webkitURL||Wi.mozURL,Wi.requestAnimationFrame=Wi.requestAnimationFrame||Wi.webkitRequestAnimationFrame||Wi.mozRequestAnimationFrame||function(t){return Wi.setTimeout(t,1e3/60)},Wi.cancelAnimationFrame=Wi.cancelAnimationFrame||Wi.webkitCancelAnimationFrame||Wi.mozCancelAnimationFrame||Wi.clearTimeout;var Qi=Boolean(Wi.AudioContext);if(Qi){var Hi=new AudioContext;Hi.createScriptProcessor=Hi.createScriptProcessor||Hi.createJavaScriptNode,Hi.createGain=Hi.createGain||Hi.createGainNode,Hi.createDelay=Hi.createDelay||Hi.createDelayNode,Hi.createPeriodicWave=Hi.createPeriodicWave||Hi.createWaveTable;var Yi={oscillator:new Jr(Hi),oneshot:new cn(Hi),noise:new dn(Hi),audio:new Tn(Hi),media:new In(Hi),stream:new Hn(Hi),mixer:new ri(Hi),processor:new ci(Hi),midi:new li(Hi),mml:new qi(Hi)};(Xi=function(t,e){var r=String(t).replace(/-/g,"").toLowerCase();switch(r){case"oscillator":if(void 0===e)return Yi.oscillator;var n=parseInt(e,10);return n>=0&&n<Yi.oscillator.length()?Yi.oscillator.get(n):null;case"oneshot":case"noise":case"audio":case"media":case"stream":case"mixer":case"processor":case"midi":case"mml":return Yi[r];default:return null}}).IS_XSOUND=Qi,Xi.SAMPLE_RATE=Hi.sampleRate,Xi.NUMBER_OF_INPUTS=Br.NUMBER_OF_INPUTS,Xi.NUMBER_OF_OUTPUTS=Br.NUMBER_OF_OUTPUTS,Xi.FFT=function(t,e,r){for(var n=function(t){return Math.pow(2,t)},i=new Float32Array(r),o=Math.log2(r),s=1;s<=o;s++)for(var a=0;a<n(s-1);a++)for(var c=o-s,u=0;u<n(c);u++){var l=a*n(c+1)+u,f=n(c)+l,h=u*n(s-1),p=t[l],y=e[l],v=t[f],d=e[f],b=Math.cos(2*Math.PI*h/r),m=-1*Math.sin(2*Math.PI*h/r);s<o?(t[l]=p+v,e[l]=y+d,t[f]=b*(p-v)-m*(y-d),e[f]=b*(y-d)+m*(p-v)):(t[l]=p+v,e[l]=y+d,t[f]=p-v,e[f]=y-d)}for(var g=1;g<=o;g++)for(var w=o-g,S=0;S<n(g-1);S++)i[n(g-1)+S]=i[S]+n(w);for(var O=0;O<r;O++)if(!(i[O]<=O)){var A=t[i[O]],k=e[i[O]];t[i[O]]=t[O],e[i[O]]=e[O],t[O]=A,e[O]=k}},Xi.IFFT=function(t,e,r){for(var n=function(t){return Math.pow(2,t)},i=new Float32Array(r),o=Math.log2(r),s=1;s<=o;s++)for(var a=0;a<n(s-1);a++)for(var c=o-s,u=0;u<n(c);u++){var l=a*n(c+1)+u,f=n(c)+l,h=u*n(s-1),p=t[l],y=e[l],v=t[f],d=e[f],b=Math.cos(2*Math.PI*h/r),m=Math.sin(2*Math.PI*h/r);s<o?(t[l]=p+v,e[l]=y+d,t[f]=b*(p-v)-m*(y-d),e[f]=b*(y-d)+m*(p-v)):(t[l]=p+v,e[l]=y+d,t[f]=p-v,e[f]=y-d)}for(var g=1;g<=o;g++)for(var w=o-g,S=0;S<n(g-1);S++)i[n(g-1)+S]=i[S]+n(w);for(var O=0;O<r;O++)if(!(i[O]<=O)){var A=t[i[O]],k=e[i[O]];t[i[O]]=t[O],e[i[O]]=e[O],t[O]=A,e[O]=k}for(var T=0;T<r;T++)t[T]/=r,e[T]/=r},Xi.ajax=function(t,e,r,n,i,o){if("[object Object]"===Object.prototype.toString.call(arguments[0])){var s=arguments[0];"url"in s&&(t=s.url),"type"in s&&(e=s.type),"timeout"in s&&(r=s.timeout),"success"in s&&(n=s.success),"error"in s&&(i=s.error),"progress"in s&&(o=s.progress)}var a="error",c="timeout",u=new XMLHttpRequest,l=parseInt(r,10);u.timeout=l>0?l:6e4,u.ontimeout=function(t){"[object Function]"===Object.prototype.toString.call(i)&&i(t,c)},u.onprogress=function(t){"[object Function]"===Object.prototype.toString.call(o)&&o(t)},u.onerror=function(t){"[object Function]"===Object.prototype.toString.call(i)&&i(t,a)},u.onload=function(t){200===u.status&&"[object Function]"===Object.prototype.toString.call(n)&&n(t,u.response)},u.open("GET",t,!0),u.responseType=/text|arraybuffer|blob|document|json/.test(String(e).toLowerCase())?String(e).toLowerCase():"arraybuffer",u.send(null)},Xi.convertTime=function(t){var e=parseFloat(t);if(e>=0)return{minutes:Math.floor(e/60),seconds:Math.floor(e%60),milliseconds:e-Math.floor(e)}},Xi.decode=function(t,e,r,n){if(t instanceof AudioContext&&e instanceof ArrayBuffer)return"[object Function]"!==Object.prototype.toString.call(r)&&(r=function(){}),"[object Function]"!==Object.prototype.toString.call(n)&&(n=function(){}),t.decodeAudioData(e,r,n)},Xi.exitFullscreen=function(){return document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():document.cancelFullScreen?document.cancelFullScreen():Promise.reject("Cannot exit from full screen.")},Xi.file=function(t,e,r,n,i){if("[object Object]"===Object.prototype.toString.call(arguments[0])){var o=arguments[0];"event"in o&&(t=o.event),"type"in o&&(e=o.type),"success"in o&&(r=o.success),"error"in o&&(n=o.error),"progress"in o&&(i=o.progress)}if(t instanceof Event){var s=null;if("drop"===t.type)t.stopPropagation(),t.preventDefault(),s=t.dataTransfer.files[0];else{if("change"!==t.type||!("files"in t.target))return;s=t.target.files[0]}if(s instanceof File){if(/text/i.test(e)&&!s.type.includes("text"))throw new Error("Please upload text file.");if(/json/i.test(e)&&!s.type.includes("application/json"))throw new Error("Please upload JSON file.");if(/arraybuffer|dataurl/i.test(e)&&!/audio|video/.test(s.type))throw new Error("Please upload audio or video file.");return/objecturl/i.test(e)?window.URL.createObjectURL(s):(Gi({file:s,type:e,success:r,error:n,progress:i}),s)}throw new Error("Please upload file.")}},Xi.requestFullscreen=function(t){return t instanceof Element?t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():Promise.reject("Cannot change to full screen."):Promise.reject("Invalid argument.")},Xi.read=Gi,Xi.toFrequencies=function(t){var e=Math.pow(2,1/12);Array.isArray(t)||(t=[t]);for(var r=new Array(t.length),n=0,i=t.length;n<i;n++){var o=parseInt(t[n],10);r[n]=o>=0?27.5*Math.pow(e,o):0}return r},Xi.toTextFile=function(t){var e=window.btoa(function(t){for(var e="",r=0,n=t.length;r<n;r++){var i=t.charCodeAt(r);e+=i>255?"&#".concat(i,";"):t.charAt(r)}return e}(String(t)));return"data:text/plain;base64,".concat(e)},Xi.Analyser=q,Xi.Recorder=K,Xi.Session=at,Xi.Effector=pt,Xi.Autopanner=wt,Xi.Chorus=Ct,Xi.Compressor=Ut,Xi.Delay=Wt,Xi.Distortion=oe,Xi.Equalizer=ve,Xi.Filter=Se,Xi.Flanger=Re,Xi.Listener=Ce,Xi.Panner=qe,Xi.Phaser=He,Xi.PitchShifter=tr,Xi.Reverb=cr,Xi.Ringmodulator=vr,Xi.Stereo=Sr,Xi.Tremolo=Rr,Xi.Wah=Ir,Xi.setup=function(){return"running"!==Hi.state?Hi.resume():Promise.reject()},Xi.clone=function(){var t={oscillator:new Jr(Hi),oneshot:new cn(Hi),noise:new dn(Hi),audio:new Tn(Hi),media:new In(Hi),stream:new Hn(Hi),mixer:new ri(Hi),processor:new ci(Hi),midi:new li(Hi),mml:new qi(Hi)},e=function(e,r){var n=String(e).replace(/-/g,"").toLowerCase();switch(n){case"oscillator":if(void 0===r)return t.oscillator;var i=parseInt(r,10);return i>=0&&i<t.oscillator.length()?t.oscillator.get(i):null;case"oneshot":case"noise":case"audio":case"media":case"stream":case"mixer":case"processor":case"midi":case"mml":return t[n];default:return null}};return e.free=function(e){Array.isArray(e)||(e=[e]);var r,n=Vi(e);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(null!==i)for(var o in t)i===t[o]&&(t[o]=null)}}catch(t){n.e(t)}finally{n.f()}},e},Xi.free=function(t){Array.isArray(t)||(t=[t]);var e,r=Vi(t);try{for(r.s();!(e=r.n()).done;){var n=e.value;if(null!==n)for(var i in Yi)n===Yi[i]&&(Yi[i]=null)}}catch(t){r.e(t)}finally{r.f()}},Xi.noConflict=function(t){return window.X===Xi&&(window.X=void 0),t&&window.XSound===Xi&&(window.XSound=void 0),Xi},Xi.get=function(){return Hi},Xi.getCurrentTime=function(){return Hi.currentTime},Xi.toString=function(){return"[XSound]"};var Zi=function t(){Xi.setup().then((function(){})).catch((function(){})),document.removeEventListener("click",t,!0),document.removeEventListener("mousedown",t,!0),document.removeEventListener("mouseup",t,!0),document.removeEventListener("touchstart",t,!0),document.removeEventListener("touchend",t,!0)};document.addEventListener("click",Zi,!0),document.addEventListener("mousedown",Zi,!0),document.addEventListener("mouseup",Zi,!0),document.addEventListener("touchstart",Zi,!0),document.addEventListener("touchend",Zi,!0)}else(Xi=function(){return null}).IS_XSOUND=Qi;Wi.XSound=Xi,Wi.X=Xi,"undefined"!=typeof exports&&(exports.XSound=Xi,exports.X=Xi)})();
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.xsound=e():t.xsound=e()}(self,(function(){return(()=>{"use strict";var t={1114:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__assign||function(){return s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.AudioModule=void 0;var o=r(2188),a=r(3449),u=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.buffer=null,n.currentTime=0,n.stopped=!0,n.source=e.createBufferSource(),n.vocalcanceler=new a.VocalCanceler,n}return i(e,t),e.prototype.setup=function(t){var e=null!=t?t:{},r=e.decodeCallback,n=e.updateCallback,i=e.endedCallback,s=e.errorCallback;return r&&(this.decodeCallback=r),n&&(this.updateCallback=n),i&&(this.endedCallback=i),s&&(this.errorCallback=s),this.envelopegenerator.setGenerator(0),this.envelopegenerator.param({attack:0,decay:.01,sustain:1,release:.01}),this},e.prototype.ready=function(t){var e=this;if(t instanceof ArrayBuffer){this.buffer=null;this.context.decodeAudioData(t,(function(t){e.buffer=t,e.analyser.start("timeoverview",0,e.buffer),e.analyser.start("timeoverview",1,e.buffer),e.decodeCallback&&e.decodeCallback(e.buffer)}),this.errorCallback)}else t instanceof AudioBuffer&&(this.buffer=t);return this},e.prototype.start=function(t,e){var r=this;if(null===this.buffer||!this.stopped)return this;var n=this.context.currentTime,i=null!=t?t:0,s=null!=e?e:this.buffer.duration;this.currentTime=s>=0?i>=0&&i<=s?i:0:i>=0&&i<=this.buffer.duration?i:0;var o=this.source.playbackRate.value,a=this.source.detune.value,u=this.source.loop;this.source=this.context.createBufferSource(),this.source.buffer=this.buffer,this.source.playbackRate.value=o,this.source.detune.value=a,this.source.loop=u,this.source.loopStart=this.currentTime,this.source.loopEnd=s>=0?s:this.buffer.duration,this.envelopegenerator.ready(0,this.source,this.processor),this.connect(this.processor),s>=0?this.source.start(n,this.currentTime,s-i):this.source.start(n,this.currentTime,this.buffer.duration-this.currentTime),this.analyser.start("time"),this.analyser.start("fft"),this.stopped=!1,this.envelopegenerator.start(n),s>=0?this.envelopegenerator.stop(n+(s-i)/this.source.playbackRate.value,!0):this.envelopegenerator.stop(n+(this.buffer.duration-i)/this.source.playbackRate.value,!0),this.on(n);var c=this.processor.bufferSize,l=this.analyser.domain("timeoverview",0),h=this.analyser.domain("timeoverview",1);return this.processor.onaudioprocess=function(t){var e=t.inputBuffer.getChannelData(0),n=t.inputBuffer.getChannelData(1),i=t.outputBuffer.getChannelData(0),s=t.outputBuffer.getChannelData(1);if(null!==r.buffer)if(r.currentTime<Math.trunc(r.source.loopEnd)){for(var o=0;o<c;o++)i[o]=r.vocalcanceler.start(e[o],n[o]),s[o]=r.vocalcanceler.start(n[o],e[o]),r.currentTime+=1*r.source.playbackRate.value/r.buffer.sampleRate,r.updateCallback&&r.updateCallback(r.source,r.currentTime);l.update(r.currentTime),h.update(r.currentTime)}else r.source.loop?(r.stop(),"sprite"===l.param("mode")?r.start(r.source.loopStart,r.source.loopEnd):r.start(0,r.buffer.duration)):r.end();else r.end()},this},e.prototype.stop=function(){if(null===this.buffer||this.stopped)return this;var t=this.context.currentTime;return this.source.stop(t),this.off(t),this.analyser.stop("time"),this.analyser.stop("fft"),this.processor.disconnect(0),this.processor.onaudioprocess=null,this.stopped=!0,this},e.prototype.param=function(t){var e,r,n,i,s,o,a,u,c,l;if("string"==typeof t)switch(t){case"mastervolume":return this.mastervolume.gain.value;case"playbackRate":return this.source.playbackRate.value;case"detune":return this.source.detune.value;case"loop":return this.source.loop;case"currentTime":return this.currentTime;case"duration":return null!==(r=null===(e=this.source.buffer)||void 0===e?void 0:e.duration)&&void 0!==r?r:0;case"sampleRate":return null!==(i=null===(n=this.source.buffer)||void 0===n?void 0:n.sampleRate)&&void 0!==i?i:this.context.sampleRate;case"numberOfChannels":return null!==(o=null===(s=this.source.buffer)||void 0===s?void 0:s.numberOfChannels)&&void 0!==o?o:0;default:return this}for(var h=0,p=Object.entries(t);h<p.length;h++){var f=p[h],d=f[0],v=f[1];switch(d){case"mastervolume":"number"==typeof v&&(this.mastervolume.gain.value=v);break;case"playbackRate":if("number"==typeof v&&v>0){this.source.playbackRate.value=v;var y=this.context.currentTime,m=this.currentTime,b=null!==(u=null===(a=this.source.buffer)||void 0===a?void 0:a.duration)&&void 0!==u?u:0;this.envelopegenerator.start(y),this.envelopegenerator.stop(y+(b-m)/v,!0)}break;case"detune":if("number"==typeof v){this.source.detune.value=v;var g=v>0?v/1200+1:Math.abs(1/(v/1200-1));y=this.context.currentTime,m=this.currentTime,b=null!==(l=null===(c=this.source.buffer)||void 0===c?void 0:c.duration)&&void 0!==l?l:0;this.envelopegenerator.start(y),this.envelopegenerator.stop(y+(b-m)/g,!0)}break;case"loop":"boolean"==typeof v&&(this.source.loop=v);break;case"currentTime":"number"==typeof v&&(this.currentTime=v,this.stopped||(this.stop(),this.start(v)))}}return this},e.prototype.get=function(){return this.source},e.prototype.end=function(){return this.stop(),this.currentTime=0,this.endedCallback&&this.endedCallback(this.source,0),this},e.prototype.has=function(){return null!==this.buffer},e.prototype.paused=function(){return this.stopped},e.prototype.fadeIn=function(t){var e,r;if("number"!=typeof t)return this.envelopegenerator.param("attack");this.envelopegenerator.param({attack:t});var n=this.context.currentTime,i=this.currentTime,s=null!==(r=null===(e=this.source.buffer)||void 0===e?void 0:e.duration)&&void 0!==r?r:0,o=this.source.playbackRate.value;return this.envelopegenerator.start(n),this.envelopegenerator.stop(n+(s-i)/o,!0),this},e.prototype.fadeOut=function(t){var e,r;if("number"!=typeof t)return this.envelopegenerator.param("release");this.envelopegenerator.param({release:t});var n=this.context.currentTime,i=this.currentTime,s=null!==(r=null===(e=this.source.buffer)||void 0===e?void 0:e.duration)&&void 0!==r?r:0,o=this.source.playbackRate.value;return this.envelopegenerator.start(n),this.envelopegenerator.stop(n+(s-i)/o,!0),this},e.prototype.slice=function(t,e){if(null===this.buffer)return null;var r=this.buffer.duration,n=this.buffer.sampleRate,i=this.buffer.numberOfChannels,s=Math.trunc((null!=t?t:0)*n),o=Math.trunc((null!=e?e:r)*n),a=i>0?this.buffer.getChannelData(0):null,u=i>1?this.buffer.getChannelData(1):null,c=o-s;switch(i){case 1:if(null===a)return null;for(var l=new Float32Array(c),h=s;h<o;h++)l[h-s]=a[h];return(f=this.context.createBuffer(1,c,n)).copyToChannel(l,0),f;case 2:if(null===a||null===u)return null;l=new Float32Array(c);var p=new Float32Array(c);for(h=s;h<o;h++)l[h-s]=a[h],p[h-s]=u[h];var f;return(f=this.context.createBuffer(2,c,n)).copyToChannel(l,0),f.copyToChannel(p,1),f;default:return null}},e.prototype.sprite=function(t){var e=this;return null===this.buffer?null:Object.keys(t).reduce((function(r,n){var i=t[n],s=e.slice.apply(e,i);return null!==s&&(r[n]=s),r}),{})},e.prototype.module=function(t){switch(t){case"analyser":return this.analyser;case"recorder":return this.recorder;case"session":return this.session;case"autopanner":return this.autopanner;case"chorus":return this.chorus;case"compressor":return this.compressor;case"delay":return this.delay;case"distortion":return this.distortion;case"equalizer":return this.equalizer;case"filter":return this.filter;case"flanger":return this.flanger;case"listener":return this.listener;case"panner":return this.panner;case"phaser":return this.phaser;case"pitchshifter":return this.pitchshifter;case"reverb":return this.reverb;case"ringmodulator":return this.ringmodulator;case"stereo":return this.stereo;case"tremolo":return this.tremolo;case"wah":return this.wah;case"envelopegenerator":return this.envelopegenerator;case"vocalcanceler":return this.vocalcanceler;default:return null}},e.prototype.resize=function(e){return t.prototype.init.call(this,this.context,e),this},e.prototype.on=function(e){return t.prototype.on.call(this,e),this},e.prototype.off=function(e){return t.prototype.off.call(this,e),this},e.prototype.suspend=function(){return t.prototype.suspend.call(this),this},e.prototype.params=function(){var e,r,n,i,o,a,u=t.prototype.params.call(this);return s(s({},u),{playbackRate:this.source.playbackRate.value,detune:this.source.detune.value,loop:this.source.loop,currentTime:this.currentTime,duration:null!==(r=null===(e=this.buffer)||void 0===e?void 0:e.duration)&&void 0!==r?r:0,sampleRate:null!==(i=null===(n=this.buffer)||void 0===n?void 0:n.sampleRate)&&void 0!==i?i:this.context.sampleRate,numberOfChannels:null!==(a=null===(o=this.buffer)||void 0===o?void 0:o.numberOfChannels)&&void 0!==a?a:0,vocalcanceler:this.vocalcanceler.params()})},e}(o.SoundModule);e.AudioModule=u},9206:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MIDI=void 0;var r=function(){function t(){this.midiAccess=null,this.inputs=[],this.outputs=[]}return t.prototype.setup=function(t){var e=this;if(!navigator.requestMIDIAccess)return Promise.reject();var r=t.options,n=t.successCallback,i=t.errorCallback;return navigator.requestMIDIAccess(r).then((function(t){e.midiAccess=t;for(var r=t.inputs.values(),i=t.outputs.values(),s=r.next();!s.done;s=r.next())e.inputs.push(s.value);for(var o=i.next();!o.done;o=i.next())e.outputs.push(o.value);n&&n(e.midiAccess,e.inputs,e.outputs)})).catch((function(t){i&&i(t)}))},t.prototype.get=function(){return this.midiAccess},t}();e.MIDI=r},5822:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Part=void 0;var n=r(6667),i=r(5146),s=r(4903),o=r(2811),a=r(9171),u=r(9646),c=r(1358),l=function(){function t(t){this.sequences=[],this.previous=null,this.timerId=null,this.currentIndex=0,this.currentPosition=0,this.offset=0;var e=t.source,r=t.mml,n=t.offset,i=t.startCallback,s=t.stopCallback,l=t.endedCallback,h=t.errorCallback;this.source=e,this.mml=r,this.offset=null!=n?n:0,i&&(this.startCallback=i),s&&(this.stopCallback=s),l&&(this.endedCallback=l),h&&(this.errorCallback=h);var p=new a.Tokenizer(r),f=new u.TreeConstructor(p),d=new c.Sequencer(f).get();d instanceof o.MMLSyntaxError?this.errorCallback&&this.errorCallback(d):this.sequences=d}return t.prototype.start=function(t){var e=this;if(!this.sequences[this.currentIndex])return this.stop(),void(this.endedCallback&&this.endedCallback());var r=this.sequences[this.currentIndex++];if(t){var o=this.mml.slice(0,this.currentPosition),a=this.mml.slice(this.currentPosition).replace(r.note,'<span class="x-highlight">'.concat(r.note,"</span>"));this.mml="".concat(o).concat(a),this.currentPosition+=this.mml.slice(this.currentPosition).indexOf("</span>")+"</span>".length}else{o=this.mml.slice(0,this.currentPosition),a=r.note;this.mml="".concat(o).concat(a),this.currentPosition+=a.length}if(this.source instanceof n.OscillatorModule)this.source.ready(0,r.duration).start(r.frequencies),this.startCallback&&this.startCallback(r);else if(this.source instanceof i.OneshotModule){for(var u=0,c=r.indexes.length;u<c;u++)-1!==r.indexes[u]&&this.source.ready(0,r.duration).start(r.indexes[u]+this.offset);this.startCallback&&this.startCallback(r,this.offset)}else this.source instanceof s.NoiseModule&&(this.source.start(),this.startCallback&&this.startCallback(r));this.timerId=window.setTimeout((function(){e.source instanceof n.OscillatorModule?e.stopCallback&&e.stopCallback(r):e.source instanceof i.OneshotModule?e.stopCallback&&e.stopCallback(r,e.offset):e.source instanceof s.NoiseModule&&(e.source.stop(),e.stopCallback&&e.stopCallback(r)),e.previous=r,e.start(t)}),1e3*r.duration)},t.prototype.stop=function(){if(null!==this.previous){if(this.source instanceof n.OscillatorModule)this.source.stop(),this.stopCallback&&this.stopCallback(this.previous);else if(this.source instanceof i.OneshotModule){for(var t=0,e=this.previous.indexes;t<e.length;t++){var r=e[t];-1!==r&&this.source.stop(r+this.offset)}this.stopCallback&&this.stopCallback(this.previous,this.offset)}else this.source instanceof s.NoiseModule&&(this.source.stop(),this.stopCallback&&this.stopCallback(this.previous));this.timerId&&window.clearTimeout(this.timerId),this.timerId=null}},t.prototype.getMML=function(){return this.mml},t.prototype.getSequences=function(){return this.sequences},t.prototype.has=function(){return this.sequences.length>0},t.prototype.paused=function(){return null===this.timerId},t.prototype.getCurrentIndex=function(){return this.currentIndex},t.prototype.setCurrentIndex=function(t){t>=0&&t<this.sequences.length&&(this.currentIndex=t)},t}();e.Part=l},6478:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Sequence=void 0;var r=function(){function t(t){var e=t.id,r=t.note,n=t.indexes,i=t.frequencies,s=t.start,o=t.stop,a=t.duration;this._id=e,this._note=r,this._indexes=n,this._frequencies=i,this._start=s,this._stop=o,this._duration=a}return t.prototype.concat=function(e){return new t({id:this._id,note:"".concat(this._note,"&").concat(e.note),indexes:this._indexes,frequencies:this._frequencies,start:this._start,duration:this._duration+e.duration,stop:this._start+(this._duration+e.duration)})},Object.defineProperty(t.prototype,"note",{get:function(){return this._note},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"indexes",{get:function(){return this._indexes},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"frequencies",{get:function(){return this._frequencies},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stop",{get:function(){return this._stop},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){return this._duration},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return JSON.stringify({id:this._id,note:this._note,indexes:this._indexes,frequencies:this._frequencies,start:this._start,stop:this._stop,duration:this._duration})},t}();e.Sequence=r},1358:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Sequencer=void 0;var n=r(999),i=r(2811),s=r(9646),o=r(6478),a=function(){function t(t){this.sequences=[],this.timeOf4note=0,this.octave=-1,this.currentTime=0,this.treeConstructor=t}return t.prototype.get=function(){var t,e;s.TreeConstructor.id=0;var r=this.treeConstructor.parse();if(r instanceof i.MMLSyntaxError)return r;this.timeOf4note=0,this.octave=-1,this.currentTime=0;for(var n=r[0];null!==n;){if(n instanceof i.MMLSyntaxError)return n;var o=n.operator,a=o.type,u=n.left,c=null!==u?u.operator.value:-1;switch(a){case"TEMPO":if(c<=0)return new i.MMLSyntaxError(o);this.timeOf4note=60/c,n=n.right;break;case"OCTAVE":if(c<0)return new i.MMLSyntaxError(o);this.octave=c,n=n.right;break;case"NOTE":case"REST":case"TIE":var l=this.push("TIE"===a?n.right:n);if(l instanceof i.MMLSyntaxError)return l;"TIE"===a?(this.concat(),n=null!==(e=null===(t=n.right)||void 0===t?void 0:t.right)&&void 0!==e?e:null):n=n.right;break;case"EOS":n=n.right;break;default:return new i.MMLSyntaxError(n.operator)}}return this.treeConstructor.free(),this.sequences},t.prototype.push=function(t){if(null!==t){var e=t.left,r=t.right;if(null!==e&&null!==r){var i=e.operator,s=r.operator;if(null===i&&null===s)return this.push(e),void this.push(r);var a=t.operator.token,u=i.value,c=i.token,l=[],h=[];if(a){for(var p=0,f=a.length;p<f;p++){var d=a.charAt(p);if((0,n.isPitchChar)(d)){var v=(0,n.computeIndex)(this.octave,d);switch(a.charAt(p+1)){case n.HALF_UP:case n.SHARP:v++,p++;break;case n.HALF_DOWN:v--,p++}if(v>=l[0]&&(v-=n.EQUAL_TEMPERAMENT),-1!==v&&v<0)return;l.push(v)}}for(var y=0,m=l;y<m.length;y++){v=m[y];var b=(0,n.computeFrequency)(v);if(b<0)return;h.push(b)}var g=0;switch(u){case 1:case 2:case 4:case 8:case 16:case 32:case 64:case 128:case 256:if(c){var w=n.QUARTER_NOTE/u;c.includes(n.DOT)?g+=w*this.timeOf4note*1.5:g+=w*this.timeOf4note}break;case 6:g+=2*this.timeOf4note/3;break;case 12:g+=this.timeOf4note/3;break;case 18:g+=2*this.timeOf4note/9;break;case 24:g+=.5*this.timeOf4note/3;break;case 36:g+=this.timeOf4note/9;break;case 48:g+=.25*this.timeOf4note/3;break;case 72:g+=.5*this.timeOf4note/9;break;case 96:g+=.125*this.timeOf4note/3;break;case 144:g+=.25*this.timeOf4note/9;break;case 192:g+=.0625*this.timeOf4note/3}var T=(this.sequences.length+1).toString(10),k="".concat(a).concat(c),_=this.currentTime,A=_+g;this.sequences.push(new o.Sequence({id:T,note:k,indexes:l,frequencies:h,start:_,stop:A,duration:g})),this.currentTime+=g}}}},t.prototype.concat=function(){var t=this.sequences.pop(),e=this.sequences.pop();e&&t&&this.sequences.push(e.concat(t))},t}();e.Sequencer=a},6806:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.TokenMap=void 0,e.TokenMap=new Map([["T","TEMPO"],["O","OCTAVE"],["C","NOTE"],["D","NOTE"],["E","NOTE"],["F","NOTE"],["G","NOTE"],["A","NOTE"],["B","NOTE"],["+","NOTE"],["-","NOTE"],["#","NOTE"],["R","REST"],["0","NUMBER"],["1","NUMBER"],["2","NUMBER"],["3","NUMBER"],["4","NUMBER"],["5","NUMBER"],["6","NUMBER"],["7","NUMBER"],["8","NUMBER"],["9","NUMBER"],[".","NUMBER"],["&","TIE"],[" ","SPACE"],[void 0,"EOS"]]);var r=function(){function t(t,e,r){this._id=t,this._type=e,this._token=r,this._value=r?parseInt(r,10):-1}return Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"value",{get:function(){return Number.isNaN(this._value)?-1:this._value},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return JSON.stringify({id:this._id,type:this._type,token:this._token,value:this._value})},t}();e.Token=r},9171:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Tokenizer=void 0;var n=r(6806),i=function(){function t(t){this.tokens=[],this.notes=[],this.numbers=[],this.tokens=t.trim().toUpperCase().split("").reverse()}return t.prototype.get=function(){var e=this.tokens.pop(),r=n.TokenMap.get(e);if(t.id++,!r)return new n.Token(t.id.toString(10),"UNKNOWN",e);for(;"SPACE"===r;)if(e=this.tokens.pop(),!(r=n.TokenMap.get(e)))return new n.Token(t.id.toString(10),"UNKNOWN",e);if("EOS"===r)return new n.Token(t.id.toString(10),"EOS",e);switch(this.notes.length=0,this.numbers.length=0,r){case"TEMPO":if(e)return new n.Token(t.id.toString(10),"TEMPO",e);break;case"OCTAVE":if(e)return new n.Token(t.id.toString(10),"OCTAVE",e);break;case"NOTE":if(e){if(this.notes.push(e),!(e=this.tokens.pop()))return new n.Token(t.id.toString(10),"NOTE",this.notes.join(""));if(!(r=n.TokenMap.get(e)))return new n.Token(t.id.toString(10),"UNKNOWN",e);for(;"NOTE"===r;){if(this.notes.push(e),!(e=this.tokens.pop()))return new n.Token(t.id.toString(10),"NOTE",this.notes.join(""));if(!(r=n.TokenMap.get(e)))return new n.Token(t.id.toString(10),"UNKNOWN",e)}return this.tokens.push(e),new n.Token(t.id.toString(10),"NOTE",this.notes.join(""))}break;case"REST":if(e)return new n.Token(t.id.toString(10),"REST",e);break;case"NUMBER":if(e){if(this.numbers.push(e),!(e=this.tokens.pop()))return new n.Token(t.id.toString(10),"NUMBER",this.numbers.join(""));if(!(r=n.TokenMap.get(e)))return new n.Token(t.id.toString(10),"UNKNOWN",e);for(;"NUMBER"===r;){if(this.numbers.push(e),!(e=this.tokens.pop()))return new n.Token(t.id.toString(10),"NUMBER",this.numbers.join(""));if(!(r=n.TokenMap.get(e)))return new n.Token(t.id.toString(10),"UNKNOWN",e)}return this.tokens.push(e),new n.Token(t.id.toString(10),"NUMBER",this.numbers.join(""))}break;case"TIE":if(e)return new n.Token(t.id.toString(10),"TIE",e);break;default:if(e)return new n.Token(t.id.toString(10),"UNKNOWN",e)}return null},t.id=0,t}();e.Tokenizer=i},2811:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.MMLSyntaxError=e.Tree=void 0;var i=function(){function t(t,e,r,n){this.indent=0,this._id=t,this._operator=e,this._left=r,this._right=n}return t.prototype.concat=function(t){this._right=t},Object.defineProperty(t.prototype,"operator",{get:function(){return this._operator},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this._left},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this._right},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this.indent=0},t.prototype.toString=function(){for(var t="",e=0;e<this.indent;e++)t+=" ";return this.indent++,"\n ".concat(t," ").concat("".concat(this._operator.token," (id = ").concat(this._id,")"),"\n ").concat(t," /\\\n ").concat(t).concat(null!==this._left?"".concat(this._left._operator.token," (id = ").concat(this._left._id,")"):"","\n ").concat(t).concat(null!==this._right&&void 0!==this._right._operator.token?this.toString.call(this._right):"EOS","\n ")},t}();e.Tree=i;var s=function(t){function e(e){var r=t.call(this)||this;return r._token=e,r}return n(e,t),Object.defineProperty(e.prototype,"token",{get:function(){return this._token},enumerable:!1,configurable:!0}),e}(Error);e.MMLSyntaxError=s},9646:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TreeConstructor=void 0;var n=r(9171),i=r(2811),s=function(){function t(t){this.syntaxTree=[],this.tokenizer=t}return t.prototype.parse=function(){n.Tokenizer.id=0;for(var e=this.tokenizer.get(),r=this.tokenizer.get();;){if(!e||!r)return this.syntaxTree;switch(t.id+=2,e.type){case"TEMPO":if("NUMBER"===r.type){var s=new i.Tree((t.id-0).toString(10),r,null,null),o=new i.Tree((t.id-1).toString(10),e,s,null);this.syntaxTree.push(o);break}return new i.MMLSyntaxError(e);case"OCTAVE":if(this.syntaxTree.length>0&&"NUMBER"===r.type){s=new i.Tree((t.id-0).toString(10),r,null,null),o=new i.Tree((t.id-1).toString(10),e,s,null);this.syntaxTree[this.syntaxTree.length-1].concat(o),this.syntaxTree.push(o);break}return new i.MMLSyntaxError(e);case"NOTE":if(this.syntaxTree.length>0&&"NUMBER"===r.type){s=new i.Tree((t.id-0).toString(10),r,null,null),o=new i.Tree((t.id-1).toString(10),e,s,null);this.syntaxTree[this.syntaxTree.length-1].concat(o),this.syntaxTree.push(o);break}return new i.MMLSyntaxError(e);case"REST":if(this.syntaxTree.length>0&&"NUMBER"===r.type){s=new i.Tree((t.id-0).toString(10),r,null,null),o=new i.Tree((t.id-1).toString(10),e,s,null);this.syntaxTree[this.syntaxTree.length-1].concat(o),this.syntaxTree.push(o);break}return new i.MMLSyntaxError(e);case"NUMBER":t.id-=2;break;case"TIE":if(this.syntaxTree.length>0){t.id--;o=new i.Tree((t.id-0).toString(10),e,null,null);this.syntaxTree[this.syntaxTree.length-1].concat(o),this.syntaxTree.push(o);break}return new i.MMLSyntaxError(e);case"EOS":if(this.syntaxTree.length>0){o=new i.Tree((t.id-1).toString(10),e,null,null);this.syntaxTree[this.syntaxTree.length-1].concat(o),this.syntaxTree.push(o)}else{o=new i.Tree((t.id-1).toString(10),e,null,null);this.syntaxTree.push(o)}return this.syntaxTree;default:return new i.MMLSyntaxError(e)}e=r,r=this.tokenizer.get()}},t.prototype.free=function(){this.syntaxTree.length=0},t.id=0,t}();e.TreeConstructor=s},7087:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MML=void 0;r(6806),r(2811),r(6478);var n=r(5822),i=function(){function t(){this.parts=[]}return t.prototype.setup=function(t){return(null==t?void 0:t.startCallback)&&(this.startCallback=t.startCallback),(null==t?void 0:t.stopCallback)&&(this.stopCallback=t.stopCallback),(null==t?void 0:t.endedCallback)&&(this.endedCallback=t.endedCallback),(null==t?void 0:t.errorCallback)&&(this.errorCallback=t.errorCallback),this},t.prototype.ready=function(t){var e=t.source,r=t.mmls,i=t.offset;this.stop(),this.clear();for(var s=0,o=r;s<o.length;s++){var a=o[s];this.parts.push(new n.Part({source:e,mml:a,offset:i,startCallback:this.startCallback,stopCallback:this.stopCallback,endedCallback:this.endedCallback,errorCallback:this.errorCallback}))}return this},t.prototype.start=function(t,e){t>=0&&t<this.parts.length&&this.parts[t].start(null!=e&&e);return this},t.prototype.stop=function(){for(var t=0,e=this.parts;t<e.length;t++){e[t].stop()}return this},t.prototype.getMML=function(t){return t>=0&&t<this.parts.length?this.parts[t].getMML():null},t.prototype.getMMLs=function(){return this.parts.map((function(t){return t.getMML()}))},t.prototype.has=function(){return this.parts.length>0&&this.parts.every((function(t){return t.has()}))},t.prototype.getSequences=function(t){return t>=0&&t<this.parts.length?this.parts[t].getSequences():null},t.prototype.getAllSequences=function(){return this.parts.map((function(t){return t.getSequences()}))},t.prototype.paused=function(){return 0===this.parts.length||this.parts.every((function(t){return t.paused()}))},t.prototype.currentIndex=function(t,e){return t<0||t>=this.parts.length?this:e?(this.parts[t].setCurrentIndex(e),this):this.parts[t].getCurrentIndex()},t.prototype.clear=function(){for(var t=0,e=this.parts;t<e.length;t++){e[t].stop()}return this.parts.length=0,this},t.prototype.toABC=function(t,e,r,n,i,s){var o,a="";a+="X:".concat(e||1,"\n"),a+="T:".concat(r||"","\n"),a+="M:".concat(n||"4/4","\n"),a+="L:".concat(i||"1/256","\n"),a+="K:".concat(s||"","\n");var u=t.match(/\s*(?:T\d+)\s*|\s*(?:O\d+)\s*|\s*(?:(?:[CDEFGABR][#+-]?)+(?:256|192|144|128|96|72|64|48|36|32|24|18|16|12|8|6|4|2|1)\.?)(?:&(?:[CDEFGABR][#+-]?)+(?:256|192|144|128|96|72|64|48|36|32|24|18|16|12|8|6|4|2|1)\.?)*\s*/gi);if(null===u)return a;for(var c=null,l=0;u.length>0;){var h=null===(o=u.shift())||void 0===o?void 0:o.trim();if(!h)return a;if(/T\d+/i.test(h)){var p=parseInt(h.slice(1),10);if(p<=0)return a;a+="Q:1/4=".concat(p,"\n")}else if(/O\d+/i.test(h)){if((c=parseInt(h.slice(1),10))<0)return a}else if(/(?:(?:[CDEFGABR][#+-]?)+)(?:256|192|144|128|96|72|64|48|36|32|24|18|16|12|8|6|4|2|1)(?:&(?:[CDEFGABR][#+-]?)+(?:256|192|144|128|96|72|64|48|36|32|24|18|16|12|8|6|4|2|1)\.?)*/i.test(h)){if(null===c)return a;var f=null;f=h.includes("&")?h.split("&"):[h];for(var d="";f.length>0;){var v=f.shift();if(!v)return a;var y="",m=0;switch(parseInt(v.replace(/^.+?(\d+)\.*$/,"$1"),10)){case 1:y=v.replace("1","256");break;case 2:y=v.replace("2","128");break;case 4:y=v.replace("4","64");break;case 8:y=v.replace("8","32");break;case 16:y=v.replace("16","16");break;case 32:y=v.replace("32","8");break;case 64:y=v.replace("64","4");break;case 128:y=v.replace("128","2");break;case 256:y=v.replace("256","1");break;case 6:y="(3".concat(v.replace("6","128")),m=128/3;break;case 12:y="(3".concat(v.replace("12","64")),m=64/3;break;case 18:y="(9".concat(v.replace("18","128")),m=128/9;break;case 24:y="(3".concat(v.replace("24","32")),m=32/3;break;case 36:y="(9".concat(v.replace("36","64")),m=64/9;break;case 48:y="(3".concat(v.replace("48","16")),m=16/3;break;case 72:y="(9".concat(v.replace("72","32")),m=32/9;break;case 96:y="(3".concat(v.replace("96","8")),m=8/3;break;case 144:y="(9".concat(v.replace("144","16")),m=16/9;break;case 192:y="(3".concat(v.replace("192","4")),m=4/3;break;default:return a}if(y.includes(".")&&(y=y.replace(/^(.+?)\d+\.+$/,"$1".concat(1.5*parseInt(y.replace(/^.+?(\d+)\.+$/,"$1"),10)))),y.includes("(")?l+=parseInt(y.replace(/^.+?(\d+)\.*$/i,"$1"),10):l+=m,l>=256&&(y+=" | ",l=0),/R/i.test(y))a+="".concat(y," ");else{var b="";switch(c){case 0:b=",,,,";break;case 1:b=",,,";break;case 2:b=",,";break;case 3:b=",";break;case 5:b="'";break;case 6:b="''";break;case 7:b="'''"}var g=y.match(/^(\(\d+)?((?:[CDEFGAB][#+-]?)+)(.*)$/i);if(null===g)return a;var w=g[1]?g[1]:"",T=g[2].length,k=g[3]?g[3]:"",_=0;if(w.length>0&&(y=y.replace(/^(?:\(\d+)?((?:[CDEFGAB][#+-]?)+)(.*)$/i,"$1$2")),1===T)d+="".concat(w).concat(y.slice(0,1)).concat(b).concat(k);else if(2===T&&/[#+-]/.test(y.charAt(1)))d+="".concat(w).concat(y.slice(1,2)).concat(y.slice(0,1)).concat(b).concat(k);else for(;_<T;)0===_&&(d+="".concat(w,"[")),/[#+-]/.test(y.charAt(_+1))?(d+="".concat(y.slice(_+1,_+2)).concat(y.slice(_,_+1)).concat(b),_+=2):(d+="".concat(y.slice(_,_+1)).concat(b),_++),_===T&&(d+="]".concat(k));f.length>0?d+="&":a+="".concat(d," ")}}}}return a.replace(/R/gi,"z").replace(/[#+]/g,"^").replace(/-/g,"_").replace(/&/g,"-").replace(/\s{2}/g," ").trim()},t}();e.MML=i},7878:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__assign||function(){return s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MediaModule=void 0;var o=r(2188),a=r(3449),u=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.source=null,n.media=null,n.ext="",n.autoplay=!1,n.mediaSource=null,n.sourceBuffer=null,n.file="",n.mimeType="",n.listeners={},n.vocalcanceler=new a.VocalCanceler,n.onSourceOpen=n.onSourceOpen.bind(n),n.onSourceEnded=n.onSourceEnded.bind(n),n.onSourceClose=n.onSourceClose.bind(n),n.onSourceBufferUpdateEnd=n.onSourceBufferUpdateEnd.bind(n),n.onSourceBufferError=n.onSourceBufferError.bind(n),n}return i(e,t),e.prototype.setup=function(t){var e=this;this.envelopegenerator.setGenerator(0),this.envelopegenerator.param({attack:0,decay:.01,sustain:1,release:.01});var r=t.media,n=t.formats,i=t.listeners,s=t.autoplay;if(!r)return this;this.media=r;for(var o=0,a=null!=n?n:[];o<a.length;o++){var u=a[o],c="audio/".concat(u),l="video/".concat(u),h=this.media.canPlayType(c),p=this.media.canPlayType(l);if(/^(?:maybe|probably)/.test(h)||/^(?:maybe|probably)/.test(p)){this.ext=u;break}}return i&&(this.listeners=i,Object.keys(i).forEach((function(t){var r=i[t];"function"==typeof r&&(i[t]=r),e.media&&e.media.addEventListener(t,r,!1)}))),this.media.addEventListener("loadstart",(function(t){null!==e.media&&null===e.source&&(e.source=e.context.createMediaElementSource(e.media))}),!1),this.media.addEventListener("ended",(function(t){null!==e.media&&(e.media.pause(),e.off(e.context.currentTime),e.analyser.stop("time"),e.analyser.stop("fft"),e.processor.disconnect(0),e.processor.onaudioprocess=null)}),!1),this.autoplay=null!=s&&s,this.autoplay&&null===this.source&&(this.source=this.context.createMediaElementSource(this.media)),this.autoplay&&this.media.src&&this.context.resume().then((function(){var t,r;e.start(null!==(r=null===(t=e.media)||void 0===t?void 0:t.currentTime)&&void 0!==r?r:0)})).catch((function(){throw new Error("Autoplay is failed")})),this},e.prototype.ready=function(t,e){if(null===this.media)return this;this.mediaSource&&"open"===this.mediaSource.readyState&&(this.mediaSource.endOfStream(),window.URL.revokeObjectURL(this.media.src),this.mediaSource.removeEventListener("sourceopen",this.onSourceOpen,!1),this.mediaSource.removeEventListener("sourceended",this.onSourceEnded,!1),this.mediaSource.removeEventListener("sourceclose",this.onSourceClose,!1),this.sourceBuffer&&(this.sourceBuffer.removeEventListener("updateend",this.onSourceBufferUpdateEnd,!1),this.sourceBuffer.removeEventListener("error",this.onSourceBufferError,!1)));try{if(e){if(!MediaSource||!MediaSource.isTypeSupported(e))throw new Error("This Browser does not support `MediaSource` or MIME type");this.media.removeAttribute("src"),this.media.load(),this.mediaSource=new MediaSource,this.media.src=window.URL.createObjectURL(this.mediaSource),this.mimeType=e,this.file=t,this.mediaSource.addEventListener("sourceopen",this.onSourceOpen,!1),this.mediaSource.addEventListener("sourceended",this.onSourceEnded,!1),this.mediaSource.addEventListener("sourceclose",this.onSourceClose,!1)}else t.startsWith("data:")||t.startsWith("blob:")||""===this.ext?this.media.src=t:this.media.src="".concat(t,".").concat(this.ext)}catch(t){if(t instanceof Error)throw new Error(t.message)}return this},e.prototype.start=function(t){var e=this;return null===this.source||null===this.media||(this.envelopegenerator.ready(0,this.source,this.processor),this.connect(this.processor),this.media.play().then((function(){if(null!==e.media){var r=e.context.currentTime;e.media.currentTime=null!=t?t:0,e.envelopegenerator.start(r),Number.isFinite(e.media.duration)&&e.envelopegenerator.stop(r+(e.media.duration-e.media.currentTime)/e.media.playbackRate,!0),e.on(r),e.analyser.start("time"),e.analyser.start("fft");var n=e.processor.bufferSize;e.processor.onaudioprocess=function(t){for(var r=t.inputBuffer.getChannelData(0),i=t.inputBuffer.getChannelData(1),s=t.outputBuffer.getChannelData(0),o=t.outputBuffer.getChannelData(1),a=0;a<n;a++)s[a]=e.vocalcanceler.start(r[a],i[a]),o[a]=e.vocalcanceler.start(i[a],r[a])}}})).catch((function(){e.stop((function(){null!==e.media&&(e.autoplay&&(e.media.muted=!0,e.media.volume=0),e.start(t))}),(function(){}))}))),this},e.prototype.stop=function(t,e){var r=this;return null===this.source||null===this.media||this.media.play().then((function(){null!==r.media&&(r.media.pause(),r.off(r.context.currentTime),r.analyser.stop("time"),r.analyser.stop("fft"),r.processor.disconnect(0),r.processor.onaudioprocess=null,t&&t())})).catch((function(t){e&&e(t)})),this},e.prototype.param=function(t){var e,r,n,i,s,o,a,u,c,l,h,p,f,d;if("string"==typeof t)switch(t){case"mastervolume":return this.mastervolume.gain.value;case"autoplay":return this.autoplay;case"playbackRate":return null!==(r=null===(e=this.media)||void 0===e?void 0:e.playbackRate)&&void 0!==r?r:1;case"currentTime":return null!==(i=null===(n=this.media)||void 0===n?void 0:n.currentTime)&&void 0!==i?i:0;case"controls":return null!==(o=null===(s=this.media)||void 0===s?void 0:s.controls)&&void 0!==o&&o;case"loop":return null!==(u=null===(a=this.media)||void 0===a?void 0:a.loop)&&void 0!==u&&u;case"muted":return null!==(l=null===(c=this.media)||void 0===c?void 0:c.muted)&&void 0!==l&&l;case"duration":return Number.isNaN(null!==(p=null===(h=this.media)||void 0===h?void 0:h.duration)&&void 0!==p?p:0)?0:null!==(d=null===(f=this.media)||void 0===f?void 0:f.duration)&&void 0!==d?d:0;default:return this}for(var v=0,y=Object.entries(t);v<y.length;v++){var m=y[v],b=m[0],g=m[1];switch(b){case"mastervolume":"number"==typeof g&&(this.mastervolume.gain.value=g);break;case"playbackRate":if(this.media&&"number"==typeof g&&g>0){this.media.playbackRate=g;var w=this.context.currentTime,T=this.media.currentTime,k=this.media.duration;this.envelopegenerator.start(w),Number.isFinite(k)&&this.envelopegenerator.stop(w+(k-T)/g,!0)}break;case"currentTime":if(this.media&&"number"==typeof g){this.media.currentTime=g;w=this.context.currentTime,k=this.media.duration;var _=this.media.playbackRate;this.envelopegenerator.start(w),Number.isFinite(k)&&this.envelopegenerator.stop(w+(k-g)/_,!0)}break;case"controls":this.media&&"boolean"==typeof g&&(this.media.controls=g);break;case"loop":this.media&&"boolean"==typeof g&&(this.media.loop=g);break;case"muted":this.media&&"boolean"==typeof g&&(this.media.muted=g)}}return this},e.prototype.get=function(){return this.source},e.prototype.hasMedia=function(){return null!==this.media},e.prototype.hasSource=function(){return null!==this.source},e.prototype.paused=function(){return null===this.media||this.media.paused},e.prototype.fadeIn=function(t){var e,r,n,i,s,o;if("number"!=typeof t)return this.envelopegenerator.param("attack");this.envelopegenerator.param({attack:t});var a=this.context.currentTime,u=null!==(r=null===(e=this.media)||void 0===e?void 0:e.currentTime)&&void 0!==r?r:0,c=null!==(i=null===(n=this.media)||void 0===n?void 0:n.duration)&&void 0!==i?i:0,l=null!==(o=null===(s=this.media)||void 0===s?void 0:s.playbackRate)&&void 0!==o?o:1;return this.envelopegenerator.start(a),this.envelopegenerator.stop(a+(c-u)/l,!0),this},e.prototype.fadeOut=function(t){var e,r,n,i,s,o;if("number"!=typeof t)return this.envelopegenerator.param("release");this.envelopegenerator.param({release:t});var a=this.context.currentTime,u=null!==(r=null===(e=this.media)||void 0===e?void 0:e.currentTime)&&void 0!==r?r:0,c=null!==(i=null===(n=this.media)||void 0===n?void 0:n.duration)&&void 0!==i?i:0,l=null!==(o=null===(s=this.media)||void 0===s?void 0:s.playbackRate)&&void 0!==o?o:1;return this.envelopegenerator.start(a),this.envelopegenerator.stop(a+(c-u)/l,!0),this},e.prototype.requestPictureInPicture=function(){return this.media instanceof HTMLVideoElement&&"pictureInPictureEnabled"in document&&document.pictureInPictureEnabled?this.media.disablePictureInPicture||0===this.media.readyState||this.media===document.pictureInPictureElement?Promise.reject():this.media.requestPictureInPicture():Promise.reject()},e.prototype.exitPictureInPicture=function(){return this.media instanceof HTMLVideoElement&&"pictureInPictureEnabled"in document&&document.pictureInPictureEnabled?this.media.disablePictureInPicture||0===this.media.readyState||this.media!==document.pictureInPictureElement?Promise.reject():document.exitPictureInPicture():Promise.reject()},e.prototype.module=function(t){switch(t){case"analyser":return this.analyser;case"recorder":return this.recorder;case"session":return this.session;case"autopanner":return this.autopanner;case"chorus":return this.chorus;case"compressor":return this.compressor;case"delay":return this.delay;case"distortion":return this.distortion;case"equalizer":return this.equalizer;case"filter":return this.filter;case"flanger":return this.flanger;case"listener":return this.listener;case"panner":return this.panner;case"phaser":return this.phaser;case"pitchshifter":return this.pitchshifter;case"reverb":return this.reverb;case"ringmodulator":return this.ringmodulator;case"stereo":return this.stereo;case"tremolo":return this.tremolo;case"wah":return this.wah;case"envelopegenerator":return this.envelopegenerator;case"vocalcanceler":return this.vocalcanceler;default:return null}},e.prototype.resize=function(e){return t.prototype.init.call(this,this.context,e),this},e.prototype.on=function(e){return t.prototype.on.call(this,e),this},e.prototype.off=function(e){return t.prototype.off.call(this,e),this},e.prototype.suspend=function(){return t.prototype.suspend.call(this),this},e.prototype.params=function(){var e,r,n,i,o,a,u,c,l,h,p,f,d,v,y=t.prototype.params.call(this);return s(s({},y),{autoplay:this.autoplay,playbackRate:null!==(r=null===(e=this.media)||void 0===e?void 0:e.playbackRate)&&void 0!==r?r:1,controls:null!==(i=null===(n=this.media)||void 0===n?void 0:n.controls)&&void 0!==i&&i,loop:null!==(a=null===(o=this.media)||void 0===o?void 0:o.loop)&&void 0!==a&&a,muted:null!==(c=null===(u=this.media)||void 0===u?void 0:u.muted)&&void 0!==c&&c,currentTime:null!==(h=null===(l=this.media)||void 0===l?void 0:l.currentTime)&&void 0!==h?h:0,duration:Number.isNaN(null!==(f=null===(p=this.media)||void 0===p?void 0:p.duration)&&void 0!==f?f:0)?0:null!==(v=null===(d=this.media)||void 0===d?void 0:d.duration)&&void 0!==v?v:0,vocalcanceler:this.vocalcanceler.params()})},e.prototype.onSourceOpen=function(t){var e=this;if(null!==this.mediaSource){this.sourceBuffer=this.mediaSource.addSourceBuffer(this.mimeType),this.sourceBuffer.mode="sequence",this.sourceBuffer.addEventListener("updateend",this.onSourceBufferUpdateEnd,!1),this.sourceBuffer.addEventListener("error",this.onSourceBufferError,!1);var r=new Request(this.file);fetch(r).then((function(t){return t.arrayBuffer()})).then((function(t){e.sourceBuffer&&e.sourceBuffer.appendBuffer(t)})).catch((function(t){e.listeners.error&&e.listeners.error(t)}))}},e.prototype.onSourceEnded=function(t){this.listeners.sourceclose&&this.listeners.sourceclose(t)},e.prototype.onSourceClose=function(t){this.listeners.sourceended&&this.listeners.sourceclose(t)},e.prototype.onSourceBufferUpdateEnd=function(t){this.listeners.updateend&&this.listeners.updateend(t)},e.prototype.onSourceBufferError=function(t){this.listeners.error&&this.listeners.error(t)},e}(o.SoundModule);e.MediaModule=u},6567:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.MixerModule=void 0;var s=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.sources=[],n.runningAnalyser=!1,n}return i(e,t),e.prototype.setup=function(){return this},e.prototype.ready=function(){return this},e.prototype.start=function(t){return this.mix(t)},e.prototype.stop=function(){return this},e.prototype.mix=function(t){this.sources=t;for(var e=0,r=this.sources;e<r.length;e++){var n=r[e],i=this.context.currentTime;this.off(i),n.suspend(),n.INPUT.connect(this.processor)}this.connect(this.processor);var s=this.context.currentTime;return this.on(s),this.runningAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.runningAnalyser=!0),this.processor.onaudioprocess=function(t){var e=t.inputBuffer.getChannelData(0),r=t.inputBuffer.getChannelData(1),n=t.outputBuffer.getChannelData(0),i=t.outputBuffer.getChannelData(1);n.set(e),i.set(r)},this},e.prototype.get=function(){return this.sources},e.prototype.module=function(t){switch(t){case"analyser":return this.analyser;case"recorder":return this.recorder;case"session":return this.session;case"autopanner":return this.autopanner;case"chorus":return this.chorus;case"compressor":return this.compressor;case"delay":return this.delay;case"distortion":return this.distortion;case"equalizer":return this.equalizer;case"filter":return this.filter;case"flanger":return this.flanger;case"listener":return this.listener;case"panner":return this.panner;case"phaser":return this.phaser;case"pitchshifter":return this.pitchshifter;case"reverb":return this.reverb;case"ringmodulator":return this.ringmodulator;case"stereo":return this.stereo;case"tremolo":return this.tremolo;case"wah":return this.wah;case"envelopegenerator":return this.envelopegenerator;default:return null}},e.prototype.resize=function(e){return t.prototype.init.call(this,this.context,e),this},e.prototype.on=function(e){return t.prototype.on.call(this,e),this},e.prototype.off=function(e){return t.prototype.off.call(this,e),this},e.prototype.suspend=function(){return t.prototype.suspend.call(this),this},e}(r(2188).SoundModule);e.MixerModule=s},4903:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__assign||function(){return s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.NoiseModule=void 0;var o=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.type="whitenoise",n.runningAnalyser=!1,n.envelopegenerator.setGenerator(0),n}return i(e,t),e.prototype.setup=function(){return this},e.prototype.ready=function(){return this},e.prototype.start=function(){var t=this,e=this.context.currentTime;this.envelopegenerator.clear(!0),this.processor.disconnect(0),this.processor.onaudioprocess=null;var r=this.envelopegenerator.getGenerator(0);r&&this.connect(r),this.envelopegenerator.ready(0,this.processor,null),this.envelopegenerator.start(e),this.runningAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.runningAnalyser=!0),this.on(e);var n=this.processor.bufferSize,i=0;return this.processor.onaudioprocess=function(e){var r=e.outputBuffer.getChannelData(0),s=e.outputBuffer.getChannelData(1);if(t.envelopegenerator.paused())t.processor.disconnect(0),t.processor.onaudioprocess=null,t.analyser.stop("time"),t.analyser.stop("fft"),t.runningAnalyser=!1;else switch(t.type){case"whitenoise":for(var o=0;o<n;o++)r[o]=2*(Math.random()-.5),s[o]=2*(Math.random()-.5);break;case"pinknoise":var a=0,u=0,c=0,l=0,h=0,p=0,f=0;for(o=0;o<n;o++){a=.99886*a+.0555179*(d=2*Math.random()-1),u=.99332*u+.0750759*d,c=.969*c+.153852*d,l=.8665*l+.3104856*d,h=.55*h+.5329522*d,p=-.7616*p-.016898*d,r[o]=a+u+c+l+h+p+f+.5362*d,s[o]=a+u+c+l+h+p+f+.5362*d,r[o]*=.11,s[o]*=.11,f=.115926*d}break;case"browniannoise":for(o=0;o<n;o++){var d=2*Math.random()-1;r[o]=(i+.02*d)/1.02,s[o]=(i+.02*d)/1.02,i=(i+.02*d)/1.02,r[o]*=3.5,s[o]*=3.5}}},this},e.prototype.stop=function(){var t=this.context.currentTime;return this.envelopegenerator.stop(t),this.off(t),this},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"mastervolume":return this.mastervolume.gain.value;case"type":return this.type;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"mastervolume":"number"==typeof s&&(this.mastervolume.gain.value=s);break;case"type":"string"==typeof s&&(this.type=s)}}return this},e.prototype.module=function(t){switch(t){case"analyser":return this.analyser;case"recorder":return this.recorder;case"session":return this.session;case"autopanner":return this.autopanner;case"chorus":return this.chorus;case"compressor":return this.compressor;case"delay":return this.delay;case"distortion":return this.distortion;case"equalizer":return this.equalizer;case"filter":return this.filter;case"flanger":return this.flanger;case"listener":return this.listener;case"panner":return this.panner;case"phaser":return this.phaser;case"pitchshifter":return this.pitchshifter;case"reverb":return this.reverb;case"ringmodulator":return this.ringmodulator;case"stereo":return this.stereo;case"tremolo":return this.tremolo;case"wah":return this.wah;case"envelopegenerator":return this.envelopegenerator;default:return null}},e.prototype.resize=function(e){return t.prototype.init.call(this,this.context,e),this},e.prototype.on=function(e){return t.prototype.on.call(this,e),this},e.prototype.off=function(e){return t.prototype.off.call(this,e),this},e.prototype.suspend=function(){return t.prototype.suspend.call(this),this},e.prototype.params=function(){var e=t.prototype.params.call(this);return s(s({},e),{type:this.type})},e}(r(2188).SoundModule);e.NoiseModule=o},5146:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__assign||function(){return s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.OneshotModule=void 0;var o=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.sources=[],n.resources=[],n.buffers=[],n.volumes=[],n.states=[],n.settings=[],n.startTime=0,n.duration=0,n.transpose=1,n.paused=!0,n.isLoadError=!1,n.runningAnalyser=!1,n}return i(e,t),e.prototype.setup=function(t){for(var e=t.resources,r=t.settings,n=t.timeout,i=t.successCallback,s=t.errorCallback,o=t.progressCallback,a=0,u=r.length;a<u;a++)this.states[a]=!1,this.volumes[a]=this.context.createGain(),this.settings[a]=r[a],this.envelopegenerator.setGenerator(a);var c=0;for(u=e.length;c<u;c++){this.resources[c]=e[c];var l=this.resources[c];"string"==typeof l?this.load({url:l,index:c,timeout:n,successCallback:i,errorCallback:s,progressCallback:o}):this.buffers[c]=l}return this},e.prototype.ready=function(t,e){return this.startTime=null!=t?t:this.context.currentTime,this.duration=null!=e?e:0,this.envelopegenerator.clear(!1),this},e.prototype.start=function(t){var e=this;if(t<0||t>=this.settings.length)return this;var r=this.settings[t],n=r.bufferIndex,i=r.playbackRate,s=r.loop,o=r.loopStart,a=r.loopEnd,u=r.volume,c=this.context.createBufferSource();c.buffer=this.buffers[n],c.playbackRate.value=(null!=i?i:1)*this.transpose,c.loop=null!=s&&s,c.loopStart=null!=o?o:0,c.loopEnd=null!=a?a:c.buffer.duration,this.volumes[t].gain.value=null!=u?u:1,this.envelopegenerator.clear(!1),this.envelopegenerator.ready(t,c,this.volumes[t]),this.volumes[t].connect(this.processor),this.connect(this.processor);var l=this.context.currentTime+this.startTime;return c.loop?c.start(l,l+c.loopStart,c.loopEnd-l):c.start(l),this.sources[t]=c,this.envelopegenerator.start(l),this.on(l),this.runningAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.runningAnalyser=!0),this.states[t]=!0,c.onended=function(){e.states[t]=!1},this.processor.onaudioprocess=function(r){if(e.paused=!e.states.some((function(t){return t})),e.paused)e.stop(t),e.off(e.context.currentTime),e.envelopegenerator.clear(!1),e.analyser.stop("time"),e.analyser.stop("fft"),e.runningAnalyser=!1,e.processor.disconnect(0),e.processor.onaudioprocess=null;else{var n=r.inputBuffer.getChannelData(0),i=r.inputBuffer.getChannelData(1),s=r.outputBuffer.getChannelData(0),o=r.outputBuffer.getChannelData(1);s.set(n),o.set(i)}},this},e.prototype.stop=function(t){if(t<0||t>=this.settings.length)return this;if("number"!=typeof this.settings[t].bufferIndex)return this;var e=this.context.currentTime+this.startTime+this.duration;return this.envelopegenerator.stop(e),this.filter.stop(e),this},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"mastervolume":return this.mastervolume.gain.value;case"transpose":return this.transpose;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"mastervolume":"number"==typeof s&&(this.mastervolume.gain.value=s);break;case"transpose":"number"==typeof s&&(this.transpose=s)}}return this},e.prototype.get=function(t){return"number"==typeof t&&t>=0&&t<this.buffers.length?this.buffers[t]:this.buffers},e.prototype.reset=function(t,e,r){if(t>=0&&t<this.settings.length)switch(e){case"bufferIndex":case"playbackRate":case"loopStart":case"loopEnd":case"volume":"number"==typeof r&&(this.settings[t][e]=r);break;case"loop":"boolean"==typeof r&&(this.settings[t][e]=r)}return this},e.prototype.module=function(t){switch(t){case"analyser":return this.analyser;case"recorder":return this.recorder;case"session":return this.session;case"autopanner":return this.autopanner;case"chorus":return this.chorus;case"compressor":return this.compressor;case"delay":return this.delay;case"distortion":return this.distortion;case"equalizer":return this.equalizer;case"filter":return this.filter;case"flanger":return this.flanger;case"listener":return this.listener;case"panner":return this.panner;case"phaser":return this.phaser;case"pitchshifter":return this.pitchshifter;case"reverb":return this.reverb;case"ringmodulator":return this.ringmodulator;case"stereo":return this.stereo;case"tremolo":return this.tremolo;case"wah":return this.wah;case"envelopegenerator":return this.envelopegenerator;default:return null}},e.prototype.resize=function(e){return t.prototype.init.call(this,this.context,e),this},e.prototype.on=function(e){return t.prototype.on.call(this,e),this},e.prototype.off=function(e){return t.prototype.off.call(this,e),this},e.prototype.suspend=function(){return t.prototype.suspend.call(this),this},e.prototype.params=function(){var e=t.prototype.params.call(this);return s(s({},e),{transpose:this.transpose})},e.prototype.load=function(t){var e=this,r=t.url,n=t.index,i=t.timeout,s=t.successCallback,o=t.errorCallback,a=t.progressCallback,u=new XMLHttpRequest;u.timeout=null!=i?i:6e4,u.ontimeout=function(t){!e.isLoadError&&o&&o(t,"timeout"),e.isLoadError=!0},u.onprogress=function(t){e.isLoadError?u.abort():a&&a(t)},u.onerror=function(t){!e.isLoadError&&o&&o(t,"error"),e.isLoadError=!0},u.onload=function(t){if(200===u.status){var r=u.response;if(!(r instanceof ArrayBuffer))return;e.context.decodeAudioData(r,(function(r){e.buffers[n]=r;for(var i=0,o=e.buffers;i<o.length;i++){if(void 0===o[i])return}s&&s(t,e.buffers)}),(function(t){o&&o(t,"decode")}))}},u.open("GET",r,!0),u.responseType="arraybuffer",u.send(null)},e}(r(2188).SoundModule);e.OneshotModule=o},9069:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Glide=void 0;var r=function(){function t(t){this.type="linear",this.time=0,this.prevFrequency=-1,this.nextFrequency=0,this.context=t}return t.prototype.ready=function(t){this.nextFrequency=t;var e=-1===this.prevFrequency?0:this.nextFrequency-this.prevFrequency;0!==this.time&&0!==e||(this.prevFrequency=this.nextFrequency)},t.prototype.start=function(t,e){var r=null!=e?e:this.context.currentTime,n=r+this.time;t.frequency.cancelScheduledValues(r),t.frequency.setValueAtTime(this.prevFrequency,r),"exponential"===this.type?t.frequency.exponentialRampToValueAtTime(this.nextFrequency,n):t.frequency.linearRampToValueAtTime(this.nextFrequency,n)},t.prototype.stop=function(){this.prevFrequency=this.nextFrequency},t.prototype.param=function(t){if("string"==typeof t)switch(t){case"type":return this.type;case"time":return this.time;default:return}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"type":"string"==typeof s&&(this.type=s);break;case"time":"number"==typeof s&&(this.time=s)}}},t.prototype.params=function(){return{type:this.type,time:this.time}},t}();e.Glide=r},9565:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Oscillator=void 0;var r=function(){function t(t,e){this.octave=0,this.fine=0,this.custom={real:new Float32Array([0,1]),imag:new Float32Array([0,1])},this.paused=!0,this.context=t,this.source=t.createOscillator(),this.volume=t.createGain(),this.isActive=e}return t.prototype.ready=function(t){if(this.isActive){var e=this.source.type,r=this.source.frequency.value,n=this.source.detune.value;if(this.paused||(this.source.stop(this.context.currentTime),this.source.disconnect(0)),this.source=this.context.createOscillator(),"custom"===e){var i=this.custom.real,s=this.custom.imag,o=this.context.createPeriodicWave(i,s);this.source.setPeriodicWave(o)}else this.source.type=e;this.source.frequency.value=r,this.source.detune.value=n,this.volume.connect(t)}},t.prototype.start=function(t){this.isActive?(this.source.start(null!=t?t:this.context.currentTime),this.paused=!1):(this.paused||(this.source.stop(this.context.currentTime),this.paused=!0),this.source.disconnect(0))},t.prototype.stop=function(t){this.paused||(this.source.stop(null!=t?t:this.context.currentTime),this.source.disconnect(0),this.paused=!0)},t.prototype.param=function(e){if("string"==typeof e)switch(e){case"type":return this.source.type;case"octave":return this.octave;case"fine":return this.fine;case"volume":return this.volume.gain.value;default:return this}for(var r=0,n=Object.entries(e);r<n.length;r++){var i=n[r],s=i[0],o=i[1];switch(s){case"type":if("string"==typeof o)this.source.type=o;else if("object"==typeof o){var a=o.real,u=o.imag,c=4096;a.length>c&&(a=a.subarray(0,c)),u.length>c&&(u=u.subarray(0,c)),0!==a[0]&&(a[0]=0),0!==u[0]&&(u[0]=0);var l=this.context.createPeriodicWave(a,u);this.source.setPeriodicWave(l),this.custom.real=a,this.custom.imag=u}break;case"octave":"number"==typeof o&&(this.octave=o,this.source.detune.value=this.fine+o*t.OCTAVE);break;case"fine":"number"==typeof o&&(this.fine=o,this.source.detune.value=o+this.octave*t.OCTAVE);break;case"volume":"number"==typeof o&&(this.volume.gain.value=o)}}return this},t.prototype.get=function(){return this.source},t.prototype.state=function(){return this.isActive},t.prototype.activate=function(){return this.isActive=!0,this},t.prototype.deactivate=function(){return this.isActive=!1,this},t.prototype.params=function(){return{state:this.isActive,type:this.source.type,octave:this.octave,fine:this.fine,volume:this.volume.gain.value}},Object.defineProperty(t.prototype,"INPUT",{get:function(){return this.source},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"OUTPUT",{get:function(){return this.volume},enumerable:!1,configurable:!0}),t.OCTAVE=1200,t}();e.Oscillator=r},6667:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__assign||function(){return s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.OscillatorModule=void 0;var o=r(2188),a=r(9069),u=r(9565),c=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.sources=[],n.startTime=0,n.duration=0,n.runningAnalyser=!1,n.glide=new a.Glide(e),n}return i(e,t),e.prototype.setup=function(t){this.sources.length=0,Array.isArray(t)||(t=[t]);for(var e=0,r=t.length;e<r;e++)this.sources[e]=new u.Oscillator(this.context,Boolean(t[e])),this.envelopegenerator.setGenerator(e);return this},e.prototype.ready=function(t,e){return this.startTime=t<0?t:0,this.duration=e<0?e:0,this.envelopegenerator.clear(!0),this},e.prototype.start=function(t){var e=this,r=this.context.currentTime+this.startTime;this.envelopegenerator.clear(!0),this.processor.disconnect(0),this.processor.onaudioprocess=null,this.connect(this.processor);for(var n=0,i=t.length;n<i&&!(n>=this.sources.length);n++){var s=this.sources[n],o=t[n];s.ready(this.processor),this.envelopegenerator.ready(n,s.INPUT,s.OUTPUT),this.glide.ready(o),this.glide.start(s.INPUT,r),s.start(r)}return this.envelopegenerator.start(r),this.on(r),this.runningAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.runningAnalyser=!0),this.processor.onaudioprocess=function(t){var r=t.inputBuffer.getChannelData(0),n=t.inputBuffer.getChannelData(1),i=t.outputBuffer.getChannelData(0),s=t.outputBuffer.getChannelData(1);if(e.envelopegenerator.paused()){for(var o=e.context.currentTime,a=0,u=e.sources;a<u.length;a++){u[a].stop(o)}e.off(o),e.analyser.stop("time"),e.analyser.stop("fft"),e.runningAnalyser=!1,e.processor.disconnect(0),e.processor.onaudioprocess=null}else i.set(r),s.set(n)},this},e.prototype.stop=function(){var t=this.context.currentTime+this.startTime+this.duration;return this.envelopegenerator.stop(t,!1),this.glide.stop(),this.filter.stop(t),this},e.prototype.param=function(t){if("string"==typeof t)return"mastervolume"===t?this.mastervolume.gain.value:this;for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];if("mastervolume"===i)"number"==typeof s&&(this.mastervolume.gain.value=s)}return this},e.prototype.get=function(t){return"number"==typeof t&&t>=0&&t<this.sources.length?this.sources[t]:this.sources},e.prototype.length=function(){return this.sources.length},e.prototype.module=function(t){switch(t){case"analyser":return this.analyser;case"recorder":return this.recorder;case"session":return this.session;case"autopanner":return this.autopanner;case"chorus":return this.chorus;case"compressor":return this.compressor;case"delay":return this.delay;case"distortion":return this.distortion;case"equalizer":return this.equalizer;case"filter":return this.filter;case"flanger":return this.flanger;case"listener":return this.listener;case"panner":return this.panner;case"phaser":return this.phaser;case"pitchshifter":return this.pitchshifter;case"reverb":return this.reverb;case"ringmodulator":return this.ringmodulator;case"stereo":return this.stereo;case"tremolo":return this.tremolo;case"wah":return this.wah;case"envelopegenerator":return this.envelopegenerator;case"glide":return this.glide;default:return null}},e.prototype.resize=function(e){return t.prototype.init.call(this,this.context,e),this},e.prototype.on=function(e){return t.prototype.on.call(this,e),this},e.prototype.off=function(e){return t.prototype.off.call(this,e),this},e.prototype.suspend=function(){return t.prototype.suspend.call(this),this},e.prototype.params=function(){var e=t.prototype.params.call(this);return s(s({},e),{oscillator:{glide:this.glide.params(),params:this.sources.map((function(t){return t.params()}))}})},e}(o.SoundModule);e.OscillatorModule=c},6954:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ProcessorModule=void 0;var s=r(2188),o=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.worklet=null,n.workletName="",n.options={},n.moduleURL="",n.runningAnalyser=!1,n.envelopegenerator.setGenerator(0),window.AudioWorkletNode||(n.worklet=n.context.createScriptProcessor(r,s.SoundModule.NUMBER_OF_INPUTS,s.SoundModule.NUMBER_OF_OUTPUTS)),n}return i(e,t),e.prototype.setup=function(t,e){return this.workletName=t,this.options=null!=e?e:{},this},e.prototype.ready=function(t,e){var r=this;return window.AudioWorkletNode?(this.moduleURL=t,this.context.audioWorklet.addModule(this.moduleURL,null!=e?e:{credentials:"same-origin"}).then((function(){r.worklet=new AudioWorkletNode(r.context,r.workletName,r.options)}))):Promise.reject()},e.prototype.start=function(t){var e=this.envelopegenerator.getGenerator(0);if(null===this.worklet||null===e)return this;var r=this.context.currentTime;return this.envelopegenerator.clear(!0),this.worklet.disconnect(0),this.worklet instanceof ScriptProcessorNode&&(this.worklet.onaudioprocess=null),this.connect(e),this.envelopegenerator.ready(0,this.worklet,null),this.envelopegenerator.start(r),this.runningAnalyser||(this.analyser.start("time"),this.analyser.start("fft"),this.runningAnalyser=!0),this.on(r),this.worklet instanceof ScriptProcessorNode&&t&&(this.worklet.onaudioprocess=t),this},e.prototype.stop=function(){if(null===this.worklet)return this;var t=this.context.currentTime;return this.worklet.disconnect(0),this.envelopegenerator.stop(t),this.off(t),this},e.prototype.postMessage=function(t){return null===this.worklet||this.worklet instanceof ScriptProcessorNode||this.worklet.port.postMessage(t),this},e.prototype.onMessage=function(t){return null===this.worklet||this.worklet instanceof ScriptProcessorNode||(this.worklet.port.onmessage=t),this},e.prototype.onMessageError=function(t){return null===this.worklet||this.worklet instanceof ScriptProcessorNode||(this.worklet.port.onmessageerror=t),this},e.prototype.map=function(){return null===this.worklet||this.worklet instanceof ScriptProcessorNode?null:this.worklet.parameters},e.prototype.get=function(){return this.worklet},e.prototype.module=function(t){switch(t){case"analyser":return this.analyser;case"recorder":return this.recorder;case"session":return this.session;case"autopanner":return this.autopanner;case"chorus":return this.chorus;case"compressor":return this.compressor;case"delay":return this.delay;case"distortion":return this.distortion;case"equalizer":return this.equalizer;case"filter":return this.filter;case"flanger":return this.flanger;case"listener":return this.listener;case"panner":return this.panner;case"phaser":return this.phaser;case"pitchshifter":return this.pitchshifter;case"reverb":return this.reverb;case"ringmodulator":return this.ringmodulator;case"stereo":return this.stereo;case"tremolo":return this.tremolo;case"wah":return this.wah;case"envelopegenerator":return this.envelopegenerator;default:return null}},e.prototype.resize=function(e){return t.prototype.init.call(this,this.context,e),this},e.prototype.on=function(e){return t.prototype.on.call(this,e),this},e.prototype.off=function(e){return t.prototype.off.call(this,e),this},e.prototype.suspend=function(){return t.prototype.suspend.call(this),this},e}(s.SoundModule);e.ProcessorModule=o},6354:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.FFT=void 0;var s=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.type="uint",n.size=256,n.textInterval=1e3,n}return i(e,t),e.prototype.setup=function(e){return t.prototype.setup.call(this,e),this},e.prototype.param=function(e){if("string"==typeof e)switch(e){case"type":return this.type;case"size":return this.size;case"textInterval":return this.textInterval;case"interval":case"styles":return t.prototype.param.call(this,e);default:return this}for(var r=0,n=Object.entries(e);r<n.length;r++){var i=n[r],s=i[0],o=i[1];switch(s){case"type":"string"==typeof o&&("uint"!==o&&"float"!==o||(this.type=o));break;case"size":"number"==typeof o&&(this.size=o);break;case"textInterval":"number"==typeof o&&(this.textInterval=o)}}return t.prototype.param.call(this,e),this},e.prototype.clear=function(){return t.prototype.clear.call(this),this},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e.prototype.visualizeOnCanvas=function(t,e,r){var n,i,s,o,a,u,c,l,h,p,f,d;if(null!==this.canvas&&null!==this.context&&this.isActive){var v=null!=e?e:-100,y=null!=r?r:-30,m=y-v,b=this.context,g=this.canvas.width,w=this.canvas.height,T=null!==(n=this.styles.top)&&void 0!==n?n:0,k=null!==(i=this.styles.bottom)&&void 0!==i?i:0,_=null!==(s=this.styles.left)&&void 0!==s?s:30,A=g-(_+(null!==(o=this.styles.right)&&void 0!==o?o:30)),S=w-(T+k),O=null!==(a=this.styles.width)&&void 0!==a?a:1.5,M=null!==(u=this.styles.cap)&&void 0!==u?u:"round",x=null!==(c=this.styles.join)&&void 0!==c?c:"miter",E=null!==(l=this.styles.wave)&&void 0!==l?l:"rgba(0, 0, 255, 1.0)",C=null!==(h=this.styles.grid)&&void 0!==h?h:"none",P=null!==(p=this.styles.text)&&void 0!==p?p:"none",R=parseInt(null!==(d=null===(f=this.styles.font)||void 0===f?void 0:f.size)&&void 0!==d?d:"13px",10),j=this.size>t.length?t.length:this.size,N=this.sampleRate/(2*t.length),I=Math.trunc(this.textInterval/N);if(b.clearRect(0,0,g,w),"float"===this.type){b.strokeStyle=E,b.lineWidth=O,b.lineCap=M,b.lineJoin=x,b.beginPath();for(var F=0;F<j;F++){var q=F/j*A+_,D=Math.abs(t[F]-y)*(S/m)+T;0===F?b.moveTo(q+O/2,D):b.lineTo(q,D)}b.stroke()}else switch(this.styles.shape){case"line":b.strokeStyle=E,b.lineWidth=O,b.lineCap=M,b.lineJoin=x,b.beginPath();for(F=0;F<j;F++){q=F/j*A+_,D=(1-t[F]/255)*S+T;0===F?b.moveTo(q+O/2,D):b.lineTo(q,D)}b.stroke();break;case"rect":for(F=0;F<j;F++){q=F/j*A+_,D=t[F]/255*S*-1;if(this.styles.gradients){for(var L=S+T,U=b.createLinearGradient(0,L,0,L+D),B=0,z=this.styles.gradients;B<z.length;B++){var G=z[B];U.addColorStop(G.offset,G.color)}b.fillStyle=U}else b.fillStyle=E;b.fillRect(q,S+T,O,D)}}if("none"!==C||"none"!==P){for(F=0;F<j;F++)if(F%I==0){q=Math.trunc(F/j*A)+_;var X=Math.trunc(this.textInterval*(F/I)),Q=X<1e3?"".concat(X," Hz"):"".concat(String(X/1e3).slice(0,3)," kHz");"none"!==C&&(b.fillStyle=C,b.fillRect(q,T,1,S)),"none"!==P&&(b.fillStyle=P,b.font=this.createFontString(),b.fillText(Q,q-b.measureText(Q).width/2,T+S+R))}if("float"===this.type)for(F=v;F<=y;F+=10){Q="".concat(F," dB"),q=Math.trunc(_-b.measureText(Q).width),D=Math.trunc(-1*(F-y)/m*S)+T;"none"!==C&&(b.fillStyle=C,b.fillRect(_,D,A,1)),"none"!==P&&(b.fillStyle=P,b.font=this.createFontString(),b.fillText(Q,q,D))}else for(var V=0,W=["0.00","0.25","0.50","0.75","1.00"];V<W.length;V++){Q=W[V],q=Math.trunc(_-b.measureText(Q).width),D=(1-parseFloat(Q))*S+T;"none"!==C&&(b.fillStyle=C,b.fillRect(_,D,A,1)),"none"!==P&&(b.fillStyle=P,b.font=this.createFontString(),b.fillText(Q,q,D-Math.trunc(R)))}}}},e.prototype.visualizeBySVG=function(t,r,n){var i,s,o,a,u,c,l,h,p,f,d,v,y,m,b,g,w,T,k,_,A,S,O,M,x,E,C,P,R,j,N,I;if(null!==this.svg&&this.isActive){var F=null!=r?r:-100,q=null!=n?n:-30,D=q-F,L=this.svg,U=parseInt(null!==(i=L.getAttribute("width"))&&void 0!==i?i:"0",10),B=parseInt(null!==(s=L.getAttribute("height"))&&void 0!==s?s:"0",10),z=null!==(o=this.styles.top)&&void 0!==o?o:0,G=null!==(a=this.styles.bottom)&&void 0!==a?a:0,X=null!==(u=this.styles.left)&&void 0!==u?u:30,Q=U-(X+(null!==(c=this.styles.right)&&void 0!==c?c:30)),V=B-(z+G),W=null!==(l=this.styles.wave)&&void 0!==l?l:"rgba(0, 0, 255, 1.0)",H=null!==(h=this.styles.width)&&void 0!==h?h:1.5,Y=null!==(p=this.styles.cap)&&void 0!==p?p:"round",Z=null!==(f=this.styles.join)&&void 0!==f?f:"miter",J=null!==(d=this.styles.grid)&&void 0!==d?d:"none",$=null!==(v=this.styles.text)&&void 0!==v?v:"none",K=parseInt(null!==(m=null===(y=this.styles.font)||void 0===y?void 0:y.size)&&void 0!==m?m:"13px",10),tt=this.size>t.length?t.length:this.size,et=this.sampleRate/(2*t.length),rt=Math.trunc(this.textInterval/et);if(L.innerHTML="","float"===this.type){for(var nt=document.createElementNS(e.XMLNS,"path"),it="",st=0;st<tt;st++){var ot=Math.trunc(st/tt*Q)+X,at=Math.trunc(-1*(t[st]-q)*(V/D))+z;it+=0===st?"M".concat(ot+H/2," ").concat(at):" L".concat(ot," ").concat(at)}nt.setAttribute("d",it),nt.setAttribute("stroke",W),nt.setAttribute("fill","none"),nt.setAttribute("stroke-width",H.toString(10)),nt.setAttribute("stroke-linecap",Y),nt.setAttribute("stroke-linejoin",Z),L.appendChild(nt)}else switch(this.styles.shape){case"line":for(nt=document.createElementNS(e.XMLNS,"path"),it="",st=0;st<tt;st++){ot=Math.trunc(st/tt*Q)+X,at=Math.trunc((1-t[st]/255)*V)+z;it+=0===st?"M".concat(ot+H/2," ").concat(at):" L".concat(ot," ").concat(at)}nt.setAttribute("d",it),nt.setAttribute("stroke",W),nt.setAttribute("fill","none"),nt.setAttribute("stroke-width",H.toString(10)),nt.setAttribute("stroke-linecap",Y),nt.setAttribute("stroke-linejoin",Z),L.appendChild(nt);break;case"rect":var ut=null;this.styles.gradients&&(ut=this.createSVGLinearGradient("".concat(e.SVG_LINEAR_GRADIENT_ID_FFT,"-").concat(this.channel)));var ct=document.createElementNS(e.XMLNS,"g");null!==ut&&ct.appendChild(ut);for(st=0;st<tt;st++){var lt=document.createElementNS(e.XMLNS,"rect");ot=Math.trunc(st/tt*Q)+X,at=Math.trunc(t[st]/255*V);lt.setAttribute("x",ot.toString(10)),lt.setAttribute("y",(z+V).toString(10)),lt.setAttribute("width",H.toString(10)),lt.setAttribute("height",Math.abs(at).toString(10)),at>=0&<.setAttribute("transform","rotate(180 ".concat(ot+H/2," ").concat(z+V,")")),lt.setAttribute("stroke","none"),lt.setAttribute("fill",null===ut?W:"url(#".concat(e.SVG_LINEAR_GRADIENT_ID_FFT,"-").concat(this.channel,")")),ct.appendChild(lt)}L.appendChild(ct)}if("none"!==J||"none"!==$){for(st=0;st<tt;st++)if(st%rt==0){ot=Math.trunc(st/tt*Q)+X;var ht=Math.trunc(this.textInterval*(st/rt)),pt=ht<1e3?"".concat(ht," Hz"):"".concat(String(ht/1e3).slice(0,3)," kHz");if("none"!==J)(lt=document.createElementNS(e.XMLNS,"rect")).setAttribute("x",ot.toString(10)),lt.setAttribute("y",z.toString(10)),lt.setAttribute("width","1"),lt.setAttribute("height",V.toString(10)),lt.setAttribute("stroke","none"),lt.setAttribute("fill",J),L.appendChild(lt);if("none"!==$)(vt=document.createElementNS(e.XMLNS,"text")).textContent=pt,vt.setAttribute("x",ot.toString(10)),vt.setAttribute("y",(z+V+K).toString(10)),vt.setAttribute("text-anchor","middle"),vt.setAttribute("stroke","none"),vt.setAttribute("fill",$),vt.setAttribute("font-family",null!==(g=null===(b=this.styles.font)||void 0===b?void 0:b.family)&&void 0!==g?g:"Arial"),vt.setAttribute("font-size",K.toString(10)),vt.setAttribute("font-style",null!==(T=null===(w=this.styles.font)||void 0===w?void 0:w.style)&&void 0!==T?T:"normal"),vt.setAttribute("font-weight",null!==(_=null===(k=this.styles.font)||void 0===k?void 0:k.weight)&&void 0!==_?_:"normal"),L.appendChild(vt)}if("float"===this.type)for(st=F;st<=q;st+=10){pt="".concat(st,"dB"),ot=X,at=Math.trunc(-1*(st-q)/D*V)+z;if("none"!==J)(lt=document.createElementNS(e.XMLNS,"rect")).setAttribute("x",ot.toString(10)),lt.setAttribute("y",at.toString(10)),lt.setAttribute("width",Q.toString(10)),lt.setAttribute("height","1"),lt.setAttribute("stroke","none"),lt.setAttribute("fill",J),L.appendChild(lt);if("none"!==J)(vt=document.createElementNS(e.XMLNS,"text")).textContent=pt,vt.setAttribute("x",ot.toString(10)),vt.setAttribute("y",(at-Math.trunc(K/4)).toString(10)),vt.setAttribute("text-anchor","end"),vt.setAttribute("stroke","none"),vt.setAttribute("fill",$),vt.setAttribute("font-family",null!==(S=null===(A=this.styles.font)||void 0===A?void 0:A.family)&&void 0!==S?S:"Arial"),vt.setAttribute("font-size",K.toString(10)),vt.setAttribute("font-style",null!==(M=null===(O=this.styles.font)||void 0===O?void 0:O.style)&&void 0!==M?M:"normal"),vt.setAttribute("font-weight",null!==(E=null===(x=this.styles.font)||void 0===x?void 0:x.weight)&&void 0!==E?E:"normal"),L.appendChild(vt)}else for(var ft=0,dt=["0.00","0.25","0.50","0.75","1.00"];ft<dt.length;ft++){var vt;pt=dt[ft],ot=X,at=(1-parseFloat(pt))*V+z;if("none"!==J)(lt=document.createElementNS(e.XMLNS,"rect")).setAttribute("x",ot.toString(10)),lt.setAttribute("y",at.toString(10)),lt.setAttribute("width",Q.toString(10)),lt.setAttribute("height","1"),lt.setAttribute("stroke","none"),lt.setAttribute("fill",J),L.appendChild(lt);if("none"!==$)(vt=document.createElementNS(e.XMLNS,"text")).textContent=pt,vt.setAttribute("x",ot.toString(10)),vt.setAttribute("y",(at-Math.trunc(K/4)).toString(10)),vt.setAttribute("text-anchor","end"),vt.setAttribute("stroke","none"),vt.setAttribute("fill",$),vt.setAttribute("font-family",null!==(P=null===(C=this.styles.font)||void 0===C?void 0:C.family)&&void 0!==P?P:"Arial"),vt.setAttribute("font-size",K.toString(10)),vt.setAttribute("font-style",null!==(j=null===(R=this.styles.font)||void 0===R?void 0:R.style)&&void 0!==j?j:"normal"),vt.setAttribute("font-weight",null!==(I=null===(N=this.styles.font)||void 0===N?void 0:N.weight)&&void 0!==I?I:"normal"),L.appendChild(vt)}}}},e}(r(1386).Visualizer);e.FFT=s},235:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Time=void 0;var s=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.type="uint",n.textInterval=.005,n}return i(e,t),e.prototype.setup=function(e){return t.prototype.setup.call(this,e),this},e.prototype.param=function(e){if("string"==typeof e)switch(e){case"type":return this.type;case"textInterval":return this.textInterval;case"interval":case"styles":return t.prototype.param.call(this,e);default:return this}for(var r=0,n=Object.entries(e);r<n.length;r++){var i=n[r],s=i[0],o=i[1];switch(s){case"type":"string"==typeof o&&("uint"!==o&&"float"!==o||(this.type=o));break;case"textInterval":"number"==typeof o&&(this.textInterval=o)}}return t.prototype.param.call(this,e),this},e.prototype.clear=function(){return t.prototype.clear.call(this),this},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e.prototype.visualizeOnCanvas=function(t,e,r){var n,i,s,o,a,u,c,l,h,p,f,d;if(null!==this.canvas&&null!==this.context&&this.isActive){var v=this.context,y=this.canvas.width,m=this.canvas.height,b=null!==(n=this.styles.top)&&void 0!==n?n:15,g=null!==(i=this.styles.bottom)&&void 0!==i?i:15,w=null!==(s=this.styles.left)&&void 0!==s?s:30,T=y-(w+(null!==(o=this.styles.right)&&void 0!==o?o:30)),k=m-(b+g),_=Math.trunc(k/2)+b,A=null!==(a=this.styles.width)&&void 0!==a?a:1.5,S=null!==(u=this.styles.cap)&&void 0!==u?u:"round",O=null!==(c=this.styles.join)&&void 0!==c?c:"miter",M=null!==(l=this.styles.wave)&&void 0!==l?l:"rgba(0, 0, 255, 1.0)",x=null!==(h=this.styles.grid)&&void 0!==h?h:"none",E=null!==(p=this.styles.text)&&void 0!==p?p:"none",C=parseInt(null!==(d=null===(f=this.styles.font)||void 0===f?void 0:f.size)&&void 0!==d?d:"13px",10),P=Math.trunc(this.textInterval*this.sampleRate);if(v.clearRect(0,0,y,m),"float"===this.type)t instanceof Float32Array&&this.visualizeTimeDomainFloat32ArrayOnCanvas(v,t,T,k,_);else switch(this.styles.shape){case"line":v.strokeStyle=M,v.lineWidth=A,v.lineCap=S,v.lineJoin=O,v.beginPath();for(var R=0,j=t.length;R<j;R++){var N=R/j*T+w,I=(1-t[R]/255)*k+b;0===R?v.moveTo(N+y/2,I):v.lineTo(N,I)}v.stroke();break;case"rect":for(R=0,j=t.length;R<j;R++){N=R/j*T+w,I=(.5-t[R]/255)*k;if(this.styles.gradients){for(var F=k/2+b,q=v.createLinearGradient(0,F,0,F+I),D=0,L=this.styles.gradients;D<L.length;D++){var U=L[D];q.addColorStop(U.offset,U.color)}v.fillStyle=q}else v.fillStyle=M;v.fillRect(N,_,1,I)}}if("none"!==x||"none"!==E){for(R=0,j=t.length;R<j;R++)if(R%P==0){N=Math.trunc(R/j*T)+w;var B="".concat(Math.trunc(R/this.sampleRate*1e3)," ms");"none"!==x&&(v.fillStyle=x,v.fillRect(N,b,1,k)),"none"!==E&&(v.fillStyle=E,v.font=this.createFontString(),v.fillText(B,N-v.measureText(B).width/2,b+k+C))}for(var z=0,G=["-1.00","-0.50"," 0.00"," 0.50"," 1.00"];z<G.length;z++){B=G[z],N=Math.trunc(w-v.measureText(B).width),I=Math.trunc((1-parseFloat(B.trim()))*(k/2))+b;"none"!==x&&(v.fillStyle=x,v.fillRect(w,I,T,1)),"none"!==E&&(v.fillStyle=E,v.font=this.createFontString(),v.fillText(B,N,I-Math.trunc(C/4)))}}}},e.prototype.visualizeBySVG=function(t,r,n){var i,s,o,a,u,c,l,h,p,f,d,v,y,m,b,g,w,T,k,_,A,S,O,M,x,E;if(null!==this.svg&&this.isActive){var C=this.svg,P=parseInt(null!==(i=C.getAttribute("width"))&&void 0!==i?i:"0",10),R=parseInt(null!==(s=C.getAttribute("height"))&&void 0!==s?s:"0",10),j=null!==(o=this.styles.top)&&void 0!==o?o:15,N=null!==(a=this.styles.bottom)&&void 0!==a?a:15,I=null!==(u=this.styles.left)&&void 0!==u?u:30,F=P-(I+(null!==(c=this.styles.right)&&void 0!==c?c:30)),q=R-(j+N),D=Math.trunc(q/2)+j,L=null!==(l=this.styles.width)&&void 0!==l?l:1.5,U=null!==(h=this.styles.cap)&&void 0!==h?h:"round",B=null!==(p=this.styles.join)&&void 0!==p?p:"miter",z=null!==(f=this.styles.wave)&&void 0!==f?f:"rgba(0, 0, 255, 1.0)",G=null!==(d=this.styles.grid)&&void 0!==d?d:"none",X=null!==(v=this.styles.text)&&void 0!==v?v:"none",Q=parseInt(null!==(m=null===(y=this.styles.font)||void 0===y?void 0:y.size)&&void 0!==m?m:"13px",10),V=Math.trunc(this.textInterval*this.sampleRate);if(C.innerHTML="","float"===this.type){if(t instanceof Float32Array){var W=this.visualizeTimeDomainFloat32ArrayBySVG(t,F,q,D,0,e.SVG_LINEAR_GRADIENT_ID_TIME);null!==W&&C.appendChild(W)}}else switch(this.styles.shape){case"line":for(var H=document.createElementNS(e.XMLNS,"path"),Y="",Z=0,J=t.length;Z<J;Z++){var $=Z/J*F+I,K=(1-t[Z]/255)*q+j;Y+=0===Z?"M".concat($+L/2," ").concat(K):" L".concat($," ").concat(K)}H.setAttribute("d",Y),H.setAttribute("stroke",z),H.setAttribute("fill","none"),H.setAttribute("stroke-width",L.toString(10)),H.setAttribute("stroke-linecap",U),H.setAttribute("stroke-linejoin",B),C.appendChild(H);break;case"rect":var tt=null;this.styles.gradients&&(tt=this.createSVGLinearGradient("".concat(e.SVG_LINEAR_GRADIENT_ID_TIME,"-").concat(this.channel)));var et=document.createElementNS(e.XMLNS,"g");null!==tt&&et.appendChild(tt);for(Z=0,J=t.length;Z<J;Z++){var rt=document.createElementNS(e.XMLNS,"rect");$=Z/J*F+I,K=(t[Z]/255-.5)*q;rt.setAttribute("x",$.toString(10)),rt.setAttribute("y",D.toString(10)),rt.setAttribute("width",L.toString(10)),rt.setAttribute("height",Math.abs(K).toString(10)),K>=0&&rt.setAttribute("transform","rotate(180 ".concat($+L/2," ").concat(D,")")),rt.setAttribute("stroke","none"),rt.setAttribute("fill",null===tt?z:"url(#".concat(e.SVG_LINEAR_GRADIENT_ID_TIME,"-").concat(this.channel,")")),et.appendChild(rt)}C.appendChild(et)}if("none"!==G||"none"!==X){for(Z=0,J=t.length;Z<J;Z++)if(Z%V==0){$=Math.trunc(Z/J*F)+I;var nt="".concat(Math.trunc(Z/this.sampleRate*1e3)," ms");if("none"!==G)(rt=document.createElementNS(e.XMLNS,"rect")).setAttribute("x",$.toString(10)),rt.setAttribute("y",j.toString(10)),rt.setAttribute("width","1"),rt.setAttribute("height",q.toString(10)),rt.setAttribute("stroke","none"),rt.setAttribute("fill",G),C.appendChild(rt);if("none"!==X)(ot=document.createElementNS(e.XMLNS,"text")).textContent=nt,ot.setAttribute("x",$.toString(10)),ot.setAttribute("y",(j+q+Q).toString(10)),ot.setAttribute("text-anchor","middle"),ot.setAttribute("stroke","none"),ot.setAttribute("fill",X),ot.setAttribute("font-family",null!==(g=null===(b=this.styles.font)||void 0===b?void 0:b.family)&&void 0!==g?g:"Arial"),ot.setAttribute("font-size",Q.toString(10)),ot.setAttribute("font-style",null!==(T=null===(w=this.styles.font)||void 0===w?void 0:w.style)&&void 0!==T?T:"normal"),ot.setAttribute("font-weight",null!==(_=null===(k=this.styles.font)||void 0===k?void 0:k.weight)&&void 0!==_?_:"normal"),C.appendChild(ot)}for(var it=0,st=["-1.00","-0.50"," 0.00"," 0.50"," 1.00"];it<st.length;it++){var ot;nt=st[it],$=I,K=Math.trunc((1-parseFloat(nt.trim()))*(q/2))+j;if("none"!==G)(rt=document.createElementNS(e.XMLNS,"rect")).setAttribute("x",$.toString(10)),rt.setAttribute("y",K.toString(10)),rt.setAttribute("width",F.toString(10)),rt.setAttribute("height","1"),rt.setAttribute("stroke","none"),rt.setAttribute("fill",G),C.appendChild(rt);if("none"!==X)(ot=document.createElementNS(e.XMLNS,"text")).textContent=nt,ot.setAttribute("x",$.toString(10)),ot.setAttribute("y",(K-Math.trunc(Q/4)).toString(10)),ot.setAttribute("text-anchor","end"),ot.setAttribute("stroke","none"),ot.setAttribute("fill",X),ot.setAttribute("font-family",null!==(S=null===(A=this.styles.font)||void 0===A?void 0:A.family)&&void 0!==S?S:"Arial"),ot.setAttribute("font-size",Q.toString(10)),ot.setAttribute("font-style",null!==(M=null===(O=this.styles.font)||void 0===O?void 0:O.style)&&void 0!==M?M:"normal"),ot.setAttribute("font-weight",null!==(E=null===(x=this.styles.font)||void 0===x?void 0:x.weight)&&void 0!==E?E:"normal"),C.appendChild(ot)}}}},e}(r(1386).Visualizer);e.Time=s},9076:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__assign||function(){return s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.TimeOverview=void 0;var o=r(1386),a="xsound-svg-current-time",u="xsound-svg-sprite",c=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.callback=function(){},n.currentImageData=null,n.currentSVGElement=null,n.currentDataSize=0,n.currentTime={width:1,color:"rgba(0, 0, 0, 0.5)"},n.sprite="rgba(255, 255, 255, 0.25)",n.plotInterval=.0625,n.textInterval=60,n.isDown=!1,n.mode="update",n.offsetX=0,n.startTime=0,n.endTime=0,n.onMouseStart=n.onMouseStart.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.onMouseUp=n.onMouseUp.bind(n),n.onTouchStart=n.onTouchStart.bind(n),n.onTouchMove=n.onTouchMove.bind(n),n.onTouchEnd=n.onTouchEnd.bind(n),n}return i(e,t),e.prototype.setup=function(e){return t.prototype.setup.call(this,e),this},e.prototype.param=function(e){if("string"==typeof e)switch(e){case"currentTime":return this.currentTime;case"sprite":return this.sprite;case"plotInterval":return this.plotInterval;case"textInterval":return this.textInterval;case"mode":return this.mode;case"interval":case"styles":return t.prototype.param.call(this,e);default:return this}for(var r=0,n=Object.entries(e);r<n.length;r++){var i=n[r],o=i[0],a=i[1];switch(o){case"currentTime":"object"==typeof a&&(this.currentTime=s(s({},this.currentTime),a));break;case"sprite":"string"==typeof a&&(this.sprite=a);break;case"plotInterval":"number"==typeof a&&(this.plotInterval=a);break;case"textInterval":"number"==typeof a&&(this.textInterval=a);break;case"mode":"string"==typeof a&&("update"!==a&&"sprite"!==a||(this.mode=a))}}return t.prototype.param.call(this,e),this},e.prototype.update=function(t){var r,n,i,s,o,c,l,h,p,f,d,v,y;switch(this.graphics){case"canvas":if(null===this.currentImageData)return this;if(null===this.canvas||null===this.context)return this;var m=this.context,b=this.canvas.width,g=this.canvas.height,w=b-((null!==(r=this.styles.left)&&void 0!==r?r:30)+(null!==(n=this.styles.right)&&void 0!==n?n:30)),T=g-((null!==(i=this.styles.top)&&void 0!==i?i:15)+(null!==(s=this.styles.bottom)&&void 0!==s?s:15)),k=t*this.sampleRate/this.currentDataSize*w,_=null!==(o=this.styles.left)&&void 0!==o?o:30,A=null!==(c=this.styles.top)&&void 0!==c?c:15,S=null!==(l=this.currentTime.color)&&void 0!==l?l:"rgba(0, 0, 0, 0.5)";switch(m.clearRect(0,0,b,g),m.putImageData(this.currentImageData,0,0),this.mode){case"update":m.fillStyle=S,m.fillRect(_,A+1,k,T-1);break;case"sprite":if(0!==this.endTime){var O=Math.trunc(Math.abs(this.endTime-this.startTime)*this.sampleRate/this.currentDataSize*w);m.fillStyle=this.sprite,k>=this.offsetX?m.fillRect(_+this.offsetX,A+1,O,T-1):m.fillRect(_+this.offsetX-O,A+1,O,T-1)}m.fillStyle=S,k>=this.offsetX?m.fillRect(_+this.offsetX,A+1,Math.abs(k-this.offsetX),T-1):m.fillRect(_+k,A+1,Math.abs(k-this.offsetX),T-1)}break;case"svg":if(null===this.currentSVGElement)return this;if(this.svg){var M=this.svg.querySelector(".".concat(a));if(null===M)return this;b=parseInt(null!==(h=this.svg.getAttribute("width"))&&void 0!==h?h:"0",10),A=null!==(p=this.styles.top)&&void 0!==p?p:15,w=b-((_=null!==(f=this.styles.left)&&void 0!==f?f:30)+(null!==(d=this.styles.right)&&void 0!==d?d:30)),k=t*this.sampleRate/this.currentDataSize*w;if("update"===this.mode)M.setAttribute("x",_.toString(10)),M.setAttribute("width",k.toString(10)),M.setAttribute("aria-label","current time");else if("sprite"===this.mode){if(0!==this.endTime){var x=this.svg.querySelector(".".concat(u));x&&(null===(v=x.parentNode)||void 0===v||v.removeChild(x));var E=document.createElementNS(e.XMLNS,"rect");E.classList.add(u);O=Math.trunc(Math.abs(this.endTime-this.startTime)*this.sampleRate/this.currentDataSize*w);E.setAttribute("y",(A+1).toString(10)),E.setAttribute("height",null!==(y=M.getAttribute("height"))&&void 0!==y?y:"0"),E.setAttribute("stroke","none"),E.setAttribute("fill",this.sprite),E.setAttribute("aria-label","current time"),k>=this.offsetX?E.setAttribute("x",(_+this.offsetX).toString(10)):E.setAttribute("x",(_+this.offsetX-O).toString(10)),E.setAttribute("width",O.toString(10)),this.svg.appendChild(E),this.svg.appendChild(M)}k>=this.offsetX?M.setAttribute("x",(_+this.offsetX).toString(10)):M.setAttribute("x",(_+k).toString(10)),M.setAttribute("width",Math.abs(k-this.offsetX).toString(10)),M.setAttribute("aria-label","sprite time")}}}return this},e.prototype.drag=function(t){var e=null;switch(this.graphics){case"canvas":if(null===this.canvas)return this;e=this.canvas;break;case"svg":if(null===this.svg)return this;e=this.svg;break;default:return this}return null===e||(t&&(this.callback=t),e.removeEventListener("mousedown",{handleEvent:this.onMouseStart},!1),e.removeEventListener("mousemove",{handleEvent:this.onMouseMove},!1),window.removeEventListener("mouseup",{handleEvent:this.onMouseUp},!1),e.removeEventListener("touchstart",{handleEvent:this.onTouchStart},!1),e.removeEventListener("touchmove",{handleEvent:this.onTouchMove},!1),window.removeEventListener("touchend",{handleEvent:this.onTouchEnd},!1),e.addEventListener("mousedown",{handleEvent:this.onMouseStart},!1),e.addEventListener("mousemove",{handleEvent:this.onMouseMove},!1),window.addEventListener("mouseup",{handleEvent:this.onMouseUp},!1),e.addEventListener("touchstart",{handleEvent:this.onTouchStart},!1),e.addEventListener("touchmove",{handleEvent:this.onTouchMove},!1),window.addEventListener("touchend",{handleEvent:this.onTouchEnd},!1)),this},e.prototype.clear=function(){return t.prototype.clear.call(this),this},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e.prototype.visualizeOnCanvas=function(t,e,r){var n,i,s,o,a,u,c,l,h;if(null!==this.canvas&&null!==this.context&&this.isActive){var p=this.context,f=this.canvas.width,d=this.canvas.height,v=null!==(n=this.styles.top)&&void 0!==n?n:15,y=null!==(i=this.styles.bottom)&&void 0!==i?i:15,m=null!==(s=this.styles.left)&&void 0!==s?s:30,b=f-(m+(null!==(o=this.styles.right)&&void 0!==o?o:30)),g=d-(v+y),w=Math.trunc(g/2)+v,T=null!==(a=this.styles.grid)&&void 0!==a?a:"none",k=null!==(u=this.styles.text)&&void 0!==u?u:"none",_=parseInt(null!==(l=null===(c=this.styles.font)||void 0===c?void 0:c.size)&&void 0!==l?l:"13px",10),A=Math.trunc(this.plotInterval*this.sampleRate),S=Math.trunc(this.textInterval*this.sampleRate);if(p.clearRect(0,0,f,d),this.visualizeTimeDomainFloat32ArrayOnCanvas(p,t,b,g,w,A),"none"!==T||"none"!==k){for(var O=0,M=t.length;O<M;O++)if(O%S==0){var x=Math.trunc(O/M*b)+m,E="".concat(Math.trunc(O/this.sampleRate/60)," min");"none"!==T&&(p.fillStyle=T,p.fillRect(x,v,1,g)),"none"!==k&&(p.fillStyle=k,p.font=this.createFontString(),p.fillText(E,x-p.measureText(E).width/2,v+g+_))}for(var C=0,P=["-1.00","-0.50"," 0.00"," 0.50"," 1.00"];C<P.length;C++){E=P[C],x=Math.trunc(m-p.measureText(E).width);var R=Math.trunc((1-parseFloat(E.trim()))*(g/2))+v;"none"!==T&&(p.fillStyle=T,p.fillRect(m,R,b,1)),"none"!==k&&(p.fillStyle=k,p.font=this.createFontString(),p.fillText(E,x,R-Math.trunc(_/4)))}}this.currentImageData=p.getImageData(0,0,f,d),this.currentDataSize=t.length,p.fillStyle=null!==(h=this.currentTime.color)&&void 0!==h?h:"rgba(0, 0, 0, 0.5)",p.fillRect(m,v,1,g)}},e.prototype.visualizeBySVG=function(t,r,n){var i,s,o,u,c,l,h,p,f,d,v,y,m,b,g,w,T,k,_,A,S,O,M;if(null!==this.svg&&this.isActive){var x=this.svg,E=parseInt(null!==(i=x.getAttribute("width"))&&void 0!==i?i:"0",10),C=parseInt(null!==(s=x.getAttribute("height"))&&void 0!==s?s:"0",10),P=null!==(o=this.styles.top)&&void 0!==o?o:15,R=null!==(u=this.styles.bottom)&&void 0!==u?u:15,j=null!==(c=this.styles.left)&&void 0!==c?c:30,N=E-(j+(null!==(l=this.styles.right)&&void 0!==l?l:30)),I=C-(P+R),F=Math.trunc(I/2)+P,q=null!==(h=this.styles.grid)&&void 0!==h?h:"none",D=null!==(p=this.styles.text)&&void 0!==p?p:"none",L=parseInt(null!==(d=null===(f=this.styles.font)||void 0===f?void 0:f.size)&&void 0!==d?d:"13px",10),U=Math.trunc(this.plotInterval*this.sampleRate),B=Math.trunc(this.textInterval*this.sampleRate);x.innerHTML="";var z=this.visualizeTimeDomainFloat32ArrayBySVG(t,N,I,F,U,"".concat(e.SVG_LINEAR_GRADIENT_ID_TIME_OVERVIEW,"-").concat(this.channel));if(z&&x.appendChild(z),"none"!==q||"none"!==D){for(var G=0,X=t.length;G<X;G++)if(G%B==0){var Q=Math.trunc(G/X*N)+j,V="".concat(Math.trunc(G/this.sampleRate/60)," min");if("none"!==q){var W=document.createElementNS(e.XMLNS,"rect");W.setAttribute("x",Q.toString(10)),W.setAttribute("y",P.toString(10)),W.setAttribute("width","1"),W.setAttribute("height",I.toString(10)),W.setAttribute("stroke","none"),W.setAttribute("fill",q),x.appendChild(W)}if("none"!==D)(Z=document.createElementNS(e.XMLNS,"text")).textContent=V,Z.setAttribute("x",Q.toString(10)),Z.setAttribute("y",(P+I+L).toString(10)),Z.setAttribute("text-anchor","middle"),Z.setAttribute("stroke","none"),Z.setAttribute("fill",D),Z.setAttribute("font-family",null!==(y=null===(v=this.styles.font)||void 0===v?void 0:v.family)&&void 0!==y?y:"Arial"),Z.setAttribute("font-size",L.toString(10)),Z.setAttribute("font-style",null!==(b=null===(m=this.styles.font)||void 0===m?void 0:m.style)&&void 0!==b?b:"normal"),Z.setAttribute("font-weight",null!==(w=null===(g=this.styles.font)||void 0===g?void 0:g.weight)&&void 0!==w?w:"normal"),x.appendChild(Z)}for(var H=0,Y=["-1.00","-0.50"," 0.00"," 0.50"," 1.00"];H<Y.length;H++){V=Y[H],Q=j;var Z,J=Math.trunc((1-parseFloat(V.trim()))*(I/2))+P;if("none"!==q){var $=document.createElementNS(e.XMLNS,"rect");$.setAttribute("x",Q.toString(10)),$.setAttribute("y",J.toString(10)),$.setAttribute("width",N.toString(10)),$.setAttribute("height","1"),$.setAttribute("stroke","none"),$.setAttribute("fill",q),x.appendChild($)}if("none"!==D)(Z=document.createElementNS(e.XMLNS,"text")).textContent=V,Z.setAttribute("x",Q.toString(10)),Z.setAttribute("y",(J-Math.trunc(L/4)).toString(10)),Z.setAttribute("text-anchor","end"),Z.setAttribute("stroke","none"),Z.setAttribute("fill",D),Z.setAttribute("font-family",null!==(k=null===(T=this.styles.font)||void 0===T?void 0:T.family)&&void 0!==k?k:"Arial"),Z.setAttribute("font-size",L.toString(10)),Z.setAttribute("font-style",null!==(A=null===(_=this.styles.font)||void 0===_?void 0:_.style)&&void 0!==A?A:"normal"),Z.setAttribute("font-weight",null!==(O=null===(S=this.styles.font)||void 0===S?void 0:S.weight)&&void 0!==O?O:"normal"),x.appendChild(Z)}}var K=document.createElementNS(e.XMLNS,"rect");K.classList.add(a),K.setAttribute("y",(P+1).toString(10)),K.setAttribute("height",(I-1).toString(10)),K.setAttribute("stroke","none"),K.setAttribute("fill",null!==(M=this.currentTime.color)&&void 0!==M?M:"rgba(0, 0, 0, 0.5)"),x.appendChild(K),this.currentSVGElement=x,this.currentDataSize=t.length}},e.prototype.visualize=function(t,e,r){var n,i,s,o,a,u,c,l,h=0,p=0;switch(this.graphics){case"canvas":if(null===this.canvas)return;h=this.canvas.offsetLeft,p=this.canvas.width;break;case"svg":if(null===this.svg)return;h=null!==(i=null===(n=this.svg.parentElement)||void 0===n?void 0:n.offsetLeft)&&void 0!==i?i:0,p=parseInt(null!==(s=this.svg.getAttribute("width"))&&void 0!==s?s:"0",10)}var f=r-(h+(null!==(o=this.styles.left)&&void 0!==o?o:30));"canvas"===this.graphics&&(null===(a=this.canvas)||void 0===a?void 0:a.parentElement)&&(f+=this.canvas.parentElement.scrollLeft),"svg"===this.graphics&&(null===(u=this.svg)||void 0===u?void 0:u.parentElement)&&(f+=this.svg.parentElement.scrollLeft),f<0&&(f=0),f>(p-=(null!==(c=this.styles.left)&&void 0!==c?c:30)+(null!==(l=this.styles.right)&&void 0!==l?l:30))&&(f=p);var d=f/p*this.currentDataSize/this.sampleRate;"mousedown"!==e&&"touchstart"!==e||(this.offsetX=f,this.startTime=d,this.endTime=0),"mouseup"!==e&&"touchend"!==e||(this.endTime=d),this.update(d),this.startTime<=d?this.callback(t,this.startTime,d,this.mode,!0):this.startTime>d&&this.callback(t,d,this.startTime,this.mode,!1)},e.prototype.onMouseStart=function(t){"mousedown"===t.type&&this.visualize(t,t.type,this.getOffsetX(t)),this.isDown=!0},e.prototype.onMouseMove=function(t){this.isDown&&(t.stopPropagation(),"mousemove"===t.type&&this.visualize(t,t.type,this.getOffsetX(t)))},e.prototype.onMouseUp=function(t){this.isDown&&("mouseup"===t.type&&this.visualize(t,t.type,this.getOffsetX(t)),this.isDown=!1)},e.prototype.onTouchStart=function(t){"touchstart"===t.type&&this.visualize(t,t.type,this.getOffsetX(t)),this.isDown=!0},e.prototype.onTouchMove=function(t){this.isDown&&(t.stopPropagation(),t.preventDefault(),"touchmove"===t.type&&this.visualize(t,t.type,this.getOffsetX(t)))},e.prototype.onTouchEnd=function(t){this.isDown&&("touchend"===t.type&&this.visualize(t,t.type,this.getOffsetX(t)),this.isDown=!1)},e.prototype.getOffsetX=function(t){return t instanceof MouseEvent?t.pageX:t instanceof TouchEvent?t.touches[0].pageX:0},e}(o.Visualizer);e.TimeOverview=c},1386:function(t,e){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.Visualizer=void 0;var n=function(){function t(t,e){this.isActive=!1,this.graphics="",this.canvas=null,this.context=null,this.svg=null,this.interval=1e3,this.styles={shape:"line",gradients:[{offset:0,color:"rgba(0, 128, 255, 1.0)"},{offset:1,color:"rgba(0, 0, 255, 1.0)"}],wave:"rgba(0, 0, 255, 1.0)",grid:"rgba(255, 0, 0, 1.0)",text:"rgba(255, 255, 255, 1.0)",font:{family:"Arial",size:"13px",style:"normal",weight:"normal"},width:1.5,cap:"round",join:"miter",top:15,right:30,bottom:15,left:30},this.sampleRate=t,this.channel=e}return t.prototype.setup=function(t){return t instanceof HTMLCanvasElement?(this.graphics="canvas",this.canvas=t,this.context=this.canvas.getContext("2d")):t instanceof SVGSVGElement&&(this.graphics="svg",this.svg=t),this},t.prototype.start=function(t,e,r){switch(this.graphics){case"canvas":this.visualizeOnCanvas(t,e,r);break;case"svg":this.visualizeBySVG(t,e,r)}return this},t.prototype.param=function(t){if("string"==typeof t)switch(t){case"interval":return this.interval;case"styles":return this.styles;default:return}for(var e=0,n=Object.entries(t);e<n.length;e++){var i=n[e],s=i[0],o=i[1];switch(s){case"interval":"number"==typeof o&&(this.interval=o);break;case"styles":"object"==typeof o&&(this.styles=r(r({},this.styles),o))}}},t.prototype.get=function(){switch(this.graphics){case"canvas":return this.canvas;case"svg":return this.svg;default:return null}},t.prototype.clear=function(){switch(this.graphics){case"canvas":this.canvas&&this.context&&this.context.clearRect(0,0,this.canvas.width,this.canvas.height);break;case"svg":this.svg&&(this.svg.innerHTML="")}return this},t.prototype.create=function(){switch(this.graphics){case"canvas":return null===this.canvas?"":this.canvas.toDataURL("image/png").replace("image/png","image/octet-stream");case"svg":return null===this.svg?"":this.svg.outerHTML;default:return""}},t.prototype.state=function(){return this.isActive},t.prototype.activate=function(){return this.isActive=!0,this},t.prototype.deactivate=function(){return this.isActive=!1,this},t.prototype.visualizeTimeDomainFloat32ArrayOnCanvas=function(t,e,r,n,i,s){var o,a,u,c,l,h,p=null!==(o=this.styles.top)&&void 0!==o?o:15,f=null!==(a=this.styles.left)&&void 0!==a?a:30,d=null!==(u=this.styles.width)&&void 0!==u?u:1.5,v=null!==(c=this.styles.cap)&&void 0!==c?c:"round",y=null!==(l=this.styles.join)&&void 0!==l?l:"miter",m=null!==(h=this.styles.wave)&&void 0!==h?h:"rgba(0, 0, 255, 1.0)";switch(this.styles.shape){case"line":t.strokeStyle=m,t.lineWidth=d,t.lineCap=v,t.lineJoin=y,t.beginPath();for(var b=0,g=e.length;b<g;b++)if(!s||b%s==0){var w=b/g*r+f,T=(1-e[b])*(n/2)+p;0===b?t.moveTo(w+t.lineWidth/2,T):t.lineTo(w,T)}t.stroke();break;case"rect":for(b=0,g=e.length;b<g;b++)if(!s||b%s==0){w=b/g*r+f,T=e[b]*(n/2)*-1;if(this.styles.gradients){for(var k=n/2+p,_=t.createLinearGradient(0,k,0,k+T),A=0,S=this.styles.gradients;A<S.length;A++){var O=S[A];_.addColorStop(O.offset,O.color)}t.fillStyle=_}else t.fillStyle=m;t.fillRect(w,i,d,T)}}},t.prototype.visualizeTimeDomainFloat32ArrayBySVG=function(e,r,n,i,s,o){var a,u,c,l,h,p,f,d=null!==(a=this.styles.top)&&void 0!==a?a:15,v=null!==(u=this.styles.left)&&void 0!==u?u:30,y=null!==(c=this.styles.width)&&void 0!==c?c:1.5,m=null!==(l=this.styles.cap)&&void 0!==l?l:"round",b=null!==(h=this.styles.join)&&void 0!==h?h:"miter",g=null!==(p=this.styles.wave)&&void 0!==p?p:"rgba(0, 0, 255, 1.0)";switch(this.styles.shape){case"line":for(var w=document.createElementNS(t.XMLNS,"path"),T="",k=0,_=e.length;k<_;k++)if(k%s==0){var A=k/_*r+v,S=(1-e[k])*(n/2)+d;T+=0===k?"M".concat(A+(null!==(f=this.styles.width)&&void 0!==f?f:1.5)/2," ").concat(S):" L".concat(A," ").concat(S)}return w.setAttribute("d",T),w.setAttribute("stroke",g),w.setAttribute("fill","none"),w.setAttribute("stroke-width",y.toString(10)),w.setAttribute("stroke-linecap",m),w.setAttribute("stroke-linejoin",b),w;case"rect":var O=null;this.styles.gradients&&(O=this.createSVGLinearGradient(o));var M=document.createElementNS(t.XMLNS,"g");null!==O&&M.appendChild(O);for(k=0,_=e.length;k<_;k++)if(k%s==0){var x=document.createElementNS(t.XMLNS,"rect");A=k/_*r+v,S=e[k]*(n/2);x.setAttribute("x",A.toString(10)),x.setAttribute("y",i.toString(10)),x.setAttribute("width",y.toString(10)),x.setAttribute("height",Math.abs(S).toString(10)),S>=0&&x.setAttribute("transform","rotate(180 ".concat(A+y/2," ").concat(i,")")),x.setAttribute("stroke","none"),x.setAttribute("fill",null===O?g:"url(#".concat(o,")")),M.appendChild(x)}return M;default:return null}},t.prototype.createSVGLinearGradient=function(e){if(!this.styles.gradients)return null;var r=document.createElementNS(t.XMLNS,"defs"),n=document.createElementNS(t.XMLNS,"linearGradient");n.setAttribute("id",e),n.setAttribute("x1","0%"),n.setAttribute("y1","0%"),n.setAttribute("x2","0%"),n.setAttribute("y2","100%");for(var i=0,s=this.styles.gradients;i<s.length;i++){var o=s[i],a=document.createElementNS(t.XMLNS,"stop");a.setAttribute("offset",o.offset.toString(10)),a.setAttribute("stop-color",o.color),n.appendChild(a)}return r.appendChild(n),r},t.prototype.createFontString=function(){var t,e,r,n,i,s,o,a;return"".concat(null!==(e=null===(t=this.styles.font)||void 0===t?void 0:t.style)&&void 0!==e?e:"normal"," ").concat(null!==(n=null===(r=this.styles.font)||void 0===r?void 0:r.weight)&&void 0!==n?n:"normal"," ").concat(null!==(s=null===(i=this.styles.font)||void 0===i?void 0:i.size)&&void 0!==s?s:"13px",' "').concat(null!==(a=null===(o=this.styles.font)||void 0===o?void 0:o.family)&&void 0!==a?a:"Arial",'"')},t.prototype.visualizeOnCanvas=function(t,e,r){},t.prototype.visualizeBySVG=function(t,e,r){},t.XMLNS="http://www.w3.org/2000/svg",t.XLINK="http://www.w3.org/1999/xlink",t.SVG_LINEAR_GRADIENT_ID_TIME_OVERVIEW="svg-linear-gradient-time-overview",t.SVG_LINEAR_GRADIENT_ID_TIME="svg-linear-gradient-time",t.SVG_LINEAR_GRADIENT_ID_FFT="svg-linear-gradient-fft",t}();e.Visualizer=n},8397:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Analyser=void 0;r(1386);var n=r(9076),i=r(235),s=r(6354),o=function(){function t(t){this.timeDomainAnimationId=null,this.timeDomainTimerId=null,this.frequencyDomainAnimationId=null,this.frequencyDomainTimerId=null,this.analyser=t.createAnalyser(),this.input=t.createGain(),this.input.connect(this.analyser),this.timeOverviewL=new n.TimeOverview(t.sampleRate,0),this.timeOverviewR=new n.TimeOverview(t.sampleRate,1),this.time=new i.Time(t.sampleRate,0),this.fft=new s.FFT(t.sampleRate,0),this.analyser.fftSize=2048,this.analyser.minDecibels=-100,this.analyser.maxDecibels=-30,this.analyser.smoothingTimeConstant=.8}return t.prototype.start=function(t,e,r){var n=this;switch(t){case"timeoverview":if((0===e||1===e)&&r)switch(e){case 0:if(r.numberOfChannels>e)(s=new Float32Array(r.length)).set(r.getChannelData(e)),this.timeOverviewL.start(s);break;case 1:if(r.numberOfChannels>e)(s=new Float32Array(r.length)).set(r.getChannelData(e)),this.timeOverviewR.start(s)}break;case"time":var i=this.time.param("interval");if("uint"===this.time.param("type")){var s=new Uint8Array(this.analyser.fftSize);this.analyser.getByteTimeDomainData(s),this.time.start(s)}else{s=new Float32Array(this.analyser.fftSize);this.analyser.getFloatTimeDomainData(s),this.time.start(s)}"number"==typeof i&&(this.stop(t),i<0?this.timeDomainAnimationId=window.requestAnimationFrame((function(){n.start(t)})):this.timeDomainTimerId=window.setTimeout((function(){n.start(t)}),i));break;case"fft":i=this.fft.param("interval");if("uint"===this.fft.param("type")){s=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(s),this.fft.start(s)}else{s=new Float32Array(this.analyser.frequencyBinCount);this.analyser.getFloatFrequencyData(s),this.fft.start(s,this.analyser.minDecibels,this.analyser.maxDecibels)}"number"==typeof i&&(this.stop(t),i<0?this.frequencyDomainAnimationId=window.requestAnimationFrame((function(){n.start(t)})):this.frequencyDomainTimerId=window.setTimeout((function(){n.start(t)}),i))}return this},t.prototype.stop=function(t){switch(t){case"time":"number"==typeof(e=this.time.param("interval"))&&(e<0&&this.timeDomainAnimationId?(window.cancelAnimationFrame(this.timeDomainAnimationId),this.timeDomainAnimationId=null):this.timeDomainTimerId&&(window.clearTimeout(this.timeDomainTimerId),this.timeDomainTimerId=null));break;case"fft":var e;"number"==typeof(e=this.fft.param("interval"))&&(e<0&&this.frequencyDomainAnimationId?(window.cancelAnimationFrame(this.frequencyDomainAnimationId),this.frequencyDomainAnimationId=null):this.frequencyDomainTimerId&&(window.clearTimeout(this.frequencyDomainTimerId),this.frequencyDomainTimerId=null))}return this},t.prototype.param=function(t){if("string"==typeof t)switch(t){case"fftSize":return this.analyser.fftSize;case"frequencyBinCount":return this.analyser.frequencyBinCount;case"minDecibels":return this.analyser.minDecibels;case"maxDecibels":return this.analyser.maxDecibels;case"smoothingTimeConstant":return this.analyser.smoothingTimeConstant;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"fftSize":this.analyser.fftSize=s;break;case"minDecibels":this.analyser.minDecibels=s;break;case"maxDecibels":this.analyser.maxDecibels=s;break;case"smoothingTimeConstant":this.analyser.smoothingTimeConstant=s}}return this},t.prototype.domain=function(t,e){switch(t){case"timeoverview":switch(e){case 0:default:return this.timeOverviewL;case 1:return this.timeOverviewR}case"time":return this.time;case"fft":return this.fft;default:return this}return this},t.prototype.get=function(){return this.analyser},Object.defineProperty(t.prototype,"INPUT",{get:function(){return this.input},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"OUTPUT",{get:function(){return this.input},enumerable:!1,configurable:!0}),t}();e.Analyser=o},8044:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Autopanner=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.panner=r.context.createStereoPanner(),r.panner.pan.value=0,r.depth.gain.value=0,r.rate.value=0,r.deactivate(),r.lfo.connect(r.depth),r.depth.connect(r.panner.pan),r}return i(e,t),e.prototype.stop=function(e,r){t.prototype.stop.call(this,e,r),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.panner.pan))},e.prototype.connect=function(){return this.input.disconnect(0),this.panner.disconnect(0),this.isActive?(this.input.connect(this.panner),this.panner.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"depth":return this.depth.gain.value;case"rate":return this.rate.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"depth":"number"==typeof s&&(this.depth.gain.value=s);break;case"rate":"number"==typeof s&&(this.rate.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,depth:this.depth.gain.value,rate:this.rate.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.Autopanner=s},8649:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Chorus=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.depthRate=0,r.delay=e.createDelay(),r.mix=e.createGain(),r.tone=e.createBiquadFilter(),r.feedback=e.createGain(),r.delay.delayTime.value=0,r.depth.gain.value=0,r.rate.value=0,r.mix.gain.value=0,r.tone.type="lowpass",r.tone.frequency.value=350,r.tone.Q.value=Math.SQRT1_2,r.tone.gain.value=0,r.feedback.gain.value=0,r.depthRate=0,r.deactivate(),r.lfo.connect(r.depth),r.depth.connect(r.delay.delayTime),r}return i(e,t),e.prototype.stop=function(e,r){t.prototype.stop.call(this,e,r),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.delay.delayTime))},e.prototype.connect=function(){return this.input.disconnect(0),this.delay.disconnect(0),this.mix.disconnect(0),this.tone.disconnect(0),this.feedback.disconnect(0),this.input.connect(this.output),this.isActive&&(this.input.connect(this.tone),this.tone.connect(this.delay),this.delay.connect(this.mix),this.mix.connect(this.output),this.delay.connect(this.feedback),this.feedback.connect(this.delay)),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"time":return this.delay.delayTime.value;case"depth":return this.depthRate;case"rate":return this.rate.value;case"mix":return this.mix.gain.value;case"tone":return this.tone.frequency.value;case"feedback":return this.feedback.gain.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"time":"number"==typeof s&&(this.delay.delayTime.value=s,this.depth.gain.value=this.delay.delayTime.value*this.depthRate);break;case"depth":"number"==typeof s&&(this.depthRate=s,this.depth.gain.value=this.delay.delayTime.value*s);break;case"rate":"number"==typeof s&&(this.rate.value=s);break;case"mix":"number"==typeof s&&(this.mix.gain.value=s);break;case"tone":"number"==typeof s&&(this.tone.frequency.value=s);break;case"feedback":"number"==typeof s&&(this.feedback.gain.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,time:this.delay.delayTime.value,depth:this.depthRate,rate:this.rate.value,mix:this.mix.gain.value,tone:this.tone.frequency.value,feedback:this.feedback.gain.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.Chorus=s},346:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Compressor=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.compressor=e.createDynamicsCompressor(),r.compressor.threshold.value=-24,r.compressor.knee.value=30,r.compressor.ratio.value=12,r.compressor.attack.value=.003,r.compressor.release.value=.25,r.activate(),r}return i(e,t),e.prototype.connect=function(){return this.input.disconnect(0),this.compressor.disconnect(0),this.isActive?(this.input.connect(this.compressor),this.compressor.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"threshold":return this.compressor.threshold.value;case"knee":return this.compressor.knee.value;case"ratio":return this.compressor.ratio.value;case"attack":return this.compressor.attack.value;case"release":return this.compressor.release.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"threshold":"number"==typeof s&&(this.compressor.threshold.value=s);break;case"knee":"number"==typeof s&&(this.compressor.knee.value=s);break;case"ratio":"number"==typeof s&&(this.compressor.ratio.value=s);break;case"attack":"number"==typeof s&&(this.compressor.attack.value=s);break;case"release":"number"==typeof s&&(this.compressor.release.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,threshold:this.compressor.threshold.value,knee:this.compressor.knee.value,ratio:this.compressor.ratio.value,attack:this.compressor.attack.value,release:this.compressor.release.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.Compressor=s},4535:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Delay=void 0;var s=function(t){function e(r){var n=t.call(this,r,0)||this;return n.delay=r.createDelay(e.MAX_DELAY_TIME),n.dry=r.createGain(),n.wet=r.createGain(),n.tone=r.createBiquadFilter(),n.feedback=r.createGain(),n.delay.delayTime.value=0,n.dry.gain.value=1,n.wet.gain.value=0,n.tone.type="lowpass",n.tone.frequency.value=350,n.tone.Q.value=Math.SQRT1_2,n.tone.gain.value=0,n.feedback.gain.value=0,n.deactivate(),n}return i(e,t),e.prototype.connect=function(){return this.input.disconnect(0),this.delay.disconnect(0),this.dry.disconnect(0),this.wet.disconnect(0),this.tone.disconnect(0),this.feedback.disconnect(0),this.isActive?(this.input.connect(this.dry),this.dry.connect(this.output),this.input.connect(this.tone),this.tone.connect(this.delay),this.delay.connect(this.wet),this.wet.connect(this.output),this.delay.connect(this.feedback),this.feedback.connect(this.delay)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"time":return this.delay.delayTime.value;case"dry":return this.dry.gain.value;case"wet":return this.wet.gain.value;case"tone":return this.tone.frequency.value;case"feedback":return this.feedback.gain.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"time":"number"==typeof s&&(this.delay.delayTime.value=s);break;case"dry":"number"==typeof s&&(this.dry.gain.value=s);break;case"wet":"number"==typeof s&&(this.wet.gain.value=s);break;case"tone":"number"==typeof s&&(this.tone.frequency.value=s);break;case"feedback":"number"==typeof s&&(this.feedback.gain.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,time:this.delay.delayTime.value,dry:this.dry.gain.value,wet:this.wet.gain.value,tone:this.tone.frequency.value,feedback:this.feedback.gain.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e.MAX_DELAY_TIME=5,e}(r(1643).Effector);e.Delay=s},1605:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Distortion=e.Cabinet=void 0;var s=r(1643),o=function(t){function e(e){var r=t.call(this,e,0)||this;return r.preAmp=e.createWaveShaper(),r.gain=e.createGain(),r.leadGain=e.createGain(),r.lowpass=e.createBiquadFilter(),r.highpass1=e.createBiquadFilter(),r.highpass2=e.createBiquadFilter(),r.highpass3=e.createBiquadFilter(),r.gain.gain.value=.5,r.leadGain.gain.value=.5,r.lowpass.type="lowpass",r.lowpass.frequency.value=3200,r.lowpass.Q.value=Math.SQRT1_2,r.lowpass.gain.value=0,r.highpass1.type="highpass",r.highpass1.frequency.value=80,r.highpass1.Q.value=Math.SQRT1_2,r.highpass1.gain.value=0,r.highpass2.type="highpass",r.highpass2.frequency.value=640,r.highpass2.Q.value=Math.SQRT1_2,r.highpass2.gain.value=0,r.highpass3.type="highpass",r.highpass3.frequency.value=80,r.highpass3.Q.value=Math.SQRT1_2,r.highpass3.gain.value=0,r.deactivate(),r}return i(e,t),e.prototype.connect=function(){return this.input.disconnect(0),this.isActive?(this.input.connect(this.highpass1),this.highpass1.connect(this.gain),this.gain.connect(this.highpass3),this.input.connect(this.highpass2),this.highpass2.connect(this.leadGain),this.leadGain.connect(this.highpass3),this.highpass3.connect(this.preAmp),this.preAmp.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"state":return this.isActive;case"curve":return this.preAmp.curve;case"gain":return this.gain.gain.value;case"lead":return this.leadGain.gain.value;default:return}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"state":"boolean"==typeof s&&(s?this.activate():this.deactivate());break;case"curve":"number"!=typeof s&&"boolean"!=typeof s&&(this.preAmp.curve=s);break;case"gain":"number"==typeof s&&(this.gain.gain.value=s);break;case"lead":"number"==typeof s&&(this.leadGain.gain.value=s)}}},e.prototype.params=function(){return{state:this.isActive,curve:this.preAmp.curve,gain:this.gain.gain.value,lead:this.leadGain.gain.value}},e}(s.Effector),a=function(t){function e(e){var r=t.call(this,e,0)||this;return r.distortion=e.createWaveShaper(),r.bass=e.createBiquadFilter(),r.middle=e.createBiquadFilter(),r.treble=e.createBiquadFilter(),r.bass.type="lowshelf",r.middle.type="peaking",r.treble.type="highshelf",r.bass.frequency.value=240,r.middle.frequency.value=500,r.treble.frequency.value=1600,r.bass.Q.value=Math.SQRT1_2,r.middle.Q.value=Math.SQRT1_2,r.treble.Q.value=Math.SQRT1_2,r.bass.gain.value=0,r.middle.gain.value=0,r.treble.gain.value=0,r.lowpass=e.createBiquadFilter(),r.highpass=e.createBiquadFilter(),r.lowpass.type="lowpass",r.lowpass.frequency.value=24e3,r.lowpass.Q.value=Math.SQRT1_2,r.lowpass.gain.value=0,r.highpass.type="highpass",r.highpass.frequency.value=40,r.highpass.Q.value=Math.SQRT1_2,r.highpass.gain.value=0,r.deactivate(),r}return i(e,t),e.prototype.connect=function(){return this.input.disconnect(0),this.isActive?(this.input.connect(this.lowpass),this.lowpass.connect(this.highpass),this.highpass.connect(this.distortion),this.distortion.connect(this.bass),this.bass.connect(this.middle),this.middle.connect(this.treble),this.treble.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"state":return this.isActive;case"curve":return this.distortion.curve;case"bass":return this.bass.gain.value;case"middle":return this.middle.gain.value;case"treble":return this.treble.gain.value;case"frequency":return this.middle.frequency.value;default:return}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"state":"boolean"==typeof s&&(s?this.activate():this.deactivate());break;case"curve":"number"!=typeof s&&"boolean"!=typeof s&&(this.distortion.curve=s);break;case"bass":"number"==typeof s&&(this.bass.gain.value=s);break;case"middle":"number"==typeof s&&(this.middle.gain.value=s);break;case"treble":"number"==typeof s&&(this.treble.gain.value=s);break;case"frequency":"number"==typeof s&&(this.middle.frequency.value=s)}}},e.prototype.params=function(){return{state:this.isActive,curve:this.distortion.curve,bass:this.bass.gain.value,middle:this.middle.gain.value,treble:this.treble.gain.value,frequency:this.middle.frequency.value}},e}(s.Effector),u=function(t){function e(e){var r=t.call(this,e,0)||this;return r.lowpass=e.createBiquadFilter(),r.notch=e.createBiquadFilter(),r.lowpass.type="lowpass",r.lowpass.frequency.value=3200,r.lowpass.Q.value=6,r.lowpass.gain.value=0,r.notch.type="notch",r.notch.frequency.value=8e3,r.notch.Q.value=1,r.notch.gain.value=0,r.deactivate(),r}return i(e,t),e.prototype.connect=function(){return this.input.disconnect(0),this.isActive?(this.input.connect(this.notch),this.notch.connect(this.lowpass),this.lowpass.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.params=function(){return{state:this.isActive}},e}(s.Effector);e.Cabinet=u;var c=function(t){function e(e){var r=t.call(this,e,0)||this;return r.numberOfSamples=256,r.preEQ=new o(e),r.postEQ=new a(e),r.cabinet=new u(e),r.type="clean",r.param({curve:"clean"}),r.deactivate(),r}return i(e,t),e.createCurve=function(t,e){var r=Math.trunc((e-1)/2),n=new Float32Array(e),i=(Math.pow(10,t/5-1)-.1)/5+1,s=.4;1===i?s=1:i>1&&i<1.04&&(s=-15.5*i+16.52);for(var o=0;o<r;o++)n[r+o]=s*(1-Math.pow(i,-o)+o*Math.pow(i,-r)/r),n[r-o]=s*(-1+Math.pow(i,-o)-o*Math.pow(i,-r)/r);return n[r]=0,n},e.prototype.connect=function(){return this.input.disconnect(0),this.isActive?(this.input.connect(this.preEQ.INPUT),this.preEQ.OUTPUT.connect(this.postEQ.INPUT),this.postEQ.OUTPUT.connect(this.cabinet.INPUT),this.cabinet.OUTPUT.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"curve":return this.type;case"samples":return this.numberOfSamples;case"pre":return this.preEQ.params();case"post":return this.postEQ.params();case"cabinet":return this.cabinet.params();default:return this}for(var r=0,n=Object.entries(t);r<n.length;r++){var i=n[r],s=i[0],o=i[1];switch(s){case"curve":var a=null;switch(o){case"clean":this.type="clean",a=e.createCurve(0,this.numberOfSamples);break;case"crunch":this.type="crunch",a=e.createCurve(3,this.numberOfSamples);break;case"overdrive":this.type="overdrive",a=e.createCurve(5,this.numberOfSamples);break;case"distortion":this.type="distortion",a=e.createCurve(8,this.numberOfSamples);break;case"fuzz":this.type="fuzz",a=e.createCurve(10,this.numberOfSamples);break;default:o instanceof Float32Array&&(a=o)}this.preEQ.param({curve:a}),this.postEQ.param({curve:a});break;case"samples":"number"==typeof o&&(this.numberOfSamples=o);break;case"pre":"object"==typeof o&&this.preEQ.param(o);break;case"post":"object"==typeof o&&this.postEQ.param(o);break;case"cabinet":this.cabinet.state()?this.cabinet.deactivate():this.cabinet.activate()}}return this},e.prototype.params=function(){return{state:this.isActive,curve:this.type,samples:this.numberOfSamples,pre:this.preEQ.params(),post:this.postEQ.params(),cabinet:this.cabinet.params()}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(s.Effector);e.Distortion=c},1643:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Effector=void 0;var r=function(){function t(t,e){this.isActive=!0,this.paused=!0,this.context=t,this.input=t.createGain(),this.output=t.createGain(),this.lfo=t.createOscillator(),this.depth=t.createGain(),this.rate=this.lfo.frequency,this.processor=t.createScriptProcessor(e,2,2)}return t.prototype.start=function(t){this.isActive&&this.paused&&(this.lfo.start(null!=t?t:this.context.currentTime),this.paused=!1)},t.prototype.stop=function(t,e){if(this.isActive&&!this.paused){var r=this.lfo.type,n=this.lfo.frequency.value;this.lfo.stop((null!=t?t:this.context.currentTime)+(null!=e?e:0)),this.lfo=this.context.createOscillator(),this.lfo.type=r,this.lfo.frequency.value=n,this.rate=this.lfo.frequency,this.paused=!0}},t.prototype.connect=function(){return this.output},t.prototype.params=function(){return{}},t.prototype.toJSON=function(){return JSON.stringify(this.params())},t.prototype.state=function(){return this.isActive},t.prototype.activate=function(){return this.isActive=!0,this.connect(),this.start(0),this},t.prototype.deactivate=function(){return this.isActive=!1,this.connect(),this.start(0),this},Object.defineProperty(t.prototype,"INPUT",{get:function(){return this.input},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"OUTPUT",{get:function(){return this.output},enumerable:!1,configurable:!0}),t}();e.Effector=r},8137:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EnvelopeGenerator=void 0;var r=function(){function t(t){this.generators=[],this.activeIndexes=[],this.activeCounter=0,this.attack=.01,this.decay=.3,this.sustain=.5,this.release=1,this.context=t}return t.prototype.ready=function(t,e,r){e&&r&&this.generators[t]?(e.connect(this.generators[t]),this.generators[t].connect(r)):e&&null===r&&this.generators[t]?e.connect(this.generators[t]):null===e&&r&&this.generators[t]&&this.generators[t].connect(r),this.activeIndexes[t]=t,this.activeCounter++},t.prototype.start=function(t){for(var e=t,r=e+this.attack,n=this.decay,i=this.sustain,s=0,o=this.activeIndexes;s<o.length;s++){var a=o[s];void 0!==a&&(this.generators[a].gain.cancelScheduledValues(e),this.generators[a].gain.setValueAtTime(0,e),this.generators[a].gain.linearRampToValueAtTime(1,r),this.generators[a].gain.setTargetAtTime(i,r,n))}},t.prototype.stop=function(t,e){for(var r=t-this.release,n=r>=this.context.currentTime?r:this.context.currentTime,i=this.release,s=0,o=this.activeIndexes;s<o.length;s++){var a=o[s];void 0!==a&&(this.generators[a].gain.cancelScheduledValues(n),e?this.generators[a].gain.setValueCurveAtTime(new Float32Array([1,.5,.25,0]),n,i):this.generators[a].gain.setTargetAtTime(0,n,i))}},t.prototype.param=function(t){if("string"==typeof t)switch(t){case"attack":return this.attack;case"decay":return this.decay;case"sustain":return this.sustain;case"release":return this.release;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"attack":"number"==typeof s&&(this.attack=s);break;case"decay":"number"==typeof s&&(this.decay=s);break;case"sustain":"number"==typeof s&&(this.sustain=s);break;case"release":"number"==typeof s&&(this.release=s)}}return this},t.prototype.getGenerator=function(t){return t>=0&&t<this.generators.length?this.generators[t]:null},t.prototype.setGenerator=function(t){this.generators[t]=this.context.createGain()},t.prototype.paused=function(){for(var e=0,r=0,n=this.activeIndexes;r<n.length;r++){var i=n[r];if(void 0!==i){if(this.generators[i].gain.value>t.MIN_GAIN)return!1;if(++e===this.activeCounter)return!0}}return!1},t.prototype.clear=function(t){this.activeIndexes.length=0,this.activeCounter=0;for(var e=0,r=this.generators;e<r.length;e++){var n=r[e];n.gain.cancelScheduledValues(this.context.currentTime),n.gain.value=1,t&&n.disconnect(0)}},t.prototype.params=function(){return{attack:this.attack,decay:this.decay,sustain:this.sustain,release:this.release}},t.prototype.toJSON=function(){return JSON.stringify(this.params())},t.MIN_GAIN=.001,t}();e.EnvelopeGenerator=r},111:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Equalizer=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.bass=e.createBiquadFilter(),r.middle=e.createBiquadFilter(),r.treble=e.createBiquadFilter(),r.presence=e.createBiquadFilter(),r.bass.type="lowshelf",r.middle.type="peaking",r.treble.type="highshelf",r.presence.type="highshelf",r.bass.frequency.value=500,r.middle.frequency.value=1e3,r.treble.frequency.value=2e3,r.presence.frequency.value=4e3,r.bass.Q.value=Math.SQRT1_2,r.middle.Q.value=Math.SQRT1_2,r.treble.Q.value=Math.SQRT1_2,r.presence.Q.value=Math.SQRT1_2,r.bass.gain.value=0,r.middle.gain.value=0,r.treble.gain.value=0,r.presence.gain.value=0,r.deactivate(),r}return i(e,t),e.prototype.connect=function(){return this.input.disconnect(0),this.bass.disconnect(0),this.middle.disconnect(0),this.treble.disconnect(0),this.presence.disconnect(0),this.isActive?(this.input.connect(this.bass),this.bass.connect(this.middle),this.middle.connect(this.treble),this.treble.connect(this.presence),this.presence.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"bass":return this.bass.gain.value;case"middle":return this.middle.gain.value;case"treble":return this.treble.gain.value;case"presence":return this.presence.gain.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"bass":"number"==typeof s&&(this.bass.gain.value=s);break;case"middle":"number"==typeof s&&(this.middle.gain.value=s);break;case"treble":"number"==typeof s&&(this.treble.gain.value=s);break;case"presence":"number"==typeof s&&(this.presence.gain.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,bass:this.bass.gain.value,middle:this.middle.gain.value,treble:this.treble.gain.value,presence:this.presence.gain.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.Equalizer=s},7369:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Filter=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.range=.1,r.attack=.01,r.decay=.3,r.sustain=1,r.release=1,r.filter=e.createBiquadFilter(),r.filter.type="lowpass",r.filter.frequency.value=350,r.filter.Q.value=1,r.filter.gain.value=0,r.maxFrequency=r.filter.frequency.value,r.deactivate(),r}return i(e,t),e.prototype.start=function(t){if(this.isActive){var e=null!=t?t:this.context.currentTime,r=e+this.attack,n=this.decay,i=this.sustain*this.maxFrequency,s=this.maxFrequency*this.range;this.filter.frequency.cancelScheduledValues(e),this.filter.frequency.setValueAtTime(s,e),this.filter.frequency.linearRampToValueAtTime(this.maxFrequency,r),this.filter.frequency.setTargetAtTime(i,r,n)}},e.prototype.stop=function(t){if(this.isActive){var e=null!=t?t:this.context.currentTime,r=this.release,n=this.maxFrequency*this.range;this.filter.frequency.cancelScheduledValues(e),this.filter.frequency.setValueAtTime(this.filter.frequency.value,e),this.filter.frequency.setTargetAtTime(n,e,r)}},e.prototype.connect=function(){return this.input.disconnect(0),this.filter.disconnect(0),this.isActive?(this.input.connect(this.filter),this.filter.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"type":return this.filter.type;case"frequency":return this.filter.frequency.value;case"Q":return this.filter.Q.value;case"gain":return this.filter.gain.value;case"range":return this.range;case"attack":return this.attack;case"decay":return this.decay;case"sustain":return this.sustain;case"release":return this.release;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"type":"string"==typeof s&&(this.filter.type=s);break;case"frequency":"number"==typeof s&&(this.filter.frequency.value=s,this.maxFrequency=s);break;case"Q":"number"==typeof s&&(this.filter.Q.value=s);break;case"gain":"number"==typeof s&&(this.filter.gain.value=s);break;case"range":"number"==typeof s&&(this.range=s);break;case"attack":"number"==typeof s&&(this.attack=s);break;case"decay":"number"==typeof s&&(this.decay=s);break;case"sustain":"number"==typeof s&&(this.sustain=s);break;case"release":"number"==typeof s&&(this.release=s)}}return this},e.prototype.params=function(){return{state:this.isActive,type:this.filter.type,frequency:this.filter.frequency.value,Q:this.filter.Q.value,gain:this.filter.gain.value,range:this.range,attack:this.attack,decay:this.decay,sustain:this.sustain,release:this.release}},e.prototype.activate=function(){return this.isActive=!0,this.connect(),this},e.prototype.deactivate=function(){return this.isActive=!1,this.connect(),this},e}(r(1643).Effector);e.Filter=s},6548:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Flanger=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.depthRate=0,r.delay=e.createDelay(),r.mix=e.createGain(),r.tone=e.createBiquadFilter(),r.feedback=e.createGain(),r.delay.delayTime.value=0,r.depth.gain.value=0,r.rate.value=0,r.mix.gain.value=0,r.tone.type="lowpass",r.tone.frequency.value=350,r.tone.Q.value=Math.SQRT1_2,r.tone.gain.value=0,r.feedback.gain.value=0,r.depthRate=0,r.deactivate(),r.lfo.connect(r.depth),r.depth.connect(r.delay.delayTime),r}return i(e,t),e.prototype.stop=function(e,r){t.prototype.stop.call(this,e,r),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.delay.delayTime))},e.prototype.connect=function(){return this.input.disconnect(0),this.delay.disconnect(0),this.mix.disconnect(0),this.tone.disconnect(0),this.feedback.disconnect(0),this.input.connect(this.output),this.isActive&&(this.input.connect(this.tone),this.tone.connect(this.delay),this.delay.connect(this.mix),this.mix.connect(this.output),this.delay.connect(this.feedback),this.feedback.connect(this.delay)),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"time":return this.delay.delayTime.value;case"depth":return this.depthRate;case"rate":return this.rate.value;case"mix":return this.mix.gain.value;case"tone":return this.tone.frequency.value;case"feedback":return this.feedback.gain.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"time":"number"==typeof s&&(this.delay.delayTime.value=s,this.depth.gain.value=this.delay.delayTime.value*this.depthRate);break;case"depth":"number"==typeof s&&(this.depthRate=s,this.depth.gain.value=this.delay.delayTime.value*s);break;case"rate":"number"==typeof s&&(this.rate.value=s);break;case"mix":"number"==typeof s&&(this.mix.gain.value=s);break;case"tone":"number"==typeof s&&(this.tone.frequency.value=s);break;case"feedback":"number"==typeof s&&(this.feedback.gain.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,time:this.delay.delayTime.value,depth:this.depthRate,rate:this.rate.value,mix:this.mix.gain.value,tone:this.tone.frequency.value,feedback:this.feedback.gain.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.Flanger=s},4226:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Listener=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.listener=e.listener,r.positions={x:0,y:0,z:0},r.forwards={x:0,y:0,z:-1},r.ups={x:0,y:1,z:0},r.listener.positionX.value=r.positions.x,r.listener.positionY.value=r.positions.y,r.listener.positionZ.value=r.positions.z,r.listener.forwardX.value=r.forwards.x,r.listener.forwardY.value=r.forwards.y,r.listener.forwardZ.value=r.forwards.z,r.listener.upX.value=r.ups.x,r.listener.upY.value=r.ups.y,r.listener.upZ.value=r.ups.z,r}return i(e,t),e.prototype.param=function(t){if("string"==typeof t)switch(t){case"x":return this.listener.positionX.value;case"y":return this.listener.positionY.value;case"z":return this.listener.positionZ.value;case"fx":return this.listener.forwardX.value;case"fy":return this.listener.forwardY.value;case"fz":return this.listener.forwardZ.value;case"ux":return this.listener.upX.value;case"uy":return this.listener.upY.value;case"uz":return this.listener.upZ.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"x":"number"==typeof s&&(this.listener.positionX.value=s);break;case"y":"number"==typeof s&&(this.listener.positionY.value=s);break;case"z":"number"==typeof s&&(this.listener.positionZ.value=s);break;case"fx":"number"==typeof s&&(this.listener.forwardX.value=s);break;case"fy":"number"==typeof s&&(this.listener.forwardY.value=s);break;case"fz":"number"==typeof s&&(this.listener.forwardZ.value=s);break;case"ux":"number"==typeof s&&(this.listener.upX.value=s);break;case"uy":"number"==typeof s&&(this.listener.upY.value=s);break;case"uz":"number"==typeof s&&(this.listener.upZ.value=s)}}return this},e.prototype.params=function(){return{x:this.positions.x,y:this.positions.y,z:this.positions.z,fx:this.forwards.x,fy:this.forwards.y,fz:this.forwards.z,ux:this.ups.x,uy:this.ups.y,uz:this.ups.z}},e}(r(1643).Effector);e.Listener=s},3751:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Panner=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.panner=e.createPanner(),r.positions={x:0,y:0,z:0},r.orientations={x:1,y:0,z:0},r.panner.refDistance=1,r.panner.maxDistance=1e4,r.panner.rolloffFactor=1,r.panner.coneInnerAngle=360,r.panner.coneOuterAngle=360,r.panner.coneOuterGain=0,r.panner.panningModel="HRTF",r.panner.distanceModel="inverse",r.panner.positionX.value=r.positions.x,r.panner.positionY.value=r.positions.y,r.panner.positionZ.value=r.positions.z,r.panner.orientationX.value=r.orientations.x,r.panner.orientationY.value=r.orientations.y,r.panner.orientationZ.value=r.orientations.z,r.deactivate(),r}return i(e,t),e.prototype.connect=function(){return this.input.disconnect(0),this.panner.disconnect(0),this.isActive?(this.input.connect(this.panner),this.panner.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"x":return this.panner.positionX.value;case"y":return this.panner.positionY.value;case"z":return this.panner.positionZ.value;case"ox":return this.panner.orientationX.value;case"oy":return this.panner.orientationY.value;case"oz":return this.panner.orientationZ.value;case"refDistance":return this.panner.refDistance;case"maxDistance":return this.panner.maxDistance;case"rolloffFactor":return this.panner.rolloffFactor;case"coneInnerAngle":return this.panner.coneInnerAngle;case"coneOuterAngle":return this.panner.coneOuterAngle;case"coneOuterGain":return this.panner.coneOuterGain;case"panningModel":return this.panner.panningModel;case"distanceModel":return this.panner.distanceModel;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"x":"number"==typeof s&&(this.panner.positionX.value=s);break;case"y":"number"==typeof s&&(this.panner.positionY.value=s);break;case"z":"number"==typeof s&&(this.panner.positionZ.value=s);break;case"ox":"number"==typeof s&&(this.panner.orientationX.value=s);break;case"oy":"number"==typeof s&&(this.panner.orientationY.value=s);break;case"oz":"number"==typeof s&&(this.panner.orientationZ.value=s);break;case"refDistance":"number"==typeof s&&(this.panner.refDistance=s);break;case"maxDistance":"number"==typeof s&&(this.panner.maxDistance=s);break;case"rolloffFactor":"number"==typeof s&&(this.panner.rolloffFactor=s);break;case"coneInnerAngle":"number"==typeof s&&(this.panner.coneInnerAngle=s);break;case"coneOuterAngle":"number"==typeof s&&(this.panner.coneOuterAngle=s);break;case"coneOuterGain":"number"==typeof s&&(this.panner.coneOuterGain=s);break;case"panningModel":"HRTF"!==s&&"equalpower"!==s||(this.panner.panningModel=s);break;case"distanceModel":"linear"!==s&&"inverse"!==s&&"exponential"!==s||(this.panner.distanceModel=s)}}return this},e.prototype.params=function(){return{state:this.isActive,x:this.positions.x,y:this.positions.y,z:this.positions.z,ox:this.orientations.x,oy:this.orientations.y,oz:this.orientations.z,refDistance:this.panner.refDistance,maxDistance:this.panner.maxDistance,rolloffFactor:this.panner.rolloffFactor,coneInnerAngle:this.panner.coneInnerAngle,coneOuterAngle:this.panner.coneOuterAngle,coneOuterGain:this.panner.coneOuterGain,panningModel:this.panner.panningModel,distanceModel:this.panner.distanceModel}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.Panner=s},2393:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Phaser=void 0;var s=function(t){function e(r){var n=t.call(this,r,0)||this;n.numberOfStages=12,n.filters=[],n.depthRate=0;for(var i=0;i<e.MAX_STAGES;i++){var s=r.createBiquadFilter();s.type="allpass",s.frequency.value=350,s.Q.value=1,s.gain.value=0,n.filters.push(s)}n.mix=r.createGain(),n.feedback=r.createGain(),n.depth.gain.value=0,n.rate.value=0,n.mix.gain.value=0,n.feedback.gain.value=0,n.deactivate(),n.lfo.connect(n.depth);for(i=0;i<e.MAX_STAGES;i++)n.depth.connect(n.filters[i].frequency);return n}return i(e,t),e.prototype.stop=function(r,n){if(t.prototype.stop.call(this,r,n),this.isActive){this.lfo.connect(this.depth);for(var i=0;i<e.MAX_STAGES;i++)this.depth.connect(this.filters[i].frequency)}},e.prototype.connect=function(){this.input.disconnect(0);for(var t=0;t<e.MAX_STAGES;t++)this.filters[t].disconnect(0);if(this.mix.disconnect(0),this.feedback.disconnect(0),this.input.connect(this.output),this.isActive&&this.numberOfStages>0){this.input.connect(this.filters[0]);for(t=0;t<this.numberOfStages;t++)t<this.numberOfStages-1?this.filters[t].connect(this.filters[t+1]):(this.filters[t].connect(this.mix),this.mix.connect(this.output),this.filters[t].connect(this.feedback),this.feedback.connect(this.filters[0]))}return this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"stage":return this.numberOfStages;case"frequency":return this.filters[0].frequency.value;case"resonance":return this.filters[0].Q.value;case"depth":return this.depthRate;case"rate":return this.rate.value;case"mix":return this.mix.gain.value;case"feedback":return this.feedback.gain.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"stage":switch(s){case 0:case 2:case 4:case 8:case 12:case 24:this.numberOfStages=s,this.connect()}break;case"frequency":if("number"==typeof s){for(var o=0,a=this.filters;o<a.length;o++){a[o].frequency.value=s}this.depth.gain.value=this.filters[0].frequency.value*this.depthRate}break;case"resonance":if("number"==typeof s)for(var u=0,c=this.filters;u<c.length;u++){c[u].Q.value=s}break;case"depth":"number"==typeof s&&(this.depthRate=s,this.depth.gain.value=this.filters[0].frequency.value*s);break;case"rate":"number"==typeof s&&(this.rate.value=s);break;case"mix":"number"==typeof s&&(this.mix.gain.value=s);break;case"feedback":"number"==typeof s&&(this.feedback.gain.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,stage:this.numberOfStages,frequency:this.filters[0].frequency.value,resonance:this.filters[0].Q.value,depth:this.depthRate,rate:this.rate.value,mix:this.mix.gain.value,feedback:this.feedback.gain.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e.MAX_STAGES=24,e}(r(1643).Effector);e.Phaser=s},4833:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.PitchShifter=void 0;var s=r(999),o=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.pitch=1,n.gainCorrection=2,n.deactivate(),n.connect(),n}return i(e,t),e.prototype.start=function(){var t=this;if(this.isActive&&this.paused){this.paused=!1;var e=this.processor.bufferSize;this.processor.onaudioprocess=function(r){var n=r.inputBuffer.getChannelData(0),i=r.inputBuffer.getChannelData(1),o=r.outputBuffer.getChannelData(0),a=r.outputBuffer.getChannelData(1);if(t.isActive&&1!==t.pitch){var u=new Float32Array(n),c=new Float32Array(i),l=new Float32Array(e),h=new Float32Array(e);(0,s.FFT)(u,l,e),(0,s.FFT)(c,h,e);for(var p=new Float32Array(e),f=new Float32Array(e),d=new Float32Array(e),v=new Float32Array(e),y=0;y<e;y++){var m=Math.trunc(t.pitch*y),b=1;y>e/2&&(b=0),m>=0&&m<e&&(p[m]+=t.gainCorrection*b*u[y],d[m]+=t.gainCorrection*b*l[y],f[m]+=t.gainCorrection*b*c[y],v[m]+=t.gainCorrection*b*h[y])}(0,s.IFFT)(p,d,e),(0,s.IFFT)(f,v,e),o.set(p),a.set(f)}else o.set(n),a.set(i)}}},e.prototype.stop=function(){this.isActive&&(this.paused=!0,this.processor.disconnect(0),this.processor.onaudioprocess=null,this.connect())},e.prototype.connect=function(){return this.input.disconnect(0),this.processor.disconnect(0),this.isActive?(this.input.connect(this.processor),this.processor.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)return"pitch"===t?this.pitch:this;for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];if("pitch"===i)"number"==typeof s&&s>0&&(this.pitch=s)}return this},e.prototype.params=function(){return{state:this.isActive,pitch:this.pitch}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.PitchShifter=o},1063:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Reverb=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.rirs=[],r.isLoadError=!1,r.convolver=e.createConvolver(),r.dry=e.createGain(),r.wet=e.createGain(),r.tone=e.createBiquadFilter(),r.dry.gain.value=1,r.wet.gain.value=0,r.tone.type="lowpass",r.tone.frequency.value=350,r.tone.Q.value=Math.SQRT1_2,r.tone.gain.value=0,r.deactivate(),r}return i(e,t),e.prototype.connect=function(){return this.input.disconnect(0),this.convolver.disconnect(0),this.dry.disconnect(0),this.wet.disconnect(0),this.tone.disconnect(0),this.isActive?(this.input.connect(this.dry),this.dry.connect(this.output),this.input.connect(this.tone),this.tone.connect(this.convolver),this.convolver.connect(this.wet),this.wet.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"buffer":return this.convolver.buffer;case"dry":return this.dry.gain.value;case"wet":return this.wet.gain.value;case"tone":return this.tone.frequency.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"buffer":"number"==typeof s?s>=0&&s<this.rirs.length&&(this.convolver.buffer=this.rirs[s],this.connect()):s instanceof AudioBuffer?(this.convolver.buffer=s,this.connect()):null===s&&(this.convolver.buffer=null,this.input.disconnect(0),this.input.connect(this.output));break;case"dry":"number"==typeof s&&(this.dry.gain.value=s);break;case"wet":"number"==typeof s&&(this.wet.gain.value=s);break;case"tone":"number"==typeof s&&(this.tone.frequency.value=s)}}return this},e.prototype.add=function(t,e){var r=this;if(t instanceof AudioBuffer)this.convolver.buffer=t,this.rirs.push(t);else if(t instanceof ArrayBuffer){this.context.decodeAudioData(t,(function(t){r.convolver.buffer=t,r.rirs.push(t)}),null!=e?e:function(){})}return this},e.prototype.preset=function(t){for(var e=t.rirs,r=t.timeout,n=t.successCallback,i=t.errorCallback,s=t.progressCallback,o=0,a=e.length;o<a;o++){var u=e[o];"string"==typeof u?this.load({rir:u,index:o,timeout:r,successCallback:n,errorCallback:i,progressCallback:s}):this.rirs[o]=u}},e.prototype.params=function(){return{state:this.isActive,dry:this.dry.gain.value,wet:this.wet.gain.value,tone:this.tone.frequency.value}},e.prototype.activate=function(){return this.isActive=!0,this.connect(),this},e.prototype.deactivate=function(){return this.isActive=!1,this.connect(),this},e.prototype.load=function(t){var e=this,r=t.rir,n=t.index,i=t.timeout,s=t.successCallback,o=t.errorCallback,a=t.progressCallback,u=new XMLHttpRequest;u.timeout=null!=i?i:6e4,u.ontimeout=function(t){!e.isLoadError&&o&&o(t,"timeout"),e.isLoadError=!0},u.onprogress=function(t){e.isLoadError?u.abort():a&&a(t)},u.onerror=function(t){!e.isLoadError&&o&&o(t,"error"),e.isLoadError=!0},u.onload=function(t){if(200===u.status){var r=u.response;e.context.decodeAudioData(r,(function(r){e.rirs[n]=r;for(var i=0,o=e.rirs;i<o.length;i++){if(void 0===o[i])return}s&&s(t)}),(function(t){o&&o(t,"decode")}))}},u.open("GET",r,!0),u.responseType="arraybuffer",u.send(null)},e}(r(1643).Effector);e.Reverb=s},7223:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Ringmodulator=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.amplitude=e.createGain(),r.amplitude.gain.value=0,r.depth.gain.value=1,r.rate.value=0,r.deactivate(),r.lfo.connect(r.depth),r.depth.connect(r.amplitude.gain),r}return i(e,t),e.prototype.stop=function(e,r){t.prototype.stop.call(this,e,r),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.amplitude.gain))},e.prototype.connect=function(){return this.input.disconnect(0),this.amplitude.disconnect(0),this.isActive?(this.input.connect(this.amplitude),this.amplitude.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"depth":return this.depth.gain.value;case"rate":return this.rate.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"depth":"number"==typeof s&&(this.depth.gain.value=s);break;case"rate":"number"==typeof s&&(this.rate.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,depth:this.depth.gain.value,rate:this.rate.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.Ringmodulator=s},8976:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Stereo=void 0;var s=function(t){function e(r,n){var i=t.call(this,r,n)||this;return i.splitter=r.createChannelSplitter(2),i.merger=r.createScriptProcessor(n,2,2),i.delayL=r.createDelay(e.MAX_DELAY_TIME),i.delayR=r.createDelay(e.MAX_DELAY_TIME),i.delayL.delayTime.value=0,i.delayR.delayTime.value=0,i.deactivate(),i}return i(e,t),e.prototype.start=function(){var t=this;if(this.isActive&&this.paused){this.paused=!1;var e=this.processor.bufferSize;this.processor.onaudioprocess=function(r){var n=r.inputBuffer.getChannelData(0),i=r.inputBuffer.getChannelData(1),s=r.outputBuffer.getChannelData(0),o=r.outputBuffer.getChannelData(1);if(t.isActive&&0!==t.delayL.delayTime.value&&0!==t.delayR.delayTime.value)for(var a=0;a<e;a++)s[a]=n[a],o[a]=-i[a];else s.set(n),o.set(i)}}},e.prototype.stop=function(){this.isActive&&(this.paused=!0,this.processor.disconnect(0),this.processor.onaudioprocess=null,this.connect())},e.prototype.connect=function(){return this.input.disconnect(0),this.splitter.disconnect(0),this.delayL.disconnect(0),this.delayR.disconnect(0),this.merger.disconnect(0),this.isActive?(this.input.connect(this.splitter),this.splitter.connect(this.delayL,0,0),this.splitter.connect(this.delayR,1,0),this.delayL.connect(this.merger),this.delayR.connect(this.merger),this.merger.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)return"time"===t?this.delayL.delayTime.value:this;for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];if("time"===i)"number"==typeof s&&(this.delayL.delayTime.value=s,this.delayR.delayTime.value=s)}return this},e.prototype.params=function(){return{state:this.isActive,time:this.delayL.delayTime.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e.MAX_DELAY_TIME=1,e}(r(1643).Effector);e.Stereo=s},4979:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Tremolo=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.amplitude=e.createGain(),r.amplitude.gain.value=1,r.lfo.type="sine",r.depth.gain.value=0,r.rate.value=0,r.deactivate(),r.lfo.connect(r.depth),r.depth.connect(r.amplitude.gain),r}return i(e,t),e.prototype.stop=function(e,r){t.prototype.stop.call(this,e,r),this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.amplitude.gain))},e.prototype.connect=function(){return this.input.disconnect(0),this.amplitude.disconnect(0),this.isActive?(this.input.connect(this.amplitude),this.amplitude.connect(this.output)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"type":return this.lfo.type;case"depth":return this.depth.gain.value;case"rate":return this.rate.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"type":"string"==typeof s&&(this.lfo.type=s);break;case"depth":"number"==typeof s&&(this.depth.gain.value=s);break;case"rate":"number"==typeof s&&(this.rate.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,type:this.lfo.type,depth:this.depth.gain.value,rate:this.rate.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.Tremolo=s},3449:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VocalCanceler=void 0;var r=function(){function t(){this.depth=0}return t.prototype.start=function(t,e){return t-this.depth*e},t.prototype.param=function(t){if("string"==typeof t)return"depth"===t?this.depth:this;for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];if("depth"===i)"number"==typeof s&&(this.depth=s)}return this},t.prototype.params=function(){return{depth:this.depth}},t}();e.VocalCanceler=r},6813:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Wah=void 0;var s=function(t){function e(e){var r=t.call(this,e,0)||this;return r.auto=!1,r.depthRate=0,r.lowpass=e.createBiquadFilter(),r.envelopeFollower=e.createWaveShaper(),r.sensitivity=e.createBiquadFilter(),r.lowpass.type="lowpass",r.lowpass.frequency.value=r.auto?20:350,r.lowpass.Q.value=1,r.lowpass.gain.value=0,r.envelopeFollower.curve=new Float32Array([1,0,1]),r.sensitivity.type="lowpass",r.sensitivity.frequency.value=350,r.sensitivity.Q.value=1,r.sensitivity.gain.value=0,r.depth.gain.value=0,r.rate.value=0,r.deactivate(),r.connect(),r}return i(e,t),e.prototype.stop=function(e,r){t.prototype.stop.call(this,e,r),!this.auto&&this.isActive&&(this.lfo.connect(this.depth),this.depth.connect(this.lowpass.frequency))},e.prototype.connect=function(){return this.input.disconnect(0),this.sensitivity.disconnect(0),this.envelopeFollower.disconnect(0),this.lowpass.disconnect(0),this.depth.disconnect(0),this.isActive?this.auto?(this.input.connect(this.sensitivity),this.sensitivity.connect(this.output),this.input.connect(this.envelopeFollower),this.envelopeFollower.connect(this.lowpass),this.lowpass.connect(this.depth),this.depth.connect(this.sensitivity.frequency)):(this.input.connect(this.lowpass),this.lowpass.connect(this.output),this.lfo.connect(this.depth),this.depth.connect(this.lowpass.frequency)):this.input.connect(this.output),this.output},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"auto":return this.auto;case"cutoff":return this.auto?this.sensitivity.frequency.value:this.lowpass.frequency.value;case"depth":return this.depthRate;case"rate":return this.rate.value;case"resonance":return this.auto?this.sensitivity.Q.value:this.lowpass.Q.value;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"auto":"boolean"==typeof s&&(this.auto=s,this.connect());break;case"cutoff":"number"==typeof s&&(this.auto?(this.sensitivity.frequency.value=s,this.lowpass.frequency.value=20):this.lowpass.frequency.value=s);break;case"depth":"number"==typeof s&&(this.depthRate=s,this.depth.gain.value=this.auto?1e4*s:this.lowpass.frequency.value*s);break;case"rate":"number"==typeof s&&(this.rate.value=s);break;case"resonance":"number"==typeof s&&(this.auto?(this.sensitivity.Q.value=s,this.lowpass.Q.value=1):this.lowpass.Q.value=s)}}return this},e.prototype.params=function(){return{state:this.isActive,auto:this.auto,cutoff:this.auto?this.sensitivity.frequency.value:this.lowpass.frequency.value,depth:this.auto?this.depth.gain.value:this.depthRate,rate:this.rate.value,resonance:this.auto?this.sensitivity.Q.value:this.lowpass.Q.value}},e.prototype.activate=function(){return t.prototype.activate.call(this),this},e.prototype.deactivate=function(){return t.prototype.deactivate.call(this),this},e}(r(1643).Effector);e.Wah=s},422:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Channel=void 0;var r=function(){function t(t){this.tracks=[],this.channelGain=1,this.id=t}return t.prototype.append=function(t){return this.tracks.push(t),this},t.prototype.get=function(t){return"number"==typeof t&&t>=0&&t<this.tracks.length?this.tracks[t]:this.tracks},t.prototype.gain=function(t){if(!("number"==typeof t&&t>=0&&t<=1))return this.channelGain;this.channelGain=t},t.prototype.length=function(){return this.tracks.length},t.prototype.toString=function(){return this.id},t}();e.Channel=r},81:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Track=void 0;var r=function(){function t(t){this.dataBlocks=[],this.id=t}return t.prototype.get=function(){return this.dataBlocks},t.prototype.append=function(t){return this.dataBlocks.push(t),this},t.prototype.clear=function(){this.dataBlocks.length=0},t.prototype.has=function(){return this.dataBlocks.length>0},t.prototype.toString=function(){return this.id},t}();e.Track=r},7806:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Recorder=void 0;var n=r(81),i=r(422),s=function(){function t(t,e,r,n){this.channels=[],this.activeTrack=-1,this.paused=!0,this.processor=t.createScriptProcessor(e,r,n),this.sampleRate=t.sampleRate}return t.prototype.setup=function(t,e){this.channels.push(new i.Channel("0")),this.channels.push(new i.Channel("1"));for(var r=0,s=this.channels;r<s.length;r++)for(var o=s[r],a=0;a<e;a++)o.append(new n.Track(a.toString(10)));return this},t.prototype.ready=function(t){return this.hasTrack(t)?this.activeTrack=t:this.activeTrack=-1,this},t.prototype.start=function(){var t=this;if(-1===this.activeTrack||!this.paused)return this;this.paused=!1;var e=this.channels[0].gain(),r=this.channels[1].gain(),n=this.channels[0].get(this.activeTrack),i=this.channels[1].get(this.activeTrack),s=this.processor.bufferSize;return this.processor.onaudioprocess=function(o){if(-1!==t.activeTrack){for(var a=o.inputBuffer.getChannelData(0),u=o.inputBuffer.getChannelData(1),c=new Float32Array(s),l=new Float32Array(s),h=0;h<s;h++)c[h]=e*a[h],l[h]=r*u[h];null==n||n.append(c),null==i||i.append(l)}else t.processor.disconnect(0),t.processor.onaudioprocess=null},this},t.prototype.stop=function(){return this.activeTrack=-1,this.paused=!0,this.processor.disconnect(0),this.processor.onaudioprocess=null,this},t.prototype.param=function(t){if("string"==typeof t)switch(t){case"0":if(this.channels[0])return this.channels[0].gain();break;case"1":if(this.channels[1])return this.channels[1].gain();break;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"0":this.channels[0]&&"number"==typeof s&&this.channels[0].gain(s);break;case"1":this.channels[1]&&"number"==typeof s&&this.channels[1].gain(s)}}return this},t.prototype.get=function(){return this.activeTrack},t.prototype.clear=function(t){if(-1!==this.activeTrack&&this.stop(),-1===t)for(var e=0,r=this.channels;e<r.length;e++)for(var n=0,i=r[e].get();n<i.length;n++){(a=i[n]).clear()}else if(this.hasTrack(t))for(var s=0,o=this.channels;s<o.length;s++){var a;null==(a=o[s].get(t))||a.clear()}return this},t.prototype.create=function(t,e,r,n){-1!==this.activeTrack&&this.stop();var i=null,s=null;if(-1===t&&this.has(-1,-1))i=this.mixTrack(0),s=this.mixTrack(1);else{if(!this.has(0,t)||!this.has(1,t))return"";i=this.flatTrack(0,t),s=this.flatTrack(1,t)}if(null===i||null===s)return"";var o=this.sampleRate,a=r,u=e,c=1===u?Math.min(i.length,s.length):2*Math.min(i.length,s.length),l=36+c*(a/8),h=8+(28+(8+c*(a/8))),p=o*u*(a/8),f=c*(a/8),d=null;switch(a){case 8:d=new Uint8Array(c);for(var v=0;v<c;v++){var y=0;(y=v%u==0?Math.round((i[Math.trunc(v/u)]+1)/2*(Math.pow(2,8)-1)):Math.round((s[Math.trunc(v/u)]+1)/2*(Math.pow(2,8)-1)))>Math.pow(2,8)-1&&(y=Math.pow(2,8)-1),y<Math.pow(2,0)-1&&(y=Math.pow(2,0)-1),d[v]=y}break;case 16:d=new Int16Array(c);for(v=0;v<c;v++){y=0;(y=v%u==0?Math.round(i[Math.trunc(v/u)]*Math.pow(2,15)):Math.round(s[Math.trunc(v/u)]*Math.pow(2,15)))>+Math.pow(2,15)-1&&(y=+Math.pow(2,15)-1),y<-Math.pow(2,15)-0&&(y=-Math.pow(2,15)-0),d[v]=y}}if(null===d)return"";var m=new Uint8Array(44+f);m[0]=82,m[1]=73,m[2]=70,m[3]=70,m[4]=l>>0&255,m[5]=l>>8&255,m[6]=l>>16&255,m[7]=l>>24&255,m[8]=87,m[9]=65,m[10]=86,m[11]=69,m[12]=102,m[13]=109,m[14]=116,m[15]=32,m[16]=16,m[17]=0,m[18]=0,m[19]=0,m[20]=1,m[21]=0,m[22]=u,m[23]=0,m[24]=o>>0&255,m[25]=o>>8&255,m[26]=o>>16&255,m[27]=o>>24&255,m[28]=p>>0&255,m[29]=p>>8&255,m[30]=p>>16&255,m[31]=p>>24&255,m[32]=u*(a/8),m[33]=0,m[34]=a,m[35]=0,m[36]=100,m[37]=97,m[38]=116,m[39]=97,m[40]=f>>0&255,m[41]=f>>8&255,m[42]=f>>16&255,m[43]=f>>24&255;for(v=0;v<c;v++)switch(a){case 8:m[h-f+v]=d[v];break;case 16:m[h-f+2*v+0]=d[v]>>0&255,m[h-f+2*v+1]=d[v]>>8&255}switch(n){case"base64":case"dataURL":var b=window.btoa(Array.from(m).map((function(t){return String.fromCodePoint(t)})).join(""));return"base64"===n?b:"data:audio/wav;base64,".concat(b);case"blob":case"objectURL":var g=new Blob([m],{type:"audio/wav"});return"blob"===n?g:window.URL.createObjectURL(g);default:return""}},t.prototype.has=function(t,e){var r;if(!this.hasChannel(t))return this.channels.some((function(t){return t.get().some((function(t){return t.has()}))}));var n=this.channels[t].get();if(!this.hasTrack(e))return n.some((function(t){return t.has()}));var i=this.channels[t].get(e);return null!==(r=null==i?void 0:i.has())&&void 0!==r&&r},t.prototype.hasChannel=function(t){return t>=0&&t<this.channels.length},t.prototype.hasTrack=function(t){return t>=0&&this.channels.every((function(e){return t<e.length()}))},Object.defineProperty(t.prototype,"INPUT",{get:function(){return this.processor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"OUTPUT",{get:function(){return this.processor},enumerable:!1,configurable:!0}),t.prototype.flatTrack=function(t,e){if(!this.hasChannel(t)||!this.hasTrack(e))return null;var r=this.channels[t].get(e);if(null===r)return null;for(var n=r.get(),i=this.processor.bufferSize,s=new Float32Array(n.length*i),o=0,a=n.length;o<a;o++)for(var u=n[o],c=0;c<i;c++)s[o*i+c]=u[c];return s},t.prototype.mixTrack=function(t){if(!this.hasChannel(t))return null;for(var e=this.channels[t].get(),r=this.processor.bufferSize,n=0,i=0,s=0,o=0,a=0,u=0,c=e;u<c.length;u++){a<(f=c[u].get()).length&&(a=f.length)}for(var l=new Float32Array(a*r);;){for(var h=0,p=e.length;h<p;h++){var f,d=(f=e[h].get())[s];d&&o>=0&&o<=d.length&&(n+=d[o],i++)}if(i<=0)return l;l[s*r+o]=n/i,n=0,i=0,o<r-1?o++:(s++,o=0)}},t}();e.Recorder=s},7836:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Room=void 0;var r=function(){function t(e,r,n,i,s,o){this.websocket=null,this.id=e,this.context=r,this.analyser=o,this.sender=r.createScriptProcessor(t.BUFFER_SIZE,i,s),this.receiver=r.createScriptProcessor(t.BUFFER_SIZE,i,s)}return t.prototype.join=function(t){var e=this,r=t.tls,n=t.host,i=t.port,s=t.path,o=t.openCallback,a=t.closeCallback,u=t.errorCallback,c=r?"wss://":"ws://";this.websocket=new WebSocket("".concat(c).concat(n,":").concat(i).concat(s)),this.websocket.binaryType="arraybuffer",this.websocket.onopen=function(t){null!==e.websocket&&(e.websocket.send(e.id),o&&o(t))},this.websocket.onclose=function(t){a&&a(t)},this.websocket.onerror=function(t){u&&u(t)},this.websocket.onmessage=function(t){if(null!==e.websocket&&t.data instanceof ArrayBuffer){var r=t.data.byteLength/Float32Array.BYTES_PER_ELEMENT,n=Math.trunc(r/2),i=n*Float32Array.BYTES_PER_ELEMENT,s=new Float32Array(t.data,0,n),o=new Float32Array(t.data,i,n);e.connect(),e.analyser.start("time"),e.analyser.start("fft"),e.receiver.onaudioprocess=function(t){var r=t.outputBuffer.getChannelData(0),n=t.outputBuffer.getChannelData(1);r.set(s),n.set(o),e.connected()||(e.analyser.stop("time"),e.analyser.stop("fft"))}}}},t.prototype.send=function(){var t=this;if(null!==this.websocket){var e=this.sender.bufferSize;this.sender.onaudioprocess=function(r){if(t.connected()){for(var n=r.inputBuffer.getChannelData(0),i=r.inputBuffer.getChannelData(1),s=new Float32Array(2*e),o=Math.trunc(s.length/2),a=0;a<e;a++)s[a]=n[a],s[o+a]=i[a];null!==t.websocket&&0===t.websocket.bufferedAmount&&(t.websocket.send(t.id),t.websocket.send(s))}}}},t.prototype.leave=function(){this.connected()&&(this.sender.disconnect(0),this.receiver.disconnect(0))},t.prototype.destroy=function(){null!==this.websocket&&(this.websocket.send(this.id),this.websocket.close(),this.websocket=null)},t.prototype.connect=function(){this.receiver.connect(this.analyser.INPUT),this.receiver.connect(this.context.destination)},t.prototype.connected=function(){return null!==this.websocket&&this.websocket.readyState===WebSocket.OPEN},t.prototype.get=function(){var t;return(t={})[this.id]=this.websocket,t},Object.defineProperty(t.prototype,"INPUT",{get:function(){return this.sender},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"OUTPUT",{get:function(){return this.sender},enumerable:!1,configurable:!0}),t.prototype.toString=function(){return this.id},t.BUFFER_SIZE=2048,t}();e.Room=r},173:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Session=void 0;var n=r(7836),i=function(){function t(t){this.rooms=[],this.context=t,this.input=t.createGain(),this.output=t.createGain()}return t.prototype.setup=function(t,e,r,i,s){return this.rooms.push(new n.Room(t,this.context,e,r,i,s)),this},t.prototype.ready=function(t,e){var r=this.get(t);return null===r||r.join(e),this},t.prototype.start=function(t){var e=this.get(t);return null===e||(this.connect(t),e.send()),this},t.prototype.stop=function(t){var e=this.get(t);return null===e||e.leave(),this},t.prototype.destroy=function(t){var e=this.get(t);return null===e||e.destroy(),this},t.prototype.connect=function(t){var e=this.get(t);return null===e||(this.input.connect(e.INPUT),e.OUTPUT.connect(this.output)),this},t.prototype.connected=function(t){var e=this.get(t);return null!==e&&e.connected()},t.prototype.get=function(t){return this.rooms.find((function(e){return e.toString()===t}))||null},Object.defineProperty(t.prototype,"INPUT",{get:function(){return this.input},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"OUTPUT",{get:function(){return this.output},enumerable:!1,configurable:!0}),t}();e.Session=i},2188:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SoundModule=void 0;var n=r(8397),i=r(7806),s=r(173),o=r(8044),a=r(8649),u=r(346),c=r(4535),l=r(1605),h=r(8137),p=r(111),f=r(7369),d=r(6548),v=r(4226),y=r(3751),m=r(2393),b=r(4833),g=r(1063),w=r(7223),T=r(8976),k=r(4979),_=r(6813),A=function(){function t(e,r){this.modules=[],this.context=e,this.mastervolume=e.createGain(),this.processor=e.createScriptProcessor(r,t.NUMBER_OF_INPUTS,t.NUMBER_OF_OUTPUTS),this.analyser=new n.Analyser(e),this.recorder=new i.Recorder(e,r,2,2),this.session=new s.Session(e),this.stereo=new T.Stereo(e,r),this.compressor=new u.Compressor(e),this.distortion=new l.Distortion(e),this.wah=new _.Wah(e),this.pitchshifter=new b.PitchShifter(e,r),this.equalizer=new p.Equalizer(e),this.filter=new f.Filter(e),this.autopanner=new o.Autopanner(e),this.tremolo=new k.Tremolo(e),this.ringmodulator=new w.Ringmodulator(e),this.phaser=new m.Phaser(e),this.flanger=new d.Flanger(e),this.chorus=new a.Chorus(e),this.delay=new c.Delay(e),this.reverb=new g.Reverb(e),this.panner=new y.Panner(e),this.listener=new v.Listener(e),this.envelopegenerator=new h.EnvelopeGenerator(e),this.modules=[this.stereo,this.compressor,this.distortion,this.wah,this.pitchshifter,this.equalizer,this.filter,this.autopanner,this.tremolo,this.ringmodulator,this.phaser,this.flanger,this.chorus,this.delay,this.reverb,this.panner]}return t.prototype.resize=function(t){return this.init(this.context,t),this},t.prototype.getBufferSize=function(){return this.processor.bufferSize},t.prototype.install=function(t,e){return this.modules.every((function(t){return t!==e}))&&this.modules.push(e),e},t.prototype.on=function(t){var e=null!=t?t:this.context.currentTime;return this.stereo.start(),this.chorus.start(e),this.flanger.start(e),this.phaser.start(e),this.autopanner.start(e),this.tremolo.start(e),this.ringmodulator.start(e),this.wah.start(e),this.filter.start(e),this},t.prototype.off=function(t){var e=null!=t?t:this.context.currentTime;return this.stereo.stop(),this.chorus.stop(e),this.flanger.stop(e),this.phaser.stop(e),this.autopanner.stop(e),this.tremolo.stop(e),this.ringmodulator.stop(e),this.wah.stop(e),this.filter.stop(e),this},t.prototype.suspend=function(){return this.analyser.stop("time"),this.analyser.stop("fft"),this.recorder.stop(),this.processor.disconnect(0),this},t.prototype.params=function(){return{mastervolume:this.mastervolume.gain.value,stereo:this.stereo.params(),compressor:this.compressor.params(),distortion:this.distortion.params(),wah:this.wah.params(),pitchshifter:this.pitchshifter.params(),equalizer:this.equalizer.params(),filter:this.filter.params(),autopanner:this.autopanner.params(),tremolo:this.tremolo.params(),ringmodulator:this.ringmodulator.params(),phaser:this.phaser.params(),flanger:this.flanger.params(),chorus:this.chorus.params(),delay:this.delay.params(),reverb:this.reverb.params(),panner:this.panner.params(),listener:this.listener.params(),envelopegenerator:this.envelopegenerator.params()}},t.prototype.toJSON=function(){return JSON.stringify(this.params())},Object.defineProperty(t.prototype,"INPUT",{get:function(){return this.processor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"OUTPUT",{get:function(){return this.mastervolume},enumerable:!1,configurable:!0}),t.prototype.init=function(e,r){if(this.modules.length>0){this.mastervolume.disconnect(0),this.processor.disconnect(0),this.analyser.INPUT.disconnect(0),this.recorder.INPUT.disconnect(0),this.session.INPUT.disconnect(0);for(var A=0,S=this.modules;A<S.length;A++){var O=S[A];O.INPUT&&O.INPUT.disconnect(0),O.OUTPUT&&O.OUTPUT.disconnect(0)}this.modules.length=0}this.processor=e.createScriptProcessor(r,t.NUMBER_OF_INPUTS,t.NUMBER_OF_OUTPUTS),this.analyser=new n.Analyser(e),this.recorder=new i.Recorder(e,r,2,2),this.session=new s.Session(e),this.stereo=new T.Stereo(e,r),this.compressor=new u.Compressor(e),this.distortion=new l.Distortion(e),this.wah=new _.Wah(e),this.pitchshifter=new b.PitchShifter(e,r),this.equalizer=new p.Equalizer(e),this.filter=new f.Filter(e),this.autopanner=new o.Autopanner(e),this.tremolo=new k.Tremolo(e),this.ringmodulator=new w.Ringmodulator(e),this.phaser=new m.Phaser(e),this.flanger=new d.Flanger(e),this.chorus=new a.Chorus(e),this.delay=new c.Delay(e),this.reverb=new g.Reverb(e),this.panner=new y.Panner(e),this.listener=new v.Listener(e),this.envelopegenerator=new h.EnvelopeGenerator(e),this.modules=[this.stereo,this.compressor,this.distortion,this.wah,this.pitchshifter,this.equalizer,this.filter,this.autopanner,this.tremolo,this.ringmodulator,this.phaser,this.flanger,this.chorus,this.delay,this.reverb,this.panner]},t.prototype.connect=function(t){var e=this.modules[0].INPUT;if(null!==e){t.disconnect(0),this.modules.length>0?t.connect(e):t.connect(this.mastervolume);for(var r=0,n=this.modules.length;r<n;r++){var i=this.modules[r].OUTPUT;if(null!==i)if(i.disconnect(0),r<this.modules.length-1){var s=this.modules[r+1].INPUT;if(null===s)continue;i.connect(s)}else i.connect(this.mastervolume)}this.mastervolume.connect(this.context.destination),this.mastervolume.connect(this.analyser.INPUT),this.mastervolume.connect(this.recorder.INPUT),this.recorder.OUTPUT.connect(this.context.destination),this.mastervolume.connect(this.session.INPUT),this.session.OUTPUT.connect(this.context.destination)}},t.NUMBER_OF_INPUTS=2,t.NUMBER_OF_OUTPUTS=2,t}();e.SoundModule=A},553:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoiseGate=void 0;var r=function(){function t(){this.level=0}return t.prototype.start=function(t){return Math.abs(t)>this.level?t:0},t.prototype.param=function(t){if("string"==typeof t)return"level"===t?this.level:void 0;for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];if("level"===i)"number"==typeof s&&(this.level=s)}},t.prototype.params=function(){return{level:this.level}},t}();e.NoiseGate=r},5413:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NoiseSuppressor=void 0;var n=r(999),i=function(){function t(){this.threshold=0}return t.prototype.start=function(t,e,r){if(0!==this.threshold){var i=new Float32Array(t),s=new Float32Array(r),o=new Float32Array(r),a=new Float32Array(r),u=new Float32Array(r),c=new Float32Array(r);(0,n.FFT)(i,s,r);for(var l=0;l<r;l++)u[l]=Math.sqrt(Math.pow(i[l],2)+Math.pow(s[l],2)),0!==i[l]&&0!==s[l]&&(c[l]=Math.atan2(s[l],i[l]));for(l=0;l<r;l++)u[l]-=this.threshold,u[l]<0&&(u[l]=0);for(l=0;l<r;l++)o[l]=u[l]*Math.cos(c[l]),a[l]=u[l]*Math.sin(c[l]);(0,n.IFFT)(o,a,r),e.set(o)}else e.set(t)},t.prototype.param=function(t){if("string"==typeof t)return"threshold"===t?this.threshold:void 0;for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];if("threshold"===i)"number"==typeof s&&s>=0&&(this.threshold=s)}},t.prototype.params=function(){return{threshold:this.threshold}},t}();e.NoiseSuppressor=i},3594:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=this&&this.__assign||function(){return s=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},s.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.StreamModule=void 0;var o=r(2188),a=r(553),u=r(5413),c=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.sources=[],n.stream=null,n.constraints={audio:!0,video:!1},n.output=!0,n.track=!1,n.paused=!0,n.noisegate=new a.NoiseGate,n.noisesuppressor=new u.NoiseSuppressor,n}return i(e,t),e.prototype.setup=function(t){return t&&(this.constraints=s(s({},this.constraints),t)),this},e.prototype.ready=function(t){var e=this;return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&window.MediaStream?(this.paused=!1,(null==t?void 0:t.stream)?(this.stream=t.stream,Promise.resolve()):navigator.mediaDevices.getUserMedia(this.constraints).then((function(r){e.paused||(e.stream=r,(null==t?void 0:t.successCallback)&&t.successCallback(r))})).catch((function(e){(null==t?void 0:t.errorCallback)&&t.errorCallback(e)}))):Promise.reject()},e.prototype.start=function(){var t=this;if(null===this.stream)return this;var e=this.processor.bufferSize,r=!1;if(this.track)for(var n=this.stream.getAudioTracks(),i=0,s=n.length;i<s;i++)this.sources[i]=this.context.createMediaStreamTrackSource(n[i]),this.sources[i].connect(this.processor),this.connect(this.processor);else this.sources[0]=this.context.createMediaStreamSource(this.stream),this.sources[0].connect(this.processor),this.connect(this.processor);return this.output||(this.mastervolume.disconnect(0),this.mastervolume.connect(this.analyser.INPUT),this.mastervolume.connect(this.recorder.INPUT),this.recorder.OUTPUT.connect(this.context.destination),this.mastervolume.connect(this.session.INPUT),this.session.OUTPUT.connect(this.context.destination)),this.on(this.context.currentTime),r||(this.analyser.start("time"),this.analyser.start("fft"),r=!0),this.processor.onaudioprocess=function(r){var n=r.inputBuffer.getChannelData(0),i=r.inputBuffer.getChannelData(1),s=r.outputBuffer.getChannelData(0),o=r.outputBuffer.getChannelData(1),a=t.noisesuppressor.param("threshold"),u=t.noisegate.param("level");if("number"==typeof a&&a>0)t.noisesuppressor.start(n,s,e),t.noisesuppressor.start(i,o,e);else if("number"==typeof u&&u>0)for(var c=0;c<e;c++)s[c]=t.noisegate.start(n[c]),o[c]=t.noisegate.start(i[c]);else s.set(n),o.set(i)},this},e.prototype.stop=function(){return this.sources.length=0,this.off(this.context.currentTime),this.analyser.stop("time"),this.analyser.stop("fft"),this.processor.disconnect(0),this.processor.onaudioprocess=null,this.paused=!0,this},e.prototype.param=function(t){if("string"==typeof t)switch(t){case"mastervolume":return this.mastervolume.gain.value;case"output":return this.output;case"track":return this.track;default:return this}for(var e=0,r=Object.entries(t);e<r.length;e++){var n=r[e],i=n[0],s=n[1];switch(i){case"mastervolume":"number"==typeof s&&(this.mastervolume.gain.value=s);break;case"output":"boolean"==typeof s&&(this.output=s);break;case"track":"boolean"==typeof s&&(this.track=s)}}return this},e.prototype.get=function(t){return"number"==typeof t&&t>=0&&t<this.sources.length?this.sources[t]:this.sources},e.prototype.getStream=function(){return this.stream},e.prototype.clear=function(){return this.stop(),this.clearAudioDevices(),this.clearVideoDevices(),this.stream=null,this},e.prototype.clearAudioDevices=function(){if(null===this.stream)return this;this.stop();for(var t=0,e=this.stream.getAudioTracks();t<e.length;t++){e[t].stop()}return this},e.prototype.clearVideoDevices=function(){if(null===this.stream)return this;this.stop();for(var t=0,e=this.stream.getVideoTracks();t<e.length;t++){e[t].stop()}return this.stream=null,this},e.prototype.devices=function(){return navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices?navigator.mediaDevices.enumerateDevices():Promise.reject()},e.prototype.streaming=function(){return!this.paused},e.prototype.module=function(t){switch(t){case"analyser":return this.analyser;case"recorder":return this.recorder;case"session":return this.session;case"autopanner":return this.autopanner;case"chorus":return this.chorus;case"compressor":return this.compressor;case"delay":return this.delay;case"distortion":return this.distortion;case"equalizer":return this.equalizer;case"filter":return this.filter;case"flanger":return this.flanger;case"listener":return this.listener;case"panner":return this.panner;case"phaser":return this.phaser;case"pitchshifter":return this.pitchshifter;case"reverb":return this.reverb;case"ringmodulator":return this.ringmodulator;case"stereo":return this.stereo;case"tremolo":return this.tremolo;case"wah":return this.wah;case"envelopegenerator":return this.envelopegenerator;case"noisegate":return this.noisegate;case"noisesuppressor":return this.noisesuppressor;default:return null}},e.prototype.resize=function(e){return t.prototype.init.call(this,this.context,e),this},e.prototype.on=function(e){return t.prototype.on.call(this,e),this},e.prototype.off=function(e){return t.prototype.off.call(this,e),this},e.prototype.suspend=function(){return t.prototype.suspend.call(this),this},e.prototype.params=function(){var e=t.prototype.params.call(this);return s(s({},e),{output:this.output,track:this.track,noisegate:this.noisegate.params(),noisesuppressor:this.noisesuppressor.params()})},e}(o.SoundModule);e.StreamModule=c},999:(t,e)=>{function r(t){return t>=0?e.MIN_A*Math.pow(e.FREQUENCY_RATIO,t):0}function n(t){var e=t.file,r=t.type,n=t.successCallback,i=t.errorCallback,s=t.progressCallback,o=new FileReader;switch(o.onprogress=function(t){s&&s(t)},o.onerror=function(t){var e,r,n,s,a;if(i){var u;switch(null===(e=o.error)||void 0===e?void 0:e.code){case null===(r=o.error)||void 0===r?void 0:r.NOT_FOUND_ERR:u="NOT_FOUND_ERR";break;case null===(n=o.error)||void 0===n?void 0:n.SECURITY_ERR:u="SECURITY_ERR";break;case null===(s=o.error)||void 0===s?void 0:s.ABORT_ERR:u="ABORT_ERR";break;case null===(a=o.error)||void 0===a?void 0:a.NOT_SUPPORTED_ERR:u="NOT_READABLE_ERR";break;default:u="ERR"}i(t,u)}},o.onload=function(t){if(n){var e=o.result;"string"!=typeof e||e.startsWith("data:")||e.startsWith("blob:")||(e=e.replace(/<(\/?script.*?)>/gi,"<$1>")),"string"==typeof e&&"json"===r&&(e=JSON.parse(e)),n(t,e)}},r){case"arraybuffer":o.readAsArrayBuffer(e);break;case"dataURL":o.readAsDataURL(e);break;case"text":case"json":o.readAsText(e,"UTF-8")}}Object.defineProperty(e,"__esModule",{value:!0}),e.toTextFile=e.toFrequencies=e.file=e.drop=e.read=e.exitFullscreen=e.requestFullscreen=e.decode=e.convertTime=e.ajax=e.IFFT=e.FFT=e.computeFrequency=e.computeIndex=e.isPitchChar=e.DOT=e.HALF_DOWN=e.HALF_UP=e.SHARP=e.QUARTER_NOTE=e.MIN_A=e.FREQUENCY_RATIO=e.EQUAL_TEMPERAMENT=void 0,e.EQUAL_TEMPERAMENT=12,e.FREQUENCY_RATIO=Math.pow(2,1/e.EQUAL_TEMPERAMENT),e.MIN_A=27.5,e.QUARTER_NOTE=4,e.SHARP="#",e.HALF_UP="+",e.HALF_DOWN="-",e.DOT=".",e.isPitchChar=function(t){switch(t.toUpperCase()){case"C":case"D":case"E":case"F":case"G":case"A":case"B":case"R":return!0;default:return!1}},e.computeIndex=function(t,r){var n=0;switch(r){case"C":n=3;break;case"D":n=5;break;case"E":n=7;break;case"F":n=8;break;case"G":n=10;break;case"A":n=12;break;case"B":n=14;break;case"R":return-1}var i=e.EQUAL_TEMPERAMENT*(t-1)+n;return i>=0?i:-1},e.computeFrequency=r,e.FFT=function(t,e,r){for(var n=function(t){return Math.pow(2,t)},i=new Float32Array(r),s=Math.log2(r),o=1;o<=s;o++)for(var a=0;a<n(o-1);a++)for(var u=s-o,c=0;c<n(u);c++){var l=a*n(u+1)+c,h=n(u)+l,p=c*n(o-1),f=t[l],d=e[l],v=t[h],y=e[h],m=Math.cos(2*Math.PI*p/r),b=-1*Math.sin(2*Math.PI*p/r);o<s?(t[l]=f+v,e[l]=d+y,t[h]=m*(f-v)-b*(d-y),e[h]=m*(d-y)+b*(f-v)):(t[l]=f+v,e[l]=d+y,t[h]=f-v,e[h]=d-y)}for(o=1;o<=s;o++)for(u=s-o,a=0;a<n(o-1);a++)i[n(o-1)+a]=i[a]+n(u);for(var g=0;g<r;g++)if(!(i[g]<=g)){var w=t[i[g]],T=e[i[g]];t[i[g]]=t[g],e[i[g]]=e[g],t[g]=w,e[g]=T}},e.IFFT=function(t,e,r){for(var n=function(t){return Math.pow(2,t)},i=new Float32Array(r),s=Math.log2(r),o=1;o<=s;o++)for(var a=0;a<n(o-1);a++)for(var u=s-o,c=0;c<n(u);c++){var l=a*n(u+1)+c,h=n(u)+l,p=c*n(o-1),f=t[l],d=e[l],v=t[h],y=e[h],m=Math.cos(2*Math.PI*p/r),b=Math.sin(2*Math.PI*p/r);o<s?(t[l]=f+v,e[l]=d+y,t[h]=m*(f-v)-b*(d-y),e[h]=m*(d-y)+b*(f-v)):(t[l]=f+v,e[l]=d+y,t[h]=f-v,e[h]=d-y)}for(o=1;o<=s;o++)for(u=s-o,a=0;a<n(o-1);a++)i[n(o-1)+a]=i[a]+n(u);for(var g=0;g<r;g++)if(!(i[g]<=g)){var w=t[i[g]],T=e[i[g]];t[i[g]]=t[g],e[i[g]]=e[g],t[g]=w,e[g]=T}for(g=0;g<r;g++)t[g]/=r,e[g]/=r},e.ajax=function(t){var e=t.url,r=t.type,n=t.timeout,i=t.successCallback,s=t.errorCallback,o=t.progressCallback,a=new XMLHttpRequest;a.timeout=null!=n?n:6e4,a.ontimeout=function(t){s&&s(t,"timeout")},a.onprogress=function(t){o&&o(t)},a.onerror=function(t){s&&s(t,"error")},a.onload=function(t){i&&200===a.status&&i(t,a.response)},a.open("GET",e,!0),a.responseType=null!=r?r:"arraybuffer",a.send(null)},e.convertTime=function(t){return t<0?{minutes:-1,seconds:-1,milliseconds:-1}:{minutes:Math.trunc(t/60),seconds:Math.trunc(t%60),milliseconds:t-Math.trunc(t)}},e.decode=function(t,e,r,n){r||(r=function(){}),n||(n=function(){}),t.decodeAudioData(e,r,n)},e.requestFullscreen=function(t){return t.requestFullscreen()},e.exitFullscreen=function(){return document.exitFullscreen()},e.read=n,e.drop=function(t){var e,r,i=t.event,s=t.type,o=t.successCallback,a=t.errorCallback,u=t.progressCallback,c=null!==(r=null===(e=i.dataTransfer)||void 0===e?void 0:e.files.item(0))&&void 0!==r?r:null;return null===c?new Error("Please drop file."):"text"!==s||c.type.includes("text")?"json"!==s||c.type.includes("application/json")?"arraybuffer"!==s&&"dataURL"!==s||/audio|video/.test(c.type)?"objectURL"===s?window.URL.createObjectURL(c):(n({file:c,type:s,successCallback:o,errorCallback:a,progressCallback:u}),c):new Error("Please drop audio or video file."):new Error("Please drop JSON file."):new Error("Please drop text file.")},e.file=function(t){var e,r,i=t.event,s=t.type,o=t.successCallback,a=t.errorCallback,u=t.progressCallback,c=null!==(r=null===(e=i.target.files)||void 0===e?void 0:e.item(0))&&void 0!==r?r:null;return null===c?new Error("Please upload file."):"text"!==s||c.type.includes("text")?"json"!==s||c.type.includes("application/json")?"arraybuffer"!==s&&"dataURL"!==s||/audio|video/.test(c.type)?"objectURL"===s?window.URL.createObjectURL(c):(n({file:c,type:s,successCallback:o,errorCallback:a,progressCallback:u}),c):new Error("Please upload audio or video file."):new Error("Please upload JSON file."):new Error("Please upload text file.")},e.toFrequencies=function(t){return t.map((function(t){return r(t)}))},e.toTextFile=function(t){var e=window.btoa(function(t){for(var e="",r=0,n=t.length;r<n;r++){var i=t.charCodeAt(r);e+=i>255?"&#".concat(i,";"):t.charAt(r)}return e}(String(t)));return"data:text/plain;base64,".concat(e)}},2309:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var s=e[n]={exports:{}};return t[n].call(s.exports,s,s.exports,r),s.exports}var n={};return(()=>{var t=n;Object.defineProperty(t,"__esModule",{value:!0}),t.X=t.XSound=void 0,r(2309);var e=r(6667),i=r(5146),s=r(4903),o=r(1114),a=r(7878),u=r(3594),c=r(6954),l=r(6567),h=r(9206),p=r(7087),f=r(8397),d=r(7806),v=r(173),y=r(1643),m=r(8044),b=r(8649),g=r(346),w=r(4535),T=r(1605),k=r(111),_=r(7369),A=r(6548),S=r(4226),O=r(3751),M=r(2393),x=r(4833),E=r(1063),C=r(7223),P=r(8976),R=r(4979),j=r(6813),N=r(999);window.AudioContext=window.AudioContext||window.webkitAudioContext,window.URL=window.URL||window.webkitURL;var I=new AudioContext,F={oscillator:new e.OscillatorModule(I,0),oneshot:new i.OneshotModule(I,0),noise:new s.NoiseModule(I,0),audio:new o.AudioModule(I,0),media:new a.MediaModule(I,0),stream:new u.StreamModule(I,0),processor:new c.ProcessorModule(I,0),mixer:new l.MixerModule(I,0),midi:new h.MIDI,mml:new p.MML};function q(t){switch(t){case"oscillator":return F.oscillator;case"oneshot":return F.oneshot;case"noise":return F.noise;case"audio":return F.audio;case"media":return F.media;case"stream":return F.stream;case"processor":return F.processor;case"mixer":return F.mixer;case"midi":return F.midi;case"mml":return F.mml;default:return null}}t.XSound=q,t.X=q,q.SAMPLE_RATE=I.sampleRate,q.EQUAL_TEMPERAMENT=N.EQUAL_TEMPERAMENT,q.FREQUENCY_RATIO=N.FREQUENCY_RATIO,q.MIN_A=N.MIN_A,q.QUARTER_NOT=N.QUARTER_NOTE,q.HALF_UP=N.HALF_UP,q.HALF_DOWN=N.HALF_DOWN,q.DOT=N.DOT,q.isPitchChar=N.isPitchChar,q.computeIndex=N.computeIndex,q.computeFrequency=N.computeFrequency,q.FFT=N.FFT,q.IFFT=N.IFFT,q.ajax=N.ajax,q.convertTime=N.convertTime,q.decode=N.decode,q.requestFullscreen=N.requestFullscreen,q.exitFullscreen=N.exitFullscreen,q.read=N.read,q.drop=N.drop,q.file=N.file,q.toFrequencies=N.toFrequencies,q.toTextFile=N.toTextFile,q.Analyser=f.Analyser,q.Recorder=d.Recorder,q.Session=v.Session,q.Effector=y.Effector,q.Autopanner=m.Autopanner,q.Chorus=b.Chorus,q.Compressor=g.Compressor,q.Delay=w.Delay,q.Distortion=T.Distortion,q.Equalizer=k.Equalizer,q.Filter=_.Filter,q.Flanger=A.Flanger,q.Listener=S.Listener,q.Panner=O.Panner,q.Phaser=M.Phaser,q.PitchShifter=x.PitchShifter,q.Reverb=E.Reverb,q.Ringmodulator=C.Ringmodulator,q.Stereo=P.Stereo,q.Tremolo=R.Tremolo,q.Wah=j.Wah,q.setup=function(){return"running"!==I.state?I.resume():Promise.reject()},q.clone=function(){var t={oscillator:new e.OscillatorModule(I,0),oneshot:new i.OneshotModule(I,0),noise:new s.NoiseModule(I,0),audio:new o.AudioModule(I,0),media:new a.MediaModule(I,0),stream:new u.StreamModule(I,0),mixer:new l.MixerModule(I,0),processor:new c.ProcessorModule(I,0),midi:new h.MIDI,mml:new p.MML};function r(e){switch(e){case"oscillator":return t.oscillator;case"oneshot":return t.oneshot;case"noise":return t.noise;case"audio":return t.audio;case"media":return t.media;case"stream":return t.stream;case"processor":return t.processor;case"mixer":return t.mixer;case"midi":return t.midi;case"mml":return t.mml;default:return null}}return r.free=function(e){for(var r=function(e){if(null===e)return"continue";Object.entries(t).forEach((function(r){var n=r[0],i=r[1];e===i&&(t[n]=null)}))},n=0,i=e;n<i.length;n++){r(i[n])}},r},q.free=function(t){for(var e=function(t){if(null===t)return"continue";Object.entries(F).forEach((function(e){var r=e[0],n=e[1];t===n&&(F[r]=null)}))},r=0,n=t;r<n.length;r++){e(n[r])}},q.noConflict=function(t){return window.X===q&&(window.X=void 0),t&&window.XSound===q&&(window.XSound=void 0),q},q.get=function(){return I},q.getCurrentTime=function(){return I.currentTime};var D=function(){q.setup().then((function(){})).catch((function(){})),document.removeEventListener("click",D,!1),document.removeEventListener("mousedown",D,!1),document.removeEventListener("mouseup",D,!1),document.removeEventListener("touchstart",D,!1),document.removeEventListener("touchend",D,!1)};document.addEventListener("click",D,!1),document.addEventListener("mousedown",D,!1),document.addEventListener("mouseup",D,!1),document.addEventListener("touchstart",D,!1),document.addEventListener("touchend",D,!1)})(),n})()}));
|
|
3
3
|
//# sourceMappingURL=xsound.js.map
|