1import{r as Wn,t as Ht}from"./rolldown-runtime-BPhFYGVA.js";var jn="15.1.22",kc=Ht(((n,t)=>{function e(s){if(Array.isArray(s))return s}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})),Cc=Ht(((n,t)=>{function e(s,i){var r=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(r!=null){var o,a,c,h,l=[],u=!0,d=!1;try{if(c=(r=r.call(s)).next,i===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(o=c.call(r)).done)&&(l.push(o.value),l.length!==i);u=!0);}catch(f){d=!0,a=f}finally{try{if(!u&&r.return!=null&&(h=r.return(),Object(h)!==h))return}finally{if(d)throw a}}return l}}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})),Ac=Ht(((n,t)=>{function e(s,i){(i==null||i>s.length)&&(i=s.length);for(var r=0,o=Array(i);r<i;r++)o[r]=s[r];return o}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})),Dc=Ht(((n,t)=>{var e=Ac();function s(i,r){if(i){if(typeof i=="string")return e(i,r);var o={}.toString.call(i).slice(8,-1);return o==="Object"&&i.constructor&&(o=i.constructor.name),o==="Map"||o==="Set"?Array.from(i):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(i,r):void 0}}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports})),Oc=Ht(((n,t)=>{function e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})),Mc=Ht(((n,t)=>{var e=kc(),s=Cc(),i=Dc(),r=Oc();function o(a,c){return e(a)||s(a,c)||i(a,c)||r()}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports})),Ec=Ht(((n,t)=>{function e(s,i){if(!(s instanceof i))throw new TypeError("Cannot call a class as a function")}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})),cr=Ht(((n,t)=>{function e(s){"@babel/helpers - typeof";return t.exports=e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},t.exports.__esModule=!0,t.exports.default=t.exports,e(s)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})),Nc=Ht(((n,t)=>{var e=cr().default;function s(i,r){if(e(i)!="object"||!i)return i;var o=i[Symbol.toPrimitive];if(o!==void 0){var a=o.call(i,r||"default");if(e(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(i)}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports})),Rc=Ht(((n,t)=>{var e=cr().default,s=Nc();function i(r){var o=s(r,"string");return e(o)=="symbol"?o:o+""}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),Fc=Ht(((n,t)=>{var e=Rc();function s(r,o){for(var a=0;a<o.length;a++){var c=o[a];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(r,e(c.key),c)}}function i(r,o,a){return o&&s(r.prototype,o),a&&s(r,a),Object.defineProperty(r,"prototype",{writable:!1}),r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),Ic=Ht(((n,t)=>{(function(e,s){typeof n=="object"&&typeof t<"u"?s(n,Mc(),Ec(),Fc()):typeof define=="function"&&define.amd?define(["exports","@babel/runtime/helpers/slicedToArray","@babel/runtime/helpers/classCallCheck","@babel/runtime/helpers/createClass"],s):(e=typeof globalThis<"u"?globalThis:e||self,s(e.automationEvents={},e._slicedToArray,e._classCallCheck,e._createClass))})(n,(function(e,s,i,r){"use strict";var o=function(A,S,k){return{endTime:S,insertTime:k,type:"exponentialRampToValue",value:A}},a=function(A,S,k){return{endTime:S,insertTime:k,type:"linearRampToValue",value:A}},c=function(A,S){return{startTime:S,type:"setValue",value:A}},h=function(A,S,k){return{duration:k,startTime:S,type:"setValueCurve",values:A}},l=function(A,S,k){var N=k.startTime,I=k.target,q=k.timeConstant;return I+(S-I)*Math.exp((N-A)/q)},u=function(A){return A.type==="exponentialRampToValue"},d=function(A){return A.type==="linearRampToValue"},f=function(A){return u(A)||d(A)},p=function(A){return A.type==="setValue"},m=function(A){return A.type==="setValueCurve"},_=function(A,S,k,N){var I=A[S];return I===void 0?N:f(I)||p(I)?I.value:m(I)?I.values[I.values.length-1]:l(k,_(A,S-1,I.startTime,N),I)},v=function(A,S,k,N,I){return k===void 0?[N.insertTime,I]:f(k)?[k.endTime,k.value]:p(k)?[k.startTime,k.value]:m(k)?[k.startTime+k.duration,k.values[k.values.length-1]]:[k.startTime,_(A,S-1,k.startTime,I)]},T=function(A){return A.type==="cancelAndHold"},C=function(A){return A.type==="cancelScheduledValues"},D=function(A){return T(A)||C(A)?A.cancelTime:u(A)||d(A)?A.endTime:A.startTime},g=function(A,S,k,N){var I=N.endTime,q=N.value;
2return k===q?q:0<k&&0<q||k<0&&q<0?k*Math.pow(q/k,(A-S)/(I-S)):A<I?k:q},w=function(A,S,k,N){var I=N.endTime,q=N.value;return k+(A-S)/(I-S)*(q-k)},y=function(A,S){var k=Math.floor(S);if(k===S)return A[k];var N=Math.ceil(S);return(1-(S-k))*A[k]+(1-(N-S))*A[N]},x=function(A,S){var k=S.duration,N=S.startTime,I=S.values;return y(I,(A-N)/k*(I.length-1))},F=function(A,S,k){for(var N=A.length,I=Math.max(1,Math.floor(k/S*N))+1,q=A instanceof Float32Array?new Float32Array(I):A.slice(0,I),lt=0;lt<I;lt+=1)q[lt]=y(A,lt/(I-1)*k/S*(N-1));return q},R=function(A){return A.type==="setTarget"},O=(function(){function P(A){i(this,P),this._automationEvents=[],this._currenTime=0,this._defaultValue=A}return r(P,[{key:Symbol.iterator,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:"add",value:function(S){var k=D(S);if(T(S)||C(S)){var N=this._automationEvents.findIndex(function(Xt){return C(S)&&m(Xt)?Xt.startTime+Xt.duration>=k:D(Xt)>=k}),I=this._automationEvents[N];if(N!==-1&&(this._automationEvents=this._automationEvents.slice(0,N)),T(S)){var q=this._automationEvents[this._automationEvents.length-1];if(I!==void 0&&f(I)){if(q!==void 0&&R(q))throw new Error("The internal list is malformed.");var lt=q===void 0?I.insertTime:m(q)?q.startTime+q.duration:D(q),Y=q===void 0?this._defaultValue:m(q)?q.values[q.values.length-1]:q.value,nt=u(I)?g(k,lt,Y,I):w(k,lt,Y,I),ut=u(I)?o(nt,k,this._currenTime):a(nt,k,this._currenTime);this._automationEvents.push(ut)}if(q!==void 0&&R(q)&&this._automationEvents.push(c(this.getValue(k),k)),q!==void 0&&m(q)&&q.startTime+q.duration>k){var z=k-q.startTime;this._automationEvents[this._automationEvents.length-1]=h(F(q.values,q.duration,z),q.startTime,z)}}}else{var Nt=this._automationEvents.findIndex(function(Xt){return D(Xt)>k}),zt=Nt===-1?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[Nt-1];if(zt!==void 0&&m(zt)&&D(zt)+zt.duration>k)return!1;var me=u(S)?o(S.value,S.endTime,this._currenTime):d(S)?a(S.value,k,this._currenTime):S;if(Nt===-1)this._automationEvents.push(me);else{if(m(S)&&k+S.duration>D(this._automationEvents[Nt]))return!1;this._automationEvents.splice(Nt,0,me)}}return!0}},{key:"flush",value:function(S){var k=this._automationEvents.findIndex(function(q){return D(q)>S});if(k>1){var N=this._automationEvents.slice(k-1),I=N[0];R(I)&&N.unshift(c(_(this._automationEvents,k-2,I.startTime,this._defaultValue),I.startTime)),this._automationEvents=N}}},{key:"getValue",value:function(S){if(this._automationEvents.length===0)return this._defaultValue;var k=this._automationEvents.findIndex(function(zt){return D(zt)>S}),N=this._automationEvents[k],I=(k===-1?this._automationEvents.length:k)-1,q=this._automationEvents[I];if(q!==void 0&&R(q)&&(N===void 0||!f(N)||N.insertTime>S))return l(S,_(this._automationEvents,I-1,q.startTime,this._defaultValue),q);if(q!==void 0&&p(q)&&(N===void 0||!f(N)))return q.value;if(q!==void 0&&m(q)&&(N===void 0||!f(N)||q.startTime+q.duration>S))return S<q.startTime+q.duration?x(S,q):q.values[q.values.length-1];if(q!==void 0&&f(q)&&(N===void 0||!f(N)))return q.value;if(N!==void 0&&u(N)){var lt=s(v(this._automationEvents,I,q,N,this._defaultValue),2),Y=lt[0],nt=lt[1];return g(S,Y,nt,N)}if(N!==void 0&&d(N)){var ut=s(v(this._automationEvents,I,q,N,this._defaultValue),2),z=ut[0],Nt=ut[1];return w(S,z,Nt,N)}return this._defaultValue}}])})(),E=function(A){return{cancelTime:A,type:"cancelAndHold"}},L=function(A){return{cancelTime:A,type:"cancelScheduledValues"}},V=function(A,S){return{endTime:S,type:"exponentialRampToValue",value:A}},X=function(A,S){return{endTime:S,type:"linearRampToValue",value:A}},U=function(A,S,k){return{startTime:S,target:A,timeConstant:k,type:"setTarget"}};e.AutomationEventList=O,e.createCancelAndHoldAutomationEvent=E,e.createCancelScheduledValuesAutomationEvent=L,e.createExponentialRampToValueAutomationEvent=V,e.createLinearRampToValueAutomationEvent=X,e.createSetTargetAutomationEvent=U,e.createSetValueAutomationEvent=c,e.createSetValueCurveAutomationEvent=h}))})),ke=Ic(),qc=()=>new DOMException("","AbortError"),Vc=n=>(t,e,[s,i,r],o)=>{n(t[i],[e,s,r],a=>a[0]===e&&a[1]===s,o)},Pc=n=>(t,e,s)=>{const i=[];for(let r=0;r<s.numberOfInputs;r+=1)i.push(new Set);n.set(t,{activeInputs:i,outputs:new Set,passiveInputs:new WeakMap,renderer:e})},Lc=n=>(t,e)=>{n.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})},Ze=new WeakSet,hr=new WeakMap,Bn=new WeakMap,lr=new WeakMap,zn=new WeakMap,tn=new WeakMap,ur=new WeakMap,Tn=new WeakMap,Sn=new WeakMap,kn=new WeakMap,dr={construct(){return dr}},Wc=n=>{try{new new Proxy(n,dr)}catch{return!1}return!0},Ei=/^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]*);?/,Ni=(n,t)=>{const e=[];let s=n.replace(/^[\s]+/,""),i=s.match(Ei);for(;i!==null;){const r=i[1].slice(1,-1),o=i[0].replace(/([\s]+)?;?$/,"").replace(r,new URL(r,t).toString());e.push(o),s=s.slice(i[0].length).replace(/^[\s]+/,""),i=s.match(Ei)}return[e.join(";"),s]},Ri=n=>{if(n!==void 0&&!Array.isArray(n))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},Fi=n=>{if(!Wc(n))throw new TypeError("The given value for processorCtor should be a constructor.");if(n.prototype===null||typeof n.prototype!="object")throw new TypeError("The given value for processorCtor should have a prototype.")},jc=(n,t,e,s,i,r,o,a,c,h,l,u,d)=>{let f=0;return(p,m,_={credentials:"omit"})=>{const v=l.get(p);if(v!==void 0&&v.has(m))return Promise.resolve();const T=h.get(p);if(T!==void 0){const g=T.get(m);
2if(g!==void 0)return g}const C=r(p),D=C.audioWorklet===void 0?i(m).then(([g,w])=>{const[y,x]=Ni(g,w);return e(`${y};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${x} 3})})(window,'_AWGS')`)}).then(()=>{const g=d._AWGS.pop();if(g===void 0)throw new SyntaxError;s(C.currentTime,C.sampleRate,()=>g(class{},void 0,(w,y)=>{if(w.trim()==="")throw t();const x=Sn.get(C);if(x!==void 0){if(x.has(w))throw t();Fi(y),Ri(y.parameterDescriptors),x.set(w,y)}else Fi(y),Ri(y.parameterDescriptors),Sn.set(C,new Map([[w,y]]))},C.sampleRate,void 0,void 0))}):Promise.all([i(m),Promise.resolve(n(u,u))]).then(([[g,w],y])=>{const x=f+1;f=x;const[F,R]=Ni(g,w),O=`${F};((AudioWorkletProcessor,registerProcessor)=>{${R} 4})(${y?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${y?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${y?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${x}',class extends AudioWorkletProcessor{process(){return !1}})`,E=new Blob([O],{type:"application/javascript; charset=utf-8"}),L=URL.createObjectURL(E);return C.audioWorklet.addModule(L,_).then(()=>{if(a(C))return C;const V=o(C);return V.audioWorklet.addModule(L,_).then(()=>V)}).then(V=>{if(c===null)throw new SyntaxError;try{new c(V,`__sac${x}`)}catch{throw new SyntaxError}}).finally(()=>URL.revokeObjectURL(L))});return T===void 0?h.set(p,new Map([[m,D]])):T.set(m,D),D.then(()=>{const g=l.get(p);g===void 0?l.set(p,new Set([m])):g.add(m)}).finally(()=>{const g=h.get(p);g!==void 0&&g.delete(m)}),D}},ne=(n,t)=>{const e=n.get(t);if(e===void 0)throw new Error("A value with the given key could not be found.");return e},en=(n,t)=>{const e=Array.from(n).filter(t);if(e.length>1)throw Error("More than one element was found.");if(e.length===0)throw Error("No element was found.");const[s]=e;return n.delete(s),s},pr=(n,t,e,s)=>{const i=ne(n,t),r=en(i,o=>o[0]===e&&o[1]===s);return i.size===0&&n.delete(t),r},ws=n=>ne(ur,n),Qe=n=>{if(Ze.has(n))throw new Error("The AudioNode is already stored.");Ze.add(n),ws(n).forEach(t=>t(!0))},fr=n=>"port"in n,xs=n=>{if(!Ze.has(n))throw new Error("The AudioNode is not stored.");Ze.delete(n),ws(n).forEach(t=>t(!1))},Cn=(n,t)=>{!fr(n)&&t.every(e=>e.size===0)&&xs(n)},Bc=(n,t,e,s,i,r,o,a,c,h,l,u,d)=>{const f=new WeakMap;return(p,m,_,v,T)=>{const{activeInputs:C,passiveInputs:D}=r(m),{outputs:g}=r(p),w=a(p),y=x=>{const F=c(m),R=c(p);if(x)n(C,p,pr(D,p,_,v),!1),!T&&!u(p)&&e(R,F,_,v),d(m)&&Qe(m);else{t(D,v,s(C,p,_,v),!1),!T&&!u(p)&&i(R,F,_,v);const O=o(m);if(O===0)l(m)&&Cn(m,C);else{const E=f.get(m);E!==void 0&&clearTimeout(E),f.set(m,setTimeout(()=>{l(m)&&Cn(m,C)},O*1e3))}}};return h(g,[m,_,v],x=>x[0]===m&&x[1]===_&&x[2]===v,!0)?(w.add(y),l(p)?n(C,p,[_,v,y],!0):t(D,v,[p,_,y],!0),!0):!1}},zc=n=>(t,e,[s,i,r],o)=>{const a=t.get(s);a===void 0?t.set(s,new Set([[i,e,r]])):n(a,[i,e,r],c=>c[0]===i&&c[1]===e,o)},Uc=n=>(t,e)=>{const s=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(s).connect(t.destination);const i=()=>{e.removeEventListener("ended",i),e.disconnect(s),s.disconnect()};e.addEventListener("ended",i)},Gc=n=>(t,e)=>{n(t).add(e)},Zc={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},Qc=(n,t,e,s,i,r)=>class extends n{constructor(a,c){const h=i(a),l=s(h,{...Zc,...c}),u=r(h)?t():null;super(a,!1,l,u),this._nativeAnalyserNode=l}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(a){this._nativeAnalyserNode.fftSize=a}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(a){const c=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=a,!(a>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=c,e()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(a){const c=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=a,!(this._nativeAnalyserNode.maxDecibels>a))throw this._nativeAnalyserNode.minDecibels=c,e()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(a){this._nativeAnalyserNode.smoothingTimeConstant=a}getByteFrequencyData(a){this._nativeAnalyserNode.getByteFrequencyData(a)}getByteTimeDomainData(a){this._nativeAnalyserNode.getByteTimeDomainData(a)}getFloatFrequencyData(a){this._nativeAnalyserNode.getFloatFrequencyData(a)}getFloatTimeDomainData(a){this._nativeAnalyserNode.getFloatTimeDomainData(a)}},Et=(n,t)=>n.context===t,Xc=(n,t,e)=>()=>{const s=new WeakMap,i=async(r,o)=>{let a=t(r);return Et(a,o)||(a=n(o,{channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,fftSize:a.fftSize,maxDecibels:a.maxDecibels,minDecibels:a.minDecibels,smoothingTimeConstant:a.smoothingTimeConstant})),s.set(o,a),await e(r,o,a),a};return{render(r,o){const a=s.get(o);return a!==void 0?Promise.resolve(a):i(r,o)}}},Ws=n=>
vendor: 11,862 bytes, line 4
4{try{n.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},de=()=>new DOMException("","IndexSizeError"),Un=n=>{n.getChannelData=(t=>e=>{try{return t.call(n,e)}catch(s){throw s.code===12?de():s}})(n.getChannelData)},$c={numberOfChannels:1},Yc=(n,t,e,s,i,r,o,a)=>{let c=null;return class mr{constructor(l){if(i===null)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:u,numberOfChannels:d,sampleRate:f}={...$c,...l};c===null&&(c=new i(1,1,44100));const p=s!==null&&t(r,r)?new s({length:u,numberOfChannels:d,sampleRate:f}):c.createBuffer(d,u,f);if(p.numberOfChannels===0)throw e();return typeof p.copyFromChannel!="function"?(o(p),Un(p)):t(Ws,()=>Ws(p))||a(p),n.add(p),p}static[Symbol.hasInstance](l){return l!==null&&typeof l=="object"&&Object.getPrototypeOf(l)===mr.prototype||n.has(l)}}},Lt=-34028234663852886e22,Rt=-Lt,ve=n=>Ze.has(n),Hc={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},Jc=(n,t,e,s,i,r,o,a)=>class extends n{constructor(h,l){const u=r(h),d={...Hc,...l},f=i(u,d),p=o(u),m=p?t():null;super(h,!1,f,m),this._audioBufferSourceNodeRenderer=m,this._isBufferNullified=!1,this._isBufferSet=d.buffer!==null,this._nativeAudioBufferSourceNode=f,this._onended=null,this._playbackRate=e(this,p,f.playbackRate,Rt,Lt)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(h){if(this._nativeAudioBufferSourceNode.buffer=h,h!==null){if(this._isBufferSet)throw s();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(h){this._nativeAudioBufferSourceNode.loop=h}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(h){this._nativeAudioBufferSourceNode.loopEnd=h}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(h){this._nativeAudioBufferSourceNode.loopStart=h}get onended(){return this._onended}set onended(h){const l=typeof h=="function"?a(this,h):null;this._nativeAudioBufferSourceNode.onended=l;const u=this._nativeAudioBufferSourceNode.onended;this._onended=u!==null&&u===l?h:u}get playbackRate(){return this._playbackRate}start(h=0,l=0,u){if(this._nativeAudioBufferSourceNode.start(h,l,u),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.start=u===void 0?[h,l]:[h,l,u]),this.context.state!=="closed"){Qe(this);const d=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",d),ve(this)&&xs(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",d)}}stop(h=0){this._nativeAudioBufferSourceNode.stop(h),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.stop=h)}},Kc=(n,t,e,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;const c=async(h,l)=>{let u=e(h);const d=Et(u,l);return d||(u=t(l,{buffer:u.buffer,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,loop:u.loop,loopEnd:u.loopEnd,loopStart:u.loopStart,playbackRate:u.playbackRate.value}),o!==null&&u.start(...o),a!==null&&u.stop(a)),r.set(l,u),d?await n(l,h.playbackRate,u.playbackRate):await s(l,h.playbackRate,u.playbackRate),await i(h,l,u),u};return{set start(h){o=h},set stop(h){a=h},render(h,l){const u=r.get(l);return u!==void 0?Promise.resolve(u):c(h,l)}}},th=n=>"playbackRate"in n,eh=n=>"frequency"in n&&"gain"in n,sh=n=>"offset"in n,nh=n=>!("frequency"in n)&&"gain"in n,ih=n=>"detune"in n&&"frequency"in n&&!("gain"in n),rh=n=>"pan"in n,It=n=>ne(hr,n),bs=n=>ne(lr,n),An=(n,t)=>{const{activeInputs:e}=It(n);e.forEach(i=>i.forEach(([r])=>{t.includes(n)||An(r,[...t,n])}));const s=th(n)?[n.playbackRate]:fr(n)?Array.from(n.parameters.values()):eh(n)?[n.Q,n.detune,n.frequency,n.gain]:sh(n)?[n.offset]:nh(n)?[n.gain]:ih(n)?[n.detune,n.frequency]:rh(n)?[n.pan]:[];for(const i of s){const r=bs(i);r!==void 0&&r.activeInputs.forEach(([o])=>An(o,t))}ve(n)&&xs(n)},sn=n=>{An(n.destination,[])},_r=n=>n===void 0||typeof n=="number"||typeof n=="string"&&(n==="balanced"||n==="interactive"||n==="playback"),oh=(n,t,e,s,i,r,o,a,c)=>class extends n{constructor(l={}){if(c===null)throw new Error("Missing the native AudioContext constructor.");let u;try{u=new c(l)}catch(p){throw p.code===12&&p.message==="sampleRate is not in range"?e():p}if(u===null)throw s();if(!_r(l.latencyHint))throw new TypeError(`The provided value '${l.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(l.sampleRate!==void 0&&u.sampleRate!==l.sampleRate)throw e();super(u,2);const{latencyHint:d}=l,{sampleRate:f}=u;if(this._baseLatency=typeof u.baseLatency=="number"?u.baseLatency:d==="balanced"?512/f:d==="interactive"||d===void 0?256/f:d==="playback"?1024/f:Math.max(2,Math.min(128,Math.round(d*f/128)))*128/f,this._nativeAudioContext=u,c.name==="webkitAudioContext"?(this._nativeGainNode=u.createGain(),this._nativeOscillatorNode=u.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(u.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,u.state==="running"){this._state="suspended";const p=()=>{this._state==="suspended"&&(this._state=null),u.removeEventListener("statechange",p)};u.addEventListener("statechange",p)}}get baseLatency(){return this._baseLatency}get state(){return this._state!==null?this._state:this._nativeAudioContext.state}close(){return this.state==="closed"?this._nativeAudioContext.close().then(()=>{throw t()}):(this._state==="suspended"&&(this._state=null),this._nativeAudioContext.close().then(()=>{this._nativeGainNode!==null&&this._nativeOscillatorNode!==null&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),sn(this)}))}createMediaElementSource(l){return new i(this,{mediaElement:l})}createMediaStreamDestination(){return new r(this)}createMediaStreamSource(l){return new o(this,{mediaStream:l})}createMediaStreamTrackSource(l){return new a(this,{mediaStreamTrack:l})}resume(){return this._state==="suspended"?new Promise((l,u)=>{const d=()=>{this._nativeAudioContext.removeEventListener("statechange",d),this._nativeAudioContext.state==="running"?l():this.resume().then(l,u)};this._nativeAudioContext.addEventListener("statechange",d)}):this._nativeAudioContext.resume().catch(l=>{throw l===void 0||l.code===15?t():l})}suspend(){return this._nativeAudioContext.suspend().catch(l=>{throw l===void 0?t():l})}},ah=(n,t,e,s,i,r,o,a)=>class extends n{constructor(h,l){const u=r(h),d=o(u),f=i(u,l,d),p=d?t(a):null;super(h,!1,f,p),this._isNodeOfNativeOfflineAudioContext=d,this._nativeAudioDestinationNode=f}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(h){if(this._isNodeOfNativeOfflineAudioContext)throw s();if(h>this._nativeAudioDestinationNode.maxChannelCount)throw e();this._nativeAudioDestinationNode.channelCount=h}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(h){if(this._isNodeOfNativeOfflineAudioContext)throw s();this._nativeAudioDestinationNode.channelCountMode=h}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}},ch=n=>{const t=new WeakMap,e=async(s,i)=>{const r=i.destination;return t.set(i,r),await n(s,i,r),r};return{render(s,i){const r=t.get(i);return r!==void 0?Promise.resolve(r):e(s,i)}}},hh=(n,t,e,s,i,r,o,a)=>(c,h)=>{const l=h.listener,u=()=>{const g=new Float32Array(1),w=t(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),y=o(h);let x=!1,F=[0,0,-1,0,1,0],R=[0,0,0];const O=()=>{if(x)return;x=!0;const X=s(h,256,9,0);X.onaudioprocess=({inputBuffer:U})=>{const P=[r(U,g,0),r(U,g,1),r(U,g,2),r(U,g,3),r(U,g,4),r(U,g,5)];P.some((S,k)=>S!==F[k])&&(l.setOrientation(...P),F=P);const A=[r(U,g,6),r(U,g,7),r(U,g,8)];A.some((S,k)=>S!==R[k])&&(l.setPosition(...A),R=A)},w.connect(X)},E=X=>U=>{U!==F[X]&&(F[X]=U,l.setOrientation(...F))},L=X=>U=>{U!==R[X]&&(R[X]=U,l.setPosition(...R))},V=(X,U,P)=>{const A=e(h,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:U});A.connect(w,0,X),A.start(),Object.defineProperty(A.offset,"defaultValue",{get(){return U}});const S=n({context:c},y,A.offset,Rt,Lt);return a(S,"value",k=>()=>k.call(S),k=>N=>{try{k.call(S,N)}catch(I){if(I.code!==9)throw I}O(),y&&P(N)}),S.cancelAndHoldAtTime=(k=>y?()=>{throw i()}:(...N)=>{const I=k.apply(S,N);return O(),I})(S.cancelAndHoldAtTime),S.cancelScheduledValues=(k=>y?()=>{throw i()}:(...N)=>{const I=k.apply(S,N);return O(),I})(S.cancelScheduledValues),S.exponentialRampToValueAtTime=(k=>y?()=>{throw i()}:(...N)=>{const I=k.apply(S,N);return O(),I})(S.exponentialRampToValueAtTime),S.linearRampToValueAtTime=(k=>y?()=>{throw i()}:(...N)=>{const I=k.apply(S,N);return O(),I})(S.linearRampToValueAtTime),S.setTargetAtTime=(k=>y?()=>{throw i()}:(...N)=>{const I=k.apply(S,N);return O(),I})(S.setTargetAtTime),S.setValueAtTime=(k=>y?()=>{throw i()}:(...N)=>{const I=k.apply(S,N);return O(),I})(S.setValueAtTime),S.setValueCurveAtTime=(k=>y?()=>{throw i()}:(...N)=>{const I=k.apply(S,N);return O(),I})(S.setValueCurveAtTime),S};return{forwardX:V(0,0,E(0)),forwardY:V(1,0,E(1)),forwardZ:V(2,-1,E(2)),positionX:V(6,0,L(0)),positionY:V(7,0,L(1)),positionZ:V(8,0,L(2)),upX:V(3,0,E(3)),upY:V(4,1,E(4)),upZ:V(5,0,E(5))}},{forwardX:d,forwardY:f,forwardZ:p,positionX:m,positionY:_,positionZ:v,upX:T,upY:C,upZ:D}=l.forwardX===void 0?u():l;return{get forwardX(){return d},get forwardY(){return f},get forwardZ(){return p},get positionX(){return m},get positionY(){return _},get positionZ(){return v},get upX(){return T},get upY(){return C},get upZ(){return D}}},js=n=>"context"in n,Ts=n=>js(n[0]),Le=(n,t,e,s)=>{for(const i of n)if(e(i)){if(s)return!1;throw Error("The set contains at least one similar element.")}return n.add(t),!0},Ii=(n,t,[e,s],i)=>{Le(n,[t,e,s],r=>r[0]===t&&r[1]===e,i)},qi=(n,[t,e,s],i)=>{const r=n.get(t);r===void 0?n.set(t,new Set([[e,s]])):Le(r,[e,s],o=>o[0]===e,i)},ns=n=>"inputs"in n,Bs=(n,t,e,s)=>{if(ns(t)){const i=t.inputs[s];return n.connect(i,e,0),[i,e,0]}return n.connect(t,e,s),[t,e,s]},gr=(n,t,e)=>{for(const s of n)if(s[0]===t&&s[1]===e)return n.delete(s),s;return null},lh=(n,t,e)=>en(n,s=>s[0]===t&&s[1]===e),vr=(n,t)=>{if(!ws(n).delete(t))throw new Error("Missing the expected event listener.")},yr=(n,t,e)=>{const s=ne(n,t),i=en(s,r=>r[0]===e);return s.size===0&&n.delete(t),i},zs=(n,t,e,s)=>{ns(t)?n.disconnect(t.inputs[s],e,0):n.disconnect(t,e,s)},ot=n=>ne(Bn,n),gs=n=>ne(zn,n),Fe=n=>Tn.has(n),Fs=n=>!Ze.has(n),Vi=(n,t)=>new Promise(e=>{if(t!==null)e(!0);else{const s=n.createScriptProcessor(256,1,1),i=n.createGain(),r=n.createBuffer(1,2,44100),o=r.getChannelData(0);o[0]=1,o[1]=1;const a=n.createBufferSource();a.buffer=r,a.loop=!0,a.connect(s).connect(n.destination),a.connect(i),a.disconnect(i),s.onaudioprocess=c=>{const h=c.inputBuffer.getChannelData(0);Array.prototype.some.call(h,l=>l===1)?e(!0):e(!1),a.stop(),s.onaudioprocess=null,a.disconnect(s),s.disconnect(n.destination)},a.start()}}),xn=(n,t)=>{const e=new Map;for(const s of n)for(const i of s){const r=e.get(i);e.set(i,r===void 0?1:r+1)}e.forEach((s,i)=>t(i,s))},Us=n=>"context"in n,uh=n=>{const t=new Map;n.connect=(e=>(s,i=0,r=0)=>{const o=Us(s)?e(s,i,r):e(s,i),a=t.get(s);return a===void 0?t.set(s,[{input:r,output:i}]):a.every(c=>c.input!==r||c.output!==i)&&a.push({input:r,output:i}),o})(n.connect.bind(n)),n.disconnect=(e=>(s,i,r)=>{if(e.apply(n),s===void 0)t.clear();else if(typeof s=="number")for(const[o,a]of t){const c=a.filter(h=>h.output!==s);c.length===0?t.delete(o):t.set(o,c)}else if(t.has(s))if(i===void 0)t.delete(s);else{const o=t.get(s);if(o!==void 0){const a=o.filter(c=>c.output!==i&&(c.input!==r||r===void 0));a.length===0?t.delete(s):t.set(s,a)}}
4for(const[o,a]of t)a.forEach(c=>{Us(o)?n.connect(o,c.output,c.input):n.connect(o,c.output)})})(n.disconnect)},dh=(n,t,e,s)=>{const{activeInputs:i,passiveInputs:r}=bs(t),{outputs:o}=It(n),a=ws(n),c=h=>{const l=ot(n),u=gs(t);h?(Ii(i,n,yr(r,n,e),!1),!s&&!Fe(n)&&l.connect(u,e)):(qi(r,lh(i,n,e),!1),!s&&!Fe(n)&&l.disconnect(u,e))};return Le(o,[t,e],h=>h[0]===t&&h[1]===e,!0)?(a.add(c),ve(n)?Ii(i,n,[e,c],!0):qi(r,[n,e,c],!0),!0):!1},ph=(n,t,e,s)=>{const{activeInputs:i,passiveInputs:r}=It(t),o=gr(i[s],n,e);return o===null?[pr(r,n,e,s)[2],!1]:[o[2],!0]},fh=(n,t,e)=>{const{activeInputs:s,passiveInputs:i}=bs(t),r=gr(s,n,e);return r===null?[yr(i,n,e)[1],!1]:[r[2],!0]},Gn=(n,t,e,s,i)=>{const[r,o]=ph(n,e,s,i);if(r!==null&&(vr(n,r),o&&!t&&!Fe(n)&&zs(ot(n),ot(e),s,i)),ve(e)){const{activeInputs:a}=It(e);Cn(e,a)}},Zn=(n,t,e,s)=>{const[i,r]=fh(n,e,s);i!==null&&(vr(n,i),r&&!t&&!Fe(n)&&ot(n).disconnect(gs(e),s))},mh=(n,t)=>{const e=It(n),s=[];for(const i of e.outputs)Ts(i)?Gn(n,t,...i):Zn(n,t,...i),s.push(i[0]);return e.outputs.clear(),s},_h=(n,t,e)=>{const s=It(n),i=[];for(const r of s.outputs)r[1]===e&&(Ts(r)?Gn(n,t,...r):Zn(n,t,...r),i.push(r[0]),s.outputs.delete(r));return i},gh=(n,t,e,s,i)=>{const r=It(n);return Array.from(r.outputs).filter(o=>o[0]===e&&(s===void 0||o[1]===s)&&(i===void 0||o[2]===i)).map(o=>(Ts(o)?Gn(n,t,...o):Zn(n,t,...o),r.outputs.delete(o),o[0]))},vh=(n,t,e,s,i,r,o,a,c,h,l,u,d,f,p,m)=>class extends h{constructor(v,T,C,D){super(C),this._context=v,this._nativeAudioNode=C;const g=l(v);u(g)&&e(Vi,()=>Vi(g,m))!==!0&&uh(C),Bn.set(this,C),ur.set(this,new Set),v.state!=="closed"&&T&&Qe(this),n(this,D,C)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(v){this._nativeAudioNode.channelCount=v}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(v){this._nativeAudioNode.channelCountMode=v}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(v){this._nativeAudioNode.channelInterpretation=v}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(v,T=0,C=0){if(T<0||T>=this._nativeAudioNode.numberOfOutputs)throw i();const D=p(l(this._context));if(d(v)||f(v))throw r();if(js(v)){const w=ot(v);try{const y=Bs(this._nativeAudioNode,w,T,C),x=Fs(this);(D||x)&&this._nativeAudioNode.disconnect(...y),this.context.state!=="closed"&&!x&&Fs(v)&&Qe(v)}catch(y){throw y.code===12?r():y}return t(this,v,T,C,D)&&xn(c([this],v),s(D)),v}const g=gs(v);if(g.name==="playbackRate"&&g.maxValue===1024)throw o();try{this._nativeAudioNode.connect(g,T),(D||Fs(this))&&this._nativeAudioNode.disconnect(g,T)}catch(w){throw w.code===12?r():w}dh(this,v,T,D)&&xn(c([this],v),s(D))}disconnect(v,T,C){let D;const g=p(l(this._context));if(v===void 0)D=mh(this,g);else if(typeof v=="number"){if(v<0||v>=this.numberOfOutputs)throw i();D=_h(this,g,v)}else{if(T!==void 0&&(T<0||T>=this.numberOfOutputs)||js(v)&&C!==void 0&&(C<0||C>=v.numberOfInputs))throw i();if(D=gh(this,g,v,T,C),D.length===0)throw r()}for(const w of D)xn(c([this],w),a)}},yh=(n,t,e,s,i,r,o,a,c,h,l,u,d)=>(f,p,m,_=null,v=null)=>{const T=m.value,C=new ke.AutomationEventList(T),D=p?s(C):null,g={get defaultValue(){return T},get maxValue(){return _===null?m.maxValue:_},get minValue(){return v===null?m.minValue:v},get value(){return m.value},set value(w){m.value=w,g.setValueAtTime(w,f.context.currentTime)},cancelAndHoldAtTime(w){if(typeof m.cancelAndHoldAtTime=="function")D===null&&C.flush(f.context.currentTime),C.add(i(w)),m.cancelAndHoldAtTime(w);else{const y=Array.from(C).pop();D===null&&C.flush(f.context.currentTime),C.add(i(w));const x=Array.from(C).pop();m.cancelScheduledValues(w),y!==x&&x!==void 0&&(x.type==="exponentialRampToValue"?m.exponentialRampToValueAtTime(x.value,x.endTime):x.type==="linearRampToValue"?m.linearRampToValueAtTime(x.value,x.endTime):x.type==="setValue"?m.setValueAtTime(x.value,x.startTime):x.type==="setValueCurve"&&m.setValueCurveAtTime(x.values,x.startTime,x.duration))}return g},cancelScheduledValues(w){return D===null&&C.flush(f.context.currentTime),C.add(r(w)),m.cancelScheduledValues(w),g},exponentialRampToValueAtTime(w,y){if(w===0)throw new RangeError;if(!Number.isFinite(y)||y<0)throw new RangeError;
vendor: 4,503 bytes, line 4
4const x=f.context.currentTime;return D===null&&C.flush(x),Array.from(C).length===0&&(C.add(h(T,x)),m.setValueAtTime(T,x)),C.add(o(w,y)),m.exponentialRampToValueAtTime(w,y),g},linearRampToValueAtTime(w,y){const x=f.context.currentTime;return D===null&&C.flush(x),Array.from(C).length===0&&(C.add(h(T,x)),m.setValueAtTime(T,x)),C.add(a(w,y)),m.linearRampToValueAtTime(w,y),g},setTargetAtTime(w,y,x){return D===null&&C.flush(f.context.currentTime),C.add(c(w,y,x)),m.setTargetAtTime(w,y,x),g},setValueAtTime(w,y){return D===null&&C.flush(f.context.currentTime),C.add(h(w,y)),m.setValueAtTime(w,y),g},setValueCurveAtTime(w,y,x){const F=w instanceof Float32Array?w:new Float32Array(w);if(u!==null&&u.name==="webkitAudioContext"){const R=y+x,O=f.context.sampleRate,E=Math.ceil(y*O),L=Math.floor(R*O),V=L-E,X=new Float32Array(V);for(let P=0;P<V;P+=1){const A=(F.length-1)/x*((E+P)/O-y),S=Math.floor(A),k=Math.ceil(A);X[P]=S===k?F[S]:(1-(A-S))*F[S]+(1-(k-A))*F[k]}D===null&&C.flush(f.context.currentTime),C.add(l(X,y,x)),m.setValueCurveAtTime(X,y,x);const U=L/O;U<R&&d(g,X[X.length-1],U),d(g,F[F.length-1],R)}else D===null&&C.flush(f.context.currentTime),C.add(l(F,y,x)),m.setValueCurveAtTime(F,y,x);return g}};return e.set(g,m),t.set(g,f),n(g,D),g},wh=n=>({replay(t){for(const e of n)if(e.type==="exponentialRampToValue"){const{endTime:s,value:i}=e;t.exponentialRampToValueAtTime(i,s)}else if(e.type==="linearRampToValue"){const{endTime:s,value:i}=e;t.linearRampToValueAtTime(i,s)}else if(e.type==="setTarget"){const{startTime:s,target:i,timeConstant:r}=e;t.setTargetAtTime(i,s,r)}else if(e.type==="setValue"){const{startTime:s,value:i}=e;t.setValueAtTime(i,s)}else if(e.type==="setValueCurve"){const{duration:s,startTime:i,values:r}=e;t.setValueCurveAtTime(r,i,s)}else throw new Error("Can't apply an unknown automation.")}}),wr=class{constructor(n){this._map=new Map(n)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(n,t=null){return this._map.forEach((e,s)=>n.call(t,e,s,this))}get(n){return this._map.get(n)}has(n){return this._map.has(n)}keys(){return this._map.keys()}values(){return this._map.values()}},xh={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}},bh=(n,t,e,s,i,r,o,a,c,h,l,u,d,f)=>class extends t{constructor(m,_,v){var T;const C=a(m),D=c(C),g=l({...xh,...v});d(g);const w=Sn.get(C),y=w?.get(_),x=i(D||C.state!=="closed"?C:(T=o(C))!==null&&T!==void 0?T:C,D?null:m.baseLatency,h,_,y,g),F=D?s(_,g,y):null;super(m,!0,x,F);const R=[];x.parameters.forEach((E,L)=>{const V=e(this,D,E);R.push([L,V])}),this._nativeAudioWorkletNode=x,this._onprocessorerror=null,this._parameters=new wr(R),D&&n(C,this);const{activeInputs:O}=r(this);u(x,O)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(m){const _=typeof m=="function"?f(this,m):null;this._nativeAudioWorkletNode.onprocessorerror=_;const v=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=v!==null&&v===_?m:v}get parameters(){return this._parameters===null?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}};function Gs(n,t,e,s,i){if(typeof n.copyFromChannel=="function")t[e].byteLength===0&&(t[e]=new Float32Array(128)),n.copyFromChannel(t[e],s,i);else{const r=n.getChannelData(s);if(t[e].byteLength===0)t[e]=r.slice(i,i+128);else{const o=new Float32Array(r.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);t[e].set(o)}}}var xr=(n,t,e,s,i)=>{typeof n.copyToChannel=="function"?t[e].byteLength!==0&&n.copyToChannel(t[e],s,i):t[e].byteLength!==0&&n.getChannelData(s).set(t[e],i)},Zs=(n,t)=>{const e=[];for(let s=0;s<n;s+=1){const i=[],r=typeof t=="number"?t:t[s];for(let o=0;o<r;o+=1)i.push(new Float32Array(128));e.push(i)}return e},Th=(n,t)=>ne(ne(kn,n),ot(t)),Sh=async(n,t,e,s,i,r,o)=>{const a=t===null?Math.ceil(n.context.length/128)*128:t.length,c=s.channelCount*s.numberOfInputs,h=i.reduce((_,v)=>_+v,0),l=h===0?null:e.createBuffer(h,a,e.sampleRate);if(r===void 0)throw new Error("Missing the processor constructor.");const u=It(n),d=await Th(e,n),f=Zs(s.numberOfInputs,s.channelCount),p=Zs(s.numberOfOutputs,i),m=Array.from(n.parameters.keys()).reduce((_,v)=>({..._,[v]:new Float32Array(128)}),{});for(let _=0;_<a;_+=128){if(s.numberOfInputs>0&&t!==null)for(let v=0;v<s.numberOfInputs;v+=1)for(let T=0;T<s.channelCount;T+=1)Gs(t,f[v],T,T,_);r.parameterDescriptors!==void 0&&t!==null&&r.parameterDescriptors.forEac
4h(({name:v},T)=>{Gs(t,m,v,c+T,_)});for(let v=0;v<s.numberOfInputs;v+=1)for(let T=0;T<i[v];T+=1)p[v][T].byteLength===0&&(p[v][T]=new Float32Array(128));try{const v=f.map((C,D)=>u.activeInputs[D].size===0?[]:C),T=o(_/e.sampleRate,e.sampleRate,()=>d.process(v,p,m));if(l!==null)for(let C=0,D=0;C<s.numberOfOutputs;C+=1){for(let g=0;g<i[C];g+=1)xr(l,p[C],g,D+g,_);D+=i[C]}if(!T)break}catch(v){n.dispatchEvent(new ErrorEvent("processorerror",{colno:v.colno,filename:v.filename,lineno:v.lineno,message:v.message}));break}}return l},kh=(n,t,e,s,i,r,o,a,c,h,l,u,d,f,p,m)=>(_,v,T)=>{const C=new WeakMap;let D=null;const g=async(w,y)=>{let x=l(w),F=null;const R=Et(x,y),O=Array.isArray(v.outputChannelCount)?v.outputChannelCount:Array.from(v.outputChannelCount);if(u===null){const E=O.reduce((U,P)=>U+P,0),L=i(y,{channelCount:Math.max(1,E),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,E)}),V=[];for(let U=0;U<w.numberOfOutputs;U+=1)V.push(s(y,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:O[U]}));const X=o(y,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1});X.connect=t.bind(null,V),X.disconnect=c.bind(null,V),F=[L,V,X]}else R||(x=new u(y,_));if(C.set(y,F===null?x:F[2]),F!==null){if(D===null){if(T===void 0)throw new Error("Missing the processor constructor.");if(d===null)throw new Error("Missing the native OfflineAudioContext constructor.");const P=w.channelCount*w.numberOfInputs,A=T.parameterDescriptors===void 0?0:T.parameterDescriptors.length,S=P+A;D=Sh(w,S===0?null:await(async()=>{const N=new d(S,Math.ceil(w.context.length/128)*128,y.sampleRate),I=[],q=[];for(let nt=0;nt<v.numberOfInputs;nt+=1)I.push(o(N,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1})),q.push(i(N,{channelCount:v.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:v.channelCount}));const lt=await Promise.all(Array.from(w.parameters.values()).map(async nt=>{const ut=r(N,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:nt.value});return await f(N,nt,ut.offset),ut})),Y=s(N,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,P+A)});for(let nt=0;nt<v.numberOfInputs;nt+=1){I[nt].connect(q[nt]);for(let ut=0;ut<v.channelCount;ut+=1)q[nt].connect(Y,ut,nt*v.channelCount+ut)}for(const[nt,ut]of lt.entries())ut.connect(Y,0,P+nt),ut.start(0);return Y.connect(N.destination),await Promise.all(I.map(nt=>p(w,N,nt))),m(N)})(),y,v,O,T,h)}const E=await D,L=e(y,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[V,X,U]=F;E!==null&&(L.buffer=E,L.start(0)),L.connect(V);for(let P=0,A=0;P<w.numberOfOutputs;P+=1){const S=X[P];for(let k=0;k<O[P];k+=1)V.connect(S,A+k,k);A+=O[P]}return U}if(R)for(const[E,L]of w.parameters.entries())await n(y,L,x.parameters.get(E));else for(const[E,L]of w.parameters.entries())await f(y,L,x.parameters.get(E));return await p(w,y,x),x};return{render(w,y){a(y,w);const x=C.get(y);return x!==void 0?Promise.resolve(x):g(w,y)}}},Ch=(n,t,e,s,i,r,o,a,c,h,l,u,d,f,p,m,_,v,T,C)=>class extends p{constructor(g,w){super(g,w),this._nativeContext=g,this._audioWorklet=n===void 0?void 0:{addModule:(y,x)=>n(this,y,x)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new t(this)}createBiquadFilter(){return new i(this)}createBuffer(g,w,y){return new e({length:w,numberOfChannels:g,sampleRate:y})}createBufferSource(){return new s(this)}createChannelMerger(g=6){return new r(this,{numberOfInputs:g})}createChannelSplitter(g=6){return new o(this,{numberOfOutputs:g})}createConstantSource(){return new a(this)}createConvolver(){return new c(this)}createDelay(g=1){return new l(this,{maxDelayTime:g})}createDynamicsCompressor(){return new u(this)}createGain(){return new d(this)}createIIRFilter(g,w){return new f(this,{feedback:w,feedforward:g})}createOscillator(){return new m(this)}createPanner(){return new _(this)}
4createPeriodicWave(g,w,y={disableNormalization:!1}){return new v(this,{...y,imag:w,real:g})}createStereoPanner(){return new T(this)}createWaveShaper(){return new C(this)}decodeAudioData(g,w,y){return h(this._nativeContext,g).then(x=>(typeof w=="function"&&w(x),x),x=>{throw typeof y=="function"&&y(x),x})}},Ah={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},Dh=(n,t,e,s,i,r,o,a)=>class extends n{constructor(h,l){const u=r(h),d=i(u,{...Ah,...l}),f=o(u),p=f?e():null;super(h,!1,d,p),this._Q=t(this,f,d.Q,Rt,Lt),this._detune=t(this,f,d.detune,1200*Math.log2(Rt),-1200*Math.log2(Rt)),this._frequency=t(this,f,d.frequency,h.sampleRate/2,0),this._gain=t(this,f,d.gain,40*Math.log10(Rt),Lt),this._nativeBiquadFilterNode=d,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(h){this._nativeBiquadFilterNode.type=h}getFrequencyResponse(h,l,u){try{this._nativeBiquadFilterNode.getFrequencyResponse(h,l,u)}catch(d){throw d.code===11?s():d}if(h.length!==l.length||l.length!==u.length)throw s()}},Oh=(n,t,e,s,i)=>()=>{const r=new WeakMap,o=async(a,c)=>{let h=e(a);const l=Et(h,c);return l||(h=t(c,{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})),r.set(c,h),l?(await n(c,a.Q,h.Q),await n(c,a.detune,h.detune),await n(c,a.frequency,h.frequency),await n(c,a.gain,h.gain)):(await s(c,a.Q,h.Q),await s(c,a.detune,h.detune),await s(c,a.frequency,h.frequency),await s(c,a.gain,h.gain)),await i(a,c,h),h};return{render(a,c){const h=r.get(c);return h!==void 0?Promise.resolve(h):o(a,c)}}},Mh=(n,t)=>(e,s)=>{const i=t.get(e);if(i!==void 0)return i;const r=n.get(e);if(r!==void 0)return r;try{const o=s();return o instanceof Promise?(n.set(e,o),o.catch(()=>!1).then(a=>(n.delete(e),t.set(e,a),a))):(t.set(e,o),o)}catch{return t.set(e,!1),!1}},Eh={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Nh=(n,t,e,s,i)=>class extends n{constructor(o,a){const c=s(o),h=e(c,{...Eh,...a}),l=i(c)?t():null;super(o,!1,h,l)}},Rh=(n,t,e)=>()=>{const s=new WeakMap,i=async(r,o)=>{let a=t(r);return Et(a,o)||(a=n(o,{channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfInputs:a.numberOfInputs})),s.set(o,a),await e(r,o,a),a};return{render(r,o){const a=s.get(o);return a!==void 0?Promise.resolve(a):i(r,o)}}},Fh={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Ih=(n,t,e,s,i,r)=>class extends n{constructor(a,c){const h=s(a),l=e(h,r({...Fh,...c})),u=i(h)?t():null;super(a,!1,l,u)}},qh=(n,t,e)=>()=>{const s=new WeakMap,i=async(r,o)=>{let a=t(r);return Et(a,o)||(a=n(o,{channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,numberOfOutputs:a.numberOfOutputs})),s.set(o,a),await e(r,o,a),a};return{render(r,o){const a=s.get(o);return a!==void 0?Promise.resolve(a):i(r,o)}}},Vh=n=>(t,e,s)=>n(e,t,s),Ph=n=>(t,e,s=0,i=0)=>{const r=t[s];if(r===void 0)throw n();return Us(e)?r.connect(e,0,i):r.connect(e,0)},Lh=n=>(t,e)=>{const s=n(t,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1});return s.buffer=t.createBuffer(1,2,44100),s.loop=!0,s.connect(e),s.start(),()=>{s.stop(),s.disconnect(e)}},Wh={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},jh=(n,t,e,s,i,r,o)=>class extends n{constructor(c,h){const l=i(c),u=s(l,{...Wh,...h}),d=r(l),f=d?e():null;super(c,!1,u,f),this._constantSourceNodeRenderer=f,this._nativeConstantSourceNode=u,this._offset=t(this,d,u.offset,Rt,Lt),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(c){const h=typeof c=="function"?o(this,c):null;this._nativeConstantSourceNode.onended=h;const l=this._nativeConstantSourceNode.onended;this._onended=l!==null&&l===h?c:l}start(c=0){if(this._nativeConstantSourceNode.start(c),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.start=c),this.context.state!=="closed"){Qe(this);const h=()=>{this._nativeConstantSourceNode.removeEventListener("ended",h),ve(this)&&xs(this)};this._nativeConstantSourceNode.addEventListener("ended",h)}}stop(c=0){this._nativeConstantSourceNode.stop(c),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.stop=c)}},Bh=(n,t,e,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;const c=async(h,l)=>{let u=e(h);const d=Et(u,l);return d||(u=t(l,{channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,offset:u.offset.value}),o!==null&&u.start(o),a!==null&&u.stop(a)),r.set(l,u),d?await n(l,h.offset,u.offset):await s(l,h.offset,u.offset),await i(h,l,u),u};return{set start(h){o=h},set stop(h){a=h},render(h,l){const u=r.get(l);return u!==void 0?Promise.resolve(u):c(h,l)}}},zh=n=>t=>(n[0]=t,n[0]),Uh={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Gh=(n,t,e,s,i,r)=>class extends n{constructor(a,c){const h=s(a),l={...Uh,...c},u=e(h,l),d=i(h)?t():null;super(a,!1,u,d),this._isBufferNullified=!1,this._nativeConvolverNode=u,l.buffer!==null&&r(this,l.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(a){if(this._nativeConvolverNode.buffer=a,a===null&&this._nativeConvolverNode.buffer!==null){const c=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=c.createBuffer(1,1,c.sampleRate),this._isBufferNullified=!0,r(this,0)}else this._isBufferNullified=!1,r(this,this._nativeConvolverNode.buffer===null?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(a){this._nativeConvolverNode.normalize=a}},Zh=(n,t,e)=>()=>{const s=new WeakMap,i=async(r,o)=>{let a=t(r);return Et(a,o)||(a=n(o,{buffer:a.buffer,channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,disableNormalization:!a.normalize})),s.set(o,a),ns(a)?await e(r,o,a.inputs[0]):await e(r,o,a),a};return{render(r,o){const a=s.get(o);return a!==void 0?Promise.resolve(a):i(r,o)}}},Qh=(n,t)=>(e,s,i)=>{if(t===null)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new t(e,s,i)}catch(r){throw r.name==="SyntaxError"?n():r}},Xh=()=>new DOMException("","DataCloneError"),Pi=n=>{const{port1:t,port2:e}=new MessageChannel;return new Promise(s=>{const i=()=>{e.onmessage=null,t.close(),e.close(),s()};e.onmessage=()=>i();try{t.postMessage(n,[n])}catch{}finally{i()}})},$h=(n,t,e,s,i,r,o,a,c,h,l)=>(u,d)=>{const f=o(u)?u:r(u);if(i.has(d)){const p=e();return Promise.reject(p)}try{i.add(d)}catch{}
4return t(c,()=>c(f))?f.decodeAudioData(d).then(p=>(Pi(d).catch(()=>{}),t(a,()=>a(p))||l(p),n.add(p),p)):new Promise((p,m)=>{const _=async()=>{try{await Pi(d)}catch{}},v=T=>{m(T),_()};try{f.decodeAudioData(d,T=>{typeof T.copyFromChannel!="function"&&(h(T),Un(T)),n.add(T),_().then(()=>p(T))},T=>{v(T===null?s():T)})}catch(T){v(T)}})},Yh=(n,t,e,s,i,r,o,a)=>(c,h)=>{const l=t.get(c);if(l===void 0)throw new Error("Missing the expected cycle count.");const u=a(r(c.context));if(l===h){if(t.delete(c),!u&&o(c)){const d=s(c),{outputs:f}=e(c);for(const p of f)if(Ts(p))n(d,s(p[0]),p[1],p[2]);else{const m=i(p[0]);d.connect(m,p[1])}}}else t.set(c,l-h)},Hh={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},Jh=(n,t,e,s,i,r,o)=>class extends n{constructor(c,h){const l=i(c),u={...Hh,...h},d=s(l,u),f=r(l),p=f?e(u.maxDelayTime):null;super(c,!1,d,p),this._delayTime=t(this,f,d.delayTime),o(this,u.maxDelayTime)}get delayTime(){return this._delayTime}},Kh=(n,t,e,s,i)=>r=>{const o=new WeakMap,a=async(c,h)=>{let l=e(c);const u=Et(l,h);return u||(l=t(h,{channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,delayTime:l.delayTime.value,maxDelayTime:r})),o.set(h,l),u?await n(h,c.delayTime,l.delayTime):await s(h,c.delayTime,l.delayTime),await i(c,h,l),l};return{render(c,h){const l=o.get(h);return l!==void 0?Promise.resolve(l):a(c,h)}}},tl=n=>(t,e,s,i)=>n(t[i],r=>r[0]===e&&r[1]===s),el=n=>(t,e)=>{n(t).delete(e)},sl=n=>"delayTime"in n,nl=(n,t,e)=>function s(i,r){const o=js(r)?r:e(n,r);if(sl(o))return[];if(i[0]===o)return[i];if(i.includes(o))return[];const{outputs:a}=t(o);return Array.from(a).map(c=>s([...i,o],c[0])).reduce((c,h)=>c.concat(h),[])},Ns=(n,t,e)=>{const s=t[e];if(s===void 0)throw n();return s},il=n=>(t,e=void 0,s=void 0,i=0)=>e===void 0?t.forEach(r=>r.disconnect()):typeof e=="number"?Ns(n,t,e).disconnect():Us(e)?s===void 0?t.forEach(r=>r.disconnect(e)):i===void 0?Ns(n,t,s).disconnect(e,0):Ns(n,t,s).disconnect(e,0,i):s===void 0?t.forEach(r=>r.disconnect(e)):Ns(n,t,s).disconnect(e,0),rl={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},ol=(n,t,e,s,i,r,o,a)=>class extends n{constructor(h,l){const u=r(h),d=s(u,{...rl,...l}),f=o(u),p=f?e():null;super(h,!1,d,p),this._attack=t(this,f,d.attack),this._knee=t(this,f,d.knee),this._nativeDynamicsCompressorNode=d,this._ratio=t(this,f,d.ratio),this._release=t(this,f,d.release),this._threshold=t(this,f,d.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(h){const l=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=h,h>2)throw this._nativeDynamicsCompressorNode.channelCount=l,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(h){const l=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=h,h==="max")throw this._nativeDynamicsCompressorNode.channelCountMode=l,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return typeof this._nativeDynamicsCompressorNode.reduction.value=="number"?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}},al=(n,t,e,s,i)=>()=>{const r=new WeakMap,o=async(a,c)=>{let h=e(a);const l=Et(h,c);return l||(h=t(c,{attack:h.attack.value,channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,knee:h.knee.value,ratio:h.ratio.value,release:h.release.value,threshold:h.threshold.value})),r.set(c,h),l?(await n(c,a.attack,h.attack),await n(c,a.knee,h.knee),await n(c,a.ratio,h.ratio),await n(c,a.release,h.release),await n(c,a.threshold,h.threshold)):(await s(c,a.attack,h.attack),await s(c,a.knee,h.knee),await s(c,a.ratio,h.ratio),await s(c,a.release,h.release),await s(c,a.threshold,h.threshold)),await i(a,c,h),h};return{render(a,c){const h=r.get(c);return h!==void 0?Promise.resolve(h):o(a,c)}}},cl=()=>new DOMException("","EncodingError"),hl=n=>t=>new Promise((e,s)=>{if(n===null){s(new SyntaxError);return}const i=n.document.head;if(i===null)s(new SyntaxError);else{const r=n.document.createElement("script"),o=new Blob([t],{type:"application/javascript"}),a=URL.createObjectURL(o),c=n.onerror,h=()=>{n.onerror=c,URL.revokeObjectURL(a)};n.onerror=(l,u,d,f,p)=>
4{if(u===a||u===n.location.href&&d===1&&f===1)return h(),s(p),!1;if(c!==null)return c(l,u,d,f,p)},r.onerror=()=>{h(),s(new SyntaxError)},r.onload=()=>{h(),e()},r.src=a,r.type="module",i.appendChild(r)}}),ll=n=>class{constructor(e){this._nativeEventTarget=e,this._listeners=new WeakMap}addEventListener(e,s,i){if(s!==null){let r=this._listeners.get(s);r===void 0&&(r=n(this,s),typeof s=="function"&&this._listeners.set(s,r)),this._nativeEventTarget.addEventListener(e,r,i)}}dispatchEvent(e){return this._nativeEventTarget.dispatchEvent(e)}removeEventListener(e,s,i){const r=s===null?void 0:this._listeners.get(s);this._nativeEventTarget.removeEventListener(e,r===void 0?null:r,i)}},ul=n=>(t,e,s)=>{Object.defineProperties(n,{currentFrame:{configurable:!0,get(){return Math.round(t*e)}},currentTime:{configurable:!0,get(){return t}}});try{return s()}finally{n!==null&&(delete n.currentFrame,delete n.currentTime)}},dl=n=>async t=>{try{const e=await fetch(t);if(e.ok)return[await e.text(),e.url]}catch{}throw n()},pl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},fl=(n,t,e,s,i,r)=>class extends n{constructor(a,c){const h=i(a),l=s(h,{...pl,...c}),u=r(h),d=u?e():null;super(a,!1,l,d),this._gain=t(this,u,l.gain,Rt,Lt)}get gain(){return this._gain}},ml=(n,t,e,s,i)=>()=>{const r=new WeakMap,o=async(a,c)=>{let h=e(a);const l=Et(h,c);return l||(h=t(c,{channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,gain:h.gain.value})),r.set(c,h),l?await n(c,a.gain,h.gain):await s(c,a.gain,h.gain),await i(a,c,h),h};return{render(a,c){const h=r.get(c);return h!==void 0?Promise.resolve(h):o(a,c)}}},_l=(n,t)=>e=>t(n,e),gl=n=>t=>{const e=n(t);if(e.renderer===null)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return e.renderer},vl=n=>t=>{var e;return(e=n.get(t))!==null&&e!==void 0?e:0},yl=n=>t=>{const e=n(t);if(e.renderer===null)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return e.renderer},wl=n=>t=>n.get(t),gt=()=>new DOMException("","InvalidStateError"),xl=n=>t=>{const e=n.get(t);if(e===void 0)throw gt();return e},bl=(n,t)=>e=>{let s=n.get(e);if(s!==void 0)return s;if(t===null)throw new Error("Missing the native OfflineAudioContext constructor.");return s=new t(1,1,44100),n.set(e,s),s},Tl=n=>t=>{const e=n.get(t);if(e===void 0)throw new Error("The context has no set of AudioWorkletNodes.");return e},nn=()=>new DOMException("","InvalidAccessError"),Sl=n=>{n.getFrequencyResponse=(t=>(e,s,i)=>{if(e.length!==s.length||s.length!==i.length)throw nn();return t.call(n,e,s,i)})(n.getFrequencyResponse)},kl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},Cl=(n,t,e,s,i,r)=>class extends n{constructor(a,c){const h=s(a),l=i(h),u={...kl,...c},d=t(h,l?null:a.baseLatency,u),f=l?e(u.feedback,u.feedforward):null;super(a,!1,d,f),Sl(d),this._nativeIIRFilterNode=d,r(this,1)}getFrequencyResponse(a,c,h){return this._nativeIIRFilterNode.getFrequencyResponse(a,c,h)}},br=(n,t,e,s,i,r,o,a,c,h,l)=>{const u=h.length;let d=a;for(let f=0;f<u;f+=1){let p=e[0]*h[f];for(let m=1;m<i;m+=1){const _=d-m&c-1;p+=e[m]*r[_],p-=n[m]*o[_]}for(let m=i;m<s;m+=1)p+=e[m]*r[d-m&c-1];for(let m=i;m<t;m+=1)p-=n[m]*o[d-m&c-1];r[d]=h[f],o[d]=p,d=d+1&c-1,l[f]=p}return d},Al=(n,t,e,s)=>{const i=e instanceof Float64Array?e:new Float64Array(e),r=s instanceof Float64Array?s:new Float64Array(s),o=i.length,a=r.length,c=Math.min(o,a);if(i[0]!==1){for(let p=0;p<o;p+=1)r[p]/=i[0];for(let p=1;p<a;p+=1)i[p]/=i[0]}const h=32,l=new Float32Array(h),u=new Float32Array(h),d=t.createBuffer(n.numberOfChannels,n.length,n.sampleRate),f=n.numberOfChannels;for(let p=0;p<f;p+=1){const m=n.getChannelData(p),_=d.getChannelData(p);l.fill(0),u.fill(0),br(i,o,r,a,c,l,u,0,h,m,_)}return d},Dl=(n,t,e,s,i)=>(r,o)=>{const a=new WeakMap;let c=null;const h=async(l,u)=>{let d=null,f=t(l);const p=Et(f,u);if(u.createIIRFilter===void 0?d=n(u,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):p||(f=u.createIIRFilter(o,r)),a.set(u,d===null?f:d),d!==null){if(c===null){if(e===null)throw new Error("Missing the native OfflineAudioContext constructor.");const _=new e(l.context.destination.channelCount,l.context.length,u.sampleRate);c=(async()=>(await s(l,_,_.destination),Al(await i(_),u,r,o)))()}const m=await c;return d.buffer=m,d.start(0),d}return await s(l,u,f),f};return{render(l,u){const d=a.get(u);return d!==void 0?Promise.resolve(d):h(l,u)}}},Ol=(n,t,e,s,i,r)=>o=>(a,c)=>{const h=n.get(a);if(h===void 0){if(!o&&r(a)){const l=s(a),{outputs:u}=e(a);for(const d of u)if(Ts(d))t(l,s(d[0]),d[1],d[2]);else{const f=i(d[0]);l.disconnect(f,d[1])}}n.set(a,c)}else n.set(a,h+c)},Ml=(n,t)=>e=>t(n.get(e))||t(e),El=(n,t)=>e=>n.has(e)||t(e),Nl=(n,t)=>e=>n.has(e)||t(e),Rl=(n,t)=>e=>t(n.get(e))||t(e),Fl=n=>t=>n!==null&&t instanceof n,Il=n=>t=>n!==null&&typeof n.AudioNode=="function"&&t instanceof n.AudioNode,ql=n=>t=>n!==null&&typeof n.AudioParam=="function"&&t instanceof n.AudioParam,Vl=(n,t)=>e=>n(e)||t(e),Pl=n=>t=>n!==null&&t instanceof n,Ll=n=>n!==null&&n.isSecureContext,Wl=async(n,t,e,s,i,r,o,a,c,h,l,u,d,f,p,m)=>n(t,t)&&n(e,e)&&n(i,i)&&n(r,r)&&n(a,a)&&n(c,c)&&n(h,h)&&n(l,l)&&n(u,u)&&n(d,d)&&n(f,f)?(await Promise.all([n(s,s),n(o,o),n(p,p),n(m,m)])).every(_=>_):!1,jl=(n,t,e,s)=>class extends n{constructor(r,o){const a=e(r),c=t(a,o);if(s(a))throw TypeError();super(r,!0,c,null),this._nativeMediaElementAudioSourceNode=c}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}},Bl={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},zl=(n,t,e,s)=>class extends n{constructor(r,o){const a=e(r);if(s(a))throw new TypeError;const c=t(a,{...Bl,...o});super(r,!1,c,null),this._nativeMediaStreamAudioDestinationNode=c}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}},Ul=(n,t,e,s)=>class extends n{constructor(r,o){const a=e(r),c=t(a,o);if(s(a))throw new TypeError;super(r,!0,c,null),this._nativeMediaStreamAudioSourceNode=c}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}},Gl=(n,t,e)=>class extends n{constructor(i,r){const o=t(e(i),r);super(i,!0,o,null)}},Zl=(n,t,e,s,i)=>class extends s{constructor(o={}){if(i===null)throw new Error("Missing the native AudioContext constructor.");let a;try{a=new i(o)}catch(l){throw l.code===12&&l.message==="sampleRate is not in range"?t():l}if(a===null)throw e();if(!_r(o.latencyHint))throw new TypeError(`The provided value '${o.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(o.sampleRate!==void 0&&a.sampleRate!==o.sampleRate)throw t();super(a,2);const{latencyHint:c}=o,{sampleRate:h}=a;if(this._baseLatency=typeof a.baseLatency=="number"?a.baseLatency:c==="balanced"?512/h:c==="interactive"||c===void 0?256/h:c==="playback"?1024/h:Math.max(2,Math.min(128,Math.round(c*h/128)))*128/h,this._nativeAudioContext=a,i.name==="webkitAudioContext"?(this._nativeGainNode=a.createGain(),this._nativeOscillatorNode=a.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(a.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,a.state==="running"){this._state="suspended";const l=()=>{this._state==="suspended"&&(this._state=null),a.removeEventListener("statechange",l)};a.addEventListener("statechange",l)}}get baseLatency(){return this._baseLatency}get state(){return this._state!==null?this._state:this._nativeAudioContext.state}close(){return this.state==="closed"?this._nativeAudioContext.close().then(()=>{throw n()}):(this._state==="suspended"&&(this._state=null),this._nativeAudioContext.close().then(()=>{this._nativeGainNode!==null&&this._nativeOscillatorNode!==null&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),sn(this)}))}resume(){return this._state==="suspended"?new Promise((o,a)=>{const c=()=>{this._nativeAudioContext.removeEventListener("statechange",c),this._nativeAudioContext.state==="running"?o():this.resume().then(o,a)};this._nativeAudioContext.addEventListener("statechange",c)}):this._nativeAudioContext.resume().catch(o=>{throw o===void 0||o.code===15?n():o})}suspend(){return this._nativeAudioContext.suspend().catch(o=>{throw o===void 0?n():o})}},Ql=(n,t,e,s,i,r)=>class extends e{constructor(a,c){super(a),this._nativeContext=a,tn.set(this,a),s(a)&&i.set(a,new Set),this._destination=new n(this,c),this._listener=t(this,a),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(a){const c=typeof a=="function"?r(this,a):null;this._nativeContext.onstatechange=c;const h=this._nativeContext.onstatechange;this._onstatechange=h!==null&&h===c?a:h}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}},Ie=n=>{const t=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const e=n.decodeAudioData(t.buffer,()=>{});return e===void 0?!1:(e.catch(()=>{}),!0)}catch{}return!1},Xl={numberOfChannels:1},$l=(n,t,e,s,i)=>class extends s{constructor(o){const{length:a,numberOfChannels:c,sampleRate:h}={...Xl,...o},l=e(c,a,h);n(Ie,()=>Ie(l))||l.addEventListener("statechange",(()=>{let u=0;const d=f=>{this._state==="running"&&(u>0?(l.removeEventListener("statechange",d),f.stopImmediatePropagation(),this._waitForThePromiseToSettle(f)):u+=1)};return d})()),super(l,c),this._length=a,this._nativeOfflineAudioContext=l,this._state=null}get length(){return this._nativeOfflineAudioContext.length===void 0?this._length:this._nativeOfflineAudioContext.length}get state(){return this._state===null?this._nativeOfflineAudioContext.state:this._state}startRendering(){return this._state==="running"?Promise.reject(t()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,sn(this)}))}_waitForThePromiseToSettle(o){this._state===null?this._nativeOfflineAudioContext.dispatchEvent(o):setTimeout(()=>this._waitForThePromiseToSettle(o))}},Yl=(n,t)=>(e,s,i)=>{const r=new Set;return e.connect=(o=>(a,c=0,h=0)=>{const l=r.size===0;if(t(a))return o.call(e,a,c,h),n(r,[a,c,h],u=>u[0]===a&&u[1]===c&&u[2]===h,!0),l&&s(),a;o.call(e,a,c),n(r,[a,c],u=>u[0]===a&&u[1]===c,!0),l&&s()})(e.connect),e.disconnect=(o=>(a,c,h)=>{const l=r.size>0;
vendor: 9,094 bytes, line 4
4if(a===void 0)o.apply(e),r.clear();else if(typeof a=="number"){o.call(e,a);for(const d of r)d[1]===a&&r.delete(d)}else{t(a)?o.call(e,a,c,h):o.call(e,a,c);for(const d of r)d[0]===a&&(c===void 0||d[1]===c)&&(h===void 0||d[2]===h)&&r.delete(d)}const u=r.size===0;l&&u&&i()})(e.disconnect),e},at=(n,t,e)=>{const s=t[e];s!==void 0&&s!==n[e]&&(n[e]=s)},wt=(n,t)=>{at(n,t,"channelCount"),at(n,t,"channelCountMode"),at(n,t,"channelInterpretation")},Li=n=>typeof n.getFloatTimeDomainData=="function",Hl=n=>{n.getFloatTimeDomainData=t=>{const e=new Uint8Array(t.length);n.getByteTimeDomainData(e);const s=Math.max(e.length,n.fftSize);for(let i=0;i<s;i+=1)t[i]=(e[i]-128)*.0078125;return t}},Jl=(n,t)=>(e,s)=>{const i=e.createAnalyser();if(wt(i,s),!(s.maxDecibels>s.minDecibels))throw t();return at(i,s,"fftSize"),at(i,s,"maxDecibels"),at(i,s,"minDecibels"),at(i,s,"smoothingTimeConstant"),n(Li,()=>Li(i))||Hl(i),i},Kl=n=>n===null?null:n.hasOwnProperty("AudioBuffer")?n.AudioBuffer:null,dt=(n,t,e)=>{const s=t[e];s!==void 0&&s!==n[e].value&&(n[e].value=s)},tu=n=>{n.start=(t=>{let e=!1;return(s=0,i=0,r)=>{if(e)throw gt();t.call(n,s,i,r),e=!0}})(n.start)},Qn=n=>{n.start=(t=>(e=0,s=0,i)=>{if(typeof i=="number"&&i<0||s<0||e<0)throw new RangeError("The parameters can't be negative.");t.call(n,e,s,i)})(n.start)},Xn=n=>{n.stop=(t=>(e=0)=>{if(e<0)throw new RangeError("The parameter can't be negative.");t.call(n,e)})(n.stop)},eu=(n,t,e,s,i,r,o,a,c,h,l)=>(u,d)=>{const f=u.createBufferSource();return wt(f,d),dt(f,d,"playbackRate"),at(f,d,"buffer"),at(f,d,"loop"),at(f,d,"loopEnd"),at(f,d,"loopStart"),t(e,()=>e(u))||tu(f),t(s,()=>s(u))||c(f),t(i,()=>i(u))||h(f,u),t(r,()=>r(u))||Qn(f),t(o,()=>o(u))||l(f,u),t(a,()=>a(u))||Xn(f),n(u,f),f},su=n=>n===null?null:n.hasOwnProperty("AudioContext")?n.AudioContext:n.hasOwnProperty("webkitAudioContext")?n.webkitAudioContext:null,nu=(n,t)=>(e,s,i)=>{const r=e.destination;if(r.channelCount!==s)try{r.channelCount=s}catch{}i&&r.channelCountMode!=="explicit"&&(r.channelCountMode="explicit"),r.maxChannelCount===0&&Object.defineProperty(r,"maxChannelCount",{value:s});const o=n(e,{channelCount:s,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,gain:1});return t(o,"channelCount",a=>()=>a.call(o),a=>c=>{a.call(o,c);try{r.channelCount=c}catch(h){if(c>r.maxChannelCount)throw h}}),t(o,"channelCountMode",a=>()=>a.call(o),a=>c=>{a.call(o,c),r.channelCountMode=c}),t(o,"channelInterpretation",a=>()=>a.call(o),a=>c=>{a.call(o,c),r.channelInterpretation=c}),Object.defineProperty(o,"maxChannelCount",{get:()=>r.maxChannelCount}),o.connect(r),o},iu=n=>n===null?null:n.hasOwnProperty("AudioWorkletNode")?n.AudioWorkletNode:null,ru=n=>{const{port1:t}=new MessageChannel;try{t.postMessage(n)}finally{t.close()}},ou=(n,t,e,s,i)=>(r,o,a,c,h,l)=>{if(a!==null)try{const u=new a(r,c,l),d=new Map;let f=null;if(Object.defineProperties(u,{channelCount:{get:()=>l.channelCount,set:()=>{throw n()}},channelCountMode:{get:()=>"explicit",set:()=>{throw n()}},onprocessorerror:{get:()=>f,set:p=>{typeof f=="function"&&u.removeEventListener("processorerror",f),f=typeof p=="function"?p:null,typeof f=="function"&&u.addEventListener("processorerror",f)}}}),u.addEventListener=(p=>(...m)=>{if(m[0]==="processorerror"){const _=typeof m[1]=="function"?m[1]:typeof m[1]=="object"&&m[1]!==null&&typeof m[1].handleEvent=="function"?m[1].handleEvent:null;if(_!==null){const v=d.get(m[1]);v!==void 0?m[1]=v:(m[1]=T=>{T.type==="error"?(Object.defineProperties(T,{type:{value:"processorerror"}}),_(T)):_(new ErrorEvent(m[0],{...T}))},d.set(_,m[1]))}}return p.call(u,"error",m[1],m[2]),p.call(u,...m)})(u.addEventListener),u.removeEventListener=(p=>(...m)=>{if(m[0]==="processorerror"){const _=d.get(m[1]);_!==void 0&&(d.delete(m[1]),m[1]=_)}return p.call(u,"error",m[1],m[2]),p.call(u,m[0],m[1],m[2])})(u.removeEventListener),l.numberOfOutputs!==0){const p=e(r,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return u.connect(p).connect(r.destination),i(u,()=>p.disconnect(),()=>p.connect(r.destination))}return u}catch(u){throw u.code===11?s():u}if(h===void 0)throw s();return ru(l),t(r,o,h,l)},Tr=(n,t)=>n===null?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(n*t))))),au=n=>new Promise((t,e)=>{const{port1:s,port2:i}=new MessageChannel;s.onmessage=({data:r})=>{s.close(),i.close(),t(r)},s.onmessageerror=({data:r})=>{s.close(),i.close(),e(r)},i.postMessage(n)}),cu=async(n,t)=>new n(await au(t)),hu=(n,t,e,s)=>{let i=kn.get(n);i===void 0&&(i=new WeakMap,kn.set(n,i));const r=cu(e,s);return i.set(t,r),r},lu=(n,t,e,s,i,r,o,a,c,h,l,u,d)=>(f,p,m,_)=>{if(_.numberOfInputs===0&&_.numberOfOutputs===0)throw c();const v=Array.isArray(_.outputChannelCount)?_.outputChannelCount:Array.from(_.outputChannelCount);if(v.some(W=>W<1))throw c();if(v.length!==_.numberOfOutputs)throw t();if(_.channelCountMode!=="explicit")throw c();const T=_.channelCount*_.numberOfInputs,C=v.reduce((W,Q)=>W+Q,0),D=m.parameterDescriptors===void 0?0:m.parameterDescriptors.length;if(T+D>6||C>6)throw c();const g=new MessageChannel,w=[],y=[];for(let W=0;W<_.numberOfInputs;W+=1)w.push(o(f,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1})),y.push(i(f,{channelCount:_.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:_.channelCount}));const x=[];if(m.parameterDescriptors!==void 0)for(const{defaultValue:W,maxValue:Q,minValue:vt,name:ht}of m.parameterDescriptors){const K=r(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:_.parameterData[ht]!==void 0?_.parameterData[ht]:W===void 0?0:W});Object.defineProperties(K.offset,{defaultValue:{get:()=>W===void 0?0:W},maxValue:{get:()=>Q===void 0?Rt:Q},minValue:{get:()=>vt===void 0?Lt:vt}}),x.push(K)}const F=s(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,T+D)}),R=Tr(p,f.sampleRate),O=a(f,R,T+D,Math.max(1,C)),E=i(f,{channelCount:Math.max(1,C),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,C)}),L=[];for(let W=0;W<_.numberOfOutputs;W+=1)L.push(s(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:v[W]}));for(let W=0;W<_.numberOfInputs;W+=1){w[W].connect(y[W]);for(let Q=0;Q<_.channelCount;Q+=1)y[W].connect(F,Q,W*_.channelCount+Q)}const V=new wr(m.parameterDescriptors===void 0?[]:m.parameterDescriptors.map(({name:W},Q)=>{const vt=x[Q];return vt.connect(F,0,T+Q),vt.start(0),[W,vt.offset]}));F.connect(O);let X=_.channelInterpretation,U=null;const P=_.numberOfOutputs===0?[O]:L,A={get bufferSize(){return R},get channelCount(){return _.channelCount},set channelCount(W){throw e()},get channelCountMode(){return _.channelCountMode},set channelCountMode(W){throw e()},get channelInterpretation(){return X},set channelInterpretation(W){for(const Q of w)Q.channelInterpretation=W;X=W},get context(){return O.context},get inputs(){return w},get numberOfInputs(){return _.numberOfInputs},get numberOfOutputs(){return _.numberOfOutputs},get onprocessorerror(){return U},set onprocessorerror(W){typeof U=="function"&&A.removeEventListener("processorerror",U),U=typeof W=="function"?W:null,typeof U=="function"&&A.addEventListener("processorerror",U)},get parameters(){return V},get port(){return g.port2},addEventListener(...W){return O.addEventListener(W[0],W[1],W[2])},connect:n.bind(null,P),disconnect:h.bind(null,P),dispatchEvent(...W){return O.dispatchEvent(W[0])},removeEventListener(...W){return O.removeEventListener(W[0],W[1],W[2])}},S=new Map;g.port1.addEventListener=(W=>(...Q)=>{if(Q[0]==="message"){const vt=typeof Q[1]=="function"?Q[1]:typeof Q[1]=="object"&&Q[1]!==null&&typeof Q[1].handleEvent=="function"?Q[1].handleEvent:null;if(vt!==null){const ht=S.get(Q[1]);ht!==void 0?Q[1]=ht:(Q[1]=K=>{l(f.currentTime,f.sampleRate,()=>vt(K))},S.set(vt,Q[1]))}}return W.call(g.port1,Q[0],Q[1],Q[2])})(g.port1.addEventListener),g.port1.removeEventListener=(W=>(...Q)=>{if(Q[0]==="message"){const vt=S.get(Q[1]);vt!==void 0&&(S.delete(Q[1]),Q[1]=vt)}return W.call(g.port1,Q[0],Q[1],Q[2])})(g.port1.removeEventListener);let k=null;Object.defineProperty(g.port1,"onmessage",{get:()=>k,set:W=>{typeof k=="function"&&g.port1.removeEventListener("message",k),k=typeof W=="function"?W:null,typeof k=="function"&&(g.port1.addEventListener("message",k),g.port1.start())}}),m.prototype.port=g.port1;let N=null;hu(f,A,m,_).then(W=>N=W);const I=Zs(_.numberOfInputs,_.channelCount),q=Zs(_.numberOfOutputs,v),lt=m.parameterDescriptors===void 0?[]:m.parameterDescriptors.reduce((W,{name:Q})=>({...W,[Q]:new Float32Array(128)}),{});let Y=!0;const nt=()=>{_.numberOfOutputs>0&&O.disconnect(E);for(let W=0,Q=0;W<_.numberOfOutputs;W+=1){const vt=L[W];for(let ht=0;ht<v[W];ht+=1)E.disconnect(vt,Q+ht,ht);Q+=v[W]}},ut=new Map;O.onaudioprocess=({inputBuffer:W,outputBuffer:Q})=>{if(N!==null){const vt=u(A);for(let ht=0;ht<R;ht+=128){for(let K=0;K<_.numberOfInputs;K+=1)for(let tt=0;tt<_.channelCount;tt+=1)Gs(W,I[K],tt,tt,ht);
4m.parameterDescriptors!==void 0&&m.parameterDescriptors.forEach(({name:K},tt)=>{Gs(W,lt,K,T+tt,ht)});for(let K=0;K<_.numberOfInputs;K+=1)for(let tt=0;tt<v[K];tt+=1)q[K][tt].byteLength===0&&(q[K][tt]=new Float32Array(128));try{const K=I.map((tt,Jt)=>{if(vt[Jt].size>0)return ut.set(Jt,R/128),tt;const Se=ut.get(Jt);return Se===void 0?[]:(tt.every(Tc=>Tc.every(Sc=>Sc===0))&&(Se===1?ut.delete(Jt):ut.set(Jt,Se-1)),tt)});Y=l(f.currentTime+ht/f.sampleRate,f.sampleRate,()=>N.process(K,q,lt));for(let tt=0,Jt=0;tt<_.numberOfOutputs;tt+=1){for(let Se=0;Se<v[tt];Se+=1)xr(Q,q[tt],Se,Jt+Se,ht);Jt+=v[tt]}}catch(K){Y=!1,A.dispatchEvent(new ErrorEvent("processorerror",{colno:K.colno,filename:K.filename,lineno:K.lineno,message:K.message}))}if(!Y){for(let K=0;K<_.numberOfInputs;K+=1){w[K].disconnect(y[K]);for(let tt=0;tt<_.channelCount;tt+=1)y[ht].disconnect(F,tt,K*_.channelCount+tt)}if(m.parameterDescriptors!==void 0){const K=m.parameterDescriptors.length;for(let tt=0;tt<K;tt+=1){const Jt=x[tt];Jt.disconnect(F,0,T+tt),Jt.stop()}}F.disconnect(O),O.onaudioprocess=null,z?nt():me();break}}}};let z=!1;const Nt=o(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),zt=()=>O.connect(Nt).connect(f.destination),me=()=>{O.disconnect(Nt),Nt.disconnect()},Xt=()=>{if(Y){me(),_.numberOfOutputs>0&&O.connect(E);for(let W=0,Q=0;W<_.numberOfOutputs;W+=1){const vt=L[W];for(let ht=0;ht<v[W];ht+=1)E.connect(vt,Q+ht,ht);Q+=v[W]}}z=!0},bc=()=>{Y&&(zt(),nt()),z=!1};return zt(),d(A,Xt,bc)},Sr=(n,t)=>{const e=n.createBiquadFilter();return wt(e,t),dt(e,t,"Q"),dt(e,t,"detune"),dt(e,t,"frequency"),dt(e,t,"gain"),at(e,t,"type"),e},uu=(n,t)=>(e,s)=>{const i=e.createChannelMerger(s.numberOfInputs);return n!==null&&n.name==="webkitAudioContext"&&t(e,i),wt(i,s),i},du=n=>{const t=n.numberOfOutputs;Object.defineProperty(n,"channelCount",{get:()=>t,set:e=>{if(e!==t)throw gt()}}),Object.defineProperty(n,"channelCountMode",{get:()=>"explicit",set:e=>{if(e!=="explicit")throw gt()}}),Object.defineProperty(n,"channelInterpretation",{get:()=>"discrete",set:e=>{if(e!=="discrete")throw gt()}})},vs=(n,t)=>{const e=n.createChannelSplitter(t.numberOfOutputs);return wt(e,t),du(e),e},pu=(n,t,e,s,i)=>(r,o)=>{if(r.createConstantSource===void 0)return e(r,o);const a=r.createConstantSource();return wt(a,o),dt(a,o,"offset"),t(s,()=>s(r))||Qn(a),t(i,()=>i(r))||Xn(a),n(r,a),a},is=(n,t)=>(n.connect=t.connect.bind(t),n.disconnect=t.disconnect.bind(t),n),fu=(n,t,e,s)=>(i,{offset:r,...o})=>{const a=i.createBuffer(1,2,44100),c=t(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),h=e(i,{...o,gain:r}),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(p){h.channelCount=p},get channelCountMode(){return h.channelCountMode},set channelCountMode(p){h.channelCountMode=p},get channelInterpretation(){return h.channelInterpretation},set channelInterpretation(p){h.channelInterpretation=p},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(p){c.onended=p},addEventListener(...p){return c.addEventListener(p[0],p[1],p[2])},dispatchEvent(...p){return c.dispatchEvent(p[0])},removeEventListener(...p){return c.removeEventListener(p[0],p[1],p[2])},start(p=0){c.start.call(c,p)},stop(p=0){c.stop.call(c,p)}},d=()=>c.connect(h),f=()=>c.disconnect(h);return n(i,c),s(is(u,h),d,f)},mu=(n,t)=>(e,s)=>{const i=e.createConvolver();if(wt(i,s),s.disableNormalization===i.normalize&&(i.normalize=!s.disableNormalization),at(i,s,"buffer"),s.channelCount>2||(t(i,"channelCount",r=>()=>r.call(i),r=>o=>{if(o>2)throw n();return r.call(i,o)}),s.channelCountMode==="max"))throw n();return t(i,"channelCountMode",r=>()=>r.call(i),r=>o=>{if(o==="max")throw n();return r.call(i,o)}),i},Wi=(n,t)=>{const e=n.createDelay(t.maxDelayTime);return wt(e,t),dt(e,t,"delayTime"),e},_u=n=>(t,e)=>{const s=t.createDynamicsCompressor();if(wt(s,e),e.channelCount>2||e.channelCountMode==="max")throw n();return dt(s,e,"attack"),dt(s,e,"knee"),dt(s,e,"ratio"),dt(s,e,"release"),dt(s,e,"threshold"),s},jt=(n,t)=>{const e=n.createGain();return wt(e,t),dt(e,t,"gain"),e},gu=n=>(t,e,s)=>{if(t.createIIRFilter===void 0)return n(t,e,s);const i=t.createIIRFilter(s.feedforward,s.feedback);return wt(i,s),i};function vu(n,t){const e=t[0]*t[0]+t[1]*t[1];return[(n[0]*t[0]+n[1]*t[1])/e,(n[1]*t[0]-n[0]*t[1])/e]}function yu(n,t){return[n[0]*t[0]-n[1]*t[1],n[0]*t[1]+n[1]*t[0]]}function ji(n,t){let e=[0,0];for(let s=n.length-1;s>=0;s-=1)e=yu(e,t),e[0]+=n[s];return e}var wu=(n,t,e,s)=>(i,r,{channelCount:o,channelCountMode:a,channelInterpretation:c,feedback:h,feedforward:l})=>{const u=Tr(r,i.sampleRate),d=h instanceof Float64Array?h:new Float64Array(h),f=l instanceof Float64Array?l:new Float64Array(l),p=d.length,m=f.length,_=Math.min(p,m);if(p===0||p>20)throw s();if(d[0]===0)throw t();if(m===0||m>20)throw s();if(f[0]===0)throw t();if(d[0]!==1){for(let y=0;y<m;y+=1)f[y]/=d[0];for(let y=1;y<p;y+=1)d[y]/=d[0]}const v=e(i,u,o,o);v.channelCount=o,v.channelCountMode=a,v.channelInterpretation=c;const T=32,C=[],D=[],g=[];for(let y=0;y<o;y+=1){C.push(0);const x=new Float32Array(T),F=new Float32Array(T);
4x.fill(0),F.fill(0),D.push(x),g.push(F)}v.onaudioprocess=y=>{const x=y.inputBuffer,F=y.outputBuffer,R=x.numberOfChannels;for(let O=0;O<R;O+=1){const E=x.getChannelData(O),L=F.getChannelData(O);C[O]=br(d,p,f,m,_,D[O],g[O],C[O],T,E,L)}};const w=i.sampleRate/2;return is({get bufferSize(){return u},get channelCount(){return v.channelCount},set channelCount(y){v.channelCount=y},get channelCountMode(){return v.channelCountMode},set channelCountMode(y){v.channelCountMode=y},get channelInterpretation(){return v.channelInterpretation},set channelInterpretation(y){v.channelInterpretation=y},get context(){return v.context},get inputs(){return[v]},get numberOfInputs(){return v.numberOfInputs},get numberOfOutputs(){return v.numberOfOutputs},addEventListener(...y){return v.addEventListener(y[0],y[1],y[2])},dispatchEvent(...y){return v.dispatchEvent(y[0])},getFrequencyResponse(y,x,F){if(y.length!==x.length||x.length!==F.length)throw n();const R=y.length;for(let O=0;O<R;O+=1){const E=-Math.PI*(y[O]/w),L=[Math.cos(E),Math.sin(E)],V=vu(ji(f,L),ji(d,L));x[O]=Math.sqrt(V[0]*V[0]+V[1]*V[1]),F[O]=Math.atan2(V[1],V[0])}},removeEventListener(...y){return v.removeEventListener(y[0],y[1],y[2])}},v)},xu=(n,t)=>n.createMediaElementSource(t.mediaElement),bu=(n,t)=>{const e=n.createMediaStreamDestination();return wt(e,t),e.numberOfOutputs===1&&Object.defineProperty(e,"numberOfOutputs",{get:()=>0}),e},Tu=(n,{mediaStream:t})=>{const e=t.getAudioTracks();e.sort((r,o)=>r.id<o.id?-1:r.id>o.id?1:0);const s=e.slice(0,1),i=n.createMediaStreamSource(new MediaStream(s));return Object.defineProperty(i,"mediaStream",{value:t}),i},Su=(n,t)=>(e,{mediaStreamTrack:s})=>{if(typeof e.createMediaStreamTrackSource=="function")return e.createMediaStreamTrackSource(s);const i=new MediaStream([s]),r=e.createMediaStreamSource(i);if(s.kind!=="audio")throw n();if(t(e))throw new TypeError;return r},ku=n=>n===null?null:n.hasOwnProperty("OfflineAudioContext")?n.OfflineAudioContext:n.hasOwnProperty("webkitOfflineAudioContext")?n.webkitOfflineAudioContext:null,Cu=(n,t,e,s,i,r)=>(o,a)=>{const c=o.createOscillator();return wt(c,a),dt(c,a,"detune"),dt(c,a,"frequency"),a.periodicWave!==void 0?c.setPeriodicWave(a.periodicWave):at(c,a,"type"),t(e,()=>e(o))||Qn(c),t(s,()=>s(o))||r(c,o),t(i,()=>i(o))||Xn(c),n(o,c),c},Au=n=>(t,e)=>{const s=t.createPanner();return s.orientationX===void 0?n(t,e):(wt(s,e),dt(s,e,"orientationX"),dt(s,e,"orientationY"),dt(s,e,"orientationZ"),dt(s,e,"positionX"),dt(s,e,"positionY"),dt(s,e,"positionZ"),at(s,e,"coneInnerAngle"),at(s,e,"coneOuterAngle"),at(s,e,"coneOuterGain"),at(s,e,"distanceModel"),at(s,e,"maxDistance"),at(s,e,"panningModel"),at(s,e,"refDistance"),at(s,e,"rolloffFactor"),s)},Du=(n,t,e,s,i,r,o,a,c,h)=>(l,{coneInnerAngle:u,coneOuterAngle:d,coneOuterGain:f,distanceModel:p,maxDistance:m,orientationX:_,orientationY:v,orientationZ:T,panningModel:C,positionX:D,positionY:g,positionZ:w,refDistance:y,rolloffFactor:x,...F})=>{const R=l.createPanner();if(F.channelCount>2||F.channelCountMode==="max")throw o();wt(R,F);const O={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},E=e(l,{...O,channelInterpretation:"speakers",numberOfInputs:6}),L=s(l,{...F,gain:1}),V=s(l,{...O,gain:1}),X=s(l,{...O,gain:0}),U=s(l,{...O,gain:0}),P=s(l,{...O,gain:0}),A=s(l,{...O,gain:0}),S=s(l,{...O,gain:0}),k=i(l,256,6,1),N=r(l,{...O,curve:new Float32Array([1,1]),oversample:"none"});let I=[_,v,T],q=[D,g,w];const lt=new Float32Array(1);k.onaudioprocess=({inputBuffer:z})=>{const Nt=[c(z,lt,0),c(z,lt,1),c(z,lt,2)];Nt.some((me,Xt)=>me!==I[Xt])&&(R.setOrientation(...Nt),I=Nt);
4const zt=[c(z,lt,3),c(z,lt,4),c(z,lt,5)];zt.some((me,Xt)=>me!==q[Xt])&&(R.setPosition(...zt),q=zt)},Object.defineProperty(X.gain,"defaultValue",{get:()=>0}),Object.defineProperty(U.gain,"defaultValue",{get:()=>0}),Object.defineProperty(P.gain,"defaultValue",{get:()=>0}),Object.defineProperty(A.gain,"defaultValue",{get:()=>0}),Object.defineProperty(S.gain,"defaultValue",{get:()=>0});const Y={get bufferSize(){},get channelCount(){return R.channelCount},set channelCount(z){if(z>2)throw o();L.channelCount=z,R.channelCount=z},get channelCountMode(){return R.channelCountMode},set channelCountMode(z){if(z==="max")throw o();L.channelCountMode=z,R.channelCountMode=z},get channelInterpretation(){return R.channelInterpretation},set channelInterpretation(z){L.channelInterpretation=z,R.channelInterpretation=z},get coneInnerAngle(){return R.coneInnerAngle},set coneInnerAngle(z){R.coneInnerAngle=z},get coneOuterAngle(){return R.coneOuterAngle},set coneOuterAngle(z){R.coneOuterAngle=z},get coneOuterGain(){return R.coneOuterGain},set coneOuterGain(z){if(z<0||z>1)throw t();R.coneOuterGain=z},get context(){return R.context},get distanceModel(){return R.distanceModel},set distanceModel(z){R.distanceModel=z},get inputs(){return[L]},get maxDistance(){return R.maxDistance},set maxDistance(z){if(z<0)throw new RangeError;R.maxDistance=z},get numberOfInputs(){return R.numberOfInputs},get numberOfOutputs(){return R.numberOfOutputs},get orientationX(){return V.gain},get orientationY(){return X.gain},get orientationZ(){return U.gain},get panningModel(){return R.panningModel},set panningModel(z){R.panningModel=z},get positionX(){return P.gain},get positionY(){return A.gain},get positionZ(){return S.gain},get refDistance(){return R.refDistance},set refDistance(z){if(z<0)throw new RangeError;R.refDistance=z},get rolloffFactor(){return R.rolloffFactor},set rolloffFactor(z){if(z<0)throw new RangeError;R.rolloffFactor=z},addEventListener(...z){return L.addEventListener(z[0],z[1],z[2])},dispatchEvent(...z){return L.dispatchEvent(z[0])},removeEventListener(...z){return L.removeEventListener(z[0],z[1],z[2])}};u!==Y.coneInnerAngle&&(Y.coneInnerAngle=u),d!==Y.coneOuterAngle&&(Y.coneOuterAngle=d),f!==Y.coneOuterGain&&(Y.coneOuterGain=f),p!==Y.distanceModel&&(Y.distanceModel=p),m!==Y.maxDistance&&(Y.maxDistance=m),_!==Y.orientationX.value&&(Y.orientationX.value=_),v!==Y.orientationY.value&&(Y.orientationY.value=v),T!==Y.orientationZ.value&&(Y.orientationZ.value=T),C!==Y.panningModel&&(Y.panningModel=C),D!==Y.positionX.value&&(Y.positionX.value=D),g!==Y.positionY.value&&(Y.positionY.value=g),w!==Y.positionZ.value&&(Y.positionZ.value=w),y!==Y.refDistance&&(Y.refDistance=y),x!==Y.rolloffFactor&&(Y.rolloffFactor=x),(I[0]!==1||I[1]!==0||I[2]!==0)&&R.setOrientation(...I),(q[0]!==0||q[1]!==0||q[2]!==0)&&R.setPosition(...q);const nt=()=>{L.connect(R),n(L,N,0,0),N.connect(V).connect(E,0,0),N.connect(X).connect(E,0,1),N.connect(U).connect(E,0,2),N.connect(P).connect(E,0,3),N.connect(A).connect(E,0,4),N.connect(S).connect(E,0,5),E.connect(k).connect(l.destination)},ut=()=>{L.disconnect(R),a(L,N,0,0),N.disconnect(V),V.disconnect(E),N.disconnect(X),X.disconnect(E),N.disconnect(U),U.disconnect(E),N.disconnect(P),P.disconnect(E),N.disconnect(A),A.disconnect(E),N.disconnect(S),S.disconnect(E),E.disconnect(k),k.disconnect(l.destination)};return h(is(Y,R),nt,ut)},Ou=n=>(t,{disableNormalization:e,imag:s,real:i})=>{const r=s instanceof Float32Array?s:new Float32Array(s),o=i instanceof Float32Array?i:new Float32Array(i),a=t.createPeriodicWave(o,r,{disableNormalization:e});if(Array.from(s).length<2)throw n();return a},Ss=(n,t,e,s)=>n.createScriptProcessor(t,e,s),Mu=(n,t)=>(e,s)=>{const i=s.channelCountMode;if(i==="clamped-max")throw t();if(e.createStereoPanner===void 0)return n(e,s);const r=e.createStereoPanner();return wt(r,s),dt(r,s,"pan"),Object.defineProperty(r,"channelCountMode",{get:()=>i,set:o=>{if(o!==i)throw t()}}),r},Eu=(n,t,e,s,i,r)=>{const a=new Float32Array([1,1]),c=Math.PI/2,h={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...h,oversample:"none"},u=(p,m,_,v)=>{const T=new Float32Array(16385),C=new Float32Array(16385);for(let F=0;F<16385;F+=1){const R=F/16384*c;T[F]=Math.cos(R),C[F]=Math.sin(R)}const D=e(p,{...h,gain:0}),g=s(p,{...l,curve:T}),w=s(p,{...l,curve:a}),y=e(p,{...h,gain:0}),x=s(p,{...l,curve:C});return{connectGraph(){m.connect(D),m.connect(w.inputs===void 0?w:w.inputs[0]),m.connect(y),w.connect(_),_.connect(g.inputs===void 0?g:g.inputs[0]),_.connect(x.inputs===void 0?x:x.inputs[0]),g.connect(D.gain),x.connect(y.gain),D.connect(v,0,0),y.connect(v,0,1)},disconnectGraph(){m.disconnect(D),m.disconnect(w.inputs===void 0?w:w.inputs[0]),m.disconnect(y),w.disconnect(_),_.disconnect(g.inputs===void 0?g:g.inputs[0]),_.disconnect(x.inputs===void 0?x:x.inputs[0]),g.disconnect(D.gain),x.disconnect(y.gain),D.disconnect(v,0,0),y.disconnect(v,0,1)}}},d=(p,m,_,v)=>{const T=new Float32Array(16385),C=new Float32Array(16385),D=new Float32Array(16385),g=new Float32Array(16385),w=Math.floor(16385/2);for(let P=0;P<16385;P+=1)if(P>w){const A=(P-w)/(16384-w)*c;T[P]=Math.cos(A),C[P]=Math.sin(A),D[P]=0,g[P]=1}else{const A=P/(16384-w)*c;T[P]=1,C[P]=0,D[P]=Math.cos(A),g[P]=Math.sin(A)}const y=t(p,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),x=e(p,{...h,gain:0}),F=s(p,{...l,curve:T}),R=e(p,{...h,gain:0}),O=s(p,{...l,curve:C}),E=s(p,{...l,curve:a}),L=e(p,{...h,gain:0}),V=s(p,{...l,curve:D}),X=e(p,{...h,gain:0}),U=s(p,{...l,curve:g});return{connectGraph(){m.connect(y),m.connect(E.inputs===void 0?E:E.inputs[0]),y.c
4onnect(x,0),y.connect(R,0),y.connect(L,1),y.connect(X,1),E.connect(_),_.connect(F.inputs===void 0?F:F.inputs[0]),_.connect(O.inputs===void 0?O:O.inputs[0]),_.connect(V.inputs===void 0?V:V.inputs[0]),_.connect(U.inputs===void 0?U:U.inputs[0]),F.connect(x.gain),O.connect(R.gain),V.connect(L.gain),U.connect(X.gain),x.connect(v,0,0),L.connect(v,0,0),R.connect(v,0,1),X.connect(v,0,1)},disconnectGraph(){m.disconnect(y),m.disconnect(E.inputs===void 0?E:E.inputs[0]),y.disconnect(x,0),y.disconnect(R,0),y.disconnect(L,1),y.disconnect(X,1),E.disconnect(_),_.disconnect(F.inputs===void 0?F:F.inputs[0]),_.disconnect(O.inputs===void 0?O:O.inputs[0]),_.disconnect(V.inputs===void 0?V:V.inputs[0]),_.disconnect(U.inputs===void 0?U:U.inputs[0]),F.disconnect(x.gain),O.disconnect(R.gain),V.disconnect(L.gain),U.disconnect(X.gain),x.disconnect(v,0,0),L.disconnect(v,0,0),R.disconnect(v,0,1),X.disconnect(v,0,1)}}},f=(p,m,_,v,T)=>{if(m===1)return u(p,_,v,T);if(m===2)return d(p,_,v,T);throw i()};return(p,{channelCount:m,channelCountMode:_,pan:v,...T})=>{if(_==="max")throw i();const C=n(p,{...T,channelCount:1,channelCountMode:_,numberOfInputs:2}),D=e(p,{...T,channelCount:m,channelCountMode:_,gain:1}),g=e(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:v});let{connectGraph:w,disconnectGraph:y}=f(p,m,D,g,C);Object.defineProperty(g.gain,"defaultValue",{get:()=>0}),Object.defineProperty(g.gain,"maxValue",{get:()=>1}),Object.defineProperty(g.gain,"minValue",{get:()=>-1});const x={get bufferSize(){},get channelCount(){return D.channelCount},set channelCount(E){D.channelCount!==E&&(F&&y(),{connectGraph:w,disconnectGraph:y}=f(p,E,D,g,C),F&&w()),D.channelCount=E},get channelCountMode(){return D.channelCountMode},set channelCountMode(E){if(E==="clamped-max"||E==="max")throw i();D.channelCountMode=E},get channelInterpretation(){return D.channelInterpretation},set channelInterpretation(E){D.channelInterpretation=E},get context(){return D.context},get inputs(){return[D]},get numberOfInputs(){return D.numberOfInputs},get numberOfOutputs(){return D.numberOfOutputs},get pan(){return g.gain},addEventListener(...E){return D.addEventListener(E[0],E[1],E[2])},dispatchEvent(...E){return D.dispatchEvent(E[0])},removeEventListener(...E){return D.removeEventListener(E[0],E[1],E[2])}};let F=!1;const R=()=>{w(),F=!0},O=()=>{y(),F=!1};return r(is(x,C),R,O)}},Nu=(n,t,e,s,i,r,o)=>(a,c)=>{const h=a.createWaveShaper();if(r!==null&&r.name==="webkitAudioContext"&&a.createGain().gain.automationRate===void 0)return e(a,c);wt(h,c);const l=c.curve===null||c.curve instanceof Float32Array?c.curve:new Float32Array(c.curve);if(l!==null&&l.length<2)throw t();at(h,{curve:l},"curve"),at(h,c,"oversample");let u=null,d=!1;return o(h,"curve",m=>()=>m.call(h),m=>_=>(m.call(h,_),d&&(s(_)&&u===null?u=n(a,h):!s(_)&&u!==null&&(u(),u=null)),_)),i(h,()=>{d=!0,s(h.curve)&&(u=n(a,h))},()=>{d=!1,u!==null&&(u(),u=null)})},Ru=(n,t,e,s,i)=>(r,{curve:o,oversample:a,...c})=>{const h=r.createWaveShaper(),l=r.createWaveShaper();wt(h,c),wt(l,c);const u=e(r,{...c,gain:1}),d=e(r,{...c,gain:-1}),f=e(r,{...c,gain:1}),p=e(r,{...c,gain:-1});let m=null,_=!1,v=null;const T={get bufferSize(){},get channelCount(){return h.channelCount},set channelCount(g){u.channelCount=g,d.channelCount=g,h.channelCount=g,f.channelCount=g,l.channelCount=g,p.channelCount=g},get channelCountMode(){return h.channelCountMode},set channelCountMode(g){u.channelCountMode=g,d.channelCountMode=g,h.channelCountMode=g,f.channelCountMode=g,l.channelCountMode=g,p.channelCountMode=g},get channelInterpretation(){return h.channelInterpretation},set channelInterpretation(g){u.channelInterpretation=g,d.channelInterpretation=g,h.channelInterpretation=g,f.channelInterpretation=g,l.channelInterpretation=g,p.channelInterpretation=g},get context(){return h.context},get curve(){return v},set curve(g){if(g!==null&&g.length<2)throw t();if(g===null)h.curve=g,l.curve=g;else{const w=g.length,y=new Float32Array(w+2-w%2),x=new Float32Array(w+2-w%2);y[0]=g[0],x[0]=-g[w-1];const F=Math.ceil((w+1)/2),R=(w+1)/2-1;for(let O=1;O<F;O+=1){const E=O/F*R,L=Math.floor(E),V=Math.ceil(E);y[O]=L===V?g[L]:(1-(E-L))*g[L]+(1-(V-E))*g[V],x[O]=L===V?-g[w-1-L]:-((1-(E-L))*g[w-1-L])-(1-(V-E))*g[w-1-V]}
4y[F]=w%2===1?g[F-1]:(g[F-2]+g[F-1])/2,h.curve=y,l.curve=x}v=g,_&&(s(v)&&m===null?m=n(r,u):m!==null&&(m(),m=null))},get inputs(){return[u]},get numberOfInputs(){return h.numberOfInputs},get numberOfOutputs(){return h.numberOfOutputs},get oversample(){return h.oversample},set oversample(g){h.oversample=g,l.oversample=g},addEventListener(...g){return u.addEventListener(g[0],g[1],g[2])},dispatchEvent(...g){return u.dispatchEvent(g[0])},removeEventListener(...g){return u.removeEventListener(g[0],g[1],g[2])}};o!==null&&(T.curve=o instanceof Float32Array?o:new Float32Array(o)),a!==T.oversample&&(T.oversample=a);const C=()=>{u.connect(h).connect(f),u.connect(d).connect(l).connect(p).connect(f),_=!0,s(v)&&(m=n(r,u))},D=()=>{u.disconnect(h),h.disconnect(f),u.disconnect(d),d.disconnect(l),l.disconnect(p),p.disconnect(f),_=!1,m!==null&&(m(),m=null)};return i(is(T,f),C,D)},Mt=()=>new DOMException("","NotSupportedError"),Fu={numberOfChannels:1},Iu=(n,t,e,s,i)=>class extends n{constructor(o,a,c){let h;if(typeof o=="number"&&a!==void 0&&c!==void 0)h={length:a,numberOfChannels:o,sampleRate:c};else if(typeof o=="object")h=o;else throw new Error("The given parameters are not valid.");const{length:l,numberOfChannels:u,sampleRate:d}={...Fu,...h},f=s(u,l,d);t(Ie,()=>Ie(f))||f.addEventListener("statechange",(()=>{let p=0;const m=_=>{this._state==="running"&&(p>0?(f.removeEventListener("statechange",m),_.stopImmediatePropagation(),this._waitForThePromiseToSettle(_)):p+=1)};return m})()),super(f,u),this._length=l,this._nativeOfflineAudioContext=f,this._state=null}get length(){return this._nativeOfflineAudioContext.length===void 0?this._length:this._nativeOfflineAudioContext.length}get state(){return this._state===null?this._nativeOfflineAudioContext.state:this._state}startRendering(){return this._state==="running"?Promise.reject(e()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,sn(this)}))}_waitForThePromiseToSettle(o){this._state===null?this._nativeOfflineAudioContext.dispatchEvent(o):setTimeout(()=>this._waitForThePromiseToSettle(o))}},qu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},Vu=(n,t,e,s,i,r,o)=>class extends n{constructor(c,h){const l=i(c),u={...qu,...h},d=e(l,u),f=r(l),p=f?s():null,m=c.sampleRate/2;super(c,!1,d,p),this._detune=t(this,f,d.detune,153600,-153600),this._frequency=t(this,f,d.frequency,m,-m),this._nativeOscillatorNode=d,this._onended=null,this._oscillatorNodeRenderer=p,this._oscillatorNodeRenderer!==null&&u.periodicWave!==void 0&&(this._oscillatorNodeRenderer.periodicWave=u.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(c){const h=typeof c=="function"?o(this,c):null;this._nativeOscillatorNode.onended=h;const l=this._nativeOscillatorNode.onended;this._onended=l!==null&&l===h?c:l}get type(){return this._nativeOscillatorNode.type}set type(c){this._nativeOscillatorNode.type=c,this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(c){this._nativeOscillatorNode.setPeriodicWave(c),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=c)}start(c=0){if(this._nativeOscillatorNode.start(c),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.start=c),this.context.state!=="closed"){Qe(this);const h=()=>{this._nativeOscillatorNode.removeEventListener("ended",h),ve(this)&&xs(this)};this._nativeOscillatorNode.addEventListener("ended",h)}}stop(c=0){this._nativeOscillatorNode.stop(c),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.stop=c)}},Pu=(n,t,e,s,i)=>()=>{const r=new WeakMap;let o=null,a=null,c=null;const h=async(l,u)=>{let d=e(l);const f=Et(d,u);return f||(d=t(u,{channelCount:d.channelCount,channelCountMode:d.channelCountMode,channelInterpretation:d.channelInterpretation,detune:d.detune.value,frequency:d.frequency.value,periodicWave:o===null?void 0:o,type:d.type}),a!==null&&d.start(a),c!==null&&d.stop(c)),r.set(u,d),f?(await n(u,l.detune,d.detune),await n(u,l.frequency,d.frequency)):(await s(u,l.detune,d.detune),await s(u,l.frequency,d.frequency)),await i(l,u,d),d};return{set periodicWave(l){o=l},set start(l){a=l},set stop(l){c=l},render(l,u){const d=r.get(u);return d!==void 0?Promise.resolve(d):h(l,u)}}},Lu={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},Wu=(n,t,e,s,i,r,o)=>class extends n{constructor(c,h){const l=i(c),u=e(l,{...Lu,...h}),d=r(l),f=d?s():null;super(c,!1,u,f),this._nativePannerNode=u,this._orientationX=t(this,d,u.orientationX,Rt,Lt),this._orientationY=t(this,d,u.orientationY,Rt,Lt),this._orientationZ=t(this,d,u.orientationZ,Rt,Lt),this._positionX=t(this,d,u.positionX,Rt,Lt),this._positionY=t(this,d,u.positionY,Rt,Lt),this._positionZ=t(this,d,u.positionZ,Rt,Lt),o(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(c){this._nativePannerNode.coneInnerAngle=c}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(c){this._nativePannerNode.coneOuterAngle=c}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(c){this._nativePannerNode.coneOuterGain=c}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(c){this._nativePannerNode.distanceModel=c}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(c){this._nativePannerNode.maxDistance=c}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(c){this._nativePannerNode.panningModel=c}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(c){this._nativePannerNode.refDistance=c}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(c){this._nativePannerNode.rolloffFactor=c}},ju=(n,t,e,s,i,r,o,a,c,h)=>()=>{const l=new WeakMap;let u=null;const d=async(f,p)=>{let m=null,_=r(f);const v={channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation},T={...v,coneInnerAngle:_.coneInnerAngle,coneOuterAngle:_.coneOuterAngle,coneOuterGain:_.coneOuterGain,distanceModel:_.distanceModel,maxDistance:_.maxDistance,panningModel:_.panningModel,refDistance:_.refDistance,rolloffFactor:_.rolloffFactor},C=Et(_,p);if("bufferSize"in _?m=s(p,{...v,gain:1}):C||(_=i(p,{...T,orientationX:_.orientationX.value,orientationY:_.orientationY.value,orientationZ:_.orientationZ.value,positionX:_.positionX.value,positionY:_.positionY.value,positionZ:_.positionZ.value})),l.set(p,m===null?_:m),m!==null){if(u===null){if(o===null)throw new Error("Missing the native OfflineAudioContext constructor.");const O=new o(6,f.context.length,p.sampleRate),E=t(O,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});E.connect(O.destination),u=(async()=>{const L=await Promise.all([f.orientationX,f.orientationY,f.orientationZ,f.positionX,f.positionY,f.positionZ].map(async(V,X)=>{const U=e(O,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:X===0?1:0});return await a(O,V,U.offset),U}));for(let V=0;V<6;V+=1)L[V].connect(E,0,V),L[V].start(0);return h(O)})()}const D=await u,g=s(p,{...v,gain:1});await c(f,p,g);const w=[];for(let O=0;O<D.numberOfChannels;O+=1)w.push(D.getChannelData(O));let y=[w[0][0],w[1][0],w[2][0]],x=[w[3][0],w[4][0],w[5][0]],F=s(p,{...v,gain:1}),R=i(p,{...T,orientationX:y[0],orientationY:y[1],orientationZ:y[2],positionX:x[0],positionY:x[1],positionZ:x[2]});g.connect(F).connect(R.inputs[0]),R.connect(m);for(let O=128;O<D.length;O+=128){const E=[w[0][O],w[1][O],w[2][O]],L=[w[3][O],w[4][O],w[5][O]];if(E.some((V,X)=>V!==y[X])||L.some((V,X)=>V!==x[X])){y=E,x=L;const V=O/p.sampleRate;F.gain.setValueAtTime(0,V),F=s(p,{...v,gain:0}),R=i(p,{...T,orientationX:y[0],orientationY:y[1],orientationZ:y[2],positionX:x[0],positionY:x[1],positionZ:x[2]}),F.gain.setValueAtTime(1,V),g.connect(F).connect(R.inputs[0]),R.connect(m)}}return m}return C?(await n(p,f.orientationX,_.orientationX),await n(p,f.orientationY,_.orientationY),await n(p,f.orientationZ,_.orientationZ),await n(p,f.positionX,_.positionX),await n(p,f.positionY,_.positionY),await n(p,f.positionZ,_.positionZ
4)):(await a(p,f.orientationX,_.orientationX),await a(p,f.orientationY,_.orientationY),await a(p,f.orientationZ,_.orientationZ),await a(p,f.positionX,_.positionX),await a(p,f.positionY,_.positionY),await a(p,f.positionZ,_.positionZ)),ns(_)?await c(f,p,_.inputs[0]):await c(f,p,_),_};return{render(f,p){const m=l.get(p);return m!==void 0?Promise.resolve(m):d(f,p)}}},Bu={disableNormalization:!1},zu=(n,t,e,s)=>class kr{constructor(r,o){const a=n(t(r),s({...Bu,...o}));return e.add(a),a}static[Symbol.hasInstance](r){return r!==null&&typeof r=="object"&&Object.getPrototypeOf(r)===kr.prototype||e.has(r)}},Uu=(n,t)=>(e,s,i)=>(n(s).replay(i),t(s,e,i)),Gu=(n,t,e)=>async(s,i,r)=>{const o=n(s);await Promise.all(o.activeInputs.map((a,c)=>Array.from(a).map(async([h,l])=>{const u=await t(h).render(h,i),d=s.context.destination;!e(h)&&(s!==d||!e(s))&&u.connect(r,l,c)})).reduce((a,c)=>[...a,...c],[]))},Zu=(n,t,e)=>async(s,i,r)=>{const o=t(s);await Promise.all(Array.from(o.activeInputs).map(async([a,c])=>{const h=await n(a).render(a,i);e(a)||h.connect(r,c)}))},Qu=(n,t,e,s)=>i=>n(Ie,()=>Ie(i))?Promise.resolve(n(s,s)).then(r=>{if(!r){const o=e(i,512,0,1);i.oncomplete=()=>{o.onaudioprocess=null,o.disconnect()},o.onaudioprocess=()=>i.currentTime,o.connect(i.destination)}return i.startRendering()}):new Promise(r=>{const o=t(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=a=>{o.disconnect(),r(a.renderedBuffer)},o.connect(i.destination),i.startRendering()}),Xu=n=>(t,e)=>{n.set(t,e)},$u=n=>(t,e)=>n.set(t,e),Yu=(n,t,e,s,i,r,o,a)=>(c,h)=>e(c).render(c,h).then(()=>Promise.all(Array.from(s(h)).map(l=>e(l).render(l,h)))).then(()=>i(h)).then(l=>(typeof l.copyFromChannel!="function"?(o(l),Un(l)):t(r,()=>r(l))||a(l),n.add(l),l)),Hu={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},Ju=(n,t,e,s,i,r)=>class extends n{constructor(a,c){const h=i(a),l=e(h,{...Hu,...c}),u=r(h),d=u?s():null;super(a,!1,l,d),this._pan=t(this,u,l.pan)}get pan(){return this._pan}},Ku=(n,t,e,s,i)=>()=>{const r=new WeakMap,o=async(a,c)=>{let h=e(a);const l=Et(h,c);return l||(h=t(c,{channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,pan:h.pan.value})),r.set(c,h),l?await n(c,a.pan,h.pan):await s(c,a.pan,h.pan),ns(h)?await i(a,c,h.inputs[0]):await i(a,c,h),h};return{render(a,c){const h=r.get(c);return h!==void 0?Promise.resolve(h):o(a,c)}}},td=n=>()=>{if(n===null)return!1;try{new n({length:1,sampleRate:44100})}catch{return!1}return!0},ed=n=>()=>{if(n===null)return!1;const t=new n(1,1,44100).createBuffer(1,1,44100);if(t.copyToChannel===void 0)return!0;const e=new Float32Array(2);try{t.copyFromChannel(e,0,0)}catch{return!1}return!0},sd=n=>()=>{if(n===null)return!1;if(n.prototype!==void 0&&n.prototype.close!==void 0)return!0;const t=new n,e=t.close!==void 0;try{t.close()}catch{}return e},nd=n=>()=>{if(n===null)return Promise.resolve(!1);const t=new n(1,1,44100);return new Promise(e=>{let s=!0;const i=o=>{s&&(s=!1,t.startRendering(),e(o instanceof TypeError))};let r;try{r=t.decodeAudioData(null,()=>{},i)}catch(o){i(o)}r!==void 0&&r.catch(i)})},id=n=>()=>{if(n===null)return!1;let t;try{t=new n({latencyHint:"balanced"})}catch{return!1}return t.close(),!0},rd=n=>()=>{if(n===null)return!1;const t=new n(1,1,44100).createGain(),e=t.connect(t)===t;return t.disconnect(t),e},od=(n,t)=>async()=>{if(n===null)return!0;if(t===null)return!1;const e=new Blob(['let c,p;class A extends AudioWorkletProcessor{constructor(){super();this.port.onmessage=(e)=>{p=e.data;p.onmessage=()=>{p.postMessage(c);p.close()};this.port.postMessage(0)}}process(){c=1}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),s=new MessageChannel,i=new t(1,128,44100),r=URL.createObjectURL(e);let o=!1;try{await i.audioWorklet.addModule(r);const a=new n(i,"a",{numberOfOutputs:0}),c=i.createOscillator();await new Promise(h=>{a.port.onmessage=()=>h(),a.port.postMessage(s.port2,[s.port2])}),a.port.onmessage=()=>o=!0,c.connect(a),c.start(0),await i.startRendering(),o=await new Promise(h=>{s.port1.onmessage=({data:l})=>h(l===1),s.port1.postMessage(0)})}catch{}finally{s.port1.close(),URL.revokeObjectURL(r)}return o},ad=(n,t)=>async()=>
4{if(n===null)return!0;if(t===null)return!1;const e=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),s=new t(1,128,44100),i=URL.createObjectURL(e);let r=!1,o=!1;try{await s.audioWorklet.addModule(i);const a=new n(s,"a",{numberOfOutputs:0}),c=s.createOscillator();a.port.onmessage=()=>r=!0,a.onprocessorerror=()=>o=!0,c.connect(a),c.start(0),await s.startRendering(),await new Promise(h=>setTimeout(h))}catch{}finally{URL.revokeObjectURL(i)}return r&&!o},cd=n=>()=>{if(n===null)return!1;const t=new n(1,1,44100).createChannelMerger();if(t.channelCountMode==="max")return!0;try{t.channelCount=2}catch{return!0}return!1},hd=n=>()=>{if(n===null)return!1;const t=new n(1,1,44100);return t.createConstantSource===void 0?!0:t.createConstantSource().offset.maxValue!==Number.POSITIVE_INFINITY},ld=n=>()=>{if(n===null)return!1;const t=new n(1,1,44100),e=t.createConvolver();e.buffer=t.createBuffer(1,1,t.sampleRate);try{e.buffer=t.createBuffer(1,1,t.sampleRate)}catch{return!1}return!0},ud=n=>()=>{if(n===null)return!1;const t=new n(1,1,44100).createConvolver();try{t.channelCount=1}catch{return!1}return!0},dd=n=>()=>n!==null&&n.hasOwnProperty("isSecureContext"),pd=n=>()=>{if(n===null)return!1;const t=new n;try{return t.createMediaStreamSource(new MediaStream),!1}catch{return!0}finally{t.close()}},fd=(n,t)=>()=>{if(t===null)return Promise.resolve(!1);const e=new t(1,1,44100),s=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise(i=>{e.oncomplete=()=>{s.disconnect(),i(e.currentTime!==0)},e.startRendering()})},md=n=>()=>{if(n===null)return Promise.resolve(!1);const t=new n(1,1,44100);if(t.createStereoPanner===void 0||t.createConstantSource===void 0)return Promise.resolve(!0);const e=t.createConstantSource(),s=t.createStereoPanner();return e.channelCount=1,e.offset.value=1,s.channelCount=1,e.start(),e.connect(s).connect(t.destination),t.startRendering().then(i=>i.getChannelData(0)[0]!==1)},Cr=()=>new DOMException("","UnknownError"),_d={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},gd=(n,t,e,s,i,r,o)=>class extends n{constructor(c,h){const l=i(c),u=e(l,{..._d,...h}),d=r(l)?s():null;super(c,!0,u,d),this._isCurveNullified=!1,this._nativeWaveShaperNode=u,o(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(c){if(c===null)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(c.length<2)throw t();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=c}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(c){this._nativeWaveShaperNode.oversample=c}},vd=(n,t,e)=>()=>{const s=new WeakMap,i=async(r,o)=>{let a=t(r);return Et(a,o)||(a=n(o,{channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,curve:a.curve,oversample:a.oversample})),s.set(o,a),ns(a)?await e(r,o,a.inputs[0]):await e(r,o,a),a};return{render(r,o){const a=s.get(o);return a!==void 0?Promise.resolve(a):i(r,o)}}},yd=()=>typeof window>"u"?null:window,wd=(n,t)=>e=>{e.copyFromChannel=(s,i,r=0)=>{const o=n(r),a=n(i);if(a>=e.numberOfChannels)throw t();const c=e.length,h=e.getChannelData(a),l=s.length;for(let u=o<0?-o:0;u+o<c&&u<l;u+=1)s[u]=h[u+o]},e.copyToChannel=(s,i,r=0)=>{const o=n(r),a=n(i);if(a>=e.numberOfChannels)throw t();const c=e.length,h=e.getChannelData(a),l=s.length;for(let u=o<0?-o:0;u+o<c&&u<l;u+=1)h[u+o]=s[u]}},xd=n=>t=>{t.copyFromChannel=(e=>(s,i,r=0)=>{const o=n(r),a=n(i);if(o<t.length)return e.call(t,s,a,o)})(t.copyFromChannel),t.copyToChannel=(e=>(s,i,r=0)=>{const o=n(r),a=n(i);if(o<t.length)return e.call(t,s,a,o)})(t.copyToChannel)},bd=n=>(t,e)=>{const s=e.createBuffer(1,1,44100);t.buffer===null&&(t.buffer=s),n(t,"buffer",i=>()=>{const r=i.call(t);return r===s?null:r},i=>r=>i.call(t,r===null?s:r))},Td=(n,t)=>(e,s)=>{s.channelCount=1,s.channelCountMode="explicit",Object.defineProperty(s,"channelCount",{get:()=>1,set:()=>{throw n()}}),Object.defineProperty(s,"channelCountMode",{get:()=>"explicit",set:()=>{throw n()}});const i=e.createBufferSource();t(s,()=>{const a=s.numberOfInputs;for(let c=0;c<a;c+=1)i.connect(s,0,c)},()=>i.disconnect(s))},Ar=(n,t,e)=>n.copyFromChannel===void 0?n.getChannelData(e)[0]:(n.copyFromChannel(t,e),t[0]),Bi=n=>{if(n===null)return!1;const t=n.length;return t%2!==0?n[Math.floor(t/2)]!==0:n[t/2-1]+n[t/2]!==0},ks=(n,t,e,s)=>{let i=n;for(;!i.hasOwnProperty(t);)i=Object.getPrototypeOf(i);const{get:r,set:o}=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(n,t,{get:e(r),set:s(o)})},Sd=n=>({...n,outputChannelCount:n.outputChannelCount!==void 0?n.outputChannelCount:n.numberOfInputs===1&&n.numberOfOutputs===1?[n.channelCount]:Array.from({length:n.numberOfOutputs},()=>1)}),kd=n=>({...n,channelCount:n.numberOfOutputs}),Cd=n=>{const{imag:t,real:e}=n;
4return t===void 0?e===void 0?{...n,imag:[0,0],real:[0,0]}:{...n,imag:Array.from(e,()=>0),real:e}:e===void 0?{...n,imag:t,real:Array.from(t,()=>0)}:{...n,imag:t,real:e}},Dr=(n,t,e)=>{try{n.setValueAtTime(t,e)}catch(s){if(s.code!==9)throw s;Dr(n,t,e+1e-7)}},Ad=n=>{const t=n.createBufferSource();t.start();try{t.start()}catch{return!0}return!1},Dd=n=>{const t=n.createBufferSource();t.buffer=n.createBuffer(1,1,44100);try{t.start(0,1)}catch{return!1}return!0},Od=n=>{const t=n.createBufferSource();t.start();try{t.stop()}catch{return!1}return!0},$n=n=>{const t=n.createOscillator();try{t.start(-1)}catch(e){return e instanceof RangeError}return!1},Or=n=>{const t=n.createBuffer(1,1,44100),e=n.createBufferSource();e.buffer=t,e.start(),e.stop();try{return e.stop(),!0}catch{return!1}},Yn=n=>{const t=n.createOscillator();try{t.stop(-1)}catch(e){return e instanceof RangeError}return!1},Md=n=>{const{port1:t,port2:e}=new MessageChannel;try{t.postMessage(n)}finally{t.close(),e.close()}},Ed=()=>{try{new DOMException}catch{return!1}return!0},Nd=()=>new Promise(n=>{const t=new ArrayBuffer(0),{port1:e,port2:s}=new MessageChannel;e.onmessage=({data:i})=>n(i!==null),s.postMessage(t,[t])}),Rd=n=>{n.start=(t=>(e=0,s=0,i)=>{const r=n.buffer,o=r===null?s:Math.min(r.duration,s);r!==null&&o>r.duration-.5/n.context.sampleRate?t.call(n,e,0,0):t.call(n,e,o,i)})(n.start)},Mr=(n,t)=>{const e=t.createGain();n.connect(e);const s=(i=>()=>{i.call(n,e),n.removeEventListener("ended",s)})(n.disconnect);n.addEventListener("ended",s),is(n,e),n.stop=(i=>{let r=!1;return(o=0)=>{if(r)try{i.call(n,o)}catch{e.gain.setValueAtTime(0,o)}else i.call(n,o),r=!0}})(n.stop)},rs=(n,t)=>e=>{const s={value:n};return Object.defineProperties(e,{currentTarget:s,target:s}),typeof t=="function"?t.call(n,e):t.handleEvent.call(n,e)}
4,Fd=Vc(Le),Id=zc(Le),qd=tl(en),Er=new WeakMap,Vd=vl(Er),Qt=Mh(new Map,new WeakMap),ie=yd(),Nr=Jl(Qt,de),Hn=gl(It),Dt=Gu(It,Hn,Fe),Pd=Xc(Nr,ot,Dt),it=xl(tn),bt=ku(ie),et=Pl(bt),Rr=new WeakMap,Fr=ll(rs),ye=su(ie),Jn=Fl(ye),Kn=Il(ie),Ir=ql(ie),Xe=iu(ie),mt=vh(Pc(hr),Bc(Fd,Id,Bs,qd,zs,It,Vd,ws,ot,Le,ve,Fe,Fs),Qt,Ol(Tn,zs,It,ot,gs,ve),de,nn,Mt,Yh(Bs,Tn,It,ot,gs,it,ve,et),nl(Rr,It,ne),Fr,it,Jn,Kn,Ir,et,Xe),Ld=Qc(mt,Pd,de,Nr,it,et),ti=new WeakSet,zi=Kl(ie),qr=zh(new Uint32Array(1)),ei=wd(qr,de),si=xd(qr),Vr=Yc(ti,Qt,Mt,zi,bt,td(zi),ei,si),Qs=Uc(jt),Pr=Zu(Hn,bs,Fe),pe=Vh(Pr),os=eu(Qs,Qt,Ad,Dd,Od,$n,Or,Yn,Rd,bd(ks),Mr),fe=Uu(yl(bs),Pr),Wd=Kc(pe,os,ot,fe,Dt),ae=yh(Lc(lr),Rr,zn,wh,ke.createCancelAndHoldAutomationEvent,ke.createCancelScheduledValuesAutomationEvent,ke.createExponentialRampToValueAutomationEvent,ke.createLinearRampToValueAutomationEvent,ke.createSetTargetAutomationEvent,ke.createSetValueAutomationEvent,ke.createSetValueCurveAutomationEvent,ye,Dr),jd=Jc(mt,Wd,ae,gt,os,it,et,rs),Bd=ah(mt,ch,de,gt,nu(jt,ks),it,et,Dt),zd=Oh(pe,Sr,ot,fe,Dt),We=$u(Er),Ud=Dh(mt,ae,zd,nn,Sr,it,et,We),Oe=Yl(Le,Kn),Me=uu(ye,Td(gt,Oe)),Gd=Nh(mt,Rh(Me,ot,Dt),Me,it,et),Zd=Ih(mt,qh(vs,ot,Dt),vs,it,et,kd),$e=pu(Qs,Qt,fu(Qs,os,jt,Oe),$n,Yn),Qd=jh(mt,ae,Bh(pe,$e,ot,fe,Dt),$e,it,et,rs),Ui=mu(Mt,ks),Xd=Gh(mt,Zh(Ui,ot,Dt),Ui,it,et,We),$d=Jh(mt,ae,Kh(pe,Wi,ot,fe,Dt),Wi,it,et,We),Gi=_u(Mt),Yd=ol(mt,ae,al(pe,Gi,ot,fe,Dt),Gi,Mt,it,et,We),Hd=fl(mt,ae,ml(pe,jt,ot,fe,Dt),jt,it,et),Jd=wu(nn,gt,Ss,Mt),rn=Qu(Qt,jt,Ss,fd(jt,bt)),Kd=Dl(os,ot,bt,Dt,rn),tp=Cl(mt,gu(Jd),Kd,it,et,We),ep=hh(ae,Me,$e,Ss,Mt,Ar,et,ks),Lr=new WeakMap,ni=Ql(Bd,ep,Fr,et,Lr,rs),Zi=Cu(Qs,Qt,$n,Or,Yn,Mr),sp=Vu(mt,ae,Zi,Pu(pe,Zi,ot,fe,Dt),it,et,rs),Qi=Lh(os),Xs=Nu(Qi,gt,Ru(Qi,gt,jt,Bi,Oe),Bi,Oe,ye,ks),Xi=Au(Du(Bs,gt,Me,jt,Ss,Xs,Mt,zs,Ar,Oe)),np=Wu(mt,ae,Xi,ju(pe,Me,$e,jt,Xi,ot,bt,fe,Dt,rn),it,et,We),ip=zu(Ou(de),it,new WeakSet,Cd),$i=Mu(Eu(Me,vs,jt,Xs,Mt,Oe),Mt),rp=Ju(mt,ae,$i,Ku(pe,$i,ot,fe,Dt),it,et),op=gd(mt,gt,Xs,vd(Xs,ot,Dt),it,et,We),Wr=Ll(ie),ii=ul(ie),jr=new WeakMap,ap=bl(jr,bt),cp=Wr?jc(Qt,Mt,hl(ie),ii,dl(qc),it,ap,et,Xe,new WeakMap,new WeakMap,ad(Xe,bt),ie):void 0,hp=Vl(Jn,et),lp=$h(ti,Qt,Xh,cl,new WeakSet,it,hp,Ws,Ie,ei,si),Br=Ch(cp,Ld,Vr,jd,Ud,Gd,Zd,Qd,Xd,lp,$d,Yd,Hd,tp,ni,sp,np,ip,rp,op),up=jl(mt,xu,it,et),dp=zl(mt,bu,it,et),pp=Ul(mt,Tu,it,et),fp=Gl(mt,Su(gt,et),it),mp=oh(Br,gt,Mt,Cr,up,dp,pp,fp,ye),ri=Tl(Lr),_p=Gc(ri),zr=Ph(de),gp=el(ri),Ur=il(de),Gr=new WeakMap,vp=ou(gt,lu(zr,de,gt,Me,vs,$e,jt,Ss,Mt,Ur,ii,_l(Gr,ne),Oe),jt,Mt,Oe),yp=kh(pe,zr,os,Me,vs,$e,jt,gp,Ur,ii,ot,Xe,bt,fe,Dt,rn),wp=wl(jr),xp=Xu(Gr),Yi=Wr?bh(_p,mt,ae,yp,vp,It,wp,it,et,Xe,Sd,xp,Md,rs):void 0,h_=Zl(gt,Mt,Cr,ni,ye),Zr=Qh(Mt,bt),Qr=Yu(ti,Qt,Hn,ri,rn,Ws,ei,si),l_=$l(Qt,gt,Zr,ni,Qr),bp=Iu(Br,Qt,gt,Zr,Qr),Tp=Ml(tn,Jn),Sp=El(Bn,Kn),kp=Nl(zn,Ir),Cp=Rl(tn,et),Ap=()=>Wl(Qt,ed(bt),sd(ye),nd(bt),id(ye),rd(bt),od(Xe,bt),cd(bt),hd(bt),ld(bt),ud(bt),Ed,dd(ie),pd(ye),md(bt),Nd);function Wt(n){return n===void 0}function H(n){return n!==void 0}function Xr(n){return typeof n=="function"}function Gt(n){return typeof n=="number"}function we(n){return Object.prototype.toString.call(n)==="[object Object]"&&n.constructor===Object}function oi(n){return typeof n=="boolean"}function kt(n){return Array.isArray(n)}function re(n){return typeof n=="string"}function ps(n){return re(n)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(n)}var Dp=Wn({assert:()=>j,assertContextRunning:()=>ai,assertRange:()=>yt,assertUsedScheduleTime:()=>Yr,enterScheduledCallback:()=>Dn,log:()=>Hr,setLogger:()=>Op,warn:()=>as});function j(n,t){if(!n)throw new Error(t)}function yt(n,t,e=1/0){if(!(t<=n&&n<=e))throw new RangeError(`Value must be within [${t}, ${e}], got: ${n}`)}function ai(n){!n.isOffline&&n.state!=="running"&&as('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}var $r=!1,Hi=!1;function Dn(n){$r=n}function Yr(n){Wt(n)&&$r&&!Hi&&(Hi=!0,as("Events scheduled inside of scheduled callbacks should use the passed in scheduling time. See https://github.com/Tonejs/Tone.js/wiki/Accurate-Timing"))}var ci=console;function Op(n){ci=n}function Hr(...n){ci.log(...n)}function as(...n){ci.warn(...n)}function Mp(n){return new mp(n)}function Ep(n,t,e){return new bp(n,t,e)}var Ft=typeof self=="object"?self:null,Np=Ft&&(Ft.hasOwnProperty("AudioContext")||Ft.hasOwnProperty("webkitAudioContext"));function Rp(n,t,e){return j(H(Yi),"AudioWorkletNode only works in a secure context (https or localhost)"),new(n instanceof Ft?.BaseAudioContext?Ft?.AudioWorkletNode:Yi)(n,t,e)}function ce(n,t,e,s){var i=arguments.length,r=i<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,s);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(i<3?o(r):i>3?o(t,e,r):o(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r}function st(n,t,e,s){function i(r){return r instanceof e?r:new e(function(o){o(r)})}return new(e||(e=Promise))(function(r,o){function a(l){try{h(s.next(l))}catch(u){o(u)}}function c(l){try{h(s.throw(l))}catch(u){o(u)}}function h(l){l.done?r(l.value):i(l.value).then(a,c)}h((s=s.apply(n,t||[])).next())})}var Fp=class{constructor(n,t,e,s){this._callback=n,this._type=t,this._minimumUpdateInterval=Math.max(128/(s||44100),.001),this.updateInterval=e,this._createClock()}_createWorker(){const n=new Blob([` 5 // the initial timeout time 6 let timeoutTime = ${(this._updateInterval*1e3).toFixed(1)}; 7 // onmessage callback 8 self.onmessage = function(msg){ 9 timeoutTime = parseInt(msg.data); 10 }; 11 // the tick function which posts a message 12 // and schedules a new tick 13 function tick(){ 14 setTimeout(tick, timeoutTime); 15 self.postMessage('tick'); 16 } 17 // call tick initially 18 tick(); 19 `],{type:"text/javascript"}),t=URL.createObjectURL(n),e=new Worker(t);e.onmessage=this._callback.bind(this),this._worker=e}_createTimeout(){this._timeout=setTimeout(()=>{this._createTimeout(),this._callback()},this._updateInterval*1e3)}_createClock(){if(this._type==="worker")try{this._createWorker()}catch{this._type="timeout",this._createClock()}else this._type==="timeout"&&this._createTimeout()}_disposeClock(){this._timeout&&clearTimeout(this._timeout),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(n){var t;this._updateInterval=Math.max(n,this._minimumUpdateInterval),this._type==="worker"&&((t=this._worker)===null||t===void 0||t.postMessage(this._updateInterval*1e3))}get type(){return this._type}set type(n){this._disposeClock(),this._type=n,this._createClock()}dispose(){this._disposeClock()}};function qe(n){return kp(n)}function De(n){return Sp(n)}function Is(n){return Cp(n)}function Ge(n){return Tp(n)}function Ip(n){return n instanceof Vr}function qp(n,t){return n==="value"||qe(t)||De(t)||Ip(t)}function $t(n,...t){if(!t.length)return n;const e=t.shift();if(we(n)&&we(e))for(const s in e)qp(s,e[s])?n[s]=e[s]:we(e[s])?(n[s]||Object.assign(n,{[s]:{}}),$t(n[s],e[s])):Object.assign(n,{[s]:e[s]});return $t(n,...t)}function Vp(n,t){return n.length===t.length&&n.every((e,s)=>t[s]===e)}function b(n,t,e=[],s){const i={},r=Array.from(t);if(we(r[0])&&s&&!Reflect.has(r[0],s)&&(Object.keys(r[0]).some(o=>Reflect.has(n,o))||($t(i,{[s]:r[0]}),e.splice(e.indexOf(s),1),r.shift())),r.length===1&&we(r[0]))$t(i,r[0]);else for(let o=0;o<e.length;o++)H(r[o])&&(i[e[o]]=r[o]);return $t(n,i)}function Pp(n){return n.constructor.getDefaults()}function Yt(n,t){return Wt(n)?t:n}
19function St(n,t){return t.forEach(e=>{Reflect.has(n,e)&&delete n[e]}),n}var xe=class{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...n){(this.debug||Ft&&this.toString()===Ft.TONE_DEBUG_CLASS)&&Hr(this,...n)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}};xe.version=jn;var hi=1e-6;function Ye(n,t){return n>t+hi}function On(n,t){return Ye(n,t)||Kt(n,t)}function $s(n,t){return n+hi<t}function Kt(n,t){return Math.abs(n-t)<hi}function je(n,t,e){return Math.max(Math.min(n,e),t)}var ee=class Jr extends xe{constructor(){super(),this.name="Timeline",this._timeline=[];const t=b(Jr.getDefaults(),arguments,["memory"]);this.memory=t.memory,this.increasing=t.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(t){if(j(Reflect.has(t,"time"),"Timeline: events must have a time attribute"),t.time=t.time.valueOf(),this.increasing&&this.length){const e=this._timeline[this.length-1];j(On(t.time,e.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(t)}else{const e=this._search(t.time);this._timeline.splice(e+1,0,t)}if(this.length>this.memory){const e=this.length-this.memory;this._timeline.splice(0,e)}return this}remove(t){const e=this._timeline.indexOf(t);return e!==-1&&this._timeline.splice(e,1),this}get(t,e="time"){const s=this._search(t,e);return s!==-1?this._timeline[s]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(t,e="time"){const s=this._search(t,e);return s+1<this._timeline.length?this._timeline[s+1]:null}getBefore(t){const e=this._timeline.length;if(e>0&&this._timeline[e-1].time<t)return this._timeline[e-1];const s=this._search(t);return s-1>=0?this._timeline[s-1]:null}cancel(t){if(this._timeline.length>1){let e=this._search(t);if(e>=0)if(Kt(this._timeline[e].time,t)){for(let s=e;s>=0&&Kt(this._timeline[s].time,t);s--)e=s;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else this._timeline.length===1&&On(this._timeline[0].time,t)&&(this._timeline=[]);return this}cancelBefore(t){const e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this}previousEvent(t){const e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null}_search(t,e="time"){if(this._timeline.length===0)return-1;let s=0;const i=this._timeline.length;let r=i;if(i>0&&this._timeline[i-1][e]<=t)return i-1;for(;s<r;){let o=Math.floor(s+(r-s)/2);const a=this._timeline[o],c=this._timeline[o+1];if(Kt(a[e],t)){for(let h=o;h<this._timeline.length;h++){const l=this._timeline[h];if(Kt(l[e],t))o=h;else break}return o}else{if($s(a[e],t)&&Ye(c[e],t))return o;Ye(a[e],t)?r=o:s=o+1}}return-1}_iterate(t,e=0,s=this._timeline.length-1){this._timeline.slice(e,s+1).forEach(t)}forEach(t){return this._iterate(t),this}forEachBefore(t,e){const s=this._search(t);return s!==-1&&this._iterate(e,0,s),this}forEachAfter(t,e){const s=this._search(t);return this._iterate(e,s+1),this}forEachBetween(t,e,s){let i=this._search(t),r=this._search(e);return i!==-1&&r!==-1?(this._timeline[i].time!==t&&(i+=1),this._timeline[r].time===e&&(r-=1),this._iterate(s,i,r)):i===-1&&this._iterate(s,0,r),this}forEachFrom(t,e){let s=this._search(t);for(;s>=0&&this._timeline[s].time>=t;)s--;return this._iterate(e,s+1),this}forEachAtTime(t,e){const s=this._search(t);if(s!==-1&&Kt(this._timeline[s].time,t)){let i=s;for(let r=s;r>=0&&Kt(this._timeline[r].time,t);r--)i=r;this._iterate(r=>{e(r)},i,s)}return this}dispose(){return super.dispose(),this._timeline=[],this}},Kr=[];function on(n){Kr.push(n)}function Lp(n){Kr.forEach(t=>t(n))}var to=[];function an(n){to.push(n)}function Wp(n){to.forEach(t=>t(n))}var cn=class eo extends xe{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach(s=>{Wt(this._events)&&(this._events={}),this._events.hasOwnProperty(s)||(this._events[s]=[]),this._events[s].push(e)}),this}once(t,e){const s=(...i)=>{e(...i),this.off(t,s)};return this.on(t,s),this}
19off(t,e){return t.split(/\W+/).forEach(s=>{if(Wt(this._events)&&(this._events={}),this._events.hasOwnProperty(s))if(Wt(e))this._events[s]=[];else{const i=this._events[s];for(let r=i.length-1;r>=0;r--)i[r]===e&&i.splice(r,1)}}),this}emit(t,...e){if(this._events&&this._events.hasOwnProperty(t)){const s=this._events[t].slice(0);for(let i=0,r=s.length;i<r;i++)s[i].apply(this,e)}return this}static mixin(t){["on","once","off","emit"].forEach(e=>{const s=Object.getOwnPropertyDescriptor(eo.prototype,e);Object.defineProperty(t.prototype,e,s)})}dispose(){return super.dispose(),this._events=void 0,this}},li=class extends cn{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}},hn=class so extends li{constructor(){var t,e;super(),this.name="Context",this._constants=new Map,this._timeouts=new ee,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;const s=b(so.getDefaults(),arguments,["context"]);s.context?(this._context=s.context,this._latencyHint=((t=arguments[0])===null||t===void 0?void 0:t.latencyHint)||""):(this._context=Mp({latencyHint:s.latencyHint}),this._latencyHint=s.latencyHint),this._ticker=new Fp(this.emit.bind(this,"tick"),s.clockSource,s.updateInterval,this._context.sampleRate),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this[!((e=arguments[0])===null||e===void 0)&&e.hasOwnProperty("updateInterval")?"_lookAhead":"lookAhead"]=s.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){return this._initialized||(Lp(this),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(t,e,s){return this._context.createBuffer(t,e,s)}createChannelMerger(t){return this._context.createChannelMerger(t)}createChannelSplitter(t){return this._context.createChannelSplitter(t)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(t){return this._context.createDelay(t)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(t,e){return this._context.createIIRFilter(t,e)}createPanner(){return this._context.createPanner()}createPeriodicWave(t,e,s){return this._context.createPeriodicWave(t,e,s)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(t){return j(Ge(this._context),"Not available if OfflineAudioContext"),this._context.createMediaStreamSource(t)}createMediaElementSource(t){return j(Ge(this._context),"Not available if OfflineAudioContext"),this._context.createMediaElementSource(t)}createMediaStreamDestination(){return j(Ge(this._context),"Not available if OfflineAudioContext"),this._context.createMediaStreamDestination()}decodeAudioData(t){return this._context.decodeAudioData(t)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(t){j(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){j(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){j(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){j(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return Rp(this.rawContext,t,e)}addAudioWorkletModule(t){return st(this,void 0,void 0,function*(){j(H(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletPromise||(this._workletPromise=this.rawContext.audioWorklet.addModule(t)),yield this._workletPromise})}workletsAreReady(){return st(this,void 0,void 0,function*(){(yield this._workletPromise)?this._workletPromise:Promise.resolve()})}get updateInterval(){return this._ticker.updateInterval}set updateInterval(t){this._ticker.updateInterval=t}get clockSource(){return this._ticker.type}set clockSource(t){this._ticker.type=t}get lookAhead(){return this._lookAhead}set lookAhead(t){this._lookAhead=t,this.updateInterval=t?t/2:.01}get latencyHint(){return this._latencyHint}get rawContext(){return this._context}now(){return this._context.currentTime+this._lookAhead}immediate(){return this._context.currentTime}resume(){return Ge(this._context)?this._context.resume():Promise.resolve()}close(){return st(this,void 0,void 0,function*(){Ge(this._context)&&this.state!=="closed"&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&Wp(this)})}getConstant(t){if(this._constants.has(t))return this._constants.get(t);{const e=this._context.createBuffer(1,128,this._context.sampleRate),s=e.getChannelData(0);for(let r=0;r<s.length;r++)s[r]=t;const i=this._context.createBufferSource();return i.channelCount=1,i.channelCountMode="explicit",i.buffer=e,i.loop=!0,i.start(0),this._constants.set(t,i),i}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map(t=>this._constants[t].disconnect()),this.close(),this}_timeoutLoop(){const t=this.now();
19this._timeouts.forEachBefore(t,e=>{e.callback(),this._timeouts.remove(e)})}setTimeout(t,e){this._timeoutIds++;const s=this.now();return this._timeouts.add({callback:t,id:this._timeoutIds,time:s+e}),this._timeoutIds}clearTimeout(t){return this._timeouts.forEach(e=>{e.id===t&&this._timeouts.remove(e)}),this}clearInterval(t){return this.clearTimeout(t)}setInterval(t,e){const s=++this._timeoutIds,i=()=>{const r=this.now();this._timeouts.add({callback:()=>{t(),i()},id:s,time:r+e})};return i(),s}},jp=class extends li{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(n,t,e){return{}}createChannelMerger(n){return{}}createChannelSplitter(n){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(n){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(n,t){return{}}createPanner(){return{}}createPeriodicWave(n,t,e){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(n){return{}}createMediaElementSource(n){return{}}createMediaStreamDestination(){return{}}decodeAudioData(n){return Promise.resolve({})}createAudioWorkletNode(n,t){return{}}get rawContext(){return{}}addAudioWorkletModule(n){return st(this,void 0,void 0,function*(){return Promise.resolve()})}resume(){return Promise.resolve()}setTimeout(n,t){return 0}clearTimeout(n){return this}setInterval(n,t){return 0}clearInterval(n){return this}getConstant(n){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(n){}get destination(){return{}}set destination(n){}now(){return 0}immediate(){return 0}};function G(n,t){kt(t)?t.forEach(e=>G(n,e)):Object.defineProperty(n,t,{enumerable:!0,writable:!1})}function Cs(n,t){kt(t)?t.forEach(e=>Cs(n,e)):Object.defineProperty(n,t,{writable:!0})}var J=()=>{},Ct=class Ot extends xe{constructor(){super(),this.name="ToneAudioBuffer",this.onload=J;const t=b(Ot.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,re(t.url)?this.load(t.url).catch(t.onerror):t.url&&this.set(t.url)}static getDefaults(){return{onerror:J,onload:J,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:rt().sampleRate}set(t){return t instanceof Ot?t.loaded?this._buffer=t.get():t.onload=()=>{this.set(t),this.onload(this)}:this._buffer=t,this._reversed&&this._reverse(),this}get(){return this._buffer}load(t){return st(this,void 0,void 0,function*(){const e=Ot.load(t).then(s=>{this.set(s),this.onload(this)});Ot.downloads.push(e);try{yield e}finally{const s=Ot.downloads.indexOf(e);Ot.downloads.splice(s,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=kt(t)&&t[0].length>0,s=e?t.length:1,i=e?t[0].length:t.length,r=rt(),o=r.createBuffer(s,i,r.sampleRate),a=!e&&s===1?[t]:t;for(let c=0;c<s;c++)o.copyToChannel(a[c],c);return this._buffer=o,this}toMono(t){if(Gt(t))this.fromArray(this.toArray(t));else{let e=new Float32Array(this.length);const s=this.numberOfChannels;for(let i=0;i<s;i++){const r=this.toArray(i);for(let o=0;o<r.length;o++)e[o]+=r[o]}e=e.map(i=>i/s),this.fromArray(e)}return this}toArray(t){if(Gt(t))return this.getChannelData(t);if(this.numberOfChannels===1)return this.toArray(0);{const e=[];for(let s=0;s<this.numberOfChannels;s++)e[s]=this.getChannelData(s);return e}}getChannelData(t){return this._buffer?this._buffer.getChannelData(t):new Float32Array(0)}slice(t,e=this.duration){j(this.loaded,"Buffer is not loaded");const s=Math.floor(t*this.sampleRate),i=Math.floor(e*this.sampleRate);j(s<i,"The start time must be less than the end time");const r=i-s,o=rt().createBuffer(this.numberOfChannels,r,this.sampleRate);for(let a=0;a<this.numberOfChannels;a++)o.copyToChannel(this.getChannelData(a).subarray(s,i),a);return new Ot(o)}_reverse(){if(this.loaded)for(let t=0;t<this.numberOfChannels;t++)this.getChannelData(t).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(t){this._reversed!==t&&(this._reversed=t,this._reverse())}static fromArray(t){return new Ot().fromArray(t)}static fromUrl(t){return st(this,void 0,void 0,function*(){return yield new Ot().load(t)})}static load(t){return st(this,void 0,void 0,function*(){const e=Ot.baseUrl===""||Ot.baseUrl.endsWith("/")?Ot.baseUrl:Ot.baseUrl+"/",s=yield fetch(e+t);if(!s.ok)throw new Error(`could not load url: ${t}`);const i=yield s.arrayBuffer();return yield rt().decodeAudioData(i)})}
19static supportsType(t){const e=t.split("."),s=e[e.length-1];return document.createElement("audio").canPlayType("audio/"+s)!==""}static loaded(){return st(this,void 0,void 0,function*(){for(yield Promise.resolve();Ot.downloads.length;)yield Ot.downloads[0]})}};Ct.baseUrl="";Ct.downloads=[];var cs=class extends hn{constructor(){super({clockSource:"offline",context:Is(arguments[0])?arguments[0]:Ep(arguments[0],arguments[1]*arguments[2],arguments[2]),lookAhead:0,updateInterval:Is(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=Is(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(n){return st(this,void 0,void 0,function*(){let t=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,t++;const e=Math.floor(this.sampleRate/128);n&&t%e===0&&(yield new Promise(s=>setTimeout(s,1)))}})}render(){return st(this,arguments,void 0,function*(n=!0){return yield this.workletsAreReady(),yield this._renderClock(n),new Ct(yield this._context.startRendering())})}close(){return Promise.resolve()}},no=new jp,Ne=no;function rt(){return Ne===no&&Np&&Ys(new hn),Ne}function Ys(n,t=!1){t&&Ne.dispose(),Ge(n)?Ne=new hn(n):Is(n)?Ne=new cs(n):Ne=n}function Bp(){return Ne.resume()}if(Ft&&!Ft.TONE_SILENCE_LOGGING){const t=` * Tone.js v${jn} * `;console.log(`%c${t}`,"background: #000; color: #fff")}function He(n){return Math.pow(10,n/20)}function As(n){return 20*(Math.log(n)/Math.LN10)}function Je(n){return Math.pow(2,n/12)}var ln=440;function zp(){return ln}function Up(n){ln=n}function Ce(n){return Math.round(io(n))}function io(n){return 69+12*Math.log2(n/ln)}function ui(n){return ln*Math.pow(2,(n-69)/12)}var Gp=class ro extends xe{constructor(t,e,s){super(),this.defaultUnits="s",this._val=e,this._units=s,this.context=t,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:t=>this._frequencyToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:t=>this._ticksToUnits(parseInt(t,10)),regexp:/^(\d+)i$/i},m:{method:t=>this._beatsToUnits(parseInt(t,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(t,e)=>{const s=parseInt(t,10),i=e==="."?1.5:1;return s===1?this._beatsToUnits(this._getTimeSignature())*i:this._beatsToUnits(4/s)*i},regexp:/^(\d+)n(\.?)$/i},number:{method:t=>this._expressions[this.defaultUnits].method.call(this,t),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:t=>this._secondsToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:t=>parseInt(t,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:t=>{const e=parseInt(t,10);return this._beatsToUnits(8/(Math.floor(e)*3))},regexp:/^(\d+)t$/i},tr:{method:(t,e,s)=>{let i=0;return t&&t!=="0"&&(i+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&e!=="0"&&(i+=this._beatsToUnits(parseFloat(e))),s&&s!=="0"&&(i+=this._beatsToUnits(parseFloat(s)/4)),i},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof ro&&this.fromType(this._val),Wt(this._val))return this._noArg();if(re(this._val)&&Wt(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(we(this._val)){let t=0;for(const e in this._val)if(H(this._val[e])){const s=this._val[e],i=new this.constructor(this.context,e).valueOf()*s;t+=i}return t}if(H(this._units)){const t=this._expressions[this._units],e=this._val.toString().trim().match(t.regexp);return e?t.method.apply(this,e.slice(1)):t.method.call(this,this._val)}else return re(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(t){return 1/t}_beatsToUnits(t){return 60/this._getBpm()*t}_secondsToUnits(t){return t}_ticksToUnits(t){return t*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(t){switch(this._units=void 0,this.defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi();break}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return this.toSeconds()*1e3}},ge=class qs extends Gp{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:t=>this._now()+new this.constructor(this.context,t).valueOf(),regexp:/^\+(.+)/},quantize:{method:t=>{const e=new qs(this.context,t).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(e))},regexp:/^@(.+)/}})}quantize(t,e=1){const s=new this.constructor(this.context,t).valueOf(),i=this.valueOf();return i+(Math.round(i/s)*s-i)*e}toNotation(){const t=this.toSeconds(),e=["1m"];for(let r=1;r<9;r++){const o=Math.pow(2,r);e.push(o+"n."),e.push(o+"n"),e.push(o+"t")}e.push("0");let s=e[0],i=new qs(this.context,e[0]).toSeconds();return e.forEach(r=>{const o=new qs(this.context,r).toSeconds();Math.abs(o-t)<Math.abs(i-t)&&(s=r,i=o)}),s}toBarsBeatsSixteenths(){const t=this._beatsToUnits(1);let e=this.valueOf()/t;e=parseFloat(e.toFixed(4));const s=Math.floor(e/this._getTimeSignature());let i=e%1*4;e=Math.floor(e)%this._getTimeSignature();const r=i.toString();return r.length>3&&(i=parseFloat(parseFloat(r).toFixed(3))),[s,e,i].join(":")}toTicks(){const t=this._beatsToUnits(1);return this.valueOf()/t*this._getPPQ()}toSeconds(){return this.valueOf()}toMidi(){return Ce(this.toFrequency())}_now(){return this.context.now()}};function Zp(n,t){return new ge(rt(),n,t)}var he=class fs extends ge{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return zp()}static set A4(t){Up(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return this.defaultUnits==="midi"?t:fs.mtof(t)}
19},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(t,e){const s=Qp[t.toLowerCase()]+(parseInt(e,10)+1)*12;return this.defaultUnits==="midi"?s:fs.mtof(s)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(t,e,s){let i=1;return t&&t!=="0"&&(i*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&e!=="0"&&(i*=this._beatsToUnits(parseFloat(e))),s&&s!=="0"&&(i*=this._beatsToUnits(parseFloat(s)/4)),i}}})}transpose(t){return new fs(this.context,this.valueOf()*Je(t))}harmonize(t){return t.map(e=>this.transpose(e))}toMidi(){return Ce(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/fs.A4);let s=Math.round(12*e)+57;const i=Math.floor(s/12);return i<0&&(s+=-12*i),Xp[s%12]+i.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.floor(e*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(t){return t}_ticksToUnits(t){return 1/(t*60/(this._getBpm()*this._getPPQ()))}_beatsToUnits(t){return 1/super._beatsToUnits(t)}_secondsToUnits(t){return 1/t}static mtof(t){return ui(t)}static ftom(t){return Ce(t)}},Qp={cbbb:-3,cbb:-2,cb:-1,c:0,"c#":1,cx:2,"c##":2,"c###":3,"cx#":3,"c#x":3,dbbb:-1,dbb:0,db:1,d:2,"d#":3,dx:4,"d##":4,"d###":5,"dx#":5,"d#x":5,ebbb:1,ebb:2,eb:3,e:4,"e#":5,ex:6,"e##":6,"e###":7,"ex#":7,"e#x":7,fbbb:2,fbb:3,fb:4,f:5,"f#":6,fx:7,"f##":7,"f###":8,"fx#":8,"f#x":8,gbbb:4,gbb:5,gb:6,g:7,"g#":8,gx:9,"g##":9,"g###":10,"gx#":10,"g#x":10,abbb:6,abb:7,ab:8,a:9,"a#":10,ax:11,"a##":11,"a###":12,"ax#":12,"a#x":12,bbbb:8,bbb:9,bb:10,b:11,"b#":12,bx:13,"b##":13,"b###":14,"bx#":14,"b#x":14},Xp=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];function $p(n,t){return new he(rt(),n,t)}var _t=class extends ge{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}};function Yp(n,t){return new _t(rt(),n,t)}var Bt=class Vs extends xe{constructor(){super();const t=b(Vs.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:rt()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(t){return Yr(t),new ge(this.context,t).toSeconds()}toFrequency(t){return new he(this.context,t).toFrequency()}toTicks(t){return new _t(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach(s=>{Wt(t[s])&&delete e[s]}),e}get(){const t=Pp(this);return Object.keys(t).forEach(e=>{if(Reflect.has(this,e)){const s=this[e];H(s)&&H(s.value)&&H(s.setValueAtTime)?t[e]=s.value:s instanceof Vs?t[e]=s._getPartialProperties(t[e]):kt(s)||Gt(s)||re(s)||oi(s)?t[e]=s:delete t[e]}}),t}set(t){return Object.keys(t).forEach(e=>{Reflect.has(this,e)&&H(this[e])&&(this[e]&&H(this[e].value)&&H(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Vs?this[e].set(t[e]):this[e]=t[e])}),this}},hs=class extends ee{constructor(n="stopped"){super(),this.name="StateTimeline",this._initial=n,this.setStateAtTime(this._initial,0)}getValueAtTime(n){const t=this.get(n);return t!==null?t.state:this._initial}setStateAtTime(n,t,e){return yt(t,0),this.add(Object.assign({},e,{state:n,time:t})),this}getLastState(n,t){const e=this._search(t);for(let s=e;s>=0;s--){const i=this._timeline[s];if(i.state===n)return i}}getNextState(n,t){const e=this._search(t);if(e!==-1)for(let s=e;s<this._timeline.length;s++){const i=this._timeline[s];if(i.state===n)return i}}},$=class Mn extends Bt{constructor(){const t=b(Mn.getDefaults(),arguments,["param","units","convert"]);for(super(t),this.name="Param",this.overridden=!1,this._minOutput=1e-7,j(H(t.param)&&(qe(t.param)||t.param instanceof Mn),"param must be an AudioParam");!qe(t.param);)t.param=t.param._param;this._swappable=H(t.swappable)?t.swappable:!1,this._swappable?(this.input=this.context.createGain(),this._param=t.param,this.input.connect(this._param)):this._param=this.input=t.param,this._events=new ee(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,H(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Bt.getDefaults(),{convert:!0,units:"number"})}get value(){const t=this.now();return this.getValueAtTime(t)}set value(t){this.cancelScheduledValues(this.now()),this.setValueAtTime(t,this.now())}get minValue(){return H(this._minValue)?this._minValue:this.units==="time"||this.units==="frequency"||this.units==="normalRange"||this.units==="positive"||this.units==="transportTime"||this.units==="ticks"||this.units==="bpm"||this.units==="hertz"||this.units==="samples"?0:this.units==="audioRange"?-1:this.units==="decibels"?-1/0:this._param.minValue}get maxValue(){return H(this._maxValue)?this._maxValue:this.units==="normalRange"||this.units==="audioRange"?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return H(this.maxValue)&&H(this.minValue)&&yt(t,this._fromType(this.minValue),this._fromType(this.maxValue)),t}_fromType(t){return this.convert&&!this.overridden?this._is(t,"time")?this.toSeconds(t):this._is(t,"decibels")?He(t):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t}_toType(t){return this.convert&&this.units==="decibels"?As(t):t}setValueAtTime(t,e){const s=this.toSeconds(e),i=this._fromType(t);return j(isFinite(i)&&isFinite(s),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(i),this.log(this.units,"setValueAtTime",t,s
19),this._events.add({time:s,type:"setValueAtTime",value:i}),this._param.setValueAtTime(i,s),this}getValueAtTime(t){const e=Math.max(this.toSeconds(t),0),s=this._events.getAfter(e),i=this._events.get(e);let r=this._initialValue;if(i===null)r=this._initialValue;else if(i.type==="setTargetAtTime"&&(s===null||s.type==="setValueAtTime")){const o=this._events.getBefore(i.time);let a;o===null?a=this._initialValue:a=o.value,i.type==="setTargetAtTime"&&(r=this._exponentialApproach(i.time,a,i.value,i.constant,e))}else if(s===null)r=i.value;else if(s.type==="linearRampToValueAtTime"||s.type==="exponentialRampToValueAtTime"){let o=i.value;if(i.type==="setTargetAtTime"){const a=this._events.getBefore(i.time);a===null?o=this._initialValue:o=a.value}s.type==="linearRampToValueAtTime"?r=this._linearInterpolate(i.time,o,s.time,s.value,e):r=this._exponentialInterpolate(i.time,o,s.time,s.value,e)}else r=i.value;return this._toType(r)}setRampPoint(t){t=this.toSeconds(t);let e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),this._fromType(e)===0&&(e=this._toType(this._minOutput)),this.setValueAtTime(e,t),this}linearRampToValueAtTime(t,e){const s=this._fromType(t),i=this.toSeconds(e);return j(isFinite(s)&&isFinite(i),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(s),this._events.add({time:i,type:"linearRampToValueAtTime",value:s}),this.log(this.units,"linearRampToValueAtTime",t,i),this._param.linearRampToValueAtTime(s,i),this}exponentialRampToValueAtTime(t,e){let s=this._fromType(t);s=Kt(s,0)?this._minOutput:s,this._assertRange(s);const i=this.toSeconds(e);return j(isFinite(s)&&isFinite(i),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({time:i,type:"exponentialRampToValueAtTime",value:s}),this.log(this.units,"exponentialRampToValueAtTime",t,i),this._param.exponentialRampToValueAtTime(s,i),this}exponentialRampTo(t,e,s){return s=this.toSeconds(s),this.setRampPoint(s),this.exponentialRampToValueAtTime(t,s+this.toSeconds(e)),this}linearRampTo(t,e,s){return s=this.toSeconds(s),this.setRampPoint(s),this.linearRampToValueAtTime(t,s+this.toSeconds(e)),this}targetRampTo(t,e,s){return s=this.toSeconds(s),this.setRampPoint(s),this.exponentialApproachValueAtTime(t,s,e),this}exponentialApproachValueAtTime(t,e,s){e=this.toSeconds(e),s=this.toSeconds(s);const i=Math.log(s+1)/Math.log(200);return this.setTargetAtTime(t,e,i),this.cancelAndHoldAtTime(e+s*.9),this.linearRampToValueAtTime(t,e+s),this}setTargetAtTime(t,e,s){const i=this._fromType(t);j(isFinite(s)&&s>0,"timeConstant must be a number greater than 0");const r=this.toSeconds(e);return this._assertRange(i),j(isFinite(i)&&isFinite(r),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({constant:s,time:r,type:"setTargetAtTime",value:i}),this.log(this.units,"setTargetAtTime",t,r,s),this._param.setTargetAtTime(i,r,s),this}setValueCurveAtTime(t,e,s,i=1){s=this.toSeconds(s),e=this.toSeconds(e);const r=this._fromType(t[0])*i;this.setValueAtTime(this._toType(r),e);const o=s/(t.length-1);for(let a=1;a<t.length;a++){const c=this._fromType(t[a])*i;this.linearRampToValueAtTime(this._toType(c),e+a*o)}return this}cancelScheduledValues(t){const e=this.toSeconds(t);return j(isFinite(e),`Invalid argument to cancelScheduledValues: ${JSON.stringify(t)}`),this._events.cancel(e),this._param.cancelScheduledValues(e),this.log(this.units,"cancelScheduledValues",e),this}cancelAndHoldAtTime(t){const e=this.toSeconds(t),s=this._fromType(this.getValueAtTime(e));j(isFinite(e),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(t)}`),this.log(this.units,"cancelAndHoldAtTime",e,"value="+s);const i=this._events.get(e),r=this._events.getAfter(e);return i&&Kt(i.time,e)?r?(this._param.cancelScheduledValues(r.time),this._events.cancel(r.time)):(this._param.cancelAndHoldAtTime(e),this._events.cancel(e+this.sampleTime)):r&&(this._param.cancelScheduledValues(r.time),this._events.cancel(r.time),r.type==="linearRampToValueAtTime"?this.linearRampToValueAtTime(this._toType(s),e):r.type==="exponentialRampToValueAtTime"&&this.exponentialRampToValueAtTime(this._toType(s),e)),this._events.add({time:e,type:"setValueAtTime",value:s}),this._param.setValueAtTime(s,e),this}rampTo(t,e=.1,s){return this.units==="frequency"||this.units==="bpm"||this.units==="decibels"?this.exponentialRampTo(t,e,s):this.linearRampTo(t,e,s),this}apply(t){const e=this.context.currentTime;t.setValueAtTime(this.getValueAtTime(e),e);const s=this._events.get(e);if(s&&s.type==="setTargetAtTime"){const i=this._events.getAfter(s.time),r=i?i.time:e+2,o=(r-e)/10;for(let a=e;a<r;a+=o)t.linearRampToValueAtTime(this.getValueAtTime(a),a)}
19return this._events.forEachAfter(this.context.currentTime,i=>{i.type==="cancelScheduledValues"?t.cancelScheduledValues(i.time):i.type==="setTargetAtTime"?t.setTargetAtTime(i.value,i.time,i.constant):t[i.type](i.value,i.time)}),this}setParam(t){j(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const e=this.input;return e.disconnect(this._param),this.apply(t),this._param=t,e.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(t,e,s,i,r){return s+(e-s)*Math.exp(-(r-t)/i)}_linearInterpolate(t,e,s,i,r){return e+(i-e)*((r-t)/(s-t))}_exponentialInterpolate(t,e,s,i,r){return e*Math.pow(i/e,(r-t)/(s-t))}},M=class Ps extends Bt{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return H(this.input)?qe(this.input)||this.input instanceof $?1:this.input.numberOfInputs:0}get numberOfOutputs(){return H(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return H(t)&&(t instanceof Ps||De(t))}_getInternalNodes(){const t=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&t.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&t.push(this.output),t}_setChannelProperties(t){this._getInternalNodes().forEach(e=>{e.channelCount=t.channelCount,e.channelCountMode=t.channelCountMode,e.channelInterpretation=t.channelInterpretation})}_getChannelProperties(){const t=this._getInternalNodes();j(t.length>0,"ToneAudioNode does not have any internal nodes");const e=t[0];return{channelCount:e.channelCount,channelCountMode:e.channelCountMode,channelInterpretation:e.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCount:t}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCountMode:t}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelInterpretation:t}))}connect(t,e=0,s=0){return Vt(this,t,e,s),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return as("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,s=0){return di(this,t,e,s),this}chain(...t){return Zt(this,...t),this}fan(...t){return t.forEach(e=>this.connect(e)),this}dispose(){return super.dispose(),H(this.input)&&(this.input instanceof Ps?this.input.dispose():De(this.input)&&this.input.disconnect()),H(this.output)&&(this.output instanceof Ps?this.output.dispose():De(this.output)&&this.output.disconnect()),this._internalChannels=[],this}};function Zt(...n){const t=n.shift();n.reduce((e,s)=>(e instanceof M?e.connect(s):De(e)&&Vt(e,s),s),t)}function Vt(n,t,e=0,s=0){for(j(H(n),"Cannot connect from undefined node"),j(H(t),"Cannot connect to undefined node"),(t instanceof M||De(t))&&j(t.numberOfInputs>0,"Cannot connect to node with no inputs"),j(n.numberOfOutputs>0,"Cannot connect from node with no outputs");t instanceof M||t instanceof $;)H(t.input)&&(t=t.input);for(;n instanceof M;)H(n.output)&&(n=n.output);qe(t)?n.connect(t,e):n.connect(t,e,s)}function di(n,t,e=0,s=0){if(H(t))for(;t instanceof M;)t=t.input;for(;!De(n);)H(n.output)&&(n=n.output);qe(t)?n.disconnect(t,e):De(t)?n.disconnect(t,e,s):n.disconnect()}function Hp(...n){const t=n.pop();H(t)&&n.forEach(e=>Vt(e,t))}var B=class oo extends M{constructor(){const t=b(oo.getDefaults(),arguments,["gain","units"]);super(t),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode,this.gain=new $({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),G(this,"gain")}static getDefaults(){return Object.assign(M.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}},Ke=class extends M{constructor(n){super(n),this.onended=J,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new B({context:this.context,gain:0}
19),this._gainNode=this.output,this.getStateAtTime=function(t){const e=this.toSeconds(t);return this._startTime!==-1&&e>=this._startTime&&(this._stopTime===-1||e<=this._stopTime)?"started":"stopped"},this._fadeIn=n.fadeIn,this._fadeOut=n.fadeOut,this._curve=n.curve,this.onended=n.onended}static getDefaults(){return Object.assign(M.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:J})}_startGain(n,t=1){j(this._startTime===-1,"Source cannot be started more than once");const e=this.toSeconds(this._fadeIn);return this._startTime=n+e,this._startTime=Math.max(this._startTime,this.context.currentTime),e>0?(this._gainNode.gain.setValueAtTime(0,n),this._curve==="linear"?this._gainNode.gain.linearRampToValueAtTime(t,n+e):this._gainNode.gain.exponentialApproachValueAtTime(t,n,e)):this._gainNode.gain.setValueAtTime(t,n),this}stop(n){return this.log("stop",n),this._stopGain(this.toSeconds(n)),this}_stopGain(n){j(this._startTime!==-1,"'start' must be called before 'stop'"),this.cancelStop();const t=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(n)+t,this._stopTime=Math.max(this._stopTime,this.now()),t>0?this._curve==="linear"?this._gainNode.gain.linearRampTo(0,t,n):this._gainNode.gain.targetRampTo(0,t,n):(this._gainNode.gain.cancelAndHoldAtTime(n),this._gainNode.gain.setValueAtTime(0,n)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(()=>{const e=this._curve==="exponential"?t*2:0;this._stopSource(this.now()+e),this._onended()},this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==J&&(this.onended(this),this.onended=J,!this.context.isOffline)){const n=()=>this.dispose();typeof requestIdleCallback<"u"?requestIdleCallback(n):setTimeout(n,10)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),j(this._startTime!==-1,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}
19dispose(){return super.dispose(),this._gainNode.dispose(),this.onended=J,this}},ao=class co extends Ke{constructor(){const t=b(co.getDefaults(),arguments,["offset"]);super(t),this.name="ToneConstantSource",this._source=this.context.createConstantSource(),Vt(this._source,this._gainNode),this.offset=new $({context:this.context,convert:t.convert,param:this._source.offset,units:t.units,value:t.offset,minValue:t.minValue,maxValue:t.maxValue})}static getDefaults(){return Object.assign(Ke.getDefaults(),{convert:!0,offset:1,units:"number"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._source.start(e),this}_stopSource(t){this._source.stop(t)}dispose(){return super.dispose(),this.state==="started"&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}},Z=class ho extends M{constructor(){const t=b(ho.getDefaults(),arguments,["value","units"]);super(t),this.name="Signal",this.override=!0,this.output=this._constantSource=new ao({context:this.context,convert:t.convert,offset:t.value,units:t.units,minValue:t.minValue,maxValue:t.maxValue}),this._constantSource.start(0),this.input=this._param=this._constantSource.offset}static getDefaults(){return Object.assign(M.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,s=0){return Ds(this,t,e,s),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(t,e){return this._param.setValueAtTime(t,e),this}getValueAtTime(t){return this._param.getValueAtTime(t)}setRampPoint(t){return this._param.setRampPoint(t),this}linearRampToValueAtTime(t,e){return this._param.linearRampToValueAtTime(t,e),this}exponentialRampToValueAtTime(t,e){return this._param.exponentialRampToValueAtTime(t,e),this}exponentialRampTo(t,e,s){return this._param.exponentialRampTo(t,e,s),this}linearRampTo(t,e,s){return this._param.linearRampTo(t,e,s),this}targetRampTo(t,e,s){return this._param.targetRampTo(t,e,s),this}exponentialApproachValueAtTime(t,e,s){return this._param.exponentialApproachValueAtTime(t,e,s),this}setTargetAtTime(t,e,s){return this._param.setTargetAtTime(t,e,s),this}setValueCurveAtTime(t,e,s,i){return this._param.setValueCurveAtTime(t,e,s,i),this}cancelScheduledValues(t){return this._param.cancelScheduledValues(t),this}cancelAndHoldAtTime(t){return this._param.cancelAndHoldAtTime(t),this}rampTo(t,e,s){return this._param.rampTo(t,e,s),this}get value(){return this._param.value}set value(t){this._param.value=t}get convert(){return this._param.convert}set convert(t){this._param.convert=t}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(t){this._param.overridden=t}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(t){return this._param.apply(t),this}};function Ds(n,t,e,s){(t instanceof $||qe(t)||t instanceof Z&&t.override)&&(t.cancelScheduledValues(0),t.setValueAtTime(0,0),t instanceof Z&&(t.overridden=!0)),Vt(n,t,e,s)}var Jp=class lo extends ${constructor(){const t=b(lo.getDefaults(),arguments,["value"]);super(t),this.name="TickParam",this._events=new ee(1/0),this._multiplier=1,this._multiplier=t.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(t.value)}),this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign($.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(t,e,s){e=this.toSeconds(e),this.setRampPoint(e);const i=this._fromType(t),r=this._events.get(e),o=Math.round(Math.max(1/s,1));for(let a=0;a<=o;a++){const c=s*a+e,h=this._exponentialApproach(r.time,r.value,i,s,c);this.linearRampToValueAtTime(this._toType(h),c)}return this}setValueAtTime(t,e){const s=this.toSeconds(e);super.setValueAtTime(t,e);const i=this._events.get(s),r=this._events.previousEvent(i),o=this._getTicksUntilEvent(r,s);return i.ticks=Math.max(o,0),this}linearRampToValueAtTime(t,e){const s=this.toSeconds(e);super.linearRampToValueAtTime(t,e);const i=this._events.get(s),r=this._events.previousEvent(i),o=this._getTicksUntilEvent(r,s);return i.ticks=Math.max(o,0),this}exponentialRampToValueAtTime(t,e){e=this.toSeconds(e);const s=this._fromType(t),i=this._events.get(e),r=Math.round(Math.max((e-i.time)*10,1)),o=(e-i.time)/r;for(let a=0;a<=r;a++){const c=o*a+i.time,h=this._exponentialInterpolate(i.time,i.value,e,s,c);this.linearRampToValueAtTime(this._toType(h),c)}return this}_getTicksUntilEvent(t,e){if(t===null)t={ticks:0,time:0,type:"setValueAtTime",value:0};else if(Wt(t.ticks)){const o=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(o,t.time)}const s=this._fromType(this.getValueAtTime(t.time));let i=this._fromType(this.getValueAtTime(e));const r=this._events.get(e);return r&&r.time===e&&r.type==="setValueAtTime"&&(i=this._fromType(this.getValueAtTime(e-this.sampleTime))),.5*(e-t.time)*(s+i)+t.ticks}getTicksAtTime(t){const e=this.toSeconds(t),s=this._events.get(e);return Math.max(this._getTicksUntilEvent(s,e),0)}getDurationOfTicks(t,e){const s=this.toSeconds(e),i=this.getTicksAtTime(e);return this.getTimeOfTick(i+t)-s}getTimeOfTick(t){const e=this._events.get(t,"ticks"),s=this._events.getAfter(t,"ticks");
19if(e&&e.ticks===t)return e.time;if(e&&s&&s.type==="linearRampToValueAtTime"&&e.value!==s.value){const i=this._fromType(this.getValueAtTime(e.time)),r=(this._fromType(this.getValueAtTime(s.time))-i)/(s.time-e.time),o=Math.sqrt(Math.pow(i,2)-2*r*(e.ticks-t)),a=(-i+o)/r,c=(-i-o)/r;return(a>0?a:c)+e.time}else return e?e.value===0?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue}ticksToTime(t,e){return this.getDurationOfTicks(t,e)}timeToTicks(t,e){const s=this.toSeconds(e),i=this.toSeconds(t),r=this.getTicksAtTime(s);return this.getTicksAtTime(s+i)-r}_fromType(t){return this.units==="bpm"&&this.multiplier?1/(60/t/this.multiplier):super._fromType(t)}_toType(t){return this.units==="bpm"&&this.multiplier?t/this.multiplier*60:super._toType(t)}get multiplier(){return this._multiplier}set multiplier(t){const e=this.value;this._multiplier=t,this.cancelScheduledValues(0),this.setValueAtTime(e,0)}},Kp=class uo extends Z{constructor(){const t=b(uo.getDefaults(),arguments,["value"]);super(t),this.name="TickSignal",this.input=this._param=new Jp({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(Z.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(t,e){return this._param.ticksToTime(t,e)}timeToTicks(t,e){return this._param.timeToTicks(t,e)}getTimeOfTick(t){return this._param.getTimeOfTick(t)}getDurationOfTicks(t,e){return this._param.getDurationOfTicks(t,e)}getTicksAtTime(t){return this._param.getTicksAtTime(t)}get multiplier(){return this._param.multiplier}set multiplier(t){this._param.multiplier=t}dispose(){return super.dispose(),this._param.dispose(),this}},tf=class po extends Bt{constructor(){const t=b(po.getDefaults(),arguments,["frequency"]);super(t),this.name="TickSource",this._state=new hs,this._tickOffset=new ee,this._ticksAtTime=new ee,this._secondsAtTime=new ee,this.frequency=new Kp({context:this.context,units:t.units,value:t.frequency}),G(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Bt.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(t,e){const s=this.toSeconds(t);return this._state.getValueAtTime(s)!=="started"&&(this._state.setStateAtTime("started",s),H(e)&&this.setTicksAtTime(e,s),this._ticksAtTime.cancel(s),this._secondsAtTime.cancel(s)),this}stop(t){const e=this.toSeconds(t);if(this._state.getValueAtTime(e)==="stopped"){const s=this._state.get(e);s&&s.time>0&&(this._tickOffset.cancel(s.time),this._state.cancel(s.time))}return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this.setTicksAtTime(0,e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}pause(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)==="started"&&(this._state.setStateAtTime("paused",e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e)),this}cancel(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this._ticksAtTime.cancel(t),this._secondsAtTime.cancel(t),this}getTicksAtTime(t){const e=this.toSeconds(t),s=this._state.getLastState("stopped",e),i=this._ticksAtTime.get(e),r={state:"paused",time:e};this._state.add(r);let o=i||s,a=i?i.ticks:0,c=null;return this._state.forEachBetween(o.time,e+this.sampleTime,h=>{let l=o.time;const u=this._tickOffset.get(h.time);u&&u.time>=o.time&&(a=u.ticks,l=u.time),o.state==="started"&&h.state!=="started"&&(a+=this.frequency.getTicksAtTime(h.time)-this.frequency.getTicksAtTime(l),h.time!==r.time&&(c={state:h.state,time:h.time,ticks:a})),o=h}),this._state.remove(r),c&&this._ticksAtTime.add(c),a}get ticks(){return this.getTicksAtTime(this.now())}set ticks(t){this.setTicksAtTime(t,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(t){const e=this.now(),s=this.frequency.timeToTicks(t,e);this.setTicksAtTime(s,e)}getSecondsAtTime(t){t=this.toSeconds(t);const e=this._state.getLastState("stopped",t),s={state:"paused",time:t};this._state.add(s);const i=this._secondsAtTime.get(t);let r=i||e,o=i?i.seconds:0,a=null;return this._state.forEachBetween(r.time,t+this.sampleTime,c=>{let h=r.time;const l=this._tickOffset.get(c.time);l&&l.time>=r.time&&(o=l.seconds,h=l.time),r.state==="started"&&c.state!=="started"&&(o+=c.time-h,c.time!==s.time&&(a={state:c.state,time:c.time,seconds:o})),r=c}),this._state.remove(s),a&&this._secondsAtTime.add(a),o}setTicksAtTime(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(t,e),ticks:t,time:e}),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}getStateAtTime(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)}getTimeOfTick(t,e=this.now()){const s=this._tickOffset.get(e),i=this._state.get(e),r=Math.max(s.time,i.time),o=this.frequency.getTicksAtTime(r)+t-s.ticks;return this.frequency.getTimeOfTick(o)}forEachTickBetween(t,e,s){let i=this._state.get(t);this._state.forEachBetween(t,e,o=>{i&&i.state==="started"&&o.state!=="started"&&this.forEachTickBetween(Math.max(i.time,t),o.time-this.sampleTime,s),i=o});let r=null;if(i&&i.state==="started"){const o=Math.max(i.time,t),a=this.frequency.getTicksAtTime(o),c=a-this.frequency.getTicksAtTime(i.time);let h=Math.ceil(c)-c;h=Kt(h,1)?0:h;let l=this.frequency.getTimeOfTick(a+h);for(;l<e;){try{s(l,Math.round(this.getTicksAtTime(l)))}catch(u){r=u;break}l+=this.frequency.getDurationOfTicks(1,l)}}if(r)throw r;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this._ticksAtTime.dispose(),this._secondsAtTime.dispose(),this.frequency.dispose(),this}},un=class fo extends Bt{constructor(){const t=b(fo.getDefaults(),arguments,["callback","frequency"]);super(t),this.name="Clock",this.callback=J,this._lastUpdate=0,this._state=new hs("stopped"),this._boundLoop=this._loop.bind(this),this.callback=t.callback,this._tickSource=new tf({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,G(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Bt.getDefaults(),{callback:J,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){ai(this.context);const s=this.toSeconds(t);return this.log("start",s),this._state.getValueAtTime(s)!=="started"&&(this._state.setStateAtTime("started",s),this._tickSource.start(s,e),s<this._lastUpdate&&this.emit
19("start",s,e)),this}stop(t){const e=this.toSeconds(t);return this.log("stop",e),this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._tickSource.stop(e),e<this._lastUpdate&&this.emit("stop",e),this}pause(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)==="started"&&(this._state.setStateAtTime("paused",e),this._tickSource.pause(e),e<this._lastUpdate&&this.emit("pause",e)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(t){this._tickSource.ticks=t}get seconds(){return this._tickSource.seconds}set seconds(t){this._tickSource.seconds=t}getSecondsAtTime(t){return this._tickSource.getSecondsAtTime(t)}setTicksAtTime(t,e){return this._tickSource.setTicksAtTime(t,e),this}getTimeOfTick(t,e=this.now()){return this._tickSource.getTimeOfTick(t,e)}getTicksAtTime(t){return this._tickSource.getTicksAtTime(t)}nextTickTime(t,e){const s=this.toSeconds(e),i=this.getTicksAtTime(s);return this._tickSource.getTimeOfTick(i+t,s)}_loop(){const t=this._lastUpdate,e=this.now();this._lastUpdate=e,this.log("loop",t,e),t!==e&&(this._state.forEachBetween(t,e,s=>{switch(s.state){case"started":const i=this._tickSource.getTicksAtTime(s.time);this.emit("start",s.time,i);break;case"stopped":s.time!==0&&this.emit("stop",s.time);break;case"paused":this.emit("pause",s.time);break}}),this._tickSource.forEachTickBetween(t,e,(s,i)=>{this.callback(s,i)}))}getStateAtTime(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}};cn.mixin(un);var se=class mo extends M{constructor(){const t=b(mo.getDefaults(),arguments,["delayTime","maxDelay"]);super(t),this.name="Delay";const e=this.toSeconds(t.maxDelay);this._maxDelay=Math.max(e,this.toSeconds(t.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(e),this.delayTime=new $({context:this.context,param:this._delayNode.delayTime,units:"time",value:t.delayTime,minValue:0,maxValue:this.maxDelay}),G(this,"delayTime")}static getDefaults(){return Object.assign(M.getDefaults(),{delayTime:0,maxDelay:1})}get maxDelay(){return this._maxDelay}dispose(){return super.dispose(),this._delayNode.disconnect(),this.delayTime.dispose(),this}},Be=class _o extends M{constructor(){const t=b(_o.getDefaults(),arguments,["volume"]);super(t),this.name="Volume",this.input=this.output=new B({context:this.context,gain:t.volume,units:"decibels"}),this.volume=this.output.gain,G(this,"volume"),this._unmutedVolume=t.volume,this.mute=t.mute}static getDefaults(){return Object.assign(M.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}},ef=class go extends M{constructor(){const t=b(go.getDefaults(),arguments);super(t),this.name="Destination",this.input=new Be({context:this.context}),this.output=new B({context:this.context}),this.volume=this.input.volume,Zt(this.input,this.output,this.context.rawContext.destination),this.mute=t.mute,this._internalChannels=[this.input,this.context.rawContext.destination,this.output]}static getDefaults(){return Object.assign(M.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(t){this.input.mute=t}chain(...t){return this.input.disconnect(),t.unshift(this.input),t.push(this.output),Zt(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}};on(n=>{n.destination=new ef({context:n})});an(n=>{n.destination.dispose()});var sf=class extends M{constructor(){super(...arguments),this.name="Listener",this.positionX=new $({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new $({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new $({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new $({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new $({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new $({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new $({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new $({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new $({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign(M.getDefaults(),{positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:-1,upX:0,upY:1,upZ:0})}dispose(){return super.dispose(),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this.forwardX.dispose(),this.forwardY.dispose(),this.forwardZ.dispose(),this.upX.dispose(),this.upY.dis
19pose(),this.upZ.dispose(),this}};on(n=>{n.listener=new sf({context:n})});an(n=>{n.listener.dispose()});function nf(n,t){return st(this,arguments,void 0,function*(e,s,i=2,r=rt().sampleRate){const o=rt(),a=new cs(i,s,r);Ys(a),yield e(a);const c=a.render();return Ys(o),new Ct(yield c)})}var dn=class vo extends xe{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=b(vo.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=t.baseUrl,Object.keys(t.urls).forEach(e=>{this._loadingCount++;const s=t.urls[e];this.add(e,s,this._bufferLoaded.bind(this,t.onload),t.onerror)})}static getDefaults(){return{baseUrl:"",onerror:J,onload:J,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return j(this.has(t),`ToneAudioBuffers has no buffer named: ${t}`),this._buffers.get(t.toString())}_bufferLoaded(t){this._loadingCount--,this._loadingCount===0&&t&&t()}get loaded(){return Array.from(this._buffers).every(([t,e])=>e.loaded)}add(t,e,s=J,i=J){return re(e)?(this.baseUrl&&e.trim().substring(0,11).toLowerCase()==="data:audio/"&&(this.baseUrl=""),this._buffers.set(t.toString(),new Ct(this.baseUrl+e,s,i))):this._buffers.set(t.toString(),new Ct(e,s,i)),this}dispose(){return super.dispose(),this._buffers.forEach(t=>t.dispose()),this._buffers.clear(),this}},Hs=class yo extends he{constructor(){super(...arguments),this.name="MidiClass",this.defaultUnits="midi"}_frequencyToUnits(t){return Ce(super._frequencyToUnits(t))}_ticksToUnits(t){return Ce(super._ticksToUnits(t))}_beatsToUnits(t){return Ce(super._beatsToUnits(t))}_secondsToUnits(t){return Ce(super._secondsToUnits(t))}toMidi(){return this.valueOf()}toFrequency(){return ui(this.toMidi())}transpose(t){return new yo(this.context,this.toMidi()+t)}};function rf(n,t){return new Hs(rt(),n,t)}var ct=class extends _t{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(n){return this._getPPQ()*n}_secondsToUnits(n){return Math.floor(n/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(n){return n}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}};function of(n,t){return new ct(rt(),n,t)}var af=class extends Bt{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new ee,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(n,t){return this._events.add({callback:n,time:this.toSeconds(t)}),this._events.length===1&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(n){return this._events.cancel(this.toSeconds(n)),this}_drawLoop(){const n=this.context.currentTime;this._events.forEachBefore(n+this.anticipation,t=>{n-t.time<=this.expiration&&t.callback(),this._events.remove(t)}),this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}};on(n=>{n.draw=new af({context:n})});an(n=>{n.draw.dispose()});var wo=class extends xe{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(n){j(H(n.time),"Events must have a time property"),j(H(n.duration),"Events must have a duration parameter"),n.time=n.time.valueOf();let t=new cf(n.time,n.time+n.duration,n);for(this._root===null?this._root=t:this._root.insert(t),this._length++;t!==null;)t.updateHeight(),t.updateMax(),this._rebalance(t),t=t.parent;return this}remove(n){if(this._root!==null){const t=[];this._root.search(n.time,t);for(const e of t)if(e.event===n){this._removeNode(e),this._length--;break}}return this}get length(){return this._length}cancel(n){return this.forEachFrom(n,t=>this.remove(t)),this}_setRoot(n){this._root=n,this._root!==null&&(this._root.parent=null)}_replaceNodeInParent(n,t){n.parent!==null?(n.isLeftChild()?n.parent.left=t:n.parent.right=t,this._rebalance(n.parent)):this._setRoot(t)}_removeNode(n){if(n.left===null&&n.right===null)this._replaceNodeInParent(n,null);else if(n.right===null)this._replaceNodeInParent(n,n.left);
19else if(n.left===null)this._replaceNodeInParent(n,n.right);else{const t=n.getBalance();let e,s=null;if(t>0)if(n.left.right===null)e=n.left,e.right=n.right,s=e;else{for(e=n.left.right;e.right!==null;)e=e.right;e.parent&&(e.parent.right=e.left,s=e.parent,e.left=n.left,e.right=n.right)}else if(n.right.left===null)e=n.right,e.left=n.left,s=e;else{for(e=n.right.left;e.left!==null;)e=e.left;e.parent&&(e.parent.left=e.right,s=e.parent,e.left=n.left,e.right=n.right)}n.parent!==null?n.isLeftChild()?n.parent.left=e:n.parent.right=e:this._setRoot(e),s&&this._rebalance(s)}n.dispose()}_rotateLeft(n){const t=n.parent,e=n.isLeftChild(),s=n.right;s&&(n.right=s.left,s.left=n),t!==null?e?t.left=s:t.right=s:this._setRoot(s)}_rotateRight(n){const t=n.parent,e=n.isLeftChild(),s=n.left;s&&(n.left=s.right,s.right=n),t!==null?e?t.left=s:t.right=s:this._setRoot(s)}_rebalance(n){const t=n.getBalance();t>1&&n.left?n.left.getBalance()<0?this._rotateLeft(n.left):this._rotateRight(n):t<-1&&n.right&&(n.right.getBalance()>0?this._rotateRight(n.right):this._rotateLeft(n))}get(n){if(this._root!==null){const t=[];if(this._root.search(n,t),t.length>0){let e=t[0];for(let s=1;s<t.length;s++)t[s].low>e.low&&(e=t[s]);return e.event}}return null}forEach(n){if(this._root!==null){const t=[];this._root.traverse(e=>t.push(e)),t.forEach(e=>{e.event&&n(e.event)})}return this}forEachAtTime(n,t){if(this._root!==null){const e=[];this._root.search(n,e),e.forEach(s=>{s.event&&t(s.event)})}return this}forEachFrom(n,t){if(this._root!==null){const e=[];this._root.searchAfter(n,e),e.forEach(s=>{s.event&&t(s.event)})}return this}dispose(){return super.dispose(),this._root!==null&&this._root.traverse(n=>n.dispose()),this._root=null,this}},cf=class{constructor(n,t,e){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=e,this.low=n,this.high=t,this.max=this.high}insert(n){n.low<=this.low?this.left===null?this.left=n:this.left.insert(n):this.right===null?this.right=n:this.right.insert(n)}search(n,t){n>this.max||(this.left!==null&&this.left.search(n,t),this.low<=n&&this.high>n&&t.push(this),!(this.low>n)&&this.right!==null&&this.right.search(n,t))}searchAfter(n,t){this.low>=n&&(t.push(this),this.left!==null&&this.left.searchAfter(n,t)),this.right!==null&&this.right.searchAfter(n,t)}traverse(n){n(this),this.left!==null&&this.left.traverse(n),this.right!==null&&this.right.traverse(n)}updateHeight(){this.left!==null&&this.right!==null?this.height=Math.max(this.left.height,this.right.height)+1:this.right!==null?this.height=this.right.height+1:this.left!==null?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,this.left!==null&&(this.max=Math.max(this.max,this.left.max)),this.right!==null&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let n=0;return this.left!==null&&this.right!==null?n=this.left.height-this.right.height:this.left!==null?n=this.left.height+1:this.right!==null&&(n=-(this.right.height+1)),n}isLeftChild(){return this.parent!==null&&this.parent.left===this}get left(){return this._left}set left(n){this._left=n,n!==null&&(n.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(n){this._right=n,n!==null&&(n.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}},hf=Wn({}),lf=class extends xe{constructor(n){super(),this.name="TimelineValue",this._timeline=new ee({memory:10}),this._initialValue=n}set(n,t){return this._timeline.add({value:n,time:t}),this}get(n){const t=this._timeline.get(n);return t?t.value:this._initialValue}},oe=class xo extends M{constructor(){super(b(xo.getDefaults(),arguments,["context"]))}connect(t,e=0,s=0){return Ds(this,t,e,s),this}},be=class bo extends oe{constructor(){const t=b(bo.getDefaults(),arguments,["mapping","length"]);super(t),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,kt(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):Xr(t.mapping)&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(Z.getDefaults(),{length:1024})}setMap(t,e=1024){const s=new Float32Array(e);for(let i=0,r=e;i<r;i++)s[i]=t(i/(r-1)*2-1,i);return this.curve=s,this}get curve(){return this._shaper.curve}set curve(t){this._shaper.curve=t}get oversample(){return this._shaper.oversample}set oversample(t){j(["none","2x","4x"].some(e=>e.includes(t)),"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}},pn=class To extends oe{constructor(){const t=b(To.getDefaults(),arguments,["value"]);super(t),this.name="Pow",this._exponentScaler=this.input=this.output=new be({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(oe.getDefaults(),{value:1})}_expFunc(t){return e=>Math.pow(Math.abs(e),t)}get value(){return this._exponent}set value(t){this._exponent=t,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}},ys=class En{constructor(t,e){this.id=En._eventId++,this._remainderTime=0;const s=Object.assign(En.getDefaults(),e);this.transport=t,this.callback=s.callback,this._once=s.once,this.time=Math.floor(s.time),this._remainderTime=s.time-this.time}static getDefaults(){return{callback:J,once:!1,time:0}}get floatTime(){return this.time+this._remainderTime}invoke(t){if(this.callback){const e=this.transport.bpm.getDurationOfTicks(1,t);this.callback(t+this._remainderTime*e),this._once&&this.transport.clear(this.id
vendor: 2,002 bytes, line 19
19)}}dispose(){return this.callback=void 0,this}};ys._eventId=0;var uf=class So extends ys{constructor(t,e){super(t,e),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const s=Object.assign(So.getDefaults(),e);this.duration=s.duration,this._interval=s.interval,this._nextTick=s.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.transport.on("ticks",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},ys.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvent(){return $s(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new ct(this.context,this._nextTick).toSeconds()):-1}_createEvents(t){$s(this._nextTick+this._interval,this.floatTime+this.duration)&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new ct(this.context,this._nextTick).toSeconds()))}_restart(t){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.floatTime;const e=this.transport.getTicksAtTime(t);Ye(e,this.time)&&(this._nextTick=this.floatTime+Math.ceil((e-this.floatTime)/this._interval)*this._interval),this._currentId=this._createEvent(),this._nextTick+=this._interval,this._nextId=this._createEvent()}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this.transport.off("ticks",this._boundRestart),this}},ko=class Co extends Bt{constructor(){const t=b(Co.getDefaults(),arguments);super(t),this.name="Transport",this._loop=new lf(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new ee,this._repeatedEvents=new wo,this._syncedSignals=[],this._swingAmou
19nt=0,this._ppq=t.ppq,this._clock=new un({callback:this._processTick.bind(this),context:this.context,frequency:0,units:"bpm"}),this._bindClockEvents(),this.bpm=this._clock.frequency,this._clock.frequency.multiplier=t.ppq,this.bpm.setValueAtTime(t.bpm,0),G(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Bt.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(t,e){if(this._loop.get(t)&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._swingAmount>0&&e%this._ppq!==0&&e%(this._swingTicks*2)!==0){const s=e%(this._swingTicks*2)/(this._swingTicks*2),i=Math.sin(s*Math.PI)*this._swingAmount;t+=new ct(this.context,this._swingTicks*2/3).toSeconds()*i}Dn(!0),this._timeline.forEachAtTime(e,s=>s.invoke(t)),Dn(!1)}schedule(t,e){const s=new ys(this,{callback:t,time:new _t(this.context,e).toTicks()});return this._addEvent(s,this._timeline)}scheduleRepeat(t,e,s,i=1/0){const r=new uf(this,{callback:t,duration:new ge(this.context,i).toTicks(),interval:new ge(this.context,e).toTicks(),time:new _t(this.context,s).toTicks()});return this._addEvent(r,this._repeatedEvents)}scheduleOnce(t,e){const s=new ys(this,{callback:t,once:!0,time:new _t(this.context,e).toTicks()});return this._addEvent(s,this._timeline)}clear(t){if(this._scheduledEvents.hasOwnProperty(t)){const e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this}_addEvent(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id}cancel(t=0){const e=this.toTicks(t);return this._timeline.forEachFrom(e,s=>this.clear(s.id)),this._repeatedEvents.forEachFrom(e,s=>this.clear(s.id)),this}_bindClockEvents(){this._clock.on("start",(t,e)=>{e=new ct(this.context,e).toSeconds(),this.emit("start",t,e)}),this._clock.on("stop",t=>{this.emit("stop",t)}),this._clock.on("pause",t=>{this.emit("pause",t)})}get state(){return this._clock.getStateAtTime(this.now())}start(t,e){this.context.resume();let s;return H(e)&&(s=this.toTicks(e)),this._clock.start(t,s),this}stop(t){return this._clock.stop(t),this}pause(t){return this._clock.pause(t),this}toggle(t){return t=this.toSeconds(t),this._clock.getStateAtTime(t)!=="started"?this.start(t):this.stop(t),this}get timeSignature(){return this._timeSignature}set timeSignature(t){kt(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new ge(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new ge(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t)}get loop(){return this._loop.get(this.now())}set loop(t){this._loop.set(t,this.now())}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}
19get swing(){return this._swingAmount}set swing(t){this._swingAmount=t}get swingSubdivision(){return new ct(this.context,this._swingTicks).toNotation()}set swingSubdivision(t){this._swingTicks=this.toTicks(t)}get position(){const t=this.now(),e=this._clock.getTicksAtTime(t);return new ct(this.context,e).toBarsBeatsSixteenths()}set position(t){const e=this.toTicks(t);this.ticks=e}get seconds(){return this._clock.seconds}set seconds(t){const e=this.now(),s=this._clock.frequency.timeToTicks(t,e);this.ticks=s}get progress(){if(this.loop){const t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}else return 0}get ticks(){return this._clock.ticks}set ticks(t){if(this._clock.ticks!==t){const e=this.now();if(this.state==="started"){const s=this._clock.getTicksAtTime(e),i=e+this._clock.frequency.getDurationOfTicks(Math.ceil(s)-s,e);this.emit("stop",i),this._clock.setTicksAtTime(t,i),this.emit("start",i,this._clock.getSecondsAtTime(i))}else this.emit("ticks",e),this._clock.setTicksAtTime(t,e)}}getTicksAtTime(t){return this._clock.getTicksAtTime(t)}getSecondsAtTime(t){return this._clock.getSecondsAtTime(t)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(t){this._clock.frequency.multiplier=t}nextSubdivision(t){if(t=this.toTicks(t),this.state!=="started")return 0;{const e=this.now(),s=this.getTicksAtTime(e),i=t-s%t;return this._clock.nextTickTime(i,e)}}syncSignal(t,e){const s=this.now();let i=this.bpm,r=1/(60/i.getValueAtTime(s)/this.PPQ),o=[];if(t.units==="time"){const c=.015625/r,h=new B(c),l=new pn(-1),u=new B(c);i.chain(h,l,u),i=u,r=1/r,o=[h,l,u]}e||(t.getValueAtTime(s)!==0?e=t.getValueAtTime(s)/r:e=0);const a=new B(e);return i.connect(a),a.connect(t._param),o.push(a),this._syncedSignals.push({initial:t.value,nodes:o,signal:t}),t.value=0,this}unsyncSignal(t){for(let e=this._syncedSignals.length-1;e>=0;e--){const s=this._syncedSignals[e];s.signal===t&&(s.nodes.forEach(i=>i.dispose()),s.signal.value=s.initial,this._syncedSignals.splice(e,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),Cs(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}};cn.mixin(ko);on(n=>{n.transport=new ko({context:n})});an(n=>
19{n.transport.dispose()});var ft=class extends M{constructor(n){super(n),this.input=void 0,this._state=new hs("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=J,this._syncedStop=J,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new Be({context:this.context,mute:n.mute,volume:n.volume}),this.volume=this._volume.volume,G(this,"volume"),this.onstop=n.onstop}static getDefaults(){return Object.assign(M.getDefaults(),{mute:!1,onstop:J,volume:0})}get state(){return this._synced?this.context.transport.state==="started"?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(n){this._volume.mute=n}_clampToCurrentTime(n){return this._synced?n:Math.max(n,this.context.currentTime)}start(n,t,e){let s=Wt(n)&&this._synced?this.context.transport.seconds:this.toSeconds(n);if(s=this._clampToCurrentTime(s),!this._synced&&this._state.getValueAtTime(s)==="started")j(Ye(s,this._state.get(s).time),"Start time must be strictly greater than previous start time"),this._state.cancel(s),this._state.setStateAtTime("started",s),this.log("restart",s),this.restart(s,t,e);else if(this.log("start",s),this._state.setStateAtTime("started",s),this._synced){const i=this._state.get(s);i&&(i.offset=this.toSeconds(Yt(t,0)),i.duration=e?this.toSeconds(e):void 0);const r=this.context.transport.schedule(o=>{this._start(o,t,e)},s);this._scheduled.push(r),this.context.transport.state==="started"&&this.context.transport.getSecondsAtTime(this.immediate())>s&&this._syncedStart(this.now(),this.context.transport.seconds)}else ai(this.context),this._start(s,t,e);return this}stop(n){let t=Wt(n)&&this._synced?this.context.transport.seconds:this.toSeconds(n);if(t=this._clampToCurrentTime(t),this._state.getValueAtTime(t)==="started"||H(this._state.getNextState("started",t))){if(this.log("stop",t),!this._synced)this._stop(t);else{const e=this.context.transport.schedule(this._stop.bind(this),t);this._scheduled.push(e)}this._state.cancel(t),this._state.setStateAtTime("stopped",t)}return this}restart(n,t,e){return n=this.toSeconds(n),this._state.getValueAtTime(n)==="started"&&(this._state.cancel(n),this._restart(n,t,e)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(n,t)=>{if(Ye(t,0)){const e=this._state.get(t);if(e&&e.state==="started"&&e.time!==t){const s=t-this.toSeconds(e.time);let i;e.duration&&(i=this.toSeconds(e.duration)-s),this._start(n,this.toSeconds(e.offset)+s,i)}}},this._syncedStop=n=>{const t=this.context.transport.getSecondsAtTime(Math.max(n-this.sampleTime,0));this._state.getValueAtTime(t)==="started"&&this._stop(n)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach(n=>this.context.transport.clear(n)),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=J,this.unsync(),this._volume.dispose(),this._state.dispose(),this}},ls=class Ao extends Ke{constructor(){const t=b(Ao.getDefaults(),arguments,["url","onload"]);super(t),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,Vt(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new $({context:this.context,param:this._source.playbackRate,units:"positive",value:t.playbackRate}),this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this._buffer=new Ct(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(Ke.getDefaults(),{url:new Ct,loop:!1,loopEnd:0,loopStart:0,onload:J,onerror:J,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t}get curve(){return this._curve}set curve(t){this._curve=t}start(t,e,s,i=1){j(this.buffer.loaded,"buffer is either not set or not loaded");const r=this.toSeconds(t);this._startGain(r,i),this.loop?e=Yt(e,this.loopStart):e=Yt(e,0);let o=Math.max(this.toSeconds(e),0);if(this.loop){const a=this.toSeconds(this.loopEnd)||this.buffer.duration,c=this.toSeconds(this.loopStart),h=a-c;On(o,a)&&(o=(o-c)%h+c),Kt(o,this.buffer.duration)&&(o=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,$s(o,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(r,o)),H(s)){let a=this.toSeconds(s);a=Math.max(a,0),this.stop(r+a)}return this}_stopSource(t){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(t)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(t){this._source.loopStart=this.toSeconds(t)}get loopEnd(){return this._source.loopEnd}set loopEnd(t){this._source.loopEnd=this.toSeconds(t)}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._source.loop}set loop(t){this._source.loop=t,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}},ts=class Do extends ft{constructor(){const t=b(Do.getDefaults(),arguments,["type"]);super(t),this.name="Noise",this._source=null,this._playbackRate=t.playbackRate,this.type=t.type,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(ft.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if(j(t in Ji,"Noise: invalid type: "+t),this._type!==t&&(this._type=t,this.state==="started")){const e=this.now();this._stop(e),this._start(e)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}_start(t){const e=Ji[this._type];this._source=new ls({url:e,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(t),Math.random()*(e.duration-.001))}_stop(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(t){this._stop(t),this._start(t)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}},Ue=44100*5,bn=2,_e={brown:null,pink:null,white:null},Ji={get brown(){if(!_e.brown){const n=[];for(let t=0;t<bn;t++){const e=new Float32Array(Ue);n[t]=e;let s=0;for(let i=0;i<Ue;i++){const r=Math.random()*2-1;e[i]=(s+.02*r)/1.02,s=e[i],e[i]*=3.5}}_e.brown=new Ct().fromArray(n)}return _e.brown},get pink(){if(!_e.pink){const n=[];for(let t=0;t<bn;t++){const e=new Float32Array(Ue);n[t]=e;let s,i,r,o,a,c,h;s=i=r=o=a=c=h=0;for(let l=0;l<Ue;l++){const u=Math.random()*2-1;s=.99886*s+u*.0555179,i=.99332*i+u*.0750759,r=.969*r+u*.153852,o=.8665*o+u*.3104856,a=.55*a+u*.5329522,c=-.7616*c-u*.016898,e[l]=s+i+r+o+a+c+h+u*.5362,e[l]*=.11,h=u*.115926}}_e.pink=new Ct().fromArray(n)}return _e.pink},get white(){if(!_e.white){const n=[];for(let t=0;t<bn;t++){const e=new Float32Array(Ue);n[t]=e;for(let s=0;s<Ue;s++)e[s]=Math.random()*2-1}_e.white=new Ct().fromArray(n)}return _e.white}},df=class Ls extends M{constructor(){const t=b(Ls.getDefaults(),arguments,["volume"]);super(t),this.name="UserMedia",this._volume=this.output=new Be({context:this.context,volume:t.volume}),this.volume=this._volume.volume,G(this,"volume"),this.mute=t.mute}static getDefaults(){return Object.assign(M.getDefaults(),{mute:!1,volume:0})}open(t){return st(this,void 0,void 0,function*(){j(Ls.supported,"UserMedia is not supported"),this.state==="started"&&this.close();const e=yield Ls.enumerateDevices();Gt(t)?this._device=e[t]:(this._device=e.find(r=>r.label===t||r.deviceId===t),!this._device&&e.length>0&&(this._device=e[0]),j(H(this._device),`No matching device ${t}`));const s={audio:{echoCancellation:!1,sampleRate:this.context.sampleRate,noiseSuppression:!1,mozNoiseSuppression:!1}};this._device&&(s.audio.deviceId=this._device.deviceId);const i=yield navigator.mediaDevices.getUserMedia(s);if(!this._stream){this._stream=i;const r=this.context.createMediaStreamSource(i);Vt(r,this.output),this._mediaStream=r}return this})}close(){return this._stream&&this._mediaStream&&(this._stream.getAudioTracks().forEac
19h(t=>{t.stop()}),this._stream=void 0,this._mediaStream.disconnect(),this._mediaStream=void 0),this._device=void 0,this}static enumerateDevices(){return st(this,void 0,void 0,function*(){return(yield navigator.mediaDevices.enumerateDevices()).filter(t=>t.kind==="audioinput")})}get state(){return this._stream&&this._stream.active?"started":"stopped"}get deviceId(){if(this._device)return this._device.deviceId}get groupId(){if(this._device)return this._device.groupId}get label(){if(this._device)return this._device.label}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}dispose(){return super.dispose(),this.close(),this._volume.dispose(),this.volume.dispose(),this}static get supported(){return H(navigator.mediaDevices)&&H(navigator.mediaDevices.getUserMedia)}};function ze(n,t){return st(this,void 0,void 0,function*(){const e=t/n.context.sampleRate,s=new cs(1,e,n.context.sampleRate);return new n.constructor(Object.assign(n.get(),{frequency:2/e,detune:0,context:s})).toDestination().start(0),(yield s.render()).getChannelData(0)})}var pi=class Oo extends Ke{constructor(){const t=b(Oo.getDefaults(),arguments,["frequency","type"]);super(t),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],Vt(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new $({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new $({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),G(this,["frequency","detune"])}static getDefaults(){return Object.assign(Ke.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._oscillator.start(e),this}_stopSource(t){this._oscillator.stop(t)}setPeriodicWave(t){return this._oscillator.setPeriodicWave(t),this}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t}dispose(){return super.dispose(),this.state==="started"&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}},At=class Ee extends ft{constructor(){const t=b(Ee.getDefaults(),arguments,["frequency","type"]);super(t),this.name="Oscillator",this._oscillator=null,this.frequency=new Z({context:this.context,units:"frequency",value:t.frequency}),G(this,"frequency"),this.detune=new Z({context:this.context,units:"cents",value:t.detune}),G(this,"detune"),this._partials=t.partials,this._partialCount=t.partialCount,this._type=t.type,t.partialCount&&t.type!=="custom"&&(this._type=this.baseType+t.partialCount.toString()),this.phase=t.phase}static getDefaults(){return Object.assign(ft.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),s=new pi({context:this.context,onended:()=>this.onstop(this)});this._oscillator=s,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(e)}_stop(t){const e=this.toSeconds(t);this._oscillator&&this._oscillator.stop(e)}_restart(t){const e=this.toSeconds(t);return this.log("restart",e),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(e),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if(this._type==="custom")return Ee._periodicWaveCache.find(t=>t.phase===this._phase&&Vp(t.partials,this._partials));{const t=Ee._periodicWaveCache.find(e=>e.type===this._type&&e.phase===this._phase);return this._partialCount=t?t.partialCount:this._partialCount,t}}get type(){return this._type}set type(t){this._type=t;const e=["sine","square","sawtooth","triangle"].indexOf(t)!==-1;if(this._phase===0&&e)this._wave=void 0,this._partialCount=0,this._oscillator!==null&&(this._oscillator.type=t);else{const s=this._getCachedPeriodicWave();if(H(s)){const{partials:i,wave:r}=s;this._wave=r,this._partials=i,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave)}else{const[i,r]=this._getRealImaginary(t,this._phase),o=this.context.createPerio
19dicWave(i,r);this._wave=o,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave),Ee._periodicWaveCache.push({imag:r,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:i,type:this._type,wave:this._wave}),Ee._periodicWaveCache.length>100&&Ee._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(t){this.partialCount&&this._type!=="custom"&&t!=="custom"?this.type=t+this.partialCount:this.type=t}get partialCount(){return this._partialCount}set partialCount(t){yt(t,0);let e=this._type;const s=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(s&&(e=s[1]),this._type!=="custom")t===0?this.type=e:this.type=e+t.toString();else{const i=new Float32Array(t);this._partials.forEach((r,o)=>i[o]=r),this._partials=Array.from(i),this.type=this._type}}_getRealImaginary(t,e){let s=2048;const i=new Float32Array(s),r=new Float32Array(s);let o=1;if(t==="custom"){if(o=this._partials.length+1,this._partialCount=this._partials.length,s=o,this._partials.length===0)return[i,r]}else{const a=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);a?(o=parseInt(a[2],10)+1,this._partialCount=parseInt(a[2],10),t=a[1],o=Math.max(o,2),s=o):this._partialCount=0,this._partials=[]}for(let a=1;a<s;++a){const c=2/(a*Math.PI);let h;switch(t){case"sine":h=a<=o?1:0,this._partials[a-1]=h;break;case"square":h=a&1?2*c:0,this._partials[a-1]=h;break;case"sawtooth":h=c*(a&1?1:-1),this._partials[a-1]=h;break;case"triangle":a&1?h=2*(c*c)*(a-1>>1&1?-1:1):h=0,this._partials[a-1]=h;break;case"custom":h=this._partials[a-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}h!==0?(i[a]=-h*Math.sin(e*a),r[a]=h*Math.cos(e*a)):(i[a]=0,r[a]=0)}return[i,r]}_inverseFFT(t,e,s){let i=0;const r=t.length;for(let o=0;o<r;o++)i+=t[o]*Math.cos(o*s)+e[o]*Math.sin(o*s);return i}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let s=0;const i=Math.PI*2,r=32;for(let o=0;o<r;o++)s=Math.max(this._inverseFFT(t,e,o/r*i),s);return je(-this._inverseFFT(t,e,this._phase)/s,-1,1)}get partials(){return this._partials.slice(0,this.partialCount)}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(t){this._phase=t*Math.PI/180,this.type=this._type}asArray(){return st(this,arguments,void 0,function*(t=1024){return ze(this,t)})}dispose(){return super.dispose(),this._oscillator!==null&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}};At._periodicWaveCache=[];var fn=class extends oe{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new be({context:this.context,mapping:n=>(n+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}},pt=class Mo extends Z{constructor(){const t=b(Mo.getDefaults(),arguments,["value"]);super(t),this.name="Multiply",this.override=!1,this._mult=this.input=this.output=new B({context:this.context,minValue:t.minValue,maxValue:t.maxValue}),this.factor=this._param=this._mult.gain,this.factor.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Z.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}},fi=class Eo extends ft{constructor(){const t=b(Eo.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="AMOscillator",this._modulationScale=new fn({context:this.context}),this._modulationNode=new B({context:this.context}),this._carrier=new At({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this._modulator=new At({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new pt({context:this.context,units:"positive",value:t.harmonicity}),this.frequency.chain(this.harmonicity,this._modulator.frequency),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),G(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(At.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){this._modulator.restart(t),this._carrier.restart(t)}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(){return st(this,arguments,void 0,function*(t=1024){return ze(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dis
19pose(),this._modulationScale.dispose(),this}},mn=class No extends ft{constructor(){const t=b(No.getDefaults(),arguments,["frequency","type","modulationType"]);super(t),this.name="FMOscillator",this._modulationNode=new B({context:this.context,gain:0}),this._carrier=new At({context:this.context,detune:t.detune,frequency:0,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.detune=this._carrier.detune,this.frequency=new Z({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new At({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new pt({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new pt({context:this.context,units:"positive",value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),G(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(At.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){return this._modulator.restart(t),this._carrier.restart(t),this}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(){return st(this,arguments,void 0,function*(t=1024){return ze(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}},_n=class Ro extends ft{constructor(){const t=b(Ro.getDefaults(),arguments,["frequency","width"]);super(t),this.name="PulseOscillator",this._widthGate=new B({context:this.context,gain:0}),this._thresh=new be({context:this.context,mapping:e=>e<=0?-1:1}),this.width=new Z({context:this.context,units:"audioRange",value:t.width}),this._triangle=new At({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:"triangle"}),this.frequency=this._triangle.frequency,this.detune=this._triangle.detune,this._triangle.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),G(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(ft.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(t){t=this.toSeconds(t),this._triangle.start(t),this._widthGate.gain.setValueAtTime(1,t)}_stop(t){t=this.toSeconds(t),this._triangle.stop(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(0,t)}_restart(t){this._triangle.restart(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(1,t)}get phase(){return this._triangle.phase}set phase(t){this._triangle.phase=t}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(t){this._triangle.type=t}asArray(){return st(this,arguments,void 0,function*(t=1024){return ze(this,t)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}},mi=class Fo extends ft{constructor(){const t=b(Fo.getDefaults(),arguments,["frequency","type","spread"]);super(t),this.name="FatOscillator",this._oscillators=[],this.frequency=new Z({context:this.context,units:"frequency",value:t.frequency}),this.detune=new Z({context:this.context,units:"cents",value:t.detune}),this._spread=t.spread,this._type=t.type,this._phase=t.phase,this._partials=t.partials,this._partialCount=t.partialCount,this.count=t.count,G(this,["frequency","detune"])}static getDefaults(){return Object.assign(At.getDefaults(),{count:3,spread:20,type:"sawtooth"})}
19_start(t){t=this.toSeconds(t),this._forEach(e=>e.start(t))}_stop(t){t=this.toSeconds(t),this._forEach(e=>e.stop(t))}_restart(t){this._forEach(e=>e.restart(t))}_forEach(t){for(let e=0;e<this._oscillators.length;e++)t(this._oscillators[e],e)}get type(){return this._type}set type(t){this._type=t,this._forEach(e=>e.type=t)}get spread(){return this._spread}set spread(t){if(this._spread=t,this._oscillators.length>1){const e=-t/2,s=t/(this._oscillators.length-1);this._forEach((i,r)=>i.detune.value=e+s*r)}}get count(){return this._oscillators.length}set count(t){if(yt(t,1),this._oscillators.length!==t){this._forEach(e=>e.dispose()),this._oscillators=[];for(let e=0;e<t;e++){const s=new At({context:this.context,volume:-6-t*1.1,type:this._type,phase:this._phase+e/t*360,partialCount:this._partialCount,onstop:e===0?()=>this.onstop(this):J});this.type==="custom"&&(s.partials=this._partials),this.frequency.connect(s.frequency),this.detune.connect(s.detune),s.detune.overridden=!1,s.connect(this.output),this._oscillators[e]=s}this.spread=this._spread,this.state==="started"&&this._forEach(e=>e.start())}}get phase(){return this._phase}set phase(t){this._phase=t,this._forEach((e,s)=>e.phase=this._phase+s/this.count*360)}get baseType(){return this._oscillators[0].baseType}set baseType(t){this._forEach(e=>e.baseType=t),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this._type="custom",this._forEach(e=>e.partials=t))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(t){this._partialCount=t,this._forEach(e=>e.partialCount=t),this._type=this._oscillators[0].type}asArray(){return st(this,arguments,void 0,function*(t=1024){return ze(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(t=>t.dispose()),this}},_i=class Io extends ft{constructor(){const t=b(Io.getDefaults(),arguments,["frequency","modulationFrequency"]);super(t),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new pt({context:this.context,value:2}),this._pulse=new _n({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new At({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase}),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),G(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(ft.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)}_stop(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)}_restart(t){this._modulator.restart(t),this._pulse.restart(t)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(t){this._modulator.phase=t}asArray(){return st(this,arguments,void 0,function*(t=1024){return ze(this,t)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}},Ki={am:fi,fat:mi,fm:mn,oscillator:At,pulse:_n,pwm:_i},Ve=class qo extends ft{constructor(){const t=b(qo.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OmniOscillator",this.frequency=new Z({context:this.context,units:"frequency",value:t.frequency}),this.detune=new Z({context:this.context,units:"cents",value:t.detune}),G(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(At.getDefaults(),mn.getDefaults(),fi.getDefaults(),mi.getDefaults(),_n.getDefaults(),_i.getDefaults())}_start(t){this._oscillator.start(t)}_stop(t){this._oscillator.stop(t)}_restart(t){return this._oscillator.restart(t),this}get type(){let t="";return["am","fm","fat"].some(e=>this._sourceType===e)&&(t=this._sourceType),t+this._oscillator.type}set type(t){t.substr(0,2)==="fm"?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):t.substr(0,2)==="am"?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):t.substr(0,3)==="fat"?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(3)):t==="pwm"?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):t==="pulse"?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=t)}get partials(){return this._oscillator.partials}set partials(t){!this._getOscType(this._oscillator,"pulse")&&!this._getOscType(this._oscillator,"pwm")&&(this._oscillator.partials=t)}get partialCount(){return this._oscillator.partialCount}set partialCount(t){!this._getOscType(this._oscillator,"pulse")&&!this._getOscType(this._oscillator,"pwm")&&(this._oscillator.partialCount=t)}
19set(t){return Reflect.has(t,"type")&&t.type&&(this.type=t.type),super.set(t),this}_createNewOscillator(t){if(t!==this._sourceType){this._sourceType=t;const e=Ki[t],s=this.now();if(this._oscillator){const i=this._oscillator;i.stop(s),this.context.setTimeout(()=>i.dispose(),this.blockTime)}this._oscillator=new e({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),this.state==="started"&&this._oscillator.start(s)}}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t}get sourceType(){return this._sourceType}set sourceType(t){let e="sine";this._oscillator.type!=="pwm"&&this._oscillator.type!=="pulse"&&(e=this._oscillator.type),t==="fm"?this.type="fm"+e:t==="am"?this.type="am"+e:t==="fat"?this.type="fat"+e:t==="oscillator"?this.type=e:t==="pulse"?this.type="pulse":t==="pwm"&&(this.type="pwm")}_getOscType(t,e){return t instanceof Ki[e]}get baseType(){return this._oscillator.baseType}set baseType(t){!this._getOscType(this._oscillator,"pulse")&&!this._getOscType(this._oscillator,"pwm")&&t!=="pulse"&&t!=="pwm"&&(this._oscillator.baseType=t)}get width(){if(this._getOscType(this._oscillator,"pulse"))return this._oscillator.width}get count(){if(this._getOscType(this._oscillator,"fat"))return this._oscillator.count}set count(t){this._getOscType(this._oscillator,"fat")&&Gt(t)&&(this._oscillator.count=t)}get spread(){if(this._getOscType(this._oscillator,"fat"))return this._oscillator.spread}set spread(t){this._getOscType(this._oscillator,"fat")&&Gt(t)&&(this._oscillator.spread=t)}get modulationType(){if(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))return this._oscillator.modulationType}set modulationType(t){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&re(t)&&(this._oscillator.modulationType=t)}get modulationIndex(){if(this._getOscType(this._oscillator,"fm"))return this._oscillator.modulationIndex}get harmonicity(){if(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))return this._oscillator.harmonicity}get modulationFrequency(){if(this._getOscType(this._oscillator,"pwm"))return this._oscillator.modulationFrequency}asArray(){return st(this,arguments,void 0,function*(t=1024){return ze(this,t)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}},Os=class Vo extends Z{constructor(){super(b(Vo.getDefaults(),arguments,["value"])),this.override=!1,this.name="Add",this._sum=new B({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,Zt(this._constantSource,this._sum)}static getDefaults(){return Object.assign(Z.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}},Pe=class Po extends oe{constructor(){const t=b(Po.getDefaults(),arguments,["min","max"]);super(t),this.name="Scale",this._mult=this.input=new pt({context:this.context,value:t.max-t.min}),this._add=this.output=new Os({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(oe.getDefaults(),{max:1,min:0})}get min(){return this._min}set min(t){this._min=t,this._setRange()}get max(){return this._max}set max(t){this._max=t,this._setRange()}_setRange(){this._add.value=this._min,this._mult.value=this._max-this._min}dispose(){return super.dispose(),this._add.dispose(),this._mult.dispose(),this}},Lo=class Wo extends oe{constructor(){super(b(Wo.getDefaults(),arguments)),this.name="Zero",this._gain=new B({context:this.context}),this.output=this._gain,this.input=void 0,Vt(this.context.getConstant(0),this._gain)}dispose(){return super.dispose(),di(this.context.getConstant(0),this._gain),this}},Ut=class jo extends M{constructor(){const t=b(jo.getDefaults(),arguments,["frequency","min","max"]);super(t),this.name="LFO",this._stoppedValue=0,this._units="number",this.convert=!0,this._fromType=$.prototype._fromType,this._toType=$.prototype._toType,this._is=$.prototype._is,this._clampValue=$.prototype._clampValue,this._oscillator=new At(t),this.frequency=this._oscillator.frequency,this._amplitudeGain=new B({context:this.context,gain:t.amplitude,units:"normalRange"}),this.amplitude=this._amplitudeGain.gain,this._stoppedSignal=new Z({context:this.context,units:"audioRange",value:0}),this._zeros=new Lo({context:this.context}),this._a2g=new fn({context:this.context}),this._scaler=this.output=new Pe({context:this.context,max:t.max,min:t.min}),this.units=t.units,this.min=t.min,this.max=t.max,this._oscillator.chain(this._amplitudeGain,this._a2g,this._scaler),this._zeros.connect(this._a2g),this._stoppedSignal.connect(this._a2g),G(this,["amplitude","frequency"]),this.phase=t.phase}static getDefaults(){return Object.assign(At.getDefaults(),{amplitude:1,frequency:"4n",max:1,min:0,type:"sine",units:"number"})}start(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(0,t),this._oscillator.start(t),this}stop(t){return t=this.toSeconds(t),this._stoppedSignal.setValueAtTime(this._stoppedValue,t),this._oscillator.stop(t),this}sync(){return this._oscillator.sync(),this._oscillator.syncFrequency(),this}unsync(){return this._oscillator.unsync(),this._oscillator.unsyncFrequency(),this}_setStoppedValue(){this._stoppedValue=this._oscillator.getInitialValue(),this._stoppedSignal.value=this._stoppedValue}get min(){return this._toType(this._scaler.min)}set min(t){t=this._fromType(t),this._scaler.min=t}get max(){return this._toType(this._scaler.max)}set max(t){t=this._fromType(t),this._scaler.max=t}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t,this._setStoppedValue()}get partials(){return this._oscillator.partials}set partials(t){this._oscillator.partials=t,this._setStoppedValue()}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t,this._setStoppedValue()}get units(){return this._units}set units(t){const e=this.min,s=this.max;this._units=t,this.min=e,this.max=s}get state(){return this._oscillator.state}connect(t,e,s){return(t instanceof $||t instanceof Z)&&(this.convert=t.convert,this.units=t.units),Ds(this,t,e,s),this}dispose(){return super.dispose(),this._oscillator.dispose(),this._stoppedSignal.dis
19pose(),this._zeros.dispose(),this._scaler.dispose(),this._a2g.dispose(),this._amplitudeGain.dispose(),this.amplitude.dispose(),this}};function Bo(n,t=1/0){const e=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return e.get(this)},set:function(r){yt(r,n,t),e.set(this,r)}})}}function Te(n,t=1/0){const e=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return e.get(this)},set:function(r){yt(this.toSeconds(r),n,t),e.set(this,r)}})}}var gn=class zo extends ft{constructor(){const t=b(zo.getDefaults(),arguments,["url","onload"]);super(t),this.name="Player",this._activeSources=new Set,this._buffer=new Ct({onload:this._onload.bind(this,t.onload),onerror:t.onerror,reverse:t.reverse,url:t.url}),this.autostart=t.autostart,this._loop=t.loop,this._loopStart=t.loopStart,this._loopEnd=t.loopEnd,this._playbackRate=t.playbackRate,this.fadeIn=t.fadeIn,this.fadeOut=t.fadeOut}static getDefaults(){return Object.assign(ft.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:J,onerror:J,playbackRate:1,reverse:!1})}load(t){return st(this,void 0,void 0,function*(){return yield this._buffer.load(t),this._onload(),this})}_onload(t=J){t(),this.autostart&&this.start()}_onSourceEnd(t){this.onstop(this),this._activeSources.delete(t),this._activeSources.size===0&&!this._synced&&this._state.getValueAtTime(this.now())==="started"&&(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}start(t,e,s){return super.start(t,e,s),this}_start(t,e,s){this._loop?e=Yt(e,this._loopStart):e=Yt(e,0);const i=this.toSeconds(e),r=s;s=Yt(s,Math.max(this._buffer.duration-i,0));let o=this.toSeconds(s);o=o/this._playbackRate,t=this.toSeconds(t);const a=new ls({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);!this._loop&&!this._synced&&(this._state.cancel(t+o),this._state.setStateAtTime("stopped",t+o,{implicitEnd:!0})),this._activeSources.add(a),this._loop&&Wt(r)?a.start(t,i):a.start(t,i,o-this.toSeconds(this.fadeOut))}_stop(t){const e=this.toSeconds(t);this._activeSources.forEach(s=>s.stop(e))}restart(t,e,s){return super.restart(t,e,s),this}_restart(t,e,s){var i;(i=[...this._activeSources].pop())===null||i===void 0||i.stop(t),this._start(t,e,s)}seek(t,e){const s=this.toSeconds(e);if(this._state.getValueAtTime(s)==="started"){const i=this.toSeconds(t);this._stop(s),this._start(s,i)}return this}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get loopStart(){return this._loopStart}set loopStart(t){this._loopStart=t,this.buffer.loaded&&yt(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach(e=>{e.loopStart=t})}get loopEnd(){return this._loopEnd}set loopEnd(t){this._loopEnd=t,this.buffer.loaded&&yt(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach(e=>{e.loopEnd=t})}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._loop}set loop(t){if(this._loop!==t&&(this._loop=t,this._activeSources.forEach(e=>{e.loop=t}),t)){const e=this._state.getNextState("stopped",this.now());e&&this._state.cancel(e.time)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t;const e=this.now(),s=this._state.getNextState("stopped",e);s&&s.implicitEnd&&(this._state.cancel(s.time),this._activeSources.forEach(i=>i.cancelStop())),this._activeSources.forEach(i=>{i.playbackRate.setValueAtTime(t,e)})}get reverse(){return this._buffer.reverse}set reverse(t){this._buffer.reverse=t}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach(t=>t.dispose()),this._activeSources.clear(),this._buffer.dispose(),this}};ce([Te(0)],gn.prototype,"fadeIn",void 0);ce([Te(0)],gn.prototype,"fadeOut",void 0);var pf=class Uo extends M{constructor(){const t=b(Uo.getDefaults(),arguments,["urls","onload"],"urls");super(t),this.name="Players",this.input=void 0,this._players=new Map,this._volume=this.output=new Be({context:this.context,volume:t.volume}),this.volume=this._volume.volume,G(this,"volume"),this._buffers=new dn({urls:t.urls,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.mute=t.mute,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(ft.getDefaults(),{baseUrl:"",fadeIn:0,fadeOut:0,mute:!1,onload:J,onerror:J,urls:{},volume:0})}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}get fadeIn(){return this._fadeIn}
19set fadeIn(t){this._fadeIn=t,this._players.forEach(e=>{e.fadeIn=t})}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t,this._players.forEach(e=>{e.fadeOut=t})}get state(){return Array.from(this._players).some(([t,e])=>e.state==="started")?"started":"stopped"}has(t){return this._buffers.has(t)}player(t){if(j(this.has(t),`No Player with the name ${t} exists on this object`),!this._players.has(t)){const e=new gn({context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,url:this._buffers.get(t)}).connect(this.output);this._players.set(t,e)}return this._players.get(t)}get loaded(){return this._buffers.loaded}add(t,e,s){return j(!this._buffers.has(t),"A buffer with that name already exists on this object"),this._buffers.add(t,e,s),this}stopAll(t){return this._players.forEach(e=>e.stop(t)),this}dispose(){return super.dispose(),this._volume.dispose(),this.volume.dispose(),this._players.forEach(t=>t.dispose()),this._buffers.dispose(),this}},ff=class Go extends ft{constructor(){const t=b(Go.getDefaults(),arguments,["url","onload"]);super(t),this.name="GrainPlayer",this._loopStart=0,this._loopEnd=0,this._activeSources=[],this.buffer=new Ct({onload:t.onload,onerror:t.onerror,reverse:t.reverse,url:t.url}),this._clock=new un({context:this.context,callback:this._tick.bind(this),frequency:1/t.grainSize}),this._playbackRate=t.playbackRate,this._grainSize=t.grainSize,this._overlap=t.overlap,this.detune=t.detune,this.overlap=t.overlap,this.loop=t.loop,this.playbackRate=t.playbackRate,this.grainSize=t.grainSize,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.reverse=t.reverse,this._clock.on("stop",this._onstop.bind(this))}static getDefaults(){return Object.assign(ft.getDefaults(),{onload:J,onerror:J,overlap:.1,grainSize:.2,playbackRate:1,detune:0,loop:!1,loopStart:0,loopEnd:0,reverse:!1})}_start(t,e,s){e=Yt(e,0),e=this.toSeconds(e),t=this.toSeconds(t);const i=1/this._clock.frequency.getValueAtTime(t);this._clock.start(t,e/i),s&&this.stop(t+this.toSeconds(s))}restart(t,e,s){return super.restart(t,e,s),this}_restart(t,e,s){this._stop(t),this._start(t,e,s)}_stop(t){this._clock.stop(t)}_onstop(t){this._activeSources.forEach(e=>{e.fadeOut=0,e.stop(t)}),this.onstop(this)}_tick(t){const e=this._clock.getTicksAtTime(t),s=e*this._grainSize;if(this.log("offset",s),!this.loop&&s>this.buffer.duration){this.stop(t);return}const i=s<this._overlap?0:this._overlap,r=new ls({context:this.context,url:this.buffer,fadeIn:i,fadeOut:this._overlap,loop:this.loop,loopStart:this._loopStart,loopEnd:this._loopEnd,playbackRate:Je(this.detune/100)}).connect(this.output);r.start(t,this._grainSize*e),r.stop(t+this._grainSize/this.playbackRate),this._activeSources.push(r),r.onended=()=>{const o=this._activeSources.indexOf(r);o!==-1&&this._activeSources.splice(o,1)}}get playbackRate(){return this._playbackRate}set playbackRate(t){yt(t,.001),this._playbackRate=t,this.grainSize=this._grainSize}get loopStart(){return this._loopStart}set loopStart(t){this.buffer.loaded&&yt(this.toSeconds(t),0,this.buffer.duration),this._loopStart=this.toSeconds(t)}get loopEnd(){return this._loopEnd}set loopEnd(t){this.buffer.loaded&&yt(this.toSeconds(t),0,this.buffer.duration),this._loopEnd=this.toSeconds(t)}get reverse(){return this.buffer.reverse}set reverse(t){this.buffer.reverse=t}get grainSize(){return this._grainSize}set grainSize(t){this._grainSize=this.toSeconds(t),this._clock.frequency.setValueAtTime(this._playbackRate/this._grainSize,this.now())}get overlap(){return this._overlap}set overlap(t){const e=this.toSeconds(t);yt(e,0),this._overlap=e}get loaded(){return this.buffer.loaded}dispose(){return super.dispose(),this.buffer.dispose(),this._clock.dispose(),this._activeSources.forEach(t=>t.dispose()),this}},Zo=class extends oe{constructor(){super(...arguments),this.name="Abs",this._abs=new be({context:this.context,mapping:n=>Math.abs(n)<.001?0:Math.abs(n)}),this.input=this._abs,this.output=this._abs}dispose(){return super.dispose(),this._abs.dispose(),this}},Qo=class extends oe{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new be({context:this.context,mapping:n=>Math.abs(n)*2-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}},gi=class extends oe{constructor(){super(...arguments),this.name="Negate",this._multiply=new pt({context:this.context,value:-1}),this.input=this._multiply,this.output=this._multiply}dispose(){return super.dispose(),this._multiply.dispose(),this}},Ms=class Xo extends Z{constructor(){super(b(Xo.getDefaults(),arguments,["value"])),this.override=!1,this.name="Subtract",this._sum=new B({context:this.context}),this.input=this._sum,this.output=this._sum,this._neg=new gi({context:this.context}),this.subtrahend=this._param,Zt(this._constantSource,this._neg,this._sum)}static getDefaults(){return Object.assign(Z.getDefaults(),{value:0})}dispose(){return super.dispose(),this._neg.dispose(),this._sum.dispose(),this}},$o=class Yo extends oe{constructor(){super(b(Yo.getDefaults(),arguments)),this.name="GreaterThanZero",this._thresh=this.output=new be({context:this.context,length:127,mapping:t=>t<=0?0:1}),this._scale=this.input=new pt({context:this.context,value:1e4}),this._scale.connect(this._thresh)}dispose(){return super.dispose(),this._scale.dispose(),this._thresh.dispose(),this}},Ho=class Jo extends Z{constructor(){const t=b(Jo.getDefaults(),arguments,["value"]);super(t),this.name="GreaterThan",this.override=!1,this._subtract=this.input=new Ms({context:this.context,value:t.value}),this._gtz=this.output=new $o({context:this.context}),this.comparator=this._param=this._subtract.subtrahend,G(this,"comparator"),this._subtract.connect(this._gtz)}static getDefaults(){return Object.assign(Z.getDefaults(),{value:0})}dispose(){return super.dispose(),this._gtz.dispose(),this._subtract.dispose(),this.comparator.dispose(),this}},Ko=class ta extends Pe{constructor(){const t=b(ta.getDefaults(),arguments,["min","max","exponent"]);super(t),this.name="ScaleExp",this.input=this._exp=new pn({context:this.context,value:t.exponent}),this._exp.connect(this._mult)}static getDefaults(){return Object.assign(Pe.getDefaults(),{exponent:1}
19)}get exponent(){return this._exp.value}set exponent(t){this._exp.value=t}dispose(){return super.dispose(),this._exp.dispose(),this}},mf=class extends Z{constructor(){const n=b(Z.getDefaults(),arguments,["value","units"]);super(n),this.name="SyncedSignal",this.override=!1,this._lastVal=n.value,this._synced=this.context.transport.scheduleRepeat(this._onTick.bind(this),"1i"),this._syncedCallback=this._anchorValue.bind(this),this.context.transport.on("start",this._syncedCallback),this.context.transport.on("pause",this._syncedCallback),this.context.transport.on("stop",this._syncedCallback),this._constantSource.disconnect(),this._constantSource.stop(0),this._constantSource=this.output=new ao({context:this.context,offset:n.value,units:n.units}).start(0),this.setValueAtTime(n.value,0)}_onTick(n){const t=super.getValueAtTime(this.context.transport.seconds);this._lastVal!==t&&(this._lastVal=t,this._constantSource.offset.setValueAtTime(t,n))}_anchorValue(n){const t=super.getValueAtTime(this.context.transport.seconds);this._lastVal=t,this._constantSource.offset.cancelAndHoldAtTime(n),this._constantSource.offset.setValueAtTime(t,n)}getValueAtTime(n){const t=new _t(this.context,n).toSeconds();return super.getValueAtTime(t)}setValueAtTime(n,t){const e=new _t(this.context,t).toSeconds();return super.setValueAtTime(n,e),this}linearRampToValueAtTime(n,t){const e=new _t(this.context,t).toSeconds();return super.linearRampToValueAtTime(n,e),this}exponentialRampToValueAtTime(n,t){const e=new _t(this.context,t).toSeconds();return super.exponentialRampToValueAtTime(n,e),this}setTargetAtTime(n,t,e){const s=new _t(this.context,t).toSeconds();return super.setTargetAtTime(n,s,e),this}cancelScheduledValues(n){const t=new _t(this.context,n).toSeconds();return super.cancelScheduledValues(t),this}setValueCurveAtTime(n,t,e,s){const i=new _t(this.context,t).toSeconds();return e=this.toSeconds(e),super.setValueCurveAtTime(n,i,e,s),this}cancelAndHoldAtTime(n){const t=new _t(this.context,n).toSeconds();return super.cancelAndHoldAtTime(t),this}setRampPoint(n){const t=new _t(this.context,n).toSeconds();return super.setRampPoint(t),this}exponentialRampTo(n,t,e){const s=new _t(this.context,e).toSeconds();return super.exponentialRampTo(n,t,s),this}linearRampTo(n,t,e){const s=new _t(this.context,e).toSeconds();return super.linearRampTo(n,t,s),this}targetRampTo(n,t,e){const s=new _t(this.context,e).toSeconds();return super.targetRampTo(n,t,s),this}dispose(){return super.dispose(),this.context.transport.clear(this._synced),this.context.transport.off("start",this._syncedCallback),this.context.transport.off("pause",this._syncedCallback),this.context.transport.off("stop",this._syncedCallback),this._constantSource.dispose(),this}},Pt=class ea extends M{constructor(){const t=b(ea.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="Envelope",this._sig=new Z({context:this.context,value:0}),this.output=this._sig,this.input=void 0,this.attack=t.attack,this.decay=t.decay,this.sustain=t.sustain,this.release=t.release,this.attackCurve=t.attackCurve,this.releaseCurve=t.releaseCurve,this.decayCurve=t.decayCurve}static getDefaults(){return Object.assign(M.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(t,e){if(re(t))return t;{let s;for(s in Rs)if(Rs[s][e]===t)return s;return t}}_setCurve(t,e,s){if(re(s)&&Reflect.has(Rs,s)){const i=Rs[s];we(i)?t!=="_decayCurve"&&(this[t]=i[e]):this[t]=i}else if(kt(s)&&t!=="_decayCurve")this[t]=s;else throw new Error("Envelope: invalid curve: "+s)}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(t){this._setCurve("_attackCurve","In",t)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(t){this._setCurve("_releaseCurve","Out",t)}get decayCurve(){return this._getCurve(this._decayCurve,"Out")}set decayCurve(t){this._setCurve("_decayCurve","Out",t)}triggerAttack(t,e=1){this.log("triggerAttack",t,e),t=this.toSeconds(t);let s=this.toSeconds(this.attack);const i=this.toSeconds(this.decay),r=this.getValueAtTime(t);if(r>0){const o=1/s;s=(1-r)/o}if(s<this.sampleTime)this._sig.cancelScheduledValues(t),this._sig.setValueAtTime(e,t);else if(this._attackCurve==="linear")this._sig.linearRampTo(e,s,t);else if(this._attackCurve==="exponential")this._sig.targetRampTo(e,s,t);else{this._sig.cancelAndHoldAtTime(t);let o=this._attackCurve;for(let a=1;a<o.length;a++)if(o[a-1]<=r&&r<=o[a]){o=this._attackCurve.slice(a),o[0]=r;break}this._sig.setValueCurveAtTime(o,t,s,e)}if(i&&this.sustain<1){const o=e*this.sustain,a=t+s;this.log("decay",a),this._decayCurve==="linear"?this._sig.linearRampToValueAtTime(o,i+a):this._sig.exponentialApproachValueAtTime(o,a,i)}return this}triggerRelease(t){this.log("triggerRelease",t),t=this.toSeconds(t);const e=this.getValueAtTime(t);if(e>0){const s=this.toSeconds(this.release);s<this.sampleTime?this._sig.setValueAtTime(0,t):this._releaseCurve==="linear"?this._sig.linearRampTo(0,s,t):this._releaseCurve==="exponential"?this._sig.targetRampTo(0,s,t):(j(kt(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(this._releaseCurve,t,s,e))}return this}getValueAtTime(t){return this._sig.getValueAtTime(t)}triggerAttackRelease(t,e,s=1){return e=this.toSeconds(e),this.triggerAttack(e,s),this.triggerRelease(e+this.toSeconds(t)),this}cancel(t){return this._sig.cancelScheduledValues(this.toSeconds(t)),this}connect(t,e=0,s=0){return Ds(this,t,e,s),this}asArray(){return st(this,arguments,void 0,function*(t=1024){const e=t/this.context.sampleRate,s=new cs(1,e,this.context.sampleRate),i=this.toSeconds(this.attack)+this.toSeconds(this.decay),r=i+this.toSeconds(this.release),o=r*.1,a=r+o,c=new this.constructor(Object.assign(this.get(),{attack:e*this.toSeconds(this.attack)/a,decay:e*this.toSeconds(this.decay)/a,release:e*this.toSeconds(this.release)/a,c
19ontext:s}));return c._sig.toDestination(),c.triggerAttackRelease(e*(i+o)/a,0),(yield s.render()).getChannelData(0)})}dispose(){return super.dispose(),this._sig.dispose(),this}};ce([Te(0)],Pt.prototype,"attack",void 0);ce([Te(0)],Pt.prototype,"decay",void 0);ce([Bo(0,1)],Pt.prototype,"sustain",void 0);ce([Te(0)],Pt.prototype,"release",void 0);var Rs=(()=>{let t,e;const s=[];for(t=0;t<128;t++)s[t]=Math.sin(t/127*(Math.PI/2));const i=[],r=6.4;for(t=0;t<127;t++)e=t/127,i[t]=(Math.sin(e*(Math.PI*2)*r-Math.PI/2)+1)/10+e*.83;i[127]=1;const o=[],a=5;for(t=0;t<128;t++)o[t]=Math.ceil(t/127*a)/a;const c=[];for(t=0;t<128;t++)e=t/127,c[t]=.5*(1-Math.cos(Math.PI*e));const h=[];for(t=0;t<128;t++){e=t/127;const d=Math.pow(e,3)*4+.2,f=Math.cos(d*Math.PI*2*e);h[t]=Math.abs(f*(1-e))}function l(d){const f=new Array(d.length);for(let p=0;p<d.length;p++)f[p]=1-d[p];return f}function u(d){return d.slice(0).reverse()}return{bounce:{In:l(h),Out:h},cosine:{In:s,Out:u(s)},exponential:"exponential",linear:"linear",ripple:{In:i,Out:l(i)},sine:{In:c,Out:l(c)},step:{In:o,Out:l(o)}}})(),le=class sa extends M{constructor(){const t=b(sa.getDefaults(),arguments);super(t),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease,this._syncedRelease=e=>this._original_triggerRelease(e),this._volume=this.output=new Be({context:this.context,volume:t.volume}),this.volume=this._volume.volume,G(this,"volume")}static getDefaults(){return Object.assign(M.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}_syncState(){let t=!1;return this._synced||(this._synced=!0,t=!0),t}_syncMethod(t,e){const s=this["_original_"+t]=this[t];this[t]=(...i)=>{const r=i[e],o=this.context.transport.schedule(a=>{i[e]=a,s.apply(this,i)},r);this._scheduledEvents.push(o)}}unsync(){return this._scheduledEvents.forEach(t=>this.context.transport.clear(t)),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease,this.context.transport.off("stop",this._syncedRelease),this.context.transport.off("pause",this._syncedRelease),this.context.transport.off("loopEnd",this._syncedRelease)),this}triggerAttackRelease(t,e,s,i){const r=this.toSeconds(s),o=this.toSeconds(e);return this.triggerAttack(t,r,i),this.triggerRelease(r+o),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}},qt=class na extends le{constructor(){const t=b(na.getDefaults(),arguments);super(t),this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(le.getDefaults(),{detune:0,onsilence:J,portamento:0})}triggerAttack(t,e,s=1){this.log("triggerAttack",t,e,s);const i=this.toSeconds(e);return this._triggerEnvelopeAttack(i,s),this.setNote(t,i),this}triggerRelease(t){this.log("triggerRelease",t);const e=this.toSeconds(t);return this._triggerEnvelopeRelease(e),this}setNote(t,e){const s=this.toSeconds(e),i=t instanceof he?t.toFrequency():t;if(this.portamento>0&&this.getLevelAtTime(s)>.05){const r=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(i,r,s)}else this.frequency.setValueAtTime(i,s);return this}};ce([Te(0)],qt.prototype,"portamento",void 0);var vn=class ia extends Pt{constructor(){super(b(ia.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new B({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}
vendor: 4,969 bytes, line 19
19dispose(){return super.dispose(),this._gainNode.dispose(),this}},es=class ra extends qt{constructor(){const t=b(ra.getDefaults(),arguments);super(t),this.name="Synth",this.oscillator=new Ve(Object.assign({context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)},t.oscillator)),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new vn(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),G(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(qt.getDefaults(),{envelope:Object.assign(St(Pt.getDefaults(),Object.keys(M.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(St(Ve.getDefaults(),[...Object.keys(ft.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(t,e){if(this.envelope.triggerAttack(t,e),this.oscillator.start(t),this.envelope.sustain===0){const s=this.toSeconds(this.envelope.attack),i=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+s+i)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}},Nn=class oa extends qt{constructor(){const t=b(oa.getDefaults(),arguments);super(t),this.name="ModulationSynth",this._carrier=new es({context:this.context,oscillator:t.oscillator,envelope:t.envelope,onsilence:()=>this.onsilence(this),volume:-10}),this._modulator=new es({context:this.context,oscillator:t.modulation,envelope:t.modulationEnvelope,volume:-10}),this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope,this.modulation=this._modulator.oscillator,this.modulationEnvelope=this._modulator.envelope,this.frequency=new Z({context:this.context,units:"frequency"}),this.detune=new Z({context:this.context,value:t.detune,units:"cents"}),this.harmonicity=new pt({context:this.context,value:t.harmonicity,minValue:0}),this._modulationNode=new B({context:this.context,gain:0}),G(this,["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])}static getDefaults(){return Object.assign(qt.getDefaults(),{harmonicity:3,oscillator:Object.assign(St(Ve.getDefaults(),[...Object.keys(ft.getDefaults()),"frequency","detune"]),{type:"sine"}),envelope:Object.assign(St(Pt.getDefaults(),Object.keys(M.getDefaults())),{attack:.01,decay:.01,sustain:1,release:.5}),modulation:Object.assign(St(Ve.getDefaults(),[...Object.keys(ft.getDefaults()),"frequency","detune"]),{type:"square"}),modulationEnvelope:Object.assign(St(Pt.getDefaults(),Object.keys(M.getDefaults())),{attack:.5,decay:0,sustain:1,release:.5})})}_triggerEnvelopeAttack(t,e){this._carrier._triggerEnvelopeAttack(t,e),this._modulator._triggerEnvelopeAttack(t,e)}_triggerEnvelopeRelease(t){return this._carrier._triggerEnvelopeRelease(t),this._modulator._triggerEnvelopeRelease(t),this}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this._carrier.dispose(),this._modulator.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._modulationNode.dispose(),this}},_f=class aa extends Nn{constructor(){super(b(aa.getDefaults(),arguments)),this.name="AMSynth",this._modulationScale=new fn({context:this.context}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output)}dispose(){return super.dispose(),this._modulationScale.dispose(),this}},Rn=class ca extends M{constructor(){const t=b(ca.getDefaults(),arguments,["frequency","type"]);super(t),this.name="BiquadFilter",this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new $({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new $({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new $({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new $({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(M.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){j(["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t)!==-1,`Invalid filter type: ${t}`),this._filter.type=t}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let o=0;o<t;o++)e[o]=Math.pow(o/t,2)*19980+20;const s=new Float32Array(t),i=new Float32Array(t),r=this.context.createBiquadFilter();
19return r.type=this.type,r.Q.value=this.Q.value,r.frequency.value=this.frequency.value,r.gain.value=this.gain.value,r.getFrequencyResponse(e,s,i),s}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}},te=class ha extends M{constructor(){const t=b(ha.getDefaults(),arguments,["frequency","type","rolloff"]);super(t),this.name="Filter",this.input=new B({context:this.context}),this.output=new B({context:this.context}),this._filters=[],this._filters=[],this.Q=new Z({context:this.context,units:"positive",value:t.Q}),this.frequency=new Z({context:this.context,units:"frequency",value:t.frequency}),this.detune=new Z({context:this.context,units:"cents",value:t.detune}),this.gain=new Z({context:this.context,units:"decibels",convert:!1,value:t.gain}),this._type=t.type,this.rolloff=t.rolloff,G(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(M.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){j(["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t)!==-1,`Invalid filter type: ${t}`),this._type=t,this._filters.forEach(e=>e.type=t)}get rolloff(){return this._rolloff}set rolloff(t){const e=Gt(t)?t:parseInt(t,10),s=[-12,-24,-48,-96];let i=s.indexOf(e);j(i!==-1,`rolloff can only be ${s.join(", ")}`),i+=1,this._rolloff=e,this.input.disconnect(),this._filters.forEach(r=>r.disconnect()),this._filters=new Array(i);for(let r=0;r<i;r++){const o=new Rn({context:this.context});o.type=this._type,this.frequency.connect(o.frequency),this.detune.connect(o.detune),this.Q.connect(o.Q),this.gain.connect(o.gain),this._filters[r]=o}this._internalChannels=this._filters,Zt(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new Rn({context:this.context,frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),s=new Float32Array(t).map(()=>1);return this._filters.forEach(()=>{e.getFrequencyResponse(t).forEach((i,r)=>s[r]*=i)}),e.dispose(),s}dispose(){return super.dispose(),this._filters.forEach(t=>{t.dispose()}),Cs(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}},Fn=class la extends Pt{constructor(){const t=b(la.getDefaults(),arguments,["attack","decay","sustain","release"]);super(t),this.name="FrequencyEnvelope",this._octaves=t.octaves,this._baseFrequency=this.toFrequency(t.baseFrequency),this._exponent=this.input=new pn({context:this.context,value:t.exponent}),this._scale=this.output=new Pe({context:this.context,min:this._baseFrequency,max:this._baseFrequency*Math.pow(2,this._octaves)}),this._sig.chain(this._exponent,this._scale)}static getDefaults(){return Object.assign(Pt.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);yt(e,0),this._baseFrequency=e,this._scale.min=this._baseFrequency,this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._scale.max=this._baseFrequency*Math.pow(2,t)}get exponent(){return this._exponent.value}set exponent(t){this._exponent.value=t}dispose(){return super.dispose(),this._exponent.dispose(),this._scale.dispose(),this}},ms=class ua extends qt{constructor(){const t=b(ua.getDefaults(),arguments);super(t),this.name="MonoSynth",this.oscillator=new Ve(Object.assign(t.oscillator,{context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)})),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.filter=new te(Object.assign(t.filter,{context:this.context})),this.filterEnvelope=new Fn(Object.assign(t.filterEnvelope,{context:this.context})),this.envelope=new vn(Object.assign(t.envelope,{context:this.context})),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),G(this,["oscillator","frequency","detune","filter","filterEnvelope","envelope"])}static getDefaults(){return Object.assign(qt.getDefaults(),{envelope:Object.assign(St(Pt.getDefaults(),Object.keys(M.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.9}),filter:Object.assign(St(te.getDefaults(),Object.keys(M.getDefaults())),{Q:1,rolloff:-12,type:"lowpass"}),filterEnvelope:Object.assign(St(Fn.getDefaults(),Object.keys(M.getDefaults())),{attack:.6,baseFrequency:200,decay:.2,exponent:2,octaves:3,release:2,sustain:.5}),oscillator:Object.assign(St(Ve.getDefaults(),Object.keys(ft.getDefaults())),{type:"sawtooth"})})}_triggerEnvelopeAttack(t,e=1){if(this.envelope.triggerAttack(t,e),this.filterEnvelope.triggerAttack(t),this.oscillator.start(t),this.envelope.sustain===0){const s=this.toSeconds(this.envelope.attack),i=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+s+i)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.filterEnvelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dis
vendor: 4,593 bytes, line 19
19pose(),this.filterEnvelope.dispose(),this.filter.dispose(),this}},gf=class da extends qt{constructor(){const t=b(da.getDefaults(),arguments);super(t),this.name="DuoSynth",this.voice0=new ms(Object.assign(t.voice0,{context:this.context,onsilence:()=>this.onsilence(this)})),this.voice1=new ms(Object.assign(t.voice1,{context:this.context})),this.harmonicity=new pt({context:this.context,units:"positive",value:t.harmonicity}),this._vibrato=new Ut({frequency:t.vibratoRate,context:this.context,min:-50,max:50}),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new B({context:this.context,units:"normalRange",gain:t.vibratoAmount}),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new Z({context:this.context,units:"frequency",value:440}),this.detune=new Z({context:this.context,units:"cents",value:t.detune}),this.frequency.connect(this.voice0.frequency),this.frequency.chain(this.harmonicity,this.voice1.frequency),this._vibrato.connect(this._vibratoGain),this._vibratoGain.fan(this.voice0.detune,this.voice1.detune),this.detune.fan(this.voice0.detune,this.voice1.detune),this.voice0.connect(this.output),this.voice1.connect(this.output),G(this,["voice0","voice1","frequency","vibratoAmount","vibratoRate"])}getLevelAtTime(t){return t=this.toSeconds(t),this.voice0.envelope.getValueAtTime(t)+this.voice1.envelope.getValueAtTime(t)}static getDefaults(){return $t(qt.getDefaults(),{vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:$t(St(ms.getDefaults(),Object.keys(qt.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}),voice1:$t(St(ms.getDefaults(),Object.keys(qt.getDefaults())),{filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}})})}_triggerEnvelopeAttack(t,e){this.voice0._triggerEnvelopeAttack(t,e),this.voice1._triggerEnvelopeAttack(t,e)}_triggerEnvelopeRelease(t){return this.voice0._triggerEnvelopeRelease(t),this.voice1._triggerEnvelopeRelease(t),this}dispose(){return super.dispose(),this.voice0.dispose(),this.voice1.dispose(),this.frequency.dispose(),this.detune.dispose(),this._vibrato.dispose(),this.vibratoRate.dispose(),this._vibratoGain.dispose(),this.harmonicity.dispose(),this}},vf=class pa extends Nn{constructor(){const t=b(pa.getDefaults(),arguments);super(t),this.name="FMSynth",this.modulationIndex=new pt({context:this.context,value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output)}static getDefaults(){return Object.assign(Nn.getDefaults(),{modulationIndex:10})}dispose(){return super.dispose(),this.modulationIndex.dispose(),this}},tr=[1,1.483,1.932,2.546,2.63,3.897],yf=class fa extends qt{constructor(){const t=b(fa.getDefaults(),arguments);super(t),this.name="MetalSynth",this._oscillators=[],this._freqMultipliers=[],this.detune=new Z({context:this.context,units:"cents",value:t.detune}),this.frequency=new Z({context:this.context,units:"frequency"}),this._amplitude=new B({context:this.context,gain:0}).connect(this.output),this._highpass=new te({Q:0,context:this.context,type:"highpass"}).connect(this._amplitude);for(let e=0;e<tr.length;e++){const s=new mn({context:this.context,harmonicity:t.harmonicity,modulationIndex:t.modulationIndex,modulationType:"square",onstop:e===0?()=>this.onsilence(this):J,type:"square"});s.connect(this._highpass),this._oscillators[e]=s;const i=new pt({context:this.context,value:tr[e]});this._freqMultipliers[e]=i,this.frequency.chain(i,s.frequency),this.detune.connect(s.detune)}this._filterFreqScaler=new Pe({context:this.context,max:7e3,min:this.toFrequency(t.resonance)}),this.envelope=new Pt({attack:t.envelope.attack,attackCurve:"linear",context:this.context,decay:t.envelope.decay,release:t.envelope.release,sustain:0}),this.envelope.chain(this._filterFreqScaler,this._highpass.frequency),this.envelope.connect(this._amplitude.gain),this._octaves=t.octaves,this.octaves=t.octaves}static getDefaults(){return $t(qt.getDefaults(),{envelope:Object.assign(St(Pt.getDefaults(),Object.keys(M.getDefaults())),{attack:.001,decay:1.4,release:.2}),harmonicity:5.1,modulationIndex:32,octaves:1.5,resonance:4e3})}_triggerEnvelopeAttack(t,e=1){return this.envelope.triggerAttack(t,e),this._oscillators.forEac
19h(s=>s.start(t)),this.envelope.sustain===0&&this._oscillators.forEach(s=>{s.stop(t+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay))}),this}_triggerEnvelopeRelease(t){return this.envelope.triggerRelease(t),this._oscillators.forEach(e=>e.stop(t+this.toSeconds(this.envelope.release))),this}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}get modulationIndex(){return this._oscillators[0].modulationIndex.value}set modulationIndex(t){this._oscillators.forEach(e=>e.modulationIndex.value=t)}get harmonicity(){return this._oscillators[0].harmonicity.value}set harmonicity(t){this._oscillators.forEach(e=>e.harmonicity.value=t)}get resonance(){return this._filterFreqScaler.min}set resonance(t){this._filterFreqScaler.min=this.toFrequency(t),this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._filterFreqScaler.max=this._filterFreqScaler.min*Math.pow(2,t)}dispose(){return super.dispose(),this._oscillators.forEach(t=>t.dispose()),this._freqMultipliers.forEach(t=>t.dispose()),this.frequency.dispose(),this.detune.dispose(),this._filterFreqScaler.dispose(),this._amplitude.dispose(),this.envelope.dispose(),this._highpass.dispose(),this}},vi=class ma extends es{constructor(){const t=b(ma.getDefaults(),arguments);super(t),this.name="MembraneSynth",this.portamento=0,this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,G(this,["oscillator","envelope"])}static getDefaults(){return $t(qt.getDefaults(),es.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(t,e){const s=this.toSeconds(e),i=this.toFrequency(t instanceof he?t.toFrequency():t),r=i*this.octaves;return this.oscillator.frequency.setValueAtTime(r,s),this.oscillator.frequency.exponentialRampToValueAtTime(i,s+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}};ce([Bo(0)],vi.prototype,"octaves",void 0);ce([Te(0)],vi.prototype,"pitchDecay",void 0);var wf=class _a extends le{constructor(){const t=b(_a.getDefaults(),arguments);super(t),this.name="NoiseSynth",this.noise=new ts(Object.assign({context:this.context},t.noise)),this.envelope=new vn(Object.assign({context:this.context},t.envelope)),this.noise.chain(this.envelope,this.output)}static getDefaults(){return Object.assign(le.getDefaults(),{envelope:Object.assign(St(Pt.getDefaults(),Object.keys(M.getDefaults())),{decay:.1,sustain:0}),noise:Object.assign(St(ts.getDefaults(),Object.keys(ft.getDefaults())),{type:"white"})})}triggerAttack(t,e=1){return t=this.toSeconds(t),this.envelope.triggerAttack(t,e),this.noise.start(t),this.envelope.sustain===0&&this.noise.stop(t+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay)),this}triggerRelease(t){return t=this.toSeconds(t),this.envelope.triggerRelease(t),this.noise.stop(t+this.toSeconds(this.envelope.release)),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0)),this}triggerAttackRelease(t,e,s=1){return e=this.toSeconds(e),t=this.toSeconds(t),this.triggerAttack(e,s),this.triggerRelease(e+t),this}dispose(){return super.dispose(),this.noise.dispose(),this.envelope.dispose(),this}},yi=new Set;function wi(n){yi.add(n)}function ga(n,t){const e=`registerProcessor("${n}", ${t})`;yi.add(e)}function xf(){return Array.from(yi).join(` 20`)}var In=class extends M{constructor(n){super(n),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=J;const t=URL.createObjectURL(new Blob([xf()],{type:"text/javascript"})),e=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(t).then(()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(e,this.workletOptions),this._worklet.onprocessorerror=this.onprocessorerror.bind(this),this.onReady(this._worklet))})}dispose(){return super.dispose(),this._dummyGain.disconnect(),this._worklet&&(this._worklet.port.postMessage("dispose"),this._worklet.disconnect()),this}};wi(` 21 /** 22 * The base AudioWorkletProcessor for use in Tone.js. Works with the {@link ToneAudioWorklet}. 23 */ 24 class ToneAudioWorkletProcessor extends AudioWorkletProcessor { 25 26 constructor(options) { 27 28 super(options); 29 /** 30 * If the processor was disposed or not. Keep alive until it's disposed. 31 */ 32 this.disposed = false;
33 /** 34 * The number of samples in the processing block 35 */ 36 this.blockSize = 128; 37 /** 38 * the sample rate 39 */ 40 this.sampleRate = sampleRate; 41 42 this.port.onmessage = (event) => { 43 // when it receives a dispose 44 if (event.data === "dispose") { 45 this.disposed = true; 46 } 47 }; 48 } 49 } 50`);var bf=` 51 /** 52 * Abstract class for a single input/output processor. 53 * has a 'generate' function which processes one sample at a time 54 */ 55 class SingleIOProcessor extends ToneAudioWorkletProcessor { 56 57 constructor(options) { 58 super(Object.assign(options, { 59 numberOfInputs: 1, 60 numberOfOutputs: 1 61 })); 62 /** 63 * Holds the name of the parameter and a single value of that 64 * parameter at the current sample 65 * @type { [name: string]: number } 66 */ 67 this.params = {} 68 } 69 70 /** 71 * Generate an output sample from the input sample and parameters 72 * @abstract 73 * @param input number 74 * @param channel number 75 * @param parameters { [name: string]: number } 76 * @returns number 77 */ 78 generate(){} 79 80 /** 81 * Update the private params object with the 82 * values of the parameters at the given index 83 * @param parameters { [name: string]: Float32Array }, 84 * @param index number 85 */ 86 updateParams(parameters, index) { 87 for (const paramName in parameters) { 88 const param = parameters[paramName]; 89 if (param.length > 1) { 90 this.params[paramName] = parameters[paramName][index]; 91 } else { 92 this.params[paramName] = parameters[paramName][0]; 93 } 94 } 95 } 96 97 /** 98 * Process a single frame of the audio 99 * @param inputs Float32Array[][] 100 * @param outputs Float32Array[][] 101 */ 102 process(inputs, outputs, parameters) { 103 const input = inputs[0]; 104 const output = outputs[0]; 105 // get the parameter values 106 const channelCount = Math.max(input && input.length || 0, output.length); 107 for (let sample = 0; sample < this.blockSize; sample++) { 108 this.updateParams(parameters, sample); 109 for (let channel = 0; channel < channelCount; channel++) { 110 const inputSample = input && input.length ? input[channel][sample] : 0; 111 output[channel][sample] = this.generate(inputSample, channel, this.params); 112 } 113 } 114 return !this.disposed; 115 } 116 }; 117`;wi(bf);wi(` 118 /** 119 * A multichannel buffer for use within an AudioWorkletProcessor as a delay line 120 */ 121 class DelayLine { 122 123 constructor(size, channels) { 124 this.buffer = []; 125 this.writeHead = [] 126 this.size = size; 127 128 // create the empty channels 129 for (let i = 0; i < channels; i++) { 130 this.buffer[i] = new Float32Array(this.size); 131 this.writeHead[i] = 0; 132 } 133 } 134 135 /** 136 * Push a value onto the end 137 * @param channel number 138 * @param value number 139 */ 140 push(channel, value) { 141 this.writeHead[channel] += 1; 142 if (this.writeHead[channel] > this.size) { 143 this.writeHead[channel] = 0; 144 } 145 this.buffer[channel][this.writeHead[channel]] = value; 146 } 147 148 /** 149 * Get the recorded value of the channel given the delay 150 * @param channel number 151 * @param delay number delay samples 152 */ 153 get(channel, delay) { 154 let readHead = this.writeHead[channel] - Math.floor(delay); 155 if (readHead < 0) { 156 readHead += this.size; 157 } 158 return this.buffer[channel][readHead]; 159 } 160 } 161`);var va="feedback-comb-filter";ga(va,` 162 class FeedbackCombFilterWorklet extends SingleIOProcessor { 163 164 constructor(options) { 165 super(options); 166 this.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2); 167 } 168 169 static get parameterDescriptors() { 170 return [{ 171 name: "delayTime", 172 defaultValue: 0.1, 173 minValue: 0, 174 maxValue: 1, 175 automationRate: "k-rate" 176 }, { 177 name: "feedback", 178 defaultValue: 0.5, 179 minValue: 0, 180 maxValue: 0.9999, 181 automationRate: "k-rate" 182 }]; 183 } 184 185 generate(input, channel, parameters) { 186 const delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate); 187 this.delayLine.push(channel, input + delayedSample * parameters.feedback); 188 return delayedSample; 189 } 190 } 191`);var xi=class ya extends In{constructor(){const t=b(ya.getDefaults(),arguments,["delayTime","resonance"]);super(t),this.name="FeedbackCombFilter",this.input=new B({context:this.context}),this.output=new B({context:this.context}),this.delayTime=new $({context:this.context,value:t.delayTime,units:"time",minValue:0,maxValue:1,param:this._dummyParam,swappable:!0}),this.resonance=new $({context:this.context,value:t.resonance,units:"normalRange",param:this._dummyParam,swappable:!0}),G(this,["resonance","delayTime"])}_audioWorkletName(){return va}static getDefaults(){return Object.assign(M.getDefaults(),{delayTime:.1,resonance:.5})}onReady(t){Zt(this.input,t,this.output);const e=t.parameters.get("delayTime");this.delayTime.setParam(e);const s=t.parameters.get("feedback");this.resonance.setParam(s)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.delayTime.dispose(),this.resonance.dispose(),this}},bi=class wa extends M{constructor(){const t=b(wa.getDefaults(),arguments,["frequency","type"]);super(t),this.name="OnePoleFilter",this._frequency=t.frequency,this._type=t.type,this.input=new B({context:this.context}),this.output=new B({context:this.context}),this._createFilter()}static getDefaults(){return Object.assign(M.getDefaults(),{frequency:880,type:"lowpass"})}_createFilter(){const t=this._filter,e=this.toFrequency(this._frequency),s=1/(2*Math.PI*e);if(this._type==="lowpass"){const i=1/(s*this.context.sampleRate),r=i-1;this._filter=this.context.createIIRFilter([i,0],[1,r])}else{const i=1/(s*this.context.sampleRate)-1;this._filter=this.context.createIIRFilter([1,-1],[1,i])}this.input.chain(this._filter,this.output),t&&this.context.setTimeout(()=>{this.disposed||(this.input.disconnect(t),t.disconnect())},this.blockTime)}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this._createFilter()}get type(){return this._type}set type(t){this._type=t,this._createFilter()}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let r=0;r<t;r++)e[r]=Math.pow(r/t,2)*19980+20;const s=new Float32Array(t),i=new Float32Array(t);return this._filter.getFrequencyResponse(e,s,i),s}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this._filter.disconnect(),this}},Ti=class xa extends M{constructor(){const t=b(xa.getDefaults(),arguments,["delayTime","resonance","dampening"]);super(t),this.name="LowpassCombFilter",this._combFilter=this.output=new xi({context:this.context,delayTime:t.delayTime,resonance:t.resonance}),this.delayTime=this._combFilter.delayTime,this.resonance=this._combFilter.resonance,this._lowpass=this.input=new bi({context:this.context,frequency:t.dampening,type:"lowpass"}),this._lowpass.connect(this._combFilter)}static getDefaults(){return Object.assign(M.getDefaults(),{dampening:3e3,delayTime:.1,resonance:.5})}get dampening(){return this._lowpass.frequency}set dampening(t){this._lowpass.frequency=t}dispose(){return super.dispose(),this._combFilter.dispose(),this._lowpass.dispose(),this}},Tf=class ba extends le{constructor(){const t=b(ba.getDefaults(),arguments);super(t),this.name="PluckSynth",this._noise=new ts({context:this.context,type:"pink"}),this.attackNoise=t.attackNoise,this._lfcf=new Ti({context:this.context,dampening:t.dampening,resonance:t.resonance}),this.resonance=t.resonance,this.release=t.release,this._noise.connect(this._lfcf),this._lfcf.connect(this.output)}static getDefaults(){return $t(le.getDefaults(),{attackNoise:1,dampening:4e3,resonance:.7,release:1})}get dampening(){return this._lfcf.dampening}set dampening(t){this._lfcf.dampening=t}triggerAttack(t,e){const s=this.toFrequency(t);e=this.toSeconds(e);const i=1/s;return this._lfcf.delayTime.setValueAtTime(i,e),this._noise.start(e),this._noise.stop(e+i*this.attackNoise),this._lfcf.resonance.cancelScheduledValues(e),this._lfcf.resonance.setValueAtTime(this.resonance,e),this}triggerRelease(t){return this._lfcf.resonance.linearRampTo(0,this.release,t),this}dispose(){return super.dispose(),this._noise.dispose(),this._lfcf.dispose(),this}},Sf=class Ta extends le{constructor(){const t=b(Ta.getDefaults(),arguments,["voice","options"]);
191super(t),this.name="PolySynth",this._availableVoices=[],this._activeVoices=[],this._voices=[],this._gcTimeout=-1,this._averageActiveVoices=0,this._syncedRelease=i=>this.releaseAll(i),j(!Gt(t.voice),"DEPRECATED: The polyphony count is no longer the first argument.");const e=t.voice.getDefaults();this.options=Object.assign(e,t.options),this.voice=t.voice,this.maxPolyphony=t.maxPolyphony,this._dummyVoice=this._getNextAvailableVoice();const s=this._voices.indexOf(this._dummyVoice);this._voices.splice(s,1),this._gcTimeout=this.context.setInterval(this._collectGarbage.bind(this),1)}static getDefaults(){return Object.assign(le.getDefaults(),{maxPolyphony:32,options:{},voice:es})}get activeVoices(){return this._activeVoices.length}_makeVoiceAvailable(t){this._availableVoices.push(t);const e=this._activeVoices.findIndex(s=>s.voice===t);this._activeVoices.splice(e,1)}_getNextAvailableVoice(){if(this._availableVoices.length)return this._availableVoices.shift();if(this._voices.length<this.maxPolyphony){const t=new this.voice(Object.assign(this.options,{context:this.context,onsilence:this._makeVoiceAvailable.bind(this)}));return j(t instanceof qt,"Voice must extend Monophonic class"),t.connect(this.output),this._voices.push(t),t}else as("Max polyphony exceeded. Note dropped.")}_collectGarbage(){if(this._averageActiveVoices=Math.max(this._averageActiveVoices*.95,this.activeVoices),this._availableVoices.length&&this._voices.length>Math.ceil(this._averageActiveVoices+1)){const t=this._availableVoices.shift(),e=this._voices.indexOf(t);this._voices.splice(e,1),this.context.isOffline||t.dispose()}}_triggerAttack(t,e,s){t.forEach(i=>{const r=new Hs(this.context,i).toMidi(),o=this._getNextAvailableVoice();o&&(o.triggerAttack(i,e,s),this._activeVoices.push({midi:r,voice:o,released:!1}),this.log("triggerAttack",i,e))})}_triggerRelease(t,e){t.forEach(s=>{const i=new Hs(this.context,s).toMidi(),r=this._activeVoices.find(({midi:o,released:a})=>o===i&&!a);r&&(r.voice.triggerRelease(e),r.released=!0,this.log("triggerRelease",s,e))})}_scheduleEvent(t,e,s,i){j(!this.disposed,"Synth was already disposed"),s<=this.now()?t==="attack"?this._triggerAttack(e,s,i):this._triggerRelease(e,s):this.context.setTimeout(()=>{this.disposed||this._scheduleEvent(t,e,s,i)},s-this.now())}triggerAttack(t,e,s){Array.isArray(t)||(t=[t]);const i=this.toSeconds(e);return this._scheduleEvent("attack",t,i,s),this}triggerRelease(t,e){Array.isArray(t)||(t=[t]);const s=this.toSeconds(e);return this._scheduleEvent("release",t,s),this}triggerAttackRelease(t,e,s,i){const r=this.toSeconds(s);if(this.triggerAttack(t,r,i),kt(e)){j(kt(t),"If the duration is an array, the notes must also be an array"),t=t;for(let o=0;o<t.length;o++){const a=e[Math.min(o,e.length-1)],c=this.toSeconds(a);j(c>0,"The duration must be greater than 0"),this.triggerRelease(t[o],r+c)}}else{const o=this.toSeconds(e);j(o>0,"The duration must be greater than 0"),this.triggerRelease(t,r+o)}return this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this.context.transport.on("stop",this._syncedRelease),this.context.transport.on("pause",this._syncedRelease),this.context.transport.on("loopEnd",this._syncedRelease)),this}set(t){const e=St(t,["onsilence","context"]);return this.options=$t(this.options,e),this._voices.forEach(s=>s.set(e)),this._dummyVoice.set(e),this}get(){return this._dummyVoice.get()}releaseAll(t){const e=this.toSeconds(t);return this._activeVoices.forEach(({voice:s})=>{s.triggerRelease(e)}),this}dispose(){return super.dispose(),this._dummyVoice.dispose(),this._voices.forEach(t=>t.dispose()),this._activeVoices=[],this._availableVoices=[],this.context.clearInterval(this._gcTimeout),this}},Si=class Sa extends le{constructor(){const t=b(Sa.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");super(t),this.name="Sampler",this._activeSources=new Map;const e={};Object.keys(t.urls).forEach(s=>{const i=parseInt(s,10);if(j(ps(s)||Gt(i)&&isFinite(i),`url key is neither a note or midi pitch: ${s}`),ps(s)){const r=new he(this.context,s).toMidi();e[r]=t.urls[s]}else Gt(i)&&isFinite(i)&&(e[i]=t.urls[i])}),this._buffers=new dn({urls:e,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.attack=t.attack,this.release=t.release,this.curve=t.curve,this._buffers.loaded&&Promise.resolve().then(t.onload)}static getDefaults(){return Object.assign(le.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:J,onerror:J,release:.1,urls:{}})}_findClosest(t){let s=0;for(;s<96;){if(this._buffers.has(t+s))return-s;
191if(this._buffers.has(t-s))return s;s++}throw new Error(`No available buffers for note: ${t}`)}triggerAttack(t,e,s=1){return this.log("triggerAttack",t,e,s),Array.isArray(t)||(t=[t]),t.forEach(i=>{const r=io(new he(this.context,i).toFrequency()),o=Math.round(r),a=r-o,c=this._findClosest(o),h=o-c,l=this._buffers.get(h),u=Je(c+a),d=new ls({url:l,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:u}).connect(this.output);d.start(e,0,l.duration/u,s),kt(this._activeSources.get(o))||this._activeSources.set(o,[]),this._activeSources.get(o).push(d),d.onended=()=>{if(this._activeSources&&this._activeSources.has(o)){const f=this._activeSources.get(o),p=f.indexOf(d);p!==-1&&f.splice(p,1)}}}),this}triggerRelease(t,e){return this.log("triggerRelease",t,e),Array.isArray(t)||(t=[t]),t.forEach(s=>{const i=new he(this.context,s).toMidi();if(this._activeSources.has(i)&&this._activeSources.get(i).length){const r=this._activeSources.get(i);e=this.toSeconds(e),r.forEach(o=>{o.stop(e)}),this._activeSources.set(i,[])}}),this}releaseAll(t){const e=this.toSeconds(t);return this._activeSources.forEach(s=>{for(;s.length;)s.shift().stop(e)}),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(t,e,s,i=1){const r=this.toSeconds(s);return this.triggerAttack(t,r,i),kt(e)?(j(kt(t),"notes must be an array when duration is array"),t.forEach((o,a)=>{const c=e[Math.min(a,e.length-1)];this.triggerRelease(o,r+this.toSeconds(c))})):this.triggerRelease(t,r+this.toSeconds(e)),this}add(t,e,s){if(j(ps(t)||isFinite(t),`note must be a pitch or midi: ${t}`),ps(t)){const i=new he(this.context,t).toMidi();this._buffers.add(i,e,s)}else this._buffers.add(t,e,s);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach(t=>{t.forEach(e=>e.dispose())}),this._activeSources.clear(),this}};ce([Te(0)],Si.prototype,"attack",void 0);ce([Te(0)],Si.prototype,"release",void 0);var Ae=class ka extends Bt{constructor(){const t=b(ka.getDefaults(),arguments,["callback","value"]);super(t),this.name="ToneEvent",this._state=new hs("stopped"),this._startOffset=0,this._loop=t.loop,this.callback=t.callback,this.value=t.value,this._loopStart=this.toTicks(t.loopStart),this._loopEnd=this.toTicks(t.loopEnd),this._playbackRate=t.playbackRate,this._probability=t.probability,this._humanize=t.humanize,this.mute=t.mute,this._playbackRate=t.playbackRate,this._state.increasing=!0,this._rescheduleEvents()}static getDefaults(){return Object.assign(Bt.getDefaults(),{callback:J,humanize:!1,loop:!1,loopEnd:"1m",loopStart:0,mute:!1,playbackRate:1,probability:1,value:null})}_rescheduleEvents(t=-1){this._state.forEachFrom(t,e=>{let s;if(e.state==="started"){e.id!==-1&&this.context.transport.clear(e.id);const i=e.time+Math.round(this.startOffset/this._playbackRate);if(this._loop===!0||Gt(this._loop)&&this._loop>1){s=1/0,Gt(this._loop)&&(s=this._loop*this._getLoopDuration());const r=this._state.getAfter(i);r!==null&&(s=Math.min(s,r.time-i)),s!==1/0&&(s=new ct(this.context,s));const o=new ct(this.context,this._getLoopDuration());e.id=this.context.transport.scheduleRepeat(this._tick.bind(this),o,new ct(this.context,i),s)}else e.id=this.context.transport.schedule(this._tick.bind(this),new ct(this.context,i))}})}get state(){return this._state.getValueAtTime(this.context.transport.ticks)}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t}get probability(){return this._probability}set probability(t){this._probability=t}get humanize(){return this._humanize}set humanize(t){this._humanize=t}start(t){const e=this.toTicks(t);return this._state.getValueAtTime(e)==="stopped"&&(this._state.add({id:-1,state:"started",time:e}),this._rescheduleEvents(e)),this}stop(t){this.cancel(t);const e=this.toTicks(t);if(this._state.getValueAtTime(e)==="started"){this._state.setStateAtTime("stopped",e,{id:-1});const s=this._state.getBefore(e);let i=e;s!==null&&(i=s.time),this._rescheduleEvents(i)}return this}cancel(t){t=Yt(t,-1/0);
191const e=this.toTicks(t);return this._state.forEachFrom(e,s=>{this.context.transport.clear(s.id)}),this._state.cancel(e),this}_tick(t){const e=this.context.transport.getTicksAtTime(t);if(!this.mute&&this._state.getValueAtTime(e)==="started"){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){let s=.02;oi(this.humanize)||(s=this.toSeconds(this.humanize)),t+=(Math.random()*2-1)*s}this.callback(t,this.value)}}_getLoopDuration(){return(this._loopEnd-this._loopStart)/this._playbackRate}get loop(){return this._loop}set loop(t){this._loop=t,this._rescheduleEvents()}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._rescheduleEvents()}get loopEnd(){return new ct(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}get loopStart(){return new ct(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._rescheduleEvents()}get progress(){if(this._loop){const t=this.context.transport.ticks,e=this._state.get(t);if(e!==null&&e.state==="started"){const s=this._getLoopDuration();return(t-e.time)%s/s}else return 0}else return 0}dispose(){return super.dispose(),this.cancel(),this._state.dispose(),this}},qn=class Ca extends Bt{constructor(){const t=b(Ca.getDefaults(),arguments,["callback","interval"]);super(t),this.name="Loop",this._event=new Ae({context:this.context,callback:this._tick.bind(this),loop:!0,loopEnd:t.interval,playbackRate:t.playbackRate,probability:t.probability,humanize:t.humanize}),this.callback=t.callback,this.iterations=t.iterations}static getDefaults(){return Object.assign(Bt.getDefaults(),{interval:"4n",callback:J,playbackRate:1,iterations:1/0,probability:1,mute:!1,humanize:!1})}start(t){return this._event.start(t),this}stop(t){return this._event.stop(t),this}cancel(t){return this._event.cancel(t),this}_tick(t){this.callback(t)}get state(){return this._event.state}get progress(){return this._event.progress}get interval(){return this._event.loopEnd}set interval(t){this._event.loopEnd=t}get playbackRate(){return this._event.playbackRate}set playbackRate(t){this._event.playbackRate=t}get humanize(){return this._event.humanize}set humanize(t){this._event.humanize=t}get probability(){return this._event.probability}set probability(t){this._event.probability=t}get mute(){return this._event.mute}set mute(t){this._event.mute=t}get iterations(){return this._event.loop===!0?1/0:this._event.loop}set iterations(t){t===1/0?this._event.loop=!0:this._event.loop=t}dispose(){return super.dispose(),this._event.dispose(),this}},Aa=class Vn extends Ae{constructor(){const t=b(Vn.getDefaults(),arguments,["callback","events"]);super(t),this.name="Part",this._state=new hs("stopped"),this._events=new Set,this._state.increasing=!0,t.events.forEach(e=>{kt(e)?this.add(e[0],e[1]):this.add(e)})}static getDefaults(){return Object.assign(Ae.getDefaults(),{events:[]})}start(t,e){const s=this.toTicks(t);if(this._state.getValueAtTime(s)!=="started"){e=Yt(e,this._loop?this._loopStart:0),this._loop?e=Yt(e,this._loopStart):e=Yt(e,0);const i=this.toTicks(e);this._state.add({id:-1,offset:i,state:"started",time:s}),this._forEach(r=>{this._startNote(r,s,i)})}return this}_startNote(t,e,s){e-=s,this._loop?t.startOffset>=this._loopStart&&t.startOffset<this._loopEnd?(t.startOffset<s&&(e+=this._getLoopDuration()),t.start(new ct(this.context,e))):t.startOffset<this._loopStart&&t.startOffset>=s&&(t.loop=!1,t.start(new ct(this.context,e))):t.startOffset>=s&&t.start(new ct(this.context,e))}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t,this._forEach(e=>{e.startOffset+=this._startOffset})}stop(t){const e=this.toTicks(t);return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._forEach(s=>{s.stop(t)}),this}at(t,e){const s=new _t(this.context,t).toTicks(),i=new ct(this.context,1).toSeconds(),r=this._events.values();let o=r.next();for(;!o.done;){const a=o.value;if(Math.abs(s-a.startOffset)<i)return H(e)&&(a.value=e),a;o=r.next()}return H(e)?(this.add(t,e),this.at(t)):null}add(t,e){t instanceof Object&&Reflect.has(t,"time")&&(e=t,t=e.time);
191const s=this.toTicks(t);let i;return e instanceof Ae?(i=e,i.callback=this._tick.bind(this)):i=new Ae({callback:this._tick.bind(this),context:this.context,value:e}),i.startOffset=s,i.set({humanize:this.humanize,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,playbackRate:this.playbackRate,probability:this.probability}),this._events.add(i),this._restartEvent(i),this}_restartEvent(t){this._state.forEach(e=>{e.state==="started"?this._startNote(t,e.time,e.offset):t.stop(new ct(this.context,e.time))})}remove(t,e){return we(t)&&t.hasOwnProperty("time")&&(e=t,t=e.time),t=this.toTicks(t),this._events.forEach(s=>{s.startOffset===t&&(Wt(e)||H(e)&&s.value===e)&&(this._events.delete(s),s.dispose())}),this}clear(){return this._forEach(t=>t.dispose()),this._events.clear(),this}cancel(t){return this._forEach(e=>e.cancel(t)),this._state.cancel(this.toTicks(t)),this}_forEach(t){return this._events&&this._events.forEach(e=>{e instanceof Vn?e._forEach(t):t(e)}),this}_setAll(t,e){this._forEach(s=>{s[t]=e})}_tick(t,e){this.mute||this.callback(t,e)}_testLoopBoundries(t){this._loop&&(t.startOffset<this._loopStart||t.startOffset>=this._loopEnd)?t.cancel(0):t.state==="stopped"&&this._restartEvent(t)}get probability(){return this._probability}set probability(t){this._probability=t,this._setAll("probability",t)}get humanize(){return this._humanize}set humanize(t){this._humanize=t,this._setAll("humanize",t)}get loop(){return this._loop}set loop(t){this._loop=t,this._forEach(e=>{e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.loop=t,this._testLoopBoundries(e)})}get loopEnd(){return new ct(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._forEach(e=>{e.loopEnd=t,this._testLoopBoundries(e)})}get loopStart(){return new ct(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._forEach(e=>{e.loopStart=this.loopStart,this._testLoopBoundries(e)})}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._setAll("playbackRate",t)}get length(){return this._events.size}dispose(){return super.dispose(),this.clear(),this}};function*kf(n){let t=0;for(;t<n;)t=je(t,0,n-1),yield t,t++}function*Cf(n){let t=n-1;for(;t>=0;)t=je(t,0,n-1),yield t,t--}function*ds(n,t){for(;;)yield*t(n)}function*er(n,t){let e=t?0:n-1;for(;;)e=je(e,0,n-1),yield e,t?(e++,e>=n-1&&(t=!1)):(e--,e<=0&&(t=!0))}function*Af(n){let t=0,e=0;for(;t<n;)t=je(t,0,n-1),yield t,e++,t+=e%2?2:-1}function*Df(n){let t=n-1,e=0;for(;t>=0;)t=je(t,0,n-1),yield t,e++,t+=e%2?-2:1}function*Of(n){for(;;)yield Math.floor(Math.random()*n)}function*Mf(n){const t=[];for(let e=0;e<n;e++)t.push(e);for(;t.length>0;)yield je(t.splice(Math.floor(t.length*Math.random()),1)[0],0,n-1)}function*Ef(n){let t=Math.floor(Math.random()*n);for(;;)t===0?t++:t===n-1||Math.random()<.5?t--:t++,yield t}function*sr(n,t="up",e=0){switch(j(n>=1,"The number of values must be at least one"),t){case"up":yield*ds(n,kf);case"down":yield*ds(n,Cf);case"upDown":yield*er(n,!0);case"downUp":yield*er(n,!1);case"alternateUp":yield*ds(n,Af);case"alternateDown":yield*ds(n,Df);case"random":yield*Of(n);case"randomOnce":yield*ds(n,Mf);case"randomWalk":yield*Ef(n)}}var Nf=class Da extends qn{constructor(){const t=b(Da.getDefaults(),arguments,["callback","values","pattern"]);super(t),this.name="Pattern",this.callback=t.callback,this._values=t.values,this._pattern=sr(t.values.length,t.pattern),this._type=t.pattern}static getDefaults(){return Object.assign(qn.getDefaults(),{pattern:"up",values:[],callback:J})}_tick(t){const e=this._pattern.next();this._index=e.value,this._value=this._values[e.value],this.callback(t,this._value)}get values(){return this._values}set values(t){this._values=t,this.pattern=this._type}get value(){return this._value}get index(){return this._index}get pattern(){return this._type}set pattern(t){this._type=t,this._pattern=sr(this._values.length,this._type)}},Rf=class Oa extends Ae{constructor(){const t=b(Oa.getDefaults(),arguments,["callback","events","subdivision"]);super(t),this.name="Sequence",this._part=new Aa({callback:this._seqCallback.bind(this),context:this.context}),this._events=[],this._eventsArray=[],this._subdivision=this.toT
vendor: 6,507 bytes, line 191
191icks(t.subdivision),this.events=t.events,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.playbackRate=t.playbackRate,this.probability=t.probability,this.humanize=t.humanize,this.mute=t.mute,this.playbackRate=t.playbackRate}static getDefaults(){return Object.assign(St(Ae.getDefaults(),["value"]),{events:[],loop:!0,loopEnd:0,loopStart:0,subdivision:"8n"})}_seqCallback(t,e){e!==null&&!this.mute&&this.callback(t,e)}get events(){return this._events}set events(t){this.clear(),this._eventsArray=t,this._events=this._createSequence(this._eventsArray),this._eventsUpdated()}start(t,e){return this._part.start(t,e&&this._indexTime(e)),this}stop(t){return this._part.stop(t),this}get subdivision(){return new ct(this.context,this._subdivision).toSeconds()}_createSequence(t){return new Proxy(t,{get:(e,s)=>e[s],set:(e,s,i)=>(re(s)&&isFinite(parseInt(s,10))&&kt(i)?e[s]=this._createSequence(i):e[s]=i,this._eventsUpdated(),!0)})}_eventsUpdated(){this._part.clear(),this._rescheduleSequence(this._eventsArray,this._subdivision,this.startOffset),this.loopEnd=this.loopEnd}_rescheduleSequence(t,e,s){t.forEach((i,r)=>{const o=r*e+s;if(kt(i))this._rescheduleSequence(i,e/i.length,o);else{const a=new ct(this.context,o,"i").toSeconds();this._part.add(a,i)}})}_indexTime(t){return new ct(this.context,t*this._subdivision+this.startOffset).toSeconds()}clear(){return this._part.clear(),this}dispose(){return super.dispose(),this._part.dispose(),this}get loop(){return this._part.loop}set loop(t){this._part.loop=t}get loopStart(){return this._loopStart}set loopStart(t){this._loopStart=t,this._part.loopStart=this._indexTime(t)}get loopEnd(){return this._loopEnd}set loopEnd(t){this._loopEnd=t,t===0?this._part.loopEnd=this._indexTime(this._eventsArray.length):this._part.loopEnd=this._indexTime(t)}get startOffset(){return this._part.startOffset}set startOffset(t){this._part.startOffset=t}get playbackRate(){return this._part.playbackRate}set playbackRate(t){this._part.playbackRate=t}get probability(){return this._part.probability}set probability(t){this._part.probability=t}get progress(){return this._part.progress}get humanize(){return this._part.humanize}set humanize(t){this._part.humanize=t}get length(){return this._part.length}},yn=class Ma extends M{constructor(){const t=b(Ma.getDefaults(),arguments,["fade"]);super(t),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new Qo({context:this.context}),this.a=new B({context:this.context,gain:0}),this.b=new B({context:this.context,gain:0}),this.output=new B({context:this.context}),this._internalChannels=[this.a,this.b],this.fade=new Z({context:this.context,units:"normalRange",value:t.fade}),G(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",Vt(this._split,this.a.gain,0),Vt(this._split,this.b.gain,1),this.fade.chain(this._g2a,this._panner.pan),this.a.connect(this.output),this.b.connect(this.output)}static getDefaults(){return Object.assign(M.getDefaults(),{fade:.5})}dispose(){return super.dispose(),this.a.dispose(),this.b.dispose(),this.output.dispose(),this.fade.dispose(),this._g2a.dispose(),this._panner.disconnect(),this._split.disconnect(),this}},xt=class extends M{constructor(n){super(n),this.name="Effect",this._dryWet=new yn({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new B({context:this.context}),this.effectReturn=new B({context:this.context}),this.input=new B({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(n.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],G(this,"wet")}static getDefaults(){return Object.assign(M.getDefaults(),{wet:1})}connectEffect(n){return this._internalChannels.push(n),this.effectSend.chain(n,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}},Js=class extends xt{constructor(n){super(n),this.name="LFOEffect",this._lfo=new Ut({context:this.context,frequency:n.frequency,amplitude:n.depth}),this.depth=this._lfo.amplitude,this.frequency=this._lfo.frequency,this.type=n.type,G(this,["frequency","depth"])}static getDefaults(){return Object.assign(xt.getDefaults(),{frequency:1,type:"sine",depth:1})}start(n){return this._lfo.start(n),this}stop(n){return this._lfo.stop(n),this}sync(){return this._lfo.sync(),this}unsync(){return this._lfo.unsync(),this}get type(){return this._lfo.type}set type(n){this._lfo.type=n}dispose(){return super.dispose(),this._lfo.dispose(),this.frequency.dispose(),this.depth.dispose(),this}},Ff=class Ea extends Js{constructor(){const t=b(Ea.getDefaults(),arguments,["frequency","baseFrequency","octaves"]);super(t),this.name="AutoFilter",this.filter=new te(Object.assign(t.filter,{context:this.context})),this.connectEffect(this.filter),this._lfo.connect(this.filter.frequency),this.octaves=t.octaves,this.baseFrequency=t.baseFrequency}static getDefaults(){return Object.assign(Js.getDefaults(),{baseFrequency:200,octaves:2.6,filter:{type:"lowpass",rolloff:-12,Q:1}})}get baseFrequency(){return this._lfo.min}set baseFrequency(t){this._lfo.min=this.toFrequency(t),this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._lfo.max=this._lfo.min*Math.pow(2,t)}dispose(){return super.dispose(),this.filter.dispose(),this}},ki=class Na extends M{constructor(){const t=b(Na.getDefaults(),arguments,["pan"]);super(t),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner,this.pan=new $({context:this.context,param:this._panner.pan,value:t.pan,minValue:-1,maxValue:1}),this._panner.channelCount=t.channelCount,this._panner.channelCountMode="explicit",G(this,"pan")}static getDefaults(){return Object.assign(M.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}},If=class Ra extends Js{constructor(){const t=b(Ra.getDefaults(),arguments,["frequency"]);super(t),this.name="AutoPanner",this._panner=new ki({context:this.context,channelCount:t.channelCount}),this.connectEffect(this._panner),this._lfo.connect(this._panner.pan),this._lfo.min=-1,this._lfo.max=1}static getDefaults(){return Object.assign(Js.getDefaults(),{channelCount:1})}
191dispose(){return super.dispose(),this._panner.dispose(),this}},Ci=class Fa extends M{constructor(){const t=b(Fa.getDefaults(),arguments,["smoothing"]);super(t),this.name="Follower",this._abs=this.input=new Zo({context:this.context}),this._lowpass=this.output=new bi({context:this.context,frequency:1/this.toSeconds(t.smoothing),type:"lowpass"}),this._abs.connect(this._lowpass),this._smoothing=t.smoothing}static getDefaults(){return Object.assign(M.getDefaults(),{smoothing:.05})}get smoothing(){return this._smoothing}set smoothing(t){this._smoothing=t,this._lowpass.frequency=1/this.toSeconds(this.smoothing)}dispose(){return super.dispose(),this._abs.dispose(),this._lowpass.dispose(),this}},qf=class Ia extends xt{constructor(){const t=b(Ia.getDefaults(),arguments,["baseFrequency","octaves","sensitivity"]);super(t),this.name="AutoWah",this._follower=new Ci({context:this.context,smoothing:t.follower}),this._sweepRange=new Ko({context:this.context,min:0,max:1,exponent:.5}),this._baseFrequency=this.toFrequency(t.baseFrequency),this._octaves=t.octaves,this._inputBoost=new B({context:this.context}),this._bandpass=new te({context:this.context,rolloff:-48,frequency:0,Q:t.Q}),this._peaking=new te({context:this.context,type:"peaking"}),this._peaking.gain.value=t.gain,this.gain=this._peaking.gain,this.Q=this._bandpass.Q,this.effectSend.chain(this._inputBoost,this._follower,this._sweepRange),this._sweepRange.connect(this._bandpass.frequency),this._sweepRange.connect(this._peaking.frequency),this.effectSend.chain(this._bandpass,this._peaking,this.effectReturn),this._setSweepRange(),this.sensitivity=t.sensitivity,G(this,["gain","Q"])}static getDefaults(){return Object.assign(xt.getDefaults(),{baseFrequency:100,octaves:6,sensitivity:0,Q:2,gain:2,follower:.2})}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._setSweepRange()}get follower(){return this._follower.smoothing}set follower(t){this._follower.smoothing=t}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){this._baseFrequency=this.toFrequency(t),this._setSweepRange()}get sensitivity(){return As(1/this._inputBoost.gain.value)}set sensitivity(t){this._inputBoost.gain.value=1/He(t)}_setSweepRange(){this._sweepRange.min=this._baseFrequency,this._sweepRange.max=Math.min(this._baseFrequency*Math.pow(2,this._octaves),this.context.sampleRate/2)}dispose(){return super.dispose(),this._follower.dispose(),this._sweepRange.dispose(),this._bandpass.dispose(),this._peaking.dispose(),this._inputBoost.dispose(),this}},qa="bit-crusher",Vf=` 192 class BitCrusherWorklet extends SingleIOProcessor { 193 194 static get parameterDescriptors() { 195 return [{ 196 name: "bits", 197 defaultValue: 12, 198 minValue: 1, 199 maxValue: 16, 200 automationRate: 'k-rate' 201 }]; 202 } 203 204 generate(input, _channel, parameters) { 205 const step = Math.pow(0.5, parameters.bits - 1); 206 const val = step * Math.floor(input / step + 0.5); 207 return val; 208 } 209 } 210`;ga(qa,Vf);var Pf=class Va extends xt{constructor(){const t=b(Va.getDefaults(),arguments,["bits"]);super(t),this.name="BitCrusher",this._bitCrusherWorklet=new Lf({context:this.context,bits:t.bits}),this.connectEffect(this._bitCrusherWorklet),this.bits=this._bitCrusherWorklet.bits}static getDefaults(){return Object.assign(xt.getDefaults(),{bits:4})}dispose(){return super.dispose(),this._bitCrusherWorklet.dispose(),this}},Lf=class Pa extends In{constructor(){const t=b(Pa.getDefaults(),arguments);super(t),this.name="BitCrusherWorklet",this.input=new B({context:this.context}),this.output=new B({context:this.context}),this.bits=new $({context:this.context,value:t.bits,units:"positive",minValue:1,maxValue:16,param:this._dummyParam,swappable:!0})}static getDefaults(){return Object.assign(In.getDefaults(),{bits:12})}_audioWorkletName(){return qa}onReady(t){Zt(this.input,t,this.output);const e=t.parameters.get("bits");this.bits.setParam(e)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.bits.dispose(),this}},Wf=class La extends xt{constructor(){const t=b(La.getDefaults(),arguments,["order"]);super(t),this.name="Chebyshev",this._shaper=new be({context:this.context,length:4096}),this._order=t.order,this.connectEffect(this._shaper),this.order=t.order,this.oversample=t.oversample}static getDefaults(){return Object.assign(xt.getDefaults(),{order:1,oversample:"none"})}_getCoefficient(t,e,s){return s.has(e)||(e===0?s.set(e,0):e===1?s.set(e,t):s.set(e,2*t*this._getCoefficient(t,e-1,s)-this._getCoefficient(t,e-2,s))),s.get(e)}get order(){return this._order}set order(t){j(Number.isInteger(t),"'order' must be an integer"),this._order=t,this._shaper.setMap(e=>this._getCoefficient(e,t,new Map))}get oversample(){return this._shaper.oversample}set oversample(t){this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.dispose(),this}},Es=class Wa extends M{constructor(){const t=b(Wa.getDefaults(),arguments,["channels"]);super(t),this.name="Split",this._splitter=this.input=this.output=this.context.createChannelSplitter(t.channels),this._internalChannels=[this._splitter]}static getDefaults(){return Object.assign(M.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._splitter.disconnect(),this}},us=class ja extends M{constructor(){const t=b(ja.getDefaults(),arguments,["channels"]);super(t),this.name="Merge",this._merger=this.output=this.input=this.context.createChannelMerger(t.channels)}static getDefaults(){return Object.assign(M.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}},ue=class extends M{constructor(n){super(n),this.name="StereoEffect",this.input=new B({context:this.context}),this.input.channelCount=2,this.input.channelCountMode="explicit",this._dryWet=this.output=new yn({context:this.context,fade:n.wet}),this.wet=this._dryWet.fade,this._split=new Es({context:this.context,channels:2}),this._merge=new us({context:this.context,channels:2}),this.input.connect(this._split),this.input.connect(this._dryWet.a),this._merge.connect(this._dryWet.b),G(this,["wet"])}connectEffectLeft(...n){this._split.connect(n[0],0,0),Zt(...n),Vt(n[n.length-1],this._merge,0,0)}connectEffectRight(...n){this._split.connect(n[0],1,0),Zt(...n),Vt(n[n.length-1],this._merge,0,1)}static getDefaults(){return Object.assign(M.getDefaults(),{wet:1})}
210dispose(){return super.dispose(),this._dryWet.dispose(),this._split.dispose(),this._merge.dispose(),this}},Pn=class extends ue{constructor(n){super(n),this.feedback=new Z({context:this.context,value:n.feedback,units:"normalRange"}),this._feedbackL=new B({context:this.context}),this._feedbackR=new B({context:this.context}),this._feedbackSplit=new Es({context:this.context,channels:2}),this._feedbackMerge=new us({context:this.context,channels:2}),this._merge.connect(this._feedbackSplit),this._feedbackMerge.connect(this._split),this._feedbackSplit.connect(this._feedbackL,0,0),this._feedbackL.connect(this._feedbackMerge,0,0),this._feedbackSplit.connect(this._feedbackR,1,0),this._feedbackR.connect(this._feedbackMerge,0,1),this.feedback.fan(this._feedbackL.gain,this._feedbackR.gain),G(this,["feedback"])}static getDefaults(){return Object.assign(ue.getDefaults(),{feedback:.5})}dispose(){return super.dispose(),this.feedback.dispose(),this._feedbackL.dispose(),this._feedbackR.dispose(),this._feedbackSplit.dispose(),this._feedbackMerge.dispose(),this}},jf=class Ba extends Pn{constructor(){const t=b(Ba.getDefaults(),arguments,["frequency","delayTime","depth"]);super(t),this.name="Chorus",this._depth=t.depth,this._delayTime=t.delayTime/1e3,this._lfoL=new Ut({context:this.context,frequency:t.frequency,min:0,max:1}),this._lfoR=new Ut({context:this.context,frequency:t.frequency,min:0,max:1,phase:180}),this._delayNodeL=new se({context:this.context}),this._delayNodeR=new se({context:this.context}),this.frequency=this._lfoL.frequency,G(this,["frequency"]),this._lfoL.frequency.connect(this._lfoR.frequency),this.connectEffectLeft(this._delayNodeL),this.connectEffectRight(this._delayNodeR),this._lfoL.connect(this._delayNodeL.delayTime),this._lfoR.connect(this._delayNodeR.delayTime),this.depth=this._depth,this.type=t.type,this.spread=t.spread}static getDefaults(){return Object.assign(Pn.getDefaults(),{frequency:1.5,delayTime:3.5,depth:.7,type:"sine",spread:180,feedback:0,wet:.5})}get depth(){return this._depth}set depth(t){this._depth=t;const e=this._delayTime*t;this._lfoL.min=Math.max(this._delayTime-e,0),this._lfoL.max=this._delayTime+e,this._lfoR.min=Math.max(this._delayTime-e,0),this._lfoR.max=this._delayTime+e}get delayTime(){return this._delayTime*1e3}set delayTime(t){this._delayTime=t/1e3,this.depth=this._depth}get type(){return this._lfoL.type}set type(t){this._lfoL.type=t,this._lfoR.type=t}get spread(){return this._lfoR.phase-this._lfoL.phase}set spread(t){this._lfoL.phase=90-t/2,this._lfoR.phase=t/2+90}start(t){return this._lfoL.start(t),this._lfoR.start(t),this}stop(t){return this._lfoL.stop(t),this._lfoR.stop(t),this}sync(){return this._lfoL.sync(),this._lfoR.sync(),this}unsync(){return this._lfoL.unsync(),this._lfoR.unsync(),this}dispose(){return super.dispose(),this._lfoL.dispose(),this._lfoR.dispose(),this._delayNodeL.dispose(),this._delayNodeR.dispose(),this.frequency.dispose(),this}},Bf=class za extends xt{constructor(){const t=b(za.getDefaults(),arguments,["distortion"]);super(t),this.name="Distortion",this._shaper=new be({context:this.context,length:4096}),this._distortion=t.distortion,this.connectEffect(this._shaper),this.distortion=t.distortion,this.oversample=t.oversample}static getDefaults(){return Object.assign(xt.getDefaults(),{distortion:.4,oversample:"none"})}get distortion(){return this._distortion}set distortion(t){this._distortion=t;const e=t*100,s=Math.PI/180;this._shaper.setMap(i=>Math.abs(i)<.001?0:(3+e)*i*20*s/(Math.PI+e*Math.abs(i)))}get oversample(){return this._shaper.oversample}set oversample(t){this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.dispose(),this}},Ks=class extends xt{constructor(n){super(n),this.name="FeedbackEffect",this._feedbackGain=new B({context:this.context,gain:n.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,G(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(xt.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}},zf=class Ua extends Ks{constructor(){const t=b(Ua.getDefaults(),arguments,["delayTime","feedback"]);super(t),this.name="FeedbackDelay",this._delayNode=new se({context:this.context,delayTime:t.delayTime,maxDelay:t.maxDelay}),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),G(this,"delayTime")}static getDefaults(){return Object.assign(Ks.getDefaults(),{delayTime:.25,maxDelay:1})}
210dispose(){return super.dispose(),this._delayNode.dispose(),this.delayTime.dispose(),this}},Uf=class extends M{constructor(n){super(n),this.name="PhaseShiftAllpass",this.input=new B({context:this.context}),this.output=new B({context:this.context}),this.offset90=new B({context:this.context});const t=[.6923878,.9360654322959,.988229522686,.9987488452737],e=[.4021921162426,.856171088242,.9722909545651,.9952884791278];this._bank0=this._createAllPassFilterBank(t),this._bank1=this._createAllPassFilterBank(e),this._oneSampleDelay=this.context.createIIRFilter([0,1],[1,0]),Zt(this.input,...this._bank0,this._oneSampleDelay,this.output),Zt(this.input,...this._bank1,this.offset90)}_createAllPassFilterBank(n){return n.map(t=>{const e=[[t*t,0,-1],[1,0,-(t*t)]];return this.context.createIIRFilter(e[0],e[1])})}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.offset90.dispose(),this._bank0.forEach(n=>n.disconnect()),this._bank1.forEach(n=>n.disconnect()),this._oneSampleDelay.disconnect(),this}},Gf=class Ga extends xt{constructor(){const t=b(Ga.getDefaults(),arguments,["frequency"]);super(t),this.name="FrequencyShifter",this.frequency=new Z({context:this.context,units:"frequency",value:t.frequency,minValue:-this.context.sampleRate/2,maxValue:this.context.sampleRate/2}),this._sine=new pi({context:this.context,type:"sine"}),this._cosine=new At({context:this.context,phase:-90,type:"sine"}),this._sineMultiply=new pt({context:this.context}),this._cosineMultiply=new pt({context:this.context}),this._negate=new gi({context:this.context}),this._add=new Os({context:this.context}),this._phaseShifter=new Uf({context:this.context}),this.effectSend.connect(this._phaseShifter),this.frequency.fan(this._sine.frequency,this._cosine.frequency),this._phaseShifter.offset90.connect(this._cosineMultiply),this._cosine.connect(this._cosineMultiply.factor),this._phaseShifter.connect(this._sineMultiply),this._sine.connect(this._sineMultiply.factor),this._sineMultiply.connect(this._negate),this._cosineMultiply.connect(this._add),this._negate.connect(this._add.addend),this._add.connect(this.effectReturn);const e=this.immediate();this._sine.start(e),this._cosine.start(e)}static getDefaults(){return Object.assign(xt.getDefaults(),{frequency:0})}dispose(){return super.dispose(),this.frequency.dispose(),this._add.dispose(),this._cosine.dispose(),this._cosineMultiply.dispose(),this._negate.dispose(),this._phaseShifter.dispose(),this._sine.dispose(),this._sineMultiply.dispose(),this}},nr=[1557/44100,1617/44100,1491/44100,1422/44100,1277/44100,1356/44100,1188/44100,1116/44100],ir=[225,556,441,341],Zf=class Za extends ue{constructor(){const t=b(Za.getDefaults(),arguments,["roomSize","dampening"]);super(t),this.name="Freeverb",this._combFilters=[],this._allpassFiltersL=[],this._allpassFiltersR=[],this.roomSize=new Z({context:this.context,value:t.roomSize,units:"normalRange"}),this._allpassFiltersL=ir.map(e=>{const s=this.context.createBiquadFilter();return s.type="allpass",s.frequency.value=e,s}),this._allpassFiltersR=ir.map(e=>{const s=this.context.createBiquadFilter();return s.type="allpass",s.frequency.value=e,s}),this._combFilters=nr.map((e,s)=>{const i=new Ti({context:this.context,dampening:t.dampening,delayTime:e});return s<nr.length/2?this.connectEffectLeft(i,...this._allpassFiltersL):this.connectEffectRight(i,...this._allpassFiltersR),this.roomSize.connect(i.resonance),i}),G(this,["roomSize"])}static getDefaults(){return Object.assign(ue.getDefaults(),{roomSize:.7,dampening:3e3})}get dampening(){return this._combFilters[0].dampening}set dampening(t){this._combFilters.forEach(e=>e.dampening=t)}dispose(){return super.dispose(),this._allpassFiltersL.forEach(t=>t.disconnect()),this._allpassFiltersR.forEach(t=>t.disconnect()),this._combFilters.forEach(t=>t.dispose()),this.roomSize.dispose(),this}},rr=[1687/25e3,1601/25e3,2053/25e3,2251/25e3],Qf=[.773,.802,.753,.733],Xf=[347,113,37],$f=class Qa extends ue{constructor(){const t=b(Qa.getDefaults(),arguments,["roomSize"]);super(t),this.name="JCReverb",this._allpassFilters=[],this._feedbackCombFilters=[],this.roomSize=new Z({context:this.context,value:t.roomSize,units:"normalRange"}),this._scaleRoomSize=new Pe({context:this.context,min:-.733,max:.197}),this._allpassFilters=Xf.map(e=>{const s=this.context.createBiquadFilter();return s.type="allpass",s.frequency.value=e,s}),this._feedbackCombFilters=rr.map((e,s)=>{const i=new xi({context:this.context,delayTime:e});return this._scaleRoomSize.connect(i.resonance),i.resonance.value=Qf[s],s<rr.length/2?this.connectEffectLeft(...this._allpassFilters,i):this.connectEffectRight(...this._allpassFilters,i),i}),this.roomSize.connect(this._scaleRoomSize),G(this,["roomSize"])}static getDefaults(){return Object.assign(ue.getDefaults(),{roomSize:.5})}
vendor: 5,044 bytes, line 210
210dispose(){return super.dispose(),this._allpassFilters.forEach(t=>t.disconnect()),this._feedbackCombFilters.forEach(t=>t.dispose()),this.roomSize.dispose(),this._scaleRoomSize.dispose(),this}},or=class extends Pn{constructor(n){super(n),this._feedbackL.disconnect(),this._feedbackL.connect(this._feedbackMerge,0,1),this._feedbackR.disconnect(),this._feedbackR.connect(this._feedbackMerge,0,0),G(this,["feedback"])}},Yf=class Xa extends or{constructor(){const t=b(Xa.getDefaults(),arguments,["delayTime","feedback"]);super(t),this.name="PingPongDelay",this._leftDelay=new se({context:this.context,maxDelay:t.maxDelay}),this._rightDelay=new se({context:this.context,maxDelay:t.maxDelay}),this._rightPreDelay=new se({context:this.context,maxDelay:t.maxDelay}),this.delayTime=new Z({context:this.context,units:"time",value:t.delayTime}),this.connectEffectLeft(this._leftDelay),this.connectEffectRight(this._rightPreDelay,this._rightDelay),this.delayTime.fan(this._leftDelay.delayTime,this._rightDelay.delayTime,this._rightPreDelay.delayTime),this._feedbackL.disconnect(),this._feedbackL.connect(this._rightDelay),G(this,["delayTime"])}static getDefaults(){return Object.assign(or.getDefaults(),{delayTime:.25,maxDelay:1})}dispose(){return super.dispose(),this._leftDelay.dispose(),this._rightDelay.dispose(),this._rightPreDelay.dispose(),this.delayTime.dispose(),this}},Hf=class $a extends Ks{constructor(){const t=b($a.getDefaults(),arguments,["pitch"]);super(t),this.name="PitchShift",this._frequency=new Z({context:this.context}),this._delayA=new se({maxDelay:1,context:this.context}),this._lfoA=new Ut({context:this.context,min:0,max:.1,type:"sawtooth"}).connect(this._delayA.delayTime),this._delayB=new se({maxDelay:1,context:this.context}),this._lfoB=new Ut({context:this.context,min:0,max:.1,type:"sawtooth",phase:180}).connect(this._delayB.delayTime),this._crossFade=new yn({context:this.context}),this._crossFadeLFO=new Ut({context:this.context,min:0,max:1,type:"triangle",phase:90}).connect(this._crossFade.fade),this._feedbackDelay=new se({delayTime:t.delayTime,context:this.context}),this.delayTime=this._feedbackDelay.delayTime,G(this,"delayTime"),this._pitch=t.pitch,this._windowSize=t.windowSize,this._delayA.connect(this._crossFade.a),this._delayB.connect(this._crossFade.b),this._frequency.fan(this._lfoA.frequency,this._lfoB.frequency,this._crossFadeLFO.frequency),this.effectSend.fan(this._delayA,this._delayB),this._crossFade.chain(this._feedbackDelay,this.effectReturn);const e=this.now();this._lfoA.start(e),this._lfoB.start(e),this._crossFadeLFO.start(e),this.windowSize=this._windowSize}static getDefaults(){return Object.assign(Ks.getDefaults(),{pitch:0,windowSize:.1,delayTime:0,feedback:0})}get pitch(){return this._pitch}set pitch(t){this._pitch=t;let e=0;t<0?(this._lfoA.min=0,this._lfoA.max=this._windowSize,this._lfoB.min=0,this._lfoB.max=this._windowSize,e=Je(t-1)+1):(this._lfoA.min=this._windowSize,this._lfoA.max=0,this._lfoB.min=this._windowSize,this._lfoB.max=0,e=Je(t)-1),this._frequency.value=e*(1.2/this._windowSize)}get windowSize(){return this._windowSize}set windowSize(t){this._windowSize=this.toSeconds(t),this.pitch=this._pitch}dispose(){return super.dispose(),this._frequency.dispose(),this._delayA.dispose(),this._delayB.dispose(),this._lfoA.dispose(),this._lfoB.dispose(),this._crossFade.dispose(),this._crossFadeLFO.dispose(),this._feedbackDelay.dispose(),this}},Jf=class Ya extends ue{constructor(){const t=b(Ya.getDefaults(),arguments,["frequency","octaves","baseFrequency"]);super(t),this.name="Phaser",this._lfoL=new Ut({context:this.context,frequency:t.frequency,min:0,max:1}),this._lfoR=new Ut({context:this.context,frequency:t.frequency,min:0,max:1,phase:180}),this._baseFrequency=this.toFrequency(t.baseFrequency),this._octaves=t.octaves,this.Q=new Z({context:this.context,value:t.Q,units:"positive"}),this._filtersL=this._makeFilters(t.stages,this._lfoL),this._filtersR=this._makeFilters(t.stages,this._lfoR),this.frequency=this._lfoL.frequency,this.frequency.value=t.frequency,this.connectEffectLeft(...this._filtersL),this.connectEffectRight(...this._filtersR),this._lfoL.frequency.connect(this._lfoR.frequency),this.baseFrequency=t.baseFrequency,this.octaves=t.octaves,this._lfoL.start(),this._lfoR.start(),G(this,["frequency","Q"])}static getDefaults(){return Object.assign(ue.getDefaults(),{frequency:.5,octaves:3,stages:10,Q:10,baseFrequency:350})}_makeFilters(t,e){const s=[];for(let i=0;i<t;i++){const r=this.context.createBiquadFilter();r.type="allpass",this.Q.connect(r.Q),e.connect(r.frequency),s.push(r)}return s}get octaves(){return this._octaves}set octaves(t){this._octaves=t;const e=this._baseFrequency*Math.pow(2,t);this._lfoL.max=e,this._lfoR.max=e}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){this._baseFrequency=this.toFrequency(t),this._lfoL.min=this._baseFrequency,this._lfoR.min=this._baseFrequency,this.octaves=this._octaves}dispose(){return super.dispose(),this.Q.dispose(),this._lfoL.dispose(),this._lfoR.dispose(),this._filtersL.forEach(t=>
210t.disconnect()),this._filtersR.forEach(t=>t.disconnect()),this.frequency.dispose(),this}},Kf=class Ha extends xt{constructor(){const t=b(Ha.getDefaults(),arguments,["decay"]);super(t),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve();const e=this.toSeconds(t.decay);yt(e,.001),this._decay=e;const s=this.toSeconds(t.preDelay);yt(s,0),this._preDelay=s,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(xt.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(t){t=this.toSeconds(t),yt(t,.001),this._decay=t,this.generate()}get preDelay(){return this._preDelay}set preDelay(t){t=this.toSeconds(t),yt(t,0),this._preDelay=t,this.generate()}generate(){return st(this,void 0,void 0,function*(){const t=this.ready,e=new cs(2,this._decay+this._preDelay,this.context.sampleRate),s=new ts({context:e}),i=new ts({context:e}),r=new us({context:e});s.connect(r,0,0),i.connect(r,0,1);const o=new B({context:e}).toDestination();r.connect(o),s.start(0),i.start(0),o.gain.setValueAtTime(0,0),o.gain.setValueAtTime(1,this._preDelay),o.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const a=e.render();return this.ready=a.then(J),yield t,this._convolver.buffer=(yield a).get(),this})}dispose(){return super.dispose(),this._convolver.disconnect(),this}},Ai=class Ja extends M{constructor(){super(b(Ja.getDefaults(),arguments)),this.name="MidSideSplit",this._split=this.input=new Es({channels:2,context:this.context}),this._midAdd=new Os({context:this.context}),this.mid=new pt({context:this.context,value:Math.SQRT1_2}),this._sideSubtract=new Ms({context:this.context}),this.side=new pt({context:this.context,value:Math.SQRT1_2}),this._split.connect(this._midAdd,0),this._split.connect(this._midAdd.addend,1),this._split.connect(this._sideSubtract,0),this._split.connect(this._sideSubtract.subtrahend,1),this._midAdd.connect(this.mid),this._sideSubtract.connect(this.side)}dispose(){return super.dispose(),this.mid.dispose(),this.side.dispose(),this._midAdd.dispose(),this._sideSubtract.dispose(),this._split.dispose(),this}},Di=class Ka extends M{constructor(){super(b(Ka.getDefaults(),arguments)),this.name="MidSideMerge",this.mid=new B({context:this.context}),this.side=new B({context:this.context}),this._left=new Os({context:this.context}),this._leftMult=new pt({context:this.context,value:Math.SQRT1_2}),this._right=new Ms({context:this.context}),this._rightMult=new pt({context:this.context,value:Math.SQRT1_2}),this._merge=this.output=new us({context:this.context}),this.mid.fan(this._left),this.side.connect(this._left.addend),this.mid.connect(this._right),this.side.connect(this._right.subtrahend),this._left.connect(this._leftMult),this._right.connect(this._rightMult),this._leftMult.connect(this._merge,0,0),this._rightMult.connect(this._merge,0,1)}dispose(){return super.dispose(),this.mid.dispose(),this.side.dispose(),this._leftMult.dispose(),this._rightMult.dispose(),this._left.dispose(),this._right.dispose(),this}},ar=class extends xt{constructor(n){super(n),this.name="MidSideEffect",this._midSideMerge=new Di({context:this.context}),this._midSideSplit=new Ai({context:this.context}),this._midSend=this._midSideSplit.mid,this._sideSend=this._midSideSplit.side,this._midReturn=this._midSideMerge.mid,this._sideReturn=this._midSideMerge.side,this.effectSend.connect(this._midSideSplit),this._midSideMerge.connect(this.effectReturn)}connectEffectMid(...n){this._midSend.chain(...n,this._midReturn)}connectEffectSide(...n){this._sideSend.chain(...n,this._sideReturn)}dispose(){return super.dispose(),this._midSideSplit.dispose(),this._midSideMerge.dispose(),this._midSend.dispose(),this._sideSend.dispose(),this._midReturn.dispose(),this._sideReturn.dispose(),this}},tm=class tc extends ar{constructor(){const t=b(tc.getDefaults(),arguments,["width"]);super(t),this.name="StereoWidener",this.width=new Z({context:this.context,value:t.width,units:"normalRange"}),G(this,["width"]),this._twoTimesWidthMid=new pt({context:this.context,value:2}),this._twoTimesWidthSide=new pt({context:this.context,value:2}),this._midMult=new pt({context:this.context}
210),this._twoTimesWidthMid.connect(this._midMult.factor),this.connectEffectMid(this._midMult),this._oneMinusWidth=new Ms({context:this.context}),this._oneMinusWidth.connect(this._twoTimesWidthMid),Vt(this.context.getConstant(1),this._oneMinusWidth),this.width.connect(this._oneMinusWidth.subtrahend),this._sideMult=new pt({context:this.context}),this.width.connect(this._twoTimesWidthSide),this._twoTimesWidthSide.connect(this._sideMult.factor),this.connectEffectSide(this._sideMult)}static getDefaults(){return Object.assign(ar.getDefaults(),{width:.5})}dispose(){return super.dispose(),this.width.dispose(),this._midMult.dispose(),this._sideMult.dispose(),this._twoTimesWidthMid.dispose(),this._twoTimesWidthSide.dispose(),this._oneMinusWidth.dispose(),this}},em=class ec extends ue{constructor(){const t=b(ec.getDefaults(),arguments,["frequency","depth"]);super(t),this.name="Tremolo",this._lfoL=new Ut({context:this.context,type:t.type,min:1,max:0}),this._lfoR=new Ut({context:this.context,type:t.type,min:1,max:0}),this._amplitudeL=new B({context:this.context}),this._amplitudeR=new B({context:this.context}),this.frequency=new Z({context:this.context,value:t.frequency,units:"frequency"}),this.depth=new Z({context:this.context,value:t.depth,units:"normalRange"}),G(this,["frequency","depth"]),this.connectEffectLeft(this._amplitudeL),this.connectEffectRight(this._amplitudeR),this._lfoL.connect(this._amplitudeL.gain),this._lfoR.connect(this._amplitudeR.gain),this.frequency.fan(this._lfoL.frequency,this._lfoR.frequency),this.depth.fan(this._lfoR.amplitude,this._lfoL.amplitude),this.spread=t.spread}static getDefaults(){return Object.assign(ue.getDefaults(),{frequency:10,type:"sine",depth:.5,spread:180})}start(t){return this._lfoL.start(t),this._lfoR.start(t),this}stop(t){return this._lfoL.stop(t),this._lfoR.stop(t),this}sync(){return this._lfoL.sync(),this._lfoR.sync(),this.context.transport.syncSignal(this.frequency),this}unsync(){return this._lfoL.unsync(),this._lfoR.unsync(),this.context.transport.unsyncSignal(this.frequency),this}get type(){return this._lfoL.type}set type(t){this._lfoL.type=t,this._lfoR.type=t}get spread(){return this._lfoR.phase-this._lfoL.phase}set spread(t){this._lfoL.phase=90-t/2,this._lfoR.phase=t/2+90}dispose(){return super.dispose(),this._lfoL.dispose(),this._lfoR.dispose(),this._amplitudeL.dispose(),this._amplitudeR.dispose(),this.frequency.dispose(),this.depth.dispose(),this}},sm=class sc extends xt{constructor(){const t=b(sc.getDefaults(),arguments,["frequency","depth"]);super(t),this.name="Vibrato",this._delayNode=new se({context:this.context,delayTime:0,maxDelay:t.maxDelay}),this._lfo=new Ut({context:this.context,type:t.type,min:0,max:t.maxDelay,frequency:t.frequency,phase:-90}).start().connect(this._delayNode.delayTime),this.frequency=this._lfo.frequency,this.depth=this._lfo.amplitude,this.depth.value=t.depth,G(this,["frequency","depth"]),this.effectSend.chain(this._delayNode,this.effectReturn)}static getDefaults(){return Object.assign(xt.getDefaults(),{maxDelay:.005,frequency:5,depth:.1,type:"sine"})}get type(){return this._lfo.type}set type(t){this._lfo.type=t}dispose(){return super.dispose(),this._delayNode.dispose(),this._lfo.dispose(),this.frequency.dispose(),this.depth.dispose(),this}},Oi=class nc extends M{constructor(){const t=b(nc.getDefaults(),arguments,["type","size"]);super(t),this.name="Analyser",this._analysers=[],this._buffers=[],this.input=this.output=this._gain=new B({context:this.context}),this._split=new Es({context:this.context,channels:t.channels}),this.input.connect(this._split),yt(t.channels,1);for(let e=0;e<t.channels;e++)this._analysers[e]=this.context.createAnalyser(),this._split.connect(this._analysers[e],e,0);this.size=t.size,this.type=t.type,this.smoothing=t.smoothing}static getDefaults(){return Object.assign(M.getDefaults(),{size:1024,smoothing:.8,type:"fft",channels:1})}getValue(){return this._analysers.forEach((t,e)=>{const s=this._buffers[e];this._type==="fft"?t.getFloatFrequencyData(s):this._type==="waveform"&&t.getFloatTimeDomainData(s)}),this.channels===1?this._buffers[0]:this._buffers}get size(){return this._analysers[0].frequencyBinCount}
210set size(t){this._analysers.forEach((e,s)=>{e.fftSize=t*2,this._buffers[s]=new Float32Array(t)})}get channels(){return this._analysers.length}get type(){return this._type}set type(t){j(t==="waveform"||t==="fft",`Analyser: invalid type: ${t}`),this._type=t}get smoothing(){return this._analysers[0].smoothingTimeConstant}set smoothing(t){this._analysers.forEach(e=>e.smoothingTimeConstant=t)}dispose(){return super.dispose(),this._analysers.forEach(t=>t.disconnect()),this._split.dispose(),this._gain.dispose(),this}},ss=class ic extends M{constructor(){super(b(ic.getDefaults(),arguments)),this.name="MeterBase",this.input=this.output=this._analyser=new Oi({context:this.context,size:256,type:"waveform"})}dispose(){return super.dispose(),this._analyser.dispose(),this}},nm=class rc extends ss{constructor(){const t=b(rc.getDefaults(),arguments,["smoothing"]);super(t),this.name="Meter",this.input=this.output=this._analyser=new Oi({context:this.context,size:256,type:"waveform",channels:t.channelCount}),this.smoothing=t.smoothing,this.normalRange=t.normalRange,this._rms=new Array(t.channelCount),this._rms.fill(0)}static getDefaults(){return Object.assign(ss.getDefaults(),{smoothing:.8,normalRange:!1,channelCount:1})}getLevel(){return as("'getLevel' has been changed to 'getValue'"),this.getValue()}getValue(){const t=this._analyser.getValue(),e=(this.channels===1?[t]:t).map((s,i)=>{const r=s.reduce((a,c)=>a+c*c,0),o=Math.sqrt(r/s.length);return this._rms[i]=Math.max(o,this._rms[i]*this.smoothing),this.normalRange?this._rms[i]:As(this._rms[i])});return this.channels===1?e[0]:e}get channels(){return this._analyser.channels}dispose(){return super.dispose(),this._analyser.dispose(),this}},im=class oc extends ss{constructor(){const t=b(oc.getDefaults(),arguments,["size"]);super(t),this.name="FFT",this.normalRange=t.normalRange,this._analyser.type="fft",this.size=t.size}static getDefaults(){return Object.assign(M.getDefaults(),{normalRange:!1,size:1024,smoothing:.8})}getValue(){return this._analyser.getValue().map(t=>this.normalRange?He(t):t)}get size(){return this._analyser.size}set size(t){this._analyser.size=t}get smoothing(){return this._analyser.smoothing}set smoothing(t){this._analyser.smoothing=t}getFrequencyOfIndex(t){return j(0<=t&&t<this.size,`index must be greater than or equal to 0 and less than ${this.size}`),t*this.context.sampleRate/(this.size*2)}},rm=class ac extends ss{constructor(){super(b(ac.getDefaults(),arguments)),this.name="DCMeter",this._analyser.type="waveform",this._analyser.size=256}getValue(){return this._analyser.getValue()[0]}},om=class cc extends ss{constructor(){const t=b(cc.getDefaults(),arguments,["size"]);super(t),this.name="Waveform",this._analyser.type="waveform",this.size=t.size}static getDefaults(){return Object.assign(ss.getDefaults(),{size:1024})}getValue(){return this._analyser.getValue()}get size(){return this._analyser.size}set size(t){this._analyser.size=t}},wn=class Tt extends M{constructor(){const t=b(Tt.getDefaults(),arguments,["solo"]);super(t),this.name="Solo",this.input=this.output=new B({context:this.context}),Tt._allSolos.has(this.context)||Tt._allSolos.set(this.context,new Set),Tt._allSolos.get(this.context).add(this),this.solo=t.solo}static getDefaults(){return Object.assign(M.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(t){t?this._addSolo():this._removeSolo(),Tt._allSolos.get(this.context).forEach(e=>e._updateSolo())}get muted(){return this.input.gain.value===0}_addSolo(){Tt._soloed.has(this.context)||Tt._soloed.set(this.context,new Set),Tt._soloed.get(this.context).add(this)}_removeSolo(){Tt._soloed.has(this.context)&&Tt._soloed.get(this.context).delete(this)}_isSoloed(){return Tt._soloed.has(this.context)&&Tt._soloed.get(this.context).has(this)}_noSolos(){return!Tt._soloed.has(this.context)||Tt._soloed.has(this.context)&&Tt._soloed.get(this.context).size===0}_updateSolo(){this._isSoloed()?this.input.gain.value=1:this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),Tt._allSolos.get(this.context).delete(this),this._removeSolo(),this}};wn._allSolos=new Map;wn._soloed=new Map;var hc=class lc extends M{constructor(){const t=b(lc.getDefaults(),arguments,["pan","volume"]);super(t),this.name="PanVol",this._panner=this.input=new ki({context:this.context,pan:t.pan,channelCount:t.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new Be({context:this.context,volume:t.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,G(this,["pan","volume"])}static getDefaults(){return Object.assign(M.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}
vendor: 4,497 bytes, line 210
210dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}},uc=class _s extends M{constructor(){const t=b(_s.getDefaults(),arguments,["volume","pan"]);super(t),this.name="Channel",this._solo=this.input=new wn({solo:t.solo,context:this.context}),this._panVol=this.output=new hc({context:this.context,pan:t.pan,volume:t.volume,mute:t.mute,channelCount:t.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),G(this,["pan","volume"])}static getDefaults(){return Object.assign(M.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(t){this._solo.solo=t}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(t){this._panVol.mute=t}_getBus(t){return _s.buses.has(t)||_s.buses.set(t,new B({context:this.context})),_s.buses.get(t)}send(t,e=0){const s=this._getBus(t),i=new B({context:this.context,units:"decibels",gain:e});return this.connect(i),i.connect(s),i}receive(t){return this._getBus(t).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}};uc.buses=new Map;var am=class dc extends M{constructor(){super(b(dc.getDefaults(),arguments)),this.name="Mono",this.input=new B({context:this.context}),this._merge=this.output=new us({channels:2,context:this.context}),this.input.connect(this._merge,0,0),this.input.connect(this._merge,0,1)}dispose(){return super.dispose(),this._merge.dispose(),this.input.dispose(),this}},Mi=class pc extends M{constructor(){const t=b(pc.getDefaults(),arguments,["lowFrequency","highFrequency"]);super(t),this.name="MultibandSplit",this.input=new B({context:this.context}),this.output=void 0,this.low=new te({context:this.context,frequency:0,type:"lowpass"}),this._lowMidFilter=new te({context:this.context,frequency:0,type:"highpass"}),this.mid=new te({context:this.context,frequency:0,type:"lowpass"}),this.high=new te({context:this.context,frequency:0,type:"highpass"}),this._internalChannels=[this.low,this.mid,this.high],this.lowFrequency=new Z({context:this.context,units:"frequency",value:t.lowFrequency}),this.highFrequency=new Z({context:this.context,units:"frequency",value:t.highFrequency}),this.Q=new Z({context:this.context,units:"positive",value:t.Q}),this.input.fan(this.low,this.high),this.input.chain(this._lowMidFilter,this.mid),this.lowFrequency.fan(this.low.frequency,this._lowMidFilter.frequency),this.highFrequency.fan(this.mid.frequency,this.high.frequency),this.Q.connect(this.low.Q),this.Q.connect(this._lowMidFilter.Q),this.Q.connect(this.mid.Q),this.Q.connect(this.high.Q),G(this,["high","mid","low","highFrequency","lowFrequency"])}static getDefaults(){return Object.assign(M.getDefaults(),{Q:1,highFrequency:2500,lowFrequency:400})}dispose(){return super.dispose(),Cs(this,["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this._lowMidFilter.dispose(),this.mid.dispose(),this.high.dispose(),this.lowFrequency.dispose(),this.highFrequency.dispose(),this.Q.dispose(),this}},cm=class fc extends M{constructor(){const t=b(fc.getDefaults(),arguments,["positionX","positionY","positionZ"]);super(t),this.name="Panner3D",this._panner=this.input=this.output=this.context.createPanner(),this.panningModel=t.panningModel,this.maxDistance=t.maxDistance,this.distanceModel=t.distanceModel,this.coneOuterGain=t.coneOuterGain,this.coneOuterAngle=t.coneOuterAngle,this.coneInnerAngle=t.coneInnerAngle,this.refDistance=t.refDistance,this.rolloffFactor=t.rolloffFactor,this.positionX=new $({context:this.context,param:this._panner.positionX,value:t.positionX}),this.positionY=new $({context:this.context,param:this._panner.positionY,value:t.positionY}),this.positionZ=new $({context:this.context,param:this._panner.positionZ,value:t.positionZ}),this.orientationX=new $({context:this.context,param:this._panner.orientationX,value:t.orientationX}),this.orientationY=new $({context:this.context,param:this._panner.orientationY,value:t.orientationY}),this.orientationZ=new $({context:this.context,param:this._panner.orientationZ,value:t.orientationZ})}static getDefaults(){return Object.assign(M.getDefaults(),{coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:0,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1}
210)}setPosition(t,e,s){return this.positionX.value=t,this.positionY.value=e,this.positionZ.value=s,this}setOrientation(t,e,s){return this.orientationX.value=t,this.orientationY.value=e,this.orientationZ.value=s,this}get panningModel(){return this._panner.panningModel}set panningModel(t){this._panner.panningModel=t}get refDistance(){return this._panner.refDistance}set refDistance(t){this._panner.refDistance=t}get rolloffFactor(){return this._panner.rolloffFactor}set rolloffFactor(t){this._panner.rolloffFactor=t}get distanceModel(){return this._panner.distanceModel}set distanceModel(t){this._panner.distanceModel=t}get coneInnerAngle(){return this._panner.coneInnerAngle}set coneInnerAngle(t){this._panner.coneInnerAngle=t}get coneOuterAngle(){return this._panner.coneOuterAngle}set coneOuterAngle(t){this._panner.coneOuterAngle=t}get coneOuterGain(){return this._panner.coneOuterGain}set coneOuterGain(t){this._panner.coneOuterGain=t}get maxDistance(){return this._panner.maxDistance}set maxDistance(t){this._panner.maxDistance=t}dispose(){return super.dispose(),this._panner.disconnect(),this.orientationX.dispose(),this.orientationY.dispose(),this.orientationZ.dispose(),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this}},hm=class Ln extends M{constructor(){const t=b(Ln.getDefaults(),arguments);super(t),this.name="Recorder",this.input=new B({context:this.context}),j(Ln.supported,"Media Recorder API is not available"),this._stream=this.context.createMediaStreamDestination(),this.input.connect(this._stream),this._recorder=new MediaRecorder(this._stream.stream,{mimeType:t.mimeType})}static getDefaults(){return M.getDefaults()}get mimeType(){return this._recorder.mimeType}static get supported(){return Ft!==null&&Reflect.has(Ft,"MediaRecorder")}get state(){return this._recorder.state==="inactive"?"stopped":this._recorder.state==="paused"?"paused":"started"}start(){return st(this,void 0,void 0,function*(){j(this.state!=="started","Recorder is already started");const t=new Promise(e=>{const s=()=>{this._recorder.removeEventListener("start",s,!1),e()};this._recorder.addEventListener("start",s,!1)});return this.state==="stopped"?this._recorder.start():this._recorder.resume(),yield t})}stop(){return st(this,void 0,void 0,function*(){j(this.state!=="stopped","Recorder is not started");const t=new Promise(e=>{const s=i=>{this._recorder.removeEventListener("dataavailable",s,!1),e(i.data)};this._recorder.addEventListener("dataavailable",s,!1)});return this._recorder.stop(),yield t})}pause(){return j(this.state==="started","Recorder must be started"),this._recorder.pause(),this}dispose(){return super.dispose(),this.input.dispose(),this._stream.disconnect(),this}},Re=class mc extends M{constructor(){const t=b(mc.getDefaults(),arguments,["threshold","ratio"]);super(t),this.name="Compressor",this._compressor=this.context.createDynamicsCompressor(),this.input=this._compressor,this.output=this._compressor,this.threshold=new $({minValue:this._compressor.threshold.minValue,maxValue:this._compressor.threshold.maxValue,context:this.context,convert:!1,param:this._compressor.threshold,units:"decibels",value:t.threshold}),this.attack=new $({minValue:this._compressor.attack.minValue,maxValue:this._compressor.attack.maxValue,context:this.context,param:this._compressor.attack,units:"time",value:t.attack}),this.release=new $({minValue:this._compressor.release.minValue,maxValue:this._compressor.release.maxValue,context:this.context,param:this._compressor.release,units:"time",value:t.release}),this.knee=new $({minValue:this._compressor.knee.minValue,maxValue:this._compressor.knee.maxValue,context:this.context,convert:!1,param:this._compressor.knee,units:"decibels",value:t.knee}),this.ratio=new $({minValue:this._compressor.ratio.minValue,maxValue:this._compressor.ratio.maxValue,context:this.context,convert:!1,param:this._compressor.ratio,units:"positive",value:t.ratio}),G(this,["knee","release","attack","ratio","threshold"])}static getDefaults(){return Object.assign(M.getDefaults(),{attack:.003,knee:30,ratio:12,release:.25,threshold:-24})}get reduction(){return this._compressor.reduction}dispose(){return super.dispose(),this._compressor.disconnect(),this.attack.dispose(),this.release.dispose(),this.threshold.dispose(),this.ratio.dispose(),this.knee.dispose(),this}},lm=class _c extends M{constructor(){const t=b(_c.getDefaults(),arguments,["threshold","smoothing"]);super(t),this.name="Gate",this._follower=new Ci({context:this.context,smoothing:t.smoothing}),this._gt=new Ho({context:this.context,value:He(t.threshold)}),this.input=new B({context:this.context}),this._gate=this.output=new B({context:this.context}),this.input.connect(this._gate),this.input.chain(this._follower,this._gt,this._gate.gain)}static getDefaults(){return Object.assign(M.getDefaults(),{smoothing:.1,threshold:-40})}get threshold(){return As(this._gt.value)}set threshold(t){this._gt.value=He(t)}get smoothing(){return this._follower.smoothing}set smoothing(t){this._follower.smoothing=t}dispose(){return super.dispose(),this.input.dispose(),this._follower.dis
vendor: 4,248 bytes, line 210
210pose(),this._gt.dispose(),this._gate.dispose(),this}},um=class gc extends M{constructor(){const t=b(gc.getDefaults(),arguments,["threshold"]);super(t),this.name="Limiter",this._compressor=this.input=this.output=new Re({context:this.context,ratio:20,attack:.003,release:.01,threshold:t.threshold}),this.threshold=this._compressor.threshold,G(this,"threshold")}static getDefaults(){return Object.assign(M.getDefaults(),{threshold:-12})}get reduction(){return this._compressor.reduction}dispose(){return super.dispose(),this._compressor.dispose(),this.threshold.dispose(),this}},dm=class vc extends M{constructor(){const t=b(vc.getDefaults(),arguments);super(t),this.name="MidSideCompressor",this._midSideSplit=this.input=new Ai({context:this.context}),this._midSideMerge=this.output=new Di({context:this.context}),this.mid=new Re(Object.assign(t.mid,{context:this.context})),this.side=new Re(Object.assign(t.side,{context:this.context})),this._midSideSplit.mid.chain(this.mid,this._midSideMerge.mid),this._midSideSplit.side.chain(this.side,this._midSideMerge.side),G(this,["mid","side"])}static getDefaults(){return Object.assign(M.getDefaults(),{mid:{ratio:3,threshold:-24,release:.03,attack:.02,knee:16},side:{ratio:6,threshold:-30,release:.25,attack:.03,knee:10}})}dispose(){return super.dispose(),this.mid.dispose(),this.side.dispose(),this._midSideSplit.dispose(),this._midSideMerge.dispose(),this}},pm=class yc extends M{constructor(){const t=b(yc.getDefaults(),arguments);super(t),this.name="MultibandCompressor",this._splitter=this.input=new Mi({context:this.context,lowFrequency:t.lowFrequency,highFrequency:t.highFrequency}),this.lowFrequency=this._splitter.lowFrequency,this.highFrequency=this._splitter.highFrequency,this.output=new B({context:this.context}),this.low=new Re(Object.assign(t.low,{context:this.context})),this.mid=new Re(Object.assign(t.mid,{context:this.context})),this.high=new Re(Object.assign(t.high,{context:this.context})),this._splitter.low.chain(this.low,this.output),this._splitter.mid.chain(this.mid,this.output),this._splitter.high.chain(this.high,this.output),G(this,["high","mid","low","highFrequency","lowFrequency"])}static getDefaults(){return Object.assign(M.getDefaults(),{lowFrequency:250,highFrequency:2e3,low:{ratio:6,threshold:-30,release:.25,attack:.03,knee:10},mid:{ratio:3,threshold:-24,release:.03,attack:.02,knee:16},high:{ratio:3,threshold:-24,release:.03,attack:.02,knee:16}})}dispose(){return super.dispose(),this._splitter.dispose(),this.low.dispose(),this.mid.dispose(),this.high.dispose(),this.output.dispose(),this}},fm=class wc extends M{constructor(){const t=b(wc.getDefaults(),arguments,["low","mid","high"]);super(t),this.name="EQ3",this.output=new B({context:this.context}),this._internalChannels=[],this.input=this._multibandSplit=new Mi({context:this.context,highFrequency:t.highFrequency,lowFrequency:t.lowFrequency}),this._lowGain=new B({context:this.context,gain:t.low,units:"decibels"}),this._midGain=new B({context:this.context,gain:t.mid,units:"decibels"}),this._highGain=new B({context:this.context,gain:t.high,units:"decibels"}),this.low=this._lowGain.gain,this.mid=this._midGain.gain,this.high=this._highGain.gain,this.Q=this._multibandSplit.Q,this.lowFrequency=this._multibandSplit.lowFrequency,this.highFrequency=this._multibandSplit.highFrequency,this._multibandSplit.low.chain(this._lowGain,this.output),this._multibandSplit.mid.chain(this._midGain,this.output),this._multibandSplit.high.chain(this._highGain,this.output),G(this,["low","mid","high","lowFrequency","highFrequency"]),this._internalChannels=[this._multibandSplit]}static getDefaults(){return Object.assign(M.getDefaults(),{high:0,highFrequency:2500,low:0,lowFrequency:400,mid:0})}dispose(){return super.dispose(),Cs(this,["low","mid","high","lowFrequency","highFrequency"]),this._multibandSplit.dispose(),this.lowFrequency.dispose(),this.highFrequency.dispose(),this._lowGain.dispose(),this._midGain.dispose(),this._highGain.dispose(),this.low.dispose(),this.mid.dispose(),this.high.dispose(),this.Q.dispose(),this}},mm=class xc extends M{constructor(){const t=b(xc.getDefaults(),arguments,["url","onload"]);super(t),this.name="Convolver",this._convolver=this.context.createConvolver(),this._buffer=new Ct
210(t.url,e=>{this.buffer=e,t.onload()}),this.input=new B({context:this.context}),this.output=new B({context:this.context}),this._buffer.loaded&&(this.buffer=this._buffer),this.normalize=t.normalize,this.input.chain(this._convolver,this.output)}static getDefaults(){return Object.assign(M.getDefaults(),{normalize:!0,onload:J})}load(t){return st(this,void 0,void 0,function*(){this.buffer=yield this._buffer.load(t)})}get buffer(){return this._buffer.length?this._buffer:null}set buffer(t){t&&this._buffer.set(t),this._convolver.buffer&&(this.input.disconnect(),this._convolver.disconnect(),this._convolver=this.context.createConvolver(),this.input.chain(this._convolver,this.output));const e=this._buffer.get();this._convolver.buffer=e||null}get normalize(){return this._convolver.normalize}set normalize(t){this._convolver.normalize=t}dispose(){return super.dispose(),this._buffer.dispose(),this._convolver.disconnect(),this}},u_=Wn({AMOscillator:()=>fi,AMSynth:()=>_f,Abs:()=>Zo,Add:()=>Os,AmplitudeEnvelope:()=>vn,Analyser:()=>Oi,AudioToGain:()=>fn,AutoFilter:()=>Ff,AutoPanner:()=>If,AutoWah:()=>qf,BaseContext:()=>li,BiquadFilter:()=>Rn,BitCrusher:()=>Pf,Buffer:()=>Om,BufferSource:()=>Em,Buffers:()=>Mm,Channel:()=>uc,Chebyshev:()=>Wf,Chorus:()=>jf,Clock:()=>un,Compressor:()=>Re,Context:()=>hn,Convolver:()=>mm,CrossFade:()=>yn,DCMeter:()=>rm,Delay:()=>se,Destination:()=>wm,Distortion:()=>Bf,Draw:()=>km,DuoSynth:()=>gf,EQ3:()=>fm,Emitter:()=>cn,Envelope:()=>Pt,FFT:()=>im,FMOscillator:()=>mn,FMSynth:()=>vf,FatOscillator:()=>mi,FeedbackCombFilter:()=>xi,FeedbackDelay:()=>zf,Filter:()=>te,Follower:()=>Ci,Freeverb:()=>Zf,Frequency:()=>$p,FrequencyClass:()=>he,FrequencyEnvelope:()=>Fn,FrequencyShifter:()=>Gf,Gain:()=>B,GainToAudio:()=>Qo,Gate:()=>lm,GrainPlayer:()=>ff,GreaterThan:()=>Ho,GreaterThanZero:()=>$o,IntervalTimeline:()=>wo,JCReverb:()=>$f,LFO:()=>Ut,Limiter:()=>um,Listener:()=>Tm,Loop:()=>qn,LowpassCombFilter:()=>Ti,Master:()=>xm,MembraneSynth:()=>vi,Merge:()=>us,MetalSynth:()=>yf,Meter:()=>nm,MidSideCompressor:()=>dm,MidSideMerge:()=>Di,MidSideSplit:()=>Ai,Midi:()=>rf,MidiClass:()=>Hs,Mono:()=>am,MonoSynth:()=>ms,MultibandCompressor:()=>pm,MultibandSplit:()=>Mi,Multiply:()=>pt,Negate:()=>gi,Noise:()=>ts,NoiseSynth:()=>wf,Offline:()=>nf,OfflineContext:()=>cs,OmniOscillator:()=>Ve,OnePoleFilter:()=>bi,Oscillator:()=>At,PWMOscillator:()=>_i,PanVol:()=>hc,Panner:()=>ki,Panner3D:()=>cm,Param:()=>$,Part:()=>Aa,Pattern:()=>Nf,Phaser:()=>Jf,PingPongDelay:()=>Yf,PitchShift:()=>Hf,Player:()=>gn,Players:()=>pf,PluckSynth:()=>Tf,PolySynth:()=>Sf,Pow:()=>pn,PulseOscillator:()=>_n,Recorder:()=>hm,Reverb:()=>Kf,Sampler:()=>Si,Scale:()=>Pe,ScaleExp:()=>Ko,Sequence:()=>Rf,Signal:()=>Z,Solo:()=>wn,Split:()=>Es,StateTimeline:()=>hs,StereoWidener:()=>tm,Subtract:()=>Ms,SyncedSignal:()=>mf,Synth:()=>es,Ticks:()=>of,TicksClass:()=>ct,Time:()=>Zp,TimeClass:()=>ge,Timeline:()=>ee,ToneAudioBuffer:()=>Ct,ToneAudioBuffers:()=>dn,ToneAudioNode:()=>M,ToneBufferSource:()=>ls,ToneEvent:()=>Ae,ToneOscillatorNode:()=>pi,Transport:()=>vm,TransportTime:()=>Yp,TransportTimeClass:()=>_t,Tremolo:()=>em,Unit:()=>hf,UserMedia:()=>df,Vibrato:()=>sm,Volume:()=>Be,WaveShaper:()=>be,Waveform:()=>om,Zero:()=>Lo,connect:()=>Vt,connectSeries:()=>Zt,connectSignal:()=>Ds,context:()=>Am,dbToGain:()=>He,debug:()=>Dp,defaultArg:()=>Yt,disconnect:()=>di,fanIn:()=>Hp,ftom:()=>Ce,gainToDb:()=>As,getContext:()=>rt,getDestination:()=>bm,getDraw:()=>Cm,getListener:()=>Sm,getTransport:()=>ym,immediate:()=>gm,intervalToFrequencyRatio:()=>Je,isArray:()=>kt,isBoolean:()=>oi,isDefined:()=>H,isFunction:()=>Xr,isNote:()=>ps,isNumber:()=>Gt,isObject:()=>we,isString:()=>re,isUndef:()=>Wt,loaded:()=>Dm,mtof:()=>ui,now:()=>_m,optionsFromArguments:()=>b,setContext:()=>Ys,start:()=>Bp,supported:()=>Ap,version:()=>jn});function _m(){return rt().now()}function gm(){return rt().immediate()}var vm=rt().transport;function ym(){return rt().transport}var wm=rt().destination,xm=rt().destination;function bm(){return rt().destination}var Tm=rt().listener;function Sm(){return rt().listener}var km=rt().draw;function Cm(){return rt().draw}var Am=rt();function Dm(){return Ct.loaded()}
210var Om=Ct,Mm=dn,Em=ls;export{u_ as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.