UNPKG

tone

Version:

A Web Audio framework for making interactive music in the browser.

1 lines 350 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Tone=e():t.Tone=e()}("undefined"!=typeof self?self:this,(function(){return function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=9)}([function(t,e,s){!function(t,e,s,n){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=i(e),r=i(s),a=i(n),c=function(t,e,s){return{endTime:e,insertTime:s,type:"exponentialRampToValue",value:t}},h=function(t,e,s){return{endTime:e,insertTime:s,type:"linearRampToValue",value:t}},u=function(t,e){return{startTime:e,type:"setValue",value:t}},l=function(t,e,s){return{duration:s,startTime:e,type:"setValueCurve",values:t}},p=function(t,e,s){var n=s.startTime,i=s.target,o=s.timeConstant;return i+(e-i)*Math.exp((n-t)/o)},d=function(t){return"exponentialRampToValue"===t.type},f=function(t){return"linearRampToValue"===t.type},_=function(t){return d(t)||f(t)},m=function(t){return"setValue"===t.type},g=function(t){return"setValueCurve"===t.type},v=function t(e,s,n,i){var o=e[s];return void 0===o?i:_(o)||m(o)?o.value:g(o)?o.values[o.values.length-1]:p(n,t(e,s-1,o.startTime,i),o)},y=function(t,e,s,n,i){return void 0===s?[n.insertTime,i]:_(s)?[s.endTime,s.value]:m(s)?[s.startTime,s.value]:g(s)?[s.startTime+s.duration,s.values[s.values.length-1]]:[s.startTime,v(t,e-1,s.startTime,i)]},x=function(t){return"cancelAndHold"===t.type},w=function(t){return"cancelScheduledValues"===t.type},b=function(t){return x(t)||w(t)?t.cancelTime:d(t)||f(t)?t.endTime:t.startTime},T=function(t,e,s,n){var i=n.endTime,o=n.value;return s===o?o:0<s&&0<o||s<0&&o<0?s*Math.pow(o/s,(t-e)/(i-e)):0},S=function(t,e,s,n){return s+(t-e)/(n.endTime-e)*(n.value-s)},k=function(t,e){var s=e.duration,n=e.startTime,i=e.values;return function(t,e){var s=Math.floor(e),n=Math.ceil(e);return s===n?t[s]:(1-(e-s))*t[s]+(1-(n-e))*t[n]}(i,(t-n)/s*(i.length-1))},C=function(t){return"setTarget"===t.type},A=function(){function t(e){r.default(this,t),this._automationEvents=[],this._currenTime=0,this._defaultValue=e}return a.default(t,[{key:Symbol.iterator,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(t){var e=b(t);if(x(t)||w(t)){var s=this._automationEvents.findIndex((function(s){return w(t)&&g(s)?s.startTime+s.duration>=e:b(s)>=e})),n=this._automationEvents[s];if(-1!==s&&(this._automationEvents=this._automationEvents.slice(0,s)),x(t)){var i=this._automationEvents[this._automationEvents.length-1];if(void 0!==n&&_(n)){if(C(i))throw new Error("The internal list is malformed.");var o=g(i)?i.startTime+i.duration:b(i),r=g(i)?i.values[i.values.length-1]:i.value,a=d(n)?T(e,o,r,n):S(e,o,r,n),p=d(n)?c(a,e,this._currenTime):h(a,e,this._currenTime);this._automationEvents.push(p)}void 0!==i&&C(i)&&this._automationEvents.push(u(this.getValue(e),e)),void 0!==i&&g(i)&&i.startTime+i.duration>e&&(this._automationEvents[this._automationEvents.length-1]=l(new Float32Array([6,7]),i.startTime,e-i.startTime))}}else{var m=this._automationEvents.findIndex((function(t){return b(t)>e})),v=-1===m?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[m-1];if(void 0!==v&&g(v)&&b(v)+v.duration>e)return!1;var y=d(t)?c(t.value,t.endTime,this._currenTime):f(t)?h(t.value,e,this._currenTime):t;if(-1===m)this._automationEvents.push(y);else{if(g(t)&&e+t.duration>b(this._automationEvents[m]))return!1;this._automationEvents.splice(m,0,y)}}return!0}},{key:"flush",value:function(t){var e=this._automationEvents.findIndex((function(e){return b(e)>t}));if(e>1){var s=this._automationEvents.slice(e-1),n=s[0];C(n)&&s.unshift(u(v(this._automationEvents,e-2,n.startTime,this._defaultValue),n.startTime)),this._automationEvents=s}}},{key:"getValue",value:function(t){if(0===this._automationEvents.length)return this._defaultValue;var e=this._automationEvents[this._automationEvents.length-1],s=this._automationEvents.findIndex((function(e){return b(e)>t})),n=this._automationEvents[s],i=b(e)<=t?e:this._automationEvents[s-1];if(void 0!==i&&C(i)&&(void 0===n||!_(n)||n.insertTime>t))return p(t,v(this._automationEvents,s-2,i.startTime,this._defaultValue),i);if(void 0!==i&&m(i)&&(void 0===n||!_(n)))return i.value;if(void 0!==i&&g(i)&&(void 0===n||!_(n)||i.startTime+i.duration>t))return t<i.startTime+i.duration?k(t,i):i.values[i.values.length-1];if(void 0!==i&&_(i)&&(void 0===n||!_(n)))return i.value;if(void 0!==n&&d(n)){var r=y(this._automationEvents,s-1,i,n,this._defaultValue),a=o.default(r,2),c=a[0],h=a[1];return T(t,c,h,n)}if(void 0!==n&&f(n)){var u=y(this._automationEvents,s-1,i,n,this._defaultValue),l=o.default(u,2),x=l[0],w=l[1];return S(t,x,w,n)}return this._defaultValue}}]),t}();t.AutomationEventList=A,t.createCancelAndHoldAutomationEvent=function(t){return{cancelTime:t,type:"cancelAndHold"}},t.createCancelScheduledValuesAutomationEvent=function(t){return{cancelTime:t,type:"cancelScheduledValues"}},t.createExponentialRampToValueAutomationEvent=function(t,e){return{endTime:e,type:"exponentialRampToValue",value:t}},t.createLinearRampToValueAutomationEvent=function(t,e){return{endTime:e,type:"linearRampToValue",value:t}},t.createSetTargetAutomationEvent=function(t,e,s){return{startTime:e,target:t,timeConstant:s,type:"setTarget"}},t.createSetValueAutomationEvent=u,t.createSetValueCurveAutomationEvent=l,Object.defineProperty(t,"__esModule",{value:!0})}(e,s(1),s(7),s(8))},function(t,e,s){var n=s(2),i=s(3),o=s(4),r=s(6);t.exports=function(t,e){return n(t)||i(t,e)||o(t,e)||r()}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var s=[],n=!0,i=!1,o=void 0;try{for(var r,a=t[Symbol.iterator]();!(n=(r=a.next()).done)&&(s.push(r.value),!e||s.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return s}}},function(t,e,s){var n=s(5);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?n(t,e):void 0}}},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,n=new Array(e);s<e;s++)n[s]=t[s];return n}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},function(t,e){function s(t,e){for(var s=0;s<e.length;s++){var n=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}},function(t,e,s){"use strict";s.r(e),s.d(e,"getContext",(function(){return Ji})),s.d(e,"setContext",(function(){return Ki})),s.d(e,"Clock",(function(){return qo})),s.d(e,"Context",(function(){return Gi})),s.d(e,"BaseContext",(function(){return Wi})),s.d(e,"Delay",(function(){return Fo})),s.d(e,"Gain",(function(){return ko})),s.d(e,"Offline",(function(){return Io})),s.d(e,"OfflineContext",(function(){return Yi})),s.d(e,"Param",(function(){return xo})),s.d(e,"ToneAudioBuffer",(function(){return Xi})),s.d(e,"ToneAudioBuffers",(function(){return Vo})),s.d(e,"ToneAudioNode",(function(){return wo})),s.d(e,"connectSeries",(function(){return bo})),s.d(e,"connect",(function(){return To})),s.d(e,"disconnect",(function(){return So})),s.d(e,"FrequencyClass",(function(){return lo})),s.d(e,"Frequency",(function(){return _o})),s.d(e,"MidiClass",(function(){return No})),s.d(e,"Midi",(function(){return Po})),s.d(e,"TimeClass",(function(){return ho})),s.d(e,"Time",(function(){return uo})),s.d(e,"TicksClass",(function(){return jo})),s.d(e,"Ticks",(function(){return Lo})),s.d(e,"TransportTimeClass",(function(){return mo})),s.d(e,"TransportTime",(function(){return go})),s.d(e,"Emitter",(function(){return Bi})),s.d(e,"IntervalTimeline",(function(){return Bo})),s.d(e,"StateTimeline",(function(){return yo})),s.d(e,"Timeline",(function(){return Ni})),s.d(e,"isUndef",(function(){return ai})),s.d(e,"isDefined",(function(){return ci})),s.d(e,"isFunction",(function(){return hi})),s.d(e,"isNumber",(function(){return ui})),s.d(e,"isObject",(function(){return li})),s.d(e,"isBoolean",(function(){return pi})),s.d(e,"isArray",(function(){return di})),s.d(e,"isString",(function(){return fi})),s.d(e,"isNote",(function(){return _i})),s.d(e,"dbToGain",(function(){return eo})),s.d(e,"gainToDb",(function(){return so})),s.d(e,"intervalToFrequencyRatio",(function(){return no})),s.d(e,"ftom",(function(){return oo})),s.d(e,"mtof",(function(){return ao})),s.d(e,"optionsFromArguments",(function(){return Di})),s.d(e,"defaultArg",(function(){return Oi})),s.d(e,"Unit",(function(){return i})),s.d(e,"debug",(function(){return n})),s.d(e,"Noise",(function(){return Jo})),s.d(e,"UserMedia",(function(){return er})),s.d(e,"Oscillator",(function(){return ir})),s.d(e,"AMOscillator",(function(){return hr})),s.d(e,"FMOscillator",(function(){return ur})),s.d(e,"PulseOscillator",(function(){return lr})),s.d(e,"FatOscillator",(function(){return pr})),s.d(e,"PWMOscillator",(function(){return dr})),s.d(e,"OmniOscillator",(function(){return _r})),s.d(e,"ToneOscillatorNode",(function(){return nr})),s.d(e,"LFO",(function(){return yr})),s.d(e,"ToneBufferSource",(function(){return $o})),s.d(e,"Player",(function(){return br})),s.d(e,"Players",(function(){return Tr})),s.d(e,"GrainPlayer",(function(){return Sr})),s.d(e,"Add",(function(){return mr})),s.d(e,"Abs",(function(){return kr})),s.d(e,"AudioToGain",(function(){return ar})),s.d(e,"GainToAudio",(function(){return Cr})),s.d(e,"GreaterThan",(function(){return Mr})),s.d(e,"GreaterThanZero",(function(){return Or})),s.d(e,"Multiply",(function(){return cr})),s.d(e,"Negate",(function(){return Ar})),s.d(e,"Pow",(function(){return Er})),s.d(e,"Signal",(function(){return Do})),s.d(e,"connectSignal",(function(){return Oo})),s.d(e,"Scale",(function(){return gr})),s.d(e,"ScaleExp",(function(){return Rr})),s.d(e,"Subtract",(function(){return Dr})),s.d(e,"SyncedSignal",(function(){return qr})),s.d(e,"WaveShaper",(function(){return rr})),s.d(e,"Zero",(function(){return vr})),s.d(e,"AMSynth",(function(){return zr})),s.d(e,"DuoSynth",(function(){return Qr})),s.d(e,"FMSynth",(function(){return Zr})),s.d(e,"MetalSynth",(function(){return Yr})),s.d(e,"MembraneSynth",(function(){return Hr})),s.d(e,"MonoSynth",(function(){return Ur})),s.d(e,"NoiseSynth",(function(){return $r})),s.d(e,"PluckSynth",(function(){return oa})),s.d(e,"PolySynth",(function(){return ra})),s.d(e,"Sampler",(function(){return aa})),s.d(e,"Synth",(function(){return jr})),s.d(e,"Loop",(function(){return ha})),s.d(e,"Part",(function(){return ua})),s.d(e,"Pattern",(function(){return xa})),s.d(e,"Sequence",(function(){return wa})),s.d(e,"ToneEvent",(function(){return ca})),s.d(e,"AutoFilter",(function(){return ka})),s.d(e,"AutoPanner",(function(){return Aa})),s.d(e,"AutoWah",(function(){return Oa})),s.d(e,"BitCrusher",(function(){return Ma})),s.d(e,"Chebyshev",(function(){return Ra})),s.d(e,"Chorus",(function(){return Na})),s.d(e,"Distortion",(function(){return Pa})),s.d(e,"FeedbackDelay",(function(){return La})),s.d(e,"FrequencyShifter",(function(){return Ba})),s.d(e,"Freeverb",(function(){return Ua})),s.d(e,"JCReverb",(function(){return Ya})),s.d(e,"PingPongDelay",(function(){return $a})),s.d(e,"PitchShift",(function(){return Ja})),s.d(e,"Phaser",(function(){return Ka})),s.d(e,"Reverb",(function(){return tc})),s.d(e,"StereoWidener",(function(){return ic})),s.d(e,"Tremolo",(function(){return oc})),s.d(e,"Vibrato",(function(){return rc})),s.d(e,"Analyser",(function(){return ac})),s.d(e,"Meter",(function(){return hc})),s.d(e,"FFT",(function(){return uc})),s.d(e,"DCMeter",(function(){return lc})),s.d(e,"Waveform",(function(){return pc})),s.d(e,"Follower",(function(){return Da})),s.d(e,"Channel",(function(){return _c})),s.d(e,"CrossFade",(function(){return ba})),s.d(e,"Merge",(function(){return Fa})),s.d(e,"MidSideMerge",(function(){return sc})),s.d(e,"MidSideSplit",(function(){return ec})),s.d(e,"Mono",(function(){return mc})),s.d(e,"MultibandSplit",(function(){return gc})),s.d(e,"Panner",(function(){return Ca})),s.d(e,"Panner3D",(function(){return yc})),s.d(e,"PanVol",(function(){return fc})),s.d(e,"Recorder",(function(){return xc})),s.d(e,"Solo",(function(){return dc})),s.d(e,"Split",(function(){return qa})),s.d(e,"Volume",(function(){return Go})),s.d(e,"Compressor",(function(){return wc})),s.d(e,"Gate",(function(){return bc})),s.d(e,"Limiter",(function(){return Tc})),s.d(e,"MidSideCompressor",(function(){return Sc})),s.d(e,"MultibandCompressor",(function(){return kc})),s.d(e,"AmplitudeEnvelope",(function(){return Pr})),s.d(e,"Envelope",(function(){return Fr})),s.d(e,"FrequencyEnvelope",(function(){return Gr})),s.d(e,"EQ3",(function(){return Cc})),s.d(e,"Filter",(function(){return Wr})),s.d(e,"OnePoleFilter",(function(){return na})),s.d(e,"FeedbackCombFilter",(function(){return sa})),s.d(e,"LowpassCombFilter",(function(){return ia})),s.d(e,"Convolver",(function(){return Ac})),s.d(e,"BiquadFilter",(function(){return Br})),s.d(e,"version",(function(){return o})),s.d(e,"start",(function(){return to})),s.d(e,"supported",(function(){return Kn})),s.d(e,"now",(function(){return Dc})),s.d(e,"immediate",(function(){return Oc})),s.d(e,"Transport",(function(){return Mc})),s.d(e,"getTransport",(function(){return Ec})),s.d(e,"Destination",(function(){return Rc})),s.d(e,"Master",(function(){return qc})),s.d(e,"getDestination",(function(){return Fc})),s.d(e,"Listener",(function(){return Ic})),s.d(e,"getListener",(function(){return Vc})),s.d(e,"Draw",(function(){return Nc})),s.d(e,"getDraw",(function(){return Pc})),s.d(e,"context",(function(){return jc})),s.d(e,"loaded",(function(){return Lc})),s.d(e,"Buffer",(function(){return zc})),s.d(e,"Buffers",(function(){return Bc})),s.d(e,"BufferSource",(function(){return Wc}));var n={};s.r(n),s.d(n,"assert",(function(){return ti})),s.d(n,"assertRange",(function(){return ei})),s.d(n,"assertContextRunning",(function(){return si})),s.d(n,"setLogger",(function(){return ii})),s.d(n,"log",(function(){return oi})),s.d(n,"warn",(function(){return ri}));var i={};s.r(i);const o="14.7.77";var r=s(0);const a=new WeakSet,c=new WeakMap,h=new WeakMap,u=new WeakMap,l=new WeakMap,p=new WeakMap,d=new WeakMap,f=new WeakMap,_=new WeakMap,m=new WeakMap,g={construct:()=>g},v=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,y=(t,e)=>{const s=[];let n=t.replace(/^[\s]+/,""),i=n.match(v);for(;null!==i;){const t=i[1].slice(1,-1),o=i[0].replace(/([\s]+)?;?$/,"").replace(t,new URL(t,e).toString());s.push(o),n=n.slice(i[0].length).replace(/^[\s]+/,""),i=n.match(v)}return[s.join(";"),n]},x=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},w=t=>{if(!(t=>{try{new new Proxy(t,g)}catch{return!1}return!0})(t))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===t.prototype||"object"!=typeof t.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},b=(t,e)=>{const s=t.get(e);if(void 0===s)throw new Error("A value with the given key could not be found.");return s},T=(t,e)=>{const s=Array.from(t).filter(e);if(s.length>1)throw Error("More than one element was found.");if(0===s.length)throw Error("No element was found.");const[n]=s;return t.delete(n),n},S=(t,e,s,n)=>{const i=b(t,e),o=T(i,t=>t[0]===s&&t[1]===n);return 0===i.size&&t.delete(e),o},k=t=>b(d,t),C=t=>{if(a.has(t))throw new Error("The AudioNode is already stored.");a.add(t),k(t).forEach(t=>t(!0))},A=t=>"port"in t,D=t=>{if(!a.has(t))throw new Error("The AudioNode is not stored.");a.delete(t),k(t).forEach(t=>t(!1))},O=(t,e)=>{!A(t)&&e.every(t=>0===t.size)&&D(t)},M={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},E=(t,e)=>t.context===e,R=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},q=()=>new DOMException("","IndexSizeError"),F=t=>{var e;t.getChannelData=(e=t.getChannelData,s=>{try{return e.call(t,s)}catch(t){if(12===t.code)throw q();throw t}})},I={numberOfChannels:1},V=-34028234663852886e22,N=-V,P=t=>a.has(t),j={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},L=t=>b(c,t),z=t=>b(u,t),B=(t,e)=>{const{activeInputs:s}=L(t);s.forEach(s=>s.forEach(([s])=>{e.includes(t)||B(s,[...e,t])}));const n=(t=>"playbackRate"in t)(t)?[t.playbackRate]:A(t)?Array.from(t.parameters.values()):(t=>"frequency"in t&&"gain"in t)(t)?[t.Q,t.detune,t.frequency,t.gain]:(t=>"offset"in t)(t)?[t.offset]:(t=>!("frequency"in t)&&"gain"in t)(t)?[t.gain]:(t=>"detune"in t&&"frequency"in t)(t)?[t.detune,t.frequency]:(t=>"pan"in t)(t)?[t.pan]:[];for(const t of n){const s=z(t);void 0!==s&&s.activeInputs.forEach(([t])=>B(t,e))}P(t)&&D(t)},W=t=>{B(t.destination,[])},G=t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t),U=t=>"context"in t,Q=t=>U(t[0]),Z=(t,e,s,n)=>{for(const e of t)if(s(e)){if(n)return!1;throw Error("The set contains at least one similar element.")}return t.add(e),!0},X=(t,e,[s,n],i)=>{Z(t,[e,s,n],t=>t[0]===e&&t[1]===s,i)},Y=(t,[e,s,n],i)=>{const o=t.get(e);void 0===o?t.set(e,new Set([[s,n]])):Z(o,[s,n],t=>t[0]===s,i)},H=t=>"inputs"in t,$=(t,e,s,n)=>{if(H(e)){const i=e.inputs[n];return t.connect(i,s,0),[i,s,0]}return t.connect(e,s,n),[e,s,n]},J=(t,e,s)=>{for(const n of t)if(n[0]===e&&n[1]===s)return t.delete(n),n;return null},K=(t,e)=>{if(!k(t).delete(e))throw new Error("Missing the expected event listener.")},tt=(t,e,s)=>{const n=b(t,e),i=T(n,t=>t[0]===s);return 0===n.size&&t.delete(e),i},et=(t,e,s,n)=>{H(e)?t.disconnect(e.inputs[n],s,0):t.disconnect(e,s,n)},st=t=>b(h,t),nt=t=>b(l,t),it=t=>f.has(t),ot=t=>!a.has(t),rt=t=>new Promise(e=>{const s=t.createScriptProcessor(256,1,1),n=t.createGain(),i=t.createBuffer(1,2,44100),o=i.getChannelData(0);o[0]=1,o[1]=1;const r=t.createBufferSource();r.buffer=i,r.loop=!0,r.connect(s).connect(t.destination),r.connect(n),r.disconnect(n),s.onaudioprocess=n=>{const i=n.inputBuffer.getChannelData(0);Array.prototype.some.call(i,t=>1===t)?e(!0):e(!1),r.stop(),s.onaudioprocess=null,r.disconnect(s),s.disconnect(t.destination)},r.start()}),at=(t,e)=>{const s=new Map;for(const e of t)for(const t of e){const e=s.get(t);s.set(t,void 0===e?1:e+1)}s.forEach((t,s)=>e(s,t))},ct=t=>"context"in t,ht=(t,e,s,n)=>{const{activeInputs:i,passiveInputs:o}=z(e),{outputs:r}=L(t),a=k(t),c=r=>{const a=st(t),c=nt(e);if(r){const e=tt(o,t,s);X(i,t,e,!1),n||it(t)||a.connect(c,s)}else{const e=((t,e,s)=>T(t,t=>t[0]===e&&t[1]===s))(i,t,s);Y(o,e,!1),n||it(t)||a.disconnect(c,s)}};return!!Z(r,[e,s],t=>t[0]===e&&t[1]===s,!0)&&(a.add(c),P(t)?X(i,t,[s,c],!0):Y(o,[t,s,c],!0),!0)},ut=(t,e,s,n,i)=>{const[o,r]=((t,e,s,n)=>{const{activeInputs:i,passiveInputs:o}=L(e),r=J(i[n],t,s);if(null===r){return[S(o,t,s,n)[2],!1]}return[r[2],!0]})(t,s,n,i);if(null!==o&&(K(t,o),!r||e||it(t)||et(st(t),st(s),n,i)),P(s)){const{activeInputs:t}=L(s);O(s,t)}},lt=(t,e,s,n)=>{const[i,o]=((t,e,s)=>{const{activeInputs:n,passiveInputs:i}=z(e),o=J(n,t,s);if(null===o){return[tt(i,t,s)[1],!1]}return[o[2],!0]})(t,s,n);null!==i&&(K(t,i),!o||e||it(t)||st(t).disconnect(nt(s),n))};class pt{constructor(t){this._map=new Map(t)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(t,e=null){return this._map.forEach((s,n)=>t.call(e,s,n,this))}get(t){return this._map.get(t)}has(t){return this._map.has(t)}keys(){return this._map.keys()}values(){return this._map.values()}}const dt={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function ft(t,e,s,n,i){if("function"==typeof t.copyFromChannel)0===e[s].byteLength&&(e[s]=new Float32Array(128)),t.copyFromChannel(e[s],n,i);else{const o=t.getChannelData(n);if(0===e[s].byteLength)e[s]=o.slice(i,i+128);else{const t=new Float32Array(o.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);e[s].set(t)}}}const _t=(t,e,s,n,i)=>{"function"==typeof t.copyToChannel?0!==e[s].byteLength&&t.copyToChannel(e[s],n,i):0!==e[s].byteLength&&t.getChannelData(n).set(e[s],i)},mt=(t,e)=>{const s=[];for(let n=0;n<t;n+=1){const t=[],i="number"==typeof e?e:e[n];for(let e=0;e<i;e+=1)t.push(new Float32Array(128));s.push(t)}return s},gt=async(t,e,s,n,i,o,r)=>{const a=null===e?128*Math.ceil(t.context.length/128):e.length,c=n.channelCount*n.numberOfInputs,h=i.reduce((t,e)=>t+e,0),u=0===h?null:s.createBuffer(h,a,s.sampleRate);if(void 0===o)throw new Error("Missing the processor constructor.");const l=L(t),p=await((t,e)=>{const s=b(m,t),n=st(e);return b(s,n)})(s,t),d=mt(n.numberOfInputs,n.channelCount),f=mt(n.numberOfOutputs,i),_=Array.from(t.parameters.keys()).reduce((t,e)=>({...t,[e]:new Float32Array(128)}),{});for(let h=0;h<a;h+=128){if(n.numberOfInputs>0&&null!==e)for(let t=0;t<n.numberOfInputs;t+=1)for(let s=0;s<n.channelCount;s+=1)ft(e,d[t],s,s,h);void 0!==o.parameterDescriptors&&null!==e&&o.parameterDescriptors.forEach(({name:t},s)=>{ft(e,_,t,c+s,h)});for(let t=0;t<n.numberOfInputs;t+=1)for(let e=0;e<i[t];e+=1)0===f[t][e].byteLength&&(f[t][e]=new Float32Array(128));try{const t=d.map((t,e)=>0===l.activeInputs[e].size?[]:t),e=r(h/s.sampleRate,s.sampleRate,()=>p.process(t,f,_));if(null!==u)for(let t=0,e=0;t<n.numberOfOutputs;t+=1){for(let s=0;s<i[t];s+=1)_t(u,f[t],s,e+s,h);e+=i[t]}if(!e)break}catch(e){t.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}));break}}return u},vt={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},yt={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},xt={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},wt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},bt={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Tt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},St=(t,e,s)=>{const n=e[s];if(void 0===n)throw t();return n},kt={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},Ct={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},At=()=>new DOMException("","InvalidStateError"),Dt=()=>new DOMException("","InvalidAccessError"),Ot={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},Mt=(t,e,s,n,i,o,r,a,c,h,u)=>{const l=h.length;let p=a;for(let a=0;a<l;a+=1){let l=s[0]*h[a];for(let e=1;e<i;e+=1){const n=p-e&c-1;l+=s[e]*o[n],l-=t[e]*r[n]}for(let t=i;t<n;t+=1)l+=s[t]*o[p-t&c-1];for(let s=i;s<e;s+=1)l-=t[s]*r[p-s&c-1];o[p]=h[a],r[p]=l,p=p+1&c-1,u[a]=l}return p},Et={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},Rt=t=>{const e=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const s=t.decodeAudioData(e.buffer,()=>{});return void 0!==s&&(s.catch(()=>{}),!0)}catch{}return!1},qt={numberOfChannels:1},Ft=(t,e,s)=>{const n=e[s];void 0!==n&&n!==t[s]&&(t[s]=n)},It=(t,e)=>{Ft(t,e,"channelCount"),Ft(t,e,"channelCountMode"),Ft(t,e,"channelInterpretation")},Vt=t=>"function"==typeof t.getFloatTimeDomainData,Nt=(t,e,s)=>{const n=e[s];void 0!==n&&n!==t[s].value&&(t[s].value=n)},Pt=t=>{var e;t.start=(e=t.start,(s=0,n=0,i)=>{if("number"==typeof i&&i<0||n<0||s<0)throw new RangeError("The parameters can't be negative.");e.call(t,s,n,i)})},jt=t=>{var e;t.stop=(e=t.stop,(s=0)=>{if(s<0)throw new RangeError("The parameter can't be negative.");e.call(t,s)})},Lt=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),zt=async(t,e)=>new t(await(t=>new Promise((e,s)=>{const{port1:n,port2:i}=new MessageChannel;n.onmessage=({data:t})=>{n.close(),i.close(),e(t)},n.onmessageerror=({data:t})=>{n.close(),i.close(),s(t)},i.postMessage(t)}))(e)),Bt=(t,e)=>{const s=t.createBiquadFilter();return It(s,e),Nt(s,e,"Q"),Nt(s,e,"detune"),Nt(s,e,"frequency"),Nt(s,e,"gain"),Ft(s,e,"type"),s},Wt=(t,e)=>{const s=t.createChannelSplitter(e.numberOfOutputs);return It(s,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw At()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw At()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw At()}})})(s),s},Gt=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),Ut=(t,e)=>{const s=t.createDelay(e.maxDelayTime);return It(s,e),Nt(s,e,"delayTime"),s},Qt=(t,e)=>{const s=t.createGain();return It(s,e),Nt(s,e,"gain"),s};function Zt(t,e){const s=e[0]*e[0]+e[1]*e[1];return[(t[0]*e[0]+t[1]*e[1])/s,(t[1]*e[0]-t[0]*e[1])/s]}function Xt(t,e){let s=[0,0];for(let o=t.length-1;o>=0;o-=1)i=e,s=[(n=s)[0]*i[0]-n[1]*i[1],n[0]*i[1]+n[1]*i[0]],s[0]+=t[o];var n,i;return s}const Yt=(t,e,s,n)=>t.createScriptProcessor(e,s,n),Ht=()=>new DOMException("","NotSupportedError"),$t={numberOfChannels:1},Jt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},Kt={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1},te={disableNormalization:!1},ee={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},se=()=>new DOMException("","UnknownError"),ne={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},ie=t=>{if(null===t)return!1;const e=t.length;return e%2!=0?0!==t[Math.floor(e/2)]:t[e/2-1]+t[e/2]!==0},oe=(t,e,s,n)=>{let i=Object.getPrototypeOf(t);for(;!i.hasOwnProperty(e);)i=Object.getPrototypeOf(i);const{get:o,set:r}=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,{get:s(o),set:n(r)})},re=(t,e,s)=>{try{t.setValueAtTime(e,s)}catch(n){if(9!==n.code)throw n;re(t,e,s+1e-7)}},ae=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},ce=t=>{const e=t.createBuffer(1,1,44100),s=t.createBufferSource();s.buffer=e,s.start(),s.stop();try{return s.stop(),!0}catch{return!1}},he=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},ue=()=>{try{new DOMException}catch{return!1}return!0},le=()=>new Promise(t=>{const e=new ArrayBuffer(0),{port1:s,port2:n}=new MessageChannel;s.onmessage=({data:e})=>t(null!==e),n.postMessage(e,[e])}),pe=(t,e)=>{const s=e.createGain();t.connect(s);const n=(i=t.disconnect,()=>{i.call(t,s),t.removeEventListener("ended",n)});var i;t.addEventListener("ended",n),Gt(t,s),t.stop=(e=>{let n=!1;return(i=0)=>{if(n)try{e.call(t,i)}catch{s.gain.setValueAtTime(0,i)}else e.call(t,i),n=!0}})(t.stop)},de=(t,e)=>s=>{const n={value:t};return Object.defineProperties(s,{currentTarget:n,target:n}),"function"==typeof e?e.call(t,s):e.handleEvent.call(t,s)},fe=(_e=Z,(t,e,[s,n,i],o)=>{_e(t[n],[e,s,i],t=>t[0]===e&&t[1]===s,o)});var _e;const me=(t=>(e,s,[n,i,o],r)=>{const a=e.get(n);void 0===a?e.set(n,new Set([[i,s,o]])):t(a,[i,s,o],t=>t[0]===i&&t[1]===s,r)})(Z),ge=(t=>(e,s,n,i)=>t(e[i],t=>t[0]===s&&t[1]===n))(T),ve=new WeakMap,ye=(t=>e=>{var s;return null!==(s=t.get(e))&&void 0!==s?s:0})(ve),xe=(we=new Map,be=new WeakMap,(t,e)=>{const s=be.get(t);if(void 0!==s)return s;const n=we.get(t);if(void 0!==n)return n;try{const s=e();return s instanceof Promise?(we.set(t,s),s.catch(()=>!1).then(e=>(we.delete(t),be.set(t,e),e))):(be.set(t,s),s)}catch{return be.set(t,!1),!1}});var we,be;const Te="undefined"==typeof window?null:window,Se=(ke=xe,Ce=q,(t,e)=>{const s=t.createAnalyser();if(It(s,e),!(e.maxDecibels>e.minDecibels))throw Ce();return Ft(s,e,"fftSize"),Ft(s,e,"maxDecibels"),Ft(s,e,"minDecibels"),Ft(s,e,"smoothingTimeConstant"),ke(Vt,()=>Vt(s))||(t=>{t.getFloatTimeDomainData=e=>{const s=new Uint8Array(e.length);t.getByteTimeDomainData(s);const n=Math.max(s.length,t.fftSize);for(let t=0;t<n;t+=1)e[t]=.0078125*(s[t]-128);return e}})(s),s});var ke,Ce;const Ae=(De=L,t=>{const e=De(t);if(null===e.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return e.renderer});var De;const Oe=((t,e,s)=>async(n,i,o,r)=>{const a=t(n),c=[...r,n];await Promise.all(a.activeInputs.map((t,r)=>Array.from(t).filter(([t])=>!c.includes(t)).map(async([t,a])=>{const h=e(t),u=await h.render(t,i,c),l=n.context.destination;s(t)||n===l&&s(n)||u.connect(o,a,r)})).reduce((t,e)=>[...t,...e],[]))})(L,Ae,it),Me=(Ee=Se,Re=st,qe=Oe,()=>{const t=new WeakMap;return{render(e,s,n){const i=t.get(s);return void 0!==i?Promise.resolve(i):(async(e,s,n)=>{let i=Re(e);if(!E(i,s)){const t={channelCount:i.channelCount,channelCountMode:i.channelCountMode,channelInterpretation:i.channelInterpretation,fftSize:i.fftSize,maxDecibels:i.maxDecibels,minDecibels:i.minDecibels,smoothingTimeConstant:i.smoothingTimeConstant};i=Ee(s,t)}return t.set(s,i),await qe(e,s,i,n),i})(e,s,n)}}});var Ee,Re,qe;const Fe=(Ie=p,t=>{const e=Ie.get(t);if(void 0===e)throw At();return e});var Ie;const Ve=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(Te),Ne=(Pe=Ve,t=>null!==Pe&&t instanceof Pe);var Pe;const je=new WeakMap,Le=(ze=de,class{constructor(t){this._nativeEventTarget=t,this._listeners=new WeakMap}addEventListener(t,e,s){if(null!==e){let n=this._listeners.get(e);void 0===n&&(n=ze(this,e),"function"==typeof e&&this._listeners.set(e,n)),this._nativeEventTarget.addEventListener(t,n,s)}}dispatchEvent(t){return this._nativeEventTarget.dispatchEvent(t)}removeEventListener(t,e,s){const n=null===e?void 0:this._listeners.get(e);this._nativeEventTarget.removeEventListener(t,void 0===n?null:n,s)}});var ze;const Be=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(Te),We=(Ge=Be,t=>null!==Ge&&t instanceof Ge);var Ge;const Ue=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(Te),Qe=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(Te),Ze=((t,e,s,n,i,o,r,a,c,u,l,p,f,_,m)=>class extends u{constructor(e,n,i,o){super(i),this._context=e,this._nativeAudioNode=i;const r=l(e);p(r)&&!0!==s(rt,()=>rt(r))&&(t=>{const e=new Map;var s,n;t.connect=(s=t.connect.bind(t),(t,n=0,i=0)=>{const o=ct(t)?s(t,n,i):s(t,n),r=e.get(t);return void 0===r?e.set(t,[{input:i,output:n}]):r.every(t=>t.input!==i||t.output!==n)&&r.push({input:i,output:n}),o}),t.disconnect=(n=t.disconnect,(s,i,o)=>{if(n.apply(t),void 0===s)e.clear();else if("number"==typeof s)for(const[t,n]of e){const i=n.filter(t=>t.output!==s);0===i.length?e.delete(t):e.set(t,i)}else if(e.has(s))if(void 0===i)e.delete(s);else{const t=e.get(s);if(void 0!==t){const n=t.filter(t=>t.output!==i&&(t.input!==o||void 0===o));0===n.length?e.delete(s):e.set(s,n)}}for(const[s,n]of e)n.forEach(e=>{ct(s)?t.connect(s,e.output,e.input):t.connect(s,e.output)})})})(i),h.set(this,i),d.set(this,new Set),"closed"!==e.state&&n&&C(this),t(this,o,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(t){this._nativeAudioNode.channelCount=t}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(t){this._nativeAudioNode.channelCountMode=t}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(t){this._nativeAudioNode.channelInterpretation=t}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(t,s=0,a=0){if(s<0||s>=this._nativeAudioNode.numberOfOutputs)throw i();const h=l(this._context),u=m(h);if(f(t)||_(t))throw o();if(U(t)){const i=st(t);try{const e=$(this._nativeAudioNode,i,s,a),n=ot(this);(u||n)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!n&&ot(t)&&C(t)}catch(t){if(12===t.code)throw o();throw t}if(e(this,t,s,a,u)){const e=c([this],t);at(e,n(u))}return t}const p=nt(t);if("playbackRate"===p.name)throw r();try{this._nativeAudioNode.connect(p,s),(u||ot(this))&&this._nativeAudioNode.disconnect(p,s)}catch(t){if(12===t.code)throw o();throw t}if(ht(this,t,s,u)){const e=c([this],t);at(e,n(u))}}disconnect(t,e,s){let n;const r=l(this._context),h=m(r);if(void 0===t)n=((t,e)=>{const s=L(t),n=[];for(const i of s.outputs)Q(i)?ut(t,e,...i):lt(t,e,...i),n.push(i[0]);return s.outputs.clear(),n})(this,h);else if("number"==typeof t){if(t<0||t>=this.numberOfOutputs)throw i();n=((t,e,s)=>{const n=L(t),i=[];for(const o of n.outputs)o[1]===s&&(Q(o)?ut(t,e,...o):lt(t,e,...o),i.push(o[0]),n.outputs.delete(o));return i})(this,h,t)}else{if(void 0!==e&&(e<0||e>=this.numberOfOutputs))throw i();if(U(t)&&void 0!==s&&(s<0||s>=t.numberOfInputs))throw i();if(n=((t,e,s,n,i)=>{const o=L(t);return Array.from(o.outputs).filter(t=>!(t[0]!==s||void 0!==n&&t[1]!==n||void 0!==i&&t[2]!==i)).map(s=>(Q(s)?ut(t,e,...s):lt(t,e,...s),o.outputs.delete(s),s[0]))})(this,h,t,e,s),0===n.length)throw o()}for(const t of n){const e=c([this],t);at(e,a)}}})((Xe=c,(t,e,s)=>{const n=[];for(let t=0;t<s.numberOfInputs;t+=1)n.push(new Set);Xe.set(t,{activeInputs:n,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,s,n,i,o,r,a,c,h,u,l,p)=>(d,f,_,m,g)=>{const{activeInputs:v,passiveInputs:y}=o(f),{outputs:x}=o(d),w=a(d),b=o=>{const a=c(f),h=c(d);if(o){const e=S(y,d,_,m);t(v,d,e,!1),g||l(d)||s(h,a,_,m),p(f)&&C(f)}else{const t=n(v,d,_,m);e(y,m,t,!1),g||l(d)||i(h,a,_,m);const s=r(f);0===s?u(f)&&O(f,v):setTimeout(()=>{u(f)&&O(f,v)},1e3*s)}};return!!h(x,[f,_,m],t=>t[0]===f&&t[1]===_&&t[2]===m,!0)&&(w.add(b),u(d)?t(v,d,[_,m,b],!0):e(y,m,[d,_,b],!0),!0)})(fe,me,$,ge,et,L,ye,k,st,Z,P,it,ot),xe,((t,e,s,n,i,o)=>r=>(a,c)=>{const h=t.get(a);if(void 0===h){if(!r&&o(a)){const t=n(a),{outputs:o}=s(a);for(const s of o)if(Q(s)){const i=n(s[0]);e(t,i,s[1],s[2])}else{const e=i(s[0]);t.disconnect(e,s[1])}}t.set(a,c)}else t.set(a,h+c)})(f,et,L,st,nt,P),q,Dt,Ht,((t,e,s,n,i,o,r,a)=>(c,h)=>{const u=e.get(c);if(void 0===u)throw new Error("Missing the expected cycle count.");const l=o(c.context),p=a(l);if(u===h){if(e.delete(c),!p&&r(c)){const e=n(c),{outputs:o}=s(c);for(const s of o)if(Q(s)){const i=n(s[0]);t(e,i,s[1],s[2])}else{const t=i(s[0]);e.connect(t,s[1])}}}else e.set(c,u-h)})($,f,L,st,nt,Fe,P,Ne),((t,e,s)=>function n(i,o){const r=U(o)?o:s(t,o);if((t=>"delayTime"in t)(r))return[];if(i[0]===r)return[i];if(i.includes(r))return[];const{outputs:a}=e(r);return Array.from(a).map(t=>n([...i,r],t[0])).reduce((t,e)=>t.concat(e),[])})(je,L,b),Le,Fe,We,Ue,Qe,Ne);var Xe;const Ye=((t,e,s,n,i,o)=>class extends t{constructor(t,s){const r=i(t),a={...M,...s},c=n(r,a);super(t,!1,c,o(r)?e():null),this._nativeAnalyserNode=c}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(t){this._nativeAnalyserNode.fftSize=t}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(t){const e=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=t,!(t>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=e,s()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(t){const e=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=t,!(this._nativeAnalyserNode.maxDecibels>t))throw this._nativeAnalyserNode.minDecibels=e,s()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(t){this._nativeAnalyserNode.smoothingTimeConstant=t}getByteFrequencyData(t){this._nativeAnalyserNode.getByteFrequencyData(t)}getByteTimeDomainData(t){this._nativeAnalyserNode.getByteTimeDomainData(t)}getFloatFrequencyData(t){this._nativeAnalyserNode.getFloatFrequencyData(t)}getFloatTimeDomainData(t){this._nativeAnalyserNode.getFloatTimeDomainData(t)}})(Ze,Me,q,Se,Fe,Ne),He=new WeakSet,$e=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(Te),Je=(Ke=new Uint32Array(1),t=>(Ke[0]=t,Ke[0]));var Ke;const ts=((t,e)=>s=>{s.copyFromChannel=(n,i,o=0)=>{const r=t(o),a=t(i);if(a>=s.numberOfChannels)throw e();const c=s.length,h=s.getChannelData(a),u=n.length;for(let t=r<0?-r:0;t+r<c&&t<u;t+=1)n[t]=h[t+r]},s.copyToChannel=(n,i,o=0)=>{const r=t(o),a=t(i);if(a>=s.numberOfChannels)throw e();const c=s.length,h=s.getChannelData(a),u=n.length;for(let t=r<0?-r:0;t+r<c&&t<u;t+=1)h[t+r]=n[t]}})(Je,q),es=(t=>e=>{e.copyFromChannel=(s=>(n,i,o=0)=>{const r=t(o),a=t(i);if(r<e.length)return s.call(e,n,a,r)})(e.copyFromChannel),e.copyToChannel=(s=>(n,i,o=0)=>{const r=t(o),a=t(i);if(r<e.length)return s.call(e,n,a,r)})(e.copyToChannel)})(Je),ss=((t,e,s,n,i,o,r,a)=>{let c=null;return class h{constructor(h){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:u,numberOfChannels:l,sampleRate:p}={...I,...h};null===c&&(c=new i(1,1,44100));const d=null!==n&&e(o,o)?new n({length:u,numberOfChannels:l,sampleRate:p}):c.createBuffer(l,u,p);if(0===d.numberOfChannels)throw s();return"function"!=typeof d.copyFromChannel?(r(d),F(d)):e(R,()=>R(d))||a(d),t.add(d),d}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===h.prototype||t.has(e)}}})(He,xe,Ht,$e,Ve,(ns=$e,()=>{if(null===ns)return!1;try{new ns({length:1,sampleRate:44100})}catch{return!1}return!0}),ts,es);var ns;const is=(os=Qt,(t,e)=>{const s=os(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(s).connect(t.destination);const n=()=>{e.removeEventListener("ended",n),e.disconnect(s),s.disconnect()};e.addEventListener("ended",n)});var os;const rs=((t,e,s)=>async(n,i,o,r)=>{const a=e(n);await Promise.all(Array.from(a.activeInputs).map(async([e,n])=>{const a=t(e),c=await a.render(e,i,r);s(e)||c.connect(o,n)}))})(Ae,z,it),as=(t=>(e,s,n,i)=>t(s,e,n,i))(rs),cs=((t,e,s,n,i,o,r,a,c,h,u)=>(l,p)=>{const d=l.createBufferSource();return It(d,p),Nt(d,p,"playbackRate"),Ft(d,p,"buffer"),Ft(d,p,"loop"),Ft(d,p,"loopEnd"),Ft(d,p,"loopStart"),e(s,()=>s(l))||(t=>{t.start=(e=>{let s=!1;return(n=0,i=0,o)=>{if(s)throw At();e.call(t,n,i,o),s=!0}})(t.start)})(d),e(n,()=>n(l))||c(d),e(i,()=>i(l))||h(d,l),e(o,()=>o(l))||Pt(d),e(r,()=>r(l))||u(d,l),e(a,()=>a(l))||jt(d),t(l,d),d})(is,xe,t=>{const e=t.createBufferSource();e.start();try{e.start()}catch{return!0}return!1},t=>{const e=t.createBufferSource(),s=t.createBuffer(1,1,44100);e.buffer=s;try{e.start(0,1)}catch{return!1}return!0},t=>{const e=t.createBufferSource();e.start();try{e.stop()}catch{return!1}return!0},ae,ce,he,t=>{var e;t.start=(e=t.start,(s=0,n=0,i)=>{const o=t.buffer,r=null===o?n:Math.min(o.duration,n);null!==o&&r>o.duration-.5/t.context.sampleRate?e.call(t,s,0,0):e.call(t,s,r,i)})},(hs=oe,(t,e)=>{const s=e.createBuffer(1,1,44100);null===t.buffer&&(t.buffer=s),hs(t,"buffer",e=>()=>{const n=e.call(t);return n===s?null:n},e=>n=>e.call(t,null===n?s:n))}),pe);var hs;const us=((t,e)=>(s,n,i,o)=>(t(n).replay(i),e(n,s,i,o)))((t=>e=>{const s=t(e);if(null===s.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return s.renderer})(z),rs),ls=((t,e,s,n,i)=>()=>{const o=new WeakMap;let r=null,a=null;return{set start(t){r=t},set stop(t){a=t},render(c,h,u){const l=o.get(h);return void 0!==l?Promise.resolve(l):(async(c,h,u)=>{let l=s(c);const p=E(l,h);if(!p){const t={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=e(h,t),null!==r&&l.start(...r),null!==a&&l.stop(a)}return o.set(h,l),p?await t(h,c.playbackRate,l.playbackRate,u):await n(h,c.playbackRate,l.playbackRate,u),await i(c,h,l,u),l})(c,h,u)}}})(as,cs,st,us,Oe),ps=((t,e,s,n,i,o,a,c,h,u,l,p,d)=>(f,_,m,g=null,v=null)=>{const y=new r.AutomationEventList(m.defaultValue),x=_?n(y):null,w={get defaultValue(){return m.defaultValue},get maxValue(){return null===g?m.maxValue:g},get minValue(){return null===v?m.minValue:v},get value(){return m.value},set value(t){m.value=t,w.setValueAtTime(t,f.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof m.cancelAndHoldAtTime)null===x&&y.flush(f.context.currentTime),y.add(i(t)),m.cancelAndHoldAtTime(t);else{const e=Array.from(y).pop();null===x&&y.flush(f.context.currentTime),y.add(i(t));const s=Array.from(y).pop();m.cancelScheduledValues(t),e!==s&&void 0!==s&&("exponentialRampToValue"===s.type?m.exponentialRampToValueAtTime(s.value,s.endTime):"linearRampToValue"===s.type?m.linearRampToValueAtTime(s.value,s.endTime):"setValue"===s.type?m.setValueAtTime(s.value,s.startTime):"setValueCurve"===s.type&&m.setValueCurveAtTime(s.values,s.startTime,s.duration))}return w},cancelScheduledValues:t=>(null===x&&y.flush(f.context.currentTime),y.add(o(t)),m.cancelScheduledValues(t),w),exponentialRampToValueAtTime(t,e){if(0===t)throw new RangeError;if(!Number.isFinite(e)||e<0)throw new RangeError;return null===x&&y.flush(f.context.currentTime),y.add(a(t,e)),m.exponentialRampToValueAtTime(t,e),w},linearRampToValueAtTime:(t,e)=>(null===x&&y.flush(f.context.currentTime),y.add(c(t,e)),m.linearRampToValueAtTime(t,e),w),setTargetAtTime:(t,e,s)=>(null===x&&y.flush(f.context.currentTime),y.add(h(t,e,s)),m.setTargetAtTime(t,e,s),w),setValueAtTime:(t,e)=>(null===x&&y.flush(f.context.currentTime),y.add(u(t,e)),m.setValueAtTime(t,e),w),setValueCurveAtTime(t,e,s){const n=t instanceof Float32Array?t:new Float32Array(t);if(null!==p&&"webkitAudioContext"===p.name){const t=e+s,i=f.context.sampleRate,o=Math.ceil(e*i),r=Math.floor(t*i),a=r-o,c=new Float32Array(a);for(let t=0;t<a;t+=1){const r=(n.length-1)/s*((o+t)/i-e),a=Math.floor(r),h=Math.ceil(r);c[t]=a===h?n[a]:(1-(r-a))*n[a]+(1-(h-r))*n[h]}null===x&&y.flush(f.context.currentTime),y.add(l(c,e,s)),m.setValueCurveAtTime(c,e,s);const h=r/i;h<t&&d(w,c[c.length-1],h),d(w,n[n.length-1],t)}else null===x&&y.flush(f.context.currentTime),y.add(l(n,e,s)),m.setValueCurveAtTime(n,e,s);return w}};return s.set(w,m),e.set(w,f),t(w,x),w})((ds=u,(t,e)=>{ds.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),je,l,t=>({replay(e){for(const s of t)if("exponentialRampToValue"===s.type){const{endTime:t,value:n}=s;e.exponentialRampToValueAtTime(n,t)}else if("linearRampToValue"===s.type){const{endTime:t,value:n}=s;e.linearRampToValueAtTime(n,t)}else if("setTarget"===s.type){const{startTime:t,target:n,timeConstant:i}=s;e.setTargetAtTime(n,t,i)}else if("setValue"===s.type){const{startTime:t,value:n}=s;e.setValueAtTime(n,t)}else{if("setValueCurve"!==s.type)throw new Error("Can't apply an unknown automation.");{const{duration:t,startTime:n,values:i}=s;e.setValueCurveAtTime(i,n,t)}}}}),r.createCancelAndHoldAutomationEvent,r.createCancelScheduledValuesAutomationEvent,r.createExponentialRampToValueAutomationEvent,r.createLinearRampToValueAutomationEvent,r.createSetTargetAutomationEvent,r.createSetValueAutomationEvent,r.createSetValueCurveAutomationEvent,Be,re);var ds;const fs=((t,e,s,n,i,o,r,a)=>class extends t{constructor(t,n){const a=o(t),c={...j,...n},h=i(a,c),u=r(a),l=u?e():null;super(t,!1,h,l),this._audioBufferSourceNodeRenderer=l,this._isBufferNullified=!1,this._isBufferSet=null!==c.buffer,this._nativeAudioBufferSourceNode=h,this._onended=null,this._playbackRate=s(this,u,h.playbackRate,N,V)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(t){if(this._nativeAudioBufferSourceNode.buffer=t,null!==t){if(this._isBufferSet)throw n();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(t){this._nativeAudioBufferSourceNode.loop=t}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(t){this._nativeAudioBufferSourceNode.loopEnd=t}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(t){this._nativeAudioBufferSourceNode.loopStart=t}get onended(){return this._onended}set onended(t){const e="function"==typeof t?a(this,t):null;this._nativeAudioBufferSourceNode.onended=e;const s=this._nativeAudioBufferSourceNode.onended;this._onended=null!==s&&s===e?t:s}get playbackRate(){return this._playbackRate}start(t=0,e=0,s){if(this._nativeAudioBufferSourceNode.start(t,e,s),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===s?[t,e]:[t,e,s]),"closed"!==this.context.state){C(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),P(this)&&D(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(Ze,ls,ps,At,cs,Fe,Ne,de),_s=((t,e,s,n,i,o,r,a)=>class extends t{constructor(t,s){const n=o(t),c=r(n),h=i(n,s,c);super(t,!1,h,c?e(a):null),this._isNodeOfNativeOfflineAudioContext=c,this._nativeAudioDestinationNode=h}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(t){if(this._isNodeOfNativeOfflineAudioContext)throw n();if(t>this._nativeAudioDestinationNode.maxChannelCount)throw s();this._nativeAudioDestinationNode.channelCount=t}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(t){if(this._isNodeOfNativeOfflineAudioContext)throw n();this._nativeAudioDestinationNode.channelCountMode=t}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(Ze,t=>{let e=null;return{render:(s,n,i)=>(null===e&&(e=(async(e,s,n)=>{const i=s.destination;return await t(e,s,i,n),i})(s,n,i)),e)}},q,At,((t,e)=>(s,n,i)=>{const o=s.destination;if(o.channelCount!==n)try{o.channelCount=n}catch{}i&&"explicit"!==o.channelCountMode&&(o.channelCountMode="explicit"),0===o.maxChannelCount&&Object.defineProperty(o,"maxChannelCount",{value:n});const r=t(s,{channelCount:n,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,gain:1});return e(r,"channelCount",t=>()=>t.call(r),t=>e=>{t.call(r,e);try{o.channelCount=e}catch(t){if(e>o.maxChannelCount)throw t}}),e(r,"channelCountMode",t=>()=>t.call(r),t=>e=>{t.call(r,e),o.channelCountMode=e}),e(r,"channelInterpretation",t=>()=>t.call(r),t=>e=>{t.call(r,e),o.channelInterpretation=e}),Object.defineProperty(r,"maxChannelCount",{get:()=>o.maxChannelCount}),r.connect(o),r})(Qt,oe),Fe,Ne,Oe),ms=((t,e,s,n,i)=>()=>{const o=new WeakMap;return{render(r,a,c){const h=o.get(a);return void 0!==h?Promise.resolve(h):(async(r,a,c)=>{let h=s(r);const u=E(h,a);if(!u){const t={Q:h.Q.value,channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,detune:h.detune.value,frequency:h.frequency.value,gain:h.gain.value,type:h.type};h=e(a,t)}return o.set(a,h),u?(await t(a,r.Q,h.Q,c),await t(a,r.detune,h.detune,c),await t(a,r.frequency,h.frequency,c),await t(a,r.gain,h.gain,c)):(await n(a,r.Q,h.Q,c),await n(a,r.detune,h.detune,c),await n(a,r.frequency,h.frequency,c),await n(a,r.gain,h.gain,c)),await i(r,a,h,c),h})(r,a,c)}}})(as,Bt,st,us,Oe),gs=(t=>(e,s)=>t.set(e,s))(ve),vs=(ys=Ze,xs=ps,ws=ms,bs=Dt,Ts=Bt,Ss=Fe,ks=Ne,Cs=gs,class extends ys{constructor(t,e){const s=Ss(t),n={...vt,...e},i=Ts(s,n),o=ks(s);super(t,!1,i,o?ws():null),this._Q=xs(this,o,i.Q,N,V),this._detune=xs(this,o,i.detune,1200*Math.log2(N),-1200*Math.log2(N)),this._frequency=xs(this,o,i.frequency,t.sampleRate/2,0),this._gain=xs(this,o,i.gain,40*Math.log10(N),V),this._nativeBiquadFilterNode=i,Cs(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(t){this._nativeBiquadFilterNode.type=t}getFrequencyResponse(t,e,s){try{this._nativeBiquadFilterNode.getFrequencyResponse(t,e,s)}catch(t){if(11===t.code)throw bs();throw t}if(t.length!==e.length||e.length!==s.length)throw bs()}});var ys,xs,ws,bs,Ts,Ss,ks,Cs;const As=((t,e)=>(s,n,i)=>{c