tone
Version:
A Web Audio framework for making interactive music in the browser.
2 lines • 346 kB
JavaScript
/*! For license information please see Tone.js.LICENSE.txt */
!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,(()=>(()=>{var t={871:function(t,e,s){!function(t,e,s,n){"use strict";var i=function(t,e,s){return{endTime:e,insertTime:s,type:"exponentialRampToValue",value:t}},o=function(t,e,s){return{endTime:e,insertTime:s,type:"linearRampToValue",value:t}},r=function(t,e){return{startTime:e,type:"setValue",value:t}},a=function(t,e,s){return{duration:s,startTime:e,type:"setValueCurve",values:t}},c=function(t,e,s){var n=s.startTime,i=s.target,o=s.timeConstant;return i+(e-i)*Math.exp((n-t)/o)},h=function(t){return"exponentialRampToValue"===t.type},l=function(t){return"linearRampToValue"===t.type},u=function(t){return h(t)||l(t)},p=function(t){return"setValue"===t.type},d=function(t){return"setValueCurve"===t.type},f=function t(e,s,n,i){var o=e[s];return void 0===o?i:u(o)||p(o)?o.value:d(o)?o.values[o.values.length-1]:c(n,t(e,s-1,o.startTime,i),o)},_=function(t,e,s,n,i){return void 0===s?[n.insertTime,i]:u(s)?[s.endTime,s.value]:p(s)?[s.startTime,s.value]:d(s)?[s.startTime+s.duration,s.values[s.values.length-1]]:[s.startTime,f(t,e-1,s.startTime,i)]},m=function(t){return"cancelAndHold"===t.type},g=function(t){return"cancelScheduledValues"===t.type},v=function(t){return m(t)||g(t)?t.cancelTime:h(t)||l(t)?t.endTime:t.startTime},y=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},x=function(t,e,s,n){return s+(t-e)/(n.endTime-e)*(n.value-s)},w=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))},b=function(t){return"setTarget"===t.type},T=function(){return n((function t(e){s(this,t),this._automationEvents=[],this._currenTime=0,this._defaultValue=e}),[{key:Symbol.iterator,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(t){var e=v(t);if(m(t)||g(t)){var s=this._automationEvents.findIndex((function(s){return g(t)&&d(s)?s.startTime+s.duration>=e:v(s)>=e})),n=this._automationEvents[s];if(-1!==s&&(this._automationEvents=this._automationEvents.slice(0,s)),m(t)){var c=this._automationEvents[this._automationEvents.length-1];if(void 0!==n&&u(n)){if(void 0!==c&&b(c))throw new Error("The internal list is malformed.");var p=void 0===c?n.insertTime:d(c)?c.startTime+c.duration:v(c),f=void 0===c?this._defaultValue:d(c)?c.values[c.values.length-1]:c.value,_=h(n)?y(e,p,f,n):x(e,p,f,n),w=h(n)?i(_,e,this._currenTime):o(_,e,this._currenTime);this._automationEvents.push(w)}if(void 0!==c&&b(c)&&this._automationEvents.push(r(this.getValue(e),e)),void 0!==c&&d(c)&&c.startTime+c.duration>e){var T=e-c.startTime,S=(c.values.length-1)/c.duration,k=Math.max(2,1+Math.ceil(T*S)),A=T/(k-1)*S,C=c.values.slice(0,k);if(A<1)for(var O=1;O<k;O+=1){var D=A*O%1;C[O]=c.values[O-1]*(1-D)+c.values[O]*D}this._automationEvents[this._automationEvents.length-1]=a(C,c.startTime,T)}}}else{var M=this._automationEvents.findIndex((function(t){return v(t)>e})),E=-1===M?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[M-1];if(void 0!==E&&d(E)&&v(E)+E.duration>e)return!1;var R=h(t)?i(t.value,t.endTime,this._currenTime):l(t)?o(t.value,e,this._currenTime):t;if(-1===M)this._automationEvents.push(R);else{if(d(t)&&e+t.duration>v(this._automationEvents[M]))return!1;this._automationEvents.splice(M,0,R)}}return!0}},{key:"flush",value:function(t){var e=this._automationEvents.findIndex((function(e){return v(e)>t}));if(e>1){var s=this._automationEvents.slice(e-1),n=s[0];b(n)&&s.unshift(r(f(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 s=this._automationEvents.findIndex((function(e){return v(e)>t})),n=this._automationEvents[s],i=(-1===s?this._automationEvents.length:s)-1,o=this._automationEvents[i];if(void 0!==o&&b(o)&&(void 0===n||!u(n)||n.insertTime>t))return c(t,f(this._automationEvents,i-1,o.startTime,this._defaultValue),o);if(void 0!==o&&p(o)&&(void 0===n||!u(n)))return o.value;if(void 0!==o&&d(o)&&(void 0===n||!u(n)||o.startTime+o.duration>t))return t<o.startTime+o.duration?w(t,o):o.values[o.values.length-1];if(void 0!==o&&u(o)&&(void 0===n||!u(n)))return o.value;if(void 0!==n&&h(n)){var r=_(this._automationEvents,i,o,n,this._defaultValue),a=e(r,2),m=a[0],g=a[1];return y(t,m,g,n)}if(void 0!==n&&l(n)){var T=_(this._automationEvents,i,o,n,this._defaultValue),S=e(T,2),k=S[0],A=S[1];return x(t,k,A,n)}return this._defaultValue}}])}();t.AutomationEventList=T,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=r,t.createSetValueCurveAutomationEvent=a}(e,s(821),s(805),s(989))},113:t=>{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},t.exports.__esModule=!0,t.exports.default=t.exports},569:t=>{t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},805:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},989:(t,e,s)=>{var n=s(498);function i(t,e){for(var s=0;s<e.length;s++){var i=e[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}t.exports=function(t,e,s){return e&&i(t.prototype,e),s&&i(t,s),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},474:t=>{t.exports=function(t,e){var s=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=s){var n,i,o,r,a=[],c=!0,h=!1;try{if(o=(s=s.call(t)).next,0===e){if(Object(s)!==s)return;c=!1}else for(;!(c=(n=o.call(s)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){h=!0,i=t}finally{try{if(!c&&null!=s.return&&(r=s.return(),Object(r)!==r))return}finally{if(h)throw i}}return a}},t.exports.__esModule=!0,t.exports.default=t.exports},18:t=>{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.")},t.exports.__esModule=!0,t.exports.default=t.exports},821:(t,e,s)=>{var n=s(569),i=s(474),o=s(744),r=s(18);t.exports=function(t,e){return n(t)||i(t,e)||o(t,e)||r()},t.exports.__esModule=!0,t.exports.default=t.exports},327:(t,e,s)=>{var n=s(564).default;t.exports=function(t,e){if("object"!=n(t)||!t)return t;var s=t[Symbol.toPrimitive];if(void 0!==s){var i=s.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},498:(t,e,s)=>{var n=s(564).default,i=s(327);t.exports=function(t){var e=i(t,"string");return"symbol"==n(e)?e:e+""},t.exports.__esModule=!0,t.exports.default=t.exports},564:t=>{function e(s){return t.exports=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},t.exports.__esModule=!0,t.exports.default=t.exports,e(s)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},744:(t,e,s)=>{var n=s(113);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}},t.exports.__esModule=!0,t.exports.default=t.exports}},e={};function s(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,s),o.exports}s.d=(t,e)=>{for(var n in e)s.o(e,n)&&!s.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return(()=>{"use strict";s.r(n),s.d(n,{AMOscillator:()=>Ho,AMSynth:()=>Or,Abs:()=>dr,Add:()=>ir,AmplitudeEnvelope:()=>kr,Analyser:()=>Ya,AudioToGain:()=>Yo,AutoFilter:()=>pa,AutoPanner:()=>fa,AutoWah:()=>ma,BaseContext:()=>Ci,BiquadFilter:()=>Dr,BitCrusher:()=>va,Buffer:()=>Oc,BufferSource:()=>Mc,Buffers:()=>Dc,Channel:()=>nc,Chebyshev:()=>xa,Chorus:()=>ka,Clock:()=>vo,Compressor:()=>cc,Context:()=>Oi,Convolver:()=>fc,CrossFade:()=>ha,DCMeter:()=>Ka,Delay:()=>yo,Destination:()=>yc,Distortion:()=>Aa,Draw:()=>Sc,DuoSynth:()=>qr,EQ3:()=>dc,Emitter:()=>Ai,Envelope:()=>wr,FFT:()=>Ja,FMOscillator:()=>Jo,FMSynth:()=>Ir,FatOscillator:()=>tr,FeedbackCombFilter:()=>Ur,FeedbackDelay:()=>Oa,Filter:()=>Mr,Follower:()=>_a,Freeverb:()=>qa,Frequency:()=>Ji,FrequencyClass:()=>Yi,FrequencyEnvelope:()=>Er,FrequencyShifter:()=>Ma,Gain:()=>ho,GainToAudio:()=>fr,Gate:()=>hc,GrainPlayer:()=>pr,GreaterThan:()=>vr,GreaterThanZero:()=>gr,IntervalTimeline:()=>Mo,JCReverb:()=>Na,LFO:()=>ar,Limiter:()=>lc,Listener:()=>bc,Loop:()=>Hr,LowpassCombFilter:()=>Qr,Master:()=>xc,MembraneSynth:()=>Nr,Merge:()=>ba,MetalSynth:()=>Vr,Meter:()=>Ha,MidSideCompressor:()=>uc,MidSideMerge:()=>Ua,MidSideSplit:()=>Ba,Midi:()=>Ao,MidiClass:()=>ko,Mono:()=>ic,MonoSynth:()=>Rr,MultibandCompressor:()=>pc,MultibandSplit:()=>oc,Multiply:()=>$o,Negate:()=>_r,Noise:()=>zo,NoiseSynth:()=>Pr,Offline:()=>To,OfflineContext:()=>qi,OmniOscillator:()=>nr,OnePoleFilter:()=>Gr,Oscillator:()=>Xo,PWMOscillator:()=>er,PanVol:()=>sc,Panner:()=>da,Panner3D:()=>rc,Param:()=>no,Part:()=>Jr,Pattern:()=>aa,Phaser:()=>za,PingPongDelay:()=>ja,PitchShift:()=>La,Player:()=>lr,Players:()=>ur,PluckSynth:()=>Zr,PolySynth:()=>Xr,Pow:()=>Fo,PulseOscillator:()=>Ko,Recorder:()=>ac,Reverb:()=>Wa,Sampler:()=>Yr,Scale:()=>or,ScaleExp:()=>yr,Sequence:()=>ca,Signal:()=>po,Solo:()=>ec,Split:()=>wa,StateTimeline:()=>so,StereoWidener:()=>Qa,Subtract:()=>mr,SyncedSignal:()=>xr,Synth:()=>Ar,Ticks:()=>Oo,TicksClass:()=>Co,Time:()=>Xi,TimeClass:()=>Zi,Timeline:()=>wi,ToneAudioBuffer:()=>Ri,ToneAudioBuffers:()=>So,ToneAudioNode:()=>io,ToneBufferSource:()=>Lo,ToneEvent:()=>$r,ToneOscillatorNode:()=>Zo,Transport:()=>gc,TransportTime:()=>to,TransportTimeClass:()=>Ki,Tremolo:()=>Za,Unit:()=>e,UserMedia:()=>Go,Vibrato:()=>Xa,Volume:()=>xo,WaveShaper:()=>Io,Waveform:()=>tc,Zero:()=>rr,connect:()=>ro,connectSeries:()=>oo,connectSignal:()=>fo,context:()=>Ac,dbToGain:()=>ji,debug:()=>t,defaultArg:()=>pi,disconnect:()=>ao,fanIn:()=>co,ftom:()=>Bi,gainToDb:()=>Li,getContext:()=>Vi,getDestination:()=>wc,getDraw:()=>kc,getListener:()=>Tc,getTransport:()=>vc,immediate:()=>mc,intervalToFrequencyRatio:()=>zi,isArray:()=>Ln,isBoolean:()=>jn,isDefined:()=>Fn,isFunction:()=>Vn,isNote:()=>Wn,isNumber:()=>Nn,isObject:()=>Pn,isString:()=>zn,isUndef:()=>In,loaded:()=>Cc,mtof:()=>Gi,now:()=>_c,optionsFromArguments:()=>ui,setContext:()=>Ni,start:()=>Pi,supported:()=>qn,version:()=>i});var t={};s.r(t),s.d(t,{assert:()=>Bn,assertContextRunning:()=>Gn,assertRange:()=>Un,assertUsedScheduleTime:()=>Yn,enterScheduledCallback:()=>Xn,log:()=>Jn,setLogger:()=>Hn,warn:()=>Kn});var e={};s.r(e);const i="15.0.4";var o=s(871);const r=new WeakSet,a=new WeakMap,c=new WeakMap,h=new WeakMap,l=new WeakMap,u=new WeakMap,p=new WeakMap,d=new WeakMap,f=new WeakMap,_=new WeakMap,m={construct:()=>m},g=/^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]*);?/,v=(t,e)=>{const s=[];let n=t.replace(/^[\s]+/,""),i=n.match(g);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(g)}return[s.join(";"),n]},y=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},x=t=>{if(!(t=>{try{new new Proxy(t,m)}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.")},w=(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},b=(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},T=(t,e,s,n)=>{const i=w(t,e),o=b(i,(t=>t[0]===s&&t[1]===n));return 0===i.size&&t.delete(e),o},S=t=>w(p,t),k=t=>{if(r.has(t))throw new Error("The AudioNode is already stored.");r.add(t),S(t).forEach((t=>t(!0)))},A=t=>"port"in t,C=t=>{if(!r.has(t))throw new Error("The AudioNode is not stored.");r.delete(t),S(t).forEach((t=>t(!1)))},O=(t,e)=>{!A(t)&&e.every((t=>0===t.size))&&C(t)},D={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},M=(t,e)=>t.context===e,E=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},R=()=>new DOMException("","IndexSizeError"),q=t=>{var e;t.getChannelData=(e=t.getChannelData,s=>{try{return e.call(t,s)}catch(t){if(12===t.code)throw R();throw t}})},I={numberOfChannels:1},F=-34028234663852886e22,V=-F,N=t=>r.has(t),P={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},j=t=>w(a,t),L=t=>w(h,t),z=(t,e)=>{const{activeInputs:s}=j(t);s.forEach((s=>s.forEach((([s])=>{e.includes(t)||z(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=L(t);void 0!==s&&s.activeInputs.forEach((([t])=>z(t,e)))}N(t)&&C(t)},W=t=>{z(t.destination,[])},B=t=>"context"in t,U=t=>B(t[0]),G=(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},Q=(t,e,[s,n],i)=>{G(t,[e,s,n],(t=>t[0]===e&&t[1]===s),i)},Z=(t,[e,s,n],i)=>{const o=t.get(e);void 0===o?t.set(e,new Set([[s,n]])):G(o,[s,n],(t=>t[0]===s),i)},X=t=>"inputs"in t,Y=(t,e,s,n)=>{if(X(e)){const i=e.inputs[n];return t.connect(i,s,0),[i,s,0]}return t.connect(e,s,n),[e,s,n]},$=(t,e,s)=>{for(const n of t)if(n[0]===e&&n[1]===s)return t.delete(n),n;return null},H=(t,e)=>{if(!S(t).delete(e))throw new Error("Missing the expected event listener.")},J=(t,e,s)=>{const n=w(t,e),i=b(n,(t=>t[0]===s));return 0===n.size&&t.delete(e),i},K=(t,e,s,n)=>{X(e)?t.disconnect(e.inputs[n],s,0):t.disconnect(e,s,n)},tt=t=>w(c,t),et=t=>w(l,t),st=t=>d.has(t),nt=t=>!r.has(t),it=(t,e)=>new Promise((s=>{if(null!==e)s(!0);else{const e=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(e).connect(t.destination),r.connect(n),r.disconnect(n),e.onaudioprocess=n=>{const i=n.inputBuffer.getChannelData(0);Array.prototype.some.call(i,(t=>1===t))?s(!0):s(!1),r.stop(),e.onaudioprocess=null,r.disconnect(e),e.disconnect(t.destination)},r.start()}})),ot=(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)))},rt=t=>"context"in t,at=t=>{const e=new Map;t.connect=(t=>(s,n=0,i=0)=>{const o=rt(s)?t(s,n,i):t(s,n),r=e.get(s);return void 0===r?e.set(s,[{input:i,output:n}]):r.every((t=>t.input!==i||t.output!==n))&&r.push({input:i,output:n}),o})(t.connect.bind(t)),t.disconnect=(s=>(n,i,o)=>{if(s.apply(t),void 0===n)e.clear();else if("number"==typeof n)for(const[t,s]of e){const i=s.filter((t=>t.output!==n));0===i.length?e.delete(t):e.set(t,i)}else if(e.has(n))if(void 0===i)e.delete(n);else{const t=e.get(n);if(void 0!==t){const s=t.filter((t=>t.output!==i&&(t.input!==o||void 0===o)));0===s.length?e.delete(n):e.set(n,s)}}for(const[s,n]of e)n.forEach((e=>{rt(s)?t.connect(s,e.output,e.input):t.connect(s,e.output)}))})(t.disconnect)},ct=(t,e,s,n,i)=>{const[o,r]=((t,e,s,n)=>{const{activeInputs:i,passiveInputs:o}=j(e),r=$(i[n],t,s);return null===r?[T(o,t,s,n)[2],!1]:[r[2],!0]})(t,s,n,i);if(null!==o&&(H(t,o),!r||e||st(t)||K(tt(t),tt(s),n,i)),N(s)){const{activeInputs:t}=j(s);O(s,t)}},ht=(t,e,s,n)=>{const[i,o]=((t,e,s)=>{const{activeInputs:n,passiveInputs:i}=L(e),o=$(n,t,s);return null===o?[J(i,t,s)[1],!1]:[o[2],!0]})(t,s,n);null!==i&&(H(t,i),!o||e||st(t)||tt(t).disconnect(et(s),n))};class lt{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 ut={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function pt(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 dt=(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)},ft=(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},_t=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),l=0===h?null:s.createBuffer(h,a,s.sampleRate);if(void 0===o)throw new Error("Missing the processor constructor.");const u=j(t),p=await((t,e)=>{const s=w(_,t),n=tt(e);return w(s,n)})(s,t),d=ft(n.numberOfInputs,n.channelCount),f=ft(n.numberOfOutputs,i),m=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)pt(e,d[t],s,s,h);void 0!==o.parameterDescriptors&&null!==e&&o.parameterDescriptors.forEach((({name:t},s)=>{pt(e,m,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===u.activeInputs[e].size?[]:t)),e=r(h/s.sampleRate,s.sampleRate,(()=>p.process(t,f,m)));if(null!==l)for(let t=0,e=0;t<n.numberOfOutputs;t+=1){for(let s=0;s<i[t];s+=1)dt(l,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 l},mt={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},gt={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},vt={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},yt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},xt={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},wt=t=>{const{port1:e,port2:s}=new MessageChannel;return new Promise((n=>{const i=()=>{s.onmessage=null,e.close(),s.close(),n()};s.onmessage=()=>i();try{e.postMessage(t,[t])}catch{}finally{i()}}))},bt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},Tt=(t,e,s)=>{const n=e[s];if(void 0===n)throw t();return n},St={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},kt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},At=()=>new DOMException("","InvalidStateError"),Ct=()=>new DOMException("","InvalidAccessError"),Ot={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},Dt=(t,e,s,n,i,o,r,a,c,h,l)=>{const u=h.length;let p=a;for(let a=0;a<u;a+=1){let u=s[0]*h[a];for(let e=1;e<i;e+=1){const n=p-e&c-1;u+=s[e]*o[n],u-=t[e]*r[n]}for(let t=i;t<n;t+=1)u+=s[t]*o[p-t&c-1];for(let s=i;s<e;s+=1)u-=t[s]*r[p-s&c-1];o[p]=h[a],r[p]=u,p=p+1&c-1,l[a]=u}return p},Mt={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},Et=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},Rt=(t,e,s)=>{const n=e[s];void 0!==n&&n!==t[s]&&(t[s]=n)},qt=(t,e)=>{Rt(t,e,"channelCount"),Rt(t,e,"channelCountMode"),Rt(t,e,"channelInterpretation")},It=t=>"function"==typeof t.getFloatTimeDomainData,Ft=(t,e,s)=>{const n=e[s];void 0!==n&&n!==t[s].value&&(t[s].value=n)},Vt=t=>{t.start=(e=>(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)})(t.start)},Nt=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)})},Pt=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),jt=(t,e)=>{const s=t.createBiquadFilter();return qt(s,e),Ft(s,e,"Q"),Ft(s,e,"detune"),Ft(s,e,"frequency"),Ft(s,e,"gain"),Rt(s,e,"type"),s},Lt=(t,e)=>{const s=t.createChannelSplitter(e.numberOfOutputs);return qt(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},zt=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),Wt=(t,e)=>{const s=t.createDelay(e.maxDelayTime);return qt(s,e),Ft(s,e,"delayTime"),s},Bt=(t,e)=>{const s=t.createGain();return qt(s,e),Ft(s,e,"gain"),s};function Ut(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 Gt(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 Qt=(t,e,s,n)=>t.createScriptProcessor(e,s,n),Zt=()=>new DOMException("","NotSupportedError"),Xt={numberOfChannels:1},Yt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},$t={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},Ht={disableNormalization:!1},Jt={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},Kt=()=>new DOMException("","UnknownError"),te={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},ee=(t,e,s)=>void 0===t.copyFromChannel?t.getChannelData(s)[0]:(t.copyFromChannel(e,s),e[0]),se=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},ne=(t,e,s,n)=>{let i=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)})},ie=(t,e,s)=>{try{t.setValueAtTime(e,s)}catch(n){if(9!==n.code)throw n;ie(t,e,s+1e-7)}},oe=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},re=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}},ae=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},ce=()=>{try{new DOMException}catch{return!1}return!0},he=()=>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])})),le=(t,e)=>{const s=e.createGain();t.connect(s);const n=(e=>()=>{e.call(t,s),t.removeEventListener("ended",n)})(t.disconnect);t.addEventListener("ended",n),zt(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)},ue=(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)},pe=(t=>(e,s,[n,i,o],r)=>{t(e[i],[s,n,o],(t=>t[0]===s&&t[1]===n),r)})(G),de=(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)})(G),fe=(t=>(e,s,n,i)=>t(e[i],(t=>t[0]===s&&t[1]===n)))(b),_e=new WeakMap,me=(t=>e=>{var s;return null!==(s=t.get(e))&&void 0!==s?s:0})(_e),ge=(ve=new Map,ye=new WeakMap,(t,e)=>{const s=ye.get(t);if(void 0!==s)return s;const n=ve.get(t);if(void 0!==n)return n;try{const s=e();return s instanceof Promise?(ve.set(t,s),s.catch((()=>!1)).then((e=>(ve.delete(t),ye.set(t,e),e)))):(ye.set(t,s),s)}catch{return ye.set(t,!1),!1}});var ve,ye;const xe="undefined"==typeof window?null:window,we=((t,e)=>(s,n)=>{const i=s.createAnalyser();if(qt(i,n),!(n.maxDecibels>n.minDecibels))throw e();return Rt(i,n,"fftSize"),Rt(i,n,"maxDecibels"),Rt(i,n,"minDecibels"),Rt(i,n,"smoothingTimeConstant"),t(It,(()=>It(i)))||(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}})(i),i})(ge,R),be=(t=>e=>{const s=t(e);if(null===s.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return s.renderer})(j),Te=((t,e,s)=>async(n,i,o)=>{const r=t(n);await Promise.all(r.activeInputs.map(((t,r)=>Array.from(t).map((async([t,a])=>{const c=e(t),h=await c.render(t,i),l=n.context.destination;s(t)||n===l&&s(n)||h.connect(o,a,r)})))).reduce(((t,e)=>[...t,...e]),[]))})(j,be,st),Se=((t,e,s)=>()=>{const n=new WeakMap;return{render(i,o){const r=n.get(o);return void 0!==r?Promise.resolve(r):(async(i,o)=>{let r=e(i);if(!M(r,o)){const e={channelCount:r.channelCount,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,fftSize:r.fftSize,maxDecibels:r.maxDecibels,minDecibels:r.minDecibels,smoothingTimeConstant:r.smoothingTimeConstant};r=t(o,e)}return n.set(o,r),await s(i,o,r),r})(i,o)}}})(we,tt,Te),ke=(Ae=u,t=>{const e=Ae.get(t);if(void 0===e)throw At();return e});var Ae;const Ce=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(xe),Oe=(t=>e=>null!==t&&e instanceof t)(Ce),De=new WeakMap,Me=(t=>class{constructor(t){this._nativeEventTarget=t,this._listeners=new WeakMap}addEventListener(e,s,n){if(null!==s){let i=this._listeners.get(s);void 0===i&&(i=t(this,s),"function"==typeof s&&this._listeners.set(s,i)),this._nativeEventTarget.addEventListener(e,i,n)}}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)}})(ue),Ee=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(xe),Re=(t=>e=>null!==t&&e instanceof t)(Ee),qe=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(xe),Ie=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(xe),Fe=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(xe),Ve=((t,e,s,n,i,o,r,a,h,l,u,d,f,_,m,g)=>class extends l{constructor(e,n,i,o){super(i),this._context=e,this._nativeAudioNode=i;const r=u(e);d(r)&&!0!==s(it,(()=>it(r,g)))&&at(i),c.set(this,i),p.set(this,new Set),"closed"!==e.state&&n&&k(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 c=u(this._context),l=m(c);if(f(t)||_(t))throw o();if(B(t)){const i=tt(t);try{const e=Y(this._nativeAudioNode,i,s,a),n=nt(this);(l||n)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!n&&nt(t)&&k(t)}catch(t){if(12===t.code)throw o();throw t}if(e(this,t,s,a,l)){const e=h([this],t);ot(e,n(l))}return t}const p=et(t);if("playbackRate"===p.name&&1024===p.maxValue)throw r();try{this._nativeAudioNode.connect(p,s),(l||nt(this))&&this._nativeAudioNode.disconnect(p,s)}catch(t){if(12===t.code)throw o();throw t}if(((t,e,s,n)=>{const{activeInputs:i,passiveInputs:o}=L(e),{outputs:r}=j(t),a=S(t),c=r=>{const a=tt(t),c=et(e);if(r){const e=J(o,t,s);Q(i,t,e,!1),n||st(t)||a.connect(c,s)}else{const e=((t,e,s)=>b(t,(t=>t[0]===e&&t[1]===s)))(i,t,s);Z(o,e,!1),n||st(t)||a.disconnect(c,s)}};return!!G(r,[e,s],(t=>t[0]===e&&t[1]===s),!0)&&(a.add(c),N(t)?Q(i,t,[s,c],!0):Z(o,[t,s,c],!0),!0)})(this,t,s,l)){const e=h([this],t);ot(e,n(l))}}disconnect(t,e,s){let n;const r=u(this._context),c=m(r);if(void 0===t)n=((t,e)=>{const s=j(t),n=[];for(const i of s.outputs)U(i)?ct(t,e,...i):ht(t,e,...i),n.push(i[0]);return s.outputs.clear(),n})(this,c);else if("number"==typeof t){if(t<0||t>=this.numberOfOutputs)throw i();n=((t,e,s)=>{const n=j(t),i=[];for(const o of n.outputs)o[1]===s&&(U(o)?ct(t,e,...o):ht(t,e,...o),i.push(o[0]),n.outputs.delete(o));return i})(this,c,t)}else{if(void 0!==e&&(e<0||e>=this.numberOfOutputs))throw i();if(B(t)&&void 0!==s&&(s<0||s>=t.numberOfInputs))throw i();if(n=((t,e,s,n,i)=>{const o=j(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=>(U(s)?ct(t,e,...s):ht(t,e,...s),o.outputs.delete(s),s[0])))})(this,c,t,e,s),0===n.length)throw o()}for(const t of n){const e=h([this],t);ot(e,a)}}})((Ne=a,(t,e,s)=>{const n=[];for(let t=0;t<s.numberOfInputs;t+=1)n.push(new Set);Ne.set(t,{activeInputs:n,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,s,n,i,o,r,a,c,h,l,u,p)=>{const d=new WeakMap;return(f,_,m,g,v)=>{const{activeInputs:y,passiveInputs:x}=o(_),{outputs:w}=o(f),b=a(f),S=o=>{const a=c(_),h=c(f);if(o){const e=T(x,f,m,g);t(y,f,e,!1),v||u(f)||s(h,a,m,g),p(_)&&k(_)}else{const t=n(y,f,m,g);e(x,g,t,!1),v||u(f)||i(h,a,m,g);const s=r(_);if(0===s)l(_)&&O(_,y);else{const t=d.get(_);void 0!==t&&clearTimeout(t),d.set(_,setTimeout((()=>{l(_)&&O(_,y)}),1e3*s))}}};return!!h(w,[_,m,g],(t=>t[0]===_&&t[1]===m&&t[2]===g),!0)&&(b.add(S),l(f)?t(y,f,[m,g,S],!0):e(x,g,[f,m,S],!0),!0)}})(pe,de,Y,fe,K,j,me,S,tt,G,N,st,nt),ge,((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(U(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)})(d,K,j,tt,et,N),R,Ct,Zt,((t,e,s,n,i,o,r,a)=>(c,h)=>{const l=e.get(c);if(void 0===l)throw new Error("Missing the expected cycle count.");const u=o(c.context),p=a(u);if(l===h){if(e.delete(c),!p&&r(c)){const e=n(c),{outputs:o}=s(c);for(const s of o)if(U(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,l-h)})(Y,d,j,tt,et,ke,N,Oe),((t,e,s)=>function n(i,o){const r=B(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)),[])})(De,j,w),Me,ke,Re,qe,Ie,Oe,Fe);var Ne;const Pe=((t,e,s,n,i,o)=>class extends t{constructor(t,s){const r=i(t),a={...D,...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)}})(Ve,Se,R,we,ke,Oe),je=new WeakSet,Le=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(xe),ze=(We=new Uint32Array(1),t=>(We[0]=t,We[0]));var We;const Be=((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),l=n.length;for(let t=r<0?-r:0;t+r<c&&t<l;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),l=n.length;for(let t=r<0?-r:0;t+r<c&&t<l;t+=1)h[t+r]=n[t]}})(ze,R),Ue=(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)})(ze),Ge=((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:l,numberOfChannels:u,sampleRate:p}={...I,...h};null===c&&(c=new i(1,1,44100));const d=null!==n&&e(o,o)?new n({length:l,numberOfChannels:u,sampleRate:p}):c.createBuffer(u,l,p);if(0===d.numberOfChannels)throw s();return"function"!=typeof d.copyFromChannel?(r(d),q(d)):e(E,(()=>E(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)}}})(je,ge,Zt,Le,Ce,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(Le),Be,Ue),Qe=(t=>(e,s)=>{const n=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});s.connect(n).connect(e.destination);const i=()=>{s.removeEventListener("ended",i),s.disconnect(n),n.disconnect()};s.addEventListener("ended",i)})(Bt),Ze=((t,e,s)=>async(n,i,o)=>{const r=e(n);await Promise.all(Array.from(r.activeInputs).map((async([e,n])=>{const r=t(e),a=await r.render(e,i);s(e)||a.connect(o,n)})))})(be,L,st),Xe=(t=>(e,s,n)=>t(s,e,n))(Ze),Ye=((t,e,s,n,i,o,r,a,c,h,l)=>(c,u)=>{const p=c.createBufferSource();return qt(p,u),Ft(p,u,"playbackRate"),Rt(p,u,"buffer"),Rt(p,u,"loop"),Rt(p,u,"loopEnd"),Rt(p,u,"loopStart"),e(s,(()=>s(c)))||(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)})(p),e(n,(()=>n(c)))||(t=>{t.start=(e=>(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)})(t.start)})(p),e(i,(()=>i(c)))||h(p,c),e(o,(()=>o(c)))||Vt(p),e(r,(()=>r(c)))||l(p,c),e(a,(()=>a(c)))||Nt(p),t(c,p),p})(Qe,ge,(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}),oe,re,ae,0,(t=>(e,s)=>{const n=s.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=n),t(e,"buffer",(t=>()=>{const s=t.call(e);return s===n?null:s}),(t=>s=>t.call(e,null===s?n:s)))})(ne),le),$e=((t,e)=>(s,n,i)=>(t(n).replay(i),e(n,s,i)))((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})(L),Ze),He=((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){const l=o.get(h);return void 0!==l?Promise.resolve(l):(async(c,h)=>{let l=s(c);const u=M(l,h);if(!u){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),u?await t(h,c.playbackRate,l.playbackRate):await n(h,c.playbackRate,l.playbackRate),await i(c,h,l),l})(c,h)}}})(Xe,Ye,tt,$e,Te),Je=((t,e,s,n,i,r,a,c,h,l,u,p,d)=>(n,f,_,m=null,g=null)=>{const v=_.value,y=new o.AutomationEventList(v),x=f?(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)}}}}))(y):null,w={get defaultValue(){return v},get maxValue(){return null===m?_.maxValue:m},get minValue(){return null===g?_.minValue:g},get value(){return _.value},set value(t){_.value=t,w.setValueAtTime(t,n.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof _.cancelAndHoldAtTime)null===x&&y.flush(n.context.currentTime),y.add(i(t)),_.cancelAndHoldAtTime(t);else{const e=Array.from(y).pop();null===x&&y.flush(n.context.currentTime),y.add(i(t));const s=Array.from(y).pop();_.cancelScheduledValues(t),e!==s&&void 0!==s&&("exponentialRampToValue"===s.type?_.exponentialRampToValueAtTime(s.value,s.endTime):"linearRampToValue"===s.type?_.linearRampToValueAtTime(s.value,s.endTime):"setValue"===s.type?_.setValueAtTime(s.value,s.startTime):"setValueCurve"===s.type&&_.setValueCurveAtTime(s.values,s.startTime,s.duration))}return w},cancelScheduledValues:t=>(null===x&&y.flush(n.context.currentTime),y.add(r(t)),_.cancelScheduledValues(t),w),exponentialRampToValueAtTime(t,e){if(0===t)throw new RangeError;if(!Number.isFinite(e)||e<0)throw new RangeError;const s=n.context.currentTime;return null===x&&y.flush(s),0===Array.from(y).length&&(y.add(l(v,s)),_.setValueAtTime(v,s)),y.add(a(t,e)),_.exponentialRampToValueAtTime(t,e),w},linearRampToValueAtTime(t,e){const s=n.context.currentTime;return null===x&&y.flush(s),0===Array.from(y).length&&(y.add(l(v,s)),_.setValueAtTime(v,s)),y.add(c(t,e)),_.linearRampToValueAtTime(t,e),w},setTargetAtTime:(t,e,s)=>(null===x&&y.flush(n.context.currentTime),y.add(h(t,e,s)),_.setTargetAtTime(t,e,s),w),setValueAtTime:(t,e)=>(null===x&&y.flush(n.context.currentTime),y.add(l(t,e)),_.setValueAtTime(t,e),w),setValueCurveAtTime(t,e,s){const i=t instanceof Float32Array?t:new Float32Array(t);if(null!==p&&"webkitAudioContext"===p.name){const t=e+s,o=n.context.sampleRate,r=Math.ceil(e*o),a=Math.floor(t*o),c=a-r,h=new Float32Array(c);for(let t=0;t<c;t+=1){const n=(i.length-1)/s*((r+t)/o-e),a=Math.floor(n),c=Math.ceil(n);h[t]=a===c?i[a]:(1-(n-a))*i[a]+(1-(c-n))*i[c]}null===x&&y.flush(n.context.currentTime),y.add(u(h,e,s)),_.setValueCurveAtTime(h,e,s);const l=a/o;l<t&&d(w,h[h.length-1],l),d(w,i[i.length-1],t)}else null===x&&y.flush(n.context.currentTime),y.add(u(i,e,s)),_.setValueCurveAtTime(i,e,s);return w}};return s.set(w,_),e.set(w,n),t(w,x),w})((Ke=h,(t,e)=>{Ke.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),De,l,0,o.createCancelAndHoldAutomationEvent,o.createCancelScheduledValuesAutomationEvent,o.createExponentialRampToValueAutomationEvent,o.createLinearRampToValueAutomationEvent,o.createSetTargetAutomationEvent,o.createSetValueAutomationEvent,o.createSetValueCurveAutomationEvent,Ee,ie);var Ke;const ts=((t,e,s,n,i,o,r,a)=>class extends t{constructor(t,n){const a=o(t),c={...P,...n},h=i(a,c),l=r(a),u=l?e():null;super(t,!1,h,u),this._audioBufferSourceNodeRenderer=u,this._isBufferNullified=!1,this._isBufferSet=null!==c.buffer,this._nativeAudioBufferSourceNode=h,this._onended=null,this._playbackRate=s(this,l,h.playbackRate,V,F)}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){k(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),N(this)&&C(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(Ve,He,Je,At,Ye,ke,Oe,ue),es=((t,e,s,n,i,o,r,a)=>class extends t{constructor(t,e){const s=o(t),n=r(s),c=i(s,e,n);super(t,!1,c,n?(t=>{const e=new WeakMap;return{render(s,n){const i=e.get(n);return void 0!==i?Promise.resolve(i):(async(s,n)=>{const i=n.destination;return e.set(n,i),await t(s,n,i),i})(s,n)}}})(a):null),this._isNodeOfNativeOfflineAudioContext=n,this._nativeAudioDestinationNode=c}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}})(Ve,0,R,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})(Bt,ne),ke,Oe,Te),ss=((t,e,s,n,i)=>()=>{const o=new WeakMap;return{render(r,a){const c=o.get(a);return void 0!==c?Promise.resolve(c):(async(r,a)=>{let c=s(r);const h=M(c,a);if(!h){const t={Q:c.Q.value,channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,detune:c.detune.value,frequency:c.frequency.value,gain:c.gain.value,type:c.type};c=e(a,t)}return o.set(a,c),h?(await t(a,r.Q,c.Q),await t(a,r.detune,c.detune),await t(a,r.frequency,c.frequency),await t(a,r.gain,c.gain)):(await n(a,r.Q,c.Q),await n(a,r.detune,c.detune),await n(a,r.frequency,c.frequency),await n(a,r.gain,c.gain)),await i(r,a,c),c})(r,a)}}})(Xe,jt,tt,$e,Te),ns=(t=>(e,s)=>t.set(e,s))(_e),is=((t,e,s,n,i,o,r,a)=>class extends t{constructor(t,n){const c=o(t),h={...mt,...n},l=i(c,h),u=r(c);super(t,!1,l,u?s():null),this._Q=e(this,u,l.Q,V,F),this._detune=e(this,u,l.detune,1200*Math.log2(V),-1200*Math.log2(V)),this._frequency=e(this,u,l.frequency,t.sampleRate/2,0),this._gain=e(this,u,l.gain,40*Math.log10(V),F),this._nativeBiquadFilterNode=l,a(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 n();throw t}if(t.length!==e.length||e.length!==s.length)throw n()}})(Ve,Je,ss,Ct,jt,ke,Oe,ns),os=((t,e)=>(s,n,i)=>{const o=new Set;return s.connect=(i=>(r,a=0,c=0)=>{const h=0===o.size;if(e(r))return i.call(s,r,a,c),t(o,[r,a,c],(t=>t[0]===r&&t[1]===a&&t[2]===c),!0),h&&n(),r;i.call(s,r,a),t(o,[r,a],(t=>t[0]===r&&t[1]===a),!0),h&&n()})(s.connect),s.disconnect=(t=>(n,r,a)=>{const c=o.size>0;if(void 0===n)t.apply(s),o.clear();else if("number"==typeof n){t.call(s,n);for(const t of o)t[1]===n&&o.delete(t)}else{e(n)?t.call(s,n,r,a):t.call(s,n,r);for(const t of o)t[0]!==n||void 0!==r&&t[1]!==r||void 0!==a&&t[2]!==a||o.delete(t)}const h=0===o.size;c&&h&&i()})(s.disconnect),s})(G,qe),rs=((t,e)=>(s,n)=>{n.channelCount=1,n.channelCountMode="explicit",Object.defineProperty(n,"channelCount",{get:()=>1,set:()=>{throw t()}}),Object.defineProperty(n,"channelCountMode",{get:()=>"explicit",set:()=>{throw t()}});const i=s.createBufferSource();e(n,(()=>{const t=n.numberOfInputs;for(let e=0;e<t;e+=1)i.connect(n,0,e)}),(()=>i.disconnect(n)))})(At,os),as=((t,e)=>(s,n)=>{const i=s.createChannelMerger(n.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(s,i),qt(i,n),i})(Ee,rs),cs=((t,e,s)=>()=>{const n=new WeakMap;return{render(i,o){const r=n.get(o);return void 0!==r?Promise.resolve(r):(async(i,o)=>{let r=e(i);if(!M(r,o)){const e={channelCount:r.channelCount,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,numberOfInputs:r.numberOfInputs};r=t(o,e)}return n.set(o,r),await s(i,o,r),r})(i,o)}}})(as,tt,Te),hs=((t,e,s,n,i)=>class extends t{constructor(t,o){const r=n(t),a={...gt,...o};super(t,!1,s(r,a),i(r)?e():null)}})(Ve,cs,as,ke,Oe),ls=((t,e,s)=>()=>{const n=new WeakMap;return{render(i,o){const r=n.get(o);return void 0!==r?Promise.resolve(r):(async(i,o)=>{let r=e(i);if(!M(r,o)){const e={channelCount:r.channelCount,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,numberOfOutputs:r.numberOfOutputs};r=t(o,e)}return n.set(o,r),await s(i,o,r),r})(i,o)}}})(Lt,tt,Te),us=((t,e,s,n,i,o)=>class extends t{constructor(t,o){const r=n(t),a=(t=>({...t,channelCount:t.numberOfOutputs}))({...vt,...o});super(t,!1,s(r,a),i(r)?e():null)}})(Ve,ls,Lt,ke,Oe),ps=((t,e,s,n)=>(i,{offset:o,...r})=>{const a=i.createBuffer(1,2,44100),c=e(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),h=s(i,{...r,gain:o}),l=a.getChannelData(0);l[0]=1,l[1]=1,c.buffer=a,c.loop=!0;const u={get bufferSize(){},get channelCount(){return h.channelCount},set channelCount(t){h.channelCount=t},get channelCountMode(){return h.channelCountMode},set channelCountMode(t){h.channelCountMode=t},get channelInterpretation(){return h.channelInterpretation},set channelInterpretation(t){h.channelInterpretation=t},get context(){return h.context},get inputs(){return[]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return h.numberOfOutputs},get offset(){return h.gain},get onended(){return c.onended},set onended(t){c.onended=t},addEventListener:(...t)=>c.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>c.dispatchEvent(t[0]),removeEventListener:(...t)=>c.removeEventListener(t[0],t[1],t[2]),start(t=0){c.start.call(c,t)},stop(t=0){c.stop.call(c,t)}};return t(i,c),n(zt(u,h),(()=>c.connect(h)),(()=>c.