@blibliki/engine 0.1.26 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/index.js +19484 -0
  2. package/dist/index.umd.cjs +227 -0
  3. package/dist/{build → src}/Engine.d.ts +10 -9
  4. package/dist/{build → src}/core/IO/AudioNode.d.ts +6 -5
  5. package/dist/{build → src}/core/IO/Collection.d.ts +5 -4
  6. package/dist/{build → src}/core/IO/ForwardNode/Base.d.ts +6 -5
  7. package/dist/{build → src}/core/IO/ForwardNode/index.d.ts +6 -5
  8. package/dist/{build → src}/core/IO/MidiNode.d.ts +5 -4
  9. package/dist/{build → src}/core/IO/Node.d.ts +3 -2
  10. package/dist/{build → src}/core/IO/index.d.ts +6 -5
  11. package/dist/{build → src}/core/Module/MonoModule.d.ts +9 -8
  12. package/dist/{build → src}/core/Module/PolyModule.d.ts +8 -7
  13. package/dist/src/core/Module/index.d.ts +7 -0
  14. package/dist/{build → src}/core/midi/ComputerKeyboardInput.d.ts +3 -2
  15. package/dist/{build → src}/core/midi/MidiDevice.d.ts +2 -1
  16. package/dist/{build → src}/core/midi/MidiDeviceManager.d.ts +2 -1
  17. package/dist/{build → src}/core/midi/MidiEvent.d.ts +3 -2
  18. package/dist/src/core/midi/index.d.ts +5 -0
  19. package/dist/src/index.d.ts +9 -0
  20. package/dist/src/main.d.ts +0 -0
  21. package/dist/{build → src}/modules/BitCrusher.d.ts +3 -2
  22. package/dist/{build → src}/modules/Delay.d.ts +3 -2
  23. package/dist/{build → src}/modules/Distortion.d.ts +3 -2
  24. package/dist/{build → src}/modules/Effect.d.ts +3 -2
  25. package/dist/{build → src}/modules/Envelope/AmpEnvelope.d.ts +3 -2
  26. package/dist/{build → src}/modules/Envelope/Base.d.ts +4 -3
  27. package/dist/{build → src}/modules/Envelope/FreqEnvelope.d.ts +4 -3
  28. package/dist/src/modules/Envelope/index.d.ts +3 -0
  29. package/dist/{build → src}/modules/Filter.d.ts +4 -3
  30. package/dist/{build → src}/modules/LFO.d.ts +5 -4
  31. package/dist/{build → src}/modules/Master.d.ts +3 -2
  32. package/dist/{build → src}/modules/MidiSelector.d.ts +3 -2
  33. package/dist/{build → src}/modules/Oscillator.d.ts +7 -6
  34. package/dist/{build → src}/modules/Reverb.d.ts +3 -2
  35. package/dist/{build → src}/modules/Sequencer.d.ts +4 -3
  36. package/dist/{build → src}/modules/VirtualMidi.d.ts +7 -6
  37. package/dist/{build → src}/modules/VoiceScheduler.d.ts +6 -5
  38. package/dist/{build → src}/modules/Volume.d.ts +4 -3
  39. package/dist/src/modules/index.d.ts +18 -0
  40. package/dist/{build → src}/routes.d.ts +3 -2
  41. package/dist/test/MockingModules.d.ts +22 -0
  42. package/dist/test/Module/Oscillator.test.d.ts +1 -0
  43. package/dist/test/core/IO.test.d.ts +1 -0
  44. package/package.json +15 -16
  45. package/src/main.ts +1 -0
  46. package/src/modules/Oscillator.ts +14 -5
  47. package/src/modules/index.ts +2 -2
  48. package/src/vite-env.d.ts +1 -0
  49. package/dist/build/core/IO/ForwardNode.d.ts +0 -38
  50. package/dist/build/core/Module/index.d.ts +0 -6
  51. package/dist/build/core/midi/index.d.ts +0 -5
  52. package/dist/build/index.d.ts +0 -9
  53. package/dist/build/modules/Envelope/index.d.ts +0 -3
  54. package/dist/build/modules/index.d.ts +0 -17
  55. package/dist/main.cjs.js +0 -25
  56. package/dist/main.cjs.js.map +0 -1
  57. package/dist/main.esm.js +0 -25
  58. package/dist/main.esm.js.map +0 -1
  59. /package/dist/{build → src}/core/Note/frequencyTable.d.ts +0 -0
  60. /package/dist/{build → src}/core/Note/index.d.ts +0 -0
  61. /package/dist/{build → src}/types.d.ts +0 -0
  62. /package/dist/{build → src}/utils.d.ts +0 -0
@@ -0,0 +1,227 @@
1
+ (function(Bt,Pt){typeof exports=="object"&&typeof module<"u"?Pt(exports):typeof define=="function"&&define.amd?define(["exports"],Pt):(Bt=typeof globalThis<"u"?globalThis:Bt||self,Pt(Bt.Engine={}))})(this,function(Bt){"use strict";var ix=Object.defineProperty;var ox=(Bt,Pt,Te)=>Pt in Bt?ix(Bt,Pt,{enumerable:!0,configurable:!0,writable:!0,value:Te}):Bt[Pt]=Te;var M=(Bt,Pt,Te)=>(ox(Bt,typeof Pt!="symbol"?Pt+"":Pt,Te),Te);const Pt="14.7.77",Te=(n,t,e)=>({endTime:t,insertTime:e,type:"exponentialRampToValue",value:n}),to=(n,t,e)=>({endTime:t,insertTime:e,type:"linearRampToValue",value:n}),tr=(n,t)=>({startTime:t,type:"setValue",value:n}),eo=(n,t,e)=>({duration:e,startTime:t,type:"setValueCurve",values:n}),so=(n,t,{startTime:e,target:s,timeConstant:r})=>s+(t-s)*Math.exp((e-n)/r),es=n=>n.type==="exponentialRampToValue",tn=n=>n.type==="linearRampToValue",ke=n=>es(n)||tn(n),er=n=>n.type==="setValue",ve=n=>n.type==="setValueCurve",en=(n,t,e,s)=>{const r=n[t];return r===void 0?s:ke(r)||er(r)?r.value:ve(r)?r.values[r.values.length-1]:so(e,en(n,t-1,r.startTime,s),r)},no=(n,t,e,s,r)=>e===void 0?[s.insertTime,r]:ke(e)?[e.endTime,e.value]:er(e)?[e.startTime,e.value]:ve(e)?[e.startTime+e.duration,e.values[e.values.length-1]]:[e.startTime,en(n,t-1,e.startTime,r)],sr=n=>n.type==="cancelAndHold",nr=n=>n.type==="cancelScheduledValues",Fe=n=>sr(n)||nr(n)?n.cancelTime:es(n)||tn(n)?n.endTime:n.startTime,ro=(n,t,e,{endTime:s,value:r})=>e===r?r:0<e&&0<r||e<0&&r<0?e*(r/e)**((n-t)/(s-t)):0,io=(n,t,e,{endTime:s,value:r})=>e+(n-t)/(s-t)*(r-e),qc=(n,t)=>{const e=Math.floor(t),s=Math.ceil(t);return e===s?n[e]:(1-(t-e))*n[e]+(1-(s-t))*n[s]},Vc=(n,{duration:t,startTime:e,values:s})=>{const r=(n-e)/t*(s.length-1);return qc(s,r)},sn=n=>n.type==="setTarget";class Wc{constructor(t){this._automationEvents=[],this._currenTime=0,this._defaultValue=t}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}add(t){const e=Fe(t);if(sr(t)||nr(t)){const s=this._automationEvents.findIndex(i=>nr(t)&&ve(i)?i.startTime+i.duration>=e:Fe(i)>=e),r=this._automationEvents[s];if(s!==-1&&(this._automationEvents=this._automationEvents.slice(0,s)),sr(t)){const i=this._automationEvents[this._automationEvents.length-1];if(r!==void 0&&ke(r)){if(i!==void 0&&sn(i))throw new Error("The internal list is malformed.");const c=i===void 0?r.insertTime:ve(i)?i.startTime+i.duration:Fe(i),o=i===void 0?this._defaultValue:ve(i)?i.values[i.values.length-1]:i.value,u=es(r)?ro(e,c,o,r):io(e,c,o,r),a=es(r)?Te(u,e,this._currenTime):to(u,e,this._currenTime);this._automationEvents.push(a)}if(i!==void 0&&sn(i)&&this._automationEvents.push(tr(this.getValue(e),e)),i!==void 0&&ve(i)&&i.startTime+i.duration>e){const c=e-i.startTime,o=(i.values.length-1)/i.duration,u=Math.max(2,1+Math.ceil(c*o)),a=c/(u-1)*o,l=i.values.slice(0,u);if(a<1)for(let h=1;h<u;h+=1){const d=a*h%1;l[h]=i.values[h-1]*(1-d)+i.values[h]*d}this._automationEvents[this._automationEvents.length-1]=eo(l,i.startTime,c)}}}else{const s=this._automationEvents.findIndex(c=>Fe(c)>e),r=s===-1?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[s-1];if(r!==void 0&&ve(r)&&Fe(r)+r.duration>e)return!1;const i=es(t)?Te(t.value,t.endTime,this._currenTime):tn(t)?to(t.value,e,this._currenTime):t;if(s===-1)this._automationEvents.push(i);else{if(ve(t)&&e+t.duration>Fe(this._automationEvents[s]))return!1;this._automationEvents.splice(s,0,i)}}return!0}flush(t){const e=this._automationEvents.findIndex(s=>Fe(s)>t);if(e>1){const s=this._automationEvents.slice(e-1),r=s[0];sn(r)&&s.unshift(tr(en(this._automationEvents,e-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=s}}getValue(t){if(this._automationEvents.length===0)return this._defaultValue;const e=this._automationEvents.findIndex(c=>Fe(c)>t),s=this._automationEvents[e],r=(e===-1?this._automationEvents.length:e)-1,i=this._automationEvents[r];if(i!==void 0&&sn(i)&&(s===void 0||!ke(s)||s.insertTime>t))return so(t,en(this._automationEvents,r-1,i.startTime,this._defaultValue),i);if(i!==void 0&&er(i)&&(s===void 0||!ke(s)))return i.value;if(i!==void 0&&ve(i)&&(s===void 0||!ke(s)||i.startTime+i.duration>t))return t<i.startTime+i.duration?Vc(t,i):i.values[i.values.length-1];if(i!==void 0&&ke(i)&&(s===void 0||!ke(s)))return i.value;if(s!==void 0&&es(s)){const[c,o]=no(this._automationEvents,r,i,s,this._defaultValue);return ro(t,c,o,s)}if(s!==void 0&&tn(s)){const[c,o]=no(this._automationEvents,r,i,s,this._defaultValue);return io(t,c,o,s)}return this._defaultValue}}const Lc=n=>({cancelTime:n,type:"cancelAndHold"}),zc=n=>({cancelTime:n,type:"cancelScheduledValues"}),jc=(n,t)=>({endTime:t,type:"exponentialRampToValue",value:n}),Hc=(n,t)=>({endTime:t,type:"linearRampToValue",value:n}),Uc=(n,t,e)=>({startTime:t,target:n,timeConstant:e,type:"setTarget"}),Gc=()=>new DOMException("","AbortError"),$c=n=>(t,e,[s,r,i],c)=>{n(t[r],[e,s,i],o=>o[0]===e&&o[1]===s,c)},Xc=n=>(t,e,s)=>{const r=[];for(let i=0;i<s.numberOfInputs;i+=1)r.push(new Set);n.set(t,{activeInputs:r,outputs:new Set,passiveInputs:new WeakMap,renderer:e})},Zc=n=>(t,e)=>{n.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})},ss=new WeakSet,oo=new WeakMap,rr=new WeakMap,ao=new WeakMap,ir=new WeakMap,nn=new WeakMap,co=new WeakMap,or=new WeakMap,ar=new WeakMap,cr=new WeakMap,uo={construct(){return uo}},Yc=n=>{try{const t=new Proxy(n,uo);new t}catch{return!1}return!0},lo=/^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]*);?/,ho=(n,t)=>{const e=[];let s=n.replace(/^[\s]+/,""),r=s.match(lo);for(;r!==null;){const i=r[1].slice(1,-1),c=r[0].replace(/([\s]+)?;?$/,"").replace(i,new URL(i,t).toString());e.push(c),s=s.slice(r[0].length).replace(/^[\s]+/,""),r=s.match(lo)}return[e.join(";"),s]},po=n=>{if(n!==void 0&&!Array.isArray(n))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},fo=n=>{if(!Yc(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.")},Qc=(n,t,e,s,r,i,c,o,u,a,l,h,d)=>{let f=0;return(p,m,x={credentials:"omit"})=>{const v=l.get(p);if(v!==void 0&&v.has(m))return Promise.resolve();const _=a.get(p);if(_!==void 0){const y=_.get(m);if(y!==void 0)return y}const g=i(p),C=g.audioWorklet===void 0?r(m).then(([y,A])=>{const[w,b]=ho(y,A),k=`${w};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${b}
2
+ })})(window,'_AWGS')`;return e(k)}).then(()=>{const y=d._AWGS.pop();if(y===void 0)throw new SyntaxError;s(g.currentTime,g.sampleRate,()=>y(class{},void 0,(A,w)=>{if(A.trim()==="")throw t();const b=ar.get(g);if(b!==void 0){if(b.has(A))throw t();fo(w),po(w.parameterDescriptors),b.set(A,w)}else fo(w),po(w.parameterDescriptors),ar.set(g,new Map([[A,w]]))},g.sampleRate,void 0,void 0))}):Promise.all([r(m),Promise.resolve(n(h,h))]).then(([[y,A],w])=>{const b=f+1;f=b;const[k,E]=ho(y,A),N=`${k};((AudioWorkletProcessor,registerProcessor)=>{${E}
3
+ })(${w?"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{${w?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${w?"":"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${b}',class extends AudioWorkletProcessor{process(){return !1}})`,P=new Blob([N],{type:"application/javascript; charset=utf-8"}),q=URL.createObjectURL(P);return g.audioWorklet.addModule(q,x).then(()=>{if(o(g))return g;const W=c(g);return W.audioWorklet.addModule(q,x).then(()=>W)}).then(W=>{if(u===null)throw new SyntaxError;try{new u(W,`__sac${b}`)}catch{throw new SyntaxError}}).finally(()=>URL.revokeObjectURL(q))});return _===void 0?a.set(p,new Map([[m,C]])):_.set(m,C),C.then(()=>{const y=l.get(p);y===void 0?l.set(p,new Set([m])):y.add(m)}).finally(()=>{const y=a.get(p);y!==void 0&&y.delete(m)}),C}},Jt=(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},rn=(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},xo=(n,t,e,s)=>{const r=Jt(n,t),i=rn(r,c=>c[0]===e&&c[1]===s);return r.size===0&&n.delete(t),i},Cs=n=>Jt(co,n),ns=n=>{if(ss.has(n))throw new Error("The AudioNode is already stored.");ss.add(n),Cs(n).forEach(t=>t(!0))},mo=n=>"port"in n,As=n=>{if(!ss.has(n))throw new Error("The AudioNode is not stored.");ss.delete(n),Cs(n).forEach(t=>t(!1))},ur=(n,t)=>{!mo(n)&&t.every(e=>e.size===0)&&As(n)},Kc=(n,t,e,s,r,i,c,o,u,a,l,h,d)=>{const f=new WeakMap;return(p,m,x,v,_)=>{const{activeInputs:g,passiveInputs:C}=i(m),{outputs:y}=i(p),A=o(p),w=b=>{const k=u(m),E=u(p);if(b){const D=xo(C,p,x,v);n(g,p,D,!1),!_&&!h(p)&&e(E,k,x,v),d(m)&&ns(m)}else{const D=s(g,p,x,v);t(C,v,D,!1),!_&&!h(p)&&r(E,k,x,v);const T=c(m);if(T===0)l(m)&&ur(m,g);else{const F=f.get(m);F!==void 0&&clearTimeout(F),f.set(m,setTimeout(()=>{l(m)&&ur(m,g)},T*1e3))}}};return a(y,[m,x,v],b=>b[0]===m&&b[1]===x&&b[2]===v,!0)?(A.add(w),l(p)?n(g,p,[x,v,w],!0):t(C,v,[p,x,w],!0),!0):!1}},Jc=n=>(t,e,[s,r,i],c)=>{const o=t.get(s);o===void 0?t.set(s,new Set([[r,e,i]])):n(o,[r,e,i],u=>u[0]===r&&u[1]===e,c)},tu=n=>(t,e)=>{const s=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(s).connect(t.destination);const r=()=>{e.removeEventListener("ended",r),e.disconnect(s),s.disconnect()};e.addEventListener("ended",r)},eu=n=>(t,e)=>{n(t).add(e)},su={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},nu=(n,t,e,s,r,i)=>class extends n{constructor(o,u){const a=r(o),l={...su,...u},h=s(a,l),d=i(a)?t():null;super(o,!1,h,d),this._nativeAnalyserNode=h}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(o){this._nativeAnalyserNode.fftSize=o}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(o){const u=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=o,!(o>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=u,e()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(o){const u=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=o,!(this._nativeAnalyserNode.maxDecibels>o))throw this._nativeAnalyserNode.minDecibels=u,e()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(o){this._nativeAnalyserNode.smoothingTimeConstant=o}getByteFrequencyData(o){this._nativeAnalyserNode.getByteFrequencyData(o)}getByteTimeDomainData(o){this._nativeAnalyserNode.getByteTimeDomainData(o)}getFloatFrequencyData(o){this._nativeAnalyserNode.getFloatFrequencyData(o)}getFloatTimeDomainData(o){this._nativeAnalyserNode.getFloatTimeDomainData(o)}},Tt=(n,t)=>n.context===t,ru=(n,t,e)=>()=>{const s=new WeakMap,r=async(i,c)=>{let o=t(i);if(!Tt(o,c)){const a={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,fftSize:o.fftSize,maxDecibels:o.maxDecibels,minDecibels:o.minDecibels,smoothingTimeConstant:o.smoothingTimeConstant};o=n(c,a)}return s.set(c,o),await e(i,c,o),o};return{render(i,c){const o=s.get(c);return o!==void 0?Promise.resolve(o):r(i,c)}}},on=n=>{try{n.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},ae=()=>new DOMException("","IndexSizeError"),lr=n=>{n.getChannelData=(t=>e=>{try{return t.call(n,e)}catch(s){throw s.code===12?ae():s}})(n.getChannelData)},iu={numberOfChannels:1},ou=(n,t,e,s,r,i,c,o)=>{let u=null;return class Rc{constructor(l){if(r===null)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:h,numberOfChannels:d,sampleRate:f}={...iu,...l};u===null&&(u=new r(1,1,44100));const p=s!==null&&t(i,i)?new s({length:h,numberOfChannels:d,sampleRate:f}):u.createBuffer(d,h,f);if(p.numberOfChannels===0)throw e();return typeof p.copyFromChannel!="function"?(c(p),lr(p)):t(on,()=>on(p))||o(p),n.add(p),p}static[Symbol.hasInstance](l){return l!==null&&typeof l=="object"&&Object.getPrototypeOf(l)===Rc.prototype||n.has(l)}}},qt=-34028234663852886e22,St=-qt,ye=n=>ss.has(n),au={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},cu=(n,t,e,s,r,i,c,o)=>class extends n{constructor(a,l){const h=i(a),d={...au,...l},f=r(h,d),p=c(h),m=p?t():null;super(a,!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,St,qt)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(a){if(this._nativeAudioBufferSourceNode.buffer=a,a!==null){if(this._isBufferSet)throw s();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(a){this._nativeAudioBufferSourceNode.loop=a}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(a){this._nativeAudioBufferSourceNode.loopEnd=a}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(a){this._nativeAudioBufferSourceNode.loopStart=a}get onended(){return this._onended}set onended(a){const l=typeof a=="function"?o(this,a):null;this._nativeAudioBufferSourceNode.onended=l;const h=this._nativeAudioBufferSourceNode.onended;this._onended=h!==null&&h===l?a:h}get playbackRate(){return this._playbackRate}start(a=0,l=0,h){if(this._nativeAudioBufferSourceNode.start(a,l,h),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.start=h===void 0?[a,l]:[a,l,h]),this.context.state!=="closed"){ns(this);const d=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",d),ye(this)&&As(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",d)}}stop(a=0){this._nativeAudioBufferSourceNode.stop(a),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.stop=a)}},uu=(n,t,e,s,r)=>()=>{const i=new WeakMap;let c=null,o=null;const u=async(a,l)=>{let h=e(a);const d=Tt(h,l);if(!d){const f={buffer:h.buffer,channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,loop:h.loop,loopEnd:h.loopEnd,loopStart:h.loopStart,playbackRate:h.playbackRate.value};h=t(l,f),c!==null&&h.start(...c),o!==null&&h.stop(o)}return i.set(l,h),d?await n(l,a.playbackRate,h.playbackRate):await s(l,a.playbackRate,h.playbackRate),await r(a,l,h),h};return{set start(a){c=a},set stop(a){o=a},render(a,l){const h=i.get(l);return h!==void 0?Promise.resolve(h):u(a,l)}}},lu=n=>"playbackRate"in n,hu=n=>"frequency"in n&&"gain"in n,du=n=>"offset"in n,pu=n=>!("frequency"in n)&&"gain"in n,fu=n=>"detune"in n&&"frequency"in n,xu=n=>"pan"in n,Nt=n=>Jt(oo,n),bs=n=>Jt(ao,n),hr=(n,t)=>{const{activeInputs:e}=Nt(n);e.forEach(r=>r.forEach(([i])=>{t.includes(n)||hr(i,[...t,n])}));const s=lu(n)?[n.playbackRate]:mo(n)?Array.from(n.parameters.values()):hu(n)?[n.Q,n.detune,n.frequency,n.gain]:du(n)?[n.offset]:pu(n)?[n.gain]:fu(n)?[n.detune,n.frequency]:xu(n)?[n.pan]:[];for(const r of s){const i=bs(r);i!==void 0&&i.activeInputs.forEach(([c])=>hr(c,t))}ye(n)&&As(n)},_o=n=>{hr(n.destination,[])},mu=n=>n===void 0||typeof n=="number"||typeof n=="string"&&(n==="balanced"||n==="interactive"||n==="playback"),_u=(n,t,e,s,r,i,c,o,u)=>class extends n{constructor(l={}){if(u===null)throw new Error("Missing the native AudioContext constructor.");let h;try{h=new u(l)}catch(p){throw p.code===12&&p.message==="sampleRate is not in range"?e():p}if(h===null)throw s();if(!mu(l.latencyHint))throw new TypeError(`The provided value '${l.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(l.sampleRate!==void 0&&h.sampleRate!==l.sampleRate)throw e();super(h,2);const{latencyHint:d}=l,{sampleRate:f}=h;if(this._baseLatency=typeof h.baseLatency=="number"?h.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=h,u.name==="webkitAudioContext"?(this._nativeGainNode=h.createGain(),this._nativeOscillatorNode=h.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(h.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,h.state==="running"){this._state="suspended";const p=()=>{this._state==="suspended"&&(this._state=null),h.removeEventListener("statechange",p)};h.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()),_o(this)}))}createMediaElementSource(l){return new r(this,{mediaElement:l})}createMediaStreamDestination(){return new i(this)}createMediaStreamSource(l){return new c(this,{mediaStream:l})}createMediaStreamTrackSource(l){return new o(this,{mediaStreamTrack:l})}resume(){return this._state==="suspended"?new Promise((l,h)=>{const d=()=>{this._nativeAudioContext.removeEventListener("statechange",d),this._nativeAudioContext.state==="running"?l():this.resume().then(l,h)};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})}},gu=(n,t,e,s,r,i,c,o)=>class extends n{constructor(a,l){const h=i(a),d=c(h),f=r(h,l,d),p=d?t(o):null;super(a,!1,f,p),this._isNodeOfNativeOfflineAudioContext=d,this._nativeAudioDestinationNode=f}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(a){if(this._isNodeOfNativeOfflineAudioContext)throw s();if(a>this._nativeAudioDestinationNode.maxChannelCount)throw e();this._nativeAudioDestinationNode.channelCount=a}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(a){if(this._isNodeOfNativeOfflineAudioContext)throw s();this._nativeAudioDestinationNode.channelCountMode=a}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}},vu=n=>{const t=new WeakMap,e=async(s,r)=>{const i=r.destination;return t.set(r,i),await n(s,r,i),i};return{render(s,r){const i=t.get(r);return i!==void 0?Promise.resolve(i):e(s,r)}}},yu=(n,t,e,s,r,i,c,o)=>(u,a)=>{const l=a.listener,h=()=>{const y=new Float32Array(1),A=t(a,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),w=c(a);let b=!1,k=[0,0,-1,0,1,0],E=[0,0,0];const D=()=>{if(b)return;b=!0;const P=s(a,256,9,0);P.onaudioprocess=({inputBuffer:q})=>{const W=[i(q,y,0),i(q,y,1),i(q,y,2),i(q,y,3),i(q,y,4),i(q,y,5)];W.some((L,j)=>L!==k[j])&&(l.setOrientation(...W),k=W);const H=[i(q,y,6),i(q,y,7),i(q,y,8)];H.some((L,j)=>L!==E[j])&&(l.setPosition(...H),E=H)},A.connect(P)},T=P=>q=>{q!==k[P]&&(k[P]=q,l.setOrientation(...k))},F=P=>q=>{q!==E[P]&&(E[P]=q,l.setPosition(...E))},N=(P,q,W)=>{const H=e(a,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:q});H.connect(A,0,P),H.start(),Object.defineProperty(H.offset,"defaultValue",{get(){return q}});const L=n({context:u},w,H.offset,St,qt);return o(L,"value",j=>()=>j.call(L),j=>B=>{try{j.call(L,B)}catch(S){if(S.code!==9)throw S}D(),w&&W(B)}),L.cancelAndHoldAtTime=(j=>w?()=>{throw r()}:(...B)=>{const S=j.apply(L,B);return D(),S})(L.cancelAndHoldAtTime),L.cancelScheduledValues=(j=>w?()=>{throw r()}:(...B)=>{const S=j.apply(L,B);return D(),S})(L.cancelScheduledValues),L.exponentialRampToValueAtTime=(j=>w?()=>{throw r()}:(...B)=>{const S=j.apply(L,B);return D(),S})(L.exponentialRampToValueAtTime),L.linearRampToValueAtTime=(j=>w?()=>{throw r()}:(...B)=>{const S=j.apply(L,B);return D(),S})(L.linearRampToValueAtTime),L.setTargetAtTime=(j=>w?()=>{throw r()}:(...B)=>{const S=j.apply(L,B);return D(),S})(L.setTargetAtTime),L.setValueAtTime=(j=>w?()=>{throw r()}:(...B)=>{const S=j.apply(L,B);return D(),S})(L.setValueAtTime),L.setValueCurveAtTime=(j=>w?()=>{throw r()}:(...B)=>{const S=j.apply(L,B);return D(),S})(L.setValueCurveAtTime),L};return{forwardX:N(0,0,T(0)),forwardY:N(1,0,T(1)),forwardZ:N(2,-1,T(2)),positionX:N(6,0,F(0)),positionY:N(7,0,F(1)),positionZ:N(8,0,F(2)),upX:N(3,0,T(3)),upY:N(4,1,T(4)),upZ:N(5,0,T(5))}},{forwardX:d,forwardY:f,forwardZ:p,positionX:m,positionY:x,positionZ:v,upX:_,upY:g,upZ:C}=l.forwardX===void 0?h():l;return{get forwardX(){return d},get forwardY(){return f},get forwardZ(){return p},get positionX(){return m},get positionY(){return x},get positionZ(){return v},get upX(){return _},get upY(){return g},get upZ(){return C}}},an=n=>"context"in n,ws=n=>an(n[0]),ze=(n,t,e,s)=>{for(const r of n)if(e(r)){if(s)return!1;throw Error("The set contains at least one similar element.")}return n.add(t),!0},go=(n,t,[e,s],r)=>{ze(n,[t,e,s],i=>i[0]===t&&i[1]===e,r)},vo=(n,[t,e,s],r)=>{const i=n.get(t);i===void 0?n.set(t,new Set([[e,s]])):ze(i,[e,s],c=>c[0]===e,r)},rs=n=>"inputs"in n,cn=(n,t,e,s)=>{if(rs(t)){const r=t.inputs[s];return n.connect(r,e,0),[r,e,0]}return n.connect(t,e,s),[t,e,s]},yo=(n,t,e)=>{for(const s of n)if(s[0]===t&&s[1]===e)return n.delete(s),s;return null},Cu=(n,t,e)=>rn(n,s=>s[0]===t&&s[1]===e),Co=(n,t)=>{if(!Cs(n).delete(t))throw new Error("Missing the expected event listener.")},Ao=(n,t,e)=>{const s=Jt(n,t),r=rn(s,i=>i[0]===e);return s.size===0&&n.delete(t),r},un=(n,t,e,s)=>{rs(t)?n.disconnect(t.inputs[s],e,0):n.disconnect(t,e,s)},ht=n=>Jt(rr,n),Es=n=>Jt(ir,n),je=n=>or.has(n),ln=n=>!ss.has(n),bo=(n,t)=>new Promise(e=>{if(t!==null)e(!0);else{const s=n.createScriptProcessor(256,1,1),r=n.createGain(),i=n.createBuffer(1,2,44100),c=i.getChannelData(0);c[0]=1,c[1]=1;const o=n.createBufferSource();o.buffer=i,o.loop=!0,o.connect(s).connect(n.destination),o.connect(r),o.disconnect(r),s.onaudioprocess=u=>{const a=u.inputBuffer.getChannelData(0);Array.prototype.some.call(a,l=>l===1)?e(!0):e(!1),o.stop(),s.onaudioprocess=null,o.disconnect(s),s.disconnect(n.destination)},o.start()}}),dr=(n,t)=>{const e=new Map;for(const s of n)for(const r of s){const i=e.get(r);e.set(r,i===void 0?1:i+1)}e.forEach((s,r)=>t(r,s))},hn=n=>"context"in n,Au=n=>{const t=new Map;n.connect=(e=>(s,r=0,i=0)=>{const c=hn(s)?e(s,r,i):e(s,r),o=t.get(s);return o===void 0?t.set(s,[{input:i,output:r}]):o.every(u=>u.input!==i||u.output!==r)&&o.push({input:i,output:r}),c})(n.connect.bind(n)),n.disconnect=(e=>(s,r,i)=>{if(e.apply(n),s===void 0)t.clear();else if(typeof s=="number")for(const[c,o]of t){const u=o.filter(a=>a.output!==s);u.length===0?t.delete(c):t.set(c,u)}else if(t.has(s))if(r===void 0)t.delete(s);else{const c=t.get(s);if(c!==void 0){const o=c.filter(u=>u.output!==r&&(u.input!==i||i===void 0));o.length===0?t.delete(s):t.set(s,o)}}for(const[c,o]of t)o.forEach(u=>{hn(c)?n.connect(c,u.output,u.input):n.connect(c,u.output)})})(n.disconnect)},bu=(n,t,e,s)=>{const{activeInputs:r,passiveInputs:i}=bs(t),{outputs:c}=Nt(n),o=Cs(n),u=a=>{const l=ht(n),h=Es(t);if(a){const d=Ao(i,n,e);go(r,n,d,!1),!s&&!je(n)&&l.connect(h,e)}else{const d=Cu(r,n,e);vo(i,d,!1),!s&&!je(n)&&l.disconnect(h,e)}};return ze(c,[t,e],a=>a[0]===t&&a[1]===e,!0)?(o.add(u),ye(n)?go(r,n,[e,u],!0):vo(i,[n,e,u],!0),!0):!1},wu=(n,t,e,s)=>{const{activeInputs:r,passiveInputs:i}=Nt(t),c=yo(r[s],n,e);return c===null?[xo(i,n,e,s)[2],!1]:[c[2],!0]},Eu=(n,t,e)=>{const{activeInputs:s,passiveInputs:r}=bs(t),i=yo(s,n,e);return i===null?[Ao(r,n,e)[1],!1]:[i[2],!0]},pr=(n,t,e,s,r)=>{const[i,c]=wu(n,e,s,r);if(i!==null&&(Co(n,i),c&&!t&&!je(n)&&un(ht(n),ht(e),s,r)),ye(e)){const{activeInputs:o}=Nt(e);ur(e,o)}},fr=(n,t,e,s)=>{const[r,i]=Eu(n,e,s);r!==null&&(Co(n,r),i&&!t&&!je(n)&&ht(n).disconnect(Es(e),s))},Du=(n,t)=>{const e=Nt(n),s=[];for(const r of e.outputs)ws(r)?pr(n,t,...r):fr(n,t,...r),s.push(r[0]);return e.outputs.clear(),s},Tu=(n,t,e)=>{const s=Nt(n),r=[];for(const i of s.outputs)i[1]===e&&(ws(i)?pr(n,t,...i):fr(n,t,...i),r.push(i[0]),s.outputs.delete(i));return r},ku=(n,t,e,s,r)=>{const i=Nt(n);return Array.from(i.outputs).filter(c=>c[0]===e&&(s===void 0||c[1]===s)&&(r===void 0||c[2]===r)).map(c=>(ws(c)?pr(n,t,...c):fr(n,t,...c),i.outputs.delete(c),c[0]))},Fu=(n,t,e,s,r,i,c,o,u,a,l,h,d,f,p,m)=>class extends a{constructor(v,_,g,C){super(g),this._context=v,this._nativeAudioNode=g;const y=l(v);h(y)&&e(bo,()=>bo(y,m))!==!0&&Au(g),rr.set(this,g),co.set(this,new Set),v.state!=="closed"&&_&&ns(this),n(this,C,g)}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,_=0,g=0){if(_<0||_>=this._nativeAudioNode.numberOfOutputs)throw r();const C=l(this._context),y=p(C);if(d(v)||f(v))throw i();if(an(v)){const b=ht(v);try{const E=cn(this._nativeAudioNode,b,_,g),D=ln(this);(y||D)&&this._nativeAudioNode.disconnect(...E),this.context.state!=="closed"&&!D&&ln(v)&&ns(v)}catch(E){throw E.code===12?i():E}if(t(this,v,_,g,y)){const E=u([this],v);dr(E,s(y))}return v}const A=Es(v);if(A.name==="playbackRate"&&A.maxValue===1024)throw c();try{this._nativeAudioNode.connect(A,_),(y||ln(this))&&this._nativeAudioNode.disconnect(A,_)}catch(b){throw b.code===12?i():b}if(bu(this,v,_,y)){const b=u([this],v);dr(b,s(y))}}disconnect(v,_,g){let C;const y=l(this._context),A=p(y);if(v===void 0)C=Du(this,A);else if(typeof v=="number"){if(v<0||v>=this.numberOfOutputs)throw r();C=Tu(this,A,v)}else{if(_!==void 0&&(_<0||_>=this.numberOfOutputs)||an(v)&&g!==void 0&&(g<0||g>=v.numberOfInputs))throw r();if(C=ku(this,A,v,_,g),C.length===0)throw i()}for(const w of C){const b=u([this],w);dr(b,o)}}},Bu=(n,t,e,s,r,i,c,o,u,a,l,h,d)=>(f,p,m,x=null,v=null)=>{const _=m.value,g=new Wc(_),C=p?s(g):null,y={get defaultValue(){return _},get maxValue(){return x===null?m.maxValue:x},get minValue(){return v===null?m.minValue:v},get value(){return m.value},set value(A){m.value=A,y.setValueAtTime(A,f.context.currentTime)},cancelAndHoldAtTime(A){if(typeof m.cancelAndHoldAtTime=="function")C===null&&g.flush(f.context.currentTime),g.add(r(A)),m.cancelAndHoldAtTime(A);else{const w=Array.from(g).pop();C===null&&g.flush(f.context.currentTime),g.add(r(A));const b=Array.from(g).pop();m.cancelScheduledValues(A),w!==b&&b!==void 0&&(b.type==="exponentialRampToValue"?m.exponentialRampToValueAtTime(b.value,b.endTime):b.type==="linearRampToValue"?m.linearRampToValueAtTime(b.value,b.endTime):b.type==="setValue"?m.setValueAtTime(b.value,b.startTime):b.type==="setValueCurve"&&m.setValueCurveAtTime(b.values,b.startTime,b.duration))}return y},cancelScheduledValues(A){return C===null&&g.flush(f.context.currentTime),g.add(i(A)),m.cancelScheduledValues(A),y},exponentialRampToValueAtTime(A,w){if(A===0)throw new RangeError;if(!Number.isFinite(w)||w<0)throw new RangeError;const b=f.context.currentTime;return C===null&&g.flush(b),Array.from(g).length===0&&(g.add(a(_,b)),m.setValueAtTime(_,b)),g.add(c(A,w)),m.exponentialRampToValueAtTime(A,w),y},linearRampToValueAtTime(A,w){const b=f.context.currentTime;return C===null&&g.flush(b),Array.from(g).length===0&&(g.add(a(_,b)),m.setValueAtTime(_,b)),g.add(o(A,w)),m.linearRampToValueAtTime(A,w),y},setTargetAtTime(A,w,b){return C===null&&g.flush(f.context.currentTime),g.add(u(A,w,b)),m.setTargetAtTime(A,w,b),y},setValueAtTime(A,w){return C===null&&g.flush(f.context.currentTime),g.add(a(A,w)),m.setValueAtTime(A,w),y},setValueCurveAtTime(A,w,b){const k=A instanceof Float32Array?A:new Float32Array(A);if(h!==null&&h.name==="webkitAudioContext"){const E=w+b,D=f.context.sampleRate,T=Math.ceil(w*D),F=Math.floor(E*D),N=F-T,P=new Float32Array(N);for(let W=0;W<N;W+=1){const H=(k.length-1)/b*((T+W)/D-w),L=Math.floor(H),j=Math.ceil(H);P[W]=L===j?k[L]:(1-(H-L))*k[L]+(1-(j-H))*k[j]}C===null&&g.flush(f.context.currentTime),g.add(l(P,w,b)),m.setValueCurveAtTime(P,w,b);const q=F/D;q<E&&d(y,P[P.length-1],q),d(y,k[k.length-1],E)}else C===null&&g.flush(f.context.currentTime),g.add(l(k,w,b)),m.setValueCurveAtTime(k,w,b);return y}};return e.set(y,m),t.set(y,f),n(y,C),y},Su=n=>({replay(t){for(const e of n)if(e.type==="exponentialRampToValue"){const{endTime:s,value:r}=e;t.exponentialRampToValueAtTime(r,s)}else if(e.type==="linearRampToValue"){const{endTime:s,value:r}=e;t.linearRampToValueAtTime(r,s)}else if(e.type==="setTarget"){const{startTime:s,target:r,timeConstant:i}=e;t.setTargetAtTime(r,s,i)}else if(e.type==="setValue"){const{startTime:s,value:r}=e;t.setValueAtTime(r,s)}else if(e.type==="setValueCurve"){const{duration:s,startTime:r,values:i}=e;t.setValueCurveAtTime(i,r,s)}else throw new Error("Can't apply an unknown automation.")}});class wo{constructor(t){this._map=new Map(t)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(t,e=null){return this._map.forEach((s,r)=>t.call(e,s,r,this))}get(t){return this._map.get(t)}has(t){return this._map.has(t)}keys(){return this._map.keys()}values(){return this._map.values()}}const Nu={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}},Ou=(n,t,e,s,r,i,c,o,u,a,l,h,d,f)=>class extends t{constructor(m,x,v){var _;const g=o(m),C=u(g),y=l({...Nu,...v});d(y);const A=ar.get(g),w=A==null?void 0:A.get(x),b=C||g.state!=="closed"?g:(_=c(g))!==null&&_!==void 0?_:g,k=r(b,C?null:m.baseLatency,a,x,w,y),E=C?s(x,y,w):null;super(m,!0,k,E);const D=[];k.parameters.forEach((F,N)=>{const P=e(this,C,F);D.push([N,P])}),this._nativeAudioWorkletNode=k,this._onprocessorerror=null,this._parameters=new wo(D),C&&n(g,this);const{activeInputs:T}=i(this);h(k,T)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(m){const x=typeof m=="function"?f(this,m):null;this._nativeAudioWorkletNode.onprocessorerror=x;const v=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=v!==null&&v===x?m:v}get parameters(){return this._parameters===null?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}};function dn(n,t,e,s,r){if(typeof n.copyFromChannel=="function")t[e].byteLength===0&&(t[e]=new Float32Array(128)),n.copyFromChannel(t[e],s,r);else{const i=n.getChannelData(s);if(t[e].byteLength===0)t[e]=i.slice(r,r+128);else{const c=new Float32Array(i.buffer,r*Float32Array.BYTES_PER_ELEMENT,128);t[e].set(c)}}}const Eo=(n,t,e,s,r)=>{typeof n.copyToChannel=="function"?t[e].byteLength!==0&&n.copyToChannel(t[e],s,r):t[e].byteLength!==0&&n.getChannelData(s).set(t[e],r)},pn=(n,t)=>{const e=[];for(let s=0;s<n;s+=1){const r=[],i=typeof t=="number"?t:t[s];for(let c=0;c<i;c+=1)r.push(new Float32Array(128));e.push(r)}return e},Mu=(n,t)=>{const e=Jt(cr,n),s=ht(t);return Jt(e,s)},Iu=async(n,t,e,s,r,i,c)=>{const o=t===null?Math.ceil(n.context.length/128)*128:t.length,u=s.channelCount*s.numberOfInputs,a=r.reduce((x,v)=>x+v,0),l=a===0?null:e.createBuffer(a,o,e.sampleRate);if(i===void 0)throw new Error("Missing the processor constructor.");const h=Nt(n),d=await Mu(e,n),f=pn(s.numberOfInputs,s.channelCount),p=pn(s.numberOfOutputs,r),m=Array.from(n.parameters.keys()).reduce((x,v)=>({...x,[v]:new Float32Array(128)}),{});for(let x=0;x<o;x+=128){if(s.numberOfInputs>0&&t!==null)for(let v=0;v<s.numberOfInputs;v+=1)for(let _=0;_<s.channelCount;_+=1)dn(t,f[v],_,_,x);i.parameterDescriptors!==void 0&&t!==null&&i.parameterDescriptors.forEach(({name:v},_)=>{dn(t,m,v,u+_,x)});for(let v=0;v<s.numberOfInputs;v+=1)for(let _=0;_<r[v];_+=1)p[v][_].byteLength===0&&(p[v][_]=new Float32Array(128));try{const v=f.map((g,C)=>h.activeInputs[C].size===0?[]:g),_=c(x/e.sampleRate,e.sampleRate,()=>d.process(v,p,m));if(l!==null)for(let g=0,C=0;g<s.numberOfOutputs;g+=1){for(let y=0;y<r[g];y+=1)Eo(l,p[g],y,C+y,x);C+=r[g]}if(!_)break}catch(v){n.dispatchEvent(new ErrorEvent("processorerror",{colno:v.colno,filename:v.filename,lineno:v.lineno,message:v.message}));break}}return l},Ru=(n,t,e,s,r,i,c,o,u,a,l,h,d,f,p,m)=>(x,v,_)=>{const g=new WeakMap;let C=null;const y=async(A,w)=>{let b=l(A),k=null;const E=Tt(b,w),D=Array.isArray(v.outputChannelCount)?v.outputChannelCount:Array.from(v.outputChannelCount);if(h===null){const T=D.reduce((q,W)=>q+W,0),F=r(w,{channelCount:Math.max(1,T),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,T)}),N=[];for(let q=0;q<A.numberOfOutputs;q+=1)N.push(s(w,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:D[q]}));const P=c(w,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1});P.connect=t.bind(null,N),P.disconnect=u.bind(null,N),k=[F,N,P]}else E||(b=new h(w,x));if(g.set(w,k===null?b:k[2]),k!==null){if(C===null){if(_===void 0)throw new Error("Missing the processor constructor.");if(d===null)throw new Error("Missing the native OfflineAudioContext constructor.");const W=A.channelCount*A.numberOfInputs,H=_.parameterDescriptors===void 0?0:_.parameterDescriptors.length,L=W+H;C=Iu(A,L===0?null:await(async()=>{const B=new d(L,Math.ceil(A.context.length/128)*128,w.sampleRate),S=[],R=[];for(let X=0;X<v.numberOfInputs;X+=1)S.push(c(B,{channelCount:v.channelCount,channelCountMode:v.channelCountMode,channelInterpretation:v.channelInterpretation,gain:1})),R.push(r(B,{channelCount:v.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:v.channelCount}));const O=await Promise.all(Array.from(A.parameters.values()).map(async X=>{const nt=i(B,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:X.value});return await f(B,X,nt.offset),nt})),U=s(B,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,W+H)});for(let X=0;X<v.numberOfInputs;X+=1){S[X].connect(R[X]);for(let nt=0;nt<v.channelCount;nt+=1)R[X].connect(U,nt,X*v.channelCount+nt)}for(const[X,nt]of O.entries())nt.connect(U,0,W+X),nt.start(0);return U.connect(B.destination),await Promise.all(S.map(X=>p(A,B,X))),m(B)})(),w,v,D,_,a)}const T=await C,F=e(w,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[N,P,q]=k;T!==null&&(F.buffer=T,F.start(0)),F.connect(N);for(let W=0,H=0;W<A.numberOfOutputs;W+=1){const L=P[W];for(let j=0;j<D[W];j+=1)N.connect(L,H+j,j);H+=D[W]}return q}if(E)for(const[T,F]of A.parameters.entries())await n(w,F,b.parameters.get(T));else for(const[T,F]of A.parameters.entries())await f(w,F,b.parameters.get(T));return await p(A,w,b),b};return{render(A,w){o(w,A);const b=g.get(w);return b!==void 0?Promise.resolve(b):y(A,w)}}},Pu=(n,t,e,s,r,i,c,o,u,a,l,h,d,f,p,m,x,v,_,g)=>class extends p{constructor(y,A){super(y,A),this._nativeContext=y,this._audioWorklet=n===void 0?void 0:{addModule:(w,b)=>n(this,w,b)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new t(this)}createBiquadFilter(){return new r(this)}createBuffer(y,A,w){return new e({length:A,numberOfChannels:y,sampleRate:w})}createBufferSource(){return new s(this)}createChannelMerger(y=6){return new i(this,{numberOfInputs:y})}createChannelSplitter(y=6){return new c(this,{numberOfOutputs:y})}createConstantSource(){return new o(this)}createConvolver(){return new u(this)}createDelay(y=1){return new l(this,{maxDelayTime:y})}createDynamicsCompressor(){return new h(this)}createGain(){return new d(this)}createIIRFilter(y,A){return new f(this,{feedback:A,feedforward:y})}createOscillator(){return new m(this)}createPanner(){return new x(this)}createPeriodicWave(y,A,w={disableNormalization:!1}){return new v(this,{...w,imag:A,real:y})}createStereoPanner(){return new _(this)}createWaveShaper(){return new g(this)}decodeAudioData(y,A,w){return a(this._nativeContext,y).then(b=>(typeof A=="function"&&A(b),b),b=>{throw typeof w=="function"&&w(b),b})}},qu={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},Vu=(n,t,e,s,r,i,c,o)=>class extends n{constructor(a,l){const h=i(a),d={...qu,...l},f=r(h,d),p=c(h),m=p?e():null;super(a,!1,f,m),this._Q=t(this,p,f.Q,St,qt),this._detune=t(this,p,f.detune,1200*Math.log2(St),-1200*Math.log2(St)),this._frequency=t(this,p,f.frequency,a.sampleRate/2,0),this._gain=t(this,p,f.gain,40*Math.log10(St),qt),this._nativeBiquadFilterNode=f,o(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(a){this._nativeBiquadFilterNode.type=a}getFrequencyResponse(a,l,h){try{this._nativeBiquadFilterNode.getFrequencyResponse(a,l,h)}catch(d){throw d.code===11?s():d}if(a.length!==l.length||l.length!==h.length)throw s()}},Wu=(n,t,e,s,r)=>()=>{const i=new WeakMap,c=async(o,u)=>{let a=e(o);const l=Tt(a,u);if(!l){const h={Q:a.Q.value,channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,detune:a.detune.value,frequency:a.frequency.value,gain:a.gain.value,type:a.type};a=t(u,h)}return i.set(u,a),l?(await n(u,o.Q,a.Q),await n(u,o.detune,a.detune),await n(u,o.frequency,a.frequency),await n(u,o.gain,a.gain)):(await s(u,o.Q,a.Q),await s(u,o.detune,a.detune),await s(u,o.frequency,a.frequency),await s(u,o.gain,a.gain)),await r(o,u,a),a};return{render(o,u){const a=i.get(u);return a!==void 0?Promise.resolve(a):c(o,u)}}},Lu=(n,t)=>(e,s)=>{const r=t.get(e);if(r!==void 0)return r;const i=n.get(e);if(i!==void 0)return i;try{const c=s();return c instanceof Promise?(n.set(e,c),c.catch(()=>!1).then(o=>(n.delete(e),t.set(e,o),o))):(t.set(e,c),c)}catch{return t.set(e,!1),!1}},zu={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},ju=(n,t,e,s,r)=>class extends n{constructor(c,o){const u=s(c),a={...zu,...o},l=e(u,a),h=r(u)?t():null;super(c,!1,l,h)}},Hu=(n,t,e)=>()=>{const s=new WeakMap,r=async(i,c)=>{let o=t(i);if(!Tt(o,c)){const a={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfInputs:o.numberOfInputs};o=n(c,a)}return s.set(c,o),await e(i,c,o),o};return{render(i,c){const o=s.get(c);return o!==void 0?Promise.resolve(o):r(i,c)}}},Uu={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Gu=(n,t,e,s,r,i)=>class extends n{constructor(o,u){const a=s(o),l=i({...Uu,...u}),h=e(a,l),d=r(a)?t():null;super(o,!1,h,d)}},$u=(n,t,e)=>()=>{const s=new WeakMap,r=async(i,c)=>{let o=t(i);if(!Tt(o,c)){const a={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfOutputs:o.numberOfOutputs};o=n(c,a)}return s.set(c,o),await e(i,c,o),o};return{render(i,c){const o=s.get(c);return o!==void 0?Promise.resolve(o):r(i,c)}}},Xu=n=>(t,e,s)=>n(e,t,s),Zu=n=>(t,e,s=0,r=0)=>{const i=t[s];if(i===void 0)throw n();return hn(e)?i.connect(e,0,r):i.connect(e,0)},Yu=n=>(t,e)=>{const s=n(t,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),r=t.createBuffer(1,2,44100);return s.buffer=r,s.loop=!0,s.connect(e),s.start(),()=>{s.stop(),s.disconnect(e)}},Qu={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},Ku=(n,t,e,s,r,i,c)=>class extends n{constructor(u,a){const l=r(u),h={...Qu,...a},d=s(l,h),f=i(l),p=f?e():null;super(u,!1,d,p),this._constantSourceNodeRenderer=p,this._nativeConstantSourceNode=d,this._offset=t(this,f,d.offset,St,qt),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(u){const a=typeof u=="function"?c(this,u):null;this._nativeConstantSourceNode.onended=a;const l=this._nativeConstantSourceNode.onended;this._onended=l!==null&&l===a?u:l}start(u=0){if(this._nativeConstantSourceNode.start(u),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.start=u),this.context.state!=="closed"){ns(this);const a=()=>{this._nativeConstantSourceNode.removeEventListener("ended",a),ye(this)&&As(this)};this._nativeConstantSourceNode.addEventListener("ended",a)}}stop(u=0){this._nativeConstantSourceNode.stop(u),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.stop=u)}},Ju=(n,t,e,s,r)=>()=>{const i=new WeakMap;let c=null,o=null;const u=async(a,l)=>{let h=e(a);const d=Tt(h,l);if(!d){const f={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,offset:h.offset.value};h=t(l,f),c!==null&&h.start(c),o!==null&&h.stop(o)}return i.set(l,h),d?await n(l,a.offset,h.offset):await s(l,a.offset,h.offset),await r(a,l,h),h};return{set start(a){c=a},set stop(a){o=a},render(a,l){const h=i.get(l);return h!==void 0?Promise.resolve(h):u(a,l)}}},t0=n=>t=>(n[0]=t,n[0]),e0={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},s0=(n,t,e,s,r,i)=>class extends n{constructor(o,u){const a=s(o),l={...e0,...u},h=e(a,l),f=r(a)?t():null;super(o,!1,h,f),this._isBufferNullified=!1,this._nativeConvolverNode=h,l.buffer!==null&&i(this,l.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(o){if(this._nativeConvolverNode.buffer=o,o===null&&this._nativeConvolverNode.buffer!==null){const u=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=u.createBuffer(1,1,u.sampleRate),this._isBufferNullified=!0,i(this,0)}else this._isBufferNullified=!1,i(this,this._nativeConvolverNode.buffer===null?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(o){this._nativeConvolverNode.normalize=o}},n0=(n,t,e)=>()=>{const s=new WeakMap,r=async(i,c)=>{let o=t(i);if(!Tt(o,c)){const a={buffer:o.buffer,channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,disableNormalization:!o.normalize};o=n(c,a)}return s.set(c,o),rs(o)?await e(i,c,o.inputs[0]):await e(i,c,o),o};return{render(i,c){const o=s.get(c);return o!==void 0?Promise.resolve(o):r(i,c)}}},r0=(n,t)=>(e,s,r)=>{if(t===null)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new t(e,s,r)}catch(i){throw i.name==="SyntaxError"?n():i}},i0=()=>new DOMException("","DataCloneError"),Do=n=>{const{port1:t,port2:e}=new MessageChannel;return new Promise(s=>{const r=()=>{e.onmessage=null,t.close(),e.close(),s()};e.onmessage=()=>r();try{t.postMessage(n,[n])}catch{}finally{r()}})},o0=(n,t,e,s,r,i,c,o,u,a,l)=>(h,d)=>{const f=c(h)?h:i(h);if(r.has(d)){const p=e();return Promise.reject(p)}try{r.add(d)}catch{}return t(u,()=>u(f))?f.decodeAudioData(d).then(p=>(Do(d).catch(()=>{}),t(o,()=>o(p))||l(p),n.add(p),p)):new Promise((p,m)=>{const x=async()=>{try{await Do(d)}catch{}},v=_=>{m(_),x()};try{f.decodeAudioData(d,_=>{typeof _.copyFromChannel!="function"&&(a(_),lr(_)),n.add(_),x().then(()=>p(_))},_=>{v(_===null?s():_)})}catch(_){v(_)}})},a0=(n,t,e,s,r,i,c,o)=>(u,a)=>{const l=t.get(u);if(l===void 0)throw new Error("Missing the expected cycle count.");const h=i(u.context),d=o(h);if(l===a){if(t.delete(u),!d&&c(u)){const f=s(u),{outputs:p}=e(u);for(const m of p)if(ws(m)){const x=s(m[0]);n(f,x,m[1],m[2])}else{const x=r(m[0]);f.connect(x,m[1])}}}else t.set(u,l-a)},c0={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},u0=(n,t,e,s,r,i,c)=>class extends n{constructor(u,a){const l=r(u),h={...c0,...a},d=s(l,h),f=i(l),p=f?e(h.maxDelayTime):null;super(u,!1,d,p),this._delayTime=t(this,f,d.delayTime),c(this,h.maxDelayTime)}get delayTime(){return this._delayTime}},l0=(n,t,e,s,r)=>i=>{const c=new WeakMap,o=async(u,a)=>{let l=e(u);const h=Tt(l,a);if(!h){const d={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,delayTime:l.delayTime.value,maxDelayTime:i};l=t(a,d)}return c.set(a,l),h?await n(a,u.delayTime,l.delayTime):await s(a,u.delayTime,l.delayTime),await r(u,a,l),l};return{render(u,a){const l=c.get(a);return l!==void 0?Promise.resolve(l):o(u,a)}}},h0=n=>(t,e,s,r)=>n(t[r],i=>i[0]===e&&i[1]===s),d0=n=>(t,e)=>{n(t).delete(e)},p0=n=>"delayTime"in n,f0=(n,t,e)=>function s(r,i){const c=an(i)?i:e(n,i);if(p0(c))return[];if(r[0]===c)return[r];if(r.includes(c))return[];const{outputs:o}=t(c);return Array.from(o).map(u=>s([...r,c],u[0])).reduce((u,a)=>u.concat(a),[])},fn=(n,t,e)=>{const s=t[e];if(s===void 0)throw n();return s},x0=n=>(t,e=void 0,s=void 0,r=0)=>e===void 0?t.forEach(i=>i.disconnect()):typeof e=="number"?fn(n,t,e).disconnect():hn(e)?s===void 0?t.forEach(i=>i.disconnect(e)):r===void 0?fn(n,t,s).disconnect(e,0):fn(n,t,s).disconnect(e,0,r):s===void 0?t.forEach(i=>i.disconnect(e)):fn(n,t,s).disconnect(e,0),m0={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},_0=(n,t,e,s,r,i,c,o)=>class extends n{constructor(a,l){const h=i(a),d={...m0,...l},f=s(h,d),p=c(h),m=p?e():null;super(a,!1,f,m),this._attack=t(this,p,f.attack),this._knee=t(this,p,f.knee),this._nativeDynamicsCompressorNode=f,this._ratio=t(this,p,f.ratio),this._release=t(this,p,f.release),this._threshold=t(this,p,f.threshold),o(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(a){const l=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=a,a>2)throw this._nativeDynamicsCompressorNode.channelCount=l,r()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(a){const l=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=a,a==="max")throw this._nativeDynamicsCompressorNode.channelCountMode=l,r()}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}},g0=(n,t,e,s,r)=>()=>{const i=new WeakMap,c=async(o,u)=>{let a=e(o);const l=Tt(a,u);if(!l){const h={attack:a.attack.value,channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,knee:a.knee.value,ratio:a.ratio.value,release:a.release.value,threshold:a.threshold.value};a=t(u,h)}return i.set(u,a),l?(await n(u,o.attack,a.attack),await n(u,o.knee,a.knee),await n(u,o.ratio,a.ratio),await n(u,o.release,a.release),await n(u,o.threshold,a.threshold)):(await s(u,o.attack,a.attack),await s(u,o.knee,a.knee),await s(u,o.ratio,a.ratio),await s(u,o.release,a.release),await s(u,o.threshold,a.threshold)),await r(o,u,a),a};return{render(o,u){const a=i.get(u);return a!==void 0?Promise.resolve(a):c(o,u)}}},v0=()=>new DOMException("","EncodingError"),y0=n=>t=>new Promise((e,s)=>{if(n===null){s(new SyntaxError);return}const r=n.document.head;if(r===null)s(new SyntaxError);else{const i=n.document.createElement("script"),c=new Blob([t],{type:"application/javascript"}),o=URL.createObjectURL(c),u=n.onerror,a=()=>{n.onerror=u,URL.revokeObjectURL(o)};n.onerror=(l,h,d,f,p)=>{if(h===o||h===n.location.href&&d===1&&f===1)return a(),s(p),!1;if(u!==null)return u(l,h,d,f,p)},i.onerror=()=>{a(),s(new SyntaxError)},i.onload=()=>{a(),e()},i.src=o,i.type="module",r.appendChild(i)}}),C0=n=>class{constructor(e){this._nativeEventTarget=e,this._listeners=new WeakMap}addEventListener(e,s,r){if(s!==null){let i=this._listeners.get(s);i===void 0&&(i=n(this,s),typeof s=="function"&&this._listeners.set(s,i)),this._nativeEventTarget.addEventListener(e,i,r)}}dispatchEvent(e){return this._nativeEventTarget.dispatchEvent(e)}removeEventListener(e,s,r){const i=s===null?void 0:this._listeners.get(s);this._nativeEventTarget.removeEventListener(e,i===void 0?null:i,r)}},A0=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)}},b0=n=>async t=>{try{const e=await fetch(t);if(e.ok)return[await e.text(),e.url]}catch{}throw n()},w0={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},E0=(n,t,e,s,r,i)=>class extends n{constructor(o,u){const a=r(o),l={...w0,...u},h=s(a,l),d=i(a),f=d?e():null;super(o,!1,h,f),this._gain=t(this,d,h.gain,St,qt)}get gain(){return this._gain}},D0=(n,t,e,s,r)=>()=>{const i=new WeakMap,c=async(o,u)=>{let a=e(o);const l=Tt(a,u);if(!l){const h={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,gain:a.gain.value};a=t(u,h)}return i.set(u,a),l?await n(u,o.gain,a.gain):await s(u,o.gain,a.gain),await r(o,u,a),a};return{render(o,u){const a=i.get(u);return a!==void 0?Promise.resolve(a):c(o,u)}}},T0=(n,t)=>e=>t(n,e),k0=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},F0=n=>t=>{var e;return(e=n.get(t))!==null&&e!==void 0?e:0},B0=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},S0=n=>t=>n.get(t),bt=()=>new DOMException("","InvalidStateError"),N0=n=>t=>{const e=n.get(t);if(e===void 0)throw bt();return e},O0=(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},M0=n=>t=>{const e=n.get(t);if(e===void 0)throw new Error("The context has no set of AudioWorkletNodes.");return e},xn=()=>new DOMException("","InvalidAccessError"),I0=n=>{n.getFrequencyResponse=(t=>(e,s,r)=>{if(e.length!==s.length||s.length!==r.length)throw xn();return t.call(n,e,s,r)})(n.getFrequencyResponse)},R0={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},P0=(n,t,e,s,r,i)=>class extends n{constructor(o,u){const a=s(o),l=r(a),h={...R0,...u},d=t(a,l?null:o.baseLatency,h),f=l?e(h.feedback,h.feedforward):null;super(o,!1,d,f),I0(d),this._nativeIIRFilterNode=d,i(this,1)}getFrequencyResponse(o,u,a){return this._nativeIIRFilterNode.getFrequencyResponse(o,u,a)}},To=(n,t,e,s,r,i,c,o,u,a,l)=>{const h=a.length;let d=o;for(let f=0;f<h;f+=1){let p=e[0]*a[f];for(let m=1;m<r;m+=1){const x=d-m&u-1;p+=e[m]*i[x],p-=n[m]*c[x]}for(let m=r;m<s;m+=1)p+=e[m]*i[d-m&u-1];for(let m=r;m<t;m+=1)p-=n[m]*c[d-m&u-1];i[d]=a[f],c[d]=p,d=d+1&u-1,l[f]=p}return d},q0=(n,t,e,s)=>{const r=e instanceof Float64Array?e:new Float64Array(e),i=s instanceof Float64Array?s:new Float64Array(s),c=r.length,o=i.length,u=Math.min(c,o);if(r[0]!==1){for(let p=0;p<c;p+=1)i[p]/=r[0];for(let p=1;p<o;p+=1)r[p]/=r[0]}const a=32,l=new Float32Array(a),h=new Float32Array(a),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),x=d.getChannelData(p);l.fill(0),h.fill(0),To(r,c,i,o,u,l,h,0,a,m,x)}return d},V0=(n,t,e,s,r)=>(i,c)=>{const o=new WeakMap;let u=null;const a=async(l,h)=>{let d=null,f=t(l);const p=Tt(f,h);if(h.createIIRFilter===void 0?d=n(h,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):p||(f=h.createIIRFilter(c,i)),o.set(h,d===null?f:d),d!==null){if(u===null){if(e===null)throw new Error("Missing the native OfflineAudioContext constructor.");const x=new e(l.context.destination.channelCount,l.context.length,h.sampleRate);u=(async()=>{await s(l,x,x.destination);const v=await r(x);return q0(v,h,i,c)})()}const m=await u;return d.buffer=m,d.start(0),d}return await s(l,h,f),f};return{render(l,h){const d=o.get(h);return d!==void 0?Promise.resolve(d):a(l,h)}}},W0=(n,t,e,s,r,i)=>c=>(o,u)=>{const a=n.get(o);if(a===void 0){if(!c&&i(o)){const l=s(o),{outputs:h}=e(o);for(const d of h)if(ws(d)){const f=s(d[0]);t(l,f,d[1],d[2])}else{const f=r(d[0]);l.disconnect(f,d[1])}}n.set(o,u)}else n.set(o,a+u)},L0=(n,t)=>e=>{const s=n.get(e);return t(s)||t(e)},z0=(n,t)=>e=>n.has(e)||t(e),j0=(n,t)=>e=>n.has(e)||t(e),H0=(n,t)=>e=>{const s=n.get(e);return t(s)||t(e)},U0=n=>t=>n!==null&&t instanceof n,G0=n=>t=>n!==null&&typeof n.AudioNode=="function"&&t instanceof n.AudioNode,$0=n=>t=>n!==null&&typeof n.AudioParam=="function"&&t instanceof n.AudioParam,X0=(n,t)=>e=>n(e)||t(e),Z0=n=>t=>n!==null&&t instanceof n,Y0=n=>n!==null&&n.isSecureContext,Q0=(n,t,e,s)=>class extends n{constructor(i,c){const o=e(i),u=t(o,c);if(s(o))throw TypeError();super(i,!0,u,null),this._nativeMediaElementAudioSourceNode=u}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}},K0={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},J0=(n,t,e,s)=>class extends n{constructor(i,c){const o=e(i);if(s(o))throw new TypeError;const u={...K0,...c},a=t(o,u);super(i,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}},tl=(n,t,e,s)=>class extends n{constructor(i,c){const o=e(i),u=t(o,c);if(s(o))throw new TypeError;super(i,!0,u,null),this._nativeMediaStreamAudioSourceNode=u}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}},el=(n,t,e)=>class extends n{constructor(r,i){const c=e(r),o=t(c,i);super(r,!0,o,null)}},sl=(n,t,e,s,r,i)=>class extends e{constructor(o,u){super(o),this._nativeContext=o,nn.set(this,o),s(o)&&r.set(o,new Set),this._destination=new n(this,u),this._listener=t(this,o),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(o){const u=typeof o=="function"?i(this,o):null;this._nativeContext.onstatechange=u;const a=this._nativeContext.onstatechange;this._onstatechange=a!==null&&a===u?o:a}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}},Ds=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},nl=(n,t)=>(e,s,r)=>{const i=new Set;return e.connect=(c=>(o,u=0,a=0)=>{const l=i.size===0;if(t(o))return c.call(e,o,u,a),n(i,[o,u,a],h=>h[0]===o&&h[1]===u&&h[2]===a,!0),l&&s(),o;c.call(e,o,u),n(i,[o,u],h=>h[0]===o&&h[1]===u,!0),l&&s()})(e.connect),e.disconnect=(c=>(o,u,a)=>{const l=i.size>0;if(o===void 0)c.apply(e),i.clear();else if(typeof o=="number"){c.call(e,o);for(const d of i)d[1]===o&&i.delete(d)}else{t(o)?c.call(e,o,u,a):c.call(e,o,u);for(const d of i)d[0]===o&&(u===void 0||d[1]===u)&&(a===void 0||d[2]===a)&&i.delete(d)}const h=i.size===0;l&&h&&r()})(e.disconnect),e},pt=(n,t,e)=>{const s=t[e];s!==void 0&&s!==n[e]&&(n[e]=s)},At=(n,t)=>{pt(n,t,"channelCount"),pt(n,t,"channelCountMode"),pt(n,t,"channelInterpretation")},ko=n=>typeof n.getFloatTimeDomainData=="function",rl=n=>{n.getFloatTimeDomainData=t=>{const e=new Uint8Array(t.length);n.getByteTimeDomainData(e);const s=Math.max(e.length,n.fftSize);for(let r=0;r<s;r+=1)t[r]=(e[r]-128)*.0078125;return t}},il=(n,t)=>(e,s)=>{const r=e.createAnalyser();if(At(r,s),!(s.maxDecibels>s.minDecibels))throw t();return pt(r,s,"fftSize"),pt(r,s,"maxDecibels"),pt(r,s,"minDecibels"),pt(r,s,"smoothingTimeConstant"),n(ko,()=>ko(r))||rl(r),r},ol=n=>n===null?null:n.hasOwnProperty("AudioBuffer")?n.AudioBuffer:null,mt=(n,t,e)=>{const s=t[e];s!==void 0&&s!==n[e].value&&(n[e].value=s)},al=n=>{n.start=(t=>{let e=!1;return(s=0,r=0,i)=>{if(e)throw bt();t.call(n,s,r,i),e=!0}})(n.start)},xr=n=>{n.start=(t=>(e=0,s=0,r)=>{if(typeof r=="number"&&r<0||s<0||e<0)throw new RangeError("The parameters can't be negative.");t.call(n,e,s,r)})(n.start)},mr=n=>{n.stop=(t=>(e=0)=>{if(e<0)throw new RangeError("The parameter can't be negative.");t.call(n,e)})(n.stop)},cl=(n,t,e,s,r,i,c,o,u,a,l)=>(h,d)=>{const f=h.createBufferSource();return At(f,d),mt(f,d,"playbackRate"),pt(f,d,"buffer"),pt(f,d,"loop"),pt(f,d,"loopEnd"),pt(f,d,"loopStart"),t(e,()=>e(h))||al(f),t(s,()=>s(h))||u(f),t(r,()=>r(h))||a(f,h),t(i,()=>i(h))||xr(f),t(c,()=>c(h))||l(f,h),t(o,()=>o(h))||mr(f),n(h,f),f},ul=n=>n===null?null:n.hasOwnProperty("AudioContext")?n.AudioContext:n.hasOwnProperty("webkitAudioContext")?n.webkitAudioContext:null,ll=(n,t)=>(e,s,r)=>{const i=e.destination;if(i.channelCount!==s)try{i.channelCount=s}catch{}r&&i.channelCountMode!=="explicit"&&(i.channelCountMode="explicit"),i.maxChannelCount===0&&Object.defineProperty(i,"maxChannelCount",{value:s});const c=n(e,{channelCount:s,channelCountMode:i.channelCountMode,channelInterpretation:i.channelInterpretation,gain:1});return t(c,"channelCount",o=>()=>o.call(c),o=>u=>{o.call(c,u);try{i.channelCount=u}catch(a){if(u>i.maxChannelCount)throw a}}),t(c,"channelCountMode",o=>()=>o.call(c),o=>u=>{o.call(c,u),i.channelCountMode=u}),t(c,"channelInterpretation",o=>()=>o.call(c),o=>u=>{o.call(c,u),i.channelInterpretation=u}),Object.defineProperty(c,"maxChannelCount",{get:()=>i.maxChannelCount}),c.connect(i),c},hl=n=>n===null?null:n.hasOwnProperty("AudioWorkletNode")?n.AudioWorkletNode:null,dl=n=>{const{port1:t}=new MessageChannel;try{t.postMessage(n)}finally{t.close()}},pl=(n,t,e,s,r)=>(i,c,o,u,a,l)=>{if(o!==null)try{const h=new o(i,u,l),d=new Map;let f=null;if(Object.defineProperties(h,{channelCount:{get:()=>l.channelCount,set:()=>{throw n()}},channelCountMode:{get:()=>"explicit",set:()=>{throw n()}},onprocessorerror:{get:()=>f,set:p=>{typeof f=="function"&&h.removeEventListener("processorerror",f),f=typeof p=="function"?p:null,typeof f=="function"&&h.addEventListener("processorerror",f)}}}),h.addEventListener=(p=>(...m)=>{if(m[0]==="processorerror"){const x=typeof m[1]=="function"?m[1]:typeof m[1]=="object"&&m[1]!==null&&typeof m[1].handleEvent=="function"?m[1].handleEvent:null;if(x!==null){const v=d.get(m[1]);v!==void 0?m[1]=v:(m[1]=_=>{_.type==="error"?(Object.defineProperties(_,{type:{value:"processorerror"}}),x(_)):x(new ErrorEvent(m[0],{..._}))},d.set(x,m[1]))}}return p.call(h,"error",m[1],m[2]),p.call(h,...m)})(h.addEventListener),h.removeEventListener=(p=>(...m)=>{if(m[0]==="processorerror"){const x=d.get(m[1]);x!==void 0&&(d.delete(m[1]),m[1]=x)}return p.call(h,"error",m[1],m[2]),p.call(h,m[0],m[1],m[2])})(h.removeEventListener),l.numberOfOutputs!==0){const p=e(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return h.connect(p).connect(i.destination),r(h,()=>p.disconnect(),()=>p.connect(i.destination))}return h}catch(h){throw h.code===11?s():h}if(a===void 0)throw s();return dl(l),t(i,c,a,l)},Fo=(n,t)=>n===null?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(n*t))))),fl=n=>new Promise((t,e)=>{const{port1:s,port2:r}=new MessageChannel;s.onmessage=({data:i})=>{s.close(),r.close(),t(i)},s.onmessageerror=({data:i})=>{s.close(),r.close(),e(i)},r.postMessage(n)}),xl=async(n,t)=>{const e=await fl(t);return new n(e)},ml=(n,t,e,s)=>{let r=cr.get(n);r===void 0&&(r=new WeakMap,cr.set(n,r));const i=xl(e,s);return r.set(t,i),i},_l=(n,t,e,s,r,i,c,o,u,a,l,h,d)=>(f,p,m,x)=>{if(x.numberOfInputs===0&&x.numberOfOutputs===0)throw u();const v=Array.isArray(x.outputChannelCount)?x.outputChannelCount:Array.from(x.outputChannelCount);if(v.some(z=>z<1))throw u();if(v.length!==x.numberOfOutputs)throw t();if(x.channelCountMode!=="explicit")throw u();const _=x.channelCount*x.numberOfInputs,g=v.reduce((z,G)=>z+G,0),C=m.parameterDescriptors===void 0?0:m.parameterDescriptors.length;if(_+C>6||g>6)throw u();const y=new MessageChannel,A=[],w=[];for(let z=0;z<x.numberOfInputs;z+=1)A.push(c(f,{channelCount:x.channelCount,channelCountMode:x.channelCountMode,channelInterpretation:x.channelInterpretation,gain:1})),w.push(r(f,{channelCount:x.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:x.channelCount}));const b=[];if(m.parameterDescriptors!==void 0)for(const{defaultValue:z,maxValue:G,minValue:ft,name:at}of m.parameterDescriptors){const tt=i(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:x.parameterData[at]!==void 0?x.parameterData[at]:z===void 0?0:z});Object.defineProperties(tt.offset,{defaultValue:{get:()=>z===void 0?0:z},maxValue:{get:()=>G===void 0?St:G},minValue:{get:()=>ft===void 0?qt:ft}}),b.push(tt)}const k=s(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,_+C)}),E=Fo(p,f.sampleRate),D=o(f,E,_+C,Math.max(1,g)),T=r(f,{channelCount:Math.max(1,g),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,g)}),F=[];for(let z=0;z<x.numberOfOutputs;z+=1)F.push(s(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:v[z]}));for(let z=0;z<x.numberOfInputs;z+=1){A[z].connect(w[z]);for(let G=0;G<x.channelCount;G+=1)w[z].connect(k,G,z*x.channelCount+G)}const N=new wo(m.parameterDescriptors===void 0?[]:m.parameterDescriptors.map(({name:z},G)=>{const ft=b[G];return ft.connect(k,0,_+G),ft.start(0),[z,ft.offset]}));k.connect(D);let P=x.channelInterpretation,q=null;const W=x.numberOfOutputs===0?[D]:F,H={get bufferSize(){return E},get channelCount(){return x.channelCount},set channelCount(z){throw e()},get channelCountMode(){return x.channelCountMode},set channelCountMode(z){throw e()},get channelInterpretation(){return P},set channelInterpretation(z){for(const G of A)G.channelInterpretation=z;P=z},get context(){return D.context},get inputs(){return A},get numberOfInputs(){return x.numberOfInputs},get numberOfOutputs(){return x.numberOfOutputs},get onprocessorerror(){return q},set onprocessorerror(z){typeof q=="function"&&H.removeEventListener("processorerror",q),q=typeof z=="function"?z:null,typeof q=="function"&&H.addEventListener("processorerror",q)},get parameters(){return N},get port(){return y.port2},addEventListener(...z){return D.addEventListener(z[0],z[1],z[2])},connect:n.bind(null,W),disconnect:a.bind(null,W),dispatchEvent(...z){return D.dispatchEvent(z[0])},removeEventListener(...z){return D.removeEventListener(z[0],z[1],z[2])}},L=new Map;y.port1.addEventListener=(z=>(...G)=>{if(G[0]==="message"){const ft=typeof G[1]=="function"?G[1]:typeof G[1]=="object"&&G[1]!==null&&typeof G[1].handleEvent=="function"?G[1].handleEvent:null;if(ft!==null){const at=L.get(G[1]);at!==void 0?G[1]=at:(G[1]=tt=>{l(f.currentTime,f.sampleRate,()=>ft(tt))},L.set(ft,G[1]))}}return z.call(y.port1,G[0],G[1],G[2])})(y.port1.addEventListener),y.port1.removeEventListener=(z=>(...G)=>{if(G[0]==="message"){const ft=L.get(G[1]);ft!==void 0&&(L.delete(G[1]),G[1]=ft)}return z.call(y.port1,G[0],G[1],G[2])})(y.port1.removeEventListener);let j=null;Object.defineProperty(y.port1,"onmessage",{get:()=>j,set:z=>{typeof j=="function"&&y.port1.removeEventListener("message",j),j=typeof z=="function"?z:null,typeof j=="function"&&(y.port1.addEventListener("message",j),y.port1.start())}}),m.prototype.port=y.port1;let B=null;ml(f,H,m,x).then(z=>B=z);const R=pn(x.numberOfInputs,x.channelCount),O=pn(x.numberOfOutputs,v),U=m.parameterDescriptors===void 0?[]:m.parameterDescriptors.reduce((z,{name:G})=>({...z,[G]:new Float32Array(128)}),{});let X=!0;const nt=()=>{x.numberOfOutputs>0&&D.disconnect(T);for(let z=0,G=0;z<x.numberOfOutputs;z+=1){const ft=F[z];for(let at=0;at<v[z];at+=1)T.disconnect(ft,G+at,at);G+=v[z]}},V=new Map;D.onaudioprocess=({inputBuffer:z,outputBuffer:G})=>{if(B!==null){const ft=h(H);for(let at=0;at<E;at+=128){for(let tt=0;tt<x.numberOfInputs;tt+=1)for(let ut=0;ut<x.channelCount;ut+=1)dn(z,R[tt],ut,ut,at);m.parameterDescriptors!==void 0&&m.parameterDescriptors.forEach(({name:tt},ut)=>{dn(z,U,tt,_+ut,at)});for(let tt=0;tt<x.numberOfInputs;tt+=1)for(let ut=0;ut<v[tt];ut+=1)O[tt][ut].byteLength===0&&(O[tt][ut]=new Float32Array(128));try{const tt=R.map((xt,Ct)=>{if(ft[Ct].size>0)return V.set(Ct,E/128),xt;const qe=V.get(Ct);return qe===void 0?[]:(xt.every(Jn=>Jn.every(Ve=>Ve===0))&&(qe===1?V.delete(Ct):V.set(Ct,qe-1)),xt)});X=l(f.currentTime+at/f.sampleRate,f.sampleRate,()=>B.process(tt,O,U));for(let xt=0,Ct=0;xt<x.numberOfOutputs;xt+=1){for(let zt=0;zt<v[xt];zt+=1)Eo(G,O[xt],zt,Ct+zt,at);Ct+=v[xt]}}catch(tt){X=!1,H.dispatchEvent(new ErrorEvent("processorerror",{colno:tt.colno,filename:tt.filename,lineno:tt.lineno,message:tt.message}))}if(!X){for(let tt=0;tt<x.numberOfInputs;tt+=1){A[tt].disconnect(w[tt]);for(let ut=0;ut<x.channelCount;ut+=1)w[at].disconnect(k,ut,tt*x.channelCount+ut)}if(m.parameterDescriptors!==void 0){const tt=m.parameterDescriptors.length;for(let ut=0;ut<tt;ut+=1){const xt=b[ut];xt.disconnect(k,0,_+ut),xt.stop()}}k.disconnect(D),D.onaudioprocess=null,Ut?nt():Kt();break}}}};let Ut=!1;const Lt=c(f,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),ge=()=>D.connect(Lt).connect(f.destination),Kt=()=>{D.disconnect(Lt),Lt.disconnect()},Gt=()=>{if(X){Kt(),x.numberOfOutputs>0&&D.connect(T);for(let z=0,G=0;z<x.numberOfOutputs;z+=1){const ft=F[z];for(let at=0;at<v[z];at+=1)T.connect(ft,G+at,at);G+=v[z]}}Ut=!0},Rt=()=>{X&&(ge(),nt()),Ut=!1};return ge(),d(H,Gt,Rt)},Bo=(n,t)=>{const e=n.createBiquadFilter();return At(e,t),mt(e,t,"Q"),mt(e,t,"detune"),mt(e,t,"frequency"),mt(e,t,"gain"),pt(e,t,"type"),e},gl=(n,t)=>(e,s)=>{const r=e.createChannelMerger(s.numberOfInputs);return n!==null&&n.name==="webkitAudioContext"&&t(e,r),At(r,s),r},vl=n=>{const t=n.numberOfOutputs;Object.defineProperty(n,"channelCount",{get:()=>t,set:e=>{if(e!==t)throw bt()}}),Object.defineProperty(n,"channelCountMode",{get:()=>"explicit",set:e=>{if(e!=="explicit")throw bt()}}),Object.defineProperty(n,"channelInterpretation",{get:()=>"discrete",set:e=>{if(e!=="discrete")throw bt()}})},Ts=(n,t)=>{const e=n.createChannelSplitter(t.numberOfOutputs);return At(e,t),vl(e),e},yl=(n,t,e,s,r)=>(i,c)=>{if(i.createConstantSource===void 0)return e(i,c);const o=i.createConstantSource();return At(o,c),mt(o,c,"offset"),t(s,()=>s(i))||xr(o),t(r,()=>r(i))||mr(o),n(i,o),o},is=(n,t)=>(n.connect=t.connect.bind(t),n.disconnect=t.disconnect.bind(t),n),Cl=(n,t,e,s)=>(r,{offset:i,...c})=>{const o=r.createBuffer(1,2,44100),u=t(r,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),a=e(r,{...c,gain:i}),l=o.getChannelData(0);l[0]=1,l[1]=1,u.buffer=o,u.loop=!0;const h={get bufferSize(){},get channelCount(){return a.channelCount},set channelCount(p){a.channelCount=p},get channelCountMode(){return a.channelCountMode},set channelCountMode(p){a.channelCountMode=p},get channelInterpretation(){return a.channelInterpretation},set channelInterpretation(p){a.channelInterpretation=p},get context(){return a.context},get inputs(){return[]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return a.numberOfOutputs},get offset(){return a.gain},get onended(){return u.onended},set onended(p){u.onended=p},addEventListener(...p){return u.addEventListener(p[0],p[1],p[2])},dispatchEvent(...p){return u.dispatchEvent(p[0])},removeEventListener(...p){return u.removeEventListener(p[0],p[1],p[2])},start(p=0){u.start.call(u,p)},stop(p=0){u.stop.call(u,p)}},d=()=>u.connect(a),f=()=>u.disconnect(a);return n(r,u),s(is(h,a),d,f)},Al=(n,t)=>(e,s)=>{const r=e.createConvolver();if(At(r,s),s.disableNormalization===r.normalize&&(r.normalize=!s.disableNormalization),pt(r,s,"buffer"),s.channelCount>2||(t(r,"channelCount",i=>()=>i.call(r),i=>c=>{if(c>2)throw n();return i.call(r,c)}),s.channelCountMode==="max"))throw n();return t(r,"channelCountMode",i=>()=>i.call(r),i=>c=>{if(c==="max")throw n();return i.call(r,c)}),r},So=(n,t)=>{const e=n.createDelay(t.maxDelayTime);return At(e,t),mt(e,t,"delayTime"),e},bl=n=>(t,e)=>{const s=t.createDynamicsCompressor();if(At(s,e),e.channelCount>2||e.channelCountMode==="max")throw n();return mt(s,e,"attack"),mt(s,e,"knee"),mt(s,e,"ratio"),mt(s,e,"release"),mt(s,e,"threshold"),s},Vt=(n,t)=>{const e=n.createGain();return At(e,t),mt(e,t,"gain"),e},wl=n=>(t,e,s)=>{if(t.createIIRFilter===void 0)return n(t,e,s);const r=t.createIIRFilter(s.feedforward,s.feedback);return At(r,s),r};function El(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 Dl(n,t){return[n[0]*t[0]-n[1]*t[1],n[0]*t[1]+n[1]*t[0]]}function No(n,t){let e=[0,0];for(let s=n.length-1;s>=0;s-=1)e=Dl(e,t),e[0]+=n[s];return e}const Tl=(n,t,e,s)=>(r,i,{channelCount:c,channelCountMode:o,channelInterpretation:u,feedback:a,feedforward:l})=>{const h=Fo(i,r.sampleRate),d=a instanceof Float64Array?a:new Float64Array(a),f=l instanceof Float64Array?l:new Float64Array(l),p=d.length,m=f.length,x=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 b=0;b<m;b+=1)f[b]/=d[0];for(let b=1;b<p;b+=1)d[b]/=d[0]}const v=e(r,h,c,c);v.channelCount=c,v.channelCountMode=o,v.channelInterpretation=u;const _=32,g=[],C=[],y=[];for(let b=0;b<c;b+=1){g.push(0);const k=new Float32Array(_),E=new Float32Array(_);k.fill(0),E.fill(0),C.push(k),y.push(E)}v.onaudioprocess=b=>{const k=b.inputBuffer,E=b.outputBuffer,D=k.numberOfChannels;for(let T=0;T<D;T+=1){const F=k.getChannelData(T),N=E.getChannelData(T);g[T]=To(d,p,f,m,x,C[T],y[T],g[T],_,F,N)}};const A=r.sampleRate/2;return is({get bufferSize(){return h},get channelCount(){return v.channelCount},set channelCount(b){v.channelCount=b},get channelCountMode(){return v.channelCountMode},set channelCountMode(b){v.channelCountMode=b},get channelInterpretation(){return v.channelInterpretation},set channelInterpretation(b){v.channelInterpretation=b},get context(){return v.context},get inputs(){return[v]},get numberOfInputs(){return v.numberOfInputs},get numberOfOutputs(){return v.numberOfOutputs},addEventListener(...b){return v.addEventListener(b[0],b[1],b[2])},dispatchEvent(...b){return v.dispatchEvent(b[0])},getFrequencyResponse(b,k,E){if(b.length!==k.length||k.length!==E.length)throw n();const D=b.length;for(let T=0;T<D;T+=1){const F=-Math.PI*(b[T]/A),N=[Math.cos(F),Math.sin(F)],P=No(f,N),q=No(d,N),W=El(P,q);k[T]=Math.sqrt(W[0]*W[0]+W[1]*W[1]),E[T]=Math.atan2(W[1],W[0])}},removeEventListener(...b){return v.removeEventListener(b[0],b[1],b[2])}},v)},kl=(n,t)=>n.createMediaElementSource(t.mediaElement),Fl=(n,t)=>{const e=n.createMediaStreamDestination();return At(e,t),e.numberOfOutputs===1&&Object.defineProperty(e,"numberOfOutputs",{get:()=>0}),e},Bl=(n,{mediaStream:t})=>{const e=t.getAudioTracks();e.sort((i,c)=>i.id<c.id?-1:i.id>c.id?1:0);const s=e.slice(0,1),r=n.createMediaStreamSource(new MediaStream(s));return Object.defineProperty(r,"mediaStream",{value:t}),r},Sl=(n,t)=>(e,{mediaStreamTrack:s})=>{if(typeof e.createMediaStreamTrackSource=="function")return e.createMediaStreamTrackSource(s);const r=new MediaStream([s]),i=e.createMediaStreamSource(r);if(s.kind!=="audio")throw n();if(t(e))throw new TypeError;return i},Nl=n=>n===null?null:n.hasOwnProperty("OfflineAudioContext")?n.OfflineAudioContext:n.hasOwnProperty("webkitOfflineAudioContext")?n.webkitOfflineAudioContext:null,Ol=(n,t,e,s,r,i)=>(c,o)=>{const u=c.createOscillator();return At(u,o),mt(u,o,"detune"),mt(u,o,"frequency"),o.periodicWave!==void 0?u.setPeriodicWave(o.periodicWave):pt(u,o,"type"),t(e,()=>e(c))||xr(u),t(s,()=>s(c))||i(u,c),t(r,()=>r(c))||mr(u),n(c,u),u},Ml=n=>(t,e)=>{const s=t.createPanner();return s.orientationX===void 0?n(t,e):(At(s,e),mt(s,e,"orientationX"),mt(s,e,"orientationY"),mt(s,e,"orientationZ"),mt(s,e,"positionX"),mt(s,e,"positionY"),mt(s,e,"positionZ"),pt(s,e,"coneInnerAngle"),pt(s,e,"coneOuterAngle"),pt(s,e,"coneOuterGain"),pt(s,e,"distanceModel"),pt(s,e,"maxDistance"),pt(s,e,"panningModel"),pt(s,e,"refDistance"),pt(s,e,"rolloffFactor"),s)},Il=(n,t,e,s,r,i,c,o,u,a)=>(l,{coneInnerAngle:h,coneOuterAngle:d,coneOuterGain:f,distanceModel:p,maxDistance:m,orientationX:x,orientationY:v,orientationZ:_,panningModel:g,positionX:C,positionY:y,positionZ:A,refDistance:w,rolloffFactor:b,...k})=>{const E=l.createPanner();if(k.channelCount>2||k.channelCountMode==="max")throw c();At(E,k);const D={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},T=e(l,{...D,channelInterpretation:"speakers",numberOfInputs:6}),F=s(l,{...k,gain:1}),N=s(l,{...D,gain:1}),P=s(l,{...D,gain:0}),q=s(l,{...D,gain:0}),W=s(l,{...D,gain:0}),H=s(l,{...D,gain:0}),L=s(l,{...D,gain:0}),j=r(l,256,6,1),B=i(l,{...D,curve:new Float32Array([1,1]),oversample:"none"});let S=[x,v,_],R=[C,y,A];const O=new Float32Array(1);j.onaudioprocess=({inputBuffer:V})=>{const Ut=[u(V,O,0),u(V,O,1),u(V,O,2)];Ut.some((ge,Kt)=>ge!==S[Kt])&&(E.setOrientation(...Ut),S=Ut);const Lt=[u(V,O,3),u(V,O,4),u(V,O,5)];Lt.some((ge,Kt)=>ge!==R[Kt])&&(E.setPosition(...Lt),R=Lt)},Object.defineProperty(P.gain,"defaultValue",{get:()=>0}),Object.defineProperty(q.gain,"defaultValue",{get:()=>0}),Object.defineProperty(W.gain,"defaultValue",{get:()=>0}),Object.defineProperty(H.gain,"defaultValue",{get:()=>0}),Object.defineProperty(L.gain,"defaultValue",{get:()=>0});const U={get bufferSize(){},get channelCount(){return E.channelCount},set channelCount(V){if(V>2)throw c();F.channelCount=V,E.channelCount=V},get channelCountMode(){return E.channelCountMode},set channelCountMode(V){if(V==="max")throw c();F.channelCountMode=V,E.channelCountMode=V},get channelInterpretation(){return E.channelInterpretation},set channelInterpretation(V){F.channelInterpretation=V,E.channelInterpretation=V},get coneInnerAngle(){return E.coneInnerAngle},set coneInnerAngle(V){E.coneInnerAngle=V},get coneOuterAngle(){return E.coneOuterAngle},set coneOuterAngle(V){E.coneOuterAngle=V},get coneOuterGain(){return E.coneOuterGain},set coneOuterGain(V){if(V<0||V>1)throw t();E.coneOuterGain=V},get context(){return E.context},get distanceModel(){return E.distanceModel},set distanceModel(V){E.distanceModel=V},get inputs(){return[F]},get maxDistance(){return E.maxDistance},set maxDistance(V){if(V<0)throw new RangeError;E.maxDistance=V},get numberOfInputs(){return E.numberOfInputs},get numberOfOutputs(){return E.numberOfOutputs},get orientationX(){return N.gain},get orientationY(){return P.gain},get orientationZ(){return q.gain},get panningModel(){return E.panningModel},set panningModel(V){E.panningModel=V},get positionX(){return W.gain},get positionY(){return H.gain},get positionZ(){return L.gain},get refDistance(){return E.refDistance},set refDistance(V){if(V<0)throw new RangeError;E.refDistance=V},get rolloffFactor(){return E.rolloffFactor},set rolloffFactor(V){if(V<0)throw new RangeError;E.rolloffFactor=V},addEventListener(...V){return F.addEventListener(V[0],V[1],V[2])},dispatchEvent(...V){return F.dispatchEvent(V[0])},removeEventListener(...V){return F.removeEventListener(V[0],V[1],V[2])}};h!==U.coneInnerAngle&&(U.coneInnerAngle=h),d!==U.coneOuterAngle&&(U.coneOuterAngle=d),f!==U.coneOuterGain&&(U.coneOuterGain=f),p!==U.distanceModel&&(U.distanceModel=p),m!==U.maxDistance&&(U.maxDistance=m),x!==U.orientationX.value&&(U.orientationX.value=x),v!==U.orientationY.value&&(U.orientationY.value=v),_!==U.orientationZ.value&&(U.orientationZ.value=_),g!==U.panningModel&&(U.panningModel=g),C!==U.positionX.value&&(U.positionX.value=C),y!==U.positionY.value&&(U.positionY.value=y),A!==U.positionZ.value&&(U.positionZ.value=A),w!==U.refDistance&&(U.refDistance=w),b!==U.rolloffFactor&&(U.rolloffFactor=b),(S[0]!==1||S[1]!==0||S[2]!==0)&&E.setOrientation(...S),(R[0]!==0||R[1]!==0||R[2]!==0)&&E.setPosition(...R);const X=()=>{F.connect(E),n(F,B,0,0),B.connect(N).connect(T,0,0),B.connect(P).connect(T,0,1),B.connect(q).connect(T,0,2),B.connect(W).connect(T,0,3),B.connect(H).connect(T,0,4),B.connect(L).connect(T,0,5),T.connect(j).connect(l.destination)},nt=()=>{F.disconnect(E),o(F,B,0,0),B.disconnect(N),N.disconnect(T),B.disconnect(P),P.disconnect(T),B.disconnect(q),q.disconnect(T),B.disconnect(W),W.disconnect(T),B.disconnect(H),H.disconnect(T),B.disconnect(L),L.disconnect(T),T.disconnect(j),j.disconnect(l.destination)};return a(is(U,E),X,nt)},Rl=n=>(t,{disableNormalization:e,imag:s,real:r})=>{const i=s instanceof Float32Array?s:new Float32Array(s),c=r instanceof Float32Array?r:new Float32Array(r),o=t.createPeriodicWave(c,i,{disableNormalization:e});if(Array.from(s).length<2)throw n();return o},ks=(n,t,e,s)=>n.createScriptProcessor(t,e,s),Pl=(n,t)=>(e,s)=>{const r=s.channelCountMode;if(r==="clamped-max")throw t();if(e.createStereoPanner===void 0)return n(e,s);const i=e.createStereoPanner();return At(i,s),mt(i,s,"pan"),Object.defineProperty(i,"channelCountMode",{get:()=>r,set:c=>{if(c!==r)throw t()}}),i},ql=(n,t,e,s,r,i)=>{const o=new Float32Array([1,1]),u=Math.PI/2,a={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...a,oversample:"none"},h=(p,m,x,v)=>{const _=new Float32Array(16385),g=new Float32Array(16385);for(let k=0;k<16385;k+=1){const E=k/16384*u;_[k]=Math.cos(E),g[k]=Math.sin(E)}const C=e(p,{...a,gain:0}),y=s(p,{...l,curve:_}),A=s(p,{...l,curve:o}),w=e(p,{...a,gain:0}),b=s(p,{...l,curve:g});return{connectGraph(){m.connect(C),m.connect(A.inputs===void 0?A:A.inputs[0]),m.connect(w),A.connect(x),x.connect(y.inputs===void 0?y:y.inputs[0]),x.connect(b.inputs===void 0?b:b.inputs[0]),y.connect(C.gain),b.connect(w.gain),C.connect(v,0,0),w.connect(v,0,1)},disconnectGraph(){m.disconnect(C),m.disconnect(A.inputs===void 0?A:A.inputs[0]),m.disconnect(w),A.disconnect(x),x.disconnect(y.inputs===void 0?y:y.inputs[0]),x.disconnect(b.inputs===void 0?b:b.inputs[0]),y.disconnect(C.gain),b.disconnect(w.gain),C.disconnect(v,0,0),w.disconnect(v,0,1)}}},d=(p,m,x,v)=>{const _=new Float32Array(16385),g=new Float32Array(16385),C=new Float32Array(16385),y=new Float32Array(16385),A=Math.floor(16385/2);for(let W=0;W<16385;W+=1)if(W>A){const H=(W-A)/(16384-A)*u;_[W]=Math.cos(H),g[W]=Math.sin(H),C[W]=0,y[W]=1}else{const H=W/(16384-A)*u;_[W]=1,g[W]=0,C[W]=Math.cos(H),y[W]=Math.sin(H)}const w=t(p,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),b=e(p,{...a,gain:0}),k=s(p,{...l,curve:_}),E=e(p,{...a,gain:0}),D=s(p,{...l,curve:g}),T=s(p,{...l,curve:o}),F=e(p,{...a,gain:0}),N=s(p,{...l,curve:C}),P=e(p,{...a,gain:0}),q=s(p,{...l,curve:y});return{connectGraph(){m.connect(w),m.connect(T.inputs===void 0?T:T.inputs[0]),w.connect(b,0),w.connect(E,0),w.connect(F,1),w.connect(P,1),T.connect(x),x.connect(k.inputs===void 0?k:k.inputs[0]),x.connect(D.inputs===void 0?D:D.inputs[0]),x.connect(N.inputs===void 0?N:N.inputs[0]),x.connect(q.inputs===void 0?q:q.inputs[0]),k.connect(b.gain),D.connect(E.gain),N.connect(F.gain),q.connect(P.gain),b.connect(v,0,0),F.connect(v,0,0),E.connect(v,0,1),P.connect(v,0,1)},disconnectGraph(){m.disconnect(w),m.disconnect(T.inputs===void 0?T:T.inputs[0]),w.disconnect(b,0),w.disconnect(E,0),w.disconnect(F,1),w.disconnect(P,1),T.disconnect(x),x.disconnect(k.inputs===void 0?k:k.inputs[0]),x.disconnect(D.inputs===void 0?D:D.inputs[0]),x.disconnect(N.inputs===void 0?N:N.inputs[0]),x.disconnect(q.inputs===void 0?q:q.inputs[0]),k.disconnect(b.gain),D.disconnect(E.gain),N.disconnect(F.gain),q.disconnect(P.gain),b.disconnect(v,0,0),F.disconnect(v,0,0),E.disconnect(v,0,1),P.disconnect(v,0,1)}}},f=(p,m,x,v,_)=>{if(m===1)return h(p,x,v,_);if(m===2)return d(p,x,v,_);throw r()};return(p,{channelCount:m,channelCountMode:x,pan:v,..._})=>{if(x==="max")throw r();const g=n(p,{..._,channelCount:1,channelCountMode:x,numberOfInputs:2}),C=e(p,{..._,channelCount:m,channelCountMode:x,gain:1}),y=e(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:v});let{connectGraph:A,disconnectGraph:w}=f(p,m,C,y,g);Object.defineProperty(y.gain,"defaultValue",{get:()=>0}),Object.defineProperty(y.gain,"maxValue",{get:()=>1}),Object.defineProperty(y.gain,"minValue",{get:()=>-1});const b={get bufferSize(){},get channelCount(){return C.channelCount},set channelCount(T){C.channelCount!==T&&(k&&w(),{connectGraph:A,disconnectGraph:w}=f(p,T,C,y,g),k&&A()),C.channelCount=T},get channelCountMode(){return C.channelCountMode},set channelCountMode(T){if(T==="clamped-max"||T==="max")throw r();C.channelCountMode=T},get channelInterpretation(){return C.channelInterpretation},set channelInterpretation(T){C.channelInterpretation=T},get context(){return C.context},get inputs(){return[C]},get numberOfInputs(){return C.numberOfInputs},get numberOfOutputs(){return C.numberOfOutputs},get pan(){return y.gain},addEventListener(...T){return C.addEventListener(T[0],T[1],T[2])},dispatchEvent(...T){return C.dispatchEvent(T[0])},removeEventListener(...T){return C.removeEventListener(T[0],T[1],T[2])}};let k=!1;const E=()=>{A(),k=!0},D=()=>{w(),k=!1};return i(is(b,g),E,D)}},Vl=(n,t,e,s,r,i,c)=>(o,u)=>{const a=o.createWaveShaper();if(i!==null&&i.name==="webkitAudioContext"&&o.createGain().gain.automationRate===void 0)return e(o,u);At(a,u);const l=u.curve===null||u.curve instanceof Float32Array?u.curve:new Float32Array(u.curve);if(l!==null&&l.length<2)throw t();pt(a,{curve:l},"curve"),pt(a,u,"oversample");let h=null,d=!1;return c(a,"curve",m=>()=>m.call(a),m=>x=>(m.call(a,x),d&&(s(x)&&h===null?h=n(o,a):!s(x)&&h!==null&&(h(),h=null)),x)),r(a,()=>{d=!0,s(a.curve)&&(h=n(o,a))},()=>{d=!1,h!==null&&(h(),h=null)})},Wl=(n,t,e,s,r)=>(i,{curve:c,oversample:o,...u})=>{const a=i.createWaveShaper(),l=i.createWaveShaper();At(a,u),At(l,u);const h=e(i,{...u,gain:1}),d=e(i,{...u,gain:-1}),f=e(i,{...u,gain:1}),p=e(i,{...u,gain:-1});let m=null,x=!1,v=null;const _={get bufferSize(){},get channelCount(){return a.channelCount},set channelCount(y){h.channelCount=y,d.channelCount=y,a.channelCount=y,f.channelCount=y,l.channelCount=y,p.channelCount=y},get channelCountMode(){return a.channelCountMode},set channelCountMode(y){h.channelCountMode=y,d.channelCountMode=y,a.channelCountMode=y,f.channelCountMode=y,l.channelCountMode=y,p.channelCountMode=y},get channelInterpretation(){return a.channelInterpretation},set channelInterpretation(y){h.channelInterpretation=y,d.channelInterpretation=y,a.channelInterpretation=y,f.channelInterpretation=y,l.channelInterpretation=y,p.channelInterpretation=y},get context(){return a.context},get curve(){return v},set curve(y){if(y!==null&&y.length<2)throw t();if(y===null)a.curve=y,l.curve=y;else{const A=y.length,w=new Float32Array(A+2-A%2),b=new Float32Array(A+2-A%2);w[0]=y[0],b[0]=-y[A-1];const k=Math.ceil((A+1)/2),E=(A+1)/2-1;for(let D=1;D<k;D+=1){const T=D/k*E,F=Math.floor(T),N=Math.ceil(T);w[D]=F===N?y[F]:(1-(T-F))*y[F]+(1-(N-T))*y[N],b[D]=F===N?-y[A-1-F]:-((1-(T-F))*y[A-1-F])-(1-(N-T))*y[A-1-N]}w[k]=A%2===1?y[k-1]:(y[k-2]+y[k-1])/2,a.curve=w,l.curve=b}v=y,x&&(s(v)&&m===null?m=n(i,h):m!==null&&(m(),m=null))},get inputs(){return[h]},get numberOfInputs(){return a.numberOfInputs},get numberOfOutputs(){return a.numberOfOutputs},get oversample(){return a.oversample},set oversample(y){a.oversample=y,l.oversample=y},addEventListener(...y){return h.addEventListener(y[0],y[1],y[2])},dispatchEvent(...y){return h.dispatchEvent(y[0])},removeEventListener(...y){return h.removeEventListener(y[0],y[1],y[2])}};c!==null&&(_.curve=c instanceof Float32Array?c:new Float32Array(c)),o!==_.oversample&&(_.oversample=o);const g=()=>{h.connect(a).connect(f),h.connect(d).connect(l).connect(p).connect(f),x=!0,s(v)&&(m=n(i,h))},C=()=>{h.disconnect(a),a.disconnect(f),h.disconnect(d),d.disconnect(l),l.disconnect(p),p.disconnect(f),x=!1,m!==null&&(m(),m=null)};return r(is(_,f),g,C)},Ot=()=>new DOMException("","NotSupportedError"),Ll={numberOfChannels:1},zl=(n,t,e,s,r)=>class extends n{constructor(c,o,u){let a;if(typeof c=="number"&&o!==void 0&&u!==void 0)a={length:o,numberOfChannels:c,sampleRate:u};else if(typeof c=="object")a=c;else throw new Error("The given parameters are not valid.");const{length:l,numberOfChannels:h,sampleRate:d}={...Ll,...a},f=s(h,l,d);t(Ds,()=>Ds(f))||f.addEventListener("statechange",(()=>{let p=0;const m=x=>{this._state==="running"&&(p>0?(f.removeEventListener("statechange",m),x.stopImmediatePropagation(),this._waitForThePromiseToSettle(x)):p+=1)};return m})()),super(f,h),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",r(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,_o(this)}))}_waitForThePromiseToSettle(c){this._state===null?this._nativeOfflineAudioContext.dispatchEvent(c):setTimeout(()=>this._waitForThePromiseToSettle(c))}},jl={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},Hl=(n,t,e,s,r,i,c)=>class extends n{constructor(u,a){const l=r(u),h={...jl,...a},d=e(l,h),f=i(l),p=f?s():null,m=u.sampleRate/2;super(u,!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&&h.periodicWave!==void 0&&(this._oscillatorNodeRenderer.periodicWave=h.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(u){const a=typeof u=="function"?c(this,u):null;this._nativeOscillatorNode.onended=a;const l=this._nativeOscillatorNode.onended;this._onended=l!==null&&l===a?u:l}get type(){return this._nativeOscillatorNode.type}set type(u){this._nativeOscillatorNode.type=u,this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(u){this._nativeOscillatorNode.setPeriodicWave(u),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=u)}start(u=0){if(this._nativeOscillatorNode.start(u),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.start=u),this.context.state!=="closed"){ns(this);const a=()=>{this._nativeOscillatorNode.removeEventListener("ended",a),ye(this)&&As(this)};this._nativeOscillatorNode.addEventListener("ended",a)}}stop(u=0){this._nativeOscillatorNode.stop(u),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.stop=u)}},Ul=(n,t,e,s,r)=>()=>{const i=new WeakMap;let c=null,o=null,u=null;const a=async(l,h)=>{let d=e(l);const f=Tt(d,h);if(!f){const p={channelCount:d.channelCount,channelCountMode:d.channelCountMode,channelInterpretation:d.channelInterpretation,detune:d.detune.value,frequency:d.frequency.value,periodicWave:c===null?void 0:c,type:d.type};d=t(h,p),o!==null&&d.start(o),u!==null&&d.stop(u)}return i.set(h,d),f?(await n(h,l.detune,d.detune),await n(h,l.frequency,d.frequency)):(await s(h,l.detune,d.detune),await s(h,l.frequency,d.frequency)),await r(l,h,d),d};return{set periodicWave(l){c=l},set start(l){o=l},set stop(l){u=l},render(l,h){const d=i.get(h);return d!==void 0?Promise.resolve(d):a(l,h)}}},Gl={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},$l=(n,t,e,s,r,i,c)=>class extends n{constructor(u,a){const l=r(u),h={...Gl,...a},d=e(l,h),f=i(l),p=f?s():null;super(u,!1,d,p),this._nativePannerNode=d,this._orientationX=t(this,f,d.orientationX,St,qt),this._orientationY=t(this,f,d.orientationY,St,qt),this._orientationZ=t(this,f,d.orientationZ,St,qt),this._positionX=t(this,f,d.positionX,St,qt),this._positionY=t(this,f,d.positionY,St,qt),this._positionZ=t(this,f,d.positionZ,St,qt),c(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(u){this._nativePannerNode.coneInnerAngle=u}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(u){this._nativePannerNode.coneOuterAngle=u}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(u){this._nativePannerNode.coneOuterGain=u}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(u){this._nativePannerNode.distanceModel=u}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(u){this._nativePannerNode.maxDistance=u}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(u){this._nativePannerNode.panningModel=u}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(u){this._nativePannerNode.refDistance=u}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(u){this._nativePannerNode.rolloffFactor=u}},Xl=(n,t,e,s,r,i,c,o,u,a)=>()=>{const l=new WeakMap;let h=null;const d=async(f,p)=>{let m=null,x=i(f);const v={channelCount:x.channelCount,channelCountMode:x.channelCountMode,channelInterpretation:x.channelInterpretation},_={...v,coneInnerAngle:x.coneInnerAngle,coneOuterAngle:x.coneOuterAngle,coneOuterGain:x.coneOuterGain,distanceModel:x.distanceModel,maxDistance:x.maxDistance,panningModel:x.panningModel,refDistance:x.refDistance,rolloffFactor:x.rolloffFactor},g=Tt(x,p);if("bufferSize"in x)m=s(p,{...v,gain:1});else if(!g){const C={..._,orientationX:x.orientationX.value,orientationY:x.orientationY.value,orientationZ:x.orientationZ.value,positionX:x.positionX.value,positionY:x.positionY.value,positionZ:x.positionZ.value};x=r(p,C)}if(l.set(p,m===null?x:m),m!==null){if(h===null){if(c===null)throw new Error("Missing the native OfflineAudioContext constructor.");const D=new c(6,f.context.length,p.sampleRate),T=t(D,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});T.connect(D.destination),h=(async()=>{const F=await Promise.all([f.orientationX,f.orientationY,f.orientationZ,f.positionX,f.positionY,f.positionZ].map(async(N,P)=>{const q=e(D,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:P===0?1:0});return await o(D,N,q.offset),q}));for(let N=0;N<6;N+=1)F[N].connect(T,0,N),F[N].start(0);return a(D)})()}const C=await h,y=s(p,{...v,gain:1});await u(f,p,y);const A=[];for(let D=0;D<C.numberOfChannels;D+=1)A.push(C.getChannelData(D));let w=[A[0][0],A[1][0],A[2][0]],b=[A[3][0],A[4][0],A[5][0]],k=s(p,{...v,gain:1}),E=r(p,{..._,orientationX:w[0],orientationY:w[1],orientationZ:w[2],positionX:b[0],positionY:b[1],positionZ:b[2]});y.connect(k).connect(E.inputs[0]),E.connect(m);for(let D=128;D<C.length;D+=128){const T=[A[0][D],A[1][D],A[2][D]],F=[A[3][D],A[4][D],A[5][D]];if(T.some((N,P)=>N!==w[P])||F.some((N,P)=>N!==b[P])){w=T,b=F;const N=D/p.sampleRate;k.gain.setValueAtTime(0,N),k=s(p,{...v,gain:0}),E=r(p,{..._,orientationX:w[0],orientationY:w[1],orientationZ:w[2],positionX:b[0],positionY:b[1],positionZ:b[2]}),k.gain.setValueAtTime(1,N),y.connect(k).connect(E.inputs[0]),E.connect(m)}}return m}return g?(await n(p,f.orientationX,x.orientationX),await n(p,f.orientationY,x.orientationY),await n(p,f.orientationZ,x.orientationZ),await n(p,f.positionX,x.positionX),await n(p,f.positionY,x.positionY),await n(p,f.positionZ,x.positionZ)):(await o(p,f.orientationX,x.orientationX),await o(p,f.orientationY,x.orientationY),await o(p,f.orientationZ,x.orientationZ),await o(p,f.positionX,x.positionX),await o(p,f.positionY,x.positionY),await o(p,f.positionZ,x.positionZ)),rs(x)?await u(f,p,x.inputs[0]):await u(f,p,x),x};return{render(f,p){const m=l.get(p);return m!==void 0?Promise.resolve(m):d(f,p)}}},Zl={disableNormalization:!1},Yl=(n,t,e,s)=>class Pc{constructor(i,c){const o=t(i),u=s({...Zl,...c}),a=n(o,u);return e.add(a),a}static[Symbol.hasInstance](i){return i!==null&&typeof i=="object"&&Object.getPrototypeOf(i)===Pc.prototype||e.has(i)}},Ql=(n,t)=>(e,s,r)=>(n(s).replay(r),t(s,e,r)),Kl=(n,t,e)=>async(s,r,i)=>{const c=n(s);await Promise.all(c.activeInputs.map((o,u)=>Array.from(o).map(async([a,l])=>{const d=await t(a).render(a,r),f=s.context.destination;!e(a)&&(s!==f||!e(s))&&d.connect(i,l,u)})).reduce((o,u)=>[...o,...u],[]))},Jl=(n,t,e)=>async(s,r,i)=>{const c=t(s);await Promise.all(Array.from(c.activeInputs).map(async([o,u])=>{const l=await n(o).render(o,r);e(o)||l.connect(i,u)}))},th=(n,t,e,s)=>r=>n(Ds,()=>Ds(r))?Promise.resolve(n(s,s)).then(i=>{if(!i){const c=e(r,512,0,1);r.oncomplete=()=>{c.onaudioprocess=null,c.disconnect()},c.onaudioprocess=()=>r.currentTime,c.connect(r.destination)}return r.startRendering()}):new Promise(i=>{const c=t(r,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});r.oncomplete=o=>{c.disconnect(),i(o.renderedBuffer)},c.connect(r.destination),r.startRendering()}),eh=n=>(t,e)=>{n.set(t,e)},sh=n=>(t,e)=>n.set(t,e),nh=(n,t,e,s,r,i,c,o)=>(u,a)=>e(u).render(u,a).then(()=>Promise.all(Array.from(s(a)).map(l=>e(l).render(l,a)))).then(()=>r(a)).then(l=>(typeof l.copyFromChannel!="function"?(c(l),lr(l)):t(i,()=>i(l))||o(l),n.add(l),l)),rh={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},ih=(n,t,e,s,r,i)=>class extends n{constructor(o,u){const a=r(o),l={...rh,...u},h=e(a,l),d=i(a),f=d?s():null;super(o,!1,h,f),this._pan=t(this,d,h.pan)}get pan(){return this._pan}},oh=(n,t,e,s,r)=>()=>{const i=new WeakMap,c=async(o,u)=>{let a=e(o);const l=Tt(a,u);if(!l){const h={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,pan:a.pan.value};a=t(u,h)}return i.set(u,a),l?await n(u,o.pan,a.pan):await s(u,o.pan,a.pan),rs(a)?await r(o,u,a.inputs[0]):await r(o,u,a),a};return{render(o,u){const a=i.get(u);return a!==void 0?Promise.resolve(a):c(o,u)}}},ah=n=>()=>{if(n===null)return!1;try{new n({length:1,sampleRate:44100})}catch{return!1}return!0},ch=(n,t)=>async()=>{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),r=URL.createObjectURL(e);let i=!1,c=!1;try{await s.audioWorklet.addModule(r);const o=new n(s,"a",{numberOfOutputs:0}),u=s.createOscillator();o.port.onmessage=()=>i=!0,o.onprocessorerror=()=>c=!0,u.connect(o),u.start(0),await s.startRendering(),await new Promise(a=>setTimeout(a))}catch{}finally{URL.revokeObjectURL(r)}return i&&!c},uh=(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(r=>{e.oncomplete=()=>{s.disconnect(),r(e.currentTime!==0)},e.startRendering()})},lh=()=>new DOMException("","UnknownError"),hh={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},dh=(n,t,e,s,r,i,c)=>class extends n{constructor(u,a){const l=r(u),h={...hh,...a},d=e(l,h),p=i(l)?s():null;super(u,!0,d,p),this._isCurveNullified=!1,this._nativeWaveShaperNode=d,c(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(u){if(u===null)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(u.length<2)throw t();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=u}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(u){this._nativeWaveShaperNode.oversample=u}},ph=(n,t,e)=>()=>{const s=new WeakMap,r=async(i,c)=>{let o=t(i);if(!Tt(o,c)){const a={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,curve:o.curve,oversample:o.oversample};o=n(c,a)}return s.set(c,o),rs(o)?await e(i,c,o.inputs[0]):await e(i,c,o),o};return{render(i,c){const o=s.get(c);return o!==void 0?Promise.resolve(o):r(i,c)}}},fh=()=>typeof window>"u"?null:window,xh=(n,t)=>e=>{e.copyFromChannel=(s,r,i=0)=>{const c=n(i),o=n(r);if(o>=e.numberOfChannels)throw t();const u=e.length,a=e.getChannelData(o),l=s.length;for(let h=c<0?-c:0;h+c<u&&h<l;h+=1)s[h]=a[h+c]},e.copyToChannel=(s,r,i=0)=>{const c=n(i),o=n(r);if(o>=e.numberOfChannels)throw t();const u=e.length,a=e.getChannelData(o),l=s.length;for(let h=c<0?-c:0;h+c<u&&h<l;h+=1)a[h+c]=s[h]}},mh=n=>t=>{t.copyFromChannel=(e=>(s,r,i=0)=>{const c=n(i),o=n(r);if(c<t.length)return e.call(t,s,o,c)})(t.copyFromChannel),t.copyToChannel=(e=>(s,r,i=0)=>{const c=n(i),o=n(r);if(c<t.length)return e.call(t,s,o,c)})(t.copyToChannel)},_h=n=>(t,e)=>{const s=e.createBuffer(1,1,44100);t.buffer===null&&(t.buffer=s),n(t,"buffer",r=>()=>{const i=r.call(t);return i===s?null:i},r=>i=>r.call(t,i===null?s:i))},gh=(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 r=e.createBufferSource();t(s,()=>{const o=s.numberOfInputs;for(let u=0;u<o;u+=1)r.connect(s,0,u)},()=>r.disconnect(s))},Oo=(n,t,e)=>n.copyFromChannel===void 0?n.getChannelData(e)[0]:(n.copyFromChannel(t,e),t[0]),Mo=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},Fs=(n,t,e,s)=>{let r=n;for(;!r.hasOwnProperty(t);)r=Object.getPrototypeOf(r);const{get:i,set:c}=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(n,t,{get:e(i),set:s(c)})},vh=n=>({...n,outputChannelCount:n.outputChannelCount!==void 0?n.outputChannelCount:n.numberOfInputs===1&&n.numberOfOutputs===1?[n.channelCount]:Array.from({length:n.numberOfOutputs},()=>1)}),yh=n=>({...n,channelCount:n.numberOfOutputs}),Ch=n=>{const{imag:t,real:e}=n;return 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}},Io=(n,t,e)=>{try{n.setValueAtTime(t,e)}catch(s){if(s.code!==9)throw s;Io(n,t,e+1e-7)}},Ah=n=>{const t=n.createBufferSource();t.start();try{t.start()}catch{return!0}return!1},bh=n=>{const t=n.createBufferSource(),e=n.createBuffer(1,1,44100);t.buffer=e;try{t.start(0,1)}catch{return!1}return!0},wh=n=>{const t=n.createBufferSource();t.start();try{t.stop()}catch{return!1}return!0},_r=n=>{const t=n.createOscillator();try{t.start(-1)}catch(e){return e instanceof RangeError}return!1},Ro=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}},gr=n=>{const t=n.createOscillator();try{t.stop(-1)}catch(e){return e instanceof RangeError}return!1},Eh=n=>{const{port1:t,port2:e}=new MessageChannel;try{t.postMessage(n)}finally{t.close(),e.close()}},Dh=n=>{n.start=(t=>(e=0,s=0,r)=>{const i=n.buffer,c=i===null?s:Math.min(i.duration,s);i!==null&&c>i.duration-.5/n.context.sampleRate?t.call(n,e,0,0):t.call(n,e,c,r)})(n.start)},Po=(n,t)=>{const e=t.createGain();n.connect(e);const s=(r=>()=>{r.call(n,e),n.removeEventListener("ended",s)})(n.disconnect);n.addEventListener("ended",s),is(n,e),n.stop=(r=>{let i=!1;return(c=0)=>{if(i)try{r.call(n,c)}catch{e.gain.setValueAtTime(0,c)}else r.call(n,c),i=!0}})(n.stop)},os=(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)},Th=$c(ze),kh=Jc(ze),Fh=h0(rn),qo=new WeakMap,Bh=F0(qo),te=Lu(new Map,new WeakMap),ce=fh(),Vo=il(te,ae),vr=k0(Nt),Et=Kl(Nt,vr,je),Sh=ru(Vo,ht,Et),lt=N0(nn),Ce=Nl(ce),ct=Z0(Ce),Wo=new WeakMap,Lo=C0(os),Bs=ul(ce),yr=U0(Bs),Cr=G0(ce),zo=$0(ce),Ss=hl(ce),gt=Fu(Xc(oo),Kc(Th,kh,cn,Fh,un,Nt,Bh,Cs,ht,ze,ye,je,ln),te,W0(or,un,Nt,ht,Es,ye),ae,xn,Ot,a0(cn,or,Nt,ht,Es,lt,ye,ct),f0(Wo,Nt,Jt),Lo,lt,yr,Cr,zo,ct,Ss),Nh=nu(gt,Sh,ae,Vo,lt,ct),Ar=new WeakSet,jo=ol(ce),Ho=t0(new Uint32Array(1)),br=xh(Ho,ae),wr=mh(Ho),Oh=ou(Ar,te,Ot,jo,Ce,ah(jo),br,wr),mn=tu(Vt),Uo=Jl(vr,bs,je),ue=Xu(Uo),as=cl(mn,te,Ah,bh,wh,_r,Ro,gr,Dh,_h(Fs),Po),le=Ql(B0(bs),Uo),Mh=uu(ue,as,ht,le,Et),ee=Bu(Zc(ao),Wo,ir,Su,Lc,zc,jc,Hc,Uc,tr,eo,Bs,Io),Ih=cu(gt,Mh,ee,bt,as,lt,ct,os),Rh=gu(gt,vu,ae,bt,ll(Vt,Fs),lt,ct,Et),Ph=Wu(ue,Bo,ht,le,Et),He=sh(qo),qh=Vu(gt,ee,Ph,xn,Bo,lt,ct,He),Be=nl(ze,Cr),Vh=gh(bt,Be),Se=gl(Bs,Vh),Wh=Hu(Se,ht,Et),Lh=ju(gt,Wh,Se,lt,ct),zh=$u(Ts,ht,Et),jh=Gu(gt,zh,Ts,lt,ct,yh),Hh=Cl(mn,as,Vt,Be),cs=yl(mn,te,Hh,_r,gr),Uh=Ju(ue,cs,ht,le,Et),Gh=Ku(gt,ee,Uh,cs,lt,ct,os),Go=Al(Ot,Fs),$h=n0(Go,ht,Et),Xh=s0(gt,$h,Go,lt,ct,He),Zh=l0(ue,So,ht,le,Et),Yh=u0(gt,ee,Zh,So,lt,ct,He),$o=bl(Ot),Qh=g0(ue,$o,ht,le,Et),Kh=_0(gt,ee,Qh,$o,Ot,lt,ct,He),Jh=D0(ue,Vt,ht,le,Et),td=E0(gt,ee,Jh,Vt,lt,ct),ed=Tl(xn,bt,ks,Ot),_n=th(te,Vt,ks,uh(Vt,Ce)),sd=V0(as,ht,Ce,Et,_n),nd=wl(ed),rd=P0(gt,nd,sd,lt,ct,He),id=yu(ee,Se,cs,ks,Ot,Oo,ct,Fs),Xo=new WeakMap,od=sl(Rh,id,Lo,ct,Xo,os),Zo=Ol(mn,te,_r,Ro,gr,Po),ad=Ul(ue,Zo,ht,le,Et),cd=Hl(gt,ee,Zo,ad,lt,ct,os),Yo=Yu(as),ud=Wl(Yo,bt,Vt,Mo,Be),gn=Vl(Yo,bt,ud,Mo,Be,Bs,Fs),ld=Il(cn,bt,Se,Vt,ks,gn,Ot,un,Oo,Be),Qo=Ml(ld),hd=Xl(ue,Se,cs,Vt,Qo,ht,Ce,le,Et,_n),dd=$l(gt,ee,Qo,hd,lt,ct,He),pd=Rl(ae),fd=Yl(pd,lt,new WeakSet,Ch),xd=ql(Se,Ts,Vt,gn,Ot,Be),Ko=Pl(xd,Ot),md=oh(ue,Ko,ht,le,Et),_d=ih(gt,ee,Ko,md,lt,ct),gd=ph(gn,ht,Et),vd=dh(gt,bt,gn,gd,lt,ct,He),Jo=Y0(ce),Er=A0(ce),ta=new WeakMap,yd=O0(ta,Ce),Cd=Jo?Qc(te,Ot,y0(ce),Er,b0(Gc),lt,yd,ct,Ss,new WeakMap,new WeakMap,ch(Ss,Ce),ce):void 0,Ad=X0(yr,ct),bd=o0(Ar,te,i0,v0,new WeakSet,lt,Ad,on,Ds,br,wr),ea=Pu(Cd,Nh,Oh,Ih,qh,Lh,jh,Gh,Xh,bd,Yh,Kh,td,rd,od,cd,dd,fd,_d,vd),wd=Q0(gt,kl,lt,ct),Ed=J0(gt,Fl,lt,ct),Dd=tl(gt,Bl,lt,ct),Td=Sl(bt,ct),kd=el(gt,Td,lt),Fd=_u(ea,bt,Ot,lh,wd,Ed,Dd,kd,Bs),Dr=M0(Xo),Bd=eu(Dr),sa=Zu(ae),Sd=d0(Dr),na=x0(ae),ra=new WeakMap,Nd=T0(ra,Jt),Od=_l(sa,ae,bt,Se,Ts,cs,Vt,ks,Ot,na,Er,Nd,Be),Md=pl(bt,Od,Vt,Ot,Be),Id=Ru(ue,sa,as,Se,Ts,cs,Vt,Sd,na,Er,ht,Ss,Ce,le,Et,_n),Rd=S0(ta),Pd=eh(ra),ia=Jo?Ou(Bd,gt,ee,Id,Md,Nt,Rd,lt,ct,Ss,vh,Pd,Eh,os):void 0,qd=r0(Ot,Ce),Vd=nh(Ar,te,vr,Dr,_n,on,br,wr),Wd=zl(ea,te,bt,qd,Vd),Ld=L0(nn,yr),zd=z0(rr,Cr),jd=j0(ir,zo),Hd=H0(nn,ct);function Z(n,t){if(!n)throw new Error(t)}function se(n,t,e=1/0){if(!(t<=n&&n<=e))throw new RangeError(`Value must be within [${t}, ${e}], got: ${n}`)}function oa(n){!n.isOffline&&n.state!=="running"&&ca('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let aa=console;function Ud(...n){aa.log(...n)}function ca(...n){aa.warn(...n)}function jt(n){return typeof n>"u"}function Y(n){return!jt(n)}function Gd(n){return typeof n=="function"}function he(n){return typeof n=="number"}function Ne(n){return Object.prototype.toString.call(n)==="[object Object]"&&n.constructor===Object}function ua(n){return typeof n=="boolean"}function Xt(n){return Array.isArray(n)}function de(n){return typeof n=="string"}function vn(n){return de(n)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(n)}function $d(n){return new Fd(n)}function Xd(n,t,e){return new Wd(n,t,e)}const Ue=typeof self=="object"?self:null,Zd=Ue&&(Ue.hasOwnProperty("AudioContext")||Ue.hasOwnProperty("webkitAudioContext"));function Yd(n,t,e){return Z(Y(ia),"This node only works in a secure context (https or localhost)"),new ia(n,t,e)}function ne(n,t,e,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,e):s,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,s);else for(var o=n.length-1;o>=0;o--)(c=n[o])&&(i=(r<3?c(i):r>3?c(t,e,i):c(t,e))||i);return r>3&&i&&Object.defineProperty(t,e,i),i}function vt(n,t,e,s){function r(i){return i instanceof e?i:new e(function(c){c(i)})}return new(e||(e=Promise))(function(i,c){function o(l){try{a(s.next(l))}catch(h){c(h)}}function u(l){try{a(s.throw(l))}catch(h){c(h)}}function a(l){l.done?i(l.value):r(l.value).then(o,u)}a((s=s.apply(n,t||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;class Qd{constructor(t,e,s){this._callback=t,this._type=e,this._updateInterval=s,this._createClock()}_createWorker(){const t=new Blob([`
4
+ // the initial timeout time
5
+ let timeoutTime = ${(this._updateInterval*1e3).toFixed(1)};
6
+ // onmessage callback
7
+ self.onmessage = function(msg){
8
+ timeoutTime = parseInt(msg.data);
9
+ };
10
+ // the tick function which posts a message
11
+ // and schedules a new tick
12
+ function tick(){
13
+ setTimeout(tick, timeoutTime);
14
+ self.postMessage('tick');
15
+ }
16
+ // call tick initially
17
+ tick();
18
+ `],{type:"text/javascript"}),e=URL.createObjectURL(t),s=new Worker(e);s.onmessage=this._callback.bind(this),this._worker=s}_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._timeout=0),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(t){this._updateInterval=Math.max(t,128/44100),this._type==="worker"&&this._worker.postMessage(Math.max(t*1e3,1))}get type(){return this._type}set type(t){this._disposeClock(),this._type=t,this._createClock()}dispose(){this._disposeClock()}}function Ge(n){return jd(n)}function Oe(n){return zd(n)}function yn(n){return Hd(n)}function us(n){return Ld(n)}function la(n){return n instanceof AudioBuffer}function Kd(n,t){return n==="value"||Ge(t)||Oe(t)||la(t)}function ls(n,...t){if(!t.length)return n;const e=t.shift();if(Ne(n)&&Ne(e))for(const s in e)Kd(s,e[s])?n[s]=e[s]:Ne(e[s])?(n[s]||Object.assign(n,{[s]:{}}),ls(n[s],e[s])):Object.assign(n,{[s]:e[s]});return ls(n,...t)}function Jd(n,t){return n.length===t.length&&n.every((e,s)=>t[s]===e)}function I(n,t,e=[],s){const r={},i=Array.from(t);if(Ne(i[0])&&s&&!Reflect.has(i[0],s)&&(Object.keys(i[0]).some(o=>Reflect.has(n,o))||(ls(r,{[s]:i[0]}),e.splice(e.indexOf(s),1),i.shift())),i.length===1&&Ne(i[0]))ls(r,i[0]);else for(let c=0;c<e.length;c++)Y(i[c])&&(r[e[c]]=i[c]);return ls(n,r)}function tp(n){return n.constructor.getDefaults()}function pe(n,t){return jt(n)?t:n}function ha(n,t){return t.forEach(e=>{Reflect.has(n,e)&&delete n[e]}),n}/**
19
+ * Tone.js
20
+ * @author Yotam Mann
21
+ * @license http://opensource.org/licenses/MIT MIT License
22
+ * @copyright 2014-2019 Yotam Mann
23
+ */class Ae{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||Ue&&this.toString()===Ue.TONE_DEBUG_CLASS)&&Ud(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}Ae.version=Pt;const Tr=1e-6;function Cn(n,t){return n>t+Tr}function kr(n,t){return Cn(n,t)||re(n,t)}function da(n,t){return n+Tr<t}function re(n,t){return Math.abs(n-t)<Tr}function ep(n,t,e){return Math.max(Math.min(n,e),t)}class fe extends Ae{constructor(){super(),this.name="Timeline",this._timeline=[];const t=I(fe.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(Z(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];Z(kr(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(re(this._timeline[e].time,t)){for(let s=e;s>=0&&re(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&&kr(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 r=this._timeline.length;let i=r;if(r>0&&this._timeline[r-1][e]<=t)return r-1;for(;s<i;){let c=Math.floor(s+(i-s)/2);const o=this._timeline[c],u=this._timeline[c+1];if(re(o[e],t)){for(let a=c;a<this._timeline.length;a++){const l=this._timeline[a];if(re(l[e],t))c=a;else break}return c}else{if(da(o[e],t)&&Cn(u[e],t))return c;Cn(o[e],t)?i=c:s=c+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 r=this._search(t),i=this._search(e);return r!==-1&&i!==-1?(this._timeline[r].time!==t&&(r+=1),this._timeline[i].time===e&&(i-=1),this._iterate(s,r,i)):r===-1&&this._iterate(s,0,i),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&&re(this._timeline[s].time,t)){let r=s;for(let i=s;i>=0&&re(this._timeline[i].time,t);i--)r=i;this._iterate(i=>{e(i)},r,s)}return this}dispose(){return super.dispose(),this._timeline=[],this}}const pa=[];function An(n){pa.push(n)}function sp(n){pa.forEach(t=>t(n))}const fa=[];function bn(n){fa.push(n)}function np(n){fa.forEach(t=>t(n))}class Ns extends Ae{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach(r=>{jt(this._events)&&(this._events={}),this._events.hasOwnProperty(r)||(this._events[r]=[]),this._events[r].push(e)}),this}once(t,e){const s=(...r)=>{e(...r),this.off(t,s)};return this.on(t,s),this}off(t,e){return t.split(/\W+/).forEach(r=>{if(jt(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(jt(e))this._events[t]=[];else{const i=this._events[t];for(let c=i.length-1;c>=0;c--)i[c]===e&&i.splice(c,1)}}),this}emit(t,...e){if(this._events&&this._events.hasOwnProperty(t)){const s=this._events[t].slice(0);for(let r=0,i=s.length;r<i;r++)s[r].apply(this,e)}return this}static mixin(t){["on","once","off","emit"].forEach(e=>{const s=Object.getOwnPropertyDescriptor(Ns.prototype,e);Object.defineProperty(t.prototype,e,s)})}dispose(){return super.dispose(),this._events=void 0,this}}class xa extends Ns{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class hs extends xa{constructor(){super(),this.name="Context",this._constants=new Map,this._timeouts=new fe,this._timeoutIds=0,this._initialized=!1,this.isOffline=!1,this._workletModules=new Map;const t=I(hs.getDefaults(),arguments,["context"]);t.context?this._context=t.context:this._context=$d({latencyHint:t.latencyHint}),this._ticker=new Qd(this.emit.bind(this,"tick"),t.clockSource,t.updateInterval),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this._setLatencyHint(t.latencyHint),this.lookAhead=t.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){return this._initialized||(sp(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 Z(us(this._context),"Not available if OfflineAudioContext"),this._context.createMediaStreamSource(t)}createMediaElementSource(t){return Z(us(this._context),"Not available if OfflineAudioContext"),this._context.createMediaElementSource(t)}createMediaStreamDestination(){return Z(us(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){Z(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){Z(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){Z(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){Z(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return Yd(this.rawContext,t,e)}addAudioWorkletModule(t,e){return vt(this,void 0,void 0,function*(){Z(Y(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletModules.has(e)||this._workletModules.set(e,this.rawContext.audioWorklet.addModule(t)),yield this._workletModules.get(e)})}workletsAreReady(){return vt(this,void 0,void 0,function*(){const t=[];this._workletModules.forEach(e=>t.push(e)),yield Promise.all(t)})}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 latencyHint(){return this._latencyHint}_setLatencyHint(t){let e=0;if(this._latencyHint=t,de(t))switch(t){case"interactive":e=.1;break;case"playback":e=.5;break;case"balanced":e=.25;break}this.lookAhead=e,this.updateInterval=e/2}get rawContext(){return this._context}now(){return this._context.currentTime+this.lookAhead}immediate(){return this._context.currentTime}resume(){return us(this._context)?this._context.resume():Promise.resolve()}close(){return vt(this,void 0,void 0,function*(){us(this._context)&&(yield this._context.close()),this._initialized&&np(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 i=0;i<s.length;i++)s[i]=t;const r=this._context.createBufferSource();return r.channelCount=1,r.channelCountMode="explicit",r.buffer=e,r.loop=!0,r.start(0),this._constants.set(t,r),r}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map(t=>this._constants[t].disconnect()),this}_timeoutLoop(){const t=this.now();let e=this._timeouts.peek();for(;this._timeouts.length&&e&&e.time<=t;)e.callback(),this._timeouts.shift(),e=this._timeouts.peek()}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,r=()=>{const i=this.now();this._timeouts.add({callback:()=>{t(),r()},id:s,time:i+e})};return r(),s}}class rp extends xa{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(t,e,s){return{}}createChannelMerger(t){return{}}createChannelSplitter(t){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(t){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(t,e){return{}}createPanner(){return{}}createPeriodicWave(t,e,s){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(t){return{}}createMediaElementSource(t){return{}}createMediaStreamDestination(){return{}}decodeAudioData(t){return Promise.resolve({})}createAudioWorkletNode(t,e){return{}}get rawContext(){return{}}addAudioWorkletModule(t,e){return vt(this,void 0,void 0,function*(){return Promise.resolve()})}resume(){return Promise.resolve()}setTimeout(t,e){return 0}clearTimeout(t){return this}setInterval(t,e){return 0}clearInterval(t){return this}getConstant(t){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(t){}get destination(){return{}}set destination(t){}now(){return 0}immediate(){return 0}}function rt(n,t){Xt(t)?t.forEach(e=>rt(n,e)):Object.defineProperty(n,t,{enumerable:!0,writable:!1})}function Fr(n,t){Xt(t)?t.forEach(e=>Fr(n,e)):Object.defineProperty(n,t,{writable:!0})}const et=()=>{};class it extends Ae{constructor(){super(),this.name="ToneAudioBuffer",this.onload=et;const t=I(it.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,t.url&&la(t.url)||t.url instanceof it?this.set(t.url):de(t.url)&&this.load(t.url).catch(t.onerror)}static getDefaults(){return{onerror:et,onload:et,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:Wt().sampleRate}set(t){return t instanceof it?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 vt(this,void 0,void 0,function*(){const e=it.load(t).then(s=>{this.set(s),this.onload(this)});it.downloads.push(e);try{yield e}finally{const s=it.downloads.indexOf(e);it.downloads.splice(s,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=Xt(t)&&t[0].length>0,s=e?t.length:1,r=e?t[0].length:t.length,i=Wt(),c=i.createBuffer(s,r,i.sampleRate),o=!e&&s===1?[t]:t;for(let u=0;u<s;u++)c.copyToChannel(o[u],u);return this._buffer=c,this}toMono(t){if(he(t))this.fromArray(this.toArray(t));else{let e=new Float32Array(this.length);const s=this.numberOfChannels;for(let r=0;r<s;r++){const i=this.toArray(r);for(let c=0;c<i.length;c++)e[c]+=i[c]}e=e.map(r=>r/s),this.fromArray(e)}return this}toArray(t){if(he(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){const s=Math.floor(t*this.sampleRate),r=Math.floor(e*this.sampleRate);Z(s<r,"The start time must be less than the end time");const i=r-s,c=Wt().createBuffer(this.numberOfChannels,i,this.sampleRate);for(let o=0;o<this.numberOfChannels;o++)c.copyToChannel(this.getChannelData(o).subarray(s,r),o);return new it(c)}_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 it().fromArray(t)}static fromUrl(t){return vt(this,void 0,void 0,function*(){return yield new it().load(t)})}static load(t){return vt(this,void 0,void 0,function*(){const e=t.match(/\[([^\]\[]+\|.+)\]$/);if(e){const o=e[1].split("|");let u=o[0];for(const a of o)if(it.supportsType(a)){u=a;break}t=t.replace(e[0],u)}const s=it.baseUrl===""||it.baseUrl.endsWith("/")?it.baseUrl:it.baseUrl+"/",r=yield fetch(s+t);if(!r.ok)throw new Error(`could not load url: ${t}`);const i=yield r.arrayBuffer();return yield Wt().decodeAudioData(i)})}static supportsType(t){const e=t.split("."),s=e[e.length-1];return document.createElement("audio").canPlayType("audio/"+s)!==""}static loaded(){return vt(this,void 0,void 0,function*(){for(yield Promise.resolve();it.downloads.length;)yield it.downloads[0]})}}it.baseUrl="",it.downloads=[];class wn extends hs{constructor(){super({clockSource:"offline",context:yn(arguments[0])?arguments[0]:Xd(arguments[0],arguments[1]*arguments[2],arguments[2]),lookAhead:0,updateInterval:yn(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=yn(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(t){return vt(this,void 0,void 0,function*(){let e=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,e++;const s=Math.floor(this.sampleRate/128);t&&e%s===0&&(yield new Promise(r=>setTimeout(r,1)))}})}render(t=!0){return vt(this,void 0,void 0,function*(){yield this.workletsAreReady(),yield this._renderClock(t);const e=yield this._context.startRendering();return new it(e)})}close(){return Promise.resolve()}}const ma=new rp;let Os=ma;function Wt(){return Os===ma&&Zd&&_a(new hs),Os}function _a(n){us(n)?Os=new hs(n):yn(n)?Os=new wn(n):Os=n}if(Ue&&!Ue.TONE_SILENCE_LOGGING){const t=` * Tone.js v${Pt} * `;console.log(`%c${t}`,"background: #000; color: #fff")}function ip(n){return Math.pow(10,n/20)}function op(n){return 20*(Math.log(n)/Math.LN10)}function ga(n){return Math.pow(2,n/12)}let En=440;function ap(){return En}function cp(n){En=n}function Br(n){return Math.round(va(n))}function va(n){return 69+12*Math.log2(n/En)}function up(n){return En*Math.pow(2,(n-69)/12)}class Sr extends Ae{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),r=e==="."?1.5:1;return s===1?this._beatsToUnits(this._getTimeSignature())*r:this._beatsToUnits(4/s)*r},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 r=0;return t&&t!=="0"&&(r+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&e!=="0"&&(r+=this._beatsToUnits(parseFloat(e))),s&&s!=="0"&&(r+=this._beatsToUnits(parseFloat(s)/4)),r},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof Sr&&this.fromType(this._val),jt(this._val))return this._noArg();if(de(this._val)&&jt(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(Ne(this._val)){let t=0;for(const e in this._val)if(Y(this._val[e])){const s=this._val[e],r=new this.constructor(this.context,e).valueOf()*s;t+=r}return t}if(Y(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 de(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}}class Zt extends Sr{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 Zt(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(),r=this.valueOf(),o=Math.round(r/s)*s-r;return r+o*e}toNotation(){const t=this.toSeconds(),e=["1m"];for(let i=1;i<9;i++){const c=Math.pow(2,i);e.push(c+"n."),e.push(c+"n"),e.push(c+"t")}e.push("0");let s=e[0],r=new Zt(this.context,e[0]).toSeconds();return e.forEach(i=>{const c=new Zt(this.context,i).toSeconds();Math.abs(c-t)<Math.abs(r-t)&&(s=i,r=c)}),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 r=e%1*4;e=Math.floor(e)%this._getTimeSignature();const i=r.toString();return i.length>3&&(r=parseFloat(parseFloat(i).toFixed(3))),[s,e,r].join(":")}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.round(e*this._getPPQ())}toSeconds(){return this.valueOf()}toMidi(){return Br(this.toFrequency())}_now(){return this.context.now()}}function lp(n,t){return new Zt(Wt(),n,t)}class Yt extends Zt{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return ap()}static set A4(t){cp(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return this.defaultUnits==="midi"?t:Yt.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method(t,e){const r=hp[t.toLowerCase()]+(parseInt(e,10)+1)*12;return this.defaultUnits==="midi"?r:Yt.mtof(r)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(t,e,s){let r=1;return t&&t!=="0"&&(r*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&e!=="0"&&(r*=this._beatsToUnits(parseFloat(e))),s&&s!=="0"&&(r*=this._beatsToUnits(parseFloat(s)/4)),r}}})}transpose(t){return new Yt(this.context,this.valueOf()*ga(t))}harmonize(t){return t.map(e=>this.transpose(e))}toMidi(){return Br(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Yt.A4);let s=Math.round(12*e)+57;const r=Math.floor(s/12);return r<0&&(s+=-12*r),dp[s%12]+r.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 up(t)}static ftom(t){return Br(t)}}const hp={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},dp=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class ds extends Zt{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class kt extends Ae{constructor(){super();const t=I(kt.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:Wt()}}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 new Zt(this.context,t).toSeconds()}toFrequency(t){return new Yt(this.context,t).toFrequency()}toTicks(t){return new ds(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach(s=>{jt(t[s])&&delete e[s]}),e}get(){const t=tp(this);return Object.keys(t).forEach(e=>{if(Reflect.has(this,e)){const s=this[e];Y(s)&&Y(s.value)&&Y(s.setValueAtTime)?t[e]=s.value:s instanceof kt?t[e]=s._getPartialProperties(t[e]):Xt(s)||he(s)||de(s)||ua(s)?t[e]=s:delete t[e]}}),t}set(t){return Object.keys(t).forEach(e=>{Reflect.has(this,e)&&Y(this[e])&&(this[e]&&Y(this[e].value)&&Y(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof kt?this[e].set(t[e]):this[e]=t[e])}),this}}class Ms extends fe{constructor(t="stopped"){super(),this.name="StateTimeline",this._initial=t,this.setStateAtTime(this._initial,0)}getValueAtTime(t){const e=this.get(t);return e!==null?e.state:this._initial}setStateAtTime(t,e,s){return se(e,0),this.add(Object.assign({},s,{state:t,time:e})),this}getLastState(t,e){const s=this._search(e);for(let r=s;r>=0;r--){const i=this._timeline[r];if(i.state===t)return i}}getNextState(t,e){const s=this._search(e);if(s!==-1)for(let r=s;r<this._timeline.length;r++){const i=this._timeline[r];if(i.state===t)return i}}}class K extends kt{constructor(){super(I(K.getDefaults(),arguments,["param","units","convert"])),this.name="Param",this.overridden=!1,this._minOutput=1e-7;const t=I(K.getDefaults(),arguments,["param","units","convert"]);for(Z(Y(t.param)&&(Ge(t.param)||t.param instanceof K),"param must be an AudioParam");!Ge(t.param);)t.param=t.param._param;this._swappable=Y(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 fe(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,Y(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(kt.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 Y(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 Y(this._maxValue)?this._maxValue:this.units==="normalRange"||this.units==="audioRange"?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return Y(this.maxValue)&&Y(this.minValue)&&se(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")?ip(t):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t}_toType(t){return this.convert&&this.units==="decibels"?op(t):t}setValueAtTime(t,e){const s=this.toSeconds(e),r=this._fromType(t);return Z(isFinite(r)&&isFinite(s),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(r),this.log(this.units,"setValueAtTime",t,s),this._events.add({time:s,type:"setValueAtTime",value:r}),this._param.setValueAtTime(r,s),this}getValueAtTime(t){const e=Math.max(this.toSeconds(t),0),s=this._events.getAfter(e),r=this._events.get(e);let i=this._initialValue;if(r===null)i=this._initialValue;else if(r.type==="setTargetAtTime"&&(s===null||s.type==="setValueAtTime")){const c=this._events.getBefore(r.time);let o;c===null?o=this._initialValue:o=c.value,r.type==="setTargetAtTime"&&(i=this._exponentialApproach(r.time,o,r.value,r.constant,e))}else if(s===null)i=r.value;else if(s.type==="linearRampToValueAtTime"||s.type==="exponentialRampToValueAtTime"){let c=r.value;if(r.type==="setTargetAtTime"){const o=this._events.getBefore(r.time);o===null?c=this._initialValue:c=o.value}s.type==="linearRampToValueAtTime"?i=this._linearInterpolate(r.time,c,s.time,s.value,e):i=this._exponentialInterpolate(r.time,c,s.time,s.value,e)}else i=r.value;return this._toType(i)}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),r=this.toSeconds(e);return Z(isFinite(s)&&isFinite(r),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(s),this._events.add({time:r,type:"linearRampToValueAtTime",value:s}),this.log(this.units,"linearRampToValueAtTime",t,r),this._param.linearRampToValueAtTime(s,r),this}exponentialRampToValueAtTime(t,e){let s=this._fromType(t);s=re(s,0)?this._minOutput:s,this._assertRange(s);const r=this.toSeconds(e);return Z(isFinite(s)&&isFinite(r),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({time:r,type:"exponentialRampToValueAtTime",value:s}),this.log(this.units,"exponentialRampToValueAtTime",t,r),this._param.exponentialRampToValueAtTime(s,r),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 r=Math.log(s+1)/Math.log(200);return this.setTargetAtTime(t,e,r),this.cancelAndHoldAtTime(e+s*.9),this.linearRampToValueAtTime(t,e+s),this}setTargetAtTime(t,e,s){const r=this._fromType(t);Z(isFinite(s)&&s>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(r),Z(isFinite(r)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({constant:s,time:i,type:"setTargetAtTime",value:r}),this.log(this.units,"setTargetAtTime",t,i,s),this._param.setTargetAtTime(r,i,s),this}setValueCurveAtTime(t,e,s,r=1){s=this.toSeconds(s),e=this.toSeconds(e);const i=this._fromType(t[0])*r;this.setValueAtTime(this._toType(i),e);const c=s/(t.length-1);for(let o=1;o<t.length;o++){const u=this._fromType(t[o])*r;this.linearRampToValueAtTime(this._toType(u),e+o*c)}return this}cancelScheduledValues(t){const e=this.toSeconds(t);return Z(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));Z(isFinite(e),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(t)}`),this.log(this.units,"cancelAndHoldAtTime",e,"value="+s);const r=this._events.get(e),i=this._events.getAfter(e);return r&&re(r.time,e)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(e),this._events.cancel(e+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),i.type==="linearRampToValueAtTime"?this.linearRampToValueAtTime(this._toType(s),e):i.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 r=this._events.getAfter(s.time),i=r?r.time:e+2,c=(i-e)/10;for(let o=e;o<i;o+=c)t.linearRampToValueAtTime(this.getValueAtTime(o),o)}return this._events.forEachAfter(this.context.currentTime,r=>{r.type==="cancelScheduledValues"?t.cancelScheduledValues(r.time):r.type==="setTargetAtTime"?t.setTargetAtTime(r.value,r.time,r.constant):t[r.type](r.value,r.time)}),this}setParam(t){Z(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,r,i){return s+(e-s)*Math.exp(-(i-t)/r)}_linearInterpolate(t,e,s,r,i){return e+(r-e)*((i-t)/(s-t))}_exponentialInterpolate(t,e,s,r,i){return e*Math.pow(r/e,(i-t)/(s-t))}}class $ extends kt{constructor(){super(...arguments),this.name="ToneAudioNode",this._internalChannels=[]}get numberOfInputs(){return Y(this.input)?Ge(this.input)||this.input instanceof K?1:this.input.numberOfInputs:0}get numberOfOutputs(){return Y(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return Y(t)&&(t instanceof $||Oe(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(s=>{s.channelCount=t.channelCount,s.channelCountMode=t.channelCountMode,s.channelInterpretation=t.channelInterpretation})}_getChannelProperties(){const t=this._getInternalNodes();Z(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 be(this,t,e,s),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return ca("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,s=0){return ya(this,t,e,s),this}chain(...t){return ps(this,...t),this}fan(...t){return t.forEach(e=>this.connect(e)),this}dispose(){return super.dispose(),Y(this.input)&&(this.input instanceof $?this.input.dispose():Oe(this.input)&&this.input.disconnect()),Y(this.output)&&(this.output instanceof $?this.output.dispose():Oe(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function ps(...n){const t=n.shift();n.reduce((e,s)=>(e instanceof $?e.connect(s):Oe(e)&&be(e,s),s),t)}function be(n,t,e=0,s=0){for(Z(Y(n),"Cannot connect from undefined node"),Z(Y(t),"Cannot connect to undefined node"),(t instanceof $||Oe(t))&&Z(t.numberOfInputs>0,"Cannot connect to node with no inputs"),Z(n.numberOfOutputs>0,"Cannot connect from node with no outputs");t instanceof $||t instanceof K;)Y(t.input)&&(t=t.input);for(;n instanceof $;)Y(n.output)&&(n=n.output);Ge(t)?n.connect(t,e):n.connect(t,e,s)}function ya(n,t,e=0,s=0){if(Y(t))for(;t instanceof $;)t=t.input;for(;!Oe(n);)Y(n.output)&&(n=n.output);Ge(t)?n.disconnect(t,e):Oe(t)?n.disconnect(t,e,s):n.disconnect()}class st extends ${constructor(){super(I(st.getDefaults(),arguments,["gain","units"])),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode;const t=I(st.getDefaults(),arguments,["gain","units"]);this.gain=new K({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),rt(this,"gain")}static getDefaults(){return Object.assign($.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class fs extends ${constructor(t){super(t),this.onended=et,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new st({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(e){const s=this.toSeconds(e);return this._startTime!==-1&&s>=this._startTime&&(this._stopTime===-1||s<=this._stopTime)?"started":"stopped"},this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut,this._curve=t.curve,this.onended=t.onended}static getDefaults(){return Object.assign($.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:et})}_startGain(t,e=1){Z(this._startTime===-1,"Source cannot be started more than once");const s=this.toSeconds(this._fadeIn);return this._startTime=t+s,this._startTime=Math.max(this._startTime,this.context.currentTime),s>0?(this._gainNode.gain.setValueAtTime(0,t),this._curve==="linear"?this._gainNode.gain.linearRampToValueAtTime(e,t+s):this._gainNode.gain.exponentialApproachValueAtTime(e,t,s)):this._gainNode.gain.setValueAtTime(e,t),this}stop(t){return this.log("stop",t),this._stopGain(this.toSeconds(t)),this}_stopGain(t){Z(this._startTime!==-1,"'start' must be called before 'stop'"),this.cancelStop();const e=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(t)+e,this._stopTime=Math.max(this._stopTime,this.context.currentTime),e>0?this._curve==="linear"?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(()=>{const s=this._curve==="exponential"?e*2:0;this._stopSource(this.now()+s),this._onended()},this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==et&&(this.onended(this),this.onended=et,!this.context.isOffline)){const t=()=>this.dispose();typeof window.requestIdleCallback<"u"?window.requestIdleCallback(t):setTimeout(t,1e3)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),Z(this._startTime!==-1,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}dispose(){return super.dispose(),this._gainNode.disconnect(),this}}class Dn extends fs{constructor(){super(I(Dn.getDefaults(),arguments,["offset"])),this.name="ToneConstantSource",this._source=this.context.createConstantSource();const t=I(Dn.getDefaults(),arguments,["offset"]);be(this._source,this._gainNode),this.offset=new K({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(fs.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}}class ot extends ${constructor(){super(I(ot.getDefaults(),arguments,["value","units"])),this.name="Signal",this.override=!0;const t=I(ot.getDefaults(),arguments,["value","units"]);this.output=this._constantSource=new Dn({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($.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,s=0){return Tn(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,r){return this._param.setValueCurveAtTime(t,e,s,r),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 Tn(n,t,e,s){(t instanceof K||Ge(t)||t instanceof ot&&t.override)&&(t.cancelScheduledValues(0),t.setValueAtTime(0,0),t instanceof ot&&(t.overridden=!0)),be(n,t,e,s)}class kn extends K{constructor(){super(I(kn.getDefaults(),arguments,["value"])),this.name="TickParam",this._events=new fe(1/0),this._multiplier=1;const t=I(kn.getDefaults(),arguments,["value"]);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(K.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(t,e,s){e=this.toSeconds(e),this.setRampPoint(e);const r=this._fromType(t),i=this._events.get(e),c=Math.round(Math.max(1/s,1));for(let o=0;o<=c;o++){const u=s*o+e,a=this._exponentialApproach(i.time,i.value,r,s,u);this.linearRampToValueAtTime(this._toType(a),u)}return this}setValueAtTime(t,e){const s=this.toSeconds(e);super.setValueAtTime(t,e);const r=this._events.get(s),i=this._events.previousEvent(r),c=this._getTicksUntilEvent(i,s);return r.ticks=Math.max(c,0),this}linearRampToValueAtTime(t,e){const s=this.toSeconds(e);super.linearRampToValueAtTime(t,e);const r=this._events.get(s),i=this._events.previousEvent(r),c=this._getTicksUntilEvent(i,s);return r.ticks=Math.max(c,0),this}exponentialRampToValueAtTime(t,e){e=this.toSeconds(e);const s=this._fromType(t),r=this._events.get(e),i=Math.round(Math.max((e-r.time)*10,1)),c=(e-r.time)/i;for(let o=0;o<=i;o++){const u=c*o+r.time,a=this._exponentialInterpolate(r.time,r.value,e,s,u);this.linearRampToValueAtTime(this._toType(a),u)}return this}_getTicksUntilEvent(t,e){if(t===null)t={ticks:0,time:0,type:"setValueAtTime",value:0};else if(jt(t.ticks)){const c=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(c,t.time)}const s=this._fromType(this.getValueAtTime(t.time));let r=this._fromType(this.getValueAtTime(e));const i=this._events.get(e);return i&&i.time===e&&i.type==="setValueAtTime"&&(r=this._fromType(this.getValueAtTime(e-this.sampleTime))),.5*(e-t.time)*(s+r)+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),r=this.getTicksAtTime(e);return this.getTimeOfTick(r+t)-s}getTimeOfTick(t){const e=this._events.get(t,"ticks"),s=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&s&&s.type==="linearRampToValueAtTime"&&e.value!==s.value){const r=this._fromType(this.getValueAtTime(e.time)),c=(this._fromType(this.getValueAtTime(s.time))-r)/(s.time-e.time),o=Math.sqrt(Math.pow(r,2)-2*c*(e.ticks-t)),u=(-r+o)/c,a=(-r-o)/c;return(u>0?u:a)+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),r=this.toSeconds(t),i=this.getTicksAtTime(s);return this.getTicksAtTime(s+r)-i}_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)}}class Fn extends ot{constructor(){super(I(Fn.getDefaults(),arguments,["value"])),this.name="TickSignal";const t=I(Fn.getDefaults(),arguments,["value"]);this.input=this._param=new kn({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(ot.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}}class Bn extends kt{constructor(){super(I(Bn.getDefaults(),arguments,["frequency"])),this.name="TickSource",this._state=new Ms,this._tickOffset=new fe;const t=I(Bn.getDefaults(),arguments,["frequency"]);this.frequency=new Fn({context:this.context,units:t.units,value:t.frequency}),rt(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},kt.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),Y(e)&&this.setTicksAtTime(e,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}pause(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)==="started"&&this._state.setStateAtTime("paused",e),this}cancel(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this}getTicksAtTime(t){const e=this.toSeconds(t),s=this._state.getLastState("stopped",e),r={state:"paused",time:e};this._state.add(r);let i=s,c=0;return this._state.forEachBetween(s.time,e+this.sampleTime,o=>{let u=i.time;const a=this._tickOffset.get(o.time);a&&a.time>=i.time&&(c=a.ticks,u=a.time),i.state==="started"&&o.state!=="started"&&(c+=this.frequency.getTicksAtTime(o.time)-this.frequency.getTicksAtTime(u)),i=o}),this._state.remove(r),c}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);let r=e,i=0;return this._state.forEachBetween(e.time,t+this.sampleTime,c=>{let o=r.time;const u=this._tickOffset.get(c.time);u&&u.time>=r.time&&(i=u.seconds,o=u.time),r.state==="started"&&c.state!=="started"&&(i+=c.time-o),r=c}),this._state.remove(s),i}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}getStateAtTime(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)}getTimeOfTick(t,e=this.now()){const s=this._tickOffset.get(e),r=this._state.get(e),i=Math.max(s.time,r.time),c=this.frequency.getTicksAtTime(i)+t-s.ticks;return this.frequency.getTimeOfTick(c)}forEachTickBetween(t,e,s){let r=this._state.get(t);this._state.forEachBetween(t,e,c=>{r&&r.state==="started"&&c.state!=="started"&&this.forEachTickBetween(Math.max(r.time,t),c.time-this.sampleTime,s),r=c});let i=null;if(r&&r.state==="started"){const c=Math.max(r.time,t),o=this.frequency.getTicksAtTime(c),u=this.frequency.getTicksAtTime(r.time),a=o-u;let l=Math.ceil(a)-a;l=re(l,1)?0:l;let h=this.frequency.getTimeOfTick(o+l);for(;h<e;){try{s(h,Math.round(this.getTicksAtTime(h)))}catch(d){i=d;break}h+=this.frequency.getDurationOfTicks(1,h)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this.frequency.dispose(),this}}class Is extends kt{constructor(){super(I(Is.getDefaults(),arguments,["callback","frequency"])),this.name="Clock",this.callback=et,this._lastUpdate=0,this._state=new Ms("stopped"),this._boundLoop=this._loop.bind(this);const t=I(Is.getDefaults(),arguments,["callback","frequency"]);this.callback=t.callback,this._tickSource=new Bn({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,rt(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(kt.getDefaults(),{callback:et,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){oa(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("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),r=this.getTicksAtTime(s);return this._tickSource.getTimeOfTick(r+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 r=this._tickSource.getTicksAtTime(s.time);this.emit("start",s.time,r);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,r)=>{this.callback(s,r)}))}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}}Ns.mixin(Is);let pp=class Gi extends ${constructor(){super(I(Gi.getDefaults(),arguments,["delayTime","maxDelay"])),this.name="Delay";const t=I(Gi.getDefaults(),arguments,["delayTime","maxDelay"]),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 K({context:this.context,param:this._delayNode.delayTime,units:"time",value:t.delayTime,minValue:0,maxValue:this.maxDelay}),rt(this,"delayTime")}static getDefaults(){return Object.assign($.getDefaults(),{delayTime:0,maxDelay:1})}get maxDelay(){return this._maxDelay}dispose(){return super.dispose(),this._delayNode.disconnect(),this.delayTime.dispose(),this}};class Nr extends Ae{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=I(Nr.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:et,onload:et,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return Z(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=et,r=et){return de(e)?this._buffers.set(t.toString(),new it(this.baseUrl+e,s,r)):this._buffers.set(t.toString(),new it(e,s,r)),this}dispose(){return super.dispose(),this._buffers.forEach(t=>t.dispose()),this._buffers.clear(),this}}class _t extends ds{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(t){return this._getPPQ()*t}_secondsToUnits(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(t){return t}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class fp extends kt{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new fe,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(t,e){return this._events.add({callback:t,time:this.toSeconds(e)}),this._events.length===1&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(t){return this._events.cancel(this.toSeconds(t)),this}_drawLoop(){const t=this.context.currentTime;for(;this._events.length&&this._events.peek().time-this.anticipation<=t;){const e=this._events.shift();e&&t-e.time<=this.expiration&&e.callback()}this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}An(n=>{n.draw=new fp({context:n})}),bn(n=>{n.draw.dispose()});class xp extends Ae{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){Z(Y(t.time),"Events must have a time property"),Z(Y(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new mp(t.time,t.time+t.duration,t);for(this._root===null?this._root=e:this._root.insert(e),this._length++;e!==null;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this}remove(t){if(this._root!==null){const e=[];this._root.search(t.time,e);for(const s of e)if(s.event===t){this._removeNode(s),this._length--;break}}return this}get length(){return this._length}cancel(t){return this.forEachFrom(t,e=>this.remove(e)),this}_setRoot(t){this._root=t,this._root!==null&&(this._root.parent=null)}_replaceNodeInParent(t,e){t.parent!==null?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)}_removeNode(t){if(t.left===null&&t.right===null)this._replaceNodeInParent(t,null);else if(t.right===null)this._replaceNodeInParent(t,t.left);else if(t.left===null)this._replaceNodeInParent(t,t.right);else{const e=t.getBalance();let s,r=null;if(e>0)if(t.left.right===null)s=t.left,s.right=t.right,r=s;else{for(s=t.left.right;s.right!==null;)s=s.right;s.parent&&(s.parent.right=s.left,r=s.parent,s.left=t.left,s.right=t.right)}else if(t.right.left===null)s=t.right,s.left=t.left,r=s;else{for(s=t.right.left;s.left!==null;)s=s.left;s.parent&&(s.parent.left=s.right,r=s.parent,s.left=t.left,s.right=t.right)}t.parent!==null?t.isLeftChild()?t.parent.left=s:t.parent.right=s:this._setRoot(s),r&&this._rebalance(r)}t.dispose()}_rotateLeft(t){const e=t.parent,s=t.isLeftChild(),r=t.right;r&&(t.right=r.left,r.left=t),e!==null?s?e.left=r:e.right=r:this._setRoot(r)}_rotateRight(t){const e=t.parent,s=t.isLeftChild(),r=t.left;r&&(t.left=r.right,r.right=t),e!==null?s?e.left=r:e.right=r:this._setRoot(r)}_rebalance(t){const e=t.getBalance();e>1&&t.left?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&t.right&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))}get(t){if(this._root!==null){const e=[];if(this._root.search(t,e),e.length>0){let s=e[0];for(let r=1;r<e.length;r++)e[r].low>s.low&&(s=e[r]);return s.event}}return null}forEach(t){if(this._root!==null){const e=[];this._root.traverse(s=>e.push(s)),e.forEach(s=>{s.event&&t(s.event)})}return this}forEachAtTime(t,e){if(this._root!==null){const s=[];this._root.search(t,s),s.forEach(r=>{r.event&&e(r.event)})}return this}forEachFrom(t,e){if(this._root!==null){const s=[];this._root.searchAfter(t,s),s.forEach(r=>{r.event&&e(r.event)})}return this}dispose(){return super.dispose(),this._root!==null&&this._root.traverse(t=>t.dispose()),this._root=null,this}}class mp{constructor(t,e,s){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=s,this.low=t,this.high=e,this.max=this.high}insert(t){t.low<=this.low?this.left===null?this.left=t:this.left.insert(t):this.right===null?this.right=t:this.right.insert(t)}search(t,e){t>this.max||(this.left!==null&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),!(this.low>t)&&this.right!==null&&this.right.search(t,e))}searchAfter(t,e){this.low>=t&&(e.push(this),this.left!==null&&this.left.searchAfter(t,e)),this.right!==null&&this.right.searchAfter(t,e)}traverse(t){t(this),this.left!==null&&this.left.traverse(t),this.right!==null&&this.right.traverse(t)}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 t=0;return this.left!==null&&this.right!==null?t=this.left.height-this.right.height:this.left!==null?t=this.left.height+1:this.right!==null&&(t=-(this.right.height+1)),t}isLeftChild(){return this.parent!==null&&this.parent.left===this}get left(){return this._left}set left(t){this._left=t,t!==null&&(t.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(t){this._right=t,t!==null&&(t.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}let Rs=class $i extends ${constructor(){super(I($i.getDefaults(),arguments,["volume"])),this.name="Volume";const t=I($i.getDefaults(),arguments,["volume"]);this.input=this.output=new st({context:this.context,gain:t.volume,units:"decibels"}),this.volume=this.output.gain,rt(this,"volume"),this._unmutedVolume=t.volume,this.mute=t.mute}static getDefaults(){return Object.assign($.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}};class Sn extends ${constructor(){super(I(Sn.getDefaults(),arguments)),this.name="Destination",this.input=new Rs({context:this.context}),this.output=new st({context:this.context}),this.volume=this.input.volume;const t=I(Sn.getDefaults(),arguments);ps(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($.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),ps(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}An(n=>{n.destination=new Sn({context:n})}),bn(n=>{n.destination.dispose()});class _p extends Ae{constructor(t){super(),this.name="TimelineValue",this._timeline=new fe({memory:10}),this._initialValue=t}set(t,e){return this._timeline.add({value:t,time:e}),this}get(t){const e=this._timeline.get(t);return e?e.value:this._initialValue}}class Me{constructor(t,e){this.id=Me._eventId++;const s=Object.assign(Me.getDefaults(),e);this.transport=t,this.callback=s.callback,this._once=s.once,this.time=s.time}static getDefaults(){return{callback:et,once:!1,time:0}}invoke(t){this.callback&&(this.callback(t),this._once&&this.transport.clear(this.id))}dispose(){return this.callback=void 0,this}}Me._eventId=0;class Or extends Me{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(Or.getDefaults(),e);this.duration=new _t(t.context,s.duration).valueOf(),this._interval=new _t(t.context,s.interval).valueOf(),this._nextTick=s.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},Me.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvents(t){const e=this.transport.getTicksAtTime(t);e>=this.time&&e>=this._nextTick&&this._nextTick+this._interval<this.time+this.duration&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new _t(this.context,this._nextTick).toSeconds()))}_restart(t){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.time;const e=this.transport.getTicksAtTime(t);e>this.time&&(this._nextTick=this.time+Math.ceil((e-this.time)/this._interval)*this._interval),this._currentId=this.transport.scheduleOnce(this.invoke.bind(this),new _t(this.context,this._nextTick).toSeconds()),this._nextTick+=this._interval,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new _t(this.context,this._nextTick).toSeconds())}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}}class Ps extends kt{constructor(){super(I(Ps.getDefaults(),arguments)),this.name="Transport",this._loop=new _p(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new fe,this._repeatedEvents=new xp,this._syncedSignals=[],this._swingAmount=0;const t=I(Ps.getDefaults(),arguments);this._ppq=t.ppq,this._clock=new Is({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),rt(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(kt.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),r=Math.sin(s*Math.PI)*this._swingAmount;t+=new _t(this.context,this._swingTicks*2/3).toSeconds()*r}this._timeline.forEachAtTime(e,s=>s.invoke(t))}schedule(t,e){const s=new Me(this,{callback:t,time:new ds(this.context,e).toTicks()});return this._addEvent(s,this._timeline)}scheduleRepeat(t,e,s,r=1/0){const i=new Or(this,{callback:t,duration:new Zt(this.context,r).toTicks(),interval:new Zt(this.context,e).toTicks(),time:new ds(this.context,s).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const s=new Me(this,{callback:t,once:!0,time:new ds(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 _t(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){let s;return Y(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){Xt(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Zt(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Zt(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}get swing(){return this._swingAmount}set swing(t){this._swingAmount=t}get swingSubdivision(){return new _t(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 _t(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),r=this._clock.frequency.getDurationOfTicks(Math.ceil(s)-s,e),i=e+r;this.emit("stop",i),this._clock.setTicksAtTime(t,i),this.emit("start",i,this._clock.getSecondsAtTime(i))}else this._clock.setTicksAtTime(t,e)}}getTicksAtTime(t){return Math.round(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),r=t-s%t;return this._clock.nextTickTime(r,e)}}syncSignal(t,e){if(!e){const r=this.now();if(t.getValueAtTime(r)!==0){const c=1/(60/this.bpm.getValueAtTime(r)/this.PPQ);e=t.getValueAtTime(r)/c}else e=0}const s=new st(e);return this.bpm.connect(s),s.connect(t._param),this._syncedSignals.push({initial:t.value,ratio:s,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.ratio.dispose(),s.signal.value=s.initial,this._syncedSignals.splice(e,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),Fr(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Ns.mixin(Ps),An(n=>{n.transport=new Ps({context:n})}),bn(n=>{n.transport.dispose()});class Mt extends ${constructor(t){super(t),this.input=void 0,this._state=new Ms("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=et,this._syncedStop=et,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new Rs({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,rt(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign($.getDefaults(),{mute:!1,onstop:et,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(t){this._volume.mute=t}_clampToCurrentTime(t){return this._synced?t:Math.max(t,this.context.currentTime)}start(t,e,s){let r=jt(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(r=this._clampToCurrentTime(r),!this._synced&&this._state.getValueAtTime(r)==="started")Z(Cn(r,this._state.get(r).time),"Start time must be strictly greater than previous start time"),this._state.cancel(r),this._state.setStateAtTime("started",r),this.log("restart",r),this.restart(r,e,s);else if(this.log("start",r),this._state.setStateAtTime("started",r),this._synced){const i=this._state.get(r);i&&(i.offset=this.toSeconds(pe(e,0)),i.duration=s?this.toSeconds(s):void 0);const c=this.context.transport.schedule(o=>{this._start(o,e,s)},r);this._scheduled.push(c),this.context.transport.state==="started"&&this.context.transport.getSecondsAtTime(this.immediate())>r&&this._syncedStart(this.now(),this.context.transport.seconds)}else oa(this.context),this._start(r,e,s);return this}stop(t){let e=jt(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),this._state.getValueAtTime(e)==="started"||Y(this._state.getNextState("started",e))){if(this.log("stop",e),!this._synced)this._stop(e);else{const s=this.context.transport.schedule(this._stop.bind(this),e);this._scheduled.push(s)}this._state.cancel(e),this._state.setStateAtTime("stopped",e)}return this}restart(t,e,s){return t=this.toSeconds(t),this._state.getValueAtTime(t)==="started"&&(this._state.cancel(t),this._restart(t,e,s)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(t,e)=>{if(e>0){const s=this._state.get(e);if(s&&s.state==="started"&&s.time!==e){const r=e-this.toSeconds(s.time);let i;s.duration&&(i=this.toSeconds(s.duration)-r),this._start(t,this.toSeconds(s.offset)+r,i)}}},this._syncedStop=t=>{const e=this.context.transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));this._state.getValueAtTime(e)==="started"&&this._stop(t)},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(t=>this.context.transport.clear(t)),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=et,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class xs extends fs{constructor(){super(I(xs.getDefaults(),arguments,["url","onload"])),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1;const t=I(xs.getDefaults(),arguments,["url","onload"]);be(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new K({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 it(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(fs.getDefaults(),{url:new it,loop:!1,loopEnd:0,loopStart:0,onload:et,onerror:et,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,r=1){Z(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,r),this.loop?e=pe(e,this.loopStart):e=pe(e,0);let c=Math.max(this.toSeconds(e),0);if(this.loop){const o=this.toSeconds(this.loopEnd)||this.buffer.duration,u=this.toSeconds(this.loopStart),a=o-u;kr(c,o)&&(c=(c-u)%a+u),re(c,this.buffer.duration)&&(c=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,da(c,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,c)),Y(s)){let o=this.toSeconds(s);o=Math.max(o,0),this.stop(i+o)}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}}class qs extends Mt{constructor(){super(I(qs.getDefaults(),arguments,["type"])),this.name="Noise",this._source=null;const t=I(qs.getDefaults(),arguments,["type"]);this._playbackRate=t.playbackRate,this.type=t.type,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Mt.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if(Z(t in Ca,"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=Ca[this._type];this._source=new xs({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}}const ms=44100*5,Mr=2,we={brown:null,pink:null,white:null},Ca={get brown(){if(!we.brown){const n=[];for(let t=0;t<Mr;t++){const e=new Float32Array(ms);n[t]=e;let s=0;for(let r=0;r<ms;r++){const i=Math.random()*2-1;e[r]=(s+.02*i)/1.02,s=e[r],e[r]*=3.5}}we.brown=new it().fromArray(n)}return we.brown},get pink(){if(!we.pink){const n=[];for(let t=0;t<Mr;t++){const e=new Float32Array(ms);n[t]=e;let s,r,i,c,o,u,a;s=r=i=c=o=u=a=0;for(let l=0;l<ms;l++){const h=Math.random()*2-1;s=.99886*s+h*.0555179,r=.99332*r+h*.0750759,i=.969*i+h*.153852,c=.8665*c+h*.3104856,o=.55*o+h*.5329522,u=-.7616*u-h*.016898,e[l]=s+r+i+c+o+u+a+h*.5362,e[l]*=.11,a=h*.115926}}we.pink=new it().fromArray(n)}return we.pink},get white(){if(!we.white){const n=[];for(let t=0;t<Mr;t++){const e=new Float32Array(ms);n[t]=e;for(let s=0;s<ms;s++)e[s]=Math.random()*2-1}we.white=new it().fromArray(n)}return we.white}};function $e(n,t){return vt(this,void 0,void 0,function*(){const e=t/n.context.sampleRate,s=new wn(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)})}class Nn extends fs{constructor(){super(I(Nn.getDefaults(),arguments,["frequency","type"])),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator];const t=I(Nn.getDefaults(),arguments,["frequency","type"]);be(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new K({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new K({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),rt(this,["frequency","detune"])}static getDefaults(){return Object.assign(fs.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}}let Ft=class Le extends Mt{constructor(){super(I(Le.getDefaults(),arguments,["frequency","type"])),this.name="Oscillator",this._oscillator=null;const t=I(Le.getDefaults(),arguments,["frequency","type"]);this.frequency=new ot({context:this.context,units:"frequency",value:t.frequency}),rt(this,"frequency"),this.detune=new ot({context:this.context,units:"cents",value:t.detune}),rt(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(Mt.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),s=new Nn({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 Le._periodicWaveCache.find(e=>e.phase===this._phase&&Jd(e.partials,this._partials));{const t=Le._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(Y(s)){const{partials:r,wave:i}=s;this._wave=i,this._partials=r,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave)}else{const[r,i]=this._getRealImaginary(t,this._phase),c=this.context.createPeriodicWave(r,i);this._wave=c,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave),Le._periodicWaveCache.push({imag:i,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:r,type:this._type,wave:this._wave}),Le._periodicWaveCache.length>100&&Le._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){se(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 r=new Float32Array(t);this._partials.forEach((i,c)=>r[c]=i),this._partials=Array.from(r),this.type=this._type}}_getRealImaginary(t,e){let r=2048;const i=new Float32Array(r),c=new Float32Array(r);let o=1;if(t==="custom"){if(o=this._partials.length+1,this._partialCount=this._partials.length,r=o,this._partials.length===0)return[i,c]}else{const u=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);u?(o=parseInt(u[2],10)+1,this._partialCount=parseInt(u[2],10),t=u[1],o=Math.max(o,2),r=o):this._partialCount=0,this._partials=[]}for(let u=1;u<r;++u){const a=2/(u*Math.PI);let l;switch(t){case"sine":l=u<=o?1:0,this._partials[u-1]=l;break;case"square":l=u&1?2*a:0,this._partials[u-1]=l;break;case"sawtooth":l=a*(u&1?1:-1),this._partials[u-1]=l;break;case"triangle":u&1?l=2*(a*a)*(u-1>>1&1?-1:1):l=0,this._partials[u-1]=l;break;case"custom":l=this._partials[u-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}l!==0?(i[u]=-l*Math.sin(e*u),c[u]=l*Math.cos(e*u)):(i[u]=0,c[u]=0)}return[i,c]}_inverseFFT(t,e,s){let r=0;const i=t.length;for(let c=0;c<i;c++)r+=t[c]*Math.cos(c*s)+e[c]*Math.sin(c*s);return r}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let s=0;const r=Math.PI*2,i=32;for(let c=0;c<i;c++)s=Math.max(this._inverseFFT(t,e,c/i*r),s);return ep(-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(t=1024){return vt(this,void 0,void 0,function*(){return $e(this,t)})}dispose(){return super.dispose(),this._oscillator!==null&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}};Ft._periodicWaveCache=[];class xe extends ${constructor(){super(Object.assign(I(xe.getDefaults(),arguments,["context"])))}connect(t,e=0,s=0){return Tn(this,t,e,s),this}}class Ie extends xe{constructor(){super(Object.assign(I(Ie.getDefaults(),arguments,["mapping","length"]))),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper;const t=I(Ie.getDefaults(),arguments,["mapping","length"]);Xt(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):Gd(t.mapping)&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(ot.getDefaults(),{length:1024})}setMap(t,e=1024){const s=new Float32Array(e);for(let r=0,i=e;r<i;r++){const c=r/(i-1)*2-1;s[r]=t(c,r)}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){const e=["none","2x","4x"].some(s=>s.includes(t));Z(e,"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class Aa extends xe{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new Ie({context:this.context,mapping:t=>(t+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class me extends ot{constructor(){super(Object.assign(I(me.getDefaults(),arguments,["value"]))),this.name="Multiply",this.override=!1;const t=I(me.getDefaults(),arguments,["value"]);this._mult=this.input=this.output=new st({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(ot.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}class Vs extends Mt{constructor(){super(I(Vs.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="AMOscillator",this._modulationScale=new Aa({context:this.context}),this._modulationNode=new st({context:this.context});const t=I(Vs.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Ft({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 Ft({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new me({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),rt(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Ft.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(t=1024){return vt(this,void 0,void 0,function*(){return $e(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}class Ws extends Mt{constructor(){super(I(Ws.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="FMOscillator",this._modulationNode=new st({context:this.context,gain:0});const t=I(Ws.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Ft({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 ot({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new Ft({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new me({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new me({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),rt(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Ft.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(t=1024){return vt(this,void 0,void 0,function*(){return $e(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}}class _s extends Mt{constructor(){super(I(_s.getDefaults(),arguments,["frequency","width"])),this.name="PulseOscillator",this._widthGate=new st({context:this.context,gain:0}),this._thresh=new Ie({context:this.context,mapping:e=>e<=0?-1:1});const t=I(_s.getDefaults(),arguments,["frequency","width"]);this.width=new ot({context:this.context,units:"audioRange",value:t.width}),this._triangle=new Ft({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),rt(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Mt.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(t=1024){return vt(this,void 0,void 0,function*(){return $e(this,t)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class Ls extends Mt{constructor(){super(I(Ls.getDefaults(),arguments,["frequency","type","spread"])),this.name="FatOscillator",this._oscillators=[];const t=I(Ls.getDefaults(),arguments,["frequency","type","spread"]);this.frequency=new ot({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ot({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,rt(this,["frequency","detune"])}static getDefaults(){return Object.assign(Ft.getDefaults(),{count:3,spread:20,type:"sawtooth"})}_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((r,i)=>r.detune.value=e+s*i)}}get count(){return this._oscillators.length}set count(t){if(se(t,1),this._oscillators.length!==t){this._forEach(e=>e.dispose()),this._oscillators=[];for(let e=0;e<t;e++){const s=new Ft({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):et});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(t=1024){return vt(this,void 0,void 0,function*(){return $e(this,t)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(t=>t.dispose()),this}}class zs extends Mt{constructor(){super(I(zs.getDefaults(),arguments,["frequency","modulationFrequency"])),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new me({context:this.context,value:2});const t=I(zs.getDefaults(),arguments,["frequency","modulationFrequency"]);this._pulse=new _s({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Ft({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),rt(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Mt.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(t=1024){return vt(this,void 0,void 0,function*(){return $e(this,t)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const ba={am:Vs,fat:Ls,fm:Ws,oscillator:Ft,pulse:_s,pwm:zs};class js extends Mt{constructor(){super(I(js.getDefaults(),arguments,["frequency","type"])),this.name="OmniOscillator";const t=I(js.getDefaults(),arguments,["frequency","type"]);this.frequency=new ot({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ot({context:this.context,units:"cents",value:t.detune}),rt(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(Ft.getDefaults(),Ws.getDefaults(),Vs.getDefaults(),Ls.getDefaults(),_s.getDefaults(),zs.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)}set(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=ba[t],s=this.now();if(this._oscillator){const r=this._oscillator;r.stop(s),this.context.setTimeout(()=>r.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 ba[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")&&he(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")&&he(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"))&&de(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(t=1024){return vt(this,void 0,void 0,function*(){return $e(this,t)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class On extends ot{constructor(){super(Object.assign(I(On.getDefaults(),arguments,["value"]))),this.override=!1,this.name="Add",this._sum=new st({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,ps(this._constantSource,this._sum)}static getDefaults(){return Object.assign(ot.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Hs extends xe{constructor(){super(Object.assign(I(Hs.getDefaults(),arguments,["min","max"]))),this.name="Scale";const t=I(Hs.getDefaults(),arguments,["min","max"]);this._mult=this.input=new me({context:this.context,value:t.max-t.min}),this._add=this.output=new On({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(xe.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}}class Ir extends xe{constructor(){super(Object.assign(I(Ir.getDefaults(),arguments))),this.name="Zero",this._gain=new st({context:this.context}),this.output=this._gain,this.input=void 0,be(this.context.getConstant(0),this._gain)}dispose(){return super.dispose(),ya(this.context.getConstant(0),this._gain),this}}let gp=class Xi extends ${constructor(){super(I(Xi.getDefaults(),arguments,["frequency","min","max"])),this.name="LFO",this._stoppedValue=0,this._units="number",this.convert=!0,this._fromType=K.prototype._fromType,this._toType=K.prototype._toType,this._is=K.prototype._is,this._clampValue=K.prototype._clampValue;const t=I(Xi.getDefaults(),arguments,["frequency","min","max"]);this._oscillator=new Ft(t),this.frequency=this._oscillator.frequency,this._amplitudeGain=new st({context:this.context,gain:t.amplitude,units:"normalRange"}),this.amplitude=this._amplitudeGain.gain,this._stoppedSignal=new ot({context:this.context,units:"audioRange",value:0}),this._zeros=new Ir({context:this.context}),this._a2g=new Aa({context:this.context}),this._scaler=this.output=new Hs({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),rt(this,["amplitude","frequency"]),this.phase=t.phase}static getDefaults(){return Object.assign(Ft.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 K||t instanceof ot)&&(this.convert=t.convert,this.units=t.units),Tn(this,t,e,s),this}dispose(){return super.dispose(),this._oscillator.dispose(),this._stoppedSignal.dispose(),this._zeros.dispose(),this._scaler.dispose(),this._a2g.dispose(),this._amplitudeGain.dispose(),this.amplitude.dispose(),this}};function wa(n,t=1/0){const e=new WeakMap;return function(s,r){Reflect.defineProperty(s,r,{configurable:!0,enumerable:!0,get:function(){return e.get(this)},set:function(i){se(i,n,t),e.set(this,i)}})}}function Ee(n,t=1/0){const e=new WeakMap;return function(s,r){Reflect.defineProperty(s,r,{configurable:!0,enumerable:!0,get:function(){return e.get(this)},set:function(i){se(this.toSeconds(i),n,t),e.set(this,i)}})}}class Us extends Mt{constructor(){super(I(Us.getDefaults(),arguments,["url","onload"])),this.name="Player",this._activeSources=new Set;const t=I(Us.getDefaults(),arguments,["url","onload"]);this._buffer=new it({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(Mt.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:et,onerror:et,playbackRate:1,reverse:!1})}load(t){return vt(this,void 0,void 0,function*(){return yield this._buffer.load(t),this._onload(),this})}_onload(t=et){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=pe(e,this._loopStart):e=pe(e,0);const r=this.toSeconds(e),i=s;s=pe(s,Math.max(this._buffer.duration-r,0));let c=this.toSeconds(s);c=c/this._playbackRate,t=this.toSeconds(t);const o=new xs({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+c),this._state.setStateAtTime("stopped",t+c,{implicitEnd:!0})),this._activeSources.add(o),this._loop&&jt(i)?o.start(t,r):o.start(t,r,c-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){this._stop(t),this._start(t,e,s)}seek(t,e){const s=this.toSeconds(e);if(this._state.getValueAtTime(s)==="started"){const r=this.toSeconds(t);this._stop(s),this._start(s,r)}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&&se(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&&se(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(r=>r.cancelStop())),this._activeSources.forEach(r=>{r.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}}ne([Ee(0)],Us.prototype,"fadeIn",void 0),ne([Ee(0)],Us.prototype,"fadeOut",void 0);class vp extends xe{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new Ie({context:this.context,mapping:t=>Math.abs(t)*2-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Mn extends xe{constructor(){super(Object.assign(I(Mn.getDefaults(),arguments,["value"]))),this.name="Pow";const t=I(Mn.getDefaults(),arguments,["value"]);this._exponentScaler=this.input=this.output=new Ie({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(xe.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}}let De=class Zi extends ${constructor(){super(I(Zi.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="Envelope",this._sig=new ot({context:this.context,value:0}),this.output=this._sig,this.input=void 0;const t=I(Zi.getDefaults(),arguments,["attack","decay","sustain","release"]);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($.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(de(t))return t;{let s;for(s in In)if(In[s][e]===t)return s;return t}}_setCurve(t,e,s){if(de(s)&&Reflect.has(In,s)){const r=In[s];Ne(r)?t!=="_decayCurve"&&(this[t]=r[e]):this[t]=r}else if(Xt(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._decayCurve}set decayCurve(t){Z(["linear","exponential"].some(e=>e===t),`Invalid envelope curve: ${t}`),this._decayCurve=t}triggerAttack(t,e=1){this.log("triggerAttack",t,e),t=this.toSeconds(t);let r=this.toSeconds(this.attack);const i=this.toSeconds(this.decay),c=this.getValueAtTime(t);if(c>0){const o=1/r;r=(1-c)/o}if(r<this.sampleTime)this._sig.cancelScheduledValues(t),this._sig.setValueAtTime(e,t);else if(this._attackCurve==="linear")this._sig.linearRampTo(e,r,t);else if(this._attackCurve==="exponential")this._sig.targetRampTo(e,r,t);else{this._sig.cancelAndHoldAtTime(t);let o=this._attackCurve;for(let u=1;u<o.length;u++)if(o[u-1]<=c&&c<=o[u]){o=this._attackCurve.slice(u),o[0]=c;break}this._sig.setValueCurveAtTime(o,t,r,e)}if(i&&this.sustain<1){const o=e*this.sustain,u=t+r;this.log("decay",u),this._decayCurve==="linear"?this._sig.linearRampToValueAtTime(o,i+u):this._sig.exponentialApproachValueAtTime(o,u,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):(Z(Xt(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 Tn(this,t,e,s),this}asArray(t=1024){return vt(this,void 0,void 0,function*(){const e=t/this.context.sampleRate,s=new wn(1,e,this.context.sampleRate),r=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=r+this.toSeconds(this.release),c=i*.1,o=i+c,u=new this.constructor(Object.assign(this.get(),{attack:e*this.toSeconds(this.attack)/o,decay:e*this.toSeconds(this.decay)/o,release:e*this.toSeconds(this.release)/o,context:s}));return u._sig.toDestination(),u.triggerAttackRelease(e*(r+c)/o,0),(yield s.render()).getChannelData(0)})}dispose(){return super.dispose(),this._sig.dispose(),this}};ne([Ee(0)],De.prototype,"attack",void 0),ne([Ee(0)],De.prototype,"decay",void 0),ne([wa(0,1)],De.prototype,"sustain",void 0),ne([Ee(0)],De.prototype,"release",void 0);const In=(()=>{let t,e;const s=[];for(t=0;t<128;t++)s[t]=Math.sin(t/127*(Math.PI/2));const r=[],i=6.4;for(t=0;t<127;t++){e=t/127;const d=Math.sin(e*(Math.PI*2)*i-Math.PI/2)+1;r[t]=d/10+e*.83}r[127]=1;const c=[],o=5;for(t=0;t<128;t++)c[t]=Math.ceil(t/127*o)/o;const u=[];for(t=0;t<128;t++)e=t/127,u[t]=.5*(1-Math.cos(Math.PI*e));const a=[];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);a[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 h(d){return d.slice(0).reverse()}return{bounce:{In:l(a),Out:a},cosine:{In:s,Out:h(s)},exponential:"exponential",linear:"linear",ripple:{In:r,Out:l(r)},sine:{In:u,Out:l(u)},step:{In:c,Out:l(c)}}})();class Xe extends ${constructor(){super(I(Xe.getDefaults(),arguments)),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease;const t=I(Xe.getDefaults(),arguments);this._volume=this.output=new Rs({context:this.context,volume:t.volume}),this.volume=this._volume.volume,rt(this,"volume")}static getDefaults(){return Object.assign($.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0)),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]=(...r)=>{const i=r[e],c=this.context.transport.schedule(o=>{r[e]=o,s.apply(this,r)},i);this._scheduledEvents.push(c)}}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}triggerAttackRelease(t,e,s,r){const i=this.toSeconds(s),c=this.toSeconds(e);return this.triggerAttack(t,i,r),this.triggerRelease(i+c),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class Ze extends Xe{constructor(){super(I(Ze.getDefaults(),arguments));const t=I(Ze.getDefaults(),arguments);this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(Xe.getDefaults(),{detune:0,onsilence:et,portamento:0})}triggerAttack(t,e,s=1){this.log("triggerAttack",t,e,s);const r=this.toSeconds(e);return this._triggerEnvelopeAttack(r,s),this.setNote(t,r),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),r=t instanceof Yt?t.toFrequency():t;if(this.portamento>0&&this.getLevelAtTime(s)>.05){const i=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(r,i,s)}else this.frequency.setValueAtTime(r,s);return this}}ne([Ee(0)],Ze.prototype,"portamento",void 0);class Rn extends De{constructor(){super(I(Rn.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new st({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}dispose(){return super.dispose(),this._gainNode.dispose(),this}}class Gs extends Ze{constructor(){super(I(Gs.getDefaults(),arguments)),this.name="Synth";const t=I(Gs.getDefaults(),arguments);this.oscillator=new js(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 Rn(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),rt(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(Ze.getDefaults(),{envelope:Object.assign(ha(De.getDefaults(),Object.keys($.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(ha(js.getDefaults(),[...Object.keys(Mt.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),r=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+s+r)}}_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}}class $s extends ${constructor(){super(I($s.getDefaults(),arguments,["frequency","type"])),this.name="BiquadFilter";const t=I($s.getDefaults(),arguments,["frequency","type"]);this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new K({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new K({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new K({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new K({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign($.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){Z(["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 c=0;c<t;c++){const u=Math.pow(c/t,2)*19980+20;e[c]=u}const s=new Float32Array(t),r=new Float32Array(t),i=this.context.createBiquadFilter();return i.type=this.type,i.Q.value=this.Q.value,i.frequency.value=this.frequency.value,i.gain.value=this.gain.value,i.getFrequencyResponse(e,s,r),s}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}let yp=class Yi extends ${constructor(){super(I(Yi.getDefaults(),arguments,["frequency","type","rolloff"])),this.name="Filter",this.input=new st({context:this.context}),this.output=new st({context:this.context}),this._filters=[];const t=I(Yi.getDefaults(),arguments,["frequency","type","rolloff"]);this._filters=[],this.Q=new ot({context:this.context,units:"positive",value:t.Q}),this.frequency=new ot({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ot({context:this.context,units:"cents",value:t.detune}),this.gain=new ot({context:this.context,units:"decibels",convert:!1,value:t.gain}),this._type=t.type,this.rolloff=t.rolloff,rt(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign($.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){Z(["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t)!==-1,`Invalid filter type: ${t}`),this._type=t,this._filters.forEach(s=>s.type=t)}get rolloff(){return this._rolloff}set rolloff(t){const e=he(t)?t:parseInt(t,10),s=[-12,-24,-48,-96];let r=s.indexOf(e);Z(r!==-1,`rolloff can only be ${s.join(", ")}`),r+=1,this._rolloff=e,this.input.disconnect(),this._filters.forEach(i=>i.disconnect()),this._filters=new Array(r);for(let i=0;i<r;i++){const c=new $s({context:this.context});c.type=this._type,this.frequency.connect(c.frequency),this.detune.connect(c.detune),this.Q.connect(c.Q),this.gain.connect(c.gain),this._filters[i]=c}this._internalChannels=this._filters,ps(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new $s({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,c)=>s[c]*=i)}),e.dispose(),s}dispose(){return super.dispose(),this._filters.forEach(t=>{t.dispose()}),Fr(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}};class Pn extends De{constructor(){super(I(Pn.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="FrequencyEnvelope";const t=I(Pn.getDefaults(),arguments,["attack","decay","sustain","release"]);this._octaves=t.octaves,this._baseFrequency=this.toFrequency(t.baseFrequency),this._exponent=this.input=new Mn({context:this.context,value:t.exponent}),this._scale=this.output=new Hs({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(De.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);se(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}}class Xs extends Gs{constructor(){super(I(Xs.getDefaults(),arguments)),this.name="MembraneSynth",this.portamento=0;const t=I(Xs.getDefaults(),arguments);this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,rt(this,["oscillator","envelope"])}static getDefaults(){return ls(Ze.getDefaults(),Gs.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),r=this.toFrequency(t instanceof Yt?t.toFrequency():t),i=r*this.octaves;return this.oscillator.frequency.setValueAtTime(i,s),this.oscillator.frequency.exponentialRampToValueAtTime(r,s+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}ne([wa(0)],Xs.prototype,"octaves",void 0),ne([Ee(0)],Xs.prototype,"pitchDecay",void 0);const Rr=new Set;function Pr(n){Rr.add(n)}function Ea(n,t){const e=`registerProcessor("${n}", ${t})`;Rr.add(e)}function Cp(){return Array.from(Rr).join(`
24
+ `)}class Da extends ${constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=et;const e=URL.createObjectURL(new Blob([Cp()],{type:"text/javascript"})),s=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(e,s).then(()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(s,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}}Pr(`
25
+ /**
26
+ * The base AudioWorkletProcessor for use in Tone.js. Works with the [[ToneAudioWorklet]].
27
+ */
28
+ class ToneAudioWorkletProcessor extends AudioWorkletProcessor {
29
+
30
+ constructor(options) {
31
+
32
+ super(options);
33
+ /**
34
+ * If the processor was disposed or not. Keep alive until it's disposed.
35
+ */
36
+ this.disposed = false;
37
+ /**
38
+ * The number of samples in the processing block
39
+ */
40
+ this.blockSize = 128;
41
+ /**
42
+ * the sample rate
43
+ */
44
+ this.sampleRate = sampleRate;
45
+
46
+ this.port.onmessage = (event) => {
47
+ // when it receives a dispose
48
+ if (event.data === "dispose") {
49
+ this.disposed = true;
50
+ }
51
+ };
52
+ }
53
+ }
54
+ `),Pr(`
55
+ /**
56
+ * Abstract class for a single input/output processor.
57
+ * has a 'generate' function which processes one sample at a time
58
+ */
59
+ class SingleIOProcessor extends ToneAudioWorkletProcessor {
60
+
61
+ constructor(options) {
62
+ super(Object.assign(options, {
63
+ numberOfInputs: 1,
64
+ numberOfOutputs: 1
65
+ }));
66
+ /**
67
+ * Holds the name of the parameter and a single value of that
68
+ * parameter at the current sample
69
+ * @type { [name: string]: number }
70
+ */
71
+ this.params = {}
72
+ }
73
+
74
+ /**
75
+ * Generate an output sample from the input sample and parameters
76
+ * @abstract
77
+ * @param input number
78
+ * @param channel number
79
+ * @param parameters { [name: string]: number }
80
+ * @returns number
81
+ */
82
+ generate(){}
83
+
84
+ /**
85
+ * Update the private params object with the
86
+ * values of the parameters at the given index
87
+ * @param parameters { [name: string]: Float32Array },
88
+ * @param index number
89
+ */
90
+ updateParams(parameters, index) {
91
+ for (const paramName in parameters) {
92
+ const param = parameters[paramName];
93
+ if (param.length > 1) {
94
+ this.params[paramName] = parameters[paramName][index];
95
+ } else {
96
+ this.params[paramName] = parameters[paramName][0];
97
+ }
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Process a single frame of the audio
103
+ * @param inputs Float32Array[][]
104
+ * @param outputs Float32Array[][]
105
+ */
106
+ process(inputs, outputs, parameters) {
107
+ const input = inputs[0];
108
+ const output = outputs[0];
109
+ // get the parameter values
110
+ const channelCount = Math.max(input && input.length || 0, output.length);
111
+ for (let sample = 0; sample < this.blockSize; sample++) {
112
+ this.updateParams(parameters, sample);
113
+ for (let channel = 0; channel < channelCount; channel++) {
114
+ const inputSample = input && input.length ? input[channel][sample] : 0;
115
+ output[channel][sample] = this.generate(inputSample, channel, this.params);
116
+ }
117
+ }
118
+ return !this.disposed;
119
+ }
120
+ };
121
+ `),Pr(`
122
+ /**
123
+ * A multichannel buffer for use within an AudioWorkletProcessor as a delay line
124
+ */
125
+ class DelayLine {
126
+
127
+ constructor(size, channels) {
128
+ this.buffer = [];
129
+ this.writeHead = []
130
+ this.size = size;
131
+
132
+ // create the empty channels
133
+ for (let i = 0; i < channels; i++) {
134
+ this.buffer[i] = new Float32Array(this.size);
135
+ this.writeHead[i] = 0;
136
+ }
137
+ }
138
+
139
+ /**
140
+ * Push a value onto the end
141
+ * @param channel number
142
+ * @param value number
143
+ */
144
+ push(channel, value) {
145
+ this.writeHead[channel] += 1;
146
+ if (this.writeHead[channel] > this.size) {
147
+ this.writeHead[channel] = 0;
148
+ }
149
+ this.buffer[channel][this.writeHead[channel]] = value;
150
+ }
151
+
152
+ /**
153
+ * Get the recorded value of the channel given the delay
154
+ * @param channel number
155
+ * @param delay number delay samples
156
+ */
157
+ get(channel, delay) {
158
+ let readHead = this.writeHead[channel] - Math.floor(delay);
159
+ if (readHead < 0) {
160
+ readHead += this.size;
161
+ }
162
+ return this.buffer[channel][readHead];
163
+ }
164
+ }
165
+ `),Ea("feedback-comb-filter",`
166
+ class FeedbackCombFilterWorklet extends SingleIOProcessor {
167
+
168
+ constructor(options) {
169
+ super(options);
170
+ this.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);
171
+ }
172
+
173
+ static get parameterDescriptors() {
174
+ return [{
175
+ name: "delayTime",
176
+ defaultValue: 0.1,
177
+ minValue: 0,
178
+ maxValue: 1,
179
+ automationRate: "k-rate"
180
+ }, {
181
+ name: "feedback",
182
+ defaultValue: 0.5,
183
+ minValue: 0,
184
+ maxValue: 0.9999,
185
+ automationRate: "k-rate"
186
+ }];
187
+ }
188
+
189
+ generate(input, channel, parameters) {
190
+ const delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);
191
+ this.delayLine.push(channel, input + delayedSample * parameters.feedback);
192
+ return delayedSample;
193
+ }
194
+ }
195
+ `);class Zs extends Xe{constructor(){super(I(Zs.getDefaults(),arguments,["urls","onload","baseUrl"],"urls")),this.name="Sampler",this._activeSources=new Map;const t=I(Zs.getDefaults(),arguments,["urls","onload","baseUrl"],"urls"),e={};Object.keys(t.urls).forEach(s=>{const r=parseInt(s,10);if(Z(vn(s)||he(r)&&isFinite(r),`url key is neither a note or midi pitch: ${s}`),vn(s)){const i=new Yt(this.context,s).toMidi();e[i]=t.urls[s]}else he(r)&&isFinite(r)&&(e[r]=t.urls[r])}),this._buffers=new Nr({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(Xe.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:et,onerror:et,release:.1,urls:{}})}_findClosest(t){let s=0;for(;s<96;){if(this._buffers.has(t+s))return-s;if(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(r=>{const i=va(new Yt(this.context,r).toFrequency()),c=Math.round(i),o=i-c,u=this._findClosest(c),a=c-u,l=this._buffers.get(a),h=ga(u+o),d=new xs({url:l,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:h}).connect(this.output);d.start(e,0,l.duration/h,s),Xt(this._activeSources.get(c))||this._activeSources.set(c,[]),this._activeSources.get(c).push(d),d.onended=()=>{if(this._activeSources&&this._activeSources.has(c)){const f=this._activeSources.get(c),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 r=new Yt(this.context,s).toMidi();if(this._activeSources.has(r)&&this._activeSources.get(r).length){const i=this._activeSources.get(r);e=this.toSeconds(e),i.forEach(c=>{c.stop(e)}),this._activeSources.set(r,[])}}),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,r=1){const i=this.toSeconds(s);return this.triggerAttack(t,i,r),Xt(e)?(Z(Xt(t),"notes must be an array when duration is array"),t.forEach((c,o)=>{const u=e[Math.min(o,e.length-1)];this.triggerRelease(c,i+this.toSeconds(u))})):this.triggerRelease(t,i+this.toSeconds(e)),this}add(t,e,s){if(Z(vn(t)||isFinite(t),`note must be a pitch or midi: ${t}`),vn(t)){const r=new Yt(this.context,t).toMidi();this._buffers.add(r,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}}ne([Ee(0)],Zs.prototype,"attack",void 0),ne([Ee(0)],Zs.prototype,"release",void 0);class Ye extends kt{constructor(){super(I(Ye.getDefaults(),arguments,["callback","value"])),this.name="ToneEvent",this._state=new Ms("stopped"),this._startOffset=0;const t=I(Ye.getDefaults(),arguments,["callback","value"]);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(kt.getDefaults(),{callback:et,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 r=e.time+Math.round(this.startOffset/this._playbackRate);if(this._loop===!0||he(this._loop)&&this._loop>1){s=1/0,he(this._loop)&&(s=this._loop*this._getLoopDuration());const i=this._state.getAfter(r);i!==null&&(s=Math.min(s,i.time-r)),s!==1/0&&(this._state.setStateAtTime("stopped",r+s+1,{id:-1}),s=new _t(this.context,s));const c=new _t(this.context,this._getLoopDuration());e.id=this.context.transport.scheduleRepeat(this._tick.bind(this),c,new _t(this.context,r),s)}else e.id=this.context.transport.schedule(this._tick.bind(this),new _t(this.context,r))}})}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 r=e;s!==null&&(r=s.time),this._rescheduleEvents(r)}return this}cancel(t){t=pe(t,-1/0);const 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;ua(this.humanize)||(s=this.toSeconds(this.humanize)),t+=(Math.random()*2-1)*s}this.callback(t,this.value)}}_getLoopDuration(){return Math.round((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 _t(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}get loopStart(){return new _t(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}}class Ys extends Ye{constructor(){super(I(Ys.getDefaults(),arguments,["callback","events"])),this.name="Part",this._state=new Ms("stopped"),this._events=new Set;const t=I(Ys.getDefaults(),arguments,["callback","events"]);this._state.increasing=!0,t.events.forEach(e=>{Xt(e)?this.add(e[0],e[1]):this.add(e)})}static getDefaults(){return Object.assign(Ye.getDefaults(),{events:[]})}start(t,e){const s=this.toTicks(t);if(this._state.getValueAtTime(s)!=="started"){e=pe(e,this._loop?this._loopStart:0),this._loop?e=pe(e,this._loopStart):e=pe(e,0);const r=this.toTicks(e);this._state.add({id:-1,offset:r,state:"started",time:s}),this._forEach(i=>{this._startNote(i,s,r)})}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 _t(this.context,e))):t.startOffset<this._loopStart&&t.startOffset>=s&&(t.loop=!1,t.start(new _t(this.context,e))):t.startOffset>=s&&t.start(new _t(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 ds(this.context,t).toTicks(),r=new _t(this.context,1).toSeconds(),i=this._events.values();let c=i.next();for(;!c.done;){const o=c.value;if(Math.abs(s-o.startOffset)<r)return Y(e)&&(o.value=e),o;c=i.next()}return Y(e)?(this.add(t,e),this.at(t)):null}add(t,e){t instanceof Object&&Reflect.has(t,"time")&&(e=t,t=e.time);const s=this.toTicks(t);let r;return e instanceof Ye?(r=e,r.callback=this._tick.bind(this)):r=new Ye({callback:this._tick.bind(this),context:this.context,value:e}),r.startOffset=s,r.set({humanize:this.humanize,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,playbackRate:this.playbackRate,probability:this.probability}),this._events.add(r),this._restartEvent(r),this}_restartEvent(t){this._state.forEach(e=>{e.state==="started"?this._startNote(t,e.time,e.offset):t.stop(new _t(this.context,e.time))})}remove(t,e){return Ne(t)&&t.hasOwnProperty("time")&&(e=t,t=e.time),t=this.toTicks(t),this._events.forEach(s=>{s.startOffset===t&&(jt(e)||Y(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 Ys?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 _t(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 _t(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}}class qn extends ${constructor(){super(Object.assign(I(qn.getDefaults(),arguments,["fade"]))),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new vp({context:this.context}),this.a=new st({context:this.context,gain:0}),this.b=new st({context:this.context,gain:0}),this.output=new st({context:this.context}),this._internalChannels=[this.a,this.b];const t=I(qn.getDefaults(),arguments,["fade"]);this.fade=new ot({context:this.context,units:"normalRange",value:t.fade}),rt(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",be(this._split,this.a.gain,0),be(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($.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}}let Re=class extends ${constructor(t){super(t),this.name="Effect",this._dryWet=new qn({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new st({context:this.context}),this.effectReturn=new st({context:this.context}),this.input=new st({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(t.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],rt(this,"wet")}static getDefaults(){return Object.assign($.getDefaults(),{wet:1})}connectEffect(t){return this._internalChannels.push(t),this.effectSend.chain(t,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}};class Vn extends ${constructor(){super(Object.assign(I(Vn.getDefaults(),arguments,["pan"]))),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner;const t=I(Vn.getDefaults(),arguments,["pan"]);this.pan=new K({context:this.context,param:this._panner.pan,value:t.pan,minValue:-1,maxValue:1}),this._panner.channelCount=t.channelCount,this._panner.channelCountMode="explicit",rt(this,"pan")}static getDefaults(){return Object.assign($.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}}const Ta="bit-crusher";Ea(Ta,`
196
+ class BitCrusherWorklet extends SingleIOProcessor {
197
+
198
+ static get parameterDescriptors() {
199
+ return [{
200
+ name: "bits",
201
+ defaultValue: 12,
202
+ minValue: 1,
203
+ maxValue: 16,
204
+ automationRate: 'k-rate'
205
+ }];
206
+ }
207
+
208
+ generate(input, _channel, parameters) {
209
+ const step = Math.pow(0.5, parameters.bits - 1);
210
+ const val = step * Math.floor(input / step + 0.5);
211
+ return val;
212
+ }
213
+ }
214
+ `);let Ap=class Qi extends Re{constructor(){super(I(Qi.getDefaults(),arguments,["bits"])),this.name="BitCrusher";const t=I(Qi.getDefaults(),arguments,["bits"]);this._bitCrusherWorklet=new Wn({context:this.context,bits:t.bits}),this.connectEffect(this._bitCrusherWorklet),this.bits=this._bitCrusherWorklet.bits}static getDefaults(){return Object.assign(Re.getDefaults(),{bits:4})}dispose(){return super.dispose(),this._bitCrusherWorklet.dispose(),this}};class Wn extends Da{constructor(){super(I(Wn.getDefaults(),arguments)),this.name="BitCrusherWorklet";const t=I(Wn.getDefaults(),arguments);this.input=new st({context:this.context}),this.output=new st({context:this.context}),this.bits=new K({context:this.context,value:t.bits,units:"positive",minValue:1,maxValue:16,param:this._dummyParam,swappable:!0})}static getDefaults(){return Object.assign(Da.getDefaults(),{bits:12})}_audioWorkletName(){return Ta}onReady(t){ps(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}}class Ln extends ${constructor(){super(I(Ln.getDefaults(),arguments,["channels"])),this.name="Merge";const t=I(Ln.getDefaults(),arguments,["channels"]);this._merger=this.output=this.input=this.context.createChannelMerger(t.channels)}static getDefaults(){return Object.assign($.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}}let bp=class Ki extends Re{constructor(){super(I(Ki.getDefaults(),arguments,["distortion"])),this.name="Distortion";const t=I(Ki.getDefaults(),arguments,["distortion"]);this._shaper=new Ie({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(Re.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(r=>Math.abs(r)<.001?0:(3+e)*r*20*s/(Math.PI+e*Math.abs(r)))}get oversample(){return this._shaper.oversample}set oversample(t){this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.dispose(),this}};class ka extends Re{constructor(t){super(t),this.name="FeedbackEffect",this._feedbackGain=new st({context:this.context,gain:t.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,rt(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(Re.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}}class zn extends ka{constructor(){super(I(zn.getDefaults(),arguments,["delayTime","feedback"])),this.name="FeedbackDelay";const t=I(zn.getDefaults(),arguments,["delayTime","feedback"]);this._delayNode=new pp({context:this.context,delayTime:t.delayTime,maxDelay:t.maxDelay}),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),rt(this,"delayTime")}static getDefaults(){return Object.assign(ka.getDefaults(),{delayTime:.25,maxDelay:1})}dispose(){return super.dispose(),this._delayNode.dispose(),this.delayTime.dispose(),this}}let wp=class Ji extends Re{constructor(){super(I(Ji.getDefaults(),arguments,["decay"])),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve();const t=I(Ji.getDefaults(),arguments,["decay"]);this._decay=t.decay,this._preDelay=t.preDelay,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(Re.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(t){t=this.toSeconds(t),se(t,.001),this._decay=t,this.generate()}get preDelay(){return this._preDelay}set preDelay(t){t=this.toSeconds(t),se(t,0),this._preDelay=t,this.generate()}generate(){return vt(this,void 0,void 0,function*(){const t=this.ready,e=new wn(2,this._decay+this._preDelay,this.context.sampleRate),s=new qs({context:e}),r=new qs({context:e}),i=new Ln({context:e});s.connect(i,0,0),r.connect(i,0,1);const c=new st({context:e}).toDestination();i.connect(c),s.start(0),r.start(0),c.gain.setValueAtTime(0,0),c.gain.setValueAtTime(1,this._preDelay),c.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const o=e.render();return this.ready=o.then(et),yield t,this._convolver.buffer=(yield o).get(),this})}dispose(){return super.dispose(),this._convolver.disconnect(),this}};class yt extends ${constructor(){super(I(yt.getDefaults(),arguments,["solo"])),this.name="Solo";const t=I(yt.getDefaults(),arguments,["solo"]);this.input=this.output=new st({context:this.context}),yt._allSolos.has(this.context)||yt._allSolos.set(this.context,new Set),yt._allSolos.get(this.context).add(this),this.solo=t.solo}static getDefaults(){return Object.assign($.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(t){t?this._addSolo():this._removeSolo(),yt._allSolos.get(this.context).forEach(e=>e._updateSolo())}get muted(){return this.input.gain.value===0}_addSolo(){yt._soloed.has(this.context)||yt._soloed.set(this.context,new Set),yt._soloed.get(this.context).add(this)}_removeSolo(){yt._soloed.has(this.context)&&yt._soloed.get(this.context).delete(this)}_isSoloed(){return yt._soloed.has(this.context)&&yt._soloed.get(this.context).has(this)}_noSolos(){return!yt._soloed.has(this.context)||yt._soloed.has(this.context)&&yt._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(),yt._allSolos.get(this.context).delete(this),this._removeSolo(),this}}yt._allSolos=new Map,yt._soloed=new Map;class jn extends ${constructor(){super(I(jn.getDefaults(),arguments,["pan","volume"])),this.name="PanVol";const t=I(jn.getDefaults(),arguments,["pan","volume"]);this._panner=this.input=new Vn({context:this.context,pan:t.pan,channelCount:t.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new Rs({context:this.context,volume:t.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,rt(this,["pan","volume"])}static getDefaults(){return Object.assign($.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class Qe extends ${constructor(){super(I(Qe.getDefaults(),arguments,["volume","pan"])),this.name="Channel";const t=I(Qe.getDefaults(),arguments,["volume","pan"]);this._solo=this.input=new yt({solo:t.solo,context:this.context}),this._panVol=this.output=new jn({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),rt(this,["pan","volume"])}static getDefaults(){return Object.assign($.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 Qe.buses.has(t)||Qe.buses.set(t,new st({context:this.context})),Qe.buses.get(t)}send(t,e=0){const s=this._getBus(t),r=new st({context:this.context,units:"decibels",gain:e});return this.connect(r),r.connect(s),r}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}}Qe.buses=new Map;class Ep extends ${constructor(){super(...arguments),this.name="Listener",this.positionX=new K({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new K({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new K({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new K({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new K({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new K({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new K({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new K({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new K({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign($.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.dispose(),this.upZ.dispose(),this}}An(n=>{n.listener=new Ep({context:n})}),bn(n=>{n.listener.dispose()});function gs(){return Wt().now()}Wt().transport,Wt().destination,Wt().destination;function Dp(){return Wt().destination}Wt().listener,Wt().draw,Wt();const Tp={C0:16.35,"C#0":17.32,Db0:17.32,D0:18.35,"D#0":19.45,Eb0:19.45,E0:20.6,F0:21.83,"F#0":23.12,Gb0:23.12,G0:24.5,"G#0":25.96,Ab0:25.96,A0:27.5,"A#0":29.14,Bb0:29.14,B0:30.87,C1:32.7,"C#1":34.65,Db1:34.65,D1:36.71,"D#1":38.89,Eb1:38.89,E1:41.2,F1:43.65,"F#1":46.25,Gb1:46.25,G1:49,"G#1":51.91,Ab1:51.91,A1:55,"A#1":58.27,Bb1:58.27,B1:61.74,C2:65.41,"C#2":69.3,Db2:69.3,D2:73.42,"D#2":77.78,Eb2:77.78,E2:82.41,F2:87.31,"F#2":92.5,Gb2:92.5,G2:98,"G#2":103.83,Ab2:103.83,A2:110,"A#2":116.54,Bb2:116.54,B2:123.47,C3:130.81,"C#3":138.59,Db3:138.59,D3:146.83,"D#3":155.56,Eb3:155.56,E3:164.81,F3:174.61,"F#3":185,Gb3:185,G3:196,"G#3":207.65,Ab3:207.65,A3:220,"A#3":233.08,Bb3:233.08,B3:246.94,C4:261.63,"C#4":277.18,Db4:277.18,D4:293.66,"D#4":311.13,Eb4:311.13,E4:329.63,F4:349.23,"F#4":369.99,Gb4:369.99,G4:392,"G#4":415.3,Ab4:415.3,A4:440,"A#4":466.16,Bb4:466.16,B4:493.88,C5:523.25,"C#5":554.37,Db5:554.37,D5:587.33,"D#5":622.25,Eb5:622.25,E5:659.26,F5:698.46,"F#5":739.99,Gb5:739.99,G5:783.99,"G#5":830.61,Ab5:830.61,A5:880,"A#5":932.33,Bb5:932.33,B5:987.77,C6:1046.5,"C#6":1108.73,Db6:1108.73,D6:1174.66,"D#6":1244.51,Eb6:1244.51,E6:1318.51,F6:1396.91,"F#6":1479.98,Gb6:1479.98,G6:1567.98,"G#6":1661.22,Ab6:1661.22,A6:1760,"A#6":1864.66,Bb6:1864.66,B6:1975.53,C7:2093,"C#7":2217.46,Db7:2217.46,D7:2349.32,"D#7":2489.02,Eb7:2489.02,E7:2637.02,F7:2793.83,"F#7":2959.96,Gb7:2959.96,G7:3135.96,"G#7":3322.44,Ab7:3322.44,A7:3520,"A#7":3729.31,Bb7:3729.31,B7:3951.07,C8:4186.01,"C#8":4434.92,Db8:4434.92,D8:4698.64,"D#8":4978.03,Eb8:4978.03},vs=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],qr=vs.length,kp=2,Qn=class Qn{constructor(t){M(this,"name");M(this,"octave");M(this,"velocity",1);M(this,"duration");M(this,"frequency");typeof t=="number"?this.fromFrequency(t):typeof t=="string"?this.fromString(t):t instanceof MIDIMessageEvent?this.fromEvent(t):this.fromProps(t)}static notes(t=3){return vs.map(e=>new Qn(`${e}${t}`))}get isSemi(){return this.name.slice(-1)==="#"}get fullName(){return`${this.name}${this.octave}`}midiData(t=!0){const e=t?144:128;return new Uint8Array([e,0,this.velocity*100])}get midiNumber(){return(this.octave+kp)*12+this.noteIndex}get noteIndex(){return vs.indexOf(this.name)}adjustFrequency(t=0,e=0){if(this.frequency)return this.frequency;let s=this.octave+t;const r=vs.indexOf(this.name)+e;let i=r;r>=qr?(s++,i=r%qr):r<0&&(s--,i=qr+i);const c=vs[i];return Tp[`${c}${s}`]}valueOf(){return this.fullName}serialize(){return{note:this.fullName,frequency:this.frequency,velocity:this.velocity,duration:this.duration}}fromFrequency(t){this.frequency=t}fromString(t){const e=t.match(/(\w#?)(\d)?/)||[];this.name=e[1],this.octave=e[2]?parseInt(e[2]):1}fromEvent(t){this.name=vs[t.data[1]%12],this.octave=Math.floor(t.data[1]/12)-2}fromProps(t){if(Object.assign(this,t),!t.note)throw Error("note props is mandatory");this.fromString(t.note)}};M(Qn,"_notes");let dt=Qn;const Fp={128:"noteOff",144:"noteOn",176:"cc"};class ie{constructor(t,e){M(this,"note");M(this,"voiceNo");M(this,"triggeredAt");M(this,"_type");M(this,"data");M(this,"event");this.event=t,this.triggeredAt=e||gs(),this.data=t.data,this.defineNotes()}static fromSequence(t,e){return t.notes.map(s=>this.fromNote(s,!0,e))}static fromNote(t,e=!0,s){const r=t instanceof dt?t:new dt(t),i=new ie(new MIDIMessageEvent("",{data:r.midiData(e)}),s);return i.note=r,i}static fromCC(t,e,s){return new ie(new MIDIMessageEvent("",{data:new Uint8Array([176,t,e])}),s)}get statusByte(){return this.data[0]}get firstData(){return this.data[1]}get secondData(){return this.data[2]}get type(){if(this._type)return this._type;let t=Fp[this.statusByte&240];return t==="noteOn"&&this.secondData===0&&(t="noteOff"),this._type=t}get isNote(){return this.type==="noteOn"||this.type==="noteOff"}defineNotes(){this.isNote&&(this.note||(this.note=new dt(this.event)))}}class Vr{constructor(t){M(this,"id");M(this,"name");M(this,"state");M(this,"eventListerCallbacks",[]);M(this,"_midi");this.id=t.id,this.name=t.name||`Device ${t.id}`,this.state=t.state,this._midi=t,this.connect()}connect(){this._midi.onmidimessage=t=>{(t instanceof MIDIMessageEvent||t instanceof ie)&&this.processEvent(t)}}disconnect(){this._midi.onmidimessage=null}serialize(){const{id:t,name:e,state:s}=this;return{id:t,name:e,state:s}}addEventListener(t){this.eventListerCallbacks.push(t)}removeEventListener(t){this.eventListerCallbacks=this.eventListerCallbacks.filter(e=>e!==t)}processEvent(t){const e=t instanceof ie?t:new ie(t);switch(e.type){case"noteOn":case"noteOff":this.eventListerCallbacks.forEach(s=>s(e))}}}const Bp={a:new dt("C3"),s:new dt("D3"),d:new dt("E3"),f:new dt("F3"),g:new dt("G3"),h:new dt("A3"),j:new dt("B3"),k:new dt("C4"),l:new dt("D4"),w:new dt("C#3"),e:new dt("D#3"),t:new dt("F#3"),y:new dt("G#3"),u:new dt("A#3"),o:new dt("C#4"),p:new dt("D#4")},Sp={id:"computer_keyboard",name:"Computer Keyboard",state:"connected"};class Np{constructor(){M(this,"id");M(this,"name");M(this,"state");M(this,"onmidimessage");M(this,"onKeyTrigger",t=>e=>{if(!this.onmidimessage)return;const s=this.extractNote(e);if(!s)return;const r=ie.fromNote(s,t);this.onmidimessage(r)});Object.assign(this,Sp),document.addEventListener("keydown",this.onKeyTrigger(!0)),document.addEventListener("keyup",this.onKeyTrigger(!1))}extractNote(t){if(!t.repeat)return Bp[t.key]}}class Fa{constructor(){M(this,"devices",{});M(this,"initialized",!1);M(this,"computerKeyboardInput");this.computerKeyboardInput=new Np,this.initializeDevices().then(()=>{this.listenChanges(),this.initialized=!0}).catch(()=>{})}find(t){const e=this.devices[t];return e||null}onStateChange(t){navigator.requestMIDIAccess().then(e=>{e.onstatechange=s=>{if(!(s instanceof MIDIConnectionEvent)||s.port instanceof MIDIOutput)return;const i=s.port,c=new Vr(i);t(c)}}).catch(()=>{})}listenChanges(){this.onStateChange(t=>{t.state==="disconnected"?(t.disconnect(),delete this.devices[t.id]):this.devices[t.id]=t})}async initializeDevices(){return this.initialized?Object.values(this.devices):((await this.inputs()).forEach(t=>{this.devices[t.id]||(this.devices[t.id]=new Vr(t))}),Object.values(this.devices))}async inputs(){const t=[this.computerKeyboardInput];return(await navigator.requestMIDIAccess()).inputs.forEach(s=>t.push(s)),t}}var Hn,Op=new Uint8Array(16);function Mp(){if(!Hn&&(Hn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Hn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hn(Op)}const Ip=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Rp(n){return typeof n=="string"&&Ip.test(n)}for(var Dt=[],Wr=0;Wr<256;++Wr)Dt.push((Wr+256).toString(16).substr(1));function Pp(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(Dt[n[t+0]]+Dt[n[t+1]]+Dt[n[t+2]]+Dt[n[t+3]]+"-"+Dt[n[t+4]]+Dt[n[t+5]]+"-"+Dt[n[t+6]]+Dt[n[t+7]]+"-"+Dt[n[t+8]]+Dt[n[t+9]]+"-"+Dt[n[t+10]]+Dt[n[t+11]]+Dt[n[t+12]]+Dt[n[t+13]]+Dt[n[t+14]]+Dt[n[t+15]]).toLowerCase();if(!Rp(e))throw TypeError("Stringified UUID is invalid");return e}function Lr(n,t,e){n=n||{};var s=n.random||(n.rng||Mp)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Pp(s)}var Q=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qp(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Vp(n){if(n.__esModule)return n;var t=n.default;if(typeof t=="function"){var e=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(n).forEach(function(s){var r=Object.getOwnPropertyDescriptor(n,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:function(){return n[s]}})}),e}var Ba={exports:{}};function Wp(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var zr={exports:{}};const Lp=Vp(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Sa;function J(){return Sa||(Sa=1,function(n,t){(function(e,s){n.exports=s()})(Q,function(){var e=e||function(s,r){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof Q<"u"&&Q.crypto&&(i=Q.crypto),!i&&typeof Wp=="function")try{i=Lp}catch{}var c=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function _(){}return function(g){var C;return _.prototype=g,C=new _,_.prototype=null,C}}(),u={},a=u.lib={},l=a.Base=function(){return{extend:function(_){var g=o(this);return _&&g.mixIn(_),(!g.hasOwnProperty("init")||this.init===g.init)&&(g.init=function(){g.$super.init.apply(this,arguments)}),g.init.prototype=g,g.$super=this,g},create:function(){var _=this.extend();return _.init.apply(_,arguments),_},init:function(){},mixIn:function(_){for(var g in _)_.hasOwnProperty(g)&&(this[g]=_[g]);_.hasOwnProperty("toString")&&(this.toString=_.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),h=a.WordArray=l.extend({init:function(_,g){_=this.words=_||[],g!=r?this.sigBytes=g:this.sigBytes=_.length*4},toString:function(_){return(_||f).stringify(this)},concat:function(_){var g=this.words,C=_.words,y=this.sigBytes,A=_.sigBytes;if(this.clamp(),y%4)for(var w=0;w<A;w++){var b=C[w>>>2]>>>24-w%4*8&255;g[y+w>>>2]|=b<<24-(y+w)%4*8}else for(var k=0;k<A;k+=4)g[y+k>>>2]=C[k>>>2];return this.sigBytes+=A,this},clamp:function(){var _=this.words,g=this.sigBytes;_[g>>>2]&=4294967295<<32-g%4*8,_.length=s.ceil(g/4)},clone:function(){var _=l.clone.call(this);return _.words=this.words.slice(0),_},random:function(_){for(var g=[],C=0;C<_;C+=4)g.push(c());return new h.init(g,_)}}),d=u.enc={},f=d.Hex={stringify:function(_){for(var g=_.words,C=_.sigBytes,y=[],A=0;A<C;A++){var w=g[A>>>2]>>>24-A%4*8&255;y.push((w>>>4).toString(16)),y.push((w&15).toString(16))}return y.join("")},parse:function(_){for(var g=_.length,C=[],y=0;y<g;y+=2)C[y>>>3]|=parseInt(_.substr(y,2),16)<<24-y%8*4;return new h.init(C,g/2)}},p=d.Latin1={stringify:function(_){for(var g=_.words,C=_.sigBytes,y=[],A=0;A<C;A++){var w=g[A>>>2]>>>24-A%4*8&255;y.push(String.fromCharCode(w))}return y.join("")},parse:function(_){for(var g=_.length,C=[],y=0;y<g;y++)C[y>>>2]|=(_.charCodeAt(y)&255)<<24-y%4*8;return new h.init(C,g)}},m=d.Utf8={stringify:function(_){try{return decodeURIComponent(escape(p.stringify(_)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(_){return p.parse(unescape(encodeURIComponent(_)))}},x=a.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(_){typeof _=="string"&&(_=m.parse(_)),this._data.concat(_),this._nDataBytes+=_.sigBytes},_process:function(_){var g,C=this._data,y=C.words,A=C.sigBytes,w=this.blockSize,b=w*4,k=A/b;_?k=s.ceil(k):k=s.max((k|0)-this._minBufferSize,0);var E=k*w,D=s.min(E*4,A);if(E){for(var T=0;T<E;T+=w)this._doProcessBlock(y,T);g=y.splice(0,E),C.sigBytes-=D}return new h.init(g,D)},clone:function(){var _=l.clone.call(this);return _._data=this._data.clone(),_},_minBufferSize:0});a.Hasher=x.extend({cfg:l.extend(),init:function(_){this.cfg=this.cfg.extend(_),this.reset()},reset:function(){x.reset.call(this),this._doReset()},update:function(_){return this._append(_),this._process(),this},finalize:function(_){_&&this._append(_);var g=this._doFinalize();return g},blockSize:16,_createHelper:function(_){return function(g,C){return new _.init(C).finalize(g)}},_createHmacHelper:function(_){return function(g,C){return new v.HMAC.init(_,C).finalize(g)}}});var v=u.algo={};return u}(Math);return e})}(zr)),zr.exports}var jr={exports:{}},Na;function Un(){return Na||(Na=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){return function(s){var r=e,i=r.lib,c=i.Base,o=i.WordArray,u=r.x64={};u.Word=c.extend({init:function(a,l){this.high=a,this.low=l}}),u.WordArray=c.extend({init:function(a,l){a=this.words=a||[],l!=s?this.sigBytes=l:this.sigBytes=a.length*8},toX32:function(){for(var a=this.words,l=a.length,h=[],d=0;d<l;d++){var f=a[d];h.push(f.high),h.push(f.low)}return o.create(h,this.sigBytes)},clone:function(){for(var a=c.clone.call(this),l=a.words=this.words.slice(0),h=l.length,d=0;d<h;d++)l[d]=l[d].clone();return a}})}(),e})}(jr)),jr.exports}var Hr={exports:{}},Oa;function zp(){return Oa||(Oa=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){return function(){if(typeof ArrayBuffer=="function"){var s=e,r=s.lib,i=r.WordArray,c=i.init,o=i.init=function(u){if(u instanceof ArrayBuffer&&(u=new Uint8Array(u)),(u instanceof Int8Array||typeof Uint8ClampedArray<"u"&&u instanceof Uint8ClampedArray||u instanceof Int16Array||u instanceof Uint16Array||u instanceof Int32Array||u instanceof Uint32Array||u instanceof Float32Array||u instanceof Float64Array)&&(u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength)),u instanceof Uint8Array){for(var a=u.byteLength,l=[],h=0;h<a;h++)l[h>>>2]|=u[h]<<24-h%4*8;c.call(this,l,a)}else c.apply(this,arguments)};o.prototype=i}}(),e.lib.WordArray})}(Hr)),Hr.exports}var Ur={exports:{}},Ma;function jp(){return Ma||(Ma=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.WordArray,c=s.enc;c.Utf16=c.Utf16BE={stringify:function(u){for(var a=u.words,l=u.sigBytes,h=[],d=0;d<l;d+=2){var f=a[d>>>2]>>>16-d%4*8&65535;h.push(String.fromCharCode(f))}return h.join("")},parse:function(u){for(var a=u.length,l=[],h=0;h<a;h++)l[h>>>1]|=u.charCodeAt(h)<<16-h%2*16;return i.create(l,a*2)}},c.Utf16LE={stringify:function(u){for(var a=u.words,l=u.sigBytes,h=[],d=0;d<l;d+=2){var f=o(a[d>>>2]>>>16-d%4*8&65535);h.push(String.fromCharCode(f))}return h.join("")},parse:function(u){for(var a=u.length,l=[],h=0;h<a;h++)l[h>>>1]|=o(u.charCodeAt(h)<<16-h%2*16);return i.create(l,a*2)}};function o(u){return u<<8&4278255360|u>>>8&16711935}}(),e.enc.Utf16})}(Ur)),Ur.exports}var Gr={exports:{}},Ia;function Ke(){return Ia||(Ia=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.WordArray,c=s.enc;c.Base64={stringify:function(u){var a=u.words,l=u.sigBytes,h=this._map;u.clamp();for(var d=[],f=0;f<l;f+=3)for(var p=a[f>>>2]>>>24-f%4*8&255,m=a[f+1>>>2]>>>24-(f+1)%4*8&255,x=a[f+2>>>2]>>>24-(f+2)%4*8&255,v=p<<16|m<<8|x,_=0;_<4&&f+_*.75<l;_++)d.push(h.charAt(v>>>6*(3-_)&63));var g=h.charAt(64);if(g)for(;d.length%4;)d.push(g);return d.join("")},parse:function(u){var a=u.length,l=this._map,h=this._reverseMap;if(!h){h=this._reverseMap=[];for(var d=0;d<l.length;d++)h[l.charCodeAt(d)]=d}var f=l.charAt(64);if(f){var p=u.indexOf(f);p!==-1&&(a=p)}return o(u,a,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(u,a,l){for(var h=[],d=0,f=0;f<a;f++)if(f%4){var p=l[u.charCodeAt(f-1)]<<f%4*2,m=l[u.charCodeAt(f)]>>>6-f%4*2,x=p|m;h[d>>>2]|=x<<24-d%4*8,d++}return i.create(h,d)}}(),e.enc.Base64})}(Gr)),Gr.exports}var $r={exports:{}},Ra;function Hp(){return Ra||(Ra=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.WordArray,c=s.enc;c.Base64url={stringify:function(u,a){a===void 0&&(a=!0);var l=u.words,h=u.sigBytes,d=a?this._safe_map:this._map;u.clamp();for(var f=[],p=0;p<h;p+=3)for(var m=l[p>>>2]>>>24-p%4*8&255,x=l[p+1>>>2]>>>24-(p+1)%4*8&255,v=l[p+2>>>2]>>>24-(p+2)%4*8&255,_=m<<16|x<<8|v,g=0;g<4&&p+g*.75<h;g++)f.push(d.charAt(_>>>6*(3-g)&63));var C=d.charAt(64);if(C)for(;f.length%4;)f.push(C);return f.join("")},parse:function(u,a){a===void 0&&(a=!0);var l=u.length,h=a?this._safe_map:this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var f=0;f<h.length;f++)d[h.charCodeAt(f)]=f}var p=h.charAt(64);if(p){var m=u.indexOf(p);m!==-1&&(l=m)}return o(u,l,d)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function o(u,a,l){for(var h=[],d=0,f=0;f<a;f++)if(f%4){var p=l[u.charCodeAt(f-1)]<<f%4*2,m=l[u.charCodeAt(f)]>>>6-f%4*2,x=p|m;h[d>>>2]|=x<<24-d%4*8,d++}return i.create(h,d)}}(),e.enc.Base64url})}($r)),$r.exports}var Xr={exports:{}},Pa;function Je(){return Pa||(Pa=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){return function(s){var r=e,i=r.lib,c=i.WordArray,o=i.Hasher,u=r.algo,a=[];(function(){for(var m=0;m<64;m++)a[m]=s.abs(s.sin(m+1))*4294967296|0})();var l=u.MD5=o.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,x){for(var v=0;v<16;v++){var _=x+v,g=m[_];m[_]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var C=this._hash.words,y=m[x+0],A=m[x+1],w=m[x+2],b=m[x+3],k=m[x+4],E=m[x+5],D=m[x+6],T=m[x+7],F=m[x+8],N=m[x+9],P=m[x+10],q=m[x+11],W=m[x+12],H=m[x+13],L=m[x+14],j=m[x+15],B=C[0],S=C[1],R=C[2],O=C[3];B=h(B,S,R,O,y,7,a[0]),O=h(O,B,S,R,A,12,a[1]),R=h(R,O,B,S,w,17,a[2]),S=h(S,R,O,B,b,22,a[3]),B=h(B,S,R,O,k,7,a[4]),O=h(O,B,S,R,E,12,a[5]),R=h(R,O,B,S,D,17,a[6]),S=h(S,R,O,B,T,22,a[7]),B=h(B,S,R,O,F,7,a[8]),O=h(O,B,S,R,N,12,a[9]),R=h(R,O,B,S,P,17,a[10]),S=h(S,R,O,B,q,22,a[11]),B=h(B,S,R,O,W,7,a[12]),O=h(O,B,S,R,H,12,a[13]),R=h(R,O,B,S,L,17,a[14]),S=h(S,R,O,B,j,22,a[15]),B=d(B,S,R,O,A,5,a[16]),O=d(O,B,S,R,D,9,a[17]),R=d(R,O,B,S,q,14,a[18]),S=d(S,R,O,B,y,20,a[19]),B=d(B,S,R,O,E,5,a[20]),O=d(O,B,S,R,P,9,a[21]),R=d(R,O,B,S,j,14,a[22]),S=d(S,R,O,B,k,20,a[23]),B=d(B,S,R,O,N,5,a[24]),O=d(O,B,S,R,L,9,a[25]),R=d(R,O,B,S,b,14,a[26]),S=d(S,R,O,B,F,20,a[27]),B=d(B,S,R,O,H,5,a[28]),O=d(O,B,S,R,w,9,a[29]),R=d(R,O,B,S,T,14,a[30]),S=d(S,R,O,B,W,20,a[31]),B=f(B,S,R,O,E,4,a[32]),O=f(O,B,S,R,F,11,a[33]),R=f(R,O,B,S,q,16,a[34]),S=f(S,R,O,B,L,23,a[35]),B=f(B,S,R,O,A,4,a[36]),O=f(O,B,S,R,k,11,a[37]),R=f(R,O,B,S,T,16,a[38]),S=f(S,R,O,B,P,23,a[39]),B=f(B,S,R,O,H,4,a[40]),O=f(O,B,S,R,y,11,a[41]),R=f(R,O,B,S,b,16,a[42]),S=f(S,R,O,B,D,23,a[43]),B=f(B,S,R,O,N,4,a[44]),O=f(O,B,S,R,W,11,a[45]),R=f(R,O,B,S,j,16,a[46]),S=f(S,R,O,B,w,23,a[47]),B=p(B,S,R,O,y,6,a[48]),O=p(O,B,S,R,T,10,a[49]),R=p(R,O,B,S,L,15,a[50]),S=p(S,R,O,B,E,21,a[51]),B=p(B,S,R,O,W,6,a[52]),O=p(O,B,S,R,b,10,a[53]),R=p(R,O,B,S,P,15,a[54]),S=p(S,R,O,B,A,21,a[55]),B=p(B,S,R,O,F,6,a[56]),O=p(O,B,S,R,j,10,a[57]),R=p(R,O,B,S,D,15,a[58]),S=p(S,R,O,B,H,21,a[59]),B=p(B,S,R,O,k,6,a[60]),O=p(O,B,S,R,q,10,a[61]),R=p(R,O,B,S,w,15,a[62]),S=p(S,R,O,B,N,21,a[63]),C[0]=C[0]+B|0,C[1]=C[1]+S|0,C[2]=C[2]+R|0,C[3]=C[3]+O|0},_doFinalize:function(){var m=this._data,x=m.words,v=this._nDataBytes*8,_=m.sigBytes*8;x[_>>>5]|=128<<24-_%32;var g=s.floor(v/4294967296),C=v;x[(_+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,x[(_+64>>>9<<4)+14]=(C<<8|C>>>24)&16711935|(C<<24|C>>>8)&4278255360,m.sigBytes=(x.length+1)*4,this._process();for(var y=this._hash,A=y.words,w=0;w<4;w++){var b=A[w];A[w]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}return y},clone:function(){var m=o.clone.call(this);return m._hash=this._hash.clone(),m}});function h(m,x,v,_,g,C,y){var A=m+(x&v|~x&_)+g+y;return(A<<C|A>>>32-C)+x}function d(m,x,v,_,g,C,y){var A=m+(x&_|v&~_)+g+y;return(A<<C|A>>>32-C)+x}function f(m,x,v,_,g,C,y){var A=m+(x^v^_)+g+y;return(A<<C|A>>>32-C)+x}function p(m,x,v,_,g,C,y){var A=m+(v^(x|~_))+g+y;return(A<<C|A>>>32-C)+x}r.MD5=o._createHelper(l),r.HmacMD5=o._createHmacHelper(l)}(Math),e.MD5})}(Xr)),Xr.exports}var Zr={exports:{}},qa;function Va(){return qa||(qa=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.WordArray,c=r.Hasher,o=s.algo,u=[],a=o.SHA1=c.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,h){for(var d=this._hash.words,f=d[0],p=d[1],m=d[2],x=d[3],v=d[4],_=0;_<80;_++){if(_<16)u[_]=l[h+_]|0;else{var g=u[_-3]^u[_-8]^u[_-14]^u[_-16];u[_]=g<<1|g>>>31}var C=(f<<5|f>>>27)+v+u[_];_<20?C+=(p&m|~p&x)+1518500249:_<40?C+=(p^m^x)+1859775393:_<60?C+=(p&m|p&x|m&x)-1894007588:C+=(p^m^x)-899497514,v=x,x=m,m=p<<30|p>>>2,p=f,f=C}d[0]=d[0]+f|0,d[1]=d[1]+p|0,d[2]=d[2]+m|0,d[3]=d[3]+x|0,d[4]=d[4]+v|0},_doFinalize:function(){var l=this._data,h=l.words,d=this._nDataBytes*8,f=l.sigBytes*8;return h[f>>>5]|=128<<24-f%32,h[(f+64>>>9<<4)+14]=Math.floor(d/4294967296),h[(f+64>>>9<<4)+15]=d,l.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var l=c.clone.call(this);return l._hash=this._hash.clone(),l}});s.SHA1=c._createHelper(a),s.HmacSHA1=c._createHmacHelper(a)}(),e.SHA1})}(Zr)),Zr.exports}var Yr={exports:{}},Wa;function Qr(){return Wa||(Wa=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){return function(s){var r=e,i=r.lib,c=i.WordArray,o=i.Hasher,u=r.algo,a=[],l=[];(function(){function f(v){for(var _=s.sqrt(v),g=2;g<=_;g++)if(!(v%g))return!1;return!0}function p(v){return(v-(v|0))*4294967296|0}for(var m=2,x=0;x<64;)f(m)&&(x<8&&(a[x]=p(s.pow(m,1/2))),l[x]=p(s.pow(m,1/3)),x++),m++})();var h=[],d=u.SHA256=o.extend({_doReset:function(){this._hash=new c.init(a.slice(0))},_doProcessBlock:function(f,p){for(var m=this._hash.words,x=m[0],v=m[1],_=m[2],g=m[3],C=m[4],y=m[5],A=m[6],w=m[7],b=0;b<64;b++){if(b<16)h[b]=f[p+b]|0;else{var k=h[b-15],E=(k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3,D=h[b-2],T=(D<<15|D>>>17)^(D<<13|D>>>19)^D>>>10;h[b]=E+h[b-7]+T+h[b-16]}var F=C&y^~C&A,N=x&v^x&_^v&_,P=(x<<30|x>>>2)^(x<<19|x>>>13)^(x<<10|x>>>22),q=(C<<26|C>>>6)^(C<<21|C>>>11)^(C<<7|C>>>25),W=w+q+F+l[b]+h[b],H=P+N;w=A,A=y,y=C,C=g+W|0,g=_,_=v,v=x,x=W+H|0}m[0]=m[0]+x|0,m[1]=m[1]+v|0,m[2]=m[2]+_|0,m[3]=m[3]+g|0,m[4]=m[4]+C|0,m[5]=m[5]+y|0,m[6]=m[6]+A|0,m[7]=m[7]+w|0},_doFinalize:function(){var f=this._data,p=f.words,m=this._nDataBytes*8,x=f.sigBytes*8;return p[x>>>5]|=128<<24-x%32,p[(x+64>>>9<<4)+14]=s.floor(m/4294967296),p[(x+64>>>9<<4)+15]=m,f.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var f=o.clone.call(this);return f._hash=this._hash.clone(),f}});r.SHA256=o._createHelper(d),r.HmacSHA256=o._createHmacHelper(d)}(Math),e.SHA256})}(Yr)),Yr.exports}var Kr={exports:{}},La;function Up(){return La||(La=1,function(n,t){(function(e,s,r){n.exports=s(J(),Qr())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.WordArray,c=s.algo,o=c.SHA256,u=c.SHA224=o.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=o._doFinalize.call(this);return a.sigBytes-=4,a}});s.SHA224=o._createHelper(u),s.HmacSHA224=o._createHmacHelper(u)}(),e.SHA224})}(Kr)),Kr.exports}var Jr={exports:{}},za;function ja(){return za||(za=1,function(n,t){(function(e,s,r){n.exports=s(J(),Un())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.Hasher,c=s.x64,o=c.Word,u=c.WordArray,a=s.algo;function l(){return o.create.apply(o,arguments)}var h=[l(1116352408,3609767458),l(1899447441,602891725),l(3049323471,3964484399),l(3921009573,2173295548),l(961987163,4081628472),l(1508970993,3053834265),l(2453635748,2937671579),l(2870763221,3664609560),l(3624381080,2734883394),l(310598401,1164996542),l(607225278,1323610764),l(1426881987,3590304994),l(1925078388,4068182383),l(2162078206,991336113),l(2614888103,633803317),l(3248222580,3479774868),l(3835390401,2666613458),l(4022224774,944711139),l(264347078,2341262773),l(604807628,2007800933),l(770255983,1495990901),l(1249150122,1856431235),l(1555081692,3175218132),l(1996064986,2198950837),l(2554220882,3999719339),l(2821834349,766784016),l(2952996808,2566594879),l(3210313671,3203337956),l(3336571891,1034457026),l(3584528711,2466948901),l(113926993,3758326383),l(338241895,168717936),l(666307205,1188179964),l(773529912,1546045734),l(1294757372,1522805485),l(1396182291,2643833823),l(1695183700,2343527390),l(1986661051,1014477480),l(2177026350,1206759142),l(2456956037,344077627),l(2730485921,1290863460),l(2820302411,3158454273),l(3259730800,3505952657),l(3345764771,106217008),l(3516065817,3606008344),l(3600352804,1432725776),l(4094571909,1467031594),l(275423344,851169720),l(430227734,3100823752),l(506948616,1363258195),l(659060556,3750685593),l(883997877,3785050280),l(958139571,3318307427),l(1322822218,3812723403),l(1537002063,2003034995),l(1747873779,3602036899),l(1955562222,1575990012),l(2024104815,1125592928),l(2227730452,2716904306),l(2361852424,442776044),l(2428436474,593698344),l(2756734187,3733110249),l(3204031479,2999351573),l(3329325298,3815920427),l(3391569614,3928383900),l(3515267271,566280711),l(3940187606,3454069534),l(4118630271,4000239992),l(116418474,1914138554),l(174292421,2731055270),l(289380356,3203993006),l(460393269,320620315),l(685471733,587496836),l(852142971,1086792851),l(1017036298,365543100),l(1126000580,2618297676),l(1288033470,3409855158),l(1501505948,4234509866),l(1607167915,987167468),l(1816402316,1246189591)],d=[];(function(){for(var p=0;p<80;p++)d[p]=l()})();var f=a.SHA512=i.extend({_doReset:function(){this._hash=new u.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(p,m){for(var x=this._hash.words,v=x[0],_=x[1],g=x[2],C=x[3],y=x[4],A=x[5],w=x[6],b=x[7],k=v.high,E=v.low,D=_.high,T=_.low,F=g.high,N=g.low,P=C.high,q=C.low,W=y.high,H=y.low,L=A.high,j=A.low,B=w.high,S=w.low,R=b.high,O=b.low,U=k,X=E,nt=D,V=T,Ut=F,Lt=N,ge=P,Kt=q,Gt=W,Rt=H,z=L,G=j,ft=B,at=S,tt=R,ut=O,xt=0;xt<80;xt++){var Ct,zt,qe=d[xt];if(xt<16)zt=qe.high=p[m+xt*2]|0,Ct=qe.low=p[m+xt*2+1]|0;else{var Jn=d[xt-15],Ve=Jn.high,Ks=Jn.low,Gf=(Ve>>>1|Ks<<31)^(Ve>>>8|Ks<<24)^Ve>>>7,Ec=(Ks>>>1|Ve<<31)^(Ks>>>8|Ve<<24)^(Ks>>>7|Ve<<25),Dc=d[xt-2],ys=Dc.high,Js=Dc.low,$f=(ys>>>19|Js<<13)^(ys<<3|Js>>>29)^ys>>>6,Tc=(Js>>>19|ys<<13)^(Js<<3|ys>>>29)^(Js>>>6|ys<<26),kc=d[xt-7],Xf=kc.high,Zf=kc.low,Fc=d[xt-16],Yf=Fc.high,Bc=Fc.low;Ct=Ec+Zf,zt=Gf+Xf+(Ct>>>0<Ec>>>0?1:0),Ct=Ct+Tc,zt=zt+$f+(Ct>>>0<Tc>>>0?1:0),Ct=Ct+Bc,zt=zt+Yf+(Ct>>>0<Bc>>>0?1:0),qe.high=zt,qe.low=Ct}var Qf=Gt&z^~Gt&ft,Sc=Rt&G^~Rt&at,Kf=U&nt^U&Ut^nt&Ut,Jf=X&V^X&Lt^V&Lt,tx=(U>>>28|X<<4)^(U<<30|X>>>2)^(U<<25|X>>>7),Nc=(X>>>28|U<<4)^(X<<30|U>>>2)^(X<<25|U>>>7),ex=(Gt>>>14|Rt<<18)^(Gt>>>18|Rt<<14)^(Gt<<23|Rt>>>9),sx=(Rt>>>14|Gt<<18)^(Rt>>>18|Gt<<14)^(Rt<<23|Gt>>>9),Oc=h[xt],nx=Oc.high,Mc=Oc.low,$t=ut+sx,We=tt+ex+($t>>>0<ut>>>0?1:0),$t=$t+Sc,We=We+Qf+($t>>>0<Sc>>>0?1:0),$t=$t+Mc,We=We+nx+($t>>>0<Mc>>>0?1:0),$t=$t+Ct,We=We+zt+($t>>>0<Ct>>>0?1:0),Ic=Nc+Jf,rx=tx+Kf+(Ic>>>0<Nc>>>0?1:0);tt=ft,ut=at,ft=z,at=G,z=Gt,G=Rt,Rt=Kt+$t|0,Gt=ge+We+(Rt>>>0<Kt>>>0?1:0)|0,ge=Ut,Kt=Lt,Ut=nt,Lt=V,nt=U,V=X,X=$t+Ic|0,U=We+rx+(X>>>0<$t>>>0?1:0)|0}E=v.low=E+X,v.high=k+U+(E>>>0<X>>>0?1:0),T=_.low=T+V,_.high=D+nt+(T>>>0<V>>>0?1:0),N=g.low=N+Lt,g.high=F+Ut+(N>>>0<Lt>>>0?1:0),q=C.low=q+Kt,C.high=P+ge+(q>>>0<Kt>>>0?1:0),H=y.low=H+Rt,y.high=W+Gt+(H>>>0<Rt>>>0?1:0),j=A.low=j+G,A.high=L+z+(j>>>0<G>>>0?1:0),S=w.low=S+at,w.high=B+ft+(S>>>0<at>>>0?1:0),O=b.low=O+ut,b.high=R+tt+(O>>>0<ut>>>0?1:0)},_doFinalize:function(){var p=this._data,m=p.words,x=this._nDataBytes*8,v=p.sigBytes*8;m[v>>>5]|=128<<24-v%32,m[(v+128>>>10<<5)+30]=Math.floor(x/4294967296),m[(v+128>>>10<<5)+31]=x,p.sigBytes=m.length*4,this._process();var _=this._hash.toX32();return _},clone:function(){var p=i.clone.call(this);return p._hash=this._hash.clone(),p},blockSize:1024/32});s.SHA512=i._createHelper(f),s.HmacSHA512=i._createHmacHelper(f)}(),e.SHA512})}(Jr)),Jr.exports}var ti={exports:{}},Ha;function Gp(){return Ha||(Ha=1,function(n,t){(function(e,s,r){n.exports=s(J(),Un(),ja())})(Q,function(e){return function(){var s=e,r=s.x64,i=r.Word,c=r.WordArray,o=s.algo,u=o.SHA512,a=o.SHA384=u.extend({_doReset:function(){this._hash=new c.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var l=u._doFinalize.call(this);return l.sigBytes-=16,l}});s.SHA384=u._createHelper(a),s.HmacSHA384=u._createHmacHelper(a)}(),e.SHA384})}(ti)),ti.exports}var ei={exports:{}},Ua;function $p(){return Ua||(Ua=1,function(n,t){(function(e,s,r){n.exports=s(J(),Un())})(Q,function(e){return function(s){var r=e,i=r.lib,c=i.WordArray,o=i.Hasher,u=r.x64,a=u.Word,l=r.algo,h=[],d=[],f=[];(function(){for(var x=1,v=0,_=0;_<24;_++){h[x+5*v]=(_+1)*(_+2)/2%64;var g=v%5,C=(2*x+3*v)%5;x=g,v=C}for(var x=0;x<5;x++)for(var v=0;v<5;v++)d[x+5*v]=v+(2*x+3*v)%5*5;for(var y=1,A=0;A<24;A++){for(var w=0,b=0,k=0;k<7;k++){if(y&1){var E=(1<<k)-1;E<32?b^=1<<E:w^=1<<E-32}y&128?y=y<<1^113:y<<=1}f[A]=a.create(w,b)}})();var p=[];(function(){for(var x=0;x<25;x++)p[x]=a.create()})();var m=l.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var x=this._state=[],v=0;v<25;v++)x[v]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(x,v){for(var _=this._state,g=this.blockSize/2,C=0;C<g;C++){var y=x[v+2*C],A=x[v+2*C+1];y=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360,A=(A<<8|A>>>24)&16711935|(A<<24|A>>>8)&4278255360;var w=_[C];w.high^=A,w.low^=y}for(var b=0;b<24;b++){for(var k=0;k<5;k++){for(var E=0,D=0,T=0;T<5;T++){var w=_[k+5*T];E^=w.high,D^=w.low}var F=p[k];F.high=E,F.low=D}for(var k=0;k<5;k++)for(var N=p[(k+4)%5],P=p[(k+1)%5],q=P.high,W=P.low,E=N.high^(q<<1|W>>>31),D=N.low^(W<<1|q>>>31),T=0;T<5;T++){var w=_[k+5*T];w.high^=E,w.low^=D}for(var H=1;H<25;H++){var E,D,w=_[H],L=w.high,j=w.low,B=h[H];B<32?(E=L<<B|j>>>32-B,D=j<<B|L>>>32-B):(E=j<<B-32|L>>>64-B,D=L<<B-32|j>>>64-B);var S=p[d[H]];S.high=E,S.low=D}var R=p[0],O=_[0];R.high=O.high,R.low=O.low;for(var k=0;k<5;k++)for(var T=0;T<5;T++){var H=k+5*T,w=_[H],U=p[H],X=p[(k+1)%5+5*T],nt=p[(k+2)%5+5*T];w.high=U.high^~X.high&nt.high,w.low=U.low^~X.low&nt.low}var w=_[0],V=f[b];w.high^=V.high,w.low^=V.low}},_doFinalize:function(){var x=this._data,v=x.words;this._nDataBytes*8;var _=x.sigBytes*8,g=this.blockSize*32;v[_>>>5]|=1<<24-_%32,v[(s.ceil((_+1)/g)*g>>>5)-1]|=128,x.sigBytes=v.length*4,this._process();for(var C=this._state,y=this.cfg.outputLength/8,A=y/8,w=[],b=0;b<A;b++){var k=C[b],E=k.high,D=k.low;E=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,D=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,w.push(D),w.push(E)}return new c.init(w,y)},clone:function(){for(var x=o.clone.call(this),v=x._state=this._state.slice(0),_=0;_<25;_++)v[_]=v[_].clone();return x}});r.SHA3=o._createHelper(m),r.HmacSHA3=o._createHmacHelper(m)}(Math),e.SHA3})}(ei)),ei.exports}var si={exports:{}},Ga;function Xp(){return Ga||(Ga=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){/** @preserve
215
+ (c) 2012 by Cédric Mesnil. All rights reserved.
216
+
217
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
218
+
219
+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
220
+ - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
221
+
222
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
223
+ */return function(s){var r=e,i=r.lib,c=i.WordArray,o=i.Hasher,u=r.algo,a=c.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=c.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),h=c.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),d=c.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),f=c.create([0,1518500249,1859775393,2400959708,2840853838]),p=c.create([1352829926,1548603684,1836072691,2053994217,0]),m=u.RIPEMD160=o.extend({_doReset:function(){this._hash=c.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(A,w){for(var b=0;b<16;b++){var k=w+b,E=A[k];A[k]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}var D=this._hash.words,T=f.words,F=p.words,N=a.words,P=l.words,q=h.words,W=d.words,H,L,j,B,S,R,O,U,X,nt;R=H=D[0],O=L=D[1],U=j=D[2],X=B=D[3],nt=S=D[4];for(var V,b=0;b<80;b+=1)V=H+A[w+N[b]]|0,b<16?V+=x(L,j,B)+T[0]:b<32?V+=v(L,j,B)+T[1]:b<48?V+=_(L,j,B)+T[2]:b<64?V+=g(L,j,B)+T[3]:V+=C(L,j,B)+T[4],V=V|0,V=y(V,q[b]),V=V+S|0,H=S,S=B,B=y(j,10),j=L,L=V,V=R+A[w+P[b]]|0,b<16?V+=C(O,U,X)+F[0]:b<32?V+=g(O,U,X)+F[1]:b<48?V+=_(O,U,X)+F[2]:b<64?V+=v(O,U,X)+F[3]:V+=x(O,U,X)+F[4],V=V|0,V=y(V,W[b]),V=V+nt|0,R=nt,nt=X,X=y(U,10),U=O,O=V;V=D[1]+j+X|0,D[1]=D[2]+B+nt|0,D[2]=D[3]+S+R|0,D[3]=D[4]+H+O|0,D[4]=D[0]+L+U|0,D[0]=V},_doFinalize:function(){var A=this._data,w=A.words,b=this._nDataBytes*8,k=A.sigBytes*8;w[k>>>5]|=128<<24-k%32,w[(k+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,A.sigBytes=(w.length+1)*4,this._process();for(var E=this._hash,D=E.words,T=0;T<5;T++){var F=D[T];D[T]=(F<<8|F>>>24)&16711935|(F<<24|F>>>8)&4278255360}return E},clone:function(){var A=o.clone.call(this);return A._hash=this._hash.clone(),A}});function x(A,w,b){return A^w^b}function v(A,w,b){return A&w|~A&b}function _(A,w,b){return(A|~w)^b}function g(A,w,b){return A&b|w&~b}function C(A,w,b){return A^(w|~b)}function y(A,w){return A<<w|A>>>32-w}r.RIPEMD160=o._createHelper(m),r.HmacRIPEMD160=o._createHmacHelper(m)}(),e.RIPEMD160})}(si)),si.exports}var ni={exports:{}},$a;function ri(){return $a||($a=1,function(n,t){(function(e,s){n.exports=s(J())})(Q,function(e){(function(){var s=e,r=s.lib,i=r.Base,c=s.enc,o=c.Utf8,u=s.algo;u.HMAC=i.extend({init:function(a,l){a=this._hasher=new a.init,typeof l=="string"&&(l=o.parse(l));var h=a.blockSize,d=h*4;l.sigBytes>d&&(l=a.finalize(l)),l.clamp();for(var f=this._oKey=l.clone(),p=this._iKey=l.clone(),m=f.words,x=p.words,v=0;v<h;v++)m[v]^=1549556828,x[v]^=909522486;f.sigBytes=p.sigBytes=d,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var l=this._hasher,h=l.finalize(a);l.reset();var d=l.finalize(this._oKey.clone().concat(h));return d}})})()})}(ni)),ni.exports}var ii={exports:{}},Xa;function Zp(){return Xa||(Xa=1,function(n,t){(function(e,s,r){n.exports=s(J(),Qr(),ri())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.Base,c=r.WordArray,o=s.algo,u=o.SHA256,a=o.HMAC,l=o.PBKDF2=i.extend({cfg:i.extend({keySize:128/32,hasher:u,iterations:25e4}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,d){for(var f=this.cfg,p=a.create(f.hasher,h),m=c.create(),x=c.create([1]),v=m.words,_=x.words,g=f.keySize,C=f.iterations;v.length<g;){var y=p.update(d).finalize(x);p.reset();for(var A=y.words,w=A.length,b=y,k=1;k<C;k++){b=p.finalize(b),p.reset();for(var E=b.words,D=0;D<w;D++)A[D]^=E[D]}m.concat(y),_[0]++}return m.sigBytes=g*4,m}});s.PBKDF2=function(h,d,f){return l.create(f).compute(h,d)}}(),e.PBKDF2})}(ii)),ii.exports}var oi={exports:{}},Za;function Pe(){return Za||(Za=1,function(n,t){(function(e,s,r){n.exports=s(J(),Va(),ri())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.Base,c=r.WordArray,o=s.algo,u=o.MD5,a=o.EvpKDF=i.extend({cfg:i.extend({keySize:128/32,hasher:u,iterations:1}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,h){for(var d,f=this.cfg,p=f.hasher.create(),m=c.create(),x=m.words,v=f.keySize,_=f.iterations;x.length<v;){d&&p.update(d),d=p.update(l).finalize(h),p.reset();for(var g=1;g<_;g++)d=p.finalize(d),p.reset();m.concat(d)}return m.sigBytes=v*4,m}});s.EvpKDF=function(l,h,d){return a.create(d).compute(l,h)}}(),e.EvpKDF})}(oi)),oi.exports}var ai={exports:{}},Ya;function wt(){return Ya||(Ya=1,function(n,t){(function(e,s,r){n.exports=s(J(),Pe())})(Q,function(e){e.lib.Cipher||function(s){var r=e,i=r.lib,c=i.Base,o=i.WordArray,u=i.BufferedBlockAlgorithm,a=r.enc;a.Utf8;var l=a.Base64,h=r.algo,d=h.EvpKDF,f=i.Cipher=u.extend({cfg:c.extend(),createEncryptor:function(E,D){return this.create(this._ENC_XFORM_MODE,E,D)},createDecryptor:function(E,D){return this.create(this._DEC_XFORM_MODE,E,D)},init:function(E,D,T){this.cfg=this.cfg.extend(T),this._xformMode=E,this._key=D,this.reset()},reset:function(){u.reset.call(this),this._doReset()},process:function(E){return this._append(E),this._process()},finalize:function(E){E&&this._append(E);var D=this._doFinalize();return D},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function E(D){return typeof D=="string"?k:A}return function(D){return{encrypt:function(T,F,N){return E(F).encrypt(D,T,F,N)},decrypt:function(T,F,N){return E(F).decrypt(D,T,F,N)}}}}()});i.StreamCipher=f.extend({_doFinalize:function(){var E=this._process(!0);return E},blockSize:1});var p=r.mode={},m=i.BlockCipherMode=c.extend({createEncryptor:function(E,D){return this.Encryptor.create(E,D)},createDecryptor:function(E,D){return this.Decryptor.create(E,D)},init:function(E,D){this._cipher=E,this._iv=D}}),x=p.CBC=function(){var E=m.extend();E.Encryptor=E.extend({processBlock:function(T,F){var N=this._cipher,P=N.blockSize;D.call(this,T,F,P),N.encryptBlock(T,F),this._prevBlock=T.slice(F,F+P)}}),E.Decryptor=E.extend({processBlock:function(T,F){var N=this._cipher,P=N.blockSize,q=T.slice(F,F+P);N.decryptBlock(T,F),D.call(this,T,F,P),this._prevBlock=q}});function D(T,F,N){var P,q=this._iv;q?(P=q,this._iv=s):P=this._prevBlock;for(var W=0;W<N;W++)T[F+W]^=P[W]}return E}(),v=r.pad={},_=v.Pkcs7={pad:function(E,D){for(var T=D*4,F=T-E.sigBytes%T,N=F<<24|F<<16|F<<8|F,P=[],q=0;q<F;q+=4)P.push(N);var W=o.create(P,F);E.concat(W)},unpad:function(E){var D=E.words[E.sigBytes-1>>>2]&255;E.sigBytes-=D}};i.BlockCipher=f.extend({cfg:f.cfg.extend({mode:x,padding:_}),reset:function(){var E;f.reset.call(this);var D=this.cfg,T=D.iv,F=D.mode;this._xformMode==this._ENC_XFORM_MODE?E=F.createEncryptor:(E=F.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==E?this._mode.init(this,T&&T.words):(this._mode=E.call(F,this,T&&T.words),this._mode.__creator=E)},_doProcessBlock:function(E,D){this._mode.processBlock(E,D)},_doFinalize:function(){var E,D=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(D.pad(this._data,this.blockSize),E=this._process(!0)):(E=this._process(!0),D.unpad(E)),E},blockSize:128/32});var g=i.CipherParams=c.extend({init:function(E){this.mixIn(E)},toString:function(E){return(E||this.formatter).stringify(this)}}),C=r.format={},y=C.OpenSSL={stringify:function(E){var D,T=E.ciphertext,F=E.salt;return F?D=o.create([1398893684,1701076831]).concat(F).concat(T):D=T,D.toString(l)},parse:function(E){var D,T=l.parse(E),F=T.words;return F[0]==1398893684&&F[1]==1701076831&&(D=o.create(F.slice(2,4)),F.splice(0,4),T.sigBytes-=16),g.create({ciphertext:T,salt:D})}},A=i.SerializableCipher=c.extend({cfg:c.extend({format:y}),encrypt:function(E,D,T,F){F=this.cfg.extend(F);var N=E.createEncryptor(T,F),P=N.finalize(D),q=N.cfg;return g.create({ciphertext:P,key:T,iv:q.iv,algorithm:E,mode:q.mode,padding:q.padding,blockSize:E.blockSize,formatter:F.format})},decrypt:function(E,D,T,F){F=this.cfg.extend(F),D=this._parse(D,F.format);var N=E.createDecryptor(T,F).finalize(D.ciphertext);return N},_parse:function(E,D){return typeof E=="string"?D.parse(E,this):E}}),w=r.kdf={},b=w.OpenSSL={execute:function(E,D,T,F,N){if(F||(F=o.random(64/8)),N)var P=d.create({keySize:D+T,hasher:N}).compute(E,F);else var P=d.create({keySize:D+T}).compute(E,F);var q=o.create(P.words.slice(D),T*4);return P.sigBytes=D*4,g.create({key:P,iv:q,salt:F})}},k=i.PasswordBasedCipher=A.extend({cfg:A.cfg.extend({kdf:b}),encrypt:function(E,D,T,F){F=this.cfg.extend(F);var N=F.kdf.execute(T,E.keySize,E.ivSize,F.salt,F.hasher);F.iv=N.iv;var P=A.encrypt.call(this,E,D,N.key,F);return P.mixIn(N),P},decrypt:function(E,D,T,F){F=this.cfg.extend(F),D=this._parse(D,F.format);var N=F.kdf.execute(T,E.keySize,E.ivSize,D.salt,F.hasher);F.iv=N.iv;var P=A.decrypt.call(this,E,D,N.key,F);return P}})}()})}(ai)),ai.exports}var ci={exports:{}},Qa;function Yp(){return Qa||(Qa=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return e.mode.CFB=function(){var s=e.lib.BlockCipherMode.extend();s.Encryptor=s.extend({processBlock:function(i,c){var o=this._cipher,u=o.blockSize;r.call(this,i,c,u,o),this._prevBlock=i.slice(c,c+u)}}),s.Decryptor=s.extend({processBlock:function(i,c){var o=this._cipher,u=o.blockSize,a=i.slice(c,c+u);r.call(this,i,c,u,o),this._prevBlock=a}});function r(i,c,o,u){var a,l=this._iv;l?(a=l.slice(0),this._iv=void 0):a=this._prevBlock,u.encryptBlock(a,0);for(var h=0;h<o;h++)i[c+h]^=a[h]}return s}(),e.mode.CFB})}(ci)),ci.exports}var ui={exports:{}},Ka;function Qp(){return Ka||(Ka=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return e.mode.CTR=function(){var s=e.lib.BlockCipherMode.extend(),r=s.Encryptor=s.extend({processBlock:function(i,c){var o=this._cipher,u=o.blockSize,a=this._iv,l=this._counter;a&&(l=this._counter=a.slice(0),this._iv=void 0);var h=l.slice(0);o.encryptBlock(h,0),l[u-1]=l[u-1]+1|0;for(var d=0;d<u;d++)i[c+d]^=h[d]}});return s.Decryptor=r,s}(),e.mode.CTR})}(ui)),ui.exports}var li={exports:{}},Ja;function Kp(){return Ja||(Ja=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){/** @preserve
224
+ * Counter block mode compatible with Dr Brian Gladman fileenc.c
225
+ * derived from CryptoJS.mode.CTR
226
+ * Jan Hruby jhruby.web@gmail.com
227
+ */return e.mode.CTRGladman=function(){var s=e.lib.BlockCipherMode.extend();function r(o){if((o>>24&255)===255){var u=o>>16&255,a=o>>8&255,l=o&255;u===255?(u=0,a===255?(a=0,l===255?l=0:++l):++a):++u,o=0,o+=u<<16,o+=a<<8,o+=l}else o+=1<<24;return o}function i(o){return(o[0]=r(o[0]))===0&&(o[1]=r(o[1])),o}var c=s.Encryptor=s.extend({processBlock:function(o,u){var a=this._cipher,l=a.blockSize,h=this._iv,d=this._counter;h&&(d=this._counter=h.slice(0),this._iv=void 0),i(d);var f=d.slice(0);a.encryptBlock(f,0);for(var p=0;p<l;p++)o[u+p]^=f[p]}});return s.Decryptor=c,s}(),e.mode.CTRGladman})}(li)),li.exports}var hi={exports:{}},tc;function Jp(){return tc||(tc=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return e.mode.OFB=function(){var s=e.lib.BlockCipherMode.extend(),r=s.Encryptor=s.extend({processBlock:function(i,c){var o=this._cipher,u=o.blockSize,a=this._iv,l=this._keystream;a&&(l=this._keystream=a.slice(0),this._iv=void 0),o.encryptBlock(l,0);for(var h=0;h<u;h++)i[c+h]^=l[h]}});return s.Decryptor=r,s}(),e.mode.OFB})}(hi)),hi.exports}var di={exports:{}},ec;function tf(){return ec||(ec=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return e.mode.ECB=function(){var s=e.lib.BlockCipherMode.extend();return s.Encryptor=s.extend({processBlock:function(r,i){this._cipher.encryptBlock(r,i)}}),s.Decryptor=s.extend({processBlock:function(r,i){this._cipher.decryptBlock(r,i)}}),s}(),e.mode.ECB})}(di)),di.exports}var pi={exports:{}},sc;function ef(){return sc||(sc=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return e.pad.AnsiX923={pad:function(s,r){var i=s.sigBytes,c=r*4,o=c-i%c,u=i+o-1;s.clamp(),s.words[u>>>2]|=o<<24-u%4*8,s.sigBytes+=o},unpad:function(s){var r=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=r}},e.pad.Ansix923})}(pi)),pi.exports}var fi={exports:{}},nc;function sf(){return nc||(nc=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return e.pad.Iso10126={pad:function(s,r){var i=r*4,c=i-s.sigBytes%i;s.concat(e.lib.WordArray.random(c-1)).concat(e.lib.WordArray.create([c<<24],1))},unpad:function(s){var r=s.words[s.sigBytes-1>>>2]&255;s.sigBytes-=r}},e.pad.Iso10126})}(fi)),fi.exports}var xi={exports:{}},rc;function nf(){return rc||(rc=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return e.pad.Iso97971={pad:function(s,r){s.concat(e.lib.WordArray.create([2147483648],1)),e.pad.ZeroPadding.pad(s,r)},unpad:function(s){e.pad.ZeroPadding.unpad(s),s.sigBytes--}},e.pad.Iso97971})}(xi)),xi.exports}var mi={exports:{}},ic;function rf(){return ic||(ic=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return e.pad.ZeroPadding={pad:function(s,r){var i=r*4;s.clamp(),s.sigBytes+=i-(s.sigBytes%i||i)},unpad:function(s){for(var r=s.words,i=s.sigBytes-1,i=s.sigBytes-1;i>=0;i--)if(r[i>>>2]>>>24-i%4*8&255){s.sigBytes=i+1;break}}},e.pad.ZeroPadding})}(mi)),mi.exports}var _i={exports:{}},oc;function of(){return oc||(oc=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return e.pad.NoPadding={pad:function(){},unpad:function(){}},e.pad.NoPadding})}(_i)),_i.exports}var gi={exports:{}},ac;function af(){return ac||(ac=1,function(n,t){(function(e,s,r){n.exports=s(J(),wt())})(Q,function(e){return function(s){var r=e,i=r.lib,c=i.CipherParams,o=r.enc,u=o.Hex,a=r.format;a.Hex={stringify:function(l){return l.ciphertext.toString(u)},parse:function(l){var h=u.parse(l);return c.create({ciphertext:h})}}}(),e.format.Hex})}(gi)),gi.exports}var vi={exports:{}},cc;function cf(){return cc||(cc=1,function(n,t){(function(e,s,r){n.exports=s(J(),Ke(),Je(),Pe(),wt())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.BlockCipher,c=s.algo,o=[],u=[],a=[],l=[],h=[],d=[],f=[],p=[],m=[],x=[];(function(){for(var g=[],C=0;C<256;C++)C<128?g[C]=C<<1:g[C]=C<<1^283;for(var y=0,A=0,C=0;C<256;C++){var w=A^A<<1^A<<2^A<<3^A<<4;w=w>>>8^w&255^99,o[y]=w,u[w]=y;var b=g[y],k=g[b],E=g[k],D=g[w]*257^w*16843008;a[y]=D<<24|D>>>8,l[y]=D<<16|D>>>16,h[y]=D<<8|D>>>24,d[y]=D;var D=E*16843009^k*65537^b*257^y*16843008;f[w]=D<<24|D>>>8,p[w]=D<<16|D>>>16,m[w]=D<<8|D>>>24,x[w]=D,y?(y=b^g[g[g[E^b]]],A^=g[g[A]]):y=A=1}})();var v=[0,1,2,4,8,16,32,64,128,27,54],_=c.AES=i.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var C=this._keyPriorReset=this._key,y=C.words,A=C.sigBytes/4,w=this._nRounds=A+6,b=(w+1)*4,k=this._keySchedule=[],E=0;E<b;E++)E<A?k[E]=y[E]:(g=k[E-1],E%A?A>6&&E%A==4&&(g=o[g>>>24]<<24|o[g>>>16&255]<<16|o[g>>>8&255]<<8|o[g&255]):(g=g<<8|g>>>24,g=o[g>>>24]<<24|o[g>>>16&255]<<16|o[g>>>8&255]<<8|o[g&255],g^=v[E/A|0]<<24),k[E]=k[E-A]^g);for(var D=this._invKeySchedule=[],T=0;T<b;T++){var E=b-T;if(T%4)var g=k[E];else var g=k[E-4];T<4||E<=4?D[T]=g:D[T]=f[o[g>>>24]]^p[o[g>>>16&255]]^m[o[g>>>8&255]]^x[o[g&255]]}}},encryptBlock:function(g,C){this._doCryptBlock(g,C,this._keySchedule,a,l,h,d,o)},decryptBlock:function(g,C){var y=g[C+1];g[C+1]=g[C+3],g[C+3]=y,this._doCryptBlock(g,C,this._invKeySchedule,f,p,m,x,u);var y=g[C+1];g[C+1]=g[C+3],g[C+3]=y},_doCryptBlock:function(g,C,y,A,w,b,k,E){for(var D=this._nRounds,T=g[C]^y[0],F=g[C+1]^y[1],N=g[C+2]^y[2],P=g[C+3]^y[3],q=4,W=1;W<D;W++){var H=A[T>>>24]^w[F>>>16&255]^b[N>>>8&255]^k[P&255]^y[q++],L=A[F>>>24]^w[N>>>16&255]^b[P>>>8&255]^k[T&255]^y[q++],j=A[N>>>24]^w[P>>>16&255]^b[T>>>8&255]^k[F&255]^y[q++],B=A[P>>>24]^w[T>>>16&255]^b[F>>>8&255]^k[N&255]^y[q++];T=H,F=L,N=j,P=B}var H=(E[T>>>24]<<24|E[F>>>16&255]<<16|E[N>>>8&255]<<8|E[P&255])^y[q++],L=(E[F>>>24]<<24|E[N>>>16&255]<<16|E[P>>>8&255]<<8|E[T&255])^y[q++],j=(E[N>>>24]<<24|E[P>>>16&255]<<16|E[T>>>8&255]<<8|E[F&255])^y[q++],B=(E[P>>>24]<<24|E[T>>>16&255]<<16|E[F>>>8&255]<<8|E[N&255])^y[q++];g[C]=H,g[C+1]=L,g[C+2]=j,g[C+3]=B},keySize:256/32});s.AES=i._createHelper(_)}(),e.AES})}(vi)),vi.exports}var yi={exports:{}},uc;function uf(){return uc||(uc=1,function(n,t){(function(e,s,r){n.exports=s(J(),Ke(),Je(),Pe(),wt())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.WordArray,c=r.BlockCipher,o=s.algo,u=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],h=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],f=o.DES=c.extend({_doReset:function(){for(var v=this._key,_=v.words,g=[],C=0;C<56;C++){var y=u[C]-1;g[C]=_[y>>>5]>>>31-y%32&1}for(var A=this._subKeys=[],w=0;w<16;w++){for(var b=A[w]=[],k=l[w],C=0;C<24;C++)b[C/6|0]|=g[(a[C]-1+k)%28]<<31-C%6,b[4+(C/6|0)]|=g[28+(a[C+24]-1+k)%28]<<31-C%6;b[0]=b[0]<<1|b[0]>>>31;for(var C=1;C<7;C++)b[C]=b[C]>>>(C-1)*4+3;b[7]=b[7]<<5|b[7]>>>27}for(var E=this._invSubKeys=[],C=0;C<16;C++)E[C]=A[15-C]},encryptBlock:function(v,_){this._doCryptBlock(v,_,this._subKeys)},decryptBlock:function(v,_){this._doCryptBlock(v,_,this._invSubKeys)},_doCryptBlock:function(v,_,g){this._lBlock=v[_],this._rBlock=v[_+1],p.call(this,4,252645135),p.call(this,16,65535),m.call(this,2,858993459),m.call(this,8,16711935),p.call(this,1,1431655765);for(var C=0;C<16;C++){for(var y=g[C],A=this._lBlock,w=this._rBlock,b=0,k=0;k<8;k++)b|=h[k][((w^y[k])&d[k])>>>0];this._lBlock=w,this._rBlock=A^b}var E=this._lBlock;this._lBlock=this._rBlock,this._rBlock=E,p.call(this,1,1431655765),m.call(this,8,16711935),m.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),v[_]=this._lBlock,v[_+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function p(v,_){var g=(this._lBlock>>>v^this._rBlock)&_;this._rBlock^=g,this._lBlock^=g<<v}function m(v,_){var g=(this._rBlock>>>v^this._lBlock)&_;this._lBlock^=g,this._rBlock^=g<<v}s.DES=c._createHelper(f);var x=o.TripleDES=c.extend({_doReset:function(){var v=this._key,_=v.words;if(_.length!==2&&_.length!==4&&_.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var g=_.slice(0,2),C=_.length<4?_.slice(0,2):_.slice(2,4),y=_.length<6?_.slice(0,2):_.slice(4,6);this._des1=f.createEncryptor(i.create(g)),this._des2=f.createEncryptor(i.create(C)),this._des3=f.createEncryptor(i.create(y))},encryptBlock:function(v,_){this._des1.encryptBlock(v,_),this._des2.decryptBlock(v,_),this._des3.encryptBlock(v,_)},decryptBlock:function(v,_){this._des3.decryptBlock(v,_),this._des2.encryptBlock(v,_),this._des1.decryptBlock(v,_)},keySize:192/32,ivSize:64/32,blockSize:64/32});s.TripleDES=c._createHelper(x)}(),e.TripleDES})}(yi)),yi.exports}var Ci={exports:{}},lc;function lf(){return lc||(lc=1,function(n,t){(function(e,s,r){n.exports=s(J(),Ke(),Je(),Pe(),wt())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.StreamCipher,c=s.algo,o=c.RC4=i.extend({_doReset:function(){for(var l=this._key,h=l.words,d=l.sigBytes,f=this._S=[],p=0;p<256;p++)f[p]=p;for(var p=0,m=0;p<256;p++){var x=p%d,v=h[x>>>2]>>>24-x%4*8&255;m=(m+f[p]+v)%256;var _=f[p];f[p]=f[m],f[m]=_}this._i=this._j=0},_doProcessBlock:function(l,h){l[h]^=u.call(this)},keySize:256/32,ivSize:0});function u(){for(var l=this._S,h=this._i,d=this._j,f=0,p=0;p<4;p++){h=(h+1)%256,d=(d+l[h])%256;var m=l[h];l[h]=l[d],l[d]=m,f|=l[(l[h]+l[d])%256]<<24-p*8}return this._i=h,this._j=d,f}s.RC4=i._createHelper(o);var a=c.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var l=this.cfg.drop;l>0;l--)u.call(this)}});s.RC4Drop=i._createHelper(a)}(),e.RC4})}(Ci)),Ci.exports}var Ai={exports:{}},hc;function hf(){return hc||(hc=1,function(n,t){(function(e,s,r){n.exports=s(J(),Ke(),Je(),Pe(),wt())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.StreamCipher,c=s.algo,o=[],u=[],a=[],l=c.Rabbit=i.extend({_doReset:function(){for(var d=this._key.words,f=this.cfg.iv,p=0;p<4;p++)d[p]=(d[p]<<8|d[p]>>>24)&16711935|(d[p]<<24|d[p]>>>8)&4278255360;var m=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],x=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var p=0;p<4;p++)h.call(this);for(var p=0;p<8;p++)x[p]^=m[p+4&7];if(f){var v=f.words,_=v[0],g=v[1],C=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,y=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,A=C>>>16|y&4294901760,w=y<<16|C&65535;x[0]^=C,x[1]^=A,x[2]^=y,x[3]^=w,x[4]^=C,x[5]^=A,x[6]^=y,x[7]^=w;for(var p=0;p<4;p++)h.call(this)}},_doProcessBlock:function(d,f){var p=this._X;h.call(this),o[0]=p[0]^p[5]>>>16^p[3]<<16,o[1]=p[2]^p[7]>>>16^p[5]<<16,o[2]=p[4]^p[1]>>>16^p[7]<<16,o[3]=p[6]^p[3]>>>16^p[1]<<16;for(var m=0;m<4;m++)o[m]=(o[m]<<8|o[m]>>>24)&16711935|(o[m]<<24|o[m]>>>8)&4278255360,d[f+m]^=o[m]},blockSize:128/32,ivSize:64/32});function h(){for(var d=this._X,f=this._C,p=0;p<8;p++)u[p]=f[p];f[0]=f[0]+1295307597+this._b|0,f[1]=f[1]+3545052371+(f[0]>>>0<u[0]>>>0?1:0)|0,f[2]=f[2]+886263092+(f[1]>>>0<u[1]>>>0?1:0)|0,f[3]=f[3]+1295307597+(f[2]>>>0<u[2]>>>0?1:0)|0,f[4]=f[4]+3545052371+(f[3]>>>0<u[3]>>>0?1:0)|0,f[5]=f[5]+886263092+(f[4]>>>0<u[4]>>>0?1:0)|0,f[6]=f[6]+1295307597+(f[5]>>>0<u[5]>>>0?1:0)|0,f[7]=f[7]+3545052371+(f[6]>>>0<u[6]>>>0?1:0)|0,this._b=f[7]>>>0<u[7]>>>0?1:0;for(var p=0;p<8;p++){var m=d[p]+f[p],x=m&65535,v=m>>>16,_=((x*x>>>17)+x*v>>>15)+v*v,g=((m&4294901760)*m|0)+((m&65535)*m|0);a[p]=_^g}d[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,d[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,d[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,d[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,d[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,d[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,d[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,d[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}s.Rabbit=i._createHelper(l)}(),e.Rabbit})}(Ai)),Ai.exports}var bi={exports:{}},dc;function df(){return dc||(dc=1,function(n,t){(function(e,s,r){n.exports=s(J(),Ke(),Je(),Pe(),wt())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.StreamCipher,c=s.algo,o=[],u=[],a=[],l=c.RabbitLegacy=i.extend({_doReset:function(){var d=this._key.words,f=this.cfg.iv,p=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],m=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var x=0;x<4;x++)h.call(this);for(var x=0;x<8;x++)m[x]^=p[x+4&7];if(f){var v=f.words,_=v[0],g=v[1],C=(_<<8|_>>>24)&16711935|(_<<24|_>>>8)&4278255360,y=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,A=C>>>16|y&4294901760,w=y<<16|C&65535;m[0]^=C,m[1]^=A,m[2]^=y,m[3]^=w,m[4]^=C,m[5]^=A,m[6]^=y,m[7]^=w;for(var x=0;x<4;x++)h.call(this)}},_doProcessBlock:function(d,f){var p=this._X;h.call(this),o[0]=p[0]^p[5]>>>16^p[3]<<16,o[1]=p[2]^p[7]>>>16^p[5]<<16,o[2]=p[4]^p[1]>>>16^p[7]<<16,o[3]=p[6]^p[3]>>>16^p[1]<<16;for(var m=0;m<4;m++)o[m]=(o[m]<<8|o[m]>>>24)&16711935|(o[m]<<24|o[m]>>>8)&4278255360,d[f+m]^=o[m]},blockSize:128/32,ivSize:64/32});function h(){for(var d=this._X,f=this._C,p=0;p<8;p++)u[p]=f[p];f[0]=f[0]+1295307597+this._b|0,f[1]=f[1]+3545052371+(f[0]>>>0<u[0]>>>0?1:0)|0,f[2]=f[2]+886263092+(f[1]>>>0<u[1]>>>0?1:0)|0,f[3]=f[3]+1295307597+(f[2]>>>0<u[2]>>>0?1:0)|0,f[4]=f[4]+3545052371+(f[3]>>>0<u[3]>>>0?1:0)|0,f[5]=f[5]+886263092+(f[4]>>>0<u[4]>>>0?1:0)|0,f[6]=f[6]+1295307597+(f[5]>>>0<u[5]>>>0?1:0)|0,f[7]=f[7]+3545052371+(f[6]>>>0<u[6]>>>0?1:0)|0,this._b=f[7]>>>0<u[7]>>>0?1:0;for(var p=0;p<8;p++){var m=d[p]+f[p],x=m&65535,v=m>>>16,_=((x*x>>>17)+x*v>>>15)+v*v,g=((m&4294901760)*m|0)+((m&65535)*m|0);a[p]=_^g}d[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,d[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,d[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,d[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,d[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,d[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,d[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,d[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}s.RabbitLegacy=i._createHelper(l)}(),e.RabbitLegacy})}(bi)),bi.exports}var wi={exports:{}},pc;function pf(){return pc||(pc=1,function(n,t){(function(e,s,r){n.exports=s(J(),Ke(),Je(),Pe(),wt())})(Q,function(e){return function(){var s=e,r=s.lib,i=r.BlockCipher,c=s.algo;const o=16,u=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var l={pbox:[],sbox:[]};function h(x,v){let _=v>>24&255,g=v>>16&255,C=v>>8&255,y=v&255,A=x.sbox[0][_]+x.sbox[1][g];return A=A^x.sbox[2][C],A=A+x.sbox[3][y],A}function d(x,v,_){let g=v,C=_,y;for(let A=0;A<o;++A)g=g^x.pbox[A],C=h(x,g)^C,y=g,g=C,C=y;return y=g,g=C,C=y,C=C^x.pbox[o],g=g^x.pbox[o+1],{left:g,right:C}}function f(x,v,_){let g=v,C=_,y;for(let A=o+1;A>1;--A)g=g^x.pbox[A],C=h(x,g)^C,y=g,g=C,C=y;return y=g,g=C,C=y,C=C^x.pbox[1],g=g^x.pbox[0],{left:g,right:C}}function p(x,v,_){for(let w=0;w<4;w++){x.sbox[w]=[];for(let b=0;b<256;b++)x.sbox[w][b]=a[w][b]}let g=0;for(let w=0;w<o+2;w++)x.pbox[w]=u[w]^v[g],g++,g>=_&&(g=0);let C=0,y=0,A=0;for(let w=0;w<o+2;w+=2)A=d(x,C,y),C=A.left,y=A.right,x.pbox[w]=C,x.pbox[w+1]=y;for(let w=0;w<4;w++)for(let b=0;b<256;b+=2)A=d(x,C,y),C=A.left,y=A.right,x.sbox[w][b]=C,x.sbox[w][b+1]=y;return!0}var m=c.Blowfish=i.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var x=this._keyPriorReset=this._key,v=x.words,_=x.sigBytes/4;p(l,v,_)}},encryptBlock:function(x,v){var _=d(l,x[v],x[v+1]);x[v]=_.left,x[v+1]=_.right},decryptBlock:function(x,v){var _=f(l,x[v],x[v+1]);x[v]=_.left,x[v+1]=_.right},blockSize:64/32,keySize:128/32,ivSize:64/32});s.Blowfish=i._createHelper(m)}(),e.Blowfish})}(wi)),wi.exports}(function(n,t){(function(e,s,r){n.exports=s(J(),Un(),zp(),jp(),Ke(),Hp(),Je(),Va(),Qr(),Up(),ja(),Gp(),$p(),Xp(),ri(),Zp(),Pe(),wt(),Yp(),Qp(),Kp(),Jp(),tf(),ef(),sf(),nf(),rf(),of(),af(),cf(),uf(),lf(),hf(),df(),pf())})(Q,function(e){return e})})(Ba);var ff=Ba.exports;const fc=qp(ff);function xc(n,t){const e=`${n}:${t}`,s=fc.SHA256(e).toString(fc.enc.Hex);return`${s.substring(0,8)}-${s.substring(8,12)}-4${s.substring(13,16)}-${"89AB"[parseInt(s.substring(17,18),16)%4]}${s.substring(18,21)}-${s.substring(21,33)}`}var It=(n=>(n.AudioInput="audioInput",n.AudioOutput="audioOutput",n.MidiInput="midiInput",n.MidiOutput="midiOutput",n.ForwardAudioInput="forwardAudioInput",n.ForwardAudioOutput="forwardAudioOutput",n))(It||{});const xf=["audioInput","audioOutput","forwardAudioInput","forwardAudioOutput"],mf=["midiInput","midiOutput"],_f=["audioInput","midiInput","forwardAudioInput"],gf=["audioOutput","midiOutput","forwardAudioOutput"];function Gn(n,t){n.plug(t)}function vf(n,t){n.connections.some(e=>e.id===t.id)&&n.unPlug(t)}class _e{constructor(t,e){M(this,"id");M(this,"ioType");M(this,"name");M(this,"plugableModule");M(this,"connections",[]);this.plugableModule=t,this.id=xc(t.id,e.name),Object.assign(this,e)}static unPlugAll(t){t.connections.forEach(e=>t.unPlug(e))}plug(t,e=!0){this.connections.push(t),e&&t.plug(this,!1)}unPlug(t,e=!0){this.connections=this.connections.filter(s=>s.id!==t.id),e&&t.unPlug(this,!1)}get isInput(){return _f.indexOf(this.ioType)>-1}get isOutput(){return gf.indexOf(this.ioType)>-1}get isAudio(){return xf.indexOf(this.ioType)>-1}get isMidi(){return mf.indexOf(this.ioType)>-1}serialize(){return{id:this.id,name:this.name,moduleId:this.plugableModule.id,moduleName:this.plugableModule.name,ioType:this.ioType}}}class mc extends _e{constructor(t,e){super(t,e),this.checkNameValidity()}get voices(){return this.subModules.length}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=t%this.voices,s=this.subModules.find(r=>r.voiceNo===e);if(!s)throw Error(`Submodule with voiceNo ${t} not found`);return s}get subIOs(){const t=[];for(let e=0;e<this.voices;e++)t.push(this.subIO(e));return t}subIO(t){const s=(this.ioType.includes("Input")?this.subModule(t).inputs:this.subModule(t).outputs).findByName(this.name);if(!s)throw Error(`Could not forward io ${this.name}`);return s}plug(t,e=!0){this.plugUnplug(t,e,!0)}unPlug(t,e=!0){this.plugUnplug(t,e,!1)}unPlugAll(){_e.unPlugAll(this)}plugUnplug(t,e,s){if(s?super.plug(t,e):super.unPlug(t,e),!e&&(t instanceof Ei||t instanceof Qs))return;const r=s?Gn:vf;if(t instanceof Ei||t instanceof Qs){const i=Math.max(this.voices,t.voices);for(let c=0;c<i;c++){const o=this.subIO(c),u=t.subIO(c);r(o,u)}}else for(let i=0;i<this.voices;i++){const c=this.subIO(i);r(c,t)}}checkNameValidity(){if(!this.subIO(0))throw Error("You should forward to existing input")}}class Qs extends mc{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}}class Ei extends mc{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}}class yf extends _e{constructor(e,s){super(e,s);M(this,"internalModule");this.internalModule=s.internalModule}plug(e,s=!0){super.plug(e,s)}unPlug(e,s=!0){super.unPlug(e,s)}unPlugAll(){_e.unPlugAll(this)}}class Cf extends _e{constructor(e,s){super(e,s);M(this,"internalModule");this.internalModule=s.internalModule}plug(e,s=!0){super.plug(e,s),!(e instanceof Qs)&&this.internalModule.connect(e.internalModule)}unPlug(e,s=!0){if(super.unPlug(e,s),!(e instanceof Qs))try{this.internalModule.disconnect(e.internalModule)}catch(r){console.error(r)}}unPlugAll(){_e.unPlugAll(this)}}class _c extends _e{constructor(e,s){super(e,s);M(this,"onMidiEvent");this.onMidiEvent=s.onMidiEvent}plug(e,s=!0){super.plug(e,s)}unPlug(e,s=!0){super.unPlug(e,s)}unPlugAll(){_e.unPlugAll(this)}}class Af extends _e{constructor(e,s){super(e,s);M(this,"onMidiEvent",e=>{this.midiConnections.forEach(s=>{s.onMidiEvent(e)})})}plug(e,s=!0){super.plug(e,s)}unPlug(e,s=!0){super.unPlug(e,s)}unPlugAll(){_e.unPlugAll(this)}get midiConnections(){return this.connections.filter(e=>e instanceof _c)}}class $n{constructor(t){M(this,"plugableModule");M(this,"collection",[]);this.plugableModule=t}add(t){let e;switch(t.ioType){case It.AudioInput:if(this.plugableModule instanceof Qt)throw Error("PolyModule is not supported");e=new yf(this.plugableModule,t);break;case It.AudioOutput:if(this.plugableModule instanceof Qt)throw Error("PolyModule is not supported");e=new Cf(this.plugableModule,t);break;case It.MidiInput:e=new _c(this.plugableModule,t);break;case It.MidiOutput:e=new Af(this.plugableModule,t);break;case It.ForwardAudioInput:if(this.plugableModule instanceof Ht)throw Error("MonoModule is not supported");e=new Qs(this.plugableModule,t);break;case It.ForwardAudioOutput:if(this.plugableModule instanceof Ht)throw Error("MonoModule is not supported");e=new Ei(this.plugableModule,t);break;default:throw Error("Unknown IOType")}return this.collection.push(e),e}unPlugAll(){this.collection.forEach(t=>t.unPlugAll())}find(t){return this.collection.find(e=>e.id===t)}findByName(t){return this.collection.find(e=>e.name===t)}serialize(){return this.collection.map(t=>t.serialize())}}class Xn{connect(){throw Error("This module is not connectable")}disconnect(){throw Error("This module is not connectable")}dispose(){}}class gc{constructor(t,e){M(this,"id");M(this,"name");M(this,"internalModule");M(this,"inputs");M(this,"outputs");M(this,"voiceNo");M(this,"updatedAt");M(this,"_props",{});M(this,"triggerAttack",(t,e)=>{throw Error("triggerAttack not implemented")});M(this,"triggerRelease",(t,e)=>{throw Error("triggerRelease not implemented")});M(this,"onMidiEvent",t=>{if(t.voiceNo!==void 0&&t.voiceNo!==this.voiceNo)return;const{note:e,triggeredAt:s}=t;switch(t.type){case"noteOn":{const{duration:r}=e;if(this.triggerer(this.triggerAttack,e,s),r){const i=s+lp(r).toSeconds();this.triggerer(this.triggerRelease,e,i)}break}case"noteOff":this.triggerer(this.triggerRelease,e,s);break;default:throw Error("This type is not a note")}});this.internalModule=t,this.id=e.id||Lr(),delete e.id,this.inputs=new $n(this),this.outputs=new $n(this),Object.assign(this,e)}set props(t){t&&(this.updatedAt=new Date,Object.assign(this,t))}get props(){return this._props}plug(t,e,s){const r=this.outputs.findByName(e);if(!r)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(s);if(!i)throw Error(`Input ${s} not exist`);Gn(i,r)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll(),this.internalModule.dispose()}triggerer(t,e,s){t(e,s)}serialize(){const t=this.constructor;return{id:this.id,name:this.name,type:t.moduleName,props:this.props,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}registerMidiInput(t){return this.inputs.add({...t,ioType:It.MidiInput})}registerAudioInput(t){return this.inputs.add({...t,ioType:It.AudioInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:It.MidiOutput})}registerAudioOutput(t){return this.outputs.add({...t,ioType:It.AudioOutput})}registerBasicOutputs(){this.registerAudioOutput({name:"output",internalModule:this.internalModule})}registerBasicInputs(){this.registerAudioInput({name:"input",internalModule:this.internalModule}),this.registerDefaultMidiInput()}registerDefaultMidiInput(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}}M(gc,"moduleName");const Ht=gc,Kn=class Kn{constructor(t){M(this,"id");M(this,"child");M(this,"_name");M(this,"audioModules");M(this,"inputs");M(this,"outputs");M(this,"_numberOfVoices");M(this,"onMidiEvent",t=>{const e=t.voiceNo||0,s=this.findVoice(e);s==null||s.onMidiEvent(t)});this.id=t.id||Lr(),delete t.id,this.audioModules=[];const{child:e,props:s,...r}=t;this.child=e,Object.assign(this,r),this.numberOfVoices=t.numberOfVoices||1,this.inputs=new $n(this),this.outputs=new $n(this),Object.assign(this,{props:s})}get name(){return this._name}set name(t){this._name=t,this.audioModules.forEach(e=>e.name=t)}get props(){if(this.audioModules.length===0)throw Error("There isn't any initialized module");return this.audioModules[0].props}set props(t){Object.assign(this,t),this.audioModules.forEach(e=>e.props=t)}get numberOfVoices(){return this._numberOfVoices}set numberOfVoices(t){this._numberOfVoices=t,this.adjustNumberOfModules()}plug(t,e,s){const r=this.outputs.findByName(e);if(!r)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(s);if(!i)throw Error(`Input ${s} not exist`);Gn(i,r)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.unPlugAll(),this.audioModules.forEach(t=>t.dispose())}serialize(){if(this.audioModules.length===0)throw Error("There isn't any initialized module");const t=this.constructor;return{...this.audioModules[0].serialize(),id:this.id,type:t.moduleName,numberOfVoices:this.numberOfVoices,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}find(t){const e=this.audioModules.find(t);if(!e)throw Error("Audio module not found");return e}findVoice(t){return this.audioModules.find(e=>e.voiceNo===t)}registerForwardAudioInput(t){return this.inputs.add({...t,ioType:It.ForwardAudioInput})}registerForwardAudioOutput(t){return this.outputs.add({...t,ioType:It.ForwardAudioOutput})}registerMidiInput(t){return this.inputs.add({...t,ioType:It.MidiInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:It.MidiOutput})}registerBasicOutputs(){this.registerForwardAudioOutput({name:"output"})}registerBasicInputs(){this.registerForwardAudioInput({name:"input"}),this.registerMidiIn()}registerMidiIn(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}adjustNumberOfModules(){if(this.audioModules.length!==this.numberOfVoices){if(this.audioModules.length>this.numberOfVoices){const t=this.audioModules.pop();t==null||t.dispose()}else{const t=this.audioModules.length,e=xc(this.id,t.toString()),s=t===0?{}:this.props,r=new this.child({id:e,name:this.name,props:{...s,voiceNo:t}});if(r instanceof Kn)throw Error("Polymodule not supported");this.audioModules.push(r)}this.adjustNumberOfModules()}}};M(Kn,"moduleName");let Qt=Kn;const bf=2,Zn=.01,vc=1,wf=0,Di={attack:Zn,decay:Zn,sustain:vc,release:Zn};class Ti extends Ht{constructor(e){const{id:s,name:r,props:i,internalModule:c}=e;super(c,{id:s,name:r,props:{...Di,...i}});M(this,"activeNote");M(this,"triggeredAt");M(this,"triggerAttack",(e,s)=>{this.activeNote=e.fullName,this.triggeredAt=s,this.internalModule.triggerAttack(s,e.velocity)});M(this,"triggerRelease",(e,s)=>{this.activeNote&&this.activeNote!==e.fullName||(this.internalModule.triggerRelease(s),this.activeNote=void 0)});this.registerBasicInputs(),this.registerBasicOutputs()}get attack(){return this._props.attack}set attack(e){this.setStage("attack",e)}get decay(){return this._props.decay}set decay(e){this.setStage("decay",e)}get sustain(){return this._props.sustain}set sustain(e){this.setStage("sustain",e)}get release(){return this._props.release}set release(e){this.setStage("release",e)}setStage(e,s){const r=s===0?this.minTime(e):this.maxTime(e)*s;this._props={...this.props,[e]:s},this.internalModule[e]=r}maxTime(e){return e==="sustain"?vc:bf}minTime(e){return e==="sustain"?wf:Zn}}class ki extends Qt{constructor(t){const{id:e,name:s,child:r,props:i}=t;super({id:e,name:s,child:r,props:{...Di,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class Ef extends Ti{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,internalModule:new De,props:r})}}class Fi extends ki{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,child:Ef,props:{...Di,...r}})}}M(Fi,"moduleName","Envelope");class Df extends Ti{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,internalModule:new Rn,props:r})}}class Bi extends ki{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,child:Df,props:r})}}M(Bi,"moduleName","AmpEnvelope");const Tf={amount:0};class kf extends Ti{constructor(e){const{id:s,name:r,props:i}=e;super({id:s,name:r,internalModule:new Pn,props:{...Tf,...i}});M(this,"_frequency");M(this,"_amount");M(this,"filter")}get frequency(){return this._frequency}set frequency(e){this._frequency=e,this.internalModule.baseFrequency=e}get amount(){return this._amount}set amount(e){this._amount=e,this.internalModule.octaves=e}}class Si extends ki{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,child:kf,props:r})}}M(Si,"moduleName","FreqEnvelope");const yc={noteName:"C3",fine:0,coarse:0,wave:"sine",range:0,volume:0};class Ff extends Ht{constructor(e){const{id:s,name:r,props:i}=e;super(new Ft,{id:s,name:r,props:{...yc,...i}});M(this,"_note");M(this,"_fineMulti");M(this,"_fineSignal");M(this,"triggerAttack",(e,s)=>{this.setNoteAt(e,s),this.start(s)});M(this,"triggerRelease",()=>{});this.registerInputs(),this.registerBasicOutputs(),this.start(gs())}get note(){return this._note}setNoteAt(e,s){this._note=this.getNote(e),this.updateFrequency(s)}set note(e){this._note=this.getNote(e),this.updateFrequency()}get noteName(){return this._props.noteName}set noteName(e){this._props={...this.props,noteName:e},this.note=new dt(this.noteName)}get fineSingal(){return this._fineSignal?this._fineSignal:(this._fineSignal=new ot,this._fineMulti=new me(100),this._fineSignal.connect(this._fineMulti),this._fineMulti.connect(this.internalModule.detune),this._fineSignal)}get fine(){return this._props.fine}set fine(e){this._props={...this.props,fine:e},this.fineSingal.value=this.fine}get coarse(){return this._props.coarse}set coarse(e){this._props={...this.props,coarse:Math.floor(e)},this.updateFrequency()}get wave(){return this._props.wave}set wave(e){this._props={...this.props,wave:e},this.internalModule.type=this.wave}get volume(){return this._props.volume}set volume(e){this._props={...this.props,volume:e},this.internalModule.volume.value=this.volume}get range(){return this._props.range}set range(e){this._props={...this.props,range:e},this.updateFrequency()}start(e){if(!oe.isStarted)return;this.internalModule.state==="started"?this.internalModule.restart(e):this.internalModule.start(e)}stop(e){this.internalModule.stop(e)}updateFrequency(e){if(!this.note)return;const s=this.note.adjustFrequency(this.range,this.coarse);e?this.internalModule.frequency.linearRampToValueAtTime(s,e):this.internalModule.frequency.value=s}getNote(e){return e instanceof dt?e:new dt(e)}registerInputs(){this.registerAudioInput({name:"fine",internalModule:this.fineSingal})}}class Ni extends Qt{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,child:Ff,props:{...yc,...r}}),this.registerBasicOutputs(),this.registerMidiIn(),this.registerForwardAudioInput({name:"fine"})}start(t){this.audioModules.forEach(e=>e.start(t))}stop(t){this.audioModules.forEach(e=>e.stop(t))}}M(Ni,"moduleName","Oscillator");const Cc=2e4,Ac={cutoff:Cc,resonance:0,envelopeAmount:0,slope:-24,filterType:"lowpass"};class Bf extends Ht{constructor(e){const{id:s,name:r,props:i}=e;super(new yp({type:"lowpass"}),{id:s,name:r,props:{...Ac,...i}});M(this,"_cutoff");M(this,"_amount");this._cutoff=new On,this._cutoff.connect(this.internalModule.frequency),this._amount=new me,this._amount.connect(this._cutoff),this.updateAmountFactor(),this.registerBasicInputs(),this.registerOutputs()}get cutoff(){return this._props.cutoff}set cutoff(e){this._cutoff&&(this._cutoff.addend.value=e),this._props={...this.props,cutoff:e},this.updateAmountFactor()}get filterType(){return this._props.filterType}set filterType(e){this._props={...this.props,filterType:e},this.internalModule.type=e}get slope(){return this._props.slope}set slope(e){this._props={...this.props,slope:e},this.internalModule.rolloff=e}get frequency(){return this.internalModule.frequency}get resonance(){return this._props.resonance}set resonance(e){this._props={...this.props,resonance:e},this.internalModule.Q.value=e}get envelopeAmount(){return this._props.envelopeAmount}set envelopeAmount(e){this._props={...this.props,envelopeAmount:e},this.updateAmountFactor()}registerOutputs(){this.registerBasicOutputs(),this.registerAudioInput({name:"cutoff",internalModule:this._amount})}updateAmountFactor(){if(!this._amount)return;const e=this.envelopeAmount>0?this.envelopeAmount*Math.abs(Cc-this.cutoff):this.envelopeAmount*Math.abs(1-this.cutoff);this._amount.factor.value=e}}class Oi extends Qt{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,child:Bf,props:{...Ac,...r}}),this.registerBasicInputs(),this.registerOutputs()}registerOutputs(){this.registerBasicOutputs(),this.registerForwardAudioInput({name:"cutoff"})}}M(Oi,"moduleName","Filter");class Mi extends Ht{constructor({id:t}){super(Dp(),{id:t,name:"Master"}),this.registerAudioInput({name:"input",internalModule:this.internalModule})}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll()}}M(Mi,"moduleName","Master");class Ii extends Qt{constructor(e){const{id:s,name:r,props:i}=e;super({id:s,name:r,child:Sf,props:i});M(this,"midiOutput");M(this,"onMidiEvent",e=>{let s;switch(e.type){case"noteOn":s=this.findFreeVoice();break;case"noteOff":s=this.audioModules.find(r=>r.activeNote===e.note.fullName);break;default:throw Error("This type is not a note")}s&&(s.midiTriggered(e),e.voiceNo=s.voiceNo,this.midiOutput.onMidiEvent(e))});this.registerInputs(),this.registerOutputs(),this.polyNumber=this.numberOfVoices}set polyNumber(e){super.numberOfVoices=e}get polyNumber(){return this.numberOfVoices}serialize(){const e=super.serialize();return{...e,props:{...e.props,polyNumber:this.polyNumber}}}findFreeVoice(){let e=this.audioModules.find(s=>!s.activeNote);return e||(e=this.audioModules.sort((s,r)=>!s||!r?0:s.triggeredAt-r.triggeredAt)[0]),e}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}M(Ii,"moduleName","VoiceScheduler");class Sf extends Ht{constructor(e){const{id:s,name:r,props:i}=e;super(new Xn,{id:s,name:r,props:i});M(this,"midiEvent");M(this,"activeNote");M(this,"triggeredAt");M(this,"midiTriggered",e=>{if(this.voiceNo===void 0)throw Error("Voice without voiceNo");const{triggeredAt:s,note:r,type:i}=e;if(!r)return;const c=r.fullName;switch(i){case"noteOn":this.activeNote=c,this.triggeredAt=s,this.midiEvent=e;break;case"noteOff":this.activeNote=null,this.midiEvent=null;break;default:throw Error("This type is not a note")}})}}const Nf={selectedId:null};class Ri extends Ht{constructor(e){const{id:s,name:r,props:i}=e;super(new Xn,{id:s,name:r,props:{...Nf,...i}});M(this,"midiOutput");M(this,"forwardMidiEvent",e=>{this.midiOutput.onMidiEvent(e)});this.registerOutputs(),this.addEventListener(this.selectedId)}get selectedId(){return this._props.selectedId}set selectedId(e){this.removeEventListener(),this._props={...this.props,selectedId:e},this.addEventListener(e)}dispose(){this.removeEventListener(),super.dispose()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}addEventListener(e){if(!this.onMidiEvent||!e)return;const s=oe.midiDeviceManager.find(e);s==null||s.addEventListener(this.forwardMidiEvent)}removeEventListener(){if(!this.selectedId)return;const e=oe.midiDeviceManager.find(this.selectedId);e==null||e.removeEventListener(this.forwardMidiEvent)}}M(Ri,"moduleName","MidiSelector");const bc={volume:-1/0};class Of extends Ht{constructor(e){const{id:s,name:r,props:i}=e;super(new Rs,{id:s,name:r,props:{...bc,...i}});M(this,"triggerAttack",(e,s)=>{const r=20*Math.log10(e.velocity);this.internalModule.volume.exponentialRampToValueAtTime(r,s)});M(this,"triggerRelease",()=>{});this.registerBasicInputs(),this.registerBasicOutputs()}get volume(){return this._props.volume}set volume(e){this._props={...this.props,volume:e},this.internalModule.volume.value=this.volume}}class Pi extends Qt{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,child:Of,props:{...bc,...r}}),this.registerBasicInputs(),this.registerBasicOutputs()}}M(Pi,"moduleName","Volume");const Mf={activeNotes:[]};class qi extends Ht{constructor(e){const{id:s,name:r,props:i}=e;super(new Xn,{id:s,name:r,props:{...Mf,...i}});M(this,"midiOutput");M(this,"triggerAttack",(e,s)=>{this.activeNotes=[...this.activeNotes,e.fullName],oe._triggerPropsUpdate(this.id,this.props),this.sendMidi(ie.fromNote(e,!0,s))});M(this,"triggerRelease",(e,s)=>{this.activeNotes=this.activeNotes.filter(r=>r!==e.fullName),oe._triggerPropsUpdate(this.id,this.props),this.sendMidi(ie.fromNote(e,!1,s))});this.registerInputs(),this.registerOutputs()}get activeNotes(){return this._props.activeNotes}set activeNotes(e){this._props={...this.props,activeNotes:e}}sendMidi(e){this.midiOutput.onMidiEvent(e)}serialize(){return{...super.serialize(),activeNotes:this.activeNotes}}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}M(qi,"moduleName","VirtualMidi");const If={wet:1};class Yn extends Ht{constructor(t){const{id:e,name:s,internalModule:r,props:i}=t;super(r,{id:e,name:s,props:{...If,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}get wet(){return this._props.wet}set wet(t){this._props={...this.props,wet:t},this.internalModule.wet.value=this.wet}}const Rf={decay:1.5,preDelay:.025};class Vi extends Yn{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,internalModule:new wp,props:{...Rf,...r}})}get decay(){return this._props.decay}set decay(t){this._props={...this.props,decay:t},this.internalModule.decay=this.decay}get preDelay(){return this._props.preDelay}set preDelay(t){this._props={...this.props,preDelay:t},this.internalModule.preDelay=this.preDelay}}M(Vi,"moduleName","Reverb");const Pf={delayTime:1,feedback:.3};class Wi extends Yn{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,internalModule:new zn,props:{...Pf,...r}})}get delayTime(){return this._props.delayTime}set delayTime(t){this._props={...this.props,delayTime:t},this.internalModule.delayTime.value=this.delayTime}get feedback(){return this._props.feedback}set feedback(t){this._props={...this.props,feedback:t},this.internalModule.feedback.value=this.feedback}}M(Wi,"moduleName","Delay");const qf={drive:.3};class Li extends Yn{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,internalModule:new bp,props:{...qf,...r}})}get drive(){return this._props.drive}set drive(t){this._props={...this.props,drive:t},this.internalModule.distortion=this.drive}}M(Li,"moduleName","Distortion");const Vf={bits:16};class zi extends Yn{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,internalModule:new Ap,props:{...Vf,...r}})}get bits(){return this._props.bits}set bits(t){this._props={...this.props,bits:t},this.internalModule.bits.value=this.bits}}M(zi,"moduleName","BitCrusher");const Wf=()=>({sequences:[],steps:16,bars:1});class ji extends Ht{constructor(e){const{id:s,name:r,props:i}=e;super(new Xn,{id:s,name:r,props:{...Wf(),...i}});M(this,"midiOutput");M(this,"part");M(this,"onPartEvent",(e,s)=>{s.active&&ie.fromSequence(s,e).forEach(r=>{this.midiOutput.onMidiEvent(r)})});this.initializePart(),this.start(gs()),this.registerOutputs()}get props(){return super.props}set props(e){this.sequences||(this._props.sequences=[]),super.props={...this.props,...e},this.adjust()}get steps(){return this._props.steps}set steps(e){this._props={...this.props,steps:e}}get bars(){return this.props.bars}set bars(e){this._props={...this.props,bars:e}}get sequences(){return this._props.sequences}set sequences(e){const s=e;this._props={...this.props,sequences:s}}start(e){oe.isStarted&&this.part.start(e)}stop(){this.part.stop()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}initializePart(){this.part=new Ys(this.onPartEvent,[]),this.part.loop=!0,this.part.loopEnd=this.loopEnd}adjust(){this.part&&(this.adjustNumberOfBars(),this.adjustNumberOfSteps(),this.updateBarParts())}adjustNumberOfBars(){const s=this.sequences.length-this.bars,r=[...this.sequences];s!==0&&(s>0?r.pop():r.push([]),this.sequences=r,this.adjustNumberOfBars())}adjustNumberOfSteps(e=0){if(!this.bars)return;const s=[...this.sequences],r=[...s[e]],i=r.length-this.steps;if(i===0){if(e===this.bars-1)return;this.adjustNumberOfSteps(e+1);return}if(i>0)r.pop();else{const c=r.length;r.push({active:!1,time:`${e}:0:${c}`,notes:[]})}s[e]=r,this.sequences=s,this.adjustNumberOfSteps(e)}updateBarParts(){this.part.clear(),this.sequences.forEach(e=>{e.forEach(s=>this.part.add(s.time,s))}),this.part.loopEnd=this.loopEnd}get loopEnd(){return`${this.bars}:0:0`}}M(ji,"moduleName","Sequencer");const wc={wave:"sine",frequency:.1,min:0,max:1,amount:1};class Lf extends Ht{constructor(e){const{id:s,name:r,props:i}=e;super(new gp,{id:s,name:r,props:{...wc,...i}});M(this,"triggerAttack",(e,s)=>{this.start(s)});M(this,"triggerRelease",()=>{});this.registerBasicOutputs(),this.registerInputs(),this.start(gs())}get wave(){return this._props.wave}set wave(e){this._props={...this.props,wave:e},this.internalModule.type=this.wave}get min(){return this._props.min}set min(e){this._props={...this.props,min:e},this.internalModule.min=this.min}get max(){return this._props.max}set max(e){this._props={...this.props,max:e},this.internalModule.max=this.max}get frequency(){return this._props.frequency}set frequency(e){this._props={...this.props,frequency:e},this.internalModule.frequency.value=this.frequency}get amount(){return this._props.amount}set amount(e){this._props={...this.props,amount:e},this.internalModule.amplitude.value=this.amount}start(e){if(!oe.isStarted)return;this.internalModule.state==="started"?(this.internalModule.stop(e-2),this.internalModule.start(e)):this.internalModule.start(e)}stop(e){this.internalModule.stop(e)}registerInputs(){this.registerAudioInput({name:"amount",internalModule:this.internalModule.amplitude})}}class Hi extends Qt{constructor(t){const{id:e,name:s,props:r}=t;super({id:e,name:s,child:Lf,props:{...wc,...r}}),this.registerBasicOutputs(),this.registerMidiIn(),this.registerForwardAudioInput({name:"amount"})}start(t){this.audioModules.forEach(e=>e.start(t))}stop(t){this.audioModules.forEach(e=>e.stop(t))}}M(Hi,"moduleName","LFO");function zf(n){const{id:t,type:e,name:s,props:r}=n,i=jf(e);return new i({id:t,name:s,props:r})}function jf(n){switch(n){case Ni.moduleName:return Ni;case Fi.moduleName:return Fi;case Bi.moduleName:return Bi;case Si.moduleName:return Si;case Oi.moduleName:return Oi;case Pi.moduleName:return Pi;case Mi.moduleName:return Mi;case Ii.moduleName:return Ii;case Ri.moduleName:return Ri;case qi.moduleName:return qi;case Vi.moduleName:return Vi;case Wi.moduleName:return Wi;case Li.moduleName:return Li;case zi.moduleName:return zi;case ji.moduleName:return ji;case Hi.moduleName:return Hi;default:throw Error(`Unknown module type ${n}`)}}function Hf(n){const t=n.id||Lr();return{...n,id:t}}function Uf(n){Object.values(oe.modules).forEach(e=>{e.unPlugAll()}),n.map(e=>{const{sourceId:s,sourceIOId:r,destinationId:i,destinationIOId:c}=e,o=oe.findById(s),u=oe.findById(i),a=o.outputs.find(r),l=u.inputs.find(c);if(!l||!a)throw Error("IO not found");return Gn(l,a),!0}).every(e=>e)?console.log("######## Routes succesfully applied"):console.log("######## Routes partialy applied")}const ts=class ts{constructor(){M(this,"midiDeviceManager");M(this,"context");M(this,"propsUpdateCallbacks");M(this,"_isStarted",!1);M(this,"modules");M(this,"routes");this.modules={},this.routes={},this.propsUpdateCallbacks=[]}static getInstance(){return ts.instance||(ts.instance=new ts),ts.instance}initialize(t){return new Promise(e=>{if(this.context)return e({});this.context=new hs(t.context),_a(this.context),this.context.transport.start(),this.midiDeviceManager=new Fa,setTimeout(()=>{e({})},0)})}addModule(t){const{id:e,name:s,numberOfVoices:r,type:i,props:c={}}=t,o=zf({id:e,name:s,type:i,props:{}});return o instanceof Qt&&r&&(o.numberOfVoices=r),o.props=c,this.modules[o.id]=o,this.updateRoutes(),o.serialize()}removeModule(t){this.modules[t].dispose();const e=this.moduleRouteIds(t);return e.forEach(s=>delete this.routes[s]),this.updateRoutes(),delete this.modules[t],e}updateModule(t){const{id:e,changes:{name:s,numberOfVoices:r,props:i={}}}=t,c=this.findById(e);return c.props=i,s&&(c.name=s),c instanceof Qt&&r&&(c.numberOfVoices=r),r&&this.updateRoutes(),c.serialize()}onPropsUpdate(t){this.propsUpdateCallbacks.push(t)}_triggerPropsUpdate(t,e){this.propsUpdateCallbacks.forEach(s=>s(t,e))}addRoute(t){if(!this.validRoute(t))throw Error("Invalid route, incompatible IOs");const e=Hf(t),s={...this.routes,[e.id]:e};return this.routes=s,this.updateRoutes(),e}validRoute(t){const{sourceId:e,sourceIOId:s,destinationId:r,destinationIOId:i}=t,c=this.findById(e).outputs.find(s),o=this.findById(r).inputs.find(i);return!!(c!=null&&c.isMidi&&(o!=null&&o.isMidi))||!!(c!=null&&c.isAudio&&(o!=null&&o.isAudio))}removeRoute(t){delete this.routes[t],this.updateRoutes()}triggerVirtualMidi(t,e,s){this.findById(t).sendMidi(ie.fromNote(e,s==="noteOn"))}dispose(){Object.values(this.modules).forEach(t=>{t.dispose()}),this.modules={},this.routes={}}findById(t){const e=this.modules[t];if(!e)throw Error(`Audio module with id ${t} not exists`);return e}get isStarted(){return this.context!==void 0&&this.context.transport.state==="started"&&this._isStarted}start(){const t=gs();this._isStarted=!0,this.updateRoutes(),Object.values(this.modules).forEach(e=>{const s=e;s.start&&s.start(t)})}stop(){const t=gs();Object.values(this.modules).forEach(e=>{const s=e;s.stop&&s.stop(t)}),this._isStarted=!1}get bpm(){return this.context.transport.bpm.value}set bpm(t){this.context.transport.bpm.value=t}updateRoutes(){Uf(Object.values(this.routes))}moduleRouteIds(t){const e={...this.routes};return Object.keys(e).filter(r=>{const{sourceId:i,destinationId:c}=e[r];return i===t||c===t})}};M(ts,"instance");let Ui=ts;const oe=Ui.getInstance();Bt.MidiDevice=Vr,Bt.MidiDeviceManager=Fa,Bt.Note=dt,Bt.default=oe,Object.defineProperties(Bt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});