@blibliki/engine 0.1.18 → 0.1.20

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 (54) hide show
  1. package/dist/build/Engine.d.ts +81 -0
  2. package/dist/build/core/IO/AudioNode.d.ts +35 -0
  3. package/dist/build/core/IO/Collection.d.ts +13 -0
  4. package/dist/build/core/IO/ForwardNode.d.ts +38 -0
  5. package/dist/build/core/IO/MidiNode.d.ts +30 -0
  6. package/dist/build/core/IO/Node.d.ts +36 -0
  7. package/dist/build/core/IO/index.d.ts +12 -0
  8. package/dist/build/core/Module/MonoModule.d.ts +67 -0
  9. package/dist/build/core/Module/PolyModule.d.ts +57 -0
  10. package/dist/build/core/Module/index.d.ts +6 -0
  11. package/dist/build/core/Note/frequencyTable.d.ts +4 -0
  12. package/dist/build/core/Note/index.d.ts +28 -0
  13. package/dist/build/core/midi/MidiDevice.d.ts +25 -0
  14. package/dist/build/core/midi/MidiDeviceManager.d.ts +13 -0
  15. package/dist/build/core/midi/MidiEvent.d.ts +21 -0
  16. package/dist/build/core/midi/index.d.ts +5 -0
  17. package/dist/build/index.d.ts +9 -0
  18. package/dist/build/modules/BitCrusher.d.ts +16 -0
  19. package/dist/build/modules/Delay.d.ts +19 -0
  20. package/dist/build/modules/Distortion.d.ts +16 -0
  21. package/dist/build/modules/Effect.d.ts +19 -0
  22. package/dist/build/modules/Envelope/AmpEnvelope.d.ts +18 -0
  23. package/dist/build/modules/Envelope/Base.d.ts +66 -0
  24. package/dist/build/modules/Envelope/FreqEnvelope.d.ts +25 -0
  25. package/dist/build/modules/Envelope/index.d.ts +3 -0
  26. package/dist/build/modules/Filter.d.ts +37 -0
  27. package/dist/build/modules/Master.d.ts +11 -0
  28. package/dist/build/modules/MidiSelector.d.ts +21 -0
  29. package/dist/build/modules/Oscillator.d.ts +51 -0
  30. package/dist/build/modules/Reverb.d.ts +19 -0
  31. package/dist/build/modules/Sequencer.d.ts +42 -0
  32. package/dist/build/modules/VirtualMidi.d.ts +32 -0
  33. package/dist/build/modules/VoiceScheduler.d.ts +43 -0
  34. package/dist/build/modules/Volume.d.ts +26 -0
  35. package/dist/build/modules/index.d.ts +16 -0
  36. package/dist/build/routes.d.ts +18 -0
  37. package/dist/build/types.d.ts +5 -0
  38. package/dist/build/utils.d.ts +1 -0
  39. package/dist/main.cjs.js +2 -2
  40. package/dist/main.cjs.js.map +1 -0
  41. package/dist/main.esm.js +33 -0
  42. package/dist/main.esm.js.map +1 -0
  43. package/package.json +14 -9
  44. package/src/modules/Envelope/Base.ts +3 -0
  45. package/src/modules/MidiSelector.ts +3 -3
  46. package/src/modules/VirtualMidi.ts +4 -2
  47. package/.eslintrc.js +0 -14
  48. package/.parcerc +0 -6
  49. package/jest.config.js +0 -19
  50. package/rollup.config.mjs +0 -21
  51. package/test/MockingModules.ts +0 -27
  52. package/test/Module/Oscillator.test.ts +0 -9
  53. package/test/core/IO.test.ts +0 -172
  54. package/tsconfig.json +0 -22
package/dist/main.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t="14.7.77",e=(t,e,n)=>({endTime:e,insertTime:n,type:"exponentialRampToValue",value:t}),n=(t,e,n)=>({endTime:e,insertTime:n,type:"linearRampToValue",value:t}),s=(t,e)=>({startTime:e,type:"setValue",value:t}),i=(t,e,n)=>({duration:n,startTime:e,type:"setValueCurve",values:t}),r=(t,e,{startTime:n,target:s,timeConstant:i})=>s+(e-s)*Math.exp((n-t)/i),o=t=>"exponentialRampToValue"===t.type,a=t=>"linearRampToValue"===t.type,u=t=>o(t)||a(t),c=t=>"setValue"===t.type,l=t=>"setValueCurve"===t.type,h=(t,e,n,s)=>{const i=t[e];return void 0===i?s:u(i)||c(i)?i.value:l(i)?i.values[i.values.length-1]:r(n,h(t,e-1,i.startTime,s),i)},p=(t,e,n,s,i)=>void 0===n?[s.insertTime,i]:u(n)?[n.endTime,n.value]:c(n)?[n.startTime,n.value]:l(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,h(t,e-1,n.startTime,i)],d=t=>"cancelAndHold"===t.type,f=t=>"cancelScheduledValues"===t.type,_=t=>d(t)||f(t)?t.cancelTime:o(t)||a(t)?t.endTime:t.startTime,m=(t,e,n,{endTime:s,value:i})=>n===i?i:0<n&&0<i||n<0&&i<0?n*(i/n)**((t-e)/(s-e)):0,g=(t,e,n,{endTime:s,value:i})=>n+(t-e)/(s-e)*(i-n),v=(t,{duration:e,startTime:n,values:s})=>((t,e)=>{const n=Math.floor(e),s=Math.ceil(e);return n===s?t[n]:(1-(e-n))*t[n]+(1-(s-e))*t[s]})(s,(t-n)/e*(s.length-1)),y=t=>"setTarget"===t.type;class w{constructor(t){this._automationEvents=[],this._currenTime=0,this._defaultValue=t}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}add(t){const r=_(t);if(d(t)||f(t)){const a=this._automationEvents.findIndex((e=>f(t)&&l(e)?e.startTime+e.duration>=r:_(e)>=r)),c=this._automationEvents[a];if(-1!==a&&(this._automationEvents=this._automationEvents.slice(0,a)),d(t)){const t=this._automationEvents[this._automationEvents.length-1];if(void 0!==c&&u(c)){if(y(t))throw new Error("The internal list is malformed.");const s=l(t)?t.startTime+t.duration:_(t),i=l(t)?t.values[t.values.length-1]:t.value,a=o(c)?m(r,s,i,c):g(r,s,i,c),u=o(c)?e(a,r,this._currenTime):n(a,r,this._currenTime);this._automationEvents.push(u)}void 0!==t&&y(t)&&this._automationEvents.push(s(this.getValue(r),r)),void 0!==t&&l(t)&&t.startTime+t.duration>r&&(this._automationEvents[this._automationEvents.length-1]=i(new Float32Array([6,7]),t.startTime,r-t.startTime))}}else{const s=this._automationEvents.findIndex((t=>_(t)>r)),i=-1===s?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[s-1];if(void 0!==i&&l(i)&&_(i)+i.duration>r)return!1;const u=o(t)?e(t.value,t.endTime,this._currenTime):a(t)?n(t.value,r,this._currenTime):t;if(-1===s)this._automationEvents.push(u);else{if(l(t)&&r+t.duration>_(this._automationEvents[s]))return!1;this._automationEvents.splice(s,0,u)}}return!0}flush(t){const e=this._automationEvents.findIndex((e=>_(e)>t));if(e>1){const t=this._automationEvents.slice(e-1),n=t[0];y(n)&&t.unshift(s(h(this._automationEvents,e-2,n.startTime,this._defaultValue),n.startTime)),this._automationEvents=t}}getValue(t){if(0===this._automationEvents.length)return this._defaultValue;const e=this._automationEvents.findIndex((e=>_(e)>t)),n=this._automationEvents[e],s=(-1===e?this._automationEvents.length:e)-1,i=this._automationEvents[s];if(void 0!==i&&y(i)&&(void 0===n||!u(n)||n.insertTime>t))return r(t,h(this._automationEvents,s-1,i.startTime,this._defaultValue),i);if(void 0!==i&&c(i)&&(void 0===n||!u(n)))return i.value;if(void 0!==i&&l(i)&&(void 0===n||!u(n)||i.startTime+i.duration>t))return t<i.startTime+i.duration?v(t,i):i.values[i.values.length-1];if(void 0!==i&&u(i)&&(void 0===n||!u(n)))return i.value;if(void 0!==n&&o(n)){const[e,r]=p(this._automationEvents,s,i,n,this._defaultValue);return m(t,e,r,n)}if(void 0!==n&&a(n)){const[e,r]=p(this._automationEvents,s,i,n,this._defaultValue);return g(t,e,r,n)}return this._defaultValue}}const x=new WeakSet,b=new WeakMap,T=new WeakMap,A=new WeakMap,k=new WeakMap,C=new WeakMap,S=new WeakMap,O=new WeakMap,M=new WeakMap,E=new WeakMap,D={construct:()=>D},I=/^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]*);?/,R=(t,e)=>{const n=[];let s=t.replace(/^[\s]+/,""),i=s.match(I);for(;null!==i;){const t=i[1].slice(1,-1),r=i[0].replace(/([\s]+)?;?$/,"").replace(t,new URL(t,e).toString());n.push(r),s=s.slice(i[0].length).replace(/^[\s]+/,""),i=s.match(I)}return[n.join(";"),s]},N=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},B=t=>{if(!(t=>{try{new new Proxy(t,D)}catch{return!1}return!0})(t))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===t.prototype||"object"!=typeof t.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},P=(t,e)=>{const n=t.get(e);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},V=(t,e)=>{const n=Array.from(t).filter(e);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[s]=n;return t.delete(s),s},q=(t,e,n,s)=>{const i=P(t,e),r=V(i,(t=>t[0]===n&&t[1]===s));return 0===i.size&&t.delete(e),r},F=t=>P(S,t),j=t=>{if(x.has(t))throw new Error("The AudioNode is already stored.");x.add(t),F(t).forEach((t=>t(!0)))},z=t=>"port"in t,W=t=>{if(!x.has(t))throw new Error("The AudioNode is not stored.");x.delete(t),F(t).forEach((t=>t(!1)))},L=(t,e)=>{!z(t)&&e.every((t=>0===t.size))&&W(t)},U={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},H=(t,e)=>t.context===e,$=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},G=()=>new DOMException("","IndexSizeError"),X=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw G();throw t}})},Z={numberOfChannels:1},Y=-34028234663852886e22,Q=-Y,K=t=>x.has(t),J={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},tt=t=>P(b,t),et=t=>P(A,t),nt=(t,e)=>{const{activeInputs:n}=tt(t);n.forEach((n=>n.forEach((([n])=>{e.includes(t)||nt(n,[...e,t])}))));const s=(t=>"playbackRate"in t)(t)?[t.playbackRate]:z(t)?Array.from(t.parameters.values()):(t=>"frequency"in t&&"gain"in t)(t)?[t.Q,t.detune,t.frequency,t.gain]:(t=>"offset"in t)(t)?[t.offset]:(t=>!("frequency"in t)&&"gain"in t)(t)?[t.gain]:(t=>"detune"in t&&"frequency"in t)(t)?[t.detune,t.frequency]:(t=>"pan"in t)(t)?[t.pan]:[];for(const t of s){const n=et(t);void 0!==n&&n.activeInputs.forEach((([t])=>nt(t,e)))}K(t)&&W(t)},st=t=>{nt(t.destination,[])},it=t=>"context"in t,rt=t=>it(t[0]),ot=(t,e,n,s)=>{for(const e of t)if(n(e)){if(s)return!1;throw Error("The set contains at least one similar element.")}return t.add(e),!0},at=(t,e,[n,s],i)=>{ot(t,[e,n,s],(t=>t[0]===e&&t[1]===n),i)},ut=(t,[e,n,s],i)=>{const r=t.get(e);void 0===r?t.set(e,new Set([[n,s]])):ot(r,[n,s],(t=>t[0]===n),i)},ct=t=>"inputs"in t,lt=(t,e,n,s)=>{if(ct(e)){const i=e.inputs[s];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,s),[e,n,s]},ht=(t,e,n)=>{for(const s of t)if(s[0]===e&&s[1]===n)return t.delete(s),s;return null},pt=(t,e)=>{if(!F(t).delete(e))throw new Error("Missing the expected event listener.")},dt=(t,e,n)=>{const s=P(t,e),i=V(s,(t=>t[0]===n));return 0===s.size&&t.delete(e),i},ft=(t,e,n,s)=>{ct(e)?t.disconnect(e.inputs[s],n,0):t.disconnect(e,n,s)},_t=t=>P(T,t),mt=t=>P(k,t),gt=t=>O.has(t),vt=t=>!x.has(t),yt=(t,e)=>new Promise((n=>{if(null!==e)n(!0);else{const e=t.createScriptProcessor(256,1,1),s=t.createGain(),i=t.createBuffer(1,2,44100),r=i.getChannelData(0);r[0]=1,r[1]=1;const o=t.createBufferSource();o.buffer=i,o.loop=!0,o.connect(e).connect(t.destination),o.connect(s),o.disconnect(s),e.onaudioprocess=s=>{const i=s.inputBuffer.getChannelData(0);Array.prototype.some.call(i,(t=>1===t))?n(!0):n(!1),o.stop(),e.onaudioprocess=null,o.disconnect(e),e.disconnect(t.destination)},o.start()}})),wt=(t,e)=>{const n=new Map;for(const e of t)for(const t of e){const e=n.get(t);n.set(t,void 0===e?1:e+1)}n.forEach(((t,n)=>e(n,t)))},xt=t=>"context"in t,bt=(t,e,n,s)=>{const{activeInputs:i,passiveInputs:r}=et(e),{outputs:o}=tt(t),a=F(t),u=o=>{const a=_t(t),u=mt(e);if(o){const e=dt(r,t,n);at(i,t,e,!1),s||gt(t)||a.connect(u,n)}else{const e=((t,e,n)=>V(t,(t=>t[0]===e&&t[1]===n)))(i,t,n);ut(r,e,!1),s||gt(t)||a.disconnect(u,n)}};return!!ot(o,[e,n],(t=>t[0]===e&&t[1]===n),!0)&&(a.add(u),K(t)?at(i,t,[n,u],!0):ut(r,[t,n,u],!0),!0)},Tt=(t,e,n,s,i)=>{const[r,o]=((t,e,n,s)=>{const{activeInputs:i,passiveInputs:r}=tt(e),o=ht(i[s],t,n);if(null===o)return[q(r,t,n,s)[2],!1];return[o[2],!0]})(t,n,s,i);if(null!==r&&(pt(t,r),!o||e||gt(t)||ft(_t(t),_t(n),s,i)),K(n)){const{activeInputs:t}=tt(n);L(n,t)}},At=(t,e,n,s)=>{const[i,r]=((t,e,n)=>{const{activeInputs:s,passiveInputs:i}=et(e),r=ht(s,t,n);if(null===r)return[dt(i,t,n)[1],!1];return[r[2],!0]})(t,n,s);null!==i&&(pt(t,i),!r||e||gt(t)||_t(t).disconnect(mt(n),s))};class kt{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(((n,s)=>t.call(e,n,s,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 Ct={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function St(t,e,n,s,i){if("function"==typeof t.copyFromChannel)0===e[n].byteLength&&(e[n]=new Float32Array(128)),t.copyFromChannel(e[n],s,i);else{const r=t.getChannelData(s);if(0===e[n].byteLength)e[n]=r.slice(i,i+128);else{const t=new Float32Array(r.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);e[n].set(t)}}}const Ot=(t,e,n,s,i)=>{"function"==typeof t.copyToChannel?0!==e[n].byteLength&&t.copyToChannel(e[n],s,i):0!==e[n].byteLength&&t.getChannelData(s).set(e[n],i)},Mt=(t,e)=>{const n=[];for(let s=0;s<t;s+=1){const t=[],i="number"==typeof e?e:e[s];for(let e=0;e<i;e+=1)t.push(new Float32Array(128));n.push(t)}return n},Et=async(t,e,n,s,i,r,o)=>{const a=null===e?128*Math.ceil(t.context.length/128):e.length,u=s.channelCount*s.numberOfInputs,c=i.reduce(((t,e)=>t+e),0),l=0===c?null:n.createBuffer(c,a,n.sampleRate);if(void 0===r)throw new Error("Missing the processor constructor.");const h=tt(t),p=await((t,e)=>{const n=P(E,t),s=_t(e);return P(n,s)})(n,t),d=Mt(s.numberOfInputs,s.channelCount),f=Mt(s.numberOfOutputs,i),_=Array.from(t.parameters.keys()).reduce(((t,e)=>({...t,[e]:new Float32Array(128)})),{});for(let c=0;c<a;c+=128){if(s.numberOfInputs>0&&null!==e)for(let t=0;t<s.numberOfInputs;t+=1)for(let n=0;n<s.channelCount;n+=1)St(e,d[t],n,n,c);void 0!==r.parameterDescriptors&&null!==e&&r.parameterDescriptors.forEach((({name:t},n)=>{St(e,_,t,u+n,c)}));for(let t=0;t<s.numberOfInputs;t+=1)for(let e=0;e<i[t];e+=1)0===f[t][e].byteLength&&(f[t][e]=new Float32Array(128));try{const t=d.map(((t,e)=>0===h.activeInputs[e].size?[]:t)),e=o(c/n.sampleRate,n.sampleRate,(()=>p.process(t,f,_)));if(null!==l)for(let t=0,e=0;t<s.numberOfOutputs;t+=1){for(let n=0;n<i[t];n+=1)Ot(l,f[t],n,e+n,c);e+=i[t]}if(!e)break}catch(e){t.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}));break}}return l},Dt={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},It={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Rt={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Nt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},Bt={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Pt=t=>{const{port1:e,port2:n}=new MessageChannel;return new Promise((s=>{const i=()=>{n.onmessage=null,e.close(),n.close(),s()};n.onmessage=()=>i();try{e.postMessage(t,[t])}finally{i()}}))},Vt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},qt=(t,e,n)=>{const s=e[n];if(void 0===s)throw t();return s},Ft={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},jt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},zt=()=>new DOMException("","InvalidStateError"),Wt=()=>new DOMException("","InvalidAccessError"),Lt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},Ut=(t,e,n,s,i,r,o,a,u,c,l)=>{const h=c.length;let p=a;for(let a=0;a<h;a+=1){let h=n[0]*c[a];for(let e=1;e<i;e+=1){const s=p-e&u-1;h+=n[e]*r[s],h-=t[e]*o[s]}for(let t=i;t<s;t+=1)h+=n[t]*r[p-t&u-1];for(let n=i;n<e;n+=1)h-=t[n]*o[p-n&u-1];r[p]=c[a],o[p]=h,p=p+1&u-1,l[a]=h}return p},Ht={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},$t=t=>{const e=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=t.decodeAudioData(e.buffer,(()=>{}));return void 0!==n&&(n.catch((()=>{})),!0)}catch{}return!1},Gt=(t,e,n)=>{const s=e[n];void 0!==s&&s!==t[n]&&(t[n]=s)},Xt=(t,e)=>{Gt(t,e,"channelCount"),Gt(t,e,"channelCountMode"),Gt(t,e,"channelInterpretation")},Zt=t=>"function"==typeof t.getFloatTimeDomainData,Yt=(t,e,n)=>{const s=e[n];void 0!==s&&s!==t[n].value&&(t[n].value=s)},Qt=t=>{var e;t.start=(e=t.start,(n=0,s=0,i)=>{if("number"==typeof i&&i<0||s<0||n<0)throw new RangeError("The parameters can't be negative.");e.call(t,n,s,i)})},Kt=t=>{var e;t.stop=(e=t.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");e.call(t,n)})},Jt=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),te=async(t,e)=>{const n=await(t=>new Promise(((e,n)=>{const{port1:s,port2:i}=new MessageChannel;s.onmessage=({data:t})=>{s.close(),i.close(),e(t)},s.onmessageerror=({data:t})=>{s.close(),i.close(),n(t)},i.postMessage(t)})))(e);return new t(n)},ee=(t,e)=>{const n=t.createBiquadFilter();return Xt(n,e),Yt(n,e,"Q"),Yt(n,e,"detune"),Yt(n,e,"frequency"),Yt(n,e,"gain"),Gt(n,e,"type"),n},ne=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return Xt(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw zt()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw zt()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw zt()}})})(n),n},se=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),ie=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return Xt(n,e),Yt(n,e,"delayTime"),n},re=(t,e)=>{const n=t.createGain();return Xt(n,e),Yt(n,e,"gain"),n};function oe(t,e){const n=e[0]*e[0]+e[1]*e[1];return[(t[0]*e[0]+t[1]*e[1])/n,(t[1]*e[0]-t[0]*e[1])/n]}function ae(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)i=e,n=[(s=n)[0]*i[0]-s[1]*i[1],s[0]*i[1]+s[1]*i[0]],n[0]+=t[r];var s,i;return n}const ue=(t,e,n,s)=>t.createScriptProcessor(e,n,s),ce=()=>new DOMException("","NotSupportedError"),le={numberOfChannels:1},he={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},pe={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},de={disableNormalization:!1},fe={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},_e={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},me=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),ge=t=>{if(null===t)return!1;const e=t.length;return e%2!=0?0!==t[Math.floor(e/2)]:t[e/2-1]+t[e/2]!==0},ve=(t,e,n,s)=>{let i=t;for(;!i.hasOwnProperty(e);)i=Object.getPrototypeOf(i);const{get:r,set:o}=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,{get:n(r),set:s(o)})},ye=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(s){if(9!==s.code)throw s;ye(t,e,n+1e-7)}},we=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},xe=t=>{const e=t.createBuffer(1,1,44100),n=t.createBufferSource();n.buffer=e,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},be=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Te=(t,e)=>{const n=e.createGain();t.connect(n);const s=(e=>()=>{e.call(t,n),t.removeEventListener("ended",s)})(t.disconnect);t.addEventListener("ended",s),se(t,n),t.stop=(e=>{let s=!1;return(i=0)=>{if(s)try{e.call(t,i)}catch{n.gain.setValueAtTime(0,i)}else e.call(t,i),s=!0}})(t.stop)},Ae=(t,e)=>n=>{const s={value:t};return Object.defineProperties(n,{currentTarget:s,target:s}),"function"==typeof e?e.call(t,n):e.handleEvent.call(t,n)},ke=(t=>(e,n,[s,i,r],o)=>{t(e[i],[n,s,r],(t=>t[0]===n&&t[1]===s),o)})(ot),Ce=(t=>(e,n,[s,i,r],o)=>{const a=e.get(s);void 0===a?e.set(s,new Set([[i,n,r]])):t(a,[i,n,r],(t=>t[0]===i&&t[1]===n),o)})(ot),Se=(t=>(e,n,s,i)=>t(e[i],(t=>t[0]===n&&t[1]===s)))(V),Oe=new WeakMap,Me=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(Oe),Ee=(De=new Map,Ie=new WeakMap,(t,e)=>{const n=Ie.get(t);if(void 0!==n)return n;const s=De.get(t);if(void 0!==s)return s;try{const n=e();return n instanceof Promise?(De.set(t,n),n.catch((()=>!1)).then((e=>(De.delete(t),Ie.set(t,e),e)))):(Ie.set(t,n),n)}catch{return Ie.set(t,!1),!1}});var De,Ie;const Re="undefined"==typeof window?null:window,Ne=((t,e)=>(n,s)=>{const i=n.createAnalyser();if(Xt(i,s),!(s.maxDecibels>s.minDecibels))throw e();return Gt(i,s,"fftSize"),Gt(i,s,"maxDecibels"),Gt(i,s,"minDecibels"),Gt(i,s,"smoothingTimeConstant"),t(Zt,(()=>Zt(i)))||(t=>{t.getFloatTimeDomainData=e=>{const n=new Uint8Array(e.length);t.getByteTimeDomainData(n);const s=Math.max(n.length,t.fftSize);for(let t=0;t<s;t+=1)e[t]=.0078125*(n[t]-128);return e}})(i),i})(Ee,G),Be=(t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return n.renderer})(tt),Pe=((t,e,n)=>async(s,i,r)=>{const o=t(s);await Promise.all(o.activeInputs.map(((t,o)=>Array.from(t).map((async([t,a])=>{const u=e(t),c=await u.render(t,i),l=s.context.destination;n(t)||s===l&&n(s)||c.connect(r,a,o)})))).reduce(((t,e)=>[...t,...e]),[]))})(tt,Be,gt),Ve=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,fftSize:o.fftSize,maxDecibels:o.maxDecibels,minDecibels:o.minDecibels,smoothingTimeConstant:o.smoothingTimeConstant};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(Ne,_t,Pe),qe=(Fe=C,t=>{const e=Fe.get(t);if(void 0===e)throw zt();return e});var Fe;const je=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(Re),ze=(t=>e=>null!==t&&e instanceof t)(je),We=new WeakMap,Le=(t=>class{constructor(t){this._nativeEventTarget=t,this._listeners=new WeakMap}addEventListener(e,n,s){if(null!==n){let i=this._listeners.get(n);void 0===i&&(i=t(this,n),"function"==typeof n&&this._listeners.set(n,i)),this._nativeEventTarget.addEventListener(e,i,s)}}dispatchEvent(t){return this._nativeEventTarget.dispatchEvent(t)}removeEventListener(t,e,n){const s=null===e?void 0:this._listeners.get(e);this._nativeEventTarget.removeEventListener(t,void 0===s?null:s,n)}})(Ae),Ue=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(Re),He=(t=>e=>null!==t&&e instanceof t)(Ue),$e=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(Re),Ge=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(Re),Xe=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(Re),Ze=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_)=>class extends c{constructor(e,s,i,r){super(i),this._context=e,this._nativeAudioNode=i;const o=l(e);h(o)&&!0!==n(yt,(()=>yt(o,_)))&&(t=>{const e=new Map;t.connect=(t=>(n,s=0,i=0)=>{const r=xt(n)?t(n,s,i):t(n,s),o=e.get(n);return void 0===o?e.set(n,[{input:i,output:s}]):o.every((t=>t.input!==i||t.output!==s))&&o.push({input:i,output:s}),r})(t.connect.bind(t)),t.disconnect=(n=>(s,i,r)=>{if(n.apply(t),void 0===s)e.clear();else if("number"==typeof s)for(const[t,n]of e){const i=n.filter((t=>t.output!==s));0===i.length?e.delete(t):e.set(t,i)}else if(e.has(s))if(void 0===i)e.delete(s);else{const t=e.get(s);if(void 0!==t){const n=t.filter((t=>t.output!==i&&(t.input!==r||void 0===r)));0===n.length?e.delete(s):e.set(s,n)}}for(const[n,s]of e)s.forEach((e=>{xt(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)}))})(t.disconnect)})(i),T.set(this,i),S.set(this,new Set),"closed"!==e.state&&s&&j(this),t(this,r,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(t){this._nativeAudioNode.channelCount=t}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(t){this._nativeAudioNode.channelCountMode=t}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(t){this._nativeAudioNode.channelInterpretation=t}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(t,n=0,a=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=l(this._context),h=f(c);if(p(t)||d(t))throw r();if(it(t)){const i=_t(t);try{const e=lt(this._nativeAudioNode,i,n,a),s=vt(this);(h||s)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!s&&vt(t)&&j(t)}catch(t){if(12===t.code)throw r();throw t}if(e(this,t,n,a,h)){const e=u([this],t);wt(e,s(h))}return t}const _=mt(t);if("playbackRate"===_.name&&1024===_.maxValue)throw o();try{this._nativeAudioNode.connect(_,n),(h||vt(this))&&this._nativeAudioNode.disconnect(_,n)}catch(t){if(12===t.code)throw r();throw t}if(bt(this,t,n,h)){const e=u([this],t);wt(e,s(h))}}disconnect(t,e,n){let s;const o=l(this._context),c=f(o);if(void 0===t)s=((t,e)=>{const n=tt(t),s=[];for(const i of n.outputs)rt(i)?Tt(t,e,...i):At(t,e,...i),s.push(i[0]);return n.outputs.clear(),s})(this,c);else if("number"==typeof t){if(t<0||t>=this.numberOfOutputs)throw i();s=((t,e,n)=>{const s=tt(t),i=[];for(const r of s.outputs)r[1]===n&&(rt(r)?Tt(t,e,...r):At(t,e,...r),i.push(r[0]),s.outputs.delete(r));return i})(this,c,t)}else{if(void 0!==e&&(e<0||e>=this.numberOfOutputs))throw i();if(it(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(s=((t,e,n,s,i)=>{const r=tt(t);return Array.from(r.outputs).filter((t=>!(t[0]!==n||void 0!==s&&t[1]!==s||void 0!==i&&t[2]!==i))).map((n=>(rt(n)?Tt(t,e,...n):At(t,e,...n),r.outputs.delete(n),n[0])))})(this,c,t,e,n),0===s.length)throw r()}for(const t of s){const e=u([this],t);wt(e,a)}}})((Ye=b,(t,e,n)=>{const s=[];for(let t=0;t<n.numberOfInputs;t+=1)s.push(new Set);Ye.set(t,{activeInputs:s,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,n,s,i,r,o,a,u,c,l,h,p)=>{const d=new WeakMap;return(f,_,m,g,v)=>{const{activeInputs:y,passiveInputs:w}=r(_),{outputs:x}=r(f),b=a(f),T=r=>{const a=u(_),c=u(f);if(r){const e=q(w,f,m,g);t(y,f,e,!1),v||h(f)||n(c,a,m,g),p(_)&&j(_)}else{const t=s(y,f,m,g);e(w,g,t,!1),v||h(f)||i(c,a,m,g);const n=o(_);if(0===n)l(_)&&L(_,y);else{const t=d.get(_);void 0!==t&&clearTimeout(t),d.set(_,setTimeout((()=>{l(_)&&L(_,y)}),1e3*n))}}};return!!c(x,[_,m,g],(t=>t[0]===_&&t[1]===m&&t[2]===g),!0)&&(b.add(T),l(f)?t(y,f,[m,g,T],!0):e(w,g,[f,m,T],!0),!0)}})(ke,Ce,lt,Se,ft,tt,Me,F,_t,ot,K,gt,vt),Ee,((t,e,n,s,i,r)=>o=>(a,u)=>{const c=t.get(a);if(void 0===c){if(!o&&r(a)){const t=s(a),{outputs:r}=n(a);for(const n of r)if(rt(n)){const i=s(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.disconnect(e,n[1])}}t.set(a,u)}else t.set(a,c+u)})(O,ft,tt,_t,mt,K),G,Wt,ce,((t,e,n,s,i,r,o,a)=>(u,c)=>{const l=e.get(u);if(void 0===l)throw new Error("Missing the expected cycle count.");const h=r(u.context),p=a(h);if(l===c){if(e.delete(u),!p&&o(u)){const e=s(u),{outputs:r}=n(u);for(const n of r)if(rt(n)){const i=s(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.connect(t,n[1])}}}else e.set(u,l-c)})(lt,O,tt,_t,mt,qe,K,ze),((t,e,n)=>function s(i,r){const o=it(r)?r:n(t,r);if((t=>"delayTime"in t)(o))return[];if(i[0]===o)return[i];if(i.includes(o))return[];const{outputs:a}=e(o);return Array.from(a).map((t=>s([...i,o],t[0]))).reduce(((t,e)=>t.concat(e)),[])})(We,tt,P),Le,qe,He,$e,Ge,ze,Xe);var Ye;const Qe=((t,e,n,s,i,r)=>class extends t{constructor(t,n){const o=i(t),a={...U,...n},u=s(o,a);super(t,!1,u,r(o)?e():null),this._nativeAnalyserNode=u}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(t){this._nativeAnalyserNode.fftSize=t}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(t){const e=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=t,!(t>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=e,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(t){const e=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=t,!(this._nativeAnalyserNode.maxDecibels>t))throw this._nativeAnalyserNode.minDecibels=e,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(t){this._nativeAnalyserNode.smoothingTimeConstant=t}getByteFrequencyData(t){this._nativeAnalyserNode.getByteFrequencyData(t)}getByteTimeDomainData(t){this._nativeAnalyserNode.getByteTimeDomainData(t)}getFloatFrequencyData(t){this._nativeAnalyserNode.getFloatFrequencyData(t)}getFloatTimeDomainData(t){this._nativeAnalyserNode.getFloatTimeDomainData(t)}})(Ze,Ve,G,Ne,qe,ze),Ke=new WeakSet,Je=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(Re),tn=(en=new Uint32Array(1),t=>(en[0]=t,en[0]));var en;const nn=((t,e)=>n=>{n.copyFromChannel=(s,i,r=0)=>{const o=t(r),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=s.length;for(let t=o<0?-o:0;t+o<u&&t<l;t+=1)s[t]=c[t+o]},n.copyToChannel=(s,i,r=0)=>{const o=t(r),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=s.length;for(let t=o<0?-o:0;t+o<u&&t<l;t+=1)c[t+o]=s[t]}})(tn,G),sn=(t=>e=>{e.copyFromChannel=(n=>(s,i,r=0)=>{const o=t(r),a=t(i);if(o<e.length)return n.call(e,s,a,o)})(e.copyFromChannel),e.copyToChannel=(n=>(s,i,r=0)=>{const o=t(r),a=t(i);if(o<e.length)return n.call(e,s,a,o)})(e.copyToChannel)})(tn),rn=((t,e,n,s,i,r,o,a)=>{let u=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:l,numberOfChannels:h,sampleRate:p}={...Z,...c};null===u&&(u=new i(1,1,44100));const d=null!==s&&e(r,r)?new s({length:l,numberOfChannels:h,sampleRate:p}):u.createBuffer(h,l,p);if(0===d.numberOfChannels)throw n();return"function"!=typeof d.copyFromChannel?(o(d),X(d)):e($,(()=>$(d)))||a(d),t.add(d),d}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===c.prototype||t.has(e)}}})(Ke,Ee,ce,Je,je,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(Je),nn,sn),on=(t=>(e,n)=>{const s=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.connect(s).connect(e.destination);const i=()=>{n.removeEventListener("ended",i),n.disconnect(s),s.disconnect()};n.addEventListener("ended",i)})(re),an=((t,e,n)=>async(s,i,r)=>{const o=e(s);await Promise.all(Array.from(o.activeInputs).map((async([e,s])=>{const o=t(e),a=await o.render(e,i);n(e)||a.connect(r,s)})))})(Be,et,gt),un=(t=>(e,n,s)=>t(n,e,s))(an),cn=((t,e,n,s,i,r,o,a,u,c,l)=>(h,p)=>{const d=h.createBufferSource();return Xt(d,p),Yt(d,p,"playbackRate"),Gt(d,p,"buffer"),Gt(d,p,"loop"),Gt(d,p,"loopEnd"),Gt(d,p,"loopStart"),e(n,(()=>n(h)))||(t=>{t.start=(e=>{let n=!1;return(s=0,i=0,r)=>{if(n)throw zt();e.call(t,s,i,r),n=!0}})(t.start)})(d),e(s,(()=>s(h)))||u(d),e(i,(()=>i(h)))||c(d,h),e(r,(()=>r(h)))||Qt(d),e(o,(()=>o(h)))||l(d,h),e(a,(()=>a(h)))||Kt(d),t(h,d),d})(on,Ee,(t=>{const e=t.createBufferSource();e.start();try{e.start()}catch{return!0}return!1}),(t=>{const e=t.createBufferSource(),n=t.createBuffer(1,1,44100);e.buffer=n;try{e.start(0,1)}catch{return!1}return!0}),(t=>{const e=t.createBufferSource();e.start();try{e.stop()}catch{return!1}return!0}),we,xe,be,(t=>{var e;t.start=(e=t.start,(n=0,s=0,i)=>{const r=t.buffer,o=null===r?s:Math.min(r.duration,s);null!==r&&o>r.duration-.5/t.context.sampleRate?e.call(t,n,0,0):e.call(t,n,o,i)})}),(t=>(e,n)=>{const s=n.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=s),t(e,"buffer",(t=>()=>{const n=t.call(e);return n===s?null:n}),(t=>n=>t.call(e,null===n?s:n)))})(ve),Te),ln=((t,e)=>(n,s,i)=>(t(s).replay(i),e(s,n,i)))((t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(et),an),hn=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;return{set start(t){o=t},set stop(t){a=t},render(u,c){const l=r.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=H(l,c);if(!h){const t={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=e(c,t),null!==o&&l.start(...o),null!==a&&l.stop(a)}return r.set(c,l),h?await t(c,u.playbackRate,l.playbackRate):await s(c,u.playbackRate,l.playbackRate),await i(u,c,l),l})(u,c)}}})(un,cn,_t,ln,Pe),pn=((t,e,n,s,i,r,o,a,u,c,l,h,p)=>(d,f,_,m=null,g=null)=>{const v=new w(_.defaultValue),y=f?s(v):null,x={get defaultValue(){return _.defaultValue},get maxValue(){return null===m?_.maxValue:m},get minValue(){return null===g?_.minValue:g},get value(){return _.value},set value(t){_.value=t,x.setValueAtTime(t,d.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof _.cancelAndHoldAtTime)null===y&&v.flush(d.context.currentTime),v.add(i(t)),_.cancelAndHoldAtTime(t);else{const e=Array.from(v).pop();null===y&&v.flush(d.context.currentTime),v.add(i(t));const n=Array.from(v).pop();_.cancelScheduledValues(t),e!==n&&void 0!==n&&("exponentialRampToValue"===n.type?_.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?_.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?_.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&_.setValueCurveAtTime(n.values,n.startTime,n.duration))}return x},cancelScheduledValues:t=>(null===y&&v.flush(d.context.currentTime),v.add(r(t)),_.cancelScheduledValues(t),x),exponentialRampToValueAtTime(t,e){if(0===t)throw new RangeError;if(!Number.isFinite(e)||e<0)throw new RangeError;return null===y&&v.flush(d.context.currentTime),v.add(o(t,e)),_.exponentialRampToValueAtTime(t,e),x},linearRampToValueAtTime:(t,e)=>(null===y&&v.flush(d.context.currentTime),v.add(a(t,e)),_.linearRampToValueAtTime(t,e),x),setTargetAtTime:(t,e,n)=>(null===y&&v.flush(d.context.currentTime),v.add(u(t,e,n)),_.setTargetAtTime(t,e,n),x),setValueAtTime:(t,e)=>(null===y&&v.flush(d.context.currentTime),v.add(c(t,e)),_.setValueAtTime(t,e),x),setValueCurveAtTime(t,e,n){const s=t instanceof Float32Array?t:new Float32Array(t);if(null!==h&&"webkitAudioContext"===h.name){const t=e+n,i=d.context.sampleRate,r=Math.ceil(e*i),o=Math.floor(t*i),a=o-r,u=new Float32Array(a);for(let t=0;t<a;t+=1){const o=(s.length-1)/n*((r+t)/i-e),a=Math.floor(o),c=Math.ceil(o);u[t]=a===c?s[a]:(1-(o-a))*s[a]+(1-(c-o))*s[c]}null===y&&v.flush(d.context.currentTime),v.add(l(u,e,n)),_.setValueCurveAtTime(u,e,n);const c=o/i;c<t&&p(x,u[u.length-1],c),p(x,s[s.length-1],t)}else null===y&&v.flush(d.context.currentTime),v.add(l(s,e,n)),_.setValueCurveAtTime(s,e,n);return x}};return n.set(x,_),e.set(x,d),t(x,y),x})((dn=A,(t,e)=>{dn.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),We,k,(t=>({replay(e){for(const n of t)if("exponentialRampToValue"===n.type){const{endTime:t,value:s}=n;e.exponentialRampToValueAtTime(s,t)}else if("linearRampToValue"===n.type){const{endTime:t,value:s}=n;e.linearRampToValueAtTime(s,t)}else if("setTarget"===n.type){const{startTime:t,target:s,timeConstant:i}=n;e.setTargetAtTime(s,t,i)}else if("setValue"===n.type){const{startTime:t,value:s}=n;e.setValueAtTime(s,t)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:t,startTime:s,values:i}=n;e.setValueCurveAtTime(i,s,t)}}}})),(t=>({cancelTime:t,type:"cancelAndHold"})),(t=>({cancelTime:t,type:"cancelScheduledValues"})),((t,e)=>({endTime:e,type:"exponentialRampToValue",value:t})),((t,e)=>({endTime:e,type:"linearRampToValue",value:t})),((t,e,n)=>({startTime:e,target:t,timeConstant:n,type:"setTarget"})),s,i,Ue,ye);var dn;const fn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,s){const a=r(t),u={...J,...s},c=i(a,u),l=o(a),h=l?e():null;super(t,!1,c,h),this._audioBufferSourceNodeRenderer=h,this._isBufferNullified=!1,this._isBufferSet=null!==u.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,l,c.playbackRate,Q,Y)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(t){if(this._nativeAudioBufferSourceNode.buffer=t,null!==t){if(this._isBufferSet)throw s();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(t){this._nativeAudioBufferSourceNode.loop=t}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(t){this._nativeAudioBufferSourceNode.loopEnd=t}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(t){this._nativeAudioBufferSourceNode.loopStart=t}get onended(){return this._onended}set onended(t){const e="function"==typeof t?a(this,t):null;this._nativeAudioBufferSourceNode.onended=e;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===e?t:n}get playbackRate(){return this._playbackRate}start(t=0,e=0,n){if(this._nativeAudioBufferSourceNode.start(t,e,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[t,e]:[t,e,n]),"closed"!==this.context.state){j(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(Ze,hn,pn,zt,cn,qe,ze,Ae),_n=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,n){const s=r(t),u=o(s),c=i(s,n,u);super(t,!1,c,u?e(a):null),this._isNodeOfNativeOfflineAudioContext=u,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(t){if(this._isNodeOfNativeOfflineAudioContext)throw s();if(t>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=t}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(t){if(this._isNodeOfNativeOfflineAudioContext)throw s();this._nativeAudioDestinationNode.channelCountMode=t}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(Ze,(t=>{const e=new WeakMap;return{render(n,s){const i=e.get(s);return void 0!==i?Promise.resolve(i):(async(n,s)=>{const i=s.destination;return e.set(s,i),await t(n,s,i),i})(n,s)}}}),G,zt,((t,e)=>(n,s,i)=>{const r=n.destination;if(r.channelCount!==s)try{r.channelCount=s}catch{}i&&"explicit"!==r.channelCountMode&&(r.channelCountMode="explicit"),0===r.maxChannelCount&&Object.defineProperty(r,"maxChannelCount",{value:s});const o=t(n,{channelCount:s,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,gain:1});return e(o,"channelCount",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e);try{r.channelCount=e}catch(t){if(e>r.maxChannelCount)throw t}})),e(o,"channelCountMode",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e),r.channelCountMode=e})),e(o,"channelInterpretation",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e),r.channelInterpretation=e})),Object.defineProperty(o,"maxChannelCount",{get:()=>r.maxChannelCount}),o.connect(r),o})(re,ve),qe,ze,Pe),mn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={Q:u.Q.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,detune:u.detune.value,frequency:u.frequency.value,gain:u.gain.value,type:u.type};u=e(a,t)}return r.set(a,u),c?(await t(a,o.Q,u.Q),await t(a,o.detune,u.detune),await t(a,o.frequency,u.frequency),await t(a,o.gain,u.gain)):(await s(a,o.Q,u.Q),await s(a,o.detune,u.detune),await s(a,o.frequency,u.frequency),await s(a,o.gain,u.gain)),await i(o,a,u),u})(o,a)}}})(un,ee,_t,ln,Pe),gn=(t=>(e,n)=>t.set(e,n))(Oe),vn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,s){const u=r(t),c={...Dt,...s},l=i(u,c),h=o(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,Q,Y),this._detune=e(this,h,l.detune,1200*Math.log2(Q),-1200*Math.log2(Q)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(Q),Y),this._nativeBiquadFilterNode=l,a(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(t){this._nativeBiquadFilterNode.type=t}getFrequencyResponse(t,e,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(t,e,n)}catch(t){if(11===t.code)throw s();throw t}if(t.length!==e.length||e.length!==n.length)throw s()}})(Ze,pn,mn,Wt,ee,qe,ze,gn),yn=((t,e)=>(n,s,i)=>{const r=new Set;return n.connect=(i=>(o,a=0,u=0)=>{const c=0===r.size;if(e(o))return i.call(n,o,a,u),t(r,[o,a,u],(t=>t[0]===o&&t[1]===a&&t[2]===u),!0),c&&s(),o;i.call(n,o,a),t(r,[o,a],(t=>t[0]===o&&t[1]===a),!0),c&&s()})(n.connect),n.disconnect=(t=>(s,o,a)=>{const u=r.size>0;if(void 0===s)t.apply(n),r.clear();else if("number"==typeof s){t.call(n,s);for(const t of r)t[1]===s&&r.delete(t)}else{e(s)?t.call(n,s,o,a):t.call(n,s,o);for(const t of r)t[0]!==s||void 0!==o&&t[1]!==o||void 0!==a&&t[2]!==a||r.delete(t)}const c=0===r.size;u&&c&&i()})(n.disconnect),n})(ot,$e),wn=((t,e)=>(n,s)=>{s.channelCount=1,s.channelCountMode="explicit",Object.defineProperty(s,"channelCount",{get:()=>1,set:()=>{throw t()}}),Object.defineProperty(s,"channelCountMode",{get:()=>"explicit",set:()=>{throw t()}});const i=n.createBufferSource();e(s,(()=>{const t=s.numberOfInputs;for(let e=0;e<t;e+=1)i.connect(s,0,e)}),(()=>i.disconnect(s)))})(zt,yn),xn=((t,e)=>(n,s)=>{const i=n.createChannelMerger(s.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),Xt(i,s),i})(Ue,wn),bn=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfInputs:o.numberOfInputs};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(xn,_t,Pe),Tn=((t,e,n,s,i)=>class extends t{constructor(t,r){const o=s(t),a={...It,...r};super(t,!1,n(o,a),i(o)?e():null)}})(Ze,bn,xn,qe,ze),An=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfOutputs:o.numberOfOutputs};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(ne,_t,Pe),kn=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u=r({...Rt,...o});super(t,!1,n(a,u),i(a)?e():null)}})(Ze,An,ne,qe,ze,(t=>({...t,channelCount:t.numberOfOutputs}))),Cn=((t,e,n,s)=>(i,{offset:r,...o})=>{const a=i.createBuffer(1,2,44100),u=e(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...o,gain:r}),l=a.getChannelData(0);l[0]=1,l[1]=1,u.buffer=a,u.loop=!0;const h={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){c.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){c.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){c.channelInterpretation=t},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return u.onended},set onended(t){u.onended=t},addEventListener:(...t)=>u.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>u.dispatchEvent(t[0]),removeEventListener:(...t)=>u.removeEventListener(t[0],t[1],t[2]),start(t=0){u.start.call(u,t)},stop(t=0){u.stop.call(u,t)}};return t(i,u),s(se(h,c),(()=>u.connect(c)),(()=>u.disconnect(c)))})(on,cn,re,yn),Sn=((t,e,n,s,i)=>(r,o)=>{if(void 0===r.createConstantSource)return n(r,o);const a=r.createConstantSource();return Xt(a,o),Yt(a,o,"offset"),e(s,(()=>s(r)))||Qt(a),e(i,(()=>i(r)))||Kt(a),t(r,a),a})(on,Ee,Cn,we,be),On=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;return{set start(t){o=t},set stop(t){a=t},render(u,c){const l=r.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=H(l,c);if(!h){const t={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,offset:l.offset.value};l=e(c,t),null!==o&&l.start(o),null!==a&&l.stop(a)}return r.set(c,l),h?await t(c,u.offset,l.offset):await s(c,u.offset,l.offset),await i(u,c,l),l})(u,c)}}})(un,Sn,_t,ln,Pe),Mn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,o){const a=i(t),u={...Nt,...o},c=s(a,u),l=r(a),h=l?n():null;super(t,!1,c,h),this._constantSourceNodeRenderer=h,this._nativeConstantSourceNode=c,this._offset=e(this,l,c.offset,Q,Y),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(t){const e="function"==typeof t?o(this,t):null;this._nativeConstantSourceNode.onended=e;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===e?t:n}start(t=0){if(this._nativeConstantSourceNode.start(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=t),"closed"!==this.context.state){j(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(Ze,pn,On,Sn,qe,ze,Ae),En=((t,e)=>(n,s)=>{const i=n.createConvolver();if(Xt(i,s),s.disableNormalization===i.normalize&&(i.normalize=!s.disableNormalization),Gt(i,s,"buffer"),s.channelCount>2)throw t();if(e(i,"channelCount",(t=>()=>t.call(i)),(e=>n=>{if(n>2)throw t();return e.call(i,n)})),"max"===s.channelCountMode)throw t();return e(i,"channelCountMode",(t=>()=>t.call(i)),(e=>n=>{if("max"===n)throw t();return e.call(i,n)})),i})(ce,ve),Dn=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={buffer:o.buffer,channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,disableNormalization:!o.normalize};o=t(r,e)}return s.set(r,o),ct(o)?await n(i,r,o.inputs[0]):await n(i,r,o),o})(i,r)}}})(En,_t,Pe),In=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u={...Bt,...o},c=n(a,u);super(t,!1,c,i(a)?e():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==u.buffer&&r(this,u.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(t){if(this._nativeConvolverNode.buffer=t,null===t&&null!==this._nativeConvolverNode.buffer){const t=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=t.createBuffer(1,1,44100),this._isBufferNullified=!0,r(this,0)}else this._isBufferNullified=!1,r(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(t){this._nativeConvolverNode.normalize=t}})(Ze,Dn,En,qe,ze,gn),Rn=((t,e,n,s,i)=>r=>{const o=new WeakMap;return{render(a,u){const c=o.get(u);return void 0!==c?Promise.resolve(c):(async(a,u)=>{let c=n(a);const l=H(c,u);if(!l){const t={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:r};c=e(u,t)}return o.set(u,c),l?await t(u,a.delayTime,c.delayTime):await s(u,a.delayTime,c.delayTime),await i(a,u,c),c})(a,u)}}})(un,ie,_t,ln,Pe),Nn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,a){const u=i(t),c={...Vt,...a},l=s(u,c),h=r(u);super(t,!1,l,h?n(c.maxDelayTime):null),this._delayTime=e(this,h,l.delayTime),o(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(Ze,pn,Rn,ie,qe,ze,gn),Bn=(t=>(e,n)=>{const s=e.createDynamicsCompressor();if(Xt(s,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return Yt(s,n,"attack"),Yt(s,n,"knee"),Yt(s,n,"ratio"),Yt(s,n,"release"),Yt(s,n,"threshold"),s})(ce),Pn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={attack:u.attack.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,knee:u.knee.value,ratio:u.ratio.value,release:u.release.value,threshold:u.threshold.value};u=e(a,t)}return r.set(a,u),c?(await t(a,o.attack,u.attack),await t(a,o.knee,u.knee),await t(a,o.ratio,u.ratio),await t(a,o.release,u.release),await t(a,o.threshold,u.threshold)):(await s(a,o.attack,u.attack),await s(a,o.knee,u.knee),await s(a,o.ratio,u.ratio),await s(a,o.release,u.release),await s(a,o.threshold,u.threshold)),await i(o,a,u),u})(o,a)}}})(un,Bn,_t,ln,Pe),Vn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,i){const u=r(t),c={...Ft,...i},l=s(u,c),h=o(u);super(t,!1,l,h?n():null),this._attack=e(this,h,l.attack),this._knee=e(this,h,l.knee),this._nativeDynamicsCompressorNode=l,this._ratio=e(this,h,l.ratio),this._release=e(this,h,l.release),this._threshold=e(this,h,l.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(t){const e=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=t,t>2)throw this._nativeDynamicsCompressorNode.channelCount=e,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(t){const e=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=t,"max"===t)throw this._nativeDynamicsCompressorNode.channelCountMode=e,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(Ze,pn,Pn,Bn,ce,qe,ze,gn),qn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,gain:u.gain.value};u=e(a,t)}return r.set(a,u),c?await t(a,o.gain,u.gain):await s(a,o.gain,u.gain),await i(o,a,u),u})(o,a)}}})(un,re,_t,ln,Pe),Fn=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=i(t),u={...jt,...o},c=s(a,u),l=r(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,Q,Y)}get gain(){return this._gain}})(Ze,pn,qn,re,qe,ze),jn=((t,e,n,s)=>(i,r,{channelCount:o,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=Jt(r,i.sampleRate),p=c instanceof Float64Array?c:new Float64Array(c),d=l instanceof Float64Array?l:new Float64Array(l),f=p.length,_=d.length,m=Math.min(f,_);if(0===f||f>20)throw s();if(0===p[0])throw e();if(0===_||_>20)throw s();if(0===d[0])throw e();if(1!==p[0]){for(let t=0;t<_;t+=1)d[t]/=p[0];for(let t=1;t<f;t+=1)p[t]/=p[0]}const g=n(i,h,o,o);g.channelCount=o,g.channelCountMode=a,g.channelInterpretation=u;const v=[],y=[],w=[];for(let t=0;t<o;t+=1){v.push(0);const t=new Float32Array(32),e=new Float32Array(32);t.fill(0),e.fill(0),y.push(t),w.push(e)}g.onaudioprocess=t=>{const e=t.inputBuffer,n=t.outputBuffer,s=e.numberOfChannels;for(let t=0;t<s;t+=1){const s=e.getChannelData(t),i=n.getChannelData(t);v[t]=Ut(p,f,d,_,m,y[t],w[t],v[t],32,s,i)}};const x=i.sampleRate/2,b={get bufferSize(){return h},get channelCount(){return g.channelCount},set channelCount(t){g.channelCount=t},get channelCountMode(){return g.channelCountMode},set channelCountMode(t){g.channelCountMode=t},get channelInterpretation(){return g.channelInterpretation},set channelInterpretation(t){g.channelInterpretation=t},get context(){return g.context},get inputs(){return[g]},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},addEventListener:(...t)=>g.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>g.dispatchEvent(t[0]),getFrequencyResponse(e,n,s){if(e.length!==n.length||n.length!==s.length)throw t();const i=e.length;for(let t=0;t<i;t+=1){const i=-Math.PI*(e[t]/x),r=[Math.cos(i),Math.sin(i)],o=oe(ae(d,r),ae(p,r));n[t]=Math.sqrt(o[0]*o[0]+o[1]*o[1]),s[t]=Math.atan2(o[1],o[0])}},removeEventListener:(...t)=>g.removeEventListener(t[0],t[1],t[2])};return se(b,g)})(Wt,zt,ue,ce),zn=((t,e,n,s)=>i=>t($t,(()=>$t(i)))?Promise.resolve(t(s,s)).then((t=>{if(!t){const t=n(i,512,0,1);i.oncomplete=()=>{t.onaudioprocess=null,t.disconnect()},t.onaudioprocess=()=>i.currentTime,t.connect(i.destination)}return i.startRendering()})):new Promise((t=>{const n=e(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=e=>{n.disconnect(),t(e.renderedBuffer)},n.connect(i.destination),i.startRendering()})))(Ee,re,ue,((t,e)=>()=>{if(null===e)return Promise.resolve(!1);const n=new e(1,1,44100),s=t(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise((t=>{n.oncomplete=()=>{s.disconnect(),t(0!==n.currentTime)},n.startRendering()}))})(re,je)),Wn=((t,e,n,s,i)=>(r,o)=>{const a=new WeakMap;let u=null;const c=async(c,l)=>{let h=null,p=e(c);const d=H(p,l);if(void 0===l.createIIRFilter?h=t(l,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):d||(p=l.createIIRFilter(o,r)),a.set(l,null===h?p:h),null!==h){if(null===u){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new n(c.context.destination.channelCount,c.context.length,l.sampleRate);u=(async()=>{await s(c,t,t.destination);return((t,e,n,s)=>{const i=n instanceof Float64Array?n:new Float64Array(n),r=s instanceof Float64Array?s:new Float64Array(s),o=i.length,a=r.length,u=Math.min(o,a);if(1!==i[0]){for(let t=0;t<o;t+=1)r[t]/=i[0];for(let t=1;t<a;t+=1)i[t]/=i[0]}const c=new Float32Array(32),l=new Float32Array(32),h=e.createBuffer(t.numberOfChannels,t.length,t.sampleRate),p=t.numberOfChannels;for(let e=0;e<p;e+=1){const n=t.getChannelData(e),s=h.getChannelData(e);c.fill(0),l.fill(0),Ut(i,o,r,a,u,c,l,0,32,n,s)}return h})(await i(t),l,r,o)})()}const t=await u;return h.buffer=t,h.start(0),h}return await s(c,l,p),p};return{render(t,e){const n=a.get(e);return void 0!==n?Promise.resolve(n):c(t,e)}}})(cn,_t,je,Pe,zn),Ln=(t=>(e,n,s)=>{if(void 0===e.createIIRFilter)return t(e,n,s);const i=e.createIIRFilter(s.feedforward,s.feedback);return Xt(i,s),i})(jn),Un=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u=i(a),c={...Lt,...o},l=e(a,u?null:t.baseLatency,c);super(t,!1,l,u?n(c.feedback,c.feedforward):null),(t=>{var e;t.getFrequencyResponse=(e=t.getFrequencyResponse,(n,s,i)=>{if(n.length!==s.length||s.length!==i.length)throw Wt();return e.call(t,n,s,i)})})(l),this._nativeIIRFilterNode=l,r(this,1)}getFrequencyResponse(t,e,n){return this._nativeIIRFilterNode.getFrequencyResponse(t,e,n)}})(Ze,Ln,Wn,qe,ze,gn),Hn=((t,e,n,s,i,r,o,a)=>(u,c)=>{const l=c.listener,{forwardX:h,forwardY:p,forwardZ:d,positionX:f,positionY:_,positionZ:m,upX:g,upY:v,upZ:y}=void 0===l.forwardX?(()=>{const h=new Float32Array(1),p=e(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),d=o(c);let f=!1,_=[0,0,-1,0,1,0],m=[0,0,0];const g=()=>{if(f)return;f=!0;const t=s(c,256,9,0);t.onaudioprocess=({inputBuffer:t})=>{const e=[r(t,h,0),r(t,h,1),r(t,h,2),r(t,h,3),r(t,h,4),r(t,h,5)];e.some(((t,e)=>t!==_[e]))&&(l.setOrientation(...e),_=e);const n=[r(t,h,6),r(t,h,7),r(t,h,8)];n.some(((t,e)=>t!==m[e]))&&(l.setPosition(...n),m=n)},p.connect(t)},v=t=>e=>{e!==_[t]&&(_[t]=e,l.setOrientation(..._))},y=t=>e=>{e!==m[t]&&(m[t]=e,l.setPosition(...m))},w=(e,s,r)=>{const o=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:s});o.connect(p,0,e),o.start(),Object.defineProperty(o.offset,"defaultValue",{get:()=>s});const l=t({context:u},d,o.offset,Q,Y);var h,f,_,m,v,y,w;return a(l,"value",(t=>()=>t.call(l)),(t=>e=>{try{t.call(l,e)}catch(t){if(9!==t.code)throw t}g(),d&&r(e)})),l.cancelAndHoldAtTime=(h=l.cancelAndHoldAtTime,d?()=>{throw i()}:(...t)=>{const e=h.apply(l,t);return g(),e}),l.cancelScheduledValues=(f=l.cancelScheduledValues,d?()=>{throw i()}:(...t)=>{const e=f.apply(l,t);return g(),e}),l.exponentialRampToValueAtTime=(_=l.exponentialRampToValueAtTime,d?()=>{throw i()}:(...t)=>{const e=_.apply(l,t);return g(),e}),l.linearRampToValueAtTime=(m=l.linearRampToValueAtTime,d?()=>{throw i()}:(...t)=>{const e=m.apply(l,t);return g(),e}),l.setTargetAtTime=(v=l.setTargetAtTime,d?()=>{throw i()}:(...t)=>{const e=v.apply(l,t);return g(),e}),l.setValueAtTime=(y=l.setValueAtTime,d?()=>{throw i()}:(...t)=>{const e=y.apply(l,t);return g(),e}),l.setValueCurveAtTime=(w=l.setValueCurveAtTime,d?()=>{throw i()}:(...t)=>{const e=w.apply(l,t);return g(),e}),l};return{forwardX:w(0,0,v(0)),forwardY:w(1,0,v(1)),forwardZ:w(2,-1,v(2)),positionX:w(6,0,y(0)),positionY:w(7,0,y(1)),positionZ:w(8,0,y(2)),upX:w(3,0,v(3)),upY:w(4,1,v(4)),upZ:w(5,0,v(5))}})():l;return{get forwardX(){return h},get forwardY(){return p},get forwardZ(){return d},get positionX(){return f},get positionY(){return _},get positionZ(){return m},get upX(){return g},get upY(){return v},get upZ(){return y}}})(pn,xn,Sn,ue,ce,me,ze,ve),$n=new WeakMap,Gn=((t,e,n,s,i,r)=>class extends n{constructor(n,r){super(n),this._nativeContext=n,C.set(this,n),s(n)&&i.set(n,new Set),this._destination=new t(this,r),this._listener=e(this,n),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(t){const e="function"==typeof t?r(this,t):null;this._nativeContext.onstatechange=e;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===e?t:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(_n,Hn,Le,ze,$n,Ae),Xn=((t,e,n,s,i,r)=>(o,a)=>{const u=o.createOscillator();return Xt(u,a),Yt(u,a,"detune"),Yt(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):Gt(u,a,"type"),e(n,(()=>n(o)))||Qt(u),e(s,(()=>s(o)))||r(u,o),e(i,(()=>i(o)))||Kt(u),t(o,u),u})(on,Ee,we,xe,be,Te),Zn=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null,u=null;return{set periodicWave(t){o=t},set start(t){a=t},set stop(t){u=t},render(c,l){const h=r.get(l);return void 0!==h?Promise.resolve(h):(async(c,l)=>{let h=n(c);const p=H(h,l);if(!p){const t={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,detune:h.detune.value,frequency:h.frequency.value,periodicWave:null===o?void 0:o,type:h.type};h=e(l,t),null!==a&&h.start(a),null!==u&&h.stop(u)}return r.set(l,h),p?(await t(l,c.detune,h.detune),await t(l,c.frequency,h.frequency)):(await s(l,c.detune,h.detune),await s(l,c.frequency,h.frequency)),await i(c,l,h),h})(c,l)}}})(un,Xn,_t,ln,Pe),Yn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,o){const a=i(t),u={...he,...o},c=n(a,u),l=r(a),h=l?s():null,p=t.sampleRate/2;super(t,!1,c,h),this._detune=e(this,l,c.detune,153600,-153600),this._frequency=e(this,l,c.frequency,p,-p),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=h,null!==this._oscillatorNodeRenderer&&void 0!==u.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=u.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(t){const e="function"==typeof t?o(this,t):null;this._nativeOscillatorNode.onended=e;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===e?t:n}get type(){return this._nativeOscillatorNode.type}set type(t){this._nativeOscillatorNode.type=t,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(t){this._nativeOscillatorNode.setPeriodicWave(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=t)}start(t=0){if(this._nativeOscillatorNode.start(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=t),"closed"!==this.context.state){j(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(Ze,pn,Xn,Zn,qe,ze,Ae),Qn=(t=>(e,n)=>{const s=t(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),i=e.createBuffer(1,2,44100);return s.buffer=i,s.loop=!0,s.connect(n),s.start(),()=>{s.stop(),s.disconnect(n)}})(cn),Kn=((t,e,n,s,i)=>(r,{curve:o,oversample:a,...u})=>{const c=r.createWaveShaper(),l=r.createWaveShaper();Xt(c,u),Xt(l,u);const h=n(r,{...u,gain:1}),p=n(r,{...u,gain:-1}),d=n(r,{...u,gain:1}),f=n(r,{...u,gain:-1});let _=null,m=!1,g=null;const v={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){h.channelCount=t,p.channelCount=t,c.channelCount=t,d.channelCount=t,l.channelCount=t,f.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){h.channelCountMode=t,p.channelCountMode=t,c.channelCountMode=t,d.channelCountMode=t,l.channelCountMode=t,f.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){h.channelInterpretation=t,p.channelInterpretation=t,c.channelInterpretation=t,d.channelInterpretation=t,l.channelInterpretation=t,f.channelInterpretation=t},get context(){return c.context},get curve(){return g},set curve(n){if(null!==n&&n.length<2)throw e();if(null===n)c.curve=n,l.curve=n;else{const t=n.length,e=new Float32Array(t+2-t%2),s=new Float32Array(t+2-t%2);e[0]=n[0],s[0]=-n[t-1];const i=Math.ceil((t+1)/2),r=(t+1)/2-1;for(let o=1;o<i;o+=1){const a=o/i*r,u=Math.floor(a),c=Math.ceil(a);e[o]=u===c?n[u]:(1-(a-u))*n[u]+(1-(c-a))*n[c],s[o]=u===c?-n[t-1-u]:-(1-(a-u))*n[t-1-u]-(1-(c-a))*n[t-1-c]}e[i]=t%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=e,l.curve=s}g=n,m&&(s(g)&&null===_?_=t(r,h):null!==_&&(_(),_=null))},get inputs(){return[h]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(t){c.oversample=t,l.oversample=t},addEventListener:(...t)=>h.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>h.dispatchEvent(t[0]),removeEventListener:(...t)=>h.removeEventListener(t[0],t[1],t[2])};null!==o&&(v.curve=o instanceof Float32Array?o:new Float32Array(o)),a!==v.oversample&&(v.oversample=a);return i(se(v,d),(()=>{h.connect(c).connect(d),h.connect(p).connect(l).connect(f).connect(d),m=!0,s(g)&&(_=t(r,h))}),(()=>{h.disconnect(c),c.disconnect(d),h.disconnect(p),p.disconnect(l),l.disconnect(f),f.disconnect(d),m=!1,null!==_&&(_(),_=null)}))})(Qn,zt,re,ge,yn),Jn=((t,e,n,s,i,r,o)=>(a,u)=>{const c=a.createWaveShaper();if(null!==r&&"webkitAudioContext"===r.name&&void 0===a.createGain().gain.automationRate)return n(a,u);Xt(c,u);const l=null===u.curve||u.curve instanceof Float32Array?u.curve:new Float32Array(u.curve);if(null!==l&&l.length<2)throw e();Gt(c,{curve:l},"curve"),Gt(c,u,"oversample");let h=null,p=!1;o(c,"curve",(t=>()=>t.call(c)),(e=>n=>(e.call(c,n),p&&(s(n)&&null===h?h=t(a,c):s(n)||null===h||(h(),h=null)),n)));return i(c,(()=>{p=!0,s(c.curve)&&(h=t(a,c))}),(()=>{p=!1,null!==h&&(h(),h=null)}))})(Qn,zt,Kn,ge,yn,Ue,ve),ts=((t,e,n,s,i,r,o,a,u,c)=>(l,{coneInnerAngle:h,coneOuterAngle:p,coneOuterGain:d,distanceModel:f,maxDistance:_,orientationX:m,orientationY:g,orientationZ:v,panningModel:y,positionX:w,positionY:x,positionZ:b,refDistance:T,rolloffFactor:A,...k})=>{const C=l.createPanner();if(k.channelCount>2)throw o();if("max"===k.channelCountMode)throw o();Xt(C,k);const S={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},O=n(l,{...S,channelInterpretation:"speakers",numberOfInputs:6}),M=s(l,{...k,gain:1}),E=s(l,{...S,gain:1}),D=s(l,{...S,gain:0}),I=s(l,{...S,gain:0}),R=s(l,{...S,gain:0}),N=s(l,{...S,gain:0}),B=s(l,{...S,gain:0}),P=i(l,256,6,1),V=r(l,{...S,curve:new Float32Array([1,1]),oversample:"none"});let q=[m,g,v],F=[w,x,b];const j=new Float32Array(1);P.onaudioprocess=({inputBuffer:t})=>{const e=[u(t,j,0),u(t,j,1),u(t,j,2)];e.some(((t,e)=>t!==q[e]))&&(C.setOrientation(...e),q=e);const n=[u(t,j,3),u(t,j,4),u(t,j,5)];n.some(((t,e)=>t!==F[e]))&&(C.setPosition(...n),F=n)},Object.defineProperty(D.gain,"defaultValue",{get:()=>0}),Object.defineProperty(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(B.gain,"defaultValue",{get:()=>0});const z={get bufferSize(){},get channelCount(){return C.channelCount},set channelCount(t){if(t>2)throw o();M.channelCount=t,C.channelCount=t},get channelCountMode(){return C.channelCountMode},set channelCountMode(t){if("max"===t)throw o();M.channelCountMode=t,C.channelCountMode=t},get channelInterpretation(){return C.channelInterpretation},set channelInterpretation(t){M.channelInterpretation=t,C.channelInterpretation=t},get coneInnerAngle(){return C.coneInnerAngle},set coneInnerAngle(t){C.coneInnerAngle=t},get coneOuterAngle(){return C.coneOuterAngle},set coneOuterAngle(t){C.coneOuterAngle=t},get coneOuterGain(){return C.coneOuterGain},set coneOuterGain(t){if(t<0||t>1)throw e();C.coneOuterGain=t},get context(){return C.context},get distanceModel(){return C.distanceModel},set distanceModel(t){C.distanceModel=t},get inputs(){return[M]},get maxDistance(){return C.maxDistance},set maxDistance(t){if(t<0)throw new RangeError;C.maxDistance=t},get numberOfInputs(){return C.numberOfInputs},get numberOfOutputs(){return C.numberOfOutputs},get orientationX(){return E.gain},get orientationY(){return D.gain},get orientationZ(){return I.gain},get panningModel(){return C.panningModel},set panningModel(t){C.panningModel=t},get positionX(){return R.gain},get positionY(){return N.gain},get positionZ(){return B.gain},get refDistance(){return C.refDistance},set refDistance(t){if(t<0)throw new RangeError;C.refDistance=t},get rolloffFactor(){return C.rolloffFactor},set rolloffFactor(t){if(t<0)throw new RangeError;C.rolloffFactor=t},addEventListener:(...t)=>M.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>M.dispatchEvent(t[0]),removeEventListener:(...t)=>M.removeEventListener(t[0],t[1],t[2])};h!==z.coneInnerAngle&&(z.coneInnerAngle=h),p!==z.coneOuterAngle&&(z.coneOuterAngle=p),d!==z.coneOuterGain&&(z.coneOuterGain=d),f!==z.distanceModel&&(z.distanceModel=f),_!==z.maxDistance&&(z.maxDistance=_),m!==z.orientationX.value&&(z.orientationX.value=m),g!==z.orientationY.value&&(z.orientationY.value=g),v!==z.orientationZ.value&&(z.orientationZ.value=v),y!==z.panningModel&&(z.panningModel=y),w!==z.positionX.value&&(z.positionX.value=w),x!==z.positionY.value&&(z.positionY.value=x),b!==z.positionZ.value&&(z.positionZ.value=b),T!==z.refDistance&&(z.refDistance=T),A!==z.rolloffFactor&&(z.rolloffFactor=A),1===q[0]&&0===q[1]&&0===q[2]||C.setOrientation(...q),0===F[0]&&0===F[1]&&0===F[2]||C.setPosition(...F);return c(se(z,C),(()=>{M.connect(C),t(M,V,0,0),V.connect(E).connect(O,0,0),V.connect(D).connect(O,0,1),V.connect(I).connect(O,0,2),V.connect(R).connect(O,0,3),V.connect(N).connect(O,0,4),V.connect(B).connect(O,0,5),O.connect(P).connect(l.destination)}),(()=>{M.disconnect(C),a(M,V,0,0),V.disconnect(E),E.disconnect(O),V.disconnect(D),D.disconnect(O),V.disconnect(I),I.disconnect(O),V.disconnect(R),R.disconnect(O),V.disconnect(N),N.disconnect(O),V.disconnect(B),B.disconnect(O),O.disconnect(P),P.disconnect(l.destination)}))})(lt,zt,xn,re,ue,Jn,ce,ft,me,yn),es=(t=>(e,n)=>{const s=e.createPanner();return void 0===s.orientationX?t(e,n):(Xt(s,n),Yt(s,n,"orientationX"),Yt(s,n,"orientationY"),Yt(s,n,"orientationZ"),Yt(s,n,"positionX"),Yt(s,n,"positionY"),Yt(s,n,"positionZ"),Gt(s,n,"coneInnerAngle"),Gt(s,n,"coneOuterAngle"),Gt(s,n,"coneOuterGain"),Gt(s,n,"distanceModel"),Gt(s,n,"maxDistance"),Gt(s,n,"panningModel"),Gt(s,n,"refDistance"),Gt(s,n,"rolloffFactor"),s)})(ts),ns=((t,e,n,s,i,r,o,a,u,c)=>()=>{const l=new WeakMap;let h=null;return{render(p,d){const f=l.get(d);return void 0!==f?Promise.resolve(f):(async(p,d)=>{let f=null,_=r(p);const m={channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation},g={...m,coneInnerAngle:_.coneInnerAngle,coneOuterAngle:_.coneOuterAngle,coneOuterGain:_.coneOuterGain,distanceModel:_.distanceModel,maxDistance:_.maxDistance,panningModel:_.panningModel,refDistance:_.refDistance,rolloffFactor:_.rolloffFactor},v=H(_,d);if("bufferSize"in _)f=s(d,{...m,gain:1});else if(!v){const t={...g,orientationX:_.orientationX.value,orientationY:_.orientationY.value,orientationZ:_.orientationZ.value,positionX:_.positionX.value,positionY:_.positionY.value,positionZ:_.positionZ.value};_=i(d,t)}if(l.set(d,null===f?_:f),null!==f){if(null===h){if(null===o)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new o(6,p.context.length,d.sampleRate),s=e(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});s.connect(t.destination),h=(async()=>{const e=await Promise.all([p.orientationX,p.orientationY,p.orientationZ,p.positionX,p.positionY,p.positionZ].map((async(e,s)=>{const i=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===s?1:0});return await a(t,e,i.offset),i})));for(let t=0;t<6;t+=1)e[t].connect(s,0,t),e[t].start(0);return c(t)})()}const t=await h,r=s(d,{...m,gain:1});await u(p,d,r);const l=[];for(let e=0;e<t.numberOfChannels;e+=1)l.push(t.getChannelData(e));let _=[l[0][0],l[1][0],l[2][0]],v=[l[3][0],l[4][0],l[5][0]],y=s(d,{...m,gain:1}),w=i(d,{...g,orientationX:_[0],orientationY:_[1],orientationZ:_[2],positionX:v[0],positionY:v[1],positionZ:v[2]});r.connect(y).connect(w.inputs[0]),w.connect(f);for(let e=128;e<t.length;e+=128){const t=[l[0][e],l[1][e],l[2][e]],n=[l[3][e],l[4][e],l[5][e]];if(t.some(((t,e)=>t!==_[e]))||n.some(((t,e)=>t!==v[e]))){_=t,v=n;const o=e/d.sampleRate;y.gain.setValueAtTime(0,o),y=s(d,{...m,gain:0}),w=i(d,{...g,orientationX:_[0],orientationY:_[1],orientationZ:_[2],positionX:v[0],positionY:v[1],positionZ:v[2]}),y.gain.setValueAtTime(1,o),r.connect(y).connect(w.inputs[0]),w.connect(f)}}return f}return v?(await t(d,p.orientationX,_.orientationX),await t(d,p.orientationY,_.orientationY),await t(d,p.orientationZ,_.orientationZ),await t(d,p.positionX,_.positionX),await t(d,p.positionY,_.positionY),await t(d,p.positionZ,_.positionZ)):(await a(d,p.orientationX,_.orientationX),await a(d,p.orientationY,_.orientationY),await a(d,p.orientationZ,_.orientationZ),await a(d,p.positionX,_.positionX),await a(d,p.positionY,_.positionY),await a(d,p.positionZ,_.positionZ)),ct(_)?await u(p,d,_.inputs[0]):await u(p,d,_),_})(p,d)}}})(un,xn,Sn,re,es,_t,je,ln,Pe,zn),ss=((t,e,n,s,i,r,o)=>class extends t{constructor(t,a){const u=i(t),c={...pe,...a},l=n(u,c),h=r(u);super(t,!1,l,h?s():null),this._nativePannerNode=l,this._orientationX=e(this,h,l.orientationX,Q,Y),this._orientationY=e(this,h,l.orientationY,Q,Y),this._orientationZ=e(this,h,l.orientationZ,Q,Y),this._positionX=e(this,h,l.positionX,Q,Y),this._positionY=e(this,h,l.positionY,Q,Y),this._positionZ=e(this,h,l.positionZ,Q,Y),o(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(t){this._nativePannerNode.coneInnerAngle=t}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(t){this._nativePannerNode.coneOuterAngle=t}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(t){this._nativePannerNode.coneOuterGain=t}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(t){this._nativePannerNode.distanceModel=t}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(t){this._nativePannerNode.maxDistance=t}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(t){this._nativePannerNode.panningModel=t}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(t){this._nativePannerNode.refDistance=t}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(t){this._nativePannerNode.rolloffFactor=t}})(Ze,pn,es,ns,qe,ze,gn),is=(t=>(e,{disableNormalization:n,imag:s,real:i})=>{const r=s instanceof Float32Array?s:new Float32Array(s),o=i instanceof Float32Array?i:new Float32Array(i),a=e.createPeriodicWave(o,r,{disableNormalization:n});if(Array.from(s).length<2)throw t();return a})(G),rs=((t,e,n,s)=>class i{constructor(i,r){const o=e(i),a=s({...de,...r}),u=t(o,a);return n.add(u),u}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===i.prototype||n.has(t)}})(is,qe,new WeakSet,(t=>{const{imag:e,real:n}=t;return void 0===e?void 0===n?{...t,imag:[0,0],real:[0,0]}:{...t,imag:Array.from(n,(()=>0)),real:n}:void 0===n?{...t,imag:e,real:Array.from(e,(()=>0))}:{...t,imag:e,real:n}})),os=((t,e,n,s,i,r)=>{const o=16385,a=new Float32Array([1,1]),u=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...c,oversample:"none"},h=(t,r,h,p,d)=>{if(1===r)return((t,e,i,r)=>{const h=new Float32Array(o),p=new Float32Array(o);for(let t=0;t<o;t+=1){const e=t/16384*u;h[t]=Math.cos(e),p[t]=Math.sin(e)}const d=n(t,{...c,gain:0}),f=s(t,{...l,curve:h}),_=s(t,{...l,curve:a}),m=n(t,{...c,gain:0}),g=s(t,{...l,curve:p});return{connectGraph(){e.connect(d),e.connect(void 0===_.inputs?_:_.inputs[0]),e.connect(m),_.connect(i),i.connect(void 0===f.inputs?f:f.inputs[0]),i.connect(void 0===g.inputs?g:g.inputs[0]),f.connect(d.gain),g.connect(m.gain),d.connect(r,0,0),m.connect(r,0,1)},disconnectGraph(){e.disconnect(d),e.disconnect(void 0===_.inputs?_:_.inputs[0]),e.disconnect(m),_.disconnect(i),i.disconnect(void 0===f.inputs?f:f.inputs[0]),i.disconnect(void 0===g.inputs?g:g.inputs[0]),f.disconnect(d.gain),g.disconnect(m.gain),d.disconnect(r,0,0),m.disconnect(r,0,1)}}})(t,h,p,d);if(2===r)return((t,i,r,h)=>{const p=new Float32Array(o),d=new Float32Array(o),f=new Float32Array(o),_=new Float32Array(o),m=Math.floor(8192.5);for(let t=0;t<o;t+=1)if(t>m){const e=(t-m)/(16384-m)*u;p[t]=Math.cos(e),d[t]=Math.sin(e),f[t]=0,_[t]=1}else{const e=t/(16384-m)*u;p[t]=1,d[t]=0,f[t]=Math.cos(e),_[t]=Math.sin(e)}const g=e(t,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),v=n(t,{...c,gain:0}),y=s(t,{...l,curve:p}),w=n(t,{...c,gain:0}),x=s(t,{...l,curve:d}),b=s(t,{...l,curve:a}),T=n(t,{...c,gain:0}),A=s(t,{...l,curve:f}),k=n(t,{...c,gain:0}),C=s(t,{...l,curve:_});return{connectGraph(){i.connect(g),i.connect(void 0===b.inputs?b:b.inputs[0]),g.connect(v,0),g.connect(w,0),g.connect(T,1),g.connect(k,1),b.connect(r),r.connect(void 0===y.inputs?y:y.inputs[0]),r.connect(void 0===x.inputs?x:x.inputs[0]),r.connect(void 0===A.inputs?A:A.inputs[0]),r.connect(void 0===C.inputs?C:C.inputs[0]),y.connect(v.gain),x.connect(w.gain),A.connect(T.gain),C.connect(k.gain),v.connect(h,0,0),T.connect(h,0,0),w.connect(h,0,1),k.connect(h,0,1)},disconnectGraph(){i.disconnect(g),i.disconnect(void 0===b.inputs?b:b.inputs[0]),g.disconnect(v,0),g.disconnect(w,0),g.disconnect(T,1),g.disconnect(k,1),b.disconnect(r),r.disconnect(void 0===y.inputs?y:y.inputs[0]),r.disconnect(void 0===x.inputs?x:x.inputs[0]),r.disconnect(void 0===A.inputs?A:A.inputs[0]),r.disconnect(void 0===C.inputs?C:C.inputs[0]),y.disconnect(v.gain),x.disconnect(w.gain),A.disconnect(T.gain),C.disconnect(k.gain),v.disconnect(h,0,0),T.disconnect(h,0,0),w.disconnect(h,0,1),k.disconnect(h,0,1)}}})(t,h,p,d);throw i()};return(e,{channelCount:s,channelCountMode:o,pan:a,...u})=>{if("max"===o)throw i();const c=t(e,{...u,channelCount:1,channelCountMode:o,numberOfInputs:2}),l=n(e,{...u,channelCount:s,channelCountMode:o,gain:1}),p=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:a});let{connectGraph:d,disconnectGraph:f}=h(e,s,l,p,c);Object.defineProperty(p.gain,"defaultValue",{get:()=>0}),Object.defineProperty(p.gain,"maxValue",{get:()=>1}),Object.defineProperty(p.gain,"minValue",{get:()=>-1});const _={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(t){l.channelCount!==t&&(m&&f(),({connectGraph:d,disconnectGraph:f}=h(e,t,l,p,c)),m&&d()),l.channelCount=t},get channelCountMode(){return l.channelCountMode},set channelCountMode(t){if("clamped-max"===t||"max"===t)throw i();l.channelCountMode=t},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(t){l.channelInterpretation=t},get context(){return l.context},get inputs(){return[l]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get pan(){return p.gain},addEventListener:(...t)=>l.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>l.dispatchEvent(t[0]),removeEventListener:(...t)=>l.removeEventListener(t[0],t[1],t[2])};let m=!1;return r(se(_,c),(()=>{d(),m=!0}),(()=>{f(),m=!1}))}})(xn,ne,re,Jn,ce,yn),as=((t,e)=>(n,s)=>{const i=s.channelCountMode;if("clamped-max"===i)throw e();if(void 0===n.createStereoPanner)return t(n,s);const r=n.createStereoPanner();return Xt(r,s),Yt(r,s,"pan"),Object.defineProperty(r,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),r})(os,ce),us=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,pan:u.pan.value};u=e(a,t)}return r.set(a,u),c?await t(a,o.pan,u.pan):await s(a,o.pan,u.pan),ct(u)?await i(o,a,u.inputs[0]):await i(o,a,u),u})(o,a)}}})(un,as,_t,ln,Pe),cs=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=i(t),u={...fe,...o},c=n(a,u),l=r(a);super(t,!1,c,l?s():null),this._pan=e(this,l,c.pan)}get pan(){return this._pan}})(Ze,pn,as,us,qe,ze),ls=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,curve:o.curve,oversample:o.oversample};o=t(r,e)}return s.set(r,o),ct(o)?await n(i,r,o.inputs[0]):await n(i,r,o),o})(i,r)}}})(Jn,_t,Pe),hs=((t,e,n,s,i,r,o)=>class extends t{constructor(t,e){const a=i(t),u={..._e,...e},c=n(a,u);super(t,!0,c,r(a)?s():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,o(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(t){if(null===t)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(t.length<2)throw e();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=t}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(t){this._nativeWaveShaperNode.oversample=t}})(Ze,zt,Jn,ls,qe,ze,gn),ps=(t=>null!==t&&t.isSecureContext)(Re),ds=(t=>(e,n,s)=>{Object.defineProperties(t,{currentFrame:{configurable:!0,get:()=>Math.round(e*n)},currentTime:{configurable:!0,get:()=>e}});try{return s()}finally{null!==t&&(delete t.currentFrame,delete t.currentTime)}})(Re),fs=new WeakMap,_s=((t,e)=>n=>{let s=t.get(n);if(void 0!==s)return s;if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");return s=new e(1,1,44100),t.set(n,s),s})(fs,je),ms=ps?((t,e,n,s,i,r,o,a,u,c,l,h,p)=>{let d=0;return(f,_,m={credentials:"omit"})=>{const g=l.get(f);if(void 0!==g&&g.has(_))return Promise.resolve();const v=c.get(f);if(void 0!==v){const t=v.get(_);if(void 0!==t)return t}const y=r(f),w=void 0===y.audioWorklet?i(_).then((([t,e])=>{const[s,i]=R(t,e);return n(`${s};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)})).then((()=>{const t=p._AWGS.pop();if(void 0===t)throw new SyntaxError;s(y.currentTime,y.sampleRate,(()=>t(class{},void 0,((t,n)=>{if(""===t.trim())throw e();const s=M.get(y);if(void 0!==s){if(s.has(t))throw e();B(n),N(n.parameterDescriptors),s.set(t,n)}else B(n),N(n.parameterDescriptors),M.set(y,new Map([[t,n]]))}),y.sampleRate,void 0,void 0)))})):Promise.all([i(_),Promise.resolve(t(h,h))]).then((([[t,e],n])=>{const s=d+1;d=s;const[i,r]=R(t,e),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${r}\n})(${n?"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{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"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${s}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),l=URL.createObjectURL(c);return y.audioWorklet.addModule(l,m).then((()=>{if(a(y))return y;const t=o(y);return t.audioWorklet.addModule(l,m).then((()=>t))})).then((t=>{if(null===u)throw new SyntaxError;try{new u(t,`__sac${s}`)}catch{throw new SyntaxError}})).finally((()=>URL.revokeObjectURL(l)))}));return void 0===v?c.set(f,new Map([[_,w]])):v.set(_,w),w.then((()=>{const t=l.get(f);void 0===t?l.set(f,new Set([_])):t.add(_)})).finally((()=>{const t=c.get(f);void 0!==t&&t.delete(_)})),w}})(Ee,ce,(t=>e=>new Promise(((n,s)=>{if(null===t)return void s(new SyntaxError);const i=t.document.head;if(null===i)s(new SyntaxError);else{const r=t.document.createElement("script"),o=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(o),u=t.onerror,c=()=>{t.onerror=u,URL.revokeObjectURL(a)};t.onerror=(e,n,i,r,o)=>n===a||n===t.location.href&&1===i&&1===r?(c(),s(o),!1):null!==u?u(e,n,i,r,o):void 0,r.onerror=()=>{c(),s(new SyntaxError)},r.onload=()=>{c(),n()},r.src=a,r.type="module",i.appendChild(r)}})))(Re),ds,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})((()=>new DOMException("","AbortError"))),qe,_s,ze,Xe,new WeakMap,new WeakMap,((t,e)=>async()=>{if(null===t)return!0;if(null===e)return!1;const n=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 e(1,128,44100),i=URL.createObjectURL(n);let r=!1,o=!1;try{await s.audioWorklet.addModule(i);const e=new t(s,"a",{numberOfOutputs:0}),n=s.createOscillator();e.port.onmessage=()=>r=!0,e.onprocessorerror=()=>o=!0,n.connect(e),n.start(0),await s.startRendering()}catch{}finally{URL.revokeObjectURL(i)}return r&&!o})(Xe,je),Re):void 0,gs=((t,e)=>n=>t(n)||e(n))(He,ze),vs=((t,e,n,s,i,r,o,a,u,c,l)=>(h,p)=>{const d=o(h)?h:r(h);if(i.has(p)){const t=n();return Promise.reject(t)}try{i.add(p)}catch{}return e(u,(()=>u(d)))?d.decodeAudioData(p).then((n=>(Pt(p).catch((()=>{})),e(a,(()=>a(n)))||l(n),t.add(n),n))):new Promise(((e,n)=>{const i=async()=>{try{await Pt(p)}catch{}},r=t=>{n(t),i()};try{d.decodeAudioData(p,(n=>{"function"!=typeof n.copyFromChannel&&(c(n),X(n)),t.add(n),i().then((()=>e(n)))}),(t=>{r(null===t?s():t)}))}catch(t){r(t)}}))})(Ke,Ee,(()=>new DOMException("","DataCloneError")),(()=>new DOMException("","EncodingError")),new WeakSet,qe,gs,$,$t,nn,sn),ys=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_,m,g,v,y)=>class extends f{constructor(e,n){super(e,n),this._nativeContext=e,this._audioWorklet=void 0===t?void 0:{addModule:(e,n)=>t(this,e,n)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new e(this)}createBiquadFilter(){return new i(this)}createBuffer(t,e,s){return new n({length:e,numberOfChannels:t,sampleRate:s})}createBufferSource(){return new s(this)}createChannelMerger(t=6){return new r(this,{numberOfInputs:t})}createChannelSplitter(t=6){return new o(this,{numberOfOutputs:t})}createConstantSource(){return new a(this)}createConvolver(){return new u(this)}createDelay(t=1){return new l(this,{maxDelayTime:t})}createDynamicsCompressor(){return new h(this)}createGain(){return new p(this)}createIIRFilter(t,e){return new d(this,{feedback:e,feedforward:t})}createOscillator(){return new _(this)}createPanner(){return new m(this)}createPeriodicWave(t,e,n={disableNormalization:!1}){return new g(this,{...n,imag:e,real:t})}createStereoPanner(){return new v(this)}createWaveShaper(){return new y(this)}decodeAudioData(t,e,n){return c(this._nativeContext,t).then((t=>("function"==typeof e&&e(t),t)),(t=>{throw"function"==typeof n&&n(t),t}))}})(ms,Qe,rn,fn,vn,Tn,kn,Mn,In,vs,Nn,Vn,Fn,Un,Gn,Yn,ss,rs,cs,hs),ws=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t),o=e(r,i);if(s(r))throw TypeError();super(t,!0,o,null),this._nativeMediaElementAudioSourceNode=o}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(Ze,((t,e)=>t.createMediaElementSource(e.mediaElement)),qe,ze),xs=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t);if(s(r))throw new TypeError;const o={...Ht,...i},a=e(r,o);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(Ze,((t,e)=>{const n=t.createMediaStreamDestination();return Xt(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n}),qe,ze),bs=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t),o=e(r,i);if(s(r))throw new TypeError;super(t,!0,o,null),this._nativeMediaStreamAudioSourceNode=o}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(Ze,((t,{mediaStream:e})=>{const n=e.getAudioTracks();n.sort(((t,e)=>t.id<e.id?-1:t.id>e.id?1:0));const s=n.slice(0,1),i=t.createMediaStreamSource(new MediaStream(s));return Object.defineProperty(i,"mediaStream",{value:e}),i}),qe,ze),Ts=((t,e)=>(n,{mediaStreamTrack:s})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(s);const i=new MediaStream([s]),r=n.createMediaStreamSource(i);if("audio"!==s.kind)throw t();if(e(n))throw new TypeError;return r})(zt,ze),As=((t,e,n)=>class extends t{constructor(t,s){const i=n(t);super(t,!0,e(i,s),null)}})(Ze,Ts,qe),ks=((t,e,n,s,i,r,o,a,u)=>class extends t{constructor(t={}){if(null===u)throw new Error("Missing the native AudioContext constructor.");let e;try{e=new u(t)}catch(t){if(12===t.code&&"sampleRate is not in range"===t.message)throw n();throw t}if(null===e)throw s();if(!(t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t))(t.latencyHint))throw new TypeError(`The provided value '${t.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==t.sampleRate&&e.sampleRate!==t.sampleRate)throw n();super(e,2);const{latencyHint:i}=t,{sampleRate:r}=e;if(this._baseLatency="number"==typeof e.baseLatency?e.baseLatency:"balanced"===i?512/r:"interactive"===i||void 0===i?256/r:"playback"===i?1024/r:128*Math.max(2,Math.min(128,Math.round(i*r/128)))/r,this._nativeAudioContext=e,"webkitAudioContext"===u.name?(this._nativeGainNode=e.createGain(),this._nativeOscillatorNode=e.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(e.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===e.state){this._state="suspended";const t=()=>{"suspended"===this._state&&(this._state=null),e.removeEventListener("statechange",t)};e.addEventListener("statechange",t)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then((()=>{throw e()})):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then((()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),st(this)})))}createMediaElementSource(t){return new i(this,{mediaElement:t})}createMediaStreamDestination(){return new r(this)}createMediaStreamSource(t){return new o(this,{mediaStream:t})}createMediaStreamTrackSource(t){return new a(this,{mediaStreamTrack:t})}resume(){return"suspended"===this._state?new Promise(((t,e)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?t():this.resume().then(t,e)};this._nativeAudioContext.addEventListener("statechange",n)})):this._nativeAudioContext.resume().catch((t=>{if(void 0===t||15===t.code)throw e();throw t}))}suspend(){return this._nativeAudioContext.suspend().catch((t=>{if(void 0===t)throw e();throw t}))}})(ys,zt,ce,(()=>new DOMException("","UnknownError")),ws,xs,bs,As,Ue),Cs=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})($n),Ss=(t=>(e,n)=>{t(e).add(n)})(Cs),Os=(t=>(e,n,s=0,i=0)=>{const r=e[s];if(void 0===r)throw t();return xt(n)?r.connect(n,0,i):r.connect(n,0)})(G),Ms=(t=>(e,n)=>{t(e).delete(n)})(Cs),Es=(t=>(e,n=void 0,s=void 0,i=0)=>void 0===n?e.forEach((t=>t.disconnect())):"number"==typeof n?qt(t,e,n).disconnect():xt(n)?void 0===s?e.forEach((t=>t.disconnect(n))):void 0===i?qt(t,e,s).disconnect(n,0):qt(t,e,s).disconnect(n,0,i):void 0===s?e.forEach((t=>t.disconnect(n))):qt(t,e,s).disconnect(n,0))(G),Ds=new WeakMap,Is=((t,e)=>n=>e(t,n))(Ds,P),Rs=((t,e,n,s,i,r,o,a,u,c,l,h,p)=>(d,f,_,m)=>{if(0===m.numberOfInputs&&0===m.numberOfOutputs)throw u();const g=Array.isArray(m.outputChannelCount)?m.outputChannelCount:Array.from(m.outputChannelCount);if(g.some((t=>t<1)))throw u();if(g.length!==m.numberOfOutputs)throw e();if("explicit"!==m.channelCountMode)throw u();const v=m.channelCount*m.numberOfInputs,y=g.reduce(((t,e)=>t+e),0),w=void 0===_.parameterDescriptors?0:_.parameterDescriptors.length;if(v+w>6||y>6)throw u();const x=new MessageChannel,b=[],T=[];for(let t=0;t<m.numberOfInputs;t+=1)b.push(o(d,{channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation,gain:1})),T.push(i(d,{channelCount:m.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:m.channelCount}));const A=[];if(void 0!==_.parameterDescriptors)for(const{defaultValue:t,maxValue:e,minValue:n,name:s}of _.parameterDescriptors){const i=r(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==m.parameterData[s]?m.parameterData[s]:void 0===t?0:t});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===t?0:t},maxValue:{get:()=>void 0===e?Q:e},minValue:{get:()=>void 0===n?Y:n}}),A.push(i)}const k=s(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,v+w)}),C=Jt(f,d.sampleRate),S=a(d,C,v+w,Math.max(1,y)),O=i(d,{channelCount:Math.max(1,y),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,y)}),M=[];for(let t=0;t<m.numberOfOutputs;t+=1)M.push(s(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:g[t]}));for(let t=0;t<m.numberOfInputs;t+=1){b[t].connect(T[t]);for(let e=0;e<m.channelCount;e+=1)T[t].connect(k,e,t*m.channelCount+e)}const D=new kt(void 0===_.parameterDescriptors?[]:_.parameterDescriptors.map((({name:t},e)=>{const n=A[e];return n.connect(k,0,v+e),n.start(0),[t,n.offset]})));k.connect(S);let I=m.channelInterpretation,R=null;const N=0===m.numberOfOutputs?[S]:M,B={get bufferSize(){return C},get channelCount(){return m.channelCount},set channelCount(t){throw n()},get channelCountMode(){return m.channelCountMode},set channelCountMode(t){throw n()},get channelInterpretation(){return I},set channelInterpretation(t){for(const e of b)e.channelInterpretation=t;I=t},get context(){return S.context},get inputs(){return b},get numberOfInputs(){return m.numberOfInputs},get numberOfOutputs(){return m.numberOfOutputs},get onprocessorerror(){return R},set onprocessorerror(t){"function"==typeof R&&B.removeEventListener("processorerror",R),R="function"==typeof t?t:null,"function"==typeof R&&B.addEventListener("processorerror",R)},get parameters(){return D},get port(){return x.port2},addEventListener:(...t)=>S.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,N),disconnect:c.bind(null,N),dispatchEvent:(...t)=>S.dispatchEvent(t[0]),removeEventListener:(...t)=>S.removeEventListener(t[0],t[1],t[2])},P=new Map;var V,q;x.port1.addEventListener=(V=x.port1.addEventListener,(...t)=>{if("message"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=P.get(t[1]);void 0!==n?t[1]=n:(t[1]=t=>{l(d.currentTime,d.sampleRate,(()=>e(t)))},P.set(e,t[1]))}}return V.call(x.port1,t[0],t[1],t[2])}),x.port1.removeEventListener=(q=x.port1.removeEventListener,(...t)=>{if("message"===t[0]){const e=P.get(t[1]);void 0!==e&&(P.delete(t[1]),t[1]=e)}return q.call(x.port1,t[0],t[1],t[2])});let F=null;Object.defineProperty(x.port1,"onmessage",{get:()=>F,set:t=>{"function"==typeof F&&x.port1.removeEventListener("message",F),F="function"==typeof t?t:null,"function"==typeof F&&(x.port1.addEventListener("message",F),x.port1.start())}}),_.prototype.port=x.port1;let j=null;const z=((t,e,n,s)=>{let i=E.get(t);void 0===i&&(i=new WeakMap,E.set(t,i));const r=te(n,s);return i.set(e,r),r})(d,B,_,m);z.then((t=>j=t));const W=Mt(m.numberOfInputs,m.channelCount),L=Mt(m.numberOfOutputs,g),U=void 0===_.parameterDescriptors?[]:_.parameterDescriptors.reduce(((t,{name:e})=>({...t,[e]:new Float32Array(128)})),{});let H=!0;const $=()=>{m.numberOfOutputs>0&&S.disconnect(O);for(let t=0,e=0;t<m.numberOfOutputs;t+=1){const n=M[t];for(let s=0;s<g[t];s+=1)O.disconnect(n,e+s,s);e+=g[t]}},G=new Map;S.onaudioprocess=({inputBuffer:t,outputBuffer:e})=>{if(null!==j){const n=h(B);for(let s=0;s<C;s+=128){for(let e=0;e<m.numberOfInputs;e+=1)for(let n=0;n<m.channelCount;n+=1)St(t,W[e],n,n,s);void 0!==_.parameterDescriptors&&_.parameterDescriptors.forEach((({name:e},n)=>{St(t,U,e,v+n,s)}));for(let t=0;t<m.numberOfInputs;t+=1)for(let e=0;e<g[t];e+=1)0===L[t][e].byteLength&&(L[t][e]=new Float32Array(128));try{const t=W.map(((t,e)=>{if(n[e].size>0)return G.set(e,C/128),t;const s=G.get(e);return void 0===s?[]:(t.every((t=>t.every((t=>0===t))))&&(1===s?G.delete(e):G.set(e,s-1)),t)})),i=l(d.currentTime+s/d.sampleRate,d.sampleRate,(()=>j.process(t,L,U)));H=i;for(let t=0,n=0;t<m.numberOfOutputs;t+=1){for(let i=0;i<g[t];i+=1)Ot(e,L[t],i,n+i,s);n+=g[t]}}catch(t){H=!1,B.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}))}if(!H){for(let t=0;t<m.numberOfInputs;t+=1){b[t].disconnect(T[t]);for(let e=0;e<m.channelCount;e+=1)T[s].disconnect(k,e,t*m.channelCount+e)}if(void 0!==_.parameterDescriptors){const t=_.parameterDescriptors.length;for(let e=0;e<t;e+=1){const t=A[e];t.disconnect(k,0,v+e),t.stop()}}k.disconnect(S),S.onaudioprocess=null,X?$():J();break}}}};let X=!1;const Z=o(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),K=()=>S.connect(Z).connect(d.destination),J=()=>{S.disconnect(Z),Z.disconnect()};return K(),p(B,(()=>{if(H){J(),m.numberOfOutputs>0&&S.connect(O);for(let t=0,e=0;t<m.numberOfOutputs;t+=1){const n=M[t];for(let s=0;s<g[t];s+=1)O.connect(n,e+s,s);e+=g[t]}}X=!0}),(()=>{H&&(K(),$()),X=!1}))})(Os,G,zt,xn,ne,Sn,re,ue,ce,Es,ds,Is,yn),Ns=((t,e,n,s,i)=>(r,o,a,u,c,l)=>{if(null!==a)try{const e=new a(r,u,l),s=new Map;let o=null;if(Object.defineProperties(e,{channelCount:{get:()=>l.channelCount,set:()=>{throw t()}},channelCountMode:{get:()=>"explicit",set:()=>{throw t()}},onprocessorerror:{get:()=>o,set:t=>{"function"==typeof o&&e.removeEventListener("processorerror",o),o="function"==typeof t?t:null,"function"==typeof o&&e.addEventListener("processorerror",o)}}}),e.addEventListener=(p=e.addEventListener,(...t)=>{if("processorerror"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=s.get(t[1]);void 0!==n?t[1]=n:(t[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),e(n)):e(new ErrorEvent(t[0],{...n}))},s.set(e,t[1]))}}return p.call(e,"error",t[1],t[2]),p.call(e,...t)}),e.removeEventListener=(h=e.removeEventListener,(...t)=>{if("processorerror"===t[0]){const e=s.get(t[1]);void 0!==e&&(s.delete(t[1]),t[1]=e)}return h.call(e,"error",t[1],t[2]),h.call(e,t[0],t[1],t[2])}),0!==l.numberOfOutputs){const t=n(r,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(t).connect(r.destination);return i(e,(()=>t.disconnect()),(()=>t.connect(r.destination)))}return e}catch(t){if(11===t.code)throw s();throw t}var h,p;if(void 0===c)throw s();return(t=>{const{port1:e}=new MessageChannel;try{e.postMessage(t)}finally{e.close()}})(l),e(r,o,c,l)})(zt,Rs,re,ce,yn),Bs=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_)=>(m,g,v)=>{const y=new WeakMap;let w=null;return{render(x,b){a(b,x);const T=y.get(b);return void 0!==T?Promise.resolve(T):(async(a,x)=>{let b=l(a),T=null;const A=H(b,x),k=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(null===h){const t=k.reduce(((t,e)=>t+e),0),n=i(x,{channelCount:Math.max(1,t),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,t)}),r=[];for(let t=0;t<a.numberOfOutputs;t+=1)r.push(s(x,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:k[t]}));const c=o(x,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1});c.connect=e.bind(null,r),c.disconnect=u.bind(null,r),T=[n,r,c]}else A||(b=new h(x,m));if(y.set(x,null===T?b:T[2]),null!==T){if(null===w){if(void 0===v)throw new Error("Missing the processor constructor.");if(null===p)throw new Error("Missing the native OfflineAudioContext constructor.");const t=a.channelCount*a.numberOfInputs,e=void 0===v.parameterDescriptors?0:v.parameterDescriptors.length,n=t+e,u=async()=>{const u=new p(n,128*Math.ceil(a.context.length/128),x.sampleRate),c=[],l=[];for(let t=0;t<g.numberOfInputs;t+=1)c.push(o(u,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),l.push(i(u,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const h=await Promise.all(Array.from(a.parameters.values()).map((async t=>{const e=r(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:t.value});return await d(u,t,e.offset),e}))),m=s(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,t+e)});for(let t=0;t<g.numberOfInputs;t+=1){c[t].connect(l[t]);for(let e=0;e<g.channelCount;e+=1)l[t].connect(m,e,t*g.channelCount+e)}for(const[e,n]of h.entries())n.connect(m,0,t+e),n.start(0);return m.connect(u.destination),await Promise.all(c.map((t=>f(a,u,t)))),_(u)};w=Et(a,0===n?null:await u(),x,g,k,v,c)}const t=await w,e=n(x,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[u,l,h]=T;null!==t&&(e.buffer=t,e.start(0)),e.connect(u);for(let t=0,e=0;t<a.numberOfOutputs;t+=1){const n=l[t];for(let s=0;s<k[t];s+=1)u.connect(n,e+s,s);e+=k[t]}return h}if(A)for(const[e,n]of a.parameters.entries())await t(x,n,b.parameters.get(e));else for(const[t,e]of a.parameters.entries())await d(x,e,b.parameters.get(t));return await f(a,x,b),b})(x,b)}}})(un,Os,cn,xn,ne,Sn,re,Ms,Es,ds,_t,Xe,je,ln,Pe,zn),Ps=(t=>e=>t.get(e))(fs),Vs=(t=>(e,n)=>{t.set(e,n)})(Ds),qs=ps?((t,e,n,s,i,r,o,a,u,c,l,h,p,d)=>class extends e{constructor(e,d,f){var _;const m=a(e),g=u(m),v=l({...Ct,...f});p(v);const y=M.get(m),w=null==y?void 0:y.get(d),x=g||"closed"!==m.state?m:null!==(_=o(m))&&void 0!==_?_:m,b=i(x,g?null:e.baseLatency,c,d,w,v);super(e,!0,b,g?s(d,v,w):null);const T=[];b.parameters.forEach(((t,e)=>{const s=n(this,g,t);T.push([e,s])})),this._nativeAudioWorkletNode=b,this._onprocessorerror=null,this._parameters=new kt(T),g&&t(m,this);const{activeInputs:A}=r(this);h(b,A)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(t){const e="function"==typeof t?d(this,t):null;this._nativeAudioWorkletNode.onprocessorerror=e;const n=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=null!==n&&n===e?t:n}get parameters(){return null===this._parameters?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}})(Ss,Ze,pn,Bs,Ns,tt,Ps,qe,ze,Xe,(t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},(()=>1))})),Vs,(t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}}),Ae):void 0,Fs=((t,e)=>(n,s,i)=>{if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new e(n,s,i)}catch(e){if("SyntaxError"===e.name)throw t();throw e}})(ce,je),js=((t,e,n,s,i,r,o,a)=>(u,c)=>n(u).render(u,c).then((()=>Promise.all(Array.from(s(c)).map((t=>n(t).render(t,c)))))).then((()=>i(c))).then((n=>("function"!=typeof n.copyFromChannel?(o(n),X(n)):e(r,(()=>r(n)))||a(n),t.add(n),n))))(Ke,Ee,Be,Cs,zn,$,nn,sn),zs=((t,e,n,s,i)=>class extends t{constructor(t,n,i){let r;if("number"==typeof t&&void 0!==n&&void 0!==i)r={length:n,numberOfChannels:t,sampleRate:i};else{if("object"!=typeof t)throw new Error("The given parameters are not valid.");r=t}const{length:o,numberOfChannels:a,sampleRate:u}={...le,...r},c=s(a,o,u);e($t,(()=>$t(c)))||c.addEventListener("statechange",(()=>{let t=0;const e=n=>{"running"===this._state&&(t>0?(c.removeEventListener("statechange",e),n.stopImmediatePropagation(),this._waitForThePromiseToSettle(n)):t+=1)};return e})()),super(c,a),this._length=o,this._nativeOfflineAudioContext=c,this._state=null}get length(){return void 0===this._nativeOfflineAudioContext.length?this._length:this._nativeOfflineAudioContext.length}get state(){return null===this._state?this._nativeOfflineAudioContext.state:this._state}startRendering(){return"running"===this._state?Promise.reject(n()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally((()=>{this._state=null,st(this)})))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout((()=>this._waitForThePromiseToSettle(t)))}})(ys,Ee,zt,Fs,js),Ws=((t,e)=>n=>{const s=t.get(n);return e(s)||e(n)})(C,He),Ls=((t,e)=>n=>t.has(n)||e(n))(T,$e),Us=((t,e)=>n=>t.has(n)||e(n))(k,Ge),Hs=((t,e)=>n=>{const s=t.get(n);return e(s)||e(n)})(C,ze);function $s(t,e){if(!t)throw new Error(e)}function Gs(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function Xs(t){t.isOffline||"running"===t.state||Ys('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let Zs=console;function Ys(...t){Zs.warn(...t)}function Qs(t){return void 0===t}function Ks(t){return!Qs(t)}function Js(t){return"number"==typeof t}function ti(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function ei(t){return"boolean"==typeof t}function ni(t){return Array.isArray(t)}function si(t){return"string"==typeof t}function ii(t){return si(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}const ri="object"==typeof self?self:null,oi=ri&&(ri.hasOwnProperty("AudioContext")||ri.hasOwnProperty("webkitAudioContext"));function ai(t,e,n,s){var i,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r<3?i(o):r>3?i(e,n,o):i(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o}function ui(t,e,n,s){return new(n||(n=Promise))((function(i,r){function o(t){try{u(s.next(t))}catch(t){r(t)}}function a(t){try{u(s.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}u((s=s.apply(t,e||[])).next())}))}class ci{constructor(t,e,n){this._callback=t,this._type=e,this._updateInterval=n,this._createClock()}_createWorker(){const t=new Blob([`\n\t\t\t// the initial timeout time\n\t\t\tlet timeoutTime = ${(1e3*this._updateInterval).toFixed(1)};\n\t\t\t// onmessage callback\n\t\t\tself.onmessage = function(msg){\n\t\t\t\ttimeoutTime = parseInt(msg.data);\n\t\t\t};\n\t\t\t// the tick function which posts a message\n\t\t\t// and schedules a new tick\n\t\t\tfunction tick(){\n\t\t\t\tsetTimeout(tick, timeoutTime);\n\t\t\t\tself.postMessage('tick');\n\t\t\t}\n\t\t\t// call tick initially\n\t\t\ttick();\n\t\t\t`],{type:"text/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);n.onmessage=this._callback.bind(this),this._worker=n}_createTimeout(){this._timeout=setTimeout((()=>{this._createTimeout(),this._callback()}),1e3*this._updateInterval)}_createClock(){if("worker"===this._type)try{this._createWorker()}catch(t){this._type="timeout",this._createClock()}else"timeout"===this._type&&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),"worker"===this._type&&this._worker.postMessage(Math.max(1e3*t,1))}get type(){return this._type}set type(t){this._disposeClock(),this._type=t,this._createClock()}dispose(){this._disposeClock()}}function li(t){return Us(t)}function hi(t){return Ls(t)}function pi(t){return Hs(t)}function di(t){return Ws(t)}function fi(t){return t instanceof AudioBuffer}function _i(t,e){return"value"===t||li(e)||hi(e)||fi(e)}function mi(t,...e){if(!e.length)return t;const n=e.shift();if(ti(t)&&ti(n))for(const e in n)_i(e,n[e])?t[e]=n[e]:ti(n[e])?(t[e]||Object.assign(t,{[e]:{}}),mi(t[e],n[e])):Object.assign(t,{[e]:n[e]});return mi(t,...e)}function gi(t,e,n=[],s){const i={},r=Array.from(e);if(ti(r[0])&&s&&!Reflect.has(r[0],s)){Object.keys(r[0]).some((e=>Reflect.has(t,e)))||(mi(i,{[s]:r[0]}),n.splice(n.indexOf(s),1),r.shift())}if(1===r.length&&ti(r[0]))mi(i,r[0]);else for(let t=0;t<n.length;t++)Ks(r[t])&&(i[n[t]]=r[t]);return mi(t,i)}function vi(t,e){return Qs(t)?e:t}function yi(t,e){return e.forEach((e=>{Reflect.has(t,e)&&delete t[e]})),t}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t="14.7.77",e=(t,e,n)=>({endTime:e,insertTime:n,type:"exponentialRampToValue",value:t}),n=(t,e,n)=>({endTime:e,insertTime:n,type:"linearRampToValue",value:t}),s=(t,e)=>({startTime:e,type:"setValue",value:t}),i=(t,e,n)=>({duration:n,startTime:e,type:"setValueCurve",values:t}),r=(t,e,{startTime:n,target:s,timeConstant:i})=>s+(e-s)*Math.exp((n-t)/i),o=t=>"exponentialRampToValue"===t.type,a=t=>"linearRampToValue"===t.type,u=t=>o(t)||a(t),c=t=>"setValue"===t.type,l=t=>"setValueCurve"===t.type,h=(t,e,n,s)=>{const i=t[e];return void 0===i?s:u(i)||c(i)?i.value:l(i)?i.values[i.values.length-1]:r(n,h(t,e-1,i.startTime,s),i)},p=(t,e,n,s,i)=>void 0===n?[s.insertTime,i]:u(n)?[n.endTime,n.value]:c(n)?[n.startTime,n.value]:l(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,h(t,e-1,n.startTime,i)],d=t=>"cancelAndHold"===t.type,f=t=>"cancelScheduledValues"===t.type,_=t=>d(t)||f(t)?t.cancelTime:o(t)||a(t)?t.endTime:t.startTime,m=(t,e,n,{endTime:s,value:i})=>n===i?i:0<n&&0<i||n<0&&i<0?n*(i/n)**((t-e)/(s-e)):0,g=(t,e,n,{endTime:s,value:i})=>n+(t-e)/(s-e)*(i-n),v=(t,{duration:e,startTime:n,values:s})=>((t,e)=>{const n=Math.floor(e),s=Math.ceil(e);return n===s?t[n]:(1-(e-n))*t[n]+(1-(s-e))*t[s]})(s,(t-n)/e*(s.length-1)),y=t=>"setTarget"===t.type;class w{constructor(t){this._automationEvents=[],this._currenTime=0,this._defaultValue=t}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}add(t){const r=_(t);if(d(t)||f(t)){const a=this._automationEvents.findIndex((e=>f(t)&&l(e)?e.startTime+e.duration>=r:_(e)>=r)),c=this._automationEvents[a];if(-1!==a&&(this._automationEvents=this._automationEvents.slice(0,a)),d(t)){const t=this._automationEvents[this._automationEvents.length-1];if(void 0!==c&&u(c)){if(void 0!==t&&y(t))throw new Error("The internal list is malformed.");const s=void 0===t?c.insertTime:l(t)?t.startTime+t.duration:_(t),i=void 0===t?this._defaultValue:l(t)?t.values[t.values.length-1]:t.value,a=o(c)?m(r,s,i,c):g(r,s,i,c),u=o(c)?e(a,r,this._currenTime):n(a,r,this._currenTime);this._automationEvents.push(u)}if(void 0!==t&&y(t)&&this._automationEvents.push(s(this.getValue(r),r)),void 0!==t&&l(t)&&t.startTime+t.duration>r){const e=r-t.startTime,n=(t.values.length-1)/t.duration,s=Math.max(2,1+Math.ceil(e*n)),o=e/(s-1)*n,a=t.values.slice(0,s);if(o<1)for(let e=1;e<s;e+=1){const n=o*e%1;a[e]=t.values[e-1]*(1-n)+t.values[e]*n}this._automationEvents[this._automationEvents.length-1]=i(a,t.startTime,e)}}}else{const s=this._automationEvents.findIndex((t=>_(t)>r)),i=-1===s?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[s-1];if(void 0!==i&&l(i)&&_(i)+i.duration>r)return!1;const u=o(t)?e(t.value,t.endTime,this._currenTime):a(t)?n(t.value,r,this._currenTime):t;if(-1===s)this._automationEvents.push(u);else{if(l(t)&&r+t.duration>_(this._automationEvents[s]))return!1;this._automationEvents.splice(s,0,u)}}return!0}flush(t){const e=this._automationEvents.findIndex((e=>_(e)>t));if(e>1){const t=this._automationEvents.slice(e-1),n=t[0];y(n)&&t.unshift(s(h(this._automationEvents,e-2,n.startTime,this._defaultValue),n.startTime)),this._automationEvents=t}}getValue(t){if(0===this._automationEvents.length)return this._defaultValue;const e=this._automationEvents.findIndex((e=>_(e)>t)),n=this._automationEvents[e],s=(-1===e?this._automationEvents.length:e)-1,i=this._automationEvents[s];if(void 0!==i&&y(i)&&(void 0===n||!u(n)||n.insertTime>t))return r(t,h(this._automationEvents,s-1,i.startTime,this._defaultValue),i);if(void 0!==i&&c(i)&&(void 0===n||!u(n)))return i.value;if(void 0!==i&&l(i)&&(void 0===n||!u(n)||i.startTime+i.duration>t))return t<i.startTime+i.duration?v(t,i):i.values[i.values.length-1];if(void 0!==i&&u(i)&&(void 0===n||!u(n)))return i.value;if(void 0!==n&&o(n)){const[e,r]=p(this._automationEvents,s,i,n,this._defaultValue);return m(t,e,r,n)}if(void 0!==n&&a(n)){const[e,r]=p(this._automationEvents,s,i,n,this._defaultValue);return g(t,e,r,n)}return this._defaultValue}}const x=new WeakSet,b=new WeakMap,T=new WeakMap,A=new WeakMap,k=new WeakMap,C=new WeakMap,S=new WeakMap,O=new WeakMap,M=new WeakMap,E=new WeakMap,D={construct:()=>D},I=/^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]*);?/,R=(t,e)=>{const n=[];let s=t.replace(/^[\s]+/,""),i=s.match(I);for(;null!==i;){const t=i[1].slice(1,-1),r=i[0].replace(/([\s]+)?;?$/,"").replace(t,new URL(t,e).toString());n.push(r),s=s.slice(i[0].length).replace(/^[\s]+/,""),i=s.match(I)}return[n.join(";"),s]},N=t=>{if(void 0!==t&&!Array.isArray(t))throw new TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},B=t=>{if(!(t=>{try{new new Proxy(t,D)}catch{return!1}return!0})(t))throw new TypeError("The given value for processorCtor should be a constructor.");if(null===t.prototype||"object"!=typeof t.prototype)throw new TypeError("The given value for processorCtor should have a prototype.")},P=(t,e)=>{const n=t.get(e);if(void 0===n)throw new Error("A value with the given key could not be found.");return n},V=(t,e)=>{const n=Array.from(t).filter(e);if(n.length>1)throw Error("More than one element was found.");if(0===n.length)throw Error("No element was found.");const[s]=n;return t.delete(s),s},q=(t,e,n,s)=>{const i=P(t,e),r=V(i,(t=>t[0]===n&&t[1]===s));return 0===i.size&&t.delete(e),r},F=t=>P(S,t),j=t=>{if(x.has(t))throw new Error("The AudioNode is already stored.");x.add(t),F(t).forEach((t=>t(!0)))},z=t=>"port"in t,W=t=>{if(!x.has(t))throw new Error("The AudioNode is not stored.");x.delete(t),F(t).forEach((t=>t(!1)))},L=(t,e)=>{!z(t)&&e.every((t=>0===t.size))&&W(t)},U={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},H=(t,e)=>t.context===e,$=t=>{try{t.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},G=()=>new DOMException("","IndexSizeError"),X=t=>{var e;t.getChannelData=(e=t.getChannelData,n=>{try{return e.call(t,n)}catch(t){if(12===t.code)throw G();throw t}})},Z={numberOfChannels:1},Y=-34028234663852886e22,Q=-Y,K=t=>x.has(t),J={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1},tt=t=>P(b,t),et=t=>P(A,t),nt=(t,e)=>{const{activeInputs:n}=tt(t);n.forEach((n=>n.forEach((([n])=>{e.includes(t)||nt(n,[...e,t])}))));const s=(t=>"playbackRate"in t)(t)?[t.playbackRate]:z(t)?Array.from(t.parameters.values()):(t=>"frequency"in t&&"gain"in t)(t)?[t.Q,t.detune,t.frequency,t.gain]:(t=>"offset"in t)(t)?[t.offset]:(t=>!("frequency"in t)&&"gain"in t)(t)?[t.gain]:(t=>"detune"in t&&"frequency"in t)(t)?[t.detune,t.frequency]:(t=>"pan"in t)(t)?[t.pan]:[];for(const t of s){const n=et(t);void 0!==n&&n.activeInputs.forEach((([t])=>nt(t,e)))}K(t)&&W(t)},st=t=>{nt(t.destination,[])},it=t=>"context"in t,rt=t=>it(t[0]),ot=(t,e,n,s)=>{for(const e of t)if(n(e)){if(s)return!1;throw Error("The set contains at least one similar element.")}return t.add(e),!0},at=(t,e,[n,s],i)=>{ot(t,[e,n,s],(t=>t[0]===e&&t[1]===n),i)},ut=(t,[e,n,s],i)=>{const r=t.get(e);void 0===r?t.set(e,new Set([[n,s]])):ot(r,[n,s],(t=>t[0]===n),i)},ct=t=>"inputs"in t,lt=(t,e,n,s)=>{if(ct(e)){const i=e.inputs[s];return t.connect(i,n,0),[i,n,0]}return t.connect(e,n,s),[e,n,s]},ht=(t,e,n)=>{for(const s of t)if(s[0]===e&&s[1]===n)return t.delete(s),s;return null},pt=(t,e)=>{if(!F(t).delete(e))throw new Error("Missing the expected event listener.")},dt=(t,e,n)=>{const s=P(t,e),i=V(s,(t=>t[0]===n));return 0===s.size&&t.delete(e),i},ft=(t,e,n,s)=>{ct(e)?t.disconnect(e.inputs[s],n,0):t.disconnect(e,n,s)},_t=t=>P(T,t),mt=t=>P(k,t),gt=t=>O.has(t),vt=t=>!x.has(t),yt=(t,e)=>new Promise((n=>{if(null!==e)n(!0);else{const e=t.createScriptProcessor(256,1,1),s=t.createGain(),i=t.createBuffer(1,2,44100),r=i.getChannelData(0);r[0]=1,r[1]=1;const o=t.createBufferSource();o.buffer=i,o.loop=!0,o.connect(e).connect(t.destination),o.connect(s),o.disconnect(s),e.onaudioprocess=s=>{const i=s.inputBuffer.getChannelData(0);Array.prototype.some.call(i,(t=>1===t))?n(!0):n(!1),o.stop(),e.onaudioprocess=null,o.disconnect(e),e.disconnect(t.destination)},o.start()}})),wt=(t,e)=>{const n=new Map;for(const e of t)for(const t of e){const e=n.get(t);n.set(t,void 0===e?1:e+1)}n.forEach(((t,n)=>e(n,t)))},xt=t=>"context"in t,bt=(t,e,n,s)=>{const{activeInputs:i,passiveInputs:r}=et(e),{outputs:o}=tt(t),a=F(t),u=o=>{const a=_t(t),u=mt(e);if(o){const e=dt(r,t,n);at(i,t,e,!1),s||gt(t)||a.connect(u,n)}else{const e=((t,e,n)=>V(t,(t=>t[0]===e&&t[1]===n)))(i,t,n);ut(r,e,!1),s||gt(t)||a.disconnect(u,n)}};return!!ot(o,[e,n],(t=>t[0]===e&&t[1]===n),!0)&&(a.add(u),K(t)?at(i,t,[n,u],!0):ut(r,[t,n,u],!0),!0)},Tt=(t,e,n,s,i)=>{const[r,o]=((t,e,n,s)=>{const{activeInputs:i,passiveInputs:r}=tt(e),o=ht(i[s],t,n);if(null===o)return[q(r,t,n,s)[2],!1];return[o[2],!0]})(t,n,s,i);if(null!==r&&(pt(t,r),!o||e||gt(t)||ft(_t(t),_t(n),s,i)),K(n)){const{activeInputs:t}=tt(n);L(n,t)}},At=(t,e,n,s)=>{const[i,r]=((t,e,n)=>{const{activeInputs:s,passiveInputs:i}=et(e),r=ht(s,t,n);if(null===r)return[dt(i,t,n)[1],!1];return[r[2],!0]})(t,n,s);null!==i&&(pt(t,i),!r||e||gt(t)||_t(t).disconnect(mt(n),s))};class kt{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(((n,s)=>t.call(e,n,s,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 Ct={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}};function St(t,e,n,s,i){if("function"==typeof t.copyFromChannel)0===e[n].byteLength&&(e[n]=new Float32Array(128)),t.copyFromChannel(e[n],s,i);else{const r=t.getChannelData(s);if(0===e[n].byteLength)e[n]=r.slice(i,i+128);else{const t=new Float32Array(r.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);e[n].set(t)}}}const Ot=(t,e,n,s,i)=>{"function"==typeof t.copyToChannel?0!==e[n].byteLength&&t.copyToChannel(e[n],s,i):0!==e[n].byteLength&&t.getChannelData(s).set(e[n],i)},Mt=(t,e)=>{const n=[];for(let s=0;s<t;s+=1){const t=[],i="number"==typeof e?e:e[s];for(let e=0;e<i;e+=1)t.push(new Float32Array(128));n.push(t)}return n},Et=async(t,e,n,s,i,r,o)=>{const a=null===e?128*Math.ceil(t.context.length/128):e.length,u=s.channelCount*s.numberOfInputs,c=i.reduce(((t,e)=>t+e),0),l=0===c?null:n.createBuffer(c,a,n.sampleRate);if(void 0===r)throw new Error("Missing the processor constructor.");const h=tt(t),p=await((t,e)=>{const n=P(E,t),s=_t(e);return P(n,s)})(n,t),d=Mt(s.numberOfInputs,s.channelCount),f=Mt(s.numberOfOutputs,i),_=Array.from(t.parameters.keys()).reduce(((t,e)=>({...t,[e]:new Float32Array(128)})),{});for(let c=0;c<a;c+=128){if(s.numberOfInputs>0&&null!==e)for(let t=0;t<s.numberOfInputs;t+=1)for(let n=0;n<s.channelCount;n+=1)St(e,d[t],n,n,c);void 0!==r.parameterDescriptors&&null!==e&&r.parameterDescriptors.forEach((({name:t},n)=>{St(e,_,t,u+n,c)}));for(let t=0;t<s.numberOfInputs;t+=1)for(let e=0;e<i[t];e+=1)0===f[t][e].byteLength&&(f[t][e]=new Float32Array(128));try{const t=d.map(((t,e)=>0===h.activeInputs[e].size?[]:t)),e=o(c/n.sampleRate,n.sampleRate,(()=>p.process(t,f,_)));if(null!==l)for(let t=0,e=0;t<s.numberOfOutputs;t+=1){for(let n=0;n<i[t];n+=1)Ot(l,f[t],n,e+n,c);e+=i[t]}if(!e)break}catch(e){t.dispatchEvent(new ErrorEvent("processorerror",{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}));break}}return l},Dt={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass"},It={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6},Rt={channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6},Nt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1},Bt={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1},Pt=t=>{const{port1:e,port2:n}=new MessageChannel;return new Promise((s=>{const i=()=>{n.onmessage=null,e.close(),n.close(),s()};n.onmessage=()=>i();try{e.postMessage(t,[t])}catch{}finally{i()}}))},Vt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1},qt=(t,e,n)=>{const s=e[n];if(void 0===s)throw t();return s},Ft={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24},jt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1},zt=()=>new DOMException("","InvalidStateError"),Wt=()=>new DOMException("","InvalidAccessError"),Lt={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers"},Ut=(t,e,n,s,i,r,o,a,u,c,l)=>{const h=c.length;let p=a;for(let a=0;a<h;a+=1){let h=n[0]*c[a];for(let e=1;e<i;e+=1){const s=p-e&u-1;h+=n[e]*r[s],h-=t[e]*o[s]}for(let t=i;t<s;t+=1)h+=n[t]*r[p-t&u-1];for(let n=i;n<e;n+=1)h-=t[n]*o[p-n&u-1];r[p]=c[a],o[p]=h,p=p+1&u-1,l[a]=h}return p},Ht={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers"},$t=t=>{const e=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{const n=t.decodeAudioData(e.buffer,(()=>{}));return void 0!==n&&(n.catch((()=>{})),!0)}catch{}return!1},Gt=(t,e,n)=>{const s=e[n];void 0!==s&&s!==t[n]&&(t[n]=s)},Xt=(t,e)=>{Gt(t,e,"channelCount"),Gt(t,e,"channelCountMode"),Gt(t,e,"channelInterpretation")},Zt=t=>"function"==typeof t.getFloatTimeDomainData,Yt=(t,e,n)=>{const s=e[n];void 0!==s&&s!==t[n].value&&(t[n].value=s)},Qt=t=>{var e;t.start=(e=t.start,(n=0,s=0,i)=>{if("number"==typeof i&&i<0||s<0||n<0)throw new RangeError("The parameters can't be negative.");e.call(t,n,s,i)})},Kt=t=>{var e;t.stop=(e=t.stop,(n=0)=>{if(n<0)throw new RangeError("The parameter can't be negative.");e.call(t,n)})},Jt=(t,e)=>null===t?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(t*e))))),te=async(t,e)=>{const n=await(t=>new Promise(((e,n)=>{const{port1:s,port2:i}=new MessageChannel;s.onmessage=({data:t})=>{s.close(),i.close(),e(t)},s.onmessageerror=({data:t})=>{s.close(),i.close(),n(t)},i.postMessage(t)})))(e);return new t(n)},ee=(t,e)=>{const n=t.createBiquadFilter();return Xt(n,e),Yt(n,e,"Q"),Yt(n,e,"detune"),Yt(n,e,"frequency"),Yt(n,e,"gain"),Gt(n,e,"type"),n},ne=(t,e)=>{const n=t.createChannelSplitter(e.numberOfOutputs);return Xt(n,e),(t=>{const e=t.numberOfOutputs;Object.defineProperty(t,"channelCount",{get:()=>e,set:t=>{if(t!==e)throw zt()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set:t=>{if("explicit"!==t)throw zt()}}),Object.defineProperty(t,"channelInterpretation",{get:()=>"discrete",set:t=>{if("discrete"!==t)throw zt()}})})(n),n},se=(t,e)=>(t.connect=e.connect.bind(e),t.disconnect=e.disconnect.bind(e),t),ie=(t,e)=>{const n=t.createDelay(e.maxDelayTime);return Xt(n,e),Yt(n,e,"delayTime"),n},re=(t,e)=>{const n=t.createGain();return Xt(n,e),Yt(n,e,"gain"),n};function oe(t,e){const n=e[0]*e[0]+e[1]*e[1];return[(t[0]*e[0]+t[1]*e[1])/n,(t[1]*e[0]-t[0]*e[1])/n]}function ae(t,e){let n=[0,0];for(let r=t.length-1;r>=0;r-=1)i=e,n=[(s=n)[0]*i[0]-s[1]*i[1],s[0]*i[1]+s[1]*i[0]],n[0]+=t[r];var s,i;return n}const ue=(t,e,n,s)=>t.createScriptProcessor(e,n,s),ce=()=>new DOMException("","NotSupportedError"),le={numberOfChannels:1},he={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine"},pe={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},de={disableNormalization:!1},fe={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0},_e={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none"},me=(t,e,n)=>void 0===t.copyFromChannel?t.getChannelData(n)[0]:(t.copyFromChannel(e,n),e[0]),ge=t=>{if(null===t)return!1;const e=t.length;return e%2!=0?0!==t[Math.floor(e/2)]:t[e/2-1]+t[e/2]!==0},ve=(t,e,n,s)=>{let i=t;for(;!i.hasOwnProperty(e);)i=Object.getPrototypeOf(i);const{get:r,set:o}=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(t,e,{get:n(r),set:s(o)})},ye=(t,e,n)=>{try{t.setValueAtTime(e,n)}catch(s){if(9!==s.code)throw s;ye(t,e,n+1e-7)}},we=t=>{const e=t.createOscillator();try{e.start(-1)}catch(t){return t instanceof RangeError}return!1},xe=t=>{const e=t.createBuffer(1,1,44100),n=t.createBufferSource();n.buffer=e,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},be=t=>{const e=t.createOscillator();try{e.stop(-1)}catch(t){return t instanceof RangeError}return!1},Te=(t,e)=>{const n=e.createGain();t.connect(n);const s=(e=>()=>{e.call(t,n),t.removeEventListener("ended",s)})(t.disconnect);t.addEventListener("ended",s),se(t,n),t.stop=(e=>{let s=!1;return(i=0)=>{if(s)try{e.call(t,i)}catch{n.gain.setValueAtTime(0,i)}else e.call(t,i),s=!0}})(t.stop)},Ae=(t,e)=>n=>{const s={value:t};return Object.defineProperties(n,{currentTarget:s,target:s}),"function"==typeof e?e.call(t,n):e.handleEvent.call(t,n)},ke=(t=>(e,n,[s,i,r],o)=>{t(e[i],[n,s,r],(t=>t[0]===n&&t[1]===s),o)})(ot),Ce=(t=>(e,n,[s,i,r],o)=>{const a=e.get(s);void 0===a?e.set(s,new Set([[i,n,r]])):t(a,[i,n,r],(t=>t[0]===i&&t[1]===n),o)})(ot),Se=(t=>(e,n,s,i)=>t(e[i],(t=>t[0]===n&&t[1]===s)))(V),Oe=new WeakMap,Me=(t=>e=>{var n;return null!==(n=t.get(e))&&void 0!==n?n:0})(Oe),Ee=(De=new Map,Ie=new WeakMap,(t,e)=>{const n=Ie.get(t);if(void 0!==n)return n;const s=De.get(t);if(void 0!==s)return s;try{const n=e();return n instanceof Promise?(De.set(t,n),n.catch((()=>!1)).then((e=>(De.delete(t),Ie.set(t,e),e)))):(Ie.set(t,n),n)}catch{return Ie.set(t,!1),!1}});var De,Ie;const Re="undefined"==typeof window?null:window,Ne=((t,e)=>(n,s)=>{const i=n.createAnalyser();if(Xt(i,s),!(s.maxDecibels>s.minDecibels))throw e();return Gt(i,s,"fftSize"),Gt(i,s,"maxDecibels"),Gt(i,s,"minDecibels"),Gt(i,s,"smoothingTimeConstant"),t(Zt,(()=>Zt(i)))||(t=>{t.getFloatTimeDomainData=e=>{const n=new Uint8Array(e.length);t.getByteTimeDomainData(n);const s=Math.max(n.length,t.fftSize);for(let t=0;t<s;t+=1)e[t]=.0078125*(n[t]-128);return e}})(i),i})(Ee,G),Be=(t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioNode in the audio graph.");return n.renderer})(tt),Pe=((t,e,n)=>async(s,i,r)=>{const o=t(s);await Promise.all(o.activeInputs.map(((t,o)=>Array.from(t).map((async([t,a])=>{const u=e(t),c=await u.render(t,i),l=s.context.destination;n(t)||s===l&&n(s)||c.connect(r,a,o)})))).reduce(((t,e)=>[...t,...e]),[]))})(tt,Be,gt),Ve=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,fftSize:o.fftSize,maxDecibels:o.maxDecibels,minDecibels:o.minDecibels,smoothingTimeConstant:o.smoothingTimeConstant};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(Ne,_t,Pe),qe=(Fe=C,t=>{const e=Fe.get(t);if(void 0===e)throw zt();return e});var Fe;const je=(t=>null===t?null:t.hasOwnProperty("OfflineAudioContext")?t.OfflineAudioContext:t.hasOwnProperty("webkitOfflineAudioContext")?t.webkitOfflineAudioContext:null)(Re),ze=(t=>e=>null!==t&&e instanceof t)(je),We=new WeakMap,Le=(t=>class{constructor(t){this._nativeEventTarget=t,this._listeners=new WeakMap}addEventListener(e,n,s){if(null!==n){let i=this._listeners.get(n);void 0===i&&(i=t(this,n),"function"==typeof n&&this._listeners.set(n,i)),this._nativeEventTarget.addEventListener(e,i,s)}}dispatchEvent(t){return this._nativeEventTarget.dispatchEvent(t)}removeEventListener(t,e,n){const s=null===e?void 0:this._listeners.get(e);this._nativeEventTarget.removeEventListener(t,void 0===s?null:s,n)}})(Ae),Ue=(t=>null===t?null:t.hasOwnProperty("AudioContext")?t.AudioContext:t.hasOwnProperty("webkitAudioContext")?t.webkitAudioContext:null)(Re),He=(t=>e=>null!==t&&e instanceof t)(Ue),$e=(t=>e=>null!==t&&"function"==typeof t.AudioNode&&e instanceof t.AudioNode)(Re),Ge=(t=>e=>null!==t&&"function"==typeof t.AudioParam&&e instanceof t.AudioParam)(Re),Xe=(t=>null===t?null:t.hasOwnProperty("AudioWorkletNode")?t.AudioWorkletNode:null)(Re),Ze=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_)=>class extends c{constructor(e,s,i,r){super(i),this._context=e,this._nativeAudioNode=i;const o=l(e);h(o)&&!0!==n(yt,(()=>yt(o,_)))&&(t=>{const e=new Map;t.connect=(t=>(n,s=0,i=0)=>{const r=xt(n)?t(n,s,i):t(n,s),o=e.get(n);return void 0===o?e.set(n,[{input:i,output:s}]):o.every((t=>t.input!==i||t.output!==s))&&o.push({input:i,output:s}),r})(t.connect.bind(t)),t.disconnect=(n=>(s,i,r)=>{if(n.apply(t),void 0===s)e.clear();else if("number"==typeof s)for(const[t,n]of e){const i=n.filter((t=>t.output!==s));0===i.length?e.delete(t):e.set(t,i)}else if(e.has(s))if(void 0===i)e.delete(s);else{const t=e.get(s);if(void 0!==t){const n=t.filter((t=>t.output!==i&&(t.input!==r||void 0===r)));0===n.length?e.delete(s):e.set(s,n)}}for(const[n,s]of e)s.forEach((e=>{xt(n)?t.connect(n,e.output,e.input):t.connect(n,e.output)}))})(t.disconnect)})(i),T.set(this,i),S.set(this,new Set),"closed"!==e.state&&s&&j(this),t(this,r,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(t){this._nativeAudioNode.channelCount=t}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(t){this._nativeAudioNode.channelCountMode=t}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(t){this._nativeAudioNode.channelInterpretation=t}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(t,n=0,a=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();const c=l(this._context),h=f(c);if(p(t)||d(t))throw r();if(it(t)){const i=_t(t);try{const e=lt(this._nativeAudioNode,i,n,a),s=vt(this);(h||s)&&this._nativeAudioNode.disconnect(...e),"closed"!==this.context.state&&!s&&vt(t)&&j(t)}catch(t){if(12===t.code)throw r();throw t}if(e(this,t,n,a,h)){const e=u([this],t);wt(e,s(h))}return t}const _=mt(t);if("playbackRate"===_.name&&1024===_.maxValue)throw o();try{this._nativeAudioNode.connect(_,n),(h||vt(this))&&this._nativeAudioNode.disconnect(_,n)}catch(t){if(12===t.code)throw r();throw t}if(bt(this,t,n,h)){const e=u([this],t);wt(e,s(h))}}disconnect(t,e,n){let s;const o=l(this._context),c=f(o);if(void 0===t)s=((t,e)=>{const n=tt(t),s=[];for(const i of n.outputs)rt(i)?Tt(t,e,...i):At(t,e,...i),s.push(i[0]);return n.outputs.clear(),s})(this,c);else if("number"==typeof t){if(t<0||t>=this.numberOfOutputs)throw i();s=((t,e,n)=>{const s=tt(t),i=[];for(const r of s.outputs)r[1]===n&&(rt(r)?Tt(t,e,...r):At(t,e,...r),i.push(r[0]),s.outputs.delete(r));return i})(this,c,t)}else{if(void 0!==e&&(e<0||e>=this.numberOfOutputs))throw i();if(it(t)&&void 0!==n&&(n<0||n>=t.numberOfInputs))throw i();if(s=((t,e,n,s,i)=>{const r=tt(t);return Array.from(r.outputs).filter((t=>!(t[0]!==n||void 0!==s&&t[1]!==s||void 0!==i&&t[2]!==i))).map((n=>(rt(n)?Tt(t,e,...n):At(t,e,...n),r.outputs.delete(n),n[0])))})(this,c,t,e,n),0===s.length)throw r()}for(const t of s){const e=u([this],t);wt(e,a)}}})((Ye=b,(t,e,n)=>{const s=[];for(let t=0;t<n.numberOfInputs;t+=1)s.push(new Set);Ye.set(t,{activeInputs:s,outputs:new Set,passiveInputs:new WeakMap,renderer:e})}),((t,e,n,s,i,r,o,a,u,c,l,h,p)=>{const d=new WeakMap;return(f,_,m,g,v)=>{const{activeInputs:y,passiveInputs:w}=r(_),{outputs:x}=r(f),b=a(f),T=r=>{const a=u(_),c=u(f);if(r){const e=q(w,f,m,g);t(y,f,e,!1),v||h(f)||n(c,a,m,g),p(_)&&j(_)}else{const t=s(y,f,m,g);e(w,g,t,!1),v||h(f)||i(c,a,m,g);const n=o(_);if(0===n)l(_)&&L(_,y);else{const t=d.get(_);void 0!==t&&clearTimeout(t),d.set(_,setTimeout((()=>{l(_)&&L(_,y)}),1e3*n))}}};return!!c(x,[_,m,g],(t=>t[0]===_&&t[1]===m&&t[2]===g),!0)&&(b.add(T),l(f)?t(y,f,[m,g,T],!0):e(w,g,[f,m,T],!0),!0)}})(ke,Ce,lt,Se,ft,tt,Me,F,_t,ot,K,gt,vt),Ee,((t,e,n,s,i,r)=>o=>(a,u)=>{const c=t.get(a);if(void 0===c){if(!o&&r(a)){const t=s(a),{outputs:r}=n(a);for(const n of r)if(rt(n)){const i=s(n[0]);e(t,i,n[1],n[2])}else{const e=i(n[0]);t.disconnect(e,n[1])}}t.set(a,u)}else t.set(a,c+u)})(O,ft,tt,_t,mt,K),G,Wt,ce,((t,e,n,s,i,r,o,a)=>(u,c)=>{const l=e.get(u);if(void 0===l)throw new Error("Missing the expected cycle count.");const h=r(u.context),p=a(h);if(l===c){if(e.delete(u),!p&&o(u)){const e=s(u),{outputs:r}=n(u);for(const n of r)if(rt(n)){const i=s(n[0]);t(e,i,n[1],n[2])}else{const t=i(n[0]);e.connect(t,n[1])}}}else e.set(u,l-c)})(lt,O,tt,_t,mt,qe,K,ze),((t,e,n)=>function s(i,r){const o=it(r)?r:n(t,r);if((t=>"delayTime"in t)(o))return[];if(i[0]===o)return[i];if(i.includes(o))return[];const{outputs:a}=e(o);return Array.from(a).map((t=>s([...i,o],t[0]))).reduce(((t,e)=>t.concat(e)),[])})(We,tt,P),Le,qe,He,$e,Ge,ze,Xe);var Ye;const Qe=((t,e,n,s,i,r)=>class extends t{constructor(t,n){const o=i(t),a={...U,...n},u=s(o,a);super(t,!1,u,r(o)?e():null),this._nativeAnalyserNode=u}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(t){this._nativeAnalyserNode.fftSize=t}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(t){const e=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=t,!(t>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=e,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(t){const e=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=t,!(this._nativeAnalyserNode.maxDecibels>t))throw this._nativeAnalyserNode.minDecibels=e,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(t){this._nativeAnalyserNode.smoothingTimeConstant=t}getByteFrequencyData(t){this._nativeAnalyserNode.getByteFrequencyData(t)}getByteTimeDomainData(t){this._nativeAnalyserNode.getByteTimeDomainData(t)}getFloatFrequencyData(t){this._nativeAnalyserNode.getFloatFrequencyData(t)}getFloatTimeDomainData(t){this._nativeAnalyserNode.getFloatTimeDomainData(t)}})(Ze,Ve,G,Ne,qe,ze),Ke=new WeakSet,Je=(t=>null===t?null:t.hasOwnProperty("AudioBuffer")?t.AudioBuffer:null)(Re),tn=(en=new Uint32Array(1),t=>(en[0]=t,en[0]));var en;const nn=((t,e)=>n=>{n.copyFromChannel=(s,i,r=0)=>{const o=t(r),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=s.length;for(let t=o<0?-o:0;t+o<u&&t<l;t+=1)s[t]=c[t+o]},n.copyToChannel=(s,i,r=0)=>{const o=t(r),a=t(i);if(a>=n.numberOfChannels)throw e();const u=n.length,c=n.getChannelData(a),l=s.length;for(let t=o<0?-o:0;t+o<u&&t<l;t+=1)c[t+o]=s[t]}})(tn,G),sn=(t=>e=>{e.copyFromChannel=(n=>(s,i,r=0)=>{const o=t(r),a=t(i);if(o<e.length)return n.call(e,s,a,o)})(e.copyFromChannel),e.copyToChannel=(n=>(s,i,r=0)=>{const o=t(r),a=t(i);if(o<e.length)return n.call(e,s,a,o)})(e.copyToChannel)})(tn),rn=((t,e,n,s,i,r,o,a)=>{let u=null;return class c{constructor(c){if(null===i)throw new Error("Missing the native OfflineAudioContext constructor.");const{length:l,numberOfChannels:h,sampleRate:p}={...Z,...c};null===u&&(u=new i(1,1,44100));const d=null!==s&&e(r,r)?new s({length:l,numberOfChannels:h,sampleRate:p}):u.createBuffer(h,l,p);if(0===d.numberOfChannels)throw n();return"function"!=typeof d.copyFromChannel?(o(d),X(d)):e($,(()=>$(d)))||a(d),t.add(d),d}static[Symbol.hasInstance](e){return null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===c.prototype||t.has(e)}}})(Ke,Ee,ce,Je,je,(t=>()=>{if(null===t)return!1;try{new t({length:1,sampleRate:44100})}catch{return!1}return!0})(Je),nn,sn),on=(t=>(e,n)=>{const s=t(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});n.connect(s).connect(e.destination);const i=()=>{n.removeEventListener("ended",i),n.disconnect(s),s.disconnect()};n.addEventListener("ended",i)})(re),an=((t,e,n)=>async(s,i,r)=>{const o=e(s);await Promise.all(Array.from(o.activeInputs).map((async([e,s])=>{const o=t(e),a=await o.render(e,i);n(e)||a.connect(r,s)})))})(Be,et,gt),un=(t=>(e,n,s)=>t(n,e,s))(an),cn=((t,e,n,s,i,r,o,a,u,c,l)=>(h,p)=>{const d=h.createBufferSource();return Xt(d,p),Yt(d,p,"playbackRate"),Gt(d,p,"buffer"),Gt(d,p,"loop"),Gt(d,p,"loopEnd"),Gt(d,p,"loopStart"),e(n,(()=>n(h)))||(t=>{t.start=(e=>{let n=!1;return(s=0,i=0,r)=>{if(n)throw zt();e.call(t,s,i,r),n=!0}})(t.start)})(d),e(s,(()=>s(h)))||u(d),e(i,(()=>i(h)))||c(d,h),e(r,(()=>r(h)))||Qt(d),e(o,(()=>o(h)))||l(d,h),e(a,(()=>a(h)))||Kt(d),t(h,d),d})(on,Ee,(t=>{const e=t.createBufferSource();e.start();try{e.start()}catch{return!0}return!1}),(t=>{const e=t.createBufferSource(),n=t.createBuffer(1,1,44100);e.buffer=n;try{e.start(0,1)}catch{return!1}return!0}),(t=>{const e=t.createBufferSource();e.start();try{e.stop()}catch{return!1}return!0}),we,xe,be,(t=>{var e;t.start=(e=t.start,(n=0,s=0,i)=>{const r=t.buffer,o=null===r?s:Math.min(r.duration,s);null!==r&&o>r.duration-.5/t.context.sampleRate?e.call(t,n,0,0):e.call(t,n,o,i)})}),(t=>(e,n)=>{const s=n.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=s),t(e,"buffer",(t=>()=>{const n=t.call(e);return n===s?null:n}),(t=>n=>t.call(e,null===n?s:n)))})(ve),Te),ln=((t,e)=>(n,s,i)=>(t(s).replay(i),e(s,n,i)))((t=>e=>{const n=t(e);if(null===n.renderer)throw new Error("Missing the renderer of the given AudioParam in the audio graph.");return n.renderer})(et),an),hn=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;return{set start(t){o=t},set stop(t){a=t},render(u,c){const l=r.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=H(l,c);if(!h){const t={buffer:l.buffer,channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,loop:l.loop,loopEnd:l.loopEnd,loopStart:l.loopStart,playbackRate:l.playbackRate.value};l=e(c,t),null!==o&&l.start(...o),null!==a&&l.stop(a)}return r.set(c,l),h?await t(c,u.playbackRate,l.playbackRate):await s(c,u.playbackRate,l.playbackRate),await i(u,c,l),l})(u,c)}}})(un,cn,_t,ln,Pe),pn=((t,e,n,s,i,r,o,a,u,c,l,h,p)=>(d,f,_,m=null,g=null)=>{const v=_.value,y=new w(v),x=f?s(y):null,b={get defaultValue(){return v},get maxValue(){return null===m?_.maxValue:m},get minValue(){return null===g?_.minValue:g},get value(){return _.value},set value(t){_.value=t,b.setValueAtTime(t,d.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof _.cancelAndHoldAtTime)null===x&&y.flush(d.context.currentTime),y.add(i(t)),_.cancelAndHoldAtTime(t);else{const e=Array.from(y).pop();null===x&&y.flush(d.context.currentTime),y.add(i(t));const n=Array.from(y).pop();_.cancelScheduledValues(t),e!==n&&void 0!==n&&("exponentialRampToValue"===n.type?_.exponentialRampToValueAtTime(n.value,n.endTime):"linearRampToValue"===n.type?_.linearRampToValueAtTime(n.value,n.endTime):"setValue"===n.type?_.setValueAtTime(n.value,n.startTime):"setValueCurve"===n.type&&_.setValueCurveAtTime(n.values,n.startTime,n.duration))}return b},cancelScheduledValues:t=>(null===x&&y.flush(d.context.currentTime),y.add(r(t)),_.cancelScheduledValues(t),b),exponentialRampToValueAtTime(t,e){if(0===t)throw new RangeError;if(!Number.isFinite(e)||e<0)throw new RangeError;const n=d.context.currentTime;return null===x&&y.flush(n),0===Array.from(y).length&&(y.add(c(v,n)),_.setValueAtTime(v,n)),y.add(o(t,e)),_.exponentialRampToValueAtTime(t,e),b},linearRampToValueAtTime(t,e){const n=d.context.currentTime;return null===x&&y.flush(n),0===Array.from(y).length&&(y.add(c(v,n)),_.setValueAtTime(v,n)),y.add(a(t,e)),_.linearRampToValueAtTime(t,e),b},setTargetAtTime:(t,e,n)=>(null===x&&y.flush(d.context.currentTime),y.add(u(t,e,n)),_.setTargetAtTime(t,e,n),b),setValueAtTime:(t,e)=>(null===x&&y.flush(d.context.currentTime),y.add(c(t,e)),_.setValueAtTime(t,e),b),setValueCurveAtTime(t,e,n){const s=t instanceof Float32Array?t:new Float32Array(t);if(null!==h&&"webkitAudioContext"===h.name){const t=e+n,i=d.context.sampleRate,r=Math.ceil(e*i),o=Math.floor(t*i),a=o-r,u=new Float32Array(a);for(let t=0;t<a;t+=1){const o=(s.length-1)/n*((r+t)/i-e),a=Math.floor(o),c=Math.ceil(o);u[t]=a===c?s[a]:(1-(o-a))*s[a]+(1-(c-o))*s[c]}null===x&&y.flush(d.context.currentTime),y.add(l(u,e,n)),_.setValueCurveAtTime(u,e,n);const c=o/i;c<t&&p(b,u[u.length-1],c),p(b,s[s.length-1],t)}else null===x&&y.flush(d.context.currentTime),y.add(l(s,e,n)),_.setValueCurveAtTime(s,e,n);return b}};return n.set(b,_),e.set(b,d),t(b,x),b})((dn=A,(t,e)=>{dn.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:e})}),We,k,(t=>({replay(e){for(const n of t)if("exponentialRampToValue"===n.type){const{endTime:t,value:s}=n;e.exponentialRampToValueAtTime(s,t)}else if("linearRampToValue"===n.type){const{endTime:t,value:s}=n;e.linearRampToValueAtTime(s,t)}else if("setTarget"===n.type){const{startTime:t,target:s,timeConstant:i}=n;e.setTargetAtTime(s,t,i)}else if("setValue"===n.type){const{startTime:t,value:s}=n;e.setValueAtTime(s,t)}else{if("setValueCurve"!==n.type)throw new Error("Can't apply an unknown automation.");{const{duration:t,startTime:s,values:i}=n;e.setValueCurveAtTime(i,s,t)}}}})),(t=>({cancelTime:t,type:"cancelAndHold"})),(t=>({cancelTime:t,type:"cancelScheduledValues"})),((t,e)=>({endTime:e,type:"exponentialRampToValue",value:t})),((t,e)=>({endTime:e,type:"linearRampToValue",value:t})),((t,e,n)=>({startTime:e,target:t,timeConstant:n,type:"setTarget"})),s,i,Ue,ye);var dn;const fn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,s){const a=r(t),u={...J,...s},c=i(a,u),l=o(a),h=l?e():null;super(t,!1,c,h),this._audioBufferSourceNodeRenderer=h,this._isBufferNullified=!1,this._isBufferSet=null!==u.buffer,this._nativeAudioBufferSourceNode=c,this._onended=null,this._playbackRate=n(this,l,c.playbackRate,Q,Y)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(t){if(this._nativeAudioBufferSourceNode.buffer=t,null!==t){if(this._isBufferSet)throw s();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(t){this._nativeAudioBufferSourceNode.loop=t}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(t){this._nativeAudioBufferSourceNode.loopEnd=t}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(t){this._nativeAudioBufferSourceNode.loopStart=t}get onended(){return this._onended}set onended(t){const e="function"==typeof t?a(this,t):null;this._nativeAudioBufferSourceNode.onended=e;const n=this._nativeAudioBufferSourceNode.onended;this._onended=null!==n&&n===e?t:n}get playbackRate(){return this._playbackRate}start(t=0,e=0,n){if(this._nativeAudioBufferSourceNode.start(t,e,n),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===n?[t,e]:[t,e,n]),"closed"!==this.context.state){j(this);const t=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeAudioBufferSourceNode.stop(t),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=t)}})(Ze,hn,pn,zt,cn,qe,ze,Ae),_n=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,n){const s=r(t),u=o(s),c=i(s,n,u);super(t,!1,c,u?e(a):null),this._isNodeOfNativeOfflineAudioContext=u,this._nativeAudioDestinationNode=c}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(t){if(this._isNodeOfNativeOfflineAudioContext)throw s();if(t>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=t}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(t){if(this._isNodeOfNativeOfflineAudioContext)throw s();this._nativeAudioDestinationNode.channelCountMode=t}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}})(Ze,(t=>{const e=new WeakMap;return{render(n,s){const i=e.get(s);return void 0!==i?Promise.resolve(i):(async(n,s)=>{const i=s.destination;return e.set(s,i),await t(n,s,i),i})(n,s)}}}),G,zt,((t,e)=>(n,s,i)=>{const r=n.destination;if(r.channelCount!==s)try{r.channelCount=s}catch{}i&&"explicit"!==r.channelCountMode&&(r.channelCountMode="explicit"),0===r.maxChannelCount&&Object.defineProperty(r,"maxChannelCount",{value:s});const o=t(n,{channelCount:s,channelCountMode:r.channelCountMode,channelInterpretation:r.channelInterpretation,gain:1});return e(o,"channelCount",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e);try{r.channelCount=e}catch(t){if(e>r.maxChannelCount)throw t}})),e(o,"channelCountMode",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e),r.channelCountMode=e})),e(o,"channelInterpretation",(t=>()=>t.call(o)),(t=>e=>{t.call(o,e),r.channelInterpretation=e})),Object.defineProperty(o,"maxChannelCount",{get:()=>r.maxChannelCount}),o.connect(r),o})(re,ve),qe,ze,Pe),mn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={Q:u.Q.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,detune:u.detune.value,frequency:u.frequency.value,gain:u.gain.value,type:u.type};u=e(a,t)}return r.set(a,u),c?(await t(a,o.Q,u.Q),await t(a,o.detune,u.detune),await t(a,o.frequency,u.frequency),await t(a,o.gain,u.gain)):(await s(a,o.Q,u.Q),await s(a,o.detune,u.detune),await s(a,o.frequency,u.frequency),await s(a,o.gain,u.gain)),await i(o,a,u),u})(o,a)}}})(un,ee,_t,ln,Pe),gn=(t=>(e,n)=>t.set(e,n))(Oe),vn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,s){const u=r(t),c={...Dt,...s},l=i(u,c),h=o(u);super(t,!1,l,h?n():null),this._Q=e(this,h,l.Q,Q,Y),this._detune=e(this,h,l.detune,1200*Math.log2(Q),-1200*Math.log2(Q)),this._frequency=e(this,h,l.frequency,t.sampleRate/2,0),this._gain=e(this,h,l.gain,40*Math.log10(Q),Y),this._nativeBiquadFilterNode=l,a(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(t){this._nativeBiquadFilterNode.type=t}getFrequencyResponse(t,e,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(t,e,n)}catch(t){if(11===t.code)throw s();throw t}if(t.length!==e.length||e.length!==n.length)throw s()}})(Ze,pn,mn,Wt,ee,qe,ze,gn),yn=((t,e)=>(n,s,i)=>{const r=new Set;return n.connect=(i=>(o,a=0,u=0)=>{const c=0===r.size;if(e(o))return i.call(n,o,a,u),t(r,[o,a,u],(t=>t[0]===o&&t[1]===a&&t[2]===u),!0),c&&s(),o;i.call(n,o,a),t(r,[o,a],(t=>t[0]===o&&t[1]===a),!0),c&&s()})(n.connect),n.disconnect=(t=>(s,o,a)=>{const u=r.size>0;if(void 0===s)t.apply(n),r.clear();else if("number"==typeof s){t.call(n,s);for(const t of r)t[1]===s&&r.delete(t)}else{e(s)?t.call(n,s,o,a):t.call(n,s,o);for(const t of r)t[0]!==s||void 0!==o&&t[1]!==o||void 0!==a&&t[2]!==a||r.delete(t)}const c=0===r.size;u&&c&&i()})(n.disconnect),n})(ot,$e),wn=((t,e)=>(n,s)=>{s.channelCount=1,s.channelCountMode="explicit",Object.defineProperty(s,"channelCount",{get:()=>1,set:()=>{throw t()}}),Object.defineProperty(s,"channelCountMode",{get:()=>"explicit",set:()=>{throw t()}});const i=n.createBufferSource();e(s,(()=>{const t=s.numberOfInputs;for(let e=0;e<t;e+=1)i.connect(s,0,e)}),(()=>i.disconnect(s)))})(zt,yn),xn=((t,e)=>(n,s)=>{const i=n.createChannelMerger(s.numberOfInputs);return null!==t&&"webkitAudioContext"===t.name&&e(n,i),Xt(i,s),i})(Ue,wn),bn=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfInputs:o.numberOfInputs};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(xn,_t,Pe),Tn=((t,e,n,s,i)=>class extends t{constructor(t,r){const o=s(t),a={...It,...r};super(t,!1,n(o,a),i(o)?e():null)}})(Ze,bn,xn,qe,ze),An=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfOutputs:o.numberOfOutputs};o=t(r,e)}return s.set(r,o),await n(i,r,o),o})(i,r)}}})(ne,_t,Pe),kn=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u=r({...Rt,...o});super(t,!1,n(a,u),i(a)?e():null)}})(Ze,An,ne,qe,ze,(t=>({...t,channelCount:t.numberOfOutputs}))),Cn=((t,e,n,s)=>(i,{offset:r,...o})=>{const a=i.createBuffer(1,2,44100),u=e(i,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),c=n(i,{...o,gain:r}),l=a.getChannelData(0);l[0]=1,l[1]=1,u.buffer=a,u.loop=!0;const h={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){c.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){c.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){c.channelInterpretation=t},get context(){return c.context},get inputs(){return[]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get offset(){return c.gain},get onended(){return u.onended},set onended(t){u.onended=t},addEventListener:(...t)=>u.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>u.dispatchEvent(t[0]),removeEventListener:(...t)=>u.removeEventListener(t[0],t[1],t[2]),start(t=0){u.start.call(u,t)},stop(t=0){u.stop.call(u,t)}};return t(i,u),s(se(h,c),(()=>u.connect(c)),(()=>u.disconnect(c)))})(on,cn,re,yn),Sn=((t,e,n,s,i)=>(r,o)=>{if(void 0===r.createConstantSource)return n(r,o);const a=r.createConstantSource();return Xt(a,o),Yt(a,o,"offset"),e(s,(()=>s(r)))||Qt(a),e(i,(()=>i(r)))||Kt(a),t(r,a),a})(on,Ee,Cn,we,be),On=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null;return{set start(t){o=t},set stop(t){a=t},render(u,c){const l=r.get(c);return void 0!==l?Promise.resolve(l):(async(u,c)=>{let l=n(u);const h=H(l,c);if(!h){const t={channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,offset:l.offset.value};l=e(c,t),null!==o&&l.start(o),null!==a&&l.stop(a)}return r.set(c,l),h?await t(c,u.offset,l.offset):await s(c,u.offset,l.offset),await i(u,c,l),l})(u,c)}}})(un,Sn,_t,ln,Pe),Mn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,o){const a=i(t),u={...Nt,...o},c=s(a,u),l=r(a),h=l?n():null;super(t,!1,c,h),this._constantSourceNodeRenderer=h,this._nativeConstantSourceNode=c,this._offset=e(this,l,c.offset,Q,Y),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(t){const e="function"==typeof t?o(this,t):null;this._nativeConstantSourceNode.onended=e;const n=this._nativeConstantSourceNode.onended;this._onended=null!==n&&n===e?t:n}start(t=0){if(this._nativeConstantSourceNode.start(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=t),"closed"!==this.context.state){j(this);const t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(t=0){this._nativeConstantSourceNode.stop(t),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=t)}})(Ze,pn,On,Sn,qe,ze,Ae),En=((t,e)=>(n,s)=>{const i=n.createConvolver();if(Xt(i,s),s.disableNormalization===i.normalize&&(i.normalize=!s.disableNormalization),Gt(i,s,"buffer"),s.channelCount>2)throw t();if(e(i,"channelCount",(t=>()=>t.call(i)),(e=>n=>{if(n>2)throw t();return e.call(i,n)})),"max"===s.channelCountMode)throw t();return e(i,"channelCountMode",(t=>()=>t.call(i)),(e=>n=>{if("max"===n)throw t();return e.call(i,n)})),i})(ce,ve),Dn=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={buffer:o.buffer,channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,disableNormalization:!o.normalize};o=t(r,e)}return s.set(r,o),ct(o)?await n(i,r,o.inputs[0]):await n(i,r,o),o})(i,r)}}})(En,_t,Pe),In=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u={...Bt,...o},c=n(a,u);super(t,!1,c,i(a)?e():null),this._isBufferNullified=!1,this._nativeConvolverNode=c,null!==u.buffer&&r(this,u.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(t){if(this._nativeConvolverNode.buffer=t,null===t&&null!==this._nativeConvolverNode.buffer){const t=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=t.createBuffer(1,1,t.sampleRate),this._isBufferNullified=!0,r(this,0)}else this._isBufferNullified=!1,r(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(t){this._nativeConvolverNode.normalize=t}})(Ze,Dn,En,qe,ze,gn),Rn=((t,e,n,s,i)=>r=>{const o=new WeakMap;return{render(a,u){const c=o.get(u);return void 0!==c?Promise.resolve(c):(async(a,u)=>{let c=n(a);const l=H(c,u);if(!l){const t={channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,delayTime:c.delayTime.value,maxDelayTime:r};c=e(u,t)}return o.set(u,c),l?await t(u,a.delayTime,c.delayTime):await s(u,a.delayTime,c.delayTime),await i(a,u,c),c})(a,u)}}})(un,ie,_t,ln,Pe),Nn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,a){const u=i(t),c={...Vt,...a},l=s(u,c),h=r(u);super(t,!1,l,h?n(c.maxDelayTime):null),this._delayTime=e(this,h,l.delayTime),o(this,c.maxDelayTime)}get delayTime(){return this._delayTime}})(Ze,pn,Rn,ie,qe,ze,gn),Bn=(t=>(e,n)=>{const s=e.createDynamicsCompressor();if(Xt(s,n),n.channelCount>2)throw t();if("max"===n.channelCountMode)throw t();return Yt(s,n,"attack"),Yt(s,n,"knee"),Yt(s,n,"ratio"),Yt(s,n,"release"),Yt(s,n,"threshold"),s})(ce),Pn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={attack:u.attack.value,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,knee:u.knee.value,ratio:u.ratio.value,release:u.release.value,threshold:u.threshold.value};u=e(a,t)}return r.set(a,u),c?(await t(a,o.attack,u.attack),await t(a,o.knee,u.knee),await t(a,o.ratio,u.ratio),await t(a,o.release,u.release),await t(a,o.threshold,u.threshold)):(await s(a,o.attack,u.attack),await s(a,o.knee,u.knee),await s(a,o.ratio,u.ratio),await s(a,o.release,u.release),await s(a,o.threshold,u.threshold)),await i(o,a,u),u})(o,a)}}})(un,Bn,_t,ln,Pe),Vn=((t,e,n,s,i,r,o,a)=>class extends t{constructor(t,i){const u=r(t),c={...Ft,...i},l=s(u,c),h=o(u);super(t,!1,l,h?n():null),this._attack=e(this,h,l.attack),this._knee=e(this,h,l.knee),this._nativeDynamicsCompressorNode=l,this._ratio=e(this,h,l.ratio),this._release=e(this,h,l.release),this._threshold=e(this,h,l.threshold),a(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(t){const e=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=t,t>2)throw this._nativeDynamicsCompressorNode.channelCount=e,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(t){const e=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=t,"max"===t)throw this._nativeDynamicsCompressorNode.channelCountMode=e,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}})(Ze,pn,Pn,Bn,ce,qe,ze,gn),qn=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,gain:u.gain.value};u=e(a,t)}return r.set(a,u),c?await t(a,o.gain,u.gain):await s(a,o.gain,u.gain),await i(o,a,u),u})(o,a)}}})(un,re,_t,ln,Pe),Fn=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=i(t),u={...jt,...o},c=s(a,u),l=r(a);super(t,!1,c,l?n():null),this._gain=e(this,l,c.gain,Q,Y)}get gain(){return this._gain}})(Ze,pn,qn,re,qe,ze),jn=((t,e,n,s)=>(i,r,{channelCount:o,channelCountMode:a,channelInterpretation:u,feedback:c,feedforward:l})=>{const h=Jt(r,i.sampleRate),p=c instanceof Float64Array?c:new Float64Array(c),d=l instanceof Float64Array?l:new Float64Array(l),f=p.length,_=d.length,m=Math.min(f,_);if(0===f||f>20)throw s();if(0===p[0])throw e();if(0===_||_>20)throw s();if(0===d[0])throw e();if(1!==p[0]){for(let t=0;t<_;t+=1)d[t]/=p[0];for(let t=1;t<f;t+=1)p[t]/=p[0]}const g=n(i,h,o,o);g.channelCount=o,g.channelCountMode=a,g.channelInterpretation=u;const v=[],y=[],w=[];for(let t=0;t<o;t+=1){v.push(0);const t=new Float32Array(32),e=new Float32Array(32);t.fill(0),e.fill(0),y.push(t),w.push(e)}g.onaudioprocess=t=>{const e=t.inputBuffer,n=t.outputBuffer,s=e.numberOfChannels;for(let t=0;t<s;t+=1){const s=e.getChannelData(t),i=n.getChannelData(t);v[t]=Ut(p,f,d,_,m,y[t],w[t],v[t],32,s,i)}};const x=i.sampleRate/2,b={get bufferSize(){return h},get channelCount(){return g.channelCount},set channelCount(t){g.channelCount=t},get channelCountMode(){return g.channelCountMode},set channelCountMode(t){g.channelCountMode=t},get channelInterpretation(){return g.channelInterpretation},set channelInterpretation(t){g.channelInterpretation=t},get context(){return g.context},get inputs(){return[g]},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},addEventListener:(...t)=>g.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>g.dispatchEvent(t[0]),getFrequencyResponse(e,n,s){if(e.length!==n.length||n.length!==s.length)throw t();const i=e.length;for(let t=0;t<i;t+=1){const i=-Math.PI*(e[t]/x),r=[Math.cos(i),Math.sin(i)],o=oe(ae(d,r),ae(p,r));n[t]=Math.sqrt(o[0]*o[0]+o[1]*o[1]),s[t]=Math.atan2(o[1],o[0])}},removeEventListener:(...t)=>g.removeEventListener(t[0],t[1],t[2])};return se(b,g)})(Wt,zt,ue,ce),zn=((t,e,n,s)=>i=>t($t,(()=>$t(i)))?Promise.resolve(t(s,s)).then((t=>{if(!t){const t=n(i,512,0,1);i.oncomplete=()=>{t.onaudioprocess=null,t.disconnect()},t.onaudioprocess=()=>i.currentTime,t.connect(i.destination)}return i.startRendering()})):new Promise((t=>{const n=e(i,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});i.oncomplete=e=>{n.disconnect(),t(e.renderedBuffer)},n.connect(i.destination),i.startRendering()})))(Ee,re,ue,((t,e)=>()=>{if(null===e)return Promise.resolve(!1);const n=new e(1,1,44100),s=t(n,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise((t=>{n.oncomplete=()=>{s.disconnect(),t(0!==n.currentTime)},n.startRendering()}))})(re,je)),Wn=((t,e,n,s,i)=>(r,o)=>{const a=new WeakMap;let u=null;const c=async(c,l)=>{let h=null,p=e(c);const d=H(p,l);if(void 0===l.createIIRFilter?h=t(l,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):d||(p=l.createIIRFilter(o,r)),a.set(l,null===h?p:h),null!==h){if(null===u){if(null===n)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new n(c.context.destination.channelCount,c.context.length,l.sampleRate);u=(async()=>{await s(c,t,t.destination);return((t,e,n,s)=>{const i=n instanceof Float64Array?n:new Float64Array(n),r=s instanceof Float64Array?s:new Float64Array(s),o=i.length,a=r.length,u=Math.min(o,a);if(1!==i[0]){for(let t=0;t<o;t+=1)r[t]/=i[0];for(let t=1;t<a;t+=1)i[t]/=i[0]}const c=new Float32Array(32),l=new Float32Array(32),h=e.createBuffer(t.numberOfChannels,t.length,t.sampleRate),p=t.numberOfChannels;for(let e=0;e<p;e+=1){const n=t.getChannelData(e),s=h.getChannelData(e);c.fill(0),l.fill(0),Ut(i,o,r,a,u,c,l,0,32,n,s)}return h})(await i(t),l,r,o)})()}const t=await u;return h.buffer=t,h.start(0),h}return await s(c,l,p),p};return{render(t,e){const n=a.get(e);return void 0!==n?Promise.resolve(n):c(t,e)}}})(cn,_t,je,Pe,zn),Ln=(t=>(e,n,s)=>{if(void 0===e.createIIRFilter)return t(e,n,s);const i=e.createIIRFilter(s.feedforward,s.feedback);return Xt(i,s),i})(jn),Un=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=s(t),u=i(a),c={...Lt,...o},l=e(a,u?null:t.baseLatency,c);super(t,!1,l,u?n(c.feedback,c.feedforward):null),(t=>{var e;t.getFrequencyResponse=(e=t.getFrequencyResponse,(n,s,i)=>{if(n.length!==s.length||s.length!==i.length)throw Wt();return e.call(t,n,s,i)})})(l),this._nativeIIRFilterNode=l,r(this,1)}getFrequencyResponse(t,e,n){return this._nativeIIRFilterNode.getFrequencyResponse(t,e,n)}})(Ze,Ln,Wn,qe,ze,gn),Hn=((t,e,n,s,i,r,o,a)=>(u,c)=>{const l=c.listener,{forwardX:h,forwardY:p,forwardZ:d,positionX:f,positionY:_,positionZ:m,upX:g,upY:v,upZ:y}=void 0===l.forwardX?(()=>{const h=new Float32Array(1),p=e(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),d=o(c);let f=!1,_=[0,0,-1,0,1,0],m=[0,0,0];const g=()=>{if(f)return;f=!0;const t=s(c,256,9,0);t.onaudioprocess=({inputBuffer:t})=>{const e=[r(t,h,0),r(t,h,1),r(t,h,2),r(t,h,3),r(t,h,4),r(t,h,5)];e.some(((t,e)=>t!==_[e]))&&(l.setOrientation(...e),_=e);const n=[r(t,h,6),r(t,h,7),r(t,h,8)];n.some(((t,e)=>t!==m[e]))&&(l.setPosition(...n),m=n)},p.connect(t)},v=t=>e=>{e!==_[t]&&(_[t]=e,l.setOrientation(..._))},y=t=>e=>{e!==m[t]&&(m[t]=e,l.setPosition(...m))},w=(e,s,r)=>{const o=n(c,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:s});o.connect(p,0,e),o.start(),Object.defineProperty(o.offset,"defaultValue",{get:()=>s});const l=t({context:u},d,o.offset,Q,Y);var h,f,_,m,v,y,w;return a(l,"value",(t=>()=>t.call(l)),(t=>e=>{try{t.call(l,e)}catch(t){if(9!==t.code)throw t}g(),d&&r(e)})),l.cancelAndHoldAtTime=(h=l.cancelAndHoldAtTime,d?()=>{throw i()}:(...t)=>{const e=h.apply(l,t);return g(),e}),l.cancelScheduledValues=(f=l.cancelScheduledValues,d?()=>{throw i()}:(...t)=>{const e=f.apply(l,t);return g(),e}),l.exponentialRampToValueAtTime=(_=l.exponentialRampToValueAtTime,d?()=>{throw i()}:(...t)=>{const e=_.apply(l,t);return g(),e}),l.linearRampToValueAtTime=(m=l.linearRampToValueAtTime,d?()=>{throw i()}:(...t)=>{const e=m.apply(l,t);return g(),e}),l.setTargetAtTime=(v=l.setTargetAtTime,d?()=>{throw i()}:(...t)=>{const e=v.apply(l,t);return g(),e}),l.setValueAtTime=(y=l.setValueAtTime,d?()=>{throw i()}:(...t)=>{const e=y.apply(l,t);return g(),e}),l.setValueCurveAtTime=(w=l.setValueCurveAtTime,d?()=>{throw i()}:(...t)=>{const e=w.apply(l,t);return g(),e}),l};return{forwardX:w(0,0,v(0)),forwardY:w(1,0,v(1)),forwardZ:w(2,-1,v(2)),positionX:w(6,0,y(0)),positionY:w(7,0,y(1)),positionZ:w(8,0,y(2)),upX:w(3,0,v(3)),upY:w(4,1,v(4)),upZ:w(5,0,v(5))}})():l;return{get forwardX(){return h},get forwardY(){return p},get forwardZ(){return d},get positionX(){return f},get positionY(){return _},get positionZ(){return m},get upX(){return g},get upY(){return v},get upZ(){return y}}})(pn,xn,Sn,ue,ce,me,ze,ve),$n=new WeakMap,Gn=((t,e,n,s,i,r)=>class extends n{constructor(n,r){super(n),this._nativeContext=n,C.set(this,n),s(n)&&i.set(n,new Set),this._destination=new t(this,r),this._listener=e(this,n),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(t){const e="function"==typeof t?r(this,t):null;this._nativeContext.onstatechange=e;const n=this._nativeContext.onstatechange;this._onstatechange=null!==n&&n===e?t:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}})(_n,Hn,Le,ze,$n,Ae),Xn=((t,e,n,s,i,r)=>(o,a)=>{const u=o.createOscillator();return Xt(u,a),Yt(u,a,"detune"),Yt(u,a,"frequency"),void 0!==a.periodicWave?u.setPeriodicWave(a.periodicWave):Gt(u,a,"type"),e(n,(()=>n(o)))||Qt(u),e(s,(()=>s(o)))||r(u,o),e(i,(()=>i(o)))||Kt(u),t(o,u),u})(on,Ee,we,xe,be,Te),Zn=((t,e,n,s,i)=>()=>{const r=new WeakMap;let o=null,a=null,u=null;return{set periodicWave(t){o=t},set start(t){a=t},set stop(t){u=t},render(c,l){const h=r.get(l);return void 0!==h?Promise.resolve(h):(async(c,l)=>{let h=n(c);const p=H(h,l);if(!p){const t={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation,detune:h.detune.value,frequency:h.frequency.value,periodicWave:null===o?void 0:o,type:h.type};h=e(l,t),null!==a&&h.start(a),null!==u&&h.stop(u)}return r.set(l,h),p?(await t(l,c.detune,h.detune),await t(l,c.frequency,h.frequency)):(await s(l,c.detune,h.detune),await s(l,c.frequency,h.frequency)),await i(c,l,h),h})(c,l)}}})(un,Xn,_t,ln,Pe),Yn=((t,e,n,s,i,r,o)=>class extends t{constructor(t,o){const a=i(t),u={...he,...o},c=n(a,u),l=r(a),h=l?s():null,p=t.sampleRate/2;super(t,!1,c,h),this._detune=e(this,l,c.detune,153600,-153600),this._frequency=e(this,l,c.frequency,p,-p),this._nativeOscillatorNode=c,this._onended=null,this._oscillatorNodeRenderer=h,null!==this._oscillatorNodeRenderer&&void 0!==u.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=u.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(t){const e="function"==typeof t?o(this,t):null;this._nativeOscillatorNode.onended=e;const n=this._nativeOscillatorNode.onended;this._onended=null!==n&&n===e?t:n}get type(){return this._nativeOscillatorNode.type}set type(t){this._nativeOscillatorNode.type=t,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(t){this._nativeOscillatorNode.setPeriodicWave(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=t)}start(t=0){if(this._nativeOscillatorNode.start(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=t),"closed"!==this.context.state){j(this);const t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),K(this)&&W(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(t=0){this._nativeOscillatorNode.stop(t),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=t)}})(Ze,pn,Xn,Zn,qe,ze,Ae),Qn=(t=>(e,n)=>{const s=t(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),i=e.createBuffer(1,2,44100);return s.buffer=i,s.loop=!0,s.connect(n),s.start(),()=>{s.stop(),s.disconnect(n)}})(cn),Kn=((t,e,n,s,i)=>(r,{curve:o,oversample:a,...u})=>{const c=r.createWaveShaper(),l=r.createWaveShaper();Xt(c,u),Xt(l,u);const h=n(r,{...u,gain:1}),p=n(r,{...u,gain:-1}),d=n(r,{...u,gain:1}),f=n(r,{...u,gain:-1});let _=null,m=!1,g=null;const v={get bufferSize(){},get channelCount(){return c.channelCount},set channelCount(t){h.channelCount=t,p.channelCount=t,c.channelCount=t,d.channelCount=t,l.channelCount=t,f.channelCount=t},get channelCountMode(){return c.channelCountMode},set channelCountMode(t){h.channelCountMode=t,p.channelCountMode=t,c.channelCountMode=t,d.channelCountMode=t,l.channelCountMode=t,f.channelCountMode=t},get channelInterpretation(){return c.channelInterpretation},set channelInterpretation(t){h.channelInterpretation=t,p.channelInterpretation=t,c.channelInterpretation=t,d.channelInterpretation=t,l.channelInterpretation=t,f.channelInterpretation=t},get context(){return c.context},get curve(){return g},set curve(n){if(null!==n&&n.length<2)throw e();if(null===n)c.curve=n,l.curve=n;else{const t=n.length,e=new Float32Array(t+2-t%2),s=new Float32Array(t+2-t%2);e[0]=n[0],s[0]=-n[t-1];const i=Math.ceil((t+1)/2),r=(t+1)/2-1;for(let o=1;o<i;o+=1){const a=o/i*r,u=Math.floor(a),c=Math.ceil(a);e[o]=u===c?n[u]:(1-(a-u))*n[u]+(1-(c-a))*n[c],s[o]=u===c?-n[t-1-u]:-(1-(a-u))*n[t-1-u]-(1-(c-a))*n[t-1-c]}e[i]=t%2==1?n[i-1]:(n[i-2]+n[i-1])/2,c.curve=e,l.curve=s}g=n,m&&(s(g)&&null===_?_=t(r,h):null!==_&&(_(),_=null))},get inputs(){return[h]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return c.numberOfOutputs},get oversample(){return c.oversample},set oversample(t){c.oversample=t,l.oversample=t},addEventListener:(...t)=>h.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>h.dispatchEvent(t[0]),removeEventListener:(...t)=>h.removeEventListener(t[0],t[1],t[2])};null!==o&&(v.curve=o instanceof Float32Array?o:new Float32Array(o)),a!==v.oversample&&(v.oversample=a);return i(se(v,d),(()=>{h.connect(c).connect(d),h.connect(p).connect(l).connect(f).connect(d),m=!0,s(g)&&(_=t(r,h))}),(()=>{h.disconnect(c),c.disconnect(d),h.disconnect(p),p.disconnect(l),l.disconnect(f),f.disconnect(d),m=!1,null!==_&&(_(),_=null)}))})(Qn,zt,re,ge,yn),Jn=((t,e,n,s,i,r,o)=>(a,u)=>{const c=a.createWaveShaper();if(null!==r&&"webkitAudioContext"===r.name&&void 0===a.createGain().gain.automationRate)return n(a,u);Xt(c,u);const l=null===u.curve||u.curve instanceof Float32Array?u.curve:new Float32Array(u.curve);if(null!==l&&l.length<2)throw e();Gt(c,{curve:l},"curve"),Gt(c,u,"oversample");let h=null,p=!1;o(c,"curve",(t=>()=>t.call(c)),(e=>n=>(e.call(c,n),p&&(s(n)&&null===h?h=t(a,c):s(n)||null===h||(h(),h=null)),n)));return i(c,(()=>{p=!0,s(c.curve)&&(h=t(a,c))}),(()=>{p=!1,null!==h&&(h(),h=null)}))})(Qn,zt,Kn,ge,yn,Ue,ve),ts=((t,e,n,s,i,r,o,a,u,c)=>(l,{coneInnerAngle:h,coneOuterAngle:p,coneOuterGain:d,distanceModel:f,maxDistance:_,orientationX:m,orientationY:g,orientationZ:v,panningModel:y,positionX:w,positionY:x,positionZ:b,refDistance:T,rolloffFactor:A,...k})=>{const C=l.createPanner();if(k.channelCount>2)throw o();if("max"===k.channelCountMode)throw o();Xt(C,k);const S={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},O=n(l,{...S,channelInterpretation:"speakers",numberOfInputs:6}),M=s(l,{...k,gain:1}),E=s(l,{...S,gain:1}),D=s(l,{...S,gain:0}),I=s(l,{...S,gain:0}),R=s(l,{...S,gain:0}),N=s(l,{...S,gain:0}),B=s(l,{...S,gain:0}),P=i(l,256,6,1),V=r(l,{...S,curve:new Float32Array([1,1]),oversample:"none"});let q=[m,g,v],F=[w,x,b];const j=new Float32Array(1);P.onaudioprocess=({inputBuffer:t})=>{const e=[u(t,j,0),u(t,j,1),u(t,j,2)];e.some(((t,e)=>t!==q[e]))&&(C.setOrientation(...e),q=e);const n=[u(t,j,3),u(t,j,4),u(t,j,5)];n.some(((t,e)=>t!==F[e]))&&(C.setPosition(...n),F=n)},Object.defineProperty(D.gain,"defaultValue",{get:()=>0}),Object.defineProperty(I.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(N.gain,"defaultValue",{get:()=>0}),Object.defineProperty(B.gain,"defaultValue",{get:()=>0});const z={get bufferSize(){},get channelCount(){return C.channelCount},set channelCount(t){if(t>2)throw o();M.channelCount=t,C.channelCount=t},get channelCountMode(){return C.channelCountMode},set channelCountMode(t){if("max"===t)throw o();M.channelCountMode=t,C.channelCountMode=t},get channelInterpretation(){return C.channelInterpretation},set channelInterpretation(t){M.channelInterpretation=t,C.channelInterpretation=t},get coneInnerAngle(){return C.coneInnerAngle},set coneInnerAngle(t){C.coneInnerAngle=t},get coneOuterAngle(){return C.coneOuterAngle},set coneOuterAngle(t){C.coneOuterAngle=t},get coneOuterGain(){return C.coneOuterGain},set coneOuterGain(t){if(t<0||t>1)throw e();C.coneOuterGain=t},get context(){return C.context},get distanceModel(){return C.distanceModel},set distanceModel(t){C.distanceModel=t},get inputs(){return[M]},get maxDistance(){return C.maxDistance},set maxDistance(t){if(t<0)throw new RangeError;C.maxDistance=t},get numberOfInputs(){return C.numberOfInputs},get numberOfOutputs(){return C.numberOfOutputs},get orientationX(){return E.gain},get orientationY(){return D.gain},get orientationZ(){return I.gain},get panningModel(){return C.panningModel},set panningModel(t){C.panningModel=t},get positionX(){return R.gain},get positionY(){return N.gain},get positionZ(){return B.gain},get refDistance(){return C.refDistance},set refDistance(t){if(t<0)throw new RangeError;C.refDistance=t},get rolloffFactor(){return C.rolloffFactor},set rolloffFactor(t){if(t<0)throw new RangeError;C.rolloffFactor=t},addEventListener:(...t)=>M.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>M.dispatchEvent(t[0]),removeEventListener:(...t)=>M.removeEventListener(t[0],t[1],t[2])};h!==z.coneInnerAngle&&(z.coneInnerAngle=h),p!==z.coneOuterAngle&&(z.coneOuterAngle=p),d!==z.coneOuterGain&&(z.coneOuterGain=d),f!==z.distanceModel&&(z.distanceModel=f),_!==z.maxDistance&&(z.maxDistance=_),m!==z.orientationX.value&&(z.orientationX.value=m),g!==z.orientationY.value&&(z.orientationY.value=g),v!==z.orientationZ.value&&(z.orientationZ.value=v),y!==z.panningModel&&(z.panningModel=y),w!==z.positionX.value&&(z.positionX.value=w),x!==z.positionY.value&&(z.positionY.value=x),b!==z.positionZ.value&&(z.positionZ.value=b),T!==z.refDistance&&(z.refDistance=T),A!==z.rolloffFactor&&(z.rolloffFactor=A),1===q[0]&&0===q[1]&&0===q[2]||C.setOrientation(...q),0===F[0]&&0===F[1]&&0===F[2]||C.setPosition(...F);return c(se(z,C),(()=>{M.connect(C),t(M,V,0,0),V.connect(E).connect(O,0,0),V.connect(D).connect(O,0,1),V.connect(I).connect(O,0,2),V.connect(R).connect(O,0,3),V.connect(N).connect(O,0,4),V.connect(B).connect(O,0,5),O.connect(P).connect(l.destination)}),(()=>{M.disconnect(C),a(M,V,0,0),V.disconnect(E),E.disconnect(O),V.disconnect(D),D.disconnect(O),V.disconnect(I),I.disconnect(O),V.disconnect(R),R.disconnect(O),V.disconnect(N),N.disconnect(O),V.disconnect(B),B.disconnect(O),O.disconnect(P),P.disconnect(l.destination)}))})(lt,zt,xn,re,ue,Jn,ce,ft,me,yn),es=(t=>(e,n)=>{const s=e.createPanner();return void 0===s.orientationX?t(e,n):(Xt(s,n),Yt(s,n,"orientationX"),Yt(s,n,"orientationY"),Yt(s,n,"orientationZ"),Yt(s,n,"positionX"),Yt(s,n,"positionY"),Yt(s,n,"positionZ"),Gt(s,n,"coneInnerAngle"),Gt(s,n,"coneOuterAngle"),Gt(s,n,"coneOuterGain"),Gt(s,n,"distanceModel"),Gt(s,n,"maxDistance"),Gt(s,n,"panningModel"),Gt(s,n,"refDistance"),Gt(s,n,"rolloffFactor"),s)})(ts),ns=((t,e,n,s,i,r,o,a,u,c)=>()=>{const l=new WeakMap;let h=null;return{render(p,d){const f=l.get(d);return void 0!==f?Promise.resolve(f):(async(p,d)=>{let f=null,_=r(p);const m={channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation},g={...m,coneInnerAngle:_.coneInnerAngle,coneOuterAngle:_.coneOuterAngle,coneOuterGain:_.coneOuterGain,distanceModel:_.distanceModel,maxDistance:_.maxDistance,panningModel:_.panningModel,refDistance:_.refDistance,rolloffFactor:_.rolloffFactor},v=H(_,d);if("bufferSize"in _)f=s(d,{...m,gain:1});else if(!v){const t={...g,orientationX:_.orientationX.value,orientationY:_.orientationY.value,orientationZ:_.orientationZ.value,positionX:_.positionX.value,positionY:_.positionY.value,positionZ:_.positionZ.value};_=i(d,t)}if(l.set(d,null===f?_:f),null!==f){if(null===h){if(null===o)throw new Error("Missing the native OfflineAudioContext constructor.");const t=new o(6,p.context.length,d.sampleRate),s=e(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});s.connect(t.destination),h=(async()=>{const e=await Promise.all([p.orientationX,p.orientationY,p.orientationZ,p.positionX,p.positionY,p.positionZ].map((async(e,s)=>{const i=n(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===s?1:0});return await a(t,e,i.offset),i})));for(let t=0;t<6;t+=1)e[t].connect(s,0,t),e[t].start(0);return c(t)})()}const t=await h,r=s(d,{...m,gain:1});await u(p,d,r);const l=[];for(let e=0;e<t.numberOfChannels;e+=1)l.push(t.getChannelData(e));let _=[l[0][0],l[1][0],l[2][0]],v=[l[3][0],l[4][0],l[5][0]],y=s(d,{...m,gain:1}),w=i(d,{...g,orientationX:_[0],orientationY:_[1],orientationZ:_[2],positionX:v[0],positionY:v[1],positionZ:v[2]});r.connect(y).connect(w.inputs[0]),w.connect(f);for(let e=128;e<t.length;e+=128){const t=[l[0][e],l[1][e],l[2][e]],n=[l[3][e],l[4][e],l[5][e]];if(t.some(((t,e)=>t!==_[e]))||n.some(((t,e)=>t!==v[e]))){_=t,v=n;const o=e/d.sampleRate;y.gain.setValueAtTime(0,o),y=s(d,{...m,gain:0}),w=i(d,{...g,orientationX:_[0],orientationY:_[1],orientationZ:_[2],positionX:v[0],positionY:v[1],positionZ:v[2]}),y.gain.setValueAtTime(1,o),r.connect(y).connect(w.inputs[0]),w.connect(f)}}return f}return v?(await t(d,p.orientationX,_.orientationX),await t(d,p.orientationY,_.orientationY),await t(d,p.orientationZ,_.orientationZ),await t(d,p.positionX,_.positionX),await t(d,p.positionY,_.positionY),await t(d,p.positionZ,_.positionZ)):(await a(d,p.orientationX,_.orientationX),await a(d,p.orientationY,_.orientationY),await a(d,p.orientationZ,_.orientationZ),await a(d,p.positionX,_.positionX),await a(d,p.positionY,_.positionY),await a(d,p.positionZ,_.positionZ)),ct(_)?await u(p,d,_.inputs[0]):await u(p,d,_),_})(p,d)}}})(un,xn,Sn,re,es,_t,je,ln,Pe,zn),ss=((t,e,n,s,i,r,o)=>class extends t{constructor(t,a){const u=i(t),c={...pe,...a},l=n(u,c),h=r(u);super(t,!1,l,h?s():null),this._nativePannerNode=l,this._orientationX=e(this,h,l.orientationX,Q,Y),this._orientationY=e(this,h,l.orientationY,Q,Y),this._orientationZ=e(this,h,l.orientationZ,Q,Y),this._positionX=e(this,h,l.positionX,Q,Y),this._positionY=e(this,h,l.positionY,Q,Y),this._positionZ=e(this,h,l.positionZ,Q,Y),o(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(t){this._nativePannerNode.coneInnerAngle=t}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(t){this._nativePannerNode.coneOuterAngle=t}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(t){this._nativePannerNode.coneOuterGain=t}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(t){this._nativePannerNode.distanceModel=t}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(t){this._nativePannerNode.maxDistance=t}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(t){this._nativePannerNode.panningModel=t}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(t){this._nativePannerNode.refDistance=t}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(t){this._nativePannerNode.rolloffFactor=t}})(Ze,pn,es,ns,qe,ze,gn),is=(t=>(e,{disableNormalization:n,imag:s,real:i})=>{const r=s instanceof Float32Array?s:new Float32Array(s),o=i instanceof Float32Array?i:new Float32Array(i),a=e.createPeriodicWave(o,r,{disableNormalization:n});if(Array.from(s).length<2)throw t();return a})(G),rs=((t,e,n,s)=>class i{constructor(i,r){const o=e(i),a=s({...de,...r}),u=t(o,a);return n.add(u),u}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===i.prototype||n.has(t)}})(is,qe,new WeakSet,(t=>{const{imag:e,real:n}=t;return void 0===e?void 0===n?{...t,imag:[0,0],real:[0,0]}:{...t,imag:Array.from(n,(()=>0)),real:n}:void 0===n?{...t,imag:e,real:Array.from(e,(()=>0))}:{...t,imag:e,real:n}})),os=((t,e,n,s,i,r)=>{const o=16385,a=new Float32Array([1,1]),u=Math.PI/2,c={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},l={...c,oversample:"none"},h=(t,r,h,p,d)=>{if(1===r)return((t,e,i,r)=>{const h=new Float32Array(o),p=new Float32Array(o);for(let t=0;t<o;t+=1){const e=t/16384*u;h[t]=Math.cos(e),p[t]=Math.sin(e)}const d=n(t,{...c,gain:0}),f=s(t,{...l,curve:h}),_=s(t,{...l,curve:a}),m=n(t,{...c,gain:0}),g=s(t,{...l,curve:p});return{connectGraph(){e.connect(d),e.connect(void 0===_.inputs?_:_.inputs[0]),e.connect(m),_.connect(i),i.connect(void 0===f.inputs?f:f.inputs[0]),i.connect(void 0===g.inputs?g:g.inputs[0]),f.connect(d.gain),g.connect(m.gain),d.connect(r,0,0),m.connect(r,0,1)},disconnectGraph(){e.disconnect(d),e.disconnect(void 0===_.inputs?_:_.inputs[0]),e.disconnect(m),_.disconnect(i),i.disconnect(void 0===f.inputs?f:f.inputs[0]),i.disconnect(void 0===g.inputs?g:g.inputs[0]),f.disconnect(d.gain),g.disconnect(m.gain),d.disconnect(r,0,0),m.disconnect(r,0,1)}}})(t,h,p,d);if(2===r)return((t,i,r,h)=>{const p=new Float32Array(o),d=new Float32Array(o),f=new Float32Array(o),_=new Float32Array(o),m=Math.floor(8192.5);for(let t=0;t<o;t+=1)if(t>m){const e=(t-m)/(16384-m)*u;p[t]=Math.cos(e),d[t]=Math.sin(e),f[t]=0,_[t]=1}else{const e=t/(16384-m)*u;p[t]=1,d[t]=0,f[t]=Math.cos(e),_[t]=Math.sin(e)}const g=e(t,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),v=n(t,{...c,gain:0}),y=s(t,{...l,curve:p}),w=n(t,{...c,gain:0}),x=s(t,{...l,curve:d}),b=s(t,{...l,curve:a}),T=n(t,{...c,gain:0}),A=s(t,{...l,curve:f}),k=n(t,{...c,gain:0}),C=s(t,{...l,curve:_});return{connectGraph(){i.connect(g),i.connect(void 0===b.inputs?b:b.inputs[0]),g.connect(v,0),g.connect(w,0),g.connect(T,1),g.connect(k,1),b.connect(r),r.connect(void 0===y.inputs?y:y.inputs[0]),r.connect(void 0===x.inputs?x:x.inputs[0]),r.connect(void 0===A.inputs?A:A.inputs[0]),r.connect(void 0===C.inputs?C:C.inputs[0]),y.connect(v.gain),x.connect(w.gain),A.connect(T.gain),C.connect(k.gain),v.connect(h,0,0),T.connect(h,0,0),w.connect(h,0,1),k.connect(h,0,1)},disconnectGraph(){i.disconnect(g),i.disconnect(void 0===b.inputs?b:b.inputs[0]),g.disconnect(v,0),g.disconnect(w,0),g.disconnect(T,1),g.disconnect(k,1),b.disconnect(r),r.disconnect(void 0===y.inputs?y:y.inputs[0]),r.disconnect(void 0===x.inputs?x:x.inputs[0]),r.disconnect(void 0===A.inputs?A:A.inputs[0]),r.disconnect(void 0===C.inputs?C:C.inputs[0]),y.disconnect(v.gain),x.disconnect(w.gain),A.disconnect(T.gain),C.disconnect(k.gain),v.disconnect(h,0,0),T.disconnect(h,0,0),w.disconnect(h,0,1),k.disconnect(h,0,1)}}})(t,h,p,d);throw i()};return(e,{channelCount:s,channelCountMode:o,pan:a,...u})=>{if("max"===o)throw i();const c=t(e,{...u,channelCount:1,channelCountMode:o,numberOfInputs:2}),l=n(e,{...u,channelCount:s,channelCountMode:o,gain:1}),p=n(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:a});let{connectGraph:d,disconnectGraph:f}=h(e,s,l,p,c);Object.defineProperty(p.gain,"defaultValue",{get:()=>0}),Object.defineProperty(p.gain,"maxValue",{get:()=>1}),Object.defineProperty(p.gain,"minValue",{get:()=>-1});const _={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(t){l.channelCount!==t&&(m&&f(),({connectGraph:d,disconnectGraph:f}=h(e,t,l,p,c)),m&&d()),l.channelCount=t},get channelCountMode(){return l.channelCountMode},set channelCountMode(t){if("clamped-max"===t||"max"===t)throw i();l.channelCountMode=t},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(t){l.channelInterpretation=t},get context(){return l.context},get inputs(){return[l]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get pan(){return p.gain},addEventListener:(...t)=>l.addEventListener(t[0],t[1],t[2]),dispatchEvent:(...t)=>l.dispatchEvent(t[0]),removeEventListener:(...t)=>l.removeEventListener(t[0],t[1],t[2])};let m=!1;return r(se(_,c),(()=>{d(),m=!0}),(()=>{f(),m=!1}))}})(xn,ne,re,Jn,ce,yn),as=((t,e)=>(n,s)=>{const i=s.channelCountMode;if("clamped-max"===i)throw e();if(void 0===n.createStereoPanner)return t(n,s);const r=n.createStereoPanner();return Xt(r,s),Yt(r,s,"pan"),Object.defineProperty(r,"channelCountMode",{get:()=>i,set:t=>{if(t!==i)throw e()}}),r})(os,ce),us=((t,e,n,s,i)=>()=>{const r=new WeakMap;return{render(o,a){const u=r.get(a);return void 0!==u?Promise.resolve(u):(async(o,a)=>{let u=n(o);const c=H(u,a);if(!c){const t={channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,pan:u.pan.value};u=e(a,t)}return r.set(a,u),c?await t(a,o.pan,u.pan):await s(a,o.pan,u.pan),ct(u)?await i(o,a,u.inputs[0]):await i(o,a,u),u})(o,a)}}})(un,as,_t,ln,Pe),cs=((t,e,n,s,i,r)=>class extends t{constructor(t,o){const a=i(t),u={...fe,...o},c=n(a,u),l=r(a);super(t,!1,c,l?s():null),this._pan=e(this,l,c.pan)}get pan(){return this._pan}})(Ze,pn,as,us,qe,ze),ls=((t,e,n)=>()=>{const s=new WeakMap;return{render(i,r){const o=s.get(r);return void 0!==o?Promise.resolve(o):(async(i,r)=>{let o=e(i);if(!H(o,r)){const e={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,curve:o.curve,oversample:o.oversample};o=t(r,e)}return s.set(r,o),ct(o)?await n(i,r,o.inputs[0]):await n(i,r,o),o})(i,r)}}})(Jn,_t,Pe),hs=((t,e,n,s,i,r,o)=>class extends t{constructor(t,e){const a=i(t),u={..._e,...e},c=n(a,u);super(t,!0,c,r(a)?s():null),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,o(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(t){if(null===t)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(t.length<2)throw e();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=t}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(t){this._nativeWaveShaperNode.oversample=t}})(Ze,zt,Jn,ls,qe,ze,gn),ps=(t=>null!==t&&t.isSecureContext)(Re),ds=(t=>(e,n,s)=>{Object.defineProperties(t,{currentFrame:{configurable:!0,get:()=>Math.round(e*n)},currentTime:{configurable:!0,get:()=>e}});try{return s()}finally{null!==t&&(delete t.currentFrame,delete t.currentTime)}})(Re),fs=new WeakMap,_s=((t,e)=>n=>{let s=t.get(n);if(void 0!==s)return s;if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");return s=new e(1,1,44100),t.set(n,s),s})(fs,je),ms=ps?((t,e,n,s,i,r,o,a,u,c,l,h,p)=>{let d=0;return(f,_,m={credentials:"omit"})=>{const g=l.get(f);if(void 0!==g&&g.has(_))return Promise.resolve();const v=c.get(f);if(void 0!==v){const t=v.get(_);if(void 0!==t)return t}const y=r(f),w=void 0===y.audioWorklet?i(_).then((([t,e])=>{const[s,i]=R(t,e);return n(`${s};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}\n})})(window,'_AWGS')`)})).then((()=>{const t=p._AWGS.pop();if(void 0===t)throw new SyntaxError;s(y.currentTime,y.sampleRate,(()=>t(class{},void 0,((t,n)=>{if(""===t.trim())throw e();const s=M.get(y);if(void 0!==s){if(s.has(t))throw e();B(n),N(n.parameterDescriptors),s.set(t,n)}else B(n),N(n.parameterDescriptors),M.set(y,new Map([[t,n]]))}),y.sampleRate,void 0,void 0)))})):Promise.all([i(_),Promise.resolve(t(h,h))]).then((([[t,e],n])=>{const s=d+1;d=s;const[i,r]=R(t,e),c=new Blob([`${i};((AudioWorkletProcessor,registerProcessor)=>{${r}\n})(${n?"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{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"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${s}',class extends AudioWorkletProcessor{process(){return !1}})`],{type:"application/javascript; charset=utf-8"}),l=URL.createObjectURL(c);return y.audioWorklet.addModule(l,m).then((()=>{if(a(y))return y;const t=o(y);return t.audioWorklet.addModule(l,m).then((()=>t))})).then((t=>{if(null===u)throw new SyntaxError;try{new u(t,`__sac${s}`)}catch{throw new SyntaxError}})).finally((()=>URL.revokeObjectURL(l)))}));return void 0===v?c.set(f,new Map([[_,w]])):v.set(_,w),w.then((()=>{const t=l.get(f);void 0===t?l.set(f,new Set([_])):t.add(_)})).finally((()=>{const t=c.get(f);void 0!==t&&t.delete(_)})),w}})(Ee,ce,(t=>e=>new Promise(((n,s)=>{if(null===t)return void s(new SyntaxError);const i=t.document.head;if(null===i)s(new SyntaxError);else{const r=t.document.createElement("script"),o=new Blob([e],{type:"application/javascript"}),a=URL.createObjectURL(o),u=t.onerror,c=()=>{t.onerror=u,URL.revokeObjectURL(a)};t.onerror=(e,n,i,r,o)=>n===a||n===t.location.href&&1===i&&1===r?(c(),s(o),!1):null!==u?u(e,n,i,r,o):void 0,r.onerror=()=>{c(),s(new SyntaxError)},r.onload=()=>{c(),n()},r.src=a,r.type="module",i.appendChild(r)}})))(Re),ds,(t=>async e=>{try{const t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw t()})((()=>new DOMException("","AbortError"))),qe,_s,ze,Xe,new WeakMap,new WeakMap,((t,e)=>async()=>{if(null===t)return!0;if(null===e)return!1;const n=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 e(1,128,44100),i=URL.createObjectURL(n);let r=!1,o=!1;try{await s.audioWorklet.addModule(i);const e=new t(s,"a",{numberOfOutputs:0}),n=s.createOscillator();e.port.onmessage=()=>r=!0,e.onprocessorerror=()=>o=!0,n.connect(e),n.start(0),await s.startRendering(),await new Promise((t=>setTimeout(t)))}catch{}finally{URL.revokeObjectURL(i)}return r&&!o})(Xe,je),Re):void 0,gs=((t,e)=>n=>t(n)||e(n))(He,ze),vs=((t,e,n,s,i,r,o,a,u,c,l)=>(h,p)=>{const d=o(h)?h:r(h);if(i.has(p)){const t=n();return Promise.reject(t)}try{i.add(p)}catch{}return e(u,(()=>u(d)))?d.decodeAudioData(p).then((n=>(Pt(p).catch((()=>{})),e(a,(()=>a(n)))||l(n),t.add(n),n))):new Promise(((e,n)=>{const i=async()=>{try{await Pt(p)}catch{}},r=t=>{n(t),i()};try{d.decodeAudioData(p,(n=>{"function"!=typeof n.copyFromChannel&&(c(n),X(n)),t.add(n),i().then((()=>e(n)))}),(t=>{r(null===t?s():t)}))}catch(t){r(t)}}))})(Ke,Ee,(()=>new DOMException("","DataCloneError")),(()=>new DOMException("","EncodingError")),new WeakSet,qe,gs,$,$t,nn,sn),ys=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_,m,g,v,y)=>class extends f{constructor(e,n){super(e,n),this._nativeContext=e,this._audioWorklet=void 0===t?void 0:{addModule:(e,n)=>t(this,e,n)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new e(this)}createBiquadFilter(){return new i(this)}createBuffer(t,e,s){return new n({length:e,numberOfChannels:t,sampleRate:s})}createBufferSource(){return new s(this)}createChannelMerger(t=6){return new r(this,{numberOfInputs:t})}createChannelSplitter(t=6){return new o(this,{numberOfOutputs:t})}createConstantSource(){return new a(this)}createConvolver(){return new u(this)}createDelay(t=1){return new l(this,{maxDelayTime:t})}createDynamicsCompressor(){return new h(this)}createGain(){return new p(this)}createIIRFilter(t,e){return new d(this,{feedback:e,feedforward:t})}createOscillator(){return new _(this)}createPanner(){return new m(this)}createPeriodicWave(t,e,n={disableNormalization:!1}){return new g(this,{...n,imag:e,real:t})}createStereoPanner(){return new v(this)}createWaveShaper(){return new y(this)}decodeAudioData(t,e,n){return c(this._nativeContext,t).then((t=>("function"==typeof e&&e(t),t)),(t=>{throw"function"==typeof n&&n(t),t}))}})(ms,Qe,rn,fn,vn,Tn,kn,Mn,In,vs,Nn,Vn,Fn,Un,Gn,Yn,ss,rs,cs,hs),ws=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t),o=e(r,i);if(s(r))throw TypeError();super(t,!0,o,null),this._nativeMediaElementAudioSourceNode=o}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}})(Ze,((t,e)=>t.createMediaElementSource(e.mediaElement)),qe,ze),xs=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t);if(s(r))throw new TypeError;const o={...Ht,...i},a=e(r,o);super(t,!1,a,null),this._nativeMediaStreamAudioDestinationNode=a}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}})(Ze,((t,e)=>{const n=t.createMediaStreamDestination();return Xt(n,e),1===n.numberOfOutputs&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n}),qe,ze),bs=((t,e,n,s)=>class extends t{constructor(t,i){const r=n(t),o=e(r,i);if(s(r))throw new TypeError;super(t,!0,o,null),this._nativeMediaStreamAudioSourceNode=o}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}})(Ze,((t,{mediaStream:e})=>{const n=e.getAudioTracks();n.sort(((t,e)=>t.id<e.id?-1:t.id>e.id?1:0));const s=n.slice(0,1),i=t.createMediaStreamSource(new MediaStream(s));return Object.defineProperty(i,"mediaStream",{value:e}),i}),qe,ze),Ts=((t,e)=>(n,{mediaStreamTrack:s})=>{if("function"==typeof n.createMediaStreamTrackSource)return n.createMediaStreamTrackSource(s);const i=new MediaStream([s]),r=n.createMediaStreamSource(i);if("audio"!==s.kind)throw t();if(e(n))throw new TypeError;return r})(zt,ze),As=((t,e,n)=>class extends t{constructor(t,s){const i=n(t);super(t,!0,e(i,s),null)}})(Ze,Ts,qe),ks=((t,e,n,s,i,r,o,a,u)=>class extends t{constructor(t={}){if(null===u)throw new Error("Missing the native AudioContext constructor.");let e;try{e=new u(t)}catch(t){if(12===t.code&&"sampleRate is not in range"===t.message)throw n();throw t}if(null===e)throw s();if(!(t=>void 0===t||"number"==typeof t||"string"==typeof t&&("balanced"===t||"interactive"===t||"playback"===t))(t.latencyHint))throw new TypeError(`The provided value '${t.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(void 0!==t.sampleRate&&e.sampleRate!==t.sampleRate)throw n();super(e,2);const{latencyHint:i}=t,{sampleRate:r}=e;if(this._baseLatency="number"==typeof e.baseLatency?e.baseLatency:"balanced"===i?512/r:"interactive"===i||void 0===i?256/r:"playback"===i?1024/r:128*Math.max(2,Math.min(128,Math.round(i*r/128)))/r,this._nativeAudioContext=e,"webkitAudioContext"===u.name?(this._nativeGainNode=e.createGain(),this._nativeOscillatorNode=e.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(e.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,"running"===e.state){this._state="suspended";const t=()=>{"suspended"===this._state&&(this._state=null),e.removeEventListener("statechange",t)};e.addEventListener("statechange",t)}}get baseLatency(){return this._baseLatency}get state(){return null!==this._state?this._state:this._nativeAudioContext.state}close(){return"closed"===this.state?this._nativeAudioContext.close().then((()=>{throw e()})):("suspended"===this._state&&(this._state=null),this._nativeAudioContext.close().then((()=>{null!==this._nativeGainNode&&null!==this._nativeOscillatorNode&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),st(this)})))}createMediaElementSource(t){return new i(this,{mediaElement:t})}createMediaStreamDestination(){return new r(this)}createMediaStreamSource(t){return new o(this,{mediaStream:t})}createMediaStreamTrackSource(t){return new a(this,{mediaStreamTrack:t})}resume(){return"suspended"===this._state?new Promise(((t,e)=>{const n=()=>{this._nativeAudioContext.removeEventListener("statechange",n),"running"===this._nativeAudioContext.state?t():this.resume().then(t,e)};this._nativeAudioContext.addEventListener("statechange",n)})):this._nativeAudioContext.resume().catch((t=>{if(void 0===t||15===t.code)throw e();throw t}))}suspend(){return this._nativeAudioContext.suspend().catch((t=>{if(void 0===t)throw e();throw t}))}})(ys,zt,ce,(()=>new DOMException("","UnknownError")),ws,xs,bs,As,Ue),Cs=(t=>e=>{const n=t.get(e);if(void 0===n)throw new Error("The context has no set of AudioWorkletNodes.");return n})($n),Ss=(t=>(e,n)=>{t(e).add(n)})(Cs),Os=(t=>(e,n,s=0,i=0)=>{const r=e[s];if(void 0===r)throw t();return xt(n)?r.connect(n,0,i):r.connect(n,0)})(G),Ms=(t=>(e,n)=>{t(e).delete(n)})(Cs),Es=(t=>(e,n=void 0,s=void 0,i=0)=>void 0===n?e.forEach((t=>t.disconnect())):"number"==typeof n?qt(t,e,n).disconnect():xt(n)?void 0===s?e.forEach((t=>t.disconnect(n))):void 0===i?qt(t,e,s).disconnect(n,0):qt(t,e,s).disconnect(n,0,i):void 0===s?e.forEach((t=>t.disconnect(n))):qt(t,e,s).disconnect(n,0))(G),Ds=new WeakMap,Is=((t,e)=>n=>e(t,n))(Ds,P),Rs=((t,e,n,s,i,r,o,a,u,c,l,h,p)=>(d,f,_,m)=>{if(0===m.numberOfInputs&&0===m.numberOfOutputs)throw u();const g=Array.isArray(m.outputChannelCount)?m.outputChannelCount:Array.from(m.outputChannelCount);if(g.some((t=>t<1)))throw u();if(g.length!==m.numberOfOutputs)throw e();if("explicit"!==m.channelCountMode)throw u();const v=m.channelCount*m.numberOfInputs,y=g.reduce(((t,e)=>t+e),0),w=void 0===_.parameterDescriptors?0:_.parameterDescriptors.length;if(v+w>6||y>6)throw u();const x=new MessageChannel,b=[],T=[];for(let t=0;t<m.numberOfInputs;t+=1)b.push(o(d,{channelCount:m.channelCount,channelCountMode:m.channelCountMode,channelInterpretation:m.channelInterpretation,gain:1})),T.push(i(d,{channelCount:m.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:m.channelCount}));const A=[];if(void 0!==_.parameterDescriptors)for(const{defaultValue:t,maxValue:e,minValue:n,name:s}of _.parameterDescriptors){const i=r(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:void 0!==m.parameterData[s]?m.parameterData[s]:void 0===t?0:t});Object.defineProperties(i.offset,{defaultValue:{get:()=>void 0===t?0:t},maxValue:{get:()=>void 0===e?Q:e},minValue:{get:()=>void 0===n?Y:n}}),A.push(i)}const k=s(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,v+w)}),C=Jt(f,d.sampleRate),S=a(d,C,v+w,Math.max(1,y)),O=i(d,{channelCount:Math.max(1,y),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,y)}),M=[];for(let t=0;t<m.numberOfOutputs;t+=1)M.push(s(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:g[t]}));for(let t=0;t<m.numberOfInputs;t+=1){b[t].connect(T[t]);for(let e=0;e<m.channelCount;e+=1)T[t].connect(k,e,t*m.channelCount+e)}const D=new kt(void 0===_.parameterDescriptors?[]:_.parameterDescriptors.map((({name:t},e)=>{const n=A[e];return n.connect(k,0,v+e),n.start(0),[t,n.offset]})));k.connect(S);let I=m.channelInterpretation,R=null;const N=0===m.numberOfOutputs?[S]:M,B={get bufferSize(){return C},get channelCount(){return m.channelCount},set channelCount(t){throw n()},get channelCountMode(){return m.channelCountMode},set channelCountMode(t){throw n()},get channelInterpretation(){return I},set channelInterpretation(t){for(const e of b)e.channelInterpretation=t;I=t},get context(){return S.context},get inputs(){return b},get numberOfInputs(){return m.numberOfInputs},get numberOfOutputs(){return m.numberOfOutputs},get onprocessorerror(){return R},set onprocessorerror(t){"function"==typeof R&&B.removeEventListener("processorerror",R),R="function"==typeof t?t:null,"function"==typeof R&&B.addEventListener("processorerror",R)},get parameters(){return D},get port(){return x.port2},addEventListener:(...t)=>S.addEventListener(t[0],t[1],t[2]),connect:t.bind(null,N),disconnect:c.bind(null,N),dispatchEvent:(...t)=>S.dispatchEvent(t[0]),removeEventListener:(...t)=>S.removeEventListener(t[0],t[1],t[2])},P=new Map;var V,q;x.port1.addEventListener=(V=x.port1.addEventListener,(...t)=>{if("message"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=P.get(t[1]);void 0!==n?t[1]=n:(t[1]=t=>{l(d.currentTime,d.sampleRate,(()=>e(t)))},P.set(e,t[1]))}}return V.call(x.port1,t[0],t[1],t[2])}),x.port1.removeEventListener=(q=x.port1.removeEventListener,(...t)=>{if("message"===t[0]){const e=P.get(t[1]);void 0!==e&&(P.delete(t[1]),t[1]=e)}return q.call(x.port1,t[0],t[1],t[2])});let F=null;Object.defineProperty(x.port1,"onmessage",{get:()=>F,set:t=>{"function"==typeof F&&x.port1.removeEventListener("message",F),F="function"==typeof t?t:null,"function"==typeof F&&(x.port1.addEventListener("message",F),x.port1.start())}}),_.prototype.port=x.port1;let j=null;const z=((t,e,n,s)=>{let i=E.get(t);void 0===i&&(i=new WeakMap,E.set(t,i));const r=te(n,s);return i.set(e,r),r})(d,B,_,m);z.then((t=>j=t));const W=Mt(m.numberOfInputs,m.channelCount),L=Mt(m.numberOfOutputs,g),U=void 0===_.parameterDescriptors?[]:_.parameterDescriptors.reduce(((t,{name:e})=>({...t,[e]:new Float32Array(128)})),{});let H=!0;const $=()=>{m.numberOfOutputs>0&&S.disconnect(O);for(let t=0,e=0;t<m.numberOfOutputs;t+=1){const n=M[t];for(let s=0;s<g[t];s+=1)O.disconnect(n,e+s,s);e+=g[t]}},G=new Map;S.onaudioprocess=({inputBuffer:t,outputBuffer:e})=>{if(null!==j){const n=h(B);for(let s=0;s<C;s+=128){for(let e=0;e<m.numberOfInputs;e+=1)for(let n=0;n<m.channelCount;n+=1)St(t,W[e],n,n,s);void 0!==_.parameterDescriptors&&_.parameterDescriptors.forEach((({name:e},n)=>{St(t,U,e,v+n,s)}));for(let t=0;t<m.numberOfInputs;t+=1)for(let e=0;e<g[t];e+=1)0===L[t][e].byteLength&&(L[t][e]=new Float32Array(128));try{const t=W.map(((t,e)=>{if(n[e].size>0)return G.set(e,C/128),t;const s=G.get(e);return void 0===s?[]:(t.every((t=>t.every((t=>0===t))))&&(1===s?G.delete(e):G.set(e,s-1)),t)})),i=l(d.currentTime+s/d.sampleRate,d.sampleRate,(()=>j.process(t,L,U)));H=i;for(let t=0,n=0;t<m.numberOfOutputs;t+=1){for(let i=0;i<g[t];i+=1)Ot(e,L[t],i,n+i,s);n+=g[t]}}catch(t){H=!1,B.dispatchEvent(new ErrorEvent("processorerror",{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}))}if(!H){for(let t=0;t<m.numberOfInputs;t+=1){b[t].disconnect(T[t]);for(let e=0;e<m.channelCount;e+=1)T[s].disconnect(k,e,t*m.channelCount+e)}if(void 0!==_.parameterDescriptors){const t=_.parameterDescriptors.length;for(let e=0;e<t;e+=1){const t=A[e];t.disconnect(k,0,v+e),t.stop()}}k.disconnect(S),S.onaudioprocess=null,X?$():J();break}}}};let X=!1;const Z=o(d,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0}),K=()=>S.connect(Z).connect(d.destination),J=()=>{S.disconnect(Z),Z.disconnect()};return K(),p(B,(()=>{if(H){J(),m.numberOfOutputs>0&&S.connect(O);for(let t=0,e=0;t<m.numberOfOutputs;t+=1){const n=M[t];for(let s=0;s<g[t];s+=1)O.connect(n,e+s,s);e+=g[t]}}X=!0}),(()=>{H&&(K(),$()),X=!1}))})(Os,G,zt,xn,ne,Sn,re,ue,ce,Es,ds,Is,yn),Ns=((t,e,n,s,i)=>(r,o,a,u,c,l)=>{if(null!==a)try{const e=new a(r,u,l),s=new Map;let o=null;if(Object.defineProperties(e,{channelCount:{get:()=>l.channelCount,set:()=>{throw t()}},channelCountMode:{get:()=>"explicit",set:()=>{throw t()}},onprocessorerror:{get:()=>o,set:t=>{"function"==typeof o&&e.removeEventListener("processorerror",o),o="function"==typeof t?t:null,"function"==typeof o&&e.addEventListener("processorerror",o)}}}),e.addEventListener=(p=e.addEventListener,(...t)=>{if("processorerror"===t[0]){const e="function"==typeof t[1]?t[1]:"object"==typeof t[1]&&null!==t[1]&&"function"==typeof t[1].handleEvent?t[1].handleEvent:null;if(null!==e){const n=s.get(t[1]);void 0!==n?t[1]=n:(t[1]=n=>{"error"===n.type?(Object.defineProperties(n,{type:{value:"processorerror"}}),e(n)):e(new ErrorEvent(t[0],{...n}))},s.set(e,t[1]))}}return p.call(e,"error",t[1],t[2]),p.call(e,...t)}),e.removeEventListener=(h=e.removeEventListener,(...t)=>{if("processorerror"===t[0]){const e=s.get(t[1]);void 0!==e&&(s.delete(t[1]),t[1]=e)}return h.call(e,"error",t[1],t[2]),h.call(e,t[0],t[1],t[2])}),0!==l.numberOfOutputs){const t=n(r,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.connect(t).connect(r.destination);return i(e,(()=>t.disconnect()),(()=>t.connect(r.destination)))}return e}catch(t){if(11===t.code)throw s();throw t}var h,p;if(void 0===c)throw s();return(t=>{const{port1:e}=new MessageChannel;try{e.postMessage(t)}finally{e.close()}})(l),e(r,o,c,l)})(zt,Rs,re,ce,yn),Bs=((t,e,n,s,i,r,o,a,u,c,l,h,p,d,f,_)=>(m,g,v)=>{const y=new WeakMap;let w=null;return{render(x,b){a(b,x);const T=y.get(b);return void 0!==T?Promise.resolve(T):(async(a,x)=>{let b=l(a),T=null;const A=H(b,x),k=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(null===h){const t=k.reduce(((t,e)=>t+e),0),n=i(x,{channelCount:Math.max(1,t),channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:Math.max(1,t)}),r=[];for(let t=0;t<a.numberOfOutputs;t+=1)r.push(s(x,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:k[t]}));const c=o(x,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1});c.connect=e.bind(null,r),c.disconnect=u.bind(null,r),T=[n,r,c]}else A||(b=new h(x,m));if(y.set(x,null===T?b:T[2]),null!==T){if(null===w){if(void 0===v)throw new Error("Missing the processor constructor.");if(null===p)throw new Error("Missing the native OfflineAudioContext constructor.");const t=a.channelCount*a.numberOfInputs,e=void 0===v.parameterDescriptors?0:v.parameterDescriptors.length,n=t+e,u=async()=>{const u=new p(n,128*Math.ceil(a.context.length/128),x.sampleRate),c=[],l=[];for(let t=0;t<g.numberOfInputs;t+=1)c.push(o(u,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),l.push(i(u,{channelCount:g.channelCount,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:g.channelCount}));const h=await Promise.all(Array.from(a.parameters.values()).map((async t=>{const e=r(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:t.value});return await d(u,t,e.offset),e}))),m=s(u,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:Math.max(1,t+e)});for(let t=0;t<g.numberOfInputs;t+=1){c[t].connect(l[t]);for(let e=0;e<g.channelCount;e+=1)l[t].connect(m,e,t*g.channelCount+e)}for(const[e,n]of h.entries())n.connect(m,0,t+e),n.start(0);return m.connect(u.destination),await Promise.all(c.map((t=>f(a,u,t)))),_(u)};w=Et(a,0===n?null:await u(),x,g,k,v,c)}const t=await w,e=n(x,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[u,l,h]=T;null!==t&&(e.buffer=t,e.start(0)),e.connect(u);for(let t=0,e=0;t<a.numberOfOutputs;t+=1){const n=l[t];for(let s=0;s<k[t];s+=1)u.connect(n,e+s,s);e+=k[t]}return h}if(A)for(const[e,n]of a.parameters.entries())await t(x,n,b.parameters.get(e));else for(const[t,e]of a.parameters.entries())await d(x,e,b.parameters.get(t));return await f(a,x,b),b})(x,b)}}})(un,Os,cn,xn,ne,Sn,re,Ms,Es,ds,_t,Xe,je,ln,Pe,zn),Ps=(t=>e=>t.get(e))(fs),Vs=(t=>(e,n)=>{t.set(e,n)})(Ds),qs=ps?((t,e,n,s,i,r,o,a,u,c,l,h,p,d)=>class extends e{constructor(e,d,f){var _;const m=a(e),g=u(m),v=l({...Ct,...f});p(v);const y=M.get(m),w=null==y?void 0:y.get(d),x=g||"closed"!==m.state?m:null!==(_=o(m))&&void 0!==_?_:m,b=i(x,g?null:e.baseLatency,c,d,w,v);super(e,!0,b,g?s(d,v,w):null);const T=[];b.parameters.forEach(((t,e)=>{const s=n(this,g,t);T.push([e,s])})),this._nativeAudioWorkletNode=b,this._onprocessorerror=null,this._parameters=new kt(T),g&&t(m,this);const{activeInputs:A}=r(this);h(b,A)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(t){const e="function"==typeof t?d(this,t):null;this._nativeAudioWorkletNode.onprocessorerror=e;const n=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=null!==n&&n===e?t:n}get parameters(){return null===this._parameters?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}})(Ss,Ze,pn,Bs,Ns,tt,Ps,qe,ze,Xe,(t=>({...t,outputChannelCount:void 0!==t.outputChannelCount?t.outputChannelCount:1===t.numberOfInputs&&1===t.numberOfOutputs?[t.channelCount]:Array.from({length:t.numberOfOutputs},(()=>1))})),Vs,(t=>{const{port1:e,port2:n}=new MessageChannel;try{e.postMessage(t)}finally{e.close(),n.close()}}),Ae):void 0,Fs=((t,e)=>(n,s,i)=>{if(null===e)throw new Error("Missing the native OfflineAudioContext constructor.");try{return new e(n,s,i)}catch(e){if("SyntaxError"===e.name)throw t();throw e}})(ce,je),js=((t,e,n,s,i,r,o,a)=>(u,c)=>n(u).render(u,c).then((()=>Promise.all(Array.from(s(c)).map((t=>n(t).render(t,c)))))).then((()=>i(c))).then((n=>("function"!=typeof n.copyFromChannel?(o(n),X(n)):e(r,(()=>r(n)))||a(n),t.add(n),n))))(Ke,Ee,Be,Cs,zn,$,nn,sn),zs=((t,e,n,s,i)=>class extends t{constructor(t,n,i){let r;if("number"==typeof t&&void 0!==n&&void 0!==i)r={length:n,numberOfChannels:t,sampleRate:i};else{if("object"!=typeof t)throw new Error("The given parameters are not valid.");r=t}const{length:o,numberOfChannels:a,sampleRate:u}={...le,...r},c=s(a,o,u);e($t,(()=>$t(c)))||c.addEventListener("statechange",(()=>{let t=0;const e=n=>{"running"===this._state&&(t>0?(c.removeEventListener("statechange",e),n.stopImmediatePropagation(),this._waitForThePromiseToSettle(n)):t+=1)};return e})()),super(c,a),this._length=o,this._nativeOfflineAudioContext=c,this._state=null}get length(){return void 0===this._nativeOfflineAudioContext.length?this._length:this._nativeOfflineAudioContext.length}get state(){return null===this._state?this._nativeOfflineAudioContext.state:this._state}startRendering(){return"running"===this._state?Promise.reject(n()):(this._state="running",i(this.destination,this._nativeOfflineAudioContext).finally((()=>{this._state=null,st(this)})))}_waitForThePromiseToSettle(t){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(t):setTimeout((()=>this._waitForThePromiseToSettle(t)))}})(ys,Ee,zt,Fs,js),Ws=((t,e)=>n=>{const s=t.get(n);return e(s)||e(n)})(C,He),Ls=((t,e)=>n=>t.has(n)||e(n))(T,$e),Us=((t,e)=>n=>t.has(n)||e(n))(k,Ge),Hs=((t,e)=>n=>{const s=t.get(n);return e(s)||e(n)})(C,ze);function $s(t,e){if(!t)throw new Error(e)}function Gs(t,e,n=1/0){if(!(e<=t&&t<=n))throw new RangeError(`Value must be within [${e}, ${n}], got: ${t}`)}function Xs(t){t.isOffline||"running"===t.state||Ys('The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.')}let Zs=console;function Ys(...t){Zs.warn(...t)}function Qs(t){return void 0===t}function Ks(t){return!Qs(t)}function Js(t){return"number"==typeof t}function ti(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object}function ei(t){return"boolean"==typeof t}function ni(t){return Array.isArray(t)}function si(t){return"string"==typeof t}function ii(t){return si(t)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(t)}const ri="object"==typeof self?self:null,oi=ri&&(ri.hasOwnProperty("AudioContext")||ri.hasOwnProperty("webkitAudioContext"));function ai(t,e,n,s){var i,r=arguments.length,o=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,n):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,s);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r<3?i(o):r>3?i(e,n,o):i(e,n))||o);return r>3&&o&&Object.defineProperty(e,n,o),o}function ui(t,e,n,s){return new(n||(n=Promise))((function(i,r){function o(t){try{u(s.next(t))}catch(t){r(t)}}function a(t){try{u(s.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}u((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class ci{constructor(t,e,n){this._callback=t,this._type=e,this._updateInterval=n,this._createClock()}_createWorker(){const t=new Blob([`\n\t\t\t// the initial timeout time\n\t\t\tlet timeoutTime = ${(1e3*this._updateInterval).toFixed(1)};\n\t\t\t// onmessage callback\n\t\t\tself.onmessage = function(msg){\n\t\t\t\ttimeoutTime = parseInt(msg.data);\n\t\t\t};\n\t\t\t// the tick function which posts a message\n\t\t\t// and schedules a new tick\n\t\t\tfunction tick(){\n\t\t\t\tsetTimeout(tick, timeoutTime);\n\t\t\t\tself.postMessage('tick');\n\t\t\t}\n\t\t\t// call tick initially\n\t\t\ttick();\n\t\t\t`],{type:"text/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);n.onmessage=this._callback.bind(this),this._worker=n}_createTimeout(){this._timeout=setTimeout((()=>{this._createTimeout(),this._callback()}),1e3*this._updateInterval)}_createClock(){if("worker"===this._type)try{this._createWorker()}catch(t){this._type="timeout",this._createClock()}else"timeout"===this._type&&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),"worker"===this._type&&this._worker.postMessage(Math.max(1e3*t,1))}get type(){return this._type}set type(t){this._disposeClock(),this._type=t,this._createClock()}dispose(){this._disposeClock()}}function li(t){return Us(t)}function hi(t){return Ls(t)}function pi(t){return Hs(t)}function di(t){return Ws(t)}function fi(t){return t instanceof AudioBuffer}function _i(t,e){return"value"===t||li(e)||hi(e)||fi(e)}function mi(t,...e){if(!e.length)return t;const n=e.shift();if(ti(t)&&ti(n))for(const e in n)_i(e,n[e])?t[e]=n[e]:ti(n[e])?(t[e]||Object.assign(t,{[e]:{}}),mi(t[e],n[e])):Object.assign(t,{[e]:n[e]});return mi(t,...e)}function gi(t,e,n=[],s){const i={},r=Array.from(e);if(ti(r[0])&&s&&!Reflect.has(r[0],s)){Object.keys(r[0]).some((e=>Reflect.has(t,e)))||(mi(i,{[s]:r[0]}),n.splice(n.indexOf(s),1),r.shift())}if(1===r.length&&ti(r[0]))mi(i,r[0]);else for(let t=0;t<n.length;t++)Ks(r[t])&&(i[n[t]]=r[t]);return mi(t,i)}function vi(t,e){return Qs(t)?e:t}function yi(t,e){return e.forEach((e=>{Reflect.has(t,e)&&delete t[e]})),t}
2
2
  /**
3
3
  * Tone.js
4
4
  * @author Yotam Mann
@@ -29,5 +29,5 @@ return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();functio
29
29
 
30
30
  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.
31
31
  */
32
- return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=i.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]),u=i.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]),c=i.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]),l=i.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]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=r.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,o,d,w,x,b,T,A,k,C,S,O=this._hash.words,M=h.words,E=p.words,D=a.words,I=u.words,R=c.words,N=l.words;for(b=r=O[0],T=o=O[1],A=d=O[2],k=w=O[3],C=x=O[4],n=0;n<80;n+=1)S=r+t[e+D[n]]|0,S+=n<16?f(o,d,w)+M[0]:n<32?_(o,d,w)+M[1]:n<48?m(o,d,w)+M[2]:n<64?g(o,d,w)+M[3]:v(o,d,w)+M[4],S=(S=y(S|=0,R[n]))+x|0,r=x,x=w,w=y(d,10),d=o,o=S,S=b+t[e+I[n]]|0,S+=n<16?v(T,A,k)+E[0]:n<32?g(T,A,k)+E[1]:n<48?m(T,A,k)+E[2]:n<64?_(T,A,k)+E[3]:f(T,A,k)+E[4],S=(S=y(S|=0,N[n]))+C|0,b=C,C=k,k=y(A,10),A=T,T=S;S=O[1]+d+k|0,O[1]=O[2]+w+C|0,O[2]=O[3]+x+b|0,O[3]=O[4]+r+T|0,O[4]=O[0]+o+A|0,O[0]=S},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var a=r[o];r[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function f(t,e,n){return t^e^n}function _(t,e,n){return t&e|~t&n}function m(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function v(t,e,n){return t^(e|~n)}function y(t,e){return t<<e|t>>>32-e}n.RIPEMD160=r._createHelper(d),n.HmacRIPEMD160=r._createHmacHelper(d)}(),t.RIPEMD160}(na())),za(),Wa||(Wa=1,La.exports=function(t){return s=(n=(e=t).lib).Base,i=n.WordArray,o=(r=e.algo).SHA256,a=r.HMAC,u=r.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,s=a.create(n.hasher,t),r=i.create(),o=i.create([1]),u=r.words,c=o.words,l=n.keySize,h=n.iterations;u.length<l;){var p=s.update(e).finalize(o);s.reset();for(var d=p.words,f=d.length,_=p,m=1;m<h;m++){_=s.finalize(_),s.reset();for(var g=_.words,v=0;v<f;v++)d[v]^=g[v]}r.concat(p),c[0]++}return r.sigBytes=4*l,r}}),e.PBKDF2=function(t,e,n){return u.create(n).compute(t,e)},t.PBKDF2;var e,n,s,i,r,o,a,u}(na(),Ca(),za())),$a(),Za(),Ka(),eu(),iu(),au(),uu||(uu=1,cu.exports=function(t){return t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e),t.mode.ECB;var e}(na(),Za())),lu||(lu=1,hu.exports=function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,s=4*e,i=s-n%s,r=n+i-1;t.clamp(),t.words[r>>>2]|=i<<24-r%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923}(na(),Za())),pu||(pu=1,du.exports=function(t){return t.pad.Iso10126={pad:function(e,n){var s=4*n,i=s-e.sigBytes%s;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126}(na(),Za())),fu||(fu=1,_u.exports=function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971}(na(),Za())),mu||(mu=1,gu.exports=function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},t.pad.ZeroPadding}(na(),Za())),vu||(vu=1,yu.exports=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}(na(),Za())),wu||(wu=1,xu.exports=function(t){return n=(e=t).lib.CipherParams,s=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return n.create({ciphertext:e})}},t.format.Hex;var e,n,s}(na(),Za())),bu||(bu=1,Tu.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo,i=[],r=[],o=[],a=[],u=[],c=[],l=[],h=[],p=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,s=0;for(e=0;e<256;e++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,i[n]=f,r[f]=n;var _=t[n],m=t[_],g=t[m],v=257*t[f]^16843008*f;o[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,u[n]=v<<8|v>>>24,c[n]=v,v=16843009*g^65537*m^257*_^16843008*n,l[f]=v<<24|v>>>8,h[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,d[f]=v,n?(n=_^t[t[t[g^_]]],s^=t[t[s]]):n=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=s.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,s=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o<s;o++)o<n?r[o]=e[o]:(c=r[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=f[o/n|0]<<24),r[o]=r[o-n]^c);for(var a=this._invKeySchedule=[],u=0;u<s;u++){if(o=s-u,u%4)var c=r[o];else c=r[o-4];a[u]=u<4||o<=4?c:l[i[c>>>24]]^h[i[c>>>16&255]]^p[i[c>>>8&255]]^d[i[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,o,a,u,c,i)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,l,h,p,d,r),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,s,i,r,o,a){for(var u=this._nRounds,c=t[e]^n[0],l=t[e+1]^n[1],h=t[e+2]^n[2],p=t[e+3]^n[3],d=4,f=1;f<u;f++){var _=s[c>>>24]^i[l>>>16&255]^r[h>>>8&255]^o[255&p]^n[d++],m=s[l>>>24]^i[h>>>16&255]^r[p>>>8&255]^o[255&c]^n[d++],g=s[h>>>24]^i[p>>>16&255]^r[c>>>8&255]^o[255&l]^n[d++],v=s[p>>>24]^i[c>>>16&255]^r[l>>>8&255]^o[255&h]^n[d++];c=_,l=m,h=g,p=v}_=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&p])^n[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^n[d++],g=(a[h>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],v=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],t[e]=_,t[e+1]=m,t[e+2]=g,t[e+3]=v},keySize:8});e.AES=n._createHelper(_)}(),t.AES}(na(),fa(),wa(),$a(),Za())),Cu(),Su||(Su=1,Ou.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=s.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,s=this._S=[],i=0;i<256;i++)s[i]=i;i=0;for(var r=0;i<256;i++){var o=i%n,a=e[o>>>2]>>>24-o%4*8&255;r=(r+s[i]+a)%256;var u=s[i];s[i]=s[r],s[r]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var t=this._S,e=this._i,n=this._j,s=0,i=0;i<4;i++){n=(n+t[e=(e+1)%256])%256;var r=t[e];t[e]=t[n],t[n]=r,s|=t[(t[e]+t[n])%256]<<24-8*i}return this._i=e,this._j=n,s}e.RC4=n._createHelper(i);var o=s.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)r.call(this)}});e.RC4Drop=n._createHelper(o)}(),t.RC4}(na(),fa(),wa(),$a(),Za())),Mu||(Mu=1,Eu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var s=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=s[n+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=l,i[3]^=p,i[4]^=c,i[5]^=h,i[6]^=l,i[7]^=p,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=n._createHelper(a)}(),t.Rabbit}(na(),fa(),wa(),$a(),Za())),Du||(Du=1,Iu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],s=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)u.call(this);for(i=0;i<8;i++)s[i]^=n[i+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(s[0]^=c,s[1]^=h,s[2]^=l,s[3]^=p,s[4]^=c,s[5]^=h,s[6]^=l,s[7]^=p,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=n._createHelper(a)}(),t.RabbitLegacy}(na(),fa(),wa(),$a(),Za())),Bu());var Pu,Vu=Wo(Jo.exports);function qu(t,e){const n=`${t}:${e}`,s=Vu.SHA256(n).toString(Vu.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)}`}function Fu(t,e){if(t instanceof Uu&&e instanceof Hu)t.plug(e);else if(t instanceof $u&&e instanceof Gu)t.plug(e);else if(t instanceof Wu&&e instanceof Lu)t.plug(e);else if(t instanceof Wu&&e instanceof Gu)t.plug(e);else if(t instanceof Wu&&e instanceof Hu)t.plug(e);else if(t instanceof Uu&&e instanceof Lu)t.plug(e);else{if(!(t instanceof $u&&e instanceof Lu))throw Error("Input and output type is not compatible");t.plug(e)}}function ju(t,e){if(t instanceof Uu&&e instanceof Hu)t.unPlug(e);else if(t instanceof $u&&e instanceof Gu)t.unPlug(e);else if(t instanceof Wu&&e instanceof Lu)t.unPlug(e);else if(t instanceof Wu&&e instanceof Gu)t.unPlug(e);else if(t instanceof Wu&&e instanceof Hu)t.unPlug(e);else if(t instanceof Uu&&e instanceof Lu)t.unPlug(e);else{if(!(t instanceof $u&&e instanceof Lu))throw Error("Input and output type is not compatible");t.unPlug(e)}}!function(t){t.AudioInput="audioInput",t.AudioOutput="audioOutput",t.MidiInput="midiInput",t.MidiOutput="midiOutput",t.ForwardInput="forwardInput",t.ForwardOutput="forwardOutput"}(Pu||(Pu={}));class zu{id;ioType;name;plugableModule;connections=[];static unPlugAll(t){t.connections.forEach((e=>t.unPlug(e)))}constructor(t,e){this.plugableModule=t,this.id=qu(t.id,e.name),Object.assign(this,e)}plug(t,e=!0){this.connections.push(t),e&&t.plug(this,!1)}unPlug(t,e=!0){this.connections=this.connections.filter((e=>e.id!==t.id)),e&&t.unPlug(this,!1)}serialize(){return{id:this.id,name:this.name,moduleId:this.plugableModule.id,moduleName:this.plugableModule.name,ioType:this.ioType}}}class Wu extends zu{constructor(t,e){super(t,e),this.checkNameValidity()}get subInputs(){return this.plugableModule.audioModules.map((t=>{const e=t.inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subInput(t){const e=this.subModule(t).inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);Fu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>Fu(e,t))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);ju(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>ju(e,t))))}unPlugAll(){zu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].inputs.findByName(this.name))throw Error("You should forward to existing input")}}class Lu extends zu{constructor(t,e){super(t,e),this.checkNameValidity()}get subOutputs(){return this.subModules.map((t=>{const e=t.outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subOutput(t){const e=this.subModule(t).outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Wu||(t instanceof Wu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);Fu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>Fu(t,e))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Wu||(t instanceof Wu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);ju(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>ju(t,e))))}unPlugAll(){zu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].outputs.findByName(this.name))throw Error("You should forward to existing output")}}class Uu extends zu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){zu.unPlugAll(this)}}class Hu extends zu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e),t instanceof Wu||this.internalModule.connect(t.internalModule)}unPlug(t,e=!0){super.unPlug(t,e),t instanceof Wu||this.internalModule.disconnect(t.internalModule)}unPlugAll(){zu.unPlugAll(this)}}class $u extends zu{onMidiEvent;constructor(t,e){super(t,e),this.onMidiEvent=e.onMidiEvent}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){zu.unPlugAll(this)}}class Gu extends zu{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){zu.unPlugAll(this)}onMidiEvent=t=>{this.midiConnections.forEach((e=>{e.onMidiEvent(t)}))};get midiConnections(){return this.connections.filter((t=>t instanceof $u))}}class Xu{plugableModule;collection=[];constructor(t){this.plugableModule=t}add(t){let e;switch(t.ioType){case Pu.AudioInput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new Uu(this.plugableModule,t);break;case Pu.AudioOutput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new Hu(this.plugableModule,t);break;case Pu.ForwardInput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Wu(this.plugableModule,t);break;case Pu.ForwardOutput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Lu(this.plugableModule,t);break;case Pu.MidiInput:e=new $u(this.plugableModule,t);break;case Pu.MidiOutput:e=new Gu(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 Zu{connect(){throw Error("This module is not connectable")}disconnect(){throw Error("This module is not connectable")}dispose(){}}var Yu,Qu=class{static moduleName;id;name;internalModule;inputs;outputs;voiceNo;updatedAt;_props={};constructor(t,e){this.internalModule=t,this.id=e.id||Ko(),delete e.id,this.inputs=new Xu(this),this.outputs=new Xu(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,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);Fu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll(),this.internalModule.dispose()}triggerAttack=(t,e)=>{throw Error("triggerAttack not implemented")};triggerRelease=(t,e)=>{throw Error("triggerRelease not implemented")};onMidiEvent=t=>{if(void 0!==t.voiceNo&&t.voiceNo!==this.voiceNo)return;const{note:e,triggeredAt:n}=t;switch(t.type){case"noteOn":{const{duration:t}=e;if(this.triggerer(this.triggerAttack,e,n),t){const r=n+(s=t,new Xi(zi(),s,i)).toSeconds();this.triggerer(this.triggerRelease,e,r)}break}case"noteOff":this.triggerer(this.triggerRelease,e,n);break;default:throw Error("This type is not a note")}var s,i};triggerer(t,e,n){t(e,n)}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:Pu.MidiInput})}registerAudioInput(t){return this.inputs.add({...t,ioType:Pu.AudioInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Pu.MidiOutput})}registerAudioOutput(t){return this.outputs.add({...t,ioType:Pu.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})}};class Ku{static moduleName;id;child;_name;audioModules;inputs;outputs;_numberOfVoices;constructor(t){this.id=t.id||Ko(),delete t.id,this.audioModules=[];const{child:e,props:n,...s}=t;this.child=e,Object.assign(this,s),this.numberOfVoices=1,this.inputs=new Xu(this),this.outputs=new Xu(this),Object.assign(this,{props:n})}get name(){return this._name}set name(t){this._name=t,this.audioModules.forEach((e=>e.name=t))}get props(){if(0===this.audioModules.length)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,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);Fu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.unPlugAll(),this.audioModules.forEach((t=>t.dispose()))}onMidiEvent=t=>{const e=t.voiceNo||0,n=this.findVoice(e);n?.onMidiEvent(t)};serialize(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");const t=this.constructor;return{...this.audioModules[0].serialize(),id:this.id,type:t.moduleName,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))}registerInput(t){return this.inputs.add({...t,ioType:Pu.ForwardInput})}registerOutput(t){return this.outputs.add({...t,ioType:Pu.ForwardOutput})}registerMidiInput(t){return this.inputs.add({...t,ioType:Pu.MidiInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Pu.MidiOutput})}registerBasicOutputs(){this.registerOutput({name:"output"})}registerBasicInputs(){this.registerInput({name:"input"}),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?.dispose()}else{const t=this.audioModules.length,e=qu(this.id,t.toString()),n=0===t?{}:this.props,s=new this.child({id:e,name:this.name,props:{...n,voiceNo:t}});if(s instanceof Ku)throw Error("Polymodule not supported");this.audioModules.push(s)}this.adjustNumberOfModules()}}}!function(t){t.Attack="attack",t.Decay="decay",t.Sustain="sustain",t.Release="release"}(Yu||(Yu={}));const Ju=.01,tc={attack:Ju,decay:Ju,sustain:1,release:Ju};class ec extends Qu{activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s,internalModule:i}=t;super(i,{id:e,name:n,props:{...tc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get attack(){return this._props.attack}set attack(t){this.setStage(Yu.Attack,t)}get decay(){return this._props.decay}set decay(t){this.setStage(Yu.Decay,t)}get sustain(){return this._props.sustain}set sustain(t){this.setStage(Yu.Sustain,t)}get release(){return this._props.release}set release(t){this.setStage(Yu.Release,t)}setStage(t,e){const n=0===e?this.minTime(t):this.maxTime(t)*e;this._props={...this.props,[t]:e},this.internalModule[t]=n}triggerAttack=(t,e)=>{this.activeNote=t.fullName,this.triggeredAt=e,this.internalModule.triggerAttack(e,t.velocity)};triggerRelease=(t,e)=>{this.internalModule.triggerRelease(e)};maxTime(t){return t===Yu.Sustain?1:2}minTime(t){return t===Yu.Sustain?0:Ju}}class nc extends Ku{constructor(t){const{id:e,name:n,child:s,props:i}=t;super({id:e,name:n,child:s,props:{...tc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class sc extends ec{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Jr,props:s})}}class ic extends nc{static moduleName="Envelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:sc,props:{...tc,...s}})}}class rc extends ec{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new so,props:s})}}class oc extends nc{static moduleName="AmpEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:rc,props:s})}}const ac={amount:0};class uc extends ec{_frequency;_amount;filter;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new ao,props:{...ac,...s}})}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this.internalModule.baseFrequency=t}get amount(){return this._amount}set amount(t){this._amount=t,this.internalModule.octaves=t}}class cc extends nc{static moduleName="FreqEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:uc,props:s})}}const lc={noteName:"C3",fine:0,coarse:0,wave:"sine",range:0,volume:0};class hc extends Qu{_note;constructor(t){const{id:e,name:n,props:s}=t;super(new Nr,{id:e,name:n,props:{...lc,...s}}),this.registerBasicOutputs(),this.registerDefaultMidiInput(),this.start(Io())}get note(){return this._note}setNoteAt(t,e){this._note=this.getNote(t),this.updateFrequency(e)}set note(t){this._note=this.getNote(t),this.updateFrequency()}get noteName(){return this._props.noteName}set noteName(t){this._props={...this.props,noteName:t},this.note=new Po(this.noteName)}get fine(){return this._props.fine}set fine(t){this._props={...this.props,fine:Math.floor(t)},this.internalModule.detune.value=this.fine}get coarse(){return this._props.coarse}set coarse(t){this._props={...this.props,coarse:Math.floor(t)},this.updateFrequency()}get wave(){return this._props.wave}set wave(t){this._props={...this.props,wave:t},this.internalModule.type=this.wave}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}get range(){return this._props.range}set range(t){this._props={...this.props,range:t},this.updateFrequency()}start(t){if(!Fc.isStarted)return;"started"===this.internalModule.state?this.internalModule.restart(t):this.internalModule.start(t)}stop(t){this.internalModule.stop(t)}triggerAttack=(t,e)=>{this.setNoteAt(t,e),this.start(e)};triggerRelease=()=>{};updateFrequency(t){if(!this.note)return;const e=this.note.adjustFrequency(this.range,this.coarse);t?this.internalModule.frequency.linearRampToValueAtTime(e,t):this.internalModule.frequency.value=e}getNote(t){return t instanceof Po?t:new Po(t)}}class pc extends Ku{static moduleName="Oscillator";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:hc,props:{...lc,...s}}),this.registerBasicOutputs(),this.registerInput({name:"midi in"})}start(t){this.audioModules.forEach((e=>e.start(t)))}stop(t){this.audioModules.forEach((e=>e.stop(t)))}}const dc={cutoff:2e4,resonance:0,envelopeAmount:0,slope:-24,filterType:"lowpass"};class fc extends Qu{constructor(t){const{id:e,name:n,props:s}=t;super(new oo({type:"lowpass"}),{id:e,name:n,props:{...dc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get cutoff(){return this._props.cutoff}set cutoff(t){this._props={...this.props,cutoff:t},this.internalModule.frequency.value=t}get filterType(){return this._props.filterType}set filterType(t){this._props={...this.props,filterType:t},this.internalModule.type=t}get slope(){return this._props.slope}set slope(t){this._props={...this.props,slope:t},this.internalModule.rolloff=t}get frequency(){return this.internalModule.frequency}get resonance(){return this._props.resonance}set resonance(t){this._props={...this.props,resonance:t},this.internalModule.Q.value=t}get envelopeAmount(){return this._props.envelopeAmount}set envelopeAmount(t){this._props={...this.props,envelopeAmount:t}}}class _c extends Ku{static moduleName="Filter";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:fc,props:{...dc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class mc extends Qu{static moduleName="Master";constructor({id:t}){super(zi().destination,{id:t,name:"Master"}),this.registerBasicInputs()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll()}}class gc extends Ku{static moduleName="VoiceScheduler";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:vc,props:s}),this.registerInputs(),this.registerOutputs(),this.polyNumber=this.numberOfVoices}set polyNumber(t){super.numberOfVoices=t}get polyNumber(){return this.numberOfVoices}onMidiEvent=t=>{let e;switch(t.type){case"noteOn":e=this.findFreeVoice();break;case"noteOff":e=this.audioModules.find((e=>e.activeNote===t.note.fullName));break;default:throw Error("This type is not a note")}e&&(e.midiTriggered(t),t.voiceNo=e.voiceNo,this.midiOutput.onMidiEvent(t))};serialize(){const t=super.serialize();return{...t,props:{...t.props,polyNumber:this.polyNumber}}}findFreeVoice(){let t=this.audioModules.find((t=>!t.activeNote));return t||(t=this.audioModules.sort(((t,e)=>t&&e?t.triggeredAt-e.triggeredAt:0))[0]),t}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}class vc extends Qu{midiEvent;activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s}=t;super(new Zu,{id:e,name:n,props:s})}midiTriggered=t=>{if(void 0===this.voiceNo)throw Error("Voice without voiceNo");const{triggeredAt:e,note:n,type:s}=t;if(!n)return;const i=n.fullName;switch(s){case"noteOn":this.activeNote=i,this.triggeredAt=e,this.midiEvent=t;break;case"noteOff":this.activeNote=null,this.midiEvent=null;break;default:throw Error("This type is not a note")}}}const yc={selectedId:null};class wc extends Qu{static moduleName="MidiSelector";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Zu,{id:e,name:n,props:{...yc,...s}}),this.registerOutputs(),this.addEventListener(this.selectedId)}get selectedId(){return this._props.selectedId}set selectedId(t){this.removeEventListener(),this._props={...this.props,selectedId:t},this.addEventListener(t)}dispose(){this.removeEventListener(),super.dispose()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}addEventListener(t){if(!this.onMidiEvent||!t)return;const e=Fc.midiDeviceManager.find(t);e?.addEventListener(this.onMidiEvent)}_onMidiEvent=t=>{this.midiOutput.onMidiEvent(t)};removeEventListener(){if(!this.selectedId)return;const t=Fc.midiDeviceManager.find(this.selectedId);t?.removeEventListener(this._onMidiEvent)}}const xc={volume:-1/0};class bc extends Qu{constructor(t){const{id:e,name:n,props:s}=t;super(new wr,{id:e,name:n,props:{...xc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}triggerAttack=(t,e)=>{const n=20*Math.log10(t.velocity);this.internalModule.volume.exponentialRampToValueAtTime(n,e)};triggerRelease=()=>{}}class Tc extends Ku{static moduleName="Volume";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:bc,props:{...xc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}}const Ac={activeNotes:[]};class kc extends Qu{static moduleName="VirtualMidi";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Zu,{id:e,name:n,props:{...Ac,...s}}),this.registerInputs(),this.registerOutputs()}get activeNotes(){return this._props.activeNotes}set activeNotes(t){this._props={...this.props,activeNotes:t}}sendMidi(t){this.midiOutput.onMidiEvent(t)}triggerAttack=t=>{this.activeNotes=[...this.activeNotes,t.fullName],Fc._triggerPropsUpdate(this.id,this.props)};triggerRelease=t=>{this.activeNotes=this.activeNotes.filter((e=>e!==t.fullName)),Fc._triggerPropsUpdate(this.id,this.props)};serialize(){return{...super.serialize(),activeNotes:this.activeNotes}}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}const Cc={wet:1};class Sc extends Qu{constructor(t){const{id:e,name:n,internalModule:s,props:i}=t;super(s,{id:e,name:n,props:{...Cc,...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 Oc={decay:1.5,preDelay:.025};class Mc extends Sc{static moduleName="Reverb";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new So,props:{...Oc,...s}})}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}}const Ec={delayTime:1,feedback:.3};class Dc extends Sc{static moduleName="Delay";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Co,props:{...Ec,...s}})}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}}const Ic={drive:.3};class Rc extends Sc{static moduleName="Distortion";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Ao,props:{...Ic,...s}})}get drive(){return this._props.drive}set drive(t){this._props={...this.props,drive:t},this.internalModule.distortion=this.drive}}const Nc={bits:16};class Bc extends Sc{static moduleName="BitCrusher";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new xo,props:{...Nc,...s}})}get bits(){return this._props.bits}set bits(t){this._props={...this.props,bits:t},this.internalModule.bits.value=this.bits}}class Pc extends Qu{static moduleName="Sequencer";midiOutput;part;constructor(t){const{id:e,name:n,props:s}=t;super(new Zu,{id:e,name:n,props:{sequences:[],steps:16,bars:1,...s}}),this.initializePart(),this.start(Io()),this.registerOutputs()}get props(){return super.props}set props(t){this.sequences||(this._props.sequences=[]),super.props={...this.props,...t},this.adjust()}get steps(){return this._props.steps}set steps(t){this._props={...this.props,steps:t}}get bars(){return this.props.bars}set bars(t){this._props={...this.props,bars:t}}get sequences(){return this._props.sequences}set sequences(t){const e=t;this._props={...this.props,sequences:e}}start(t){Fc.isStarted&&this.part.start(t)}stop(){this.part.stop()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}initializePart(){this.part=new mo(this.onPartEvent,[]),this.part.loop=!0,this.part.loopEnd=this.loopEnd}adjust(){this.part&&(this.adjustNumberOfBars(),this.adjustNumberOfSteps(),this.updateBarParts())}adjustNumberOfBars(){const t=this.sequences.length-this.bars,e=[...this.sequences];0!==t&&(t>0?e.pop():e.push([]),this.sequences=e,this.adjustNumberOfBars())}adjustNumberOfSteps(t=0){if(!this.bars)return;const e=[...this.sequences],n=[...e[t]],s=n.length-this.steps;if(0!==s){if(s>0)n.pop();else{const e=n.length;n.push({active:!1,time:`${t}:0:${e}`,notes:[]})}e[t]=n,this.sequences=e,this.adjustNumberOfSteps(t)}else{if(t===this.bars-1)return;this.adjustNumberOfSteps(t+1)}}updateBarParts(){this.part.clear(),this.sequences.forEach((t=>{t.forEach((t=>this.part.add(t.time,t)))})),this.part.loopEnd=this.loopEnd}get loopEnd(){return`${this.bars}:0:0`}onPartEvent=(t,e)=>{e.active&&qo.fromSequence(e,t).forEach((t=>{this.midiOutput.onMidiEvent(t)}))}}function Vc(t){const{id:e,type:n,name:s,props:i}=t,r=function(t){switch(t=Ho.upperFirst(Ho.camelCase(t))){case pc.moduleName:return pc;case ic.moduleName:return ic;case oc.moduleName:return oc;case cc.moduleName:return cc;case _c.moduleName:return _c;case Tc.moduleName:return Tc;case mc.moduleName:return mc;case gc.moduleName:return gc;case wc.moduleName:return wc;case kc.moduleName:return kc;case Mc.moduleName:return Mc;case Dc.moduleName:return Dc;case Rc.moduleName:return Rc;case Bc.moduleName:return Bc;case Pc.moduleName:return Pc;default:throw Error(`Unknown module type ${t}`)}}(n);return new r({id:e,name:s,props:i})}class qc{midiDeviceManager;static instance;context;propsUpdateCallbacks;_isStarted=!1;modules;routes;constructor(){this.modules={},this.routes={},this.propsUpdateCallbacks=[]}static getInstance(){return qc.instance||(qc.instance=new qc),qc.instance}initialize(t){return new Promise((e=>{if(this.context)return e({});this.context=new Ri(t.context),Wi(this.context),this.context.transport.start(),this.midiDeviceManager=new jo,setTimeout((()=>{e({})}),0)}))}addModule(t){const{id:e,name:n,type:s,props:i={}}=t,r=Vc({id:e,name:n,type:s,props:{}});return r.props=i,this.modules[r.id]=r,this.updateRoutes(),r.serialize()}removeModule(t){this.modules[t].dispose();const e=this.moduleRouteIds(t);return e.forEach((t=>delete this.routes[t])),this.updateRoutes(),delete this.modules[t],e}updateNameModule(t,e){const n=this.findById(t);return n.name=e,n.serialize()}onPropsUpdate(t){this.propsUpdateCallbacks.push(t)}_triggerPropsUpdate(t,e){this.propsUpdateCallbacks.forEach((n=>n(t,e)))}updatePropsModule(t,e){const n=this.findById(t),s=this.applyRoutesRequired(n,e);return n.props=e,s&&this.updateRoutes(),n.serialize()}addRoute(t){const e=function(t){const e=t.id||Ko();return{...t,id:e}}(t),n={...this.routes,[e.id]:e};return this.routes=n,this.updateRoutes(),e}removeRoute(t){delete this.routes[t],this.updateRoutes()}triggerVirtualMidi(t,e,n){this.findById(t).sendMidi(qo.fromNote(e,"noteOn"===n))}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 void 0!==this.context&&"started"===this.context.transport.state&&this._isStarted}start(){const t=Io();this._isStarted=!0,this.updateRoutes(),Object.values(this.modules).forEach((e=>{const n=e;n.start&&n.start(t)}))}stop(){const t=Io();Object.values(this.modules).forEach((e=>{const n=e;n.stop&&n.stop(t)})),this._isStarted=!1}get bpm(){return this.context.transport.bpm.value}set bpm(t){this.context.transport.bpm.value=t}updateRoutes(){var t;t=Object.values(this.routes),Object.values(Fc.modules).forEach((t=>{t.unPlugAll()})),t.map((t=>{const{sourceId:e,sourceIOId:n,destinationId:s,destinationIOId:i}=t,r=Fc.findById(e),o=Fc.findById(s),a=r.outputs.find(n),u=o.inputs.find(i);if(!u||!a)throw Error("IO not found");return Fu(u,a),!0})).every((t=>t))?console.log("######## Routes succesfully applied"):console.log("######## Routes partialy applied")}applyRoutesRequired(t,e){return!!e.polyNumber&&(t instanceof gc&&e.polyNumber!==t.polyNumber)}moduleRouteIds(t){const e={...this.routes};return Object.keys(e).filter((n=>{const{sourceId:s,destinationId:i}=e[n];return s===t||i===t}))}}var Fc=qc.getInstance();exports.MidiDevice=Fo,exports.MidiDeviceManager=jo,exports.Note=Po,exports.default=Fc;
32
+ return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=i.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]),u=i.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]),c=i.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]),l=i.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]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=r.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,o,d,w,x,b,T,A,k,C,S,O=this._hash.words,M=h.words,E=p.words,D=a.words,I=u.words,R=c.words,N=l.words;for(b=r=O[0],T=o=O[1],A=d=O[2],k=w=O[3],C=x=O[4],n=0;n<80;n+=1)S=r+t[e+D[n]]|0,S+=n<16?f(o,d,w)+M[0]:n<32?_(o,d,w)+M[1]:n<48?m(o,d,w)+M[2]:n<64?g(o,d,w)+M[3]:v(o,d,w)+M[4],S=(S=y(S|=0,R[n]))+x|0,r=x,x=w,w=y(d,10),d=o,o=S,S=b+t[e+I[n]]|0,S+=n<16?v(T,A,k)+E[0]:n<32?g(T,A,k)+E[1]:n<48?m(T,A,k)+E[2]:n<64?_(T,A,k)+E[3]:f(T,A,k)+E[4],S=(S=y(S|=0,N[n]))+C|0,b=C,C=k,k=y(A,10),A=T,T=S;S=O[1]+d+k|0,O[1]=O[2]+w+C|0,O[2]=O[3]+x+b|0,O[3]=O[4]+r+T|0,O[4]=O[0]+o+A|0,O[0]=S},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var a=r[o];r[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function f(t,e,n){return t^e^n}function _(t,e,n){return t&e|~t&n}function m(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function v(t,e,n){return t^(e|~n)}function y(t,e){return t<<e|t>>>32-e}n.RIPEMD160=r._createHelper(d),n.HmacRIPEMD160=r._createHmacHelper(d)}(),t.RIPEMD160}(na())),za(),Wa||(Wa=1,La.exports=function(t){return s=(n=(e=t).lib).Base,i=n.WordArray,o=(r=e.algo).SHA256,a=r.HMAC,u=r.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,s=a.create(n.hasher,t),r=i.create(),o=i.create([1]),u=r.words,c=o.words,l=n.keySize,h=n.iterations;u.length<l;){var p=s.update(e).finalize(o);s.reset();for(var d=p.words,f=d.length,_=p,m=1;m<h;m++){_=s.finalize(_),s.reset();for(var g=_.words,v=0;v<f;v++)d[v]^=g[v]}r.concat(p),c[0]++}return r.sigBytes=4*l,r}}),e.PBKDF2=function(t,e,n){return u.create(n).compute(t,e)},t.PBKDF2;var e,n,s,i,r,o,a,u}(na(),Ca(),za())),$a(),Za(),Ka(),eu(),iu(),au(),uu||(uu=1,cu.exports=function(t){return t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e),t.mode.ECB;var e}(na(),Za())),lu||(lu=1,hu.exports=function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,s=4*e,i=s-n%s,r=n+i-1;t.clamp(),t.words[r>>>2]|=i<<24-r%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923}(na(),Za())),pu||(pu=1,du.exports=function(t){return t.pad.Iso10126={pad:function(e,n){var s=4*n,i=s-e.sigBytes%s;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126}(na(),Za())),fu||(fu=1,_u.exports=function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971}(na(),Za())),mu||(mu=1,gu.exports=function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},t.pad.ZeroPadding}(na(),Za())),vu||(vu=1,yu.exports=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}(na(),Za())),wu||(wu=1,xu.exports=function(t){return n=(e=t).lib.CipherParams,s=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return n.create({ciphertext:e})}},t.format.Hex;var e,n,s}(na(),Za())),bu||(bu=1,Tu.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo,i=[],r=[],o=[],a=[],u=[],c=[],l=[],h=[],p=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,s=0;for(e=0;e<256;e++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,i[n]=f,r[f]=n;var _=t[n],m=t[_],g=t[m],v=257*t[f]^16843008*f;o[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,u[n]=v<<8|v>>>24,c[n]=v,v=16843009*g^65537*m^257*_^16843008*n,l[f]=v<<24|v>>>8,h[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,d[f]=v,n?(n=_^t[t[t[g^_]]],s^=t[t[s]]):n=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=s.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,s=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o<s;o++)o<n?r[o]=e[o]:(c=r[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=f[o/n|0]<<24),r[o]=r[o-n]^c);for(var a=this._invKeySchedule=[],u=0;u<s;u++){if(o=s-u,u%4)var c=r[o];else c=r[o-4];a[u]=u<4||o<=4?c:l[i[c>>>24]]^h[i[c>>>16&255]]^p[i[c>>>8&255]]^d[i[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,o,a,u,c,i)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,l,h,p,d,r),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,s,i,r,o,a){for(var u=this._nRounds,c=t[e]^n[0],l=t[e+1]^n[1],h=t[e+2]^n[2],p=t[e+3]^n[3],d=4,f=1;f<u;f++){var _=s[c>>>24]^i[l>>>16&255]^r[h>>>8&255]^o[255&p]^n[d++],m=s[l>>>24]^i[h>>>16&255]^r[p>>>8&255]^o[255&c]^n[d++],g=s[h>>>24]^i[p>>>16&255]^r[c>>>8&255]^o[255&l]^n[d++],v=s[p>>>24]^i[c>>>16&255]^r[l>>>8&255]^o[255&h]^n[d++];c=_,l=m,h=g,p=v}_=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&p])^n[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^n[d++],g=(a[h>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],v=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],t[e]=_,t[e+1]=m,t[e+2]=g,t[e+3]=v},keySize:8});e.AES=n._createHelper(_)}(),t.AES}(na(),fa(),wa(),$a(),Za())),Cu(),Su||(Su=1,Ou.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=s.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,s=this._S=[],i=0;i<256;i++)s[i]=i;i=0;for(var r=0;i<256;i++){var o=i%n,a=e[o>>>2]>>>24-o%4*8&255;r=(r+s[i]+a)%256;var u=s[i];s[i]=s[r],s[r]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var t=this._S,e=this._i,n=this._j,s=0,i=0;i<4;i++){n=(n+t[e=(e+1)%256])%256;var r=t[e];t[e]=t[n],t[n]=r,s|=t[(t[e]+t[n])%256]<<24-8*i}return this._i=e,this._j=n,s}e.RC4=n._createHelper(i);var o=s.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)r.call(this)}});e.RC4Drop=n._createHelper(o)}(),t.RC4}(na(),fa(),wa(),$a(),Za())),Mu||(Mu=1,Eu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var s=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=s[n+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=l,i[3]^=p,i[4]^=c,i[5]^=h,i[6]^=l,i[7]^=p,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=n._createHelper(a)}(),t.Rabbit}(na(),fa(),wa(),$a(),Za())),Du||(Du=1,Iu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],s=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)u.call(this);for(i=0;i<8;i++)s[i]^=n[i+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(s[0]^=c,s[1]^=h,s[2]^=l,s[3]^=p,s[4]^=c,s[5]^=h,s[6]^=l,s[7]^=p,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=n._createHelper(a)}(),t.RabbitLegacy}(na(),fa(),wa(),$a(),Za())),Bu());var Pu,Vu=Wo(Jo.exports);function qu(t,e){const n=`${t}:${e}`,s=Vu.SHA256(n).toString(Vu.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)}`}function Fu(t,e){if(t instanceof Uu&&e instanceof Hu)t.plug(e);else if(t instanceof $u&&e instanceof Gu)t.plug(e);else if(t instanceof Wu&&e instanceof Lu)t.plug(e);else if(t instanceof Wu&&e instanceof Gu)t.plug(e);else if(t instanceof Wu&&e instanceof Hu)t.plug(e);else if(t instanceof Uu&&e instanceof Lu)t.plug(e);else{if(!(t instanceof $u&&e instanceof Lu))throw Error("Input and output type is not compatible");t.plug(e)}}function ju(t,e){if(t instanceof Uu&&e instanceof Hu)t.unPlug(e);else if(t instanceof $u&&e instanceof Gu)t.unPlug(e);else if(t instanceof Wu&&e instanceof Lu)t.unPlug(e);else if(t instanceof Wu&&e instanceof Gu)t.unPlug(e);else if(t instanceof Wu&&e instanceof Hu)t.unPlug(e);else if(t instanceof Uu&&e instanceof Lu)t.unPlug(e);else{if(!(t instanceof $u&&e instanceof Lu))throw Error("Input and output type is not compatible");t.unPlug(e)}}!function(t){t.AudioInput="audioInput",t.AudioOutput="audioOutput",t.MidiInput="midiInput",t.MidiOutput="midiOutput",t.ForwardInput="forwardInput",t.ForwardOutput="forwardOutput"}(Pu||(Pu={}));class zu{id;ioType;name;plugableModule;connections=[];static unPlugAll(t){t.connections.forEach((e=>t.unPlug(e)))}constructor(t,e){this.plugableModule=t,this.id=qu(t.id,e.name),Object.assign(this,e)}plug(t,e=!0){this.connections.push(t),e&&t.plug(this,!1)}unPlug(t,e=!0){this.connections=this.connections.filter((e=>e.id!==t.id)),e&&t.unPlug(this,!1)}serialize(){return{id:this.id,name:this.name,moduleId:this.plugableModule.id,moduleName:this.plugableModule.name,ioType:this.ioType}}}class Wu extends zu{constructor(t,e){super(t,e),this.checkNameValidity()}get subInputs(){return this.plugableModule.audioModules.map((t=>{const e=t.inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subInput(t){const e=this.subModule(t).inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);Fu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>Fu(e,t))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Lu||(t instanceof Lu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);ju(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>ju(e,t))))}unPlugAll(){zu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].inputs.findByName(this.name))throw Error("You should forward to existing input")}}class Lu extends zu{constructor(t,e){super(t,e),this.checkNameValidity()}get subOutputs(){return this.subModules.map((t=>{const e=t.outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subOutput(t){const e=this.subModule(t).outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Wu||(t instanceof Wu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);Fu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>Fu(t,e))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Wu||(t instanceof Wu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);ju(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>ju(t,e))))}unPlugAll(){zu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].outputs.findByName(this.name))throw Error("You should forward to existing output")}}class Uu extends zu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){zu.unPlugAll(this)}}class Hu extends zu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e),t instanceof Wu||this.internalModule.connect(t.internalModule)}unPlug(t,e=!0){super.unPlug(t,e),t instanceof Wu||this.internalModule.disconnect(t.internalModule)}unPlugAll(){zu.unPlugAll(this)}}class $u extends zu{onMidiEvent;constructor(t,e){super(t,e),this.onMidiEvent=e.onMidiEvent}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){zu.unPlugAll(this)}}class Gu extends zu{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){zu.unPlugAll(this)}onMidiEvent=t=>{this.midiConnections.forEach((e=>{e.onMidiEvent(t)}))};get midiConnections(){return this.connections.filter((t=>t instanceof $u))}}class Xu{plugableModule;collection=[];constructor(t){this.plugableModule=t}add(t){let e;switch(t.ioType){case Pu.AudioInput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new Uu(this.plugableModule,t);break;case Pu.AudioOutput:if(this.plugableModule instanceof Ku)throw Error("PolyModule is not supported");e=new Hu(this.plugableModule,t);break;case Pu.ForwardInput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Wu(this.plugableModule,t);break;case Pu.ForwardOutput:if(this.plugableModule instanceof Qu)throw Error("MonoModule is not supported");e=new Lu(this.plugableModule,t);break;case Pu.MidiInput:e=new $u(this.plugableModule,t);break;case Pu.MidiOutput:e=new Gu(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 Zu{connect(){throw Error("This module is not connectable")}disconnect(){throw Error("This module is not connectable")}dispose(){}}var Yu,Qu=class{static moduleName;id;name;internalModule;inputs;outputs;voiceNo;updatedAt;_props={};constructor(t,e){this.internalModule=t,this.id=e.id||Ko(),delete e.id,this.inputs=new Xu(this),this.outputs=new Xu(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,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);Fu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll(),this.internalModule.dispose()}triggerAttack=(t,e)=>{throw Error("triggerAttack not implemented")};triggerRelease=(t,e)=>{throw Error("triggerRelease not implemented")};onMidiEvent=t=>{if(void 0!==t.voiceNo&&t.voiceNo!==this.voiceNo)return;const{note:e,triggeredAt:n}=t;switch(t.type){case"noteOn":{const{duration:t}=e;if(this.triggerer(this.triggerAttack,e,n),t){const r=n+(s=t,new Xi(zi(),s,i)).toSeconds();this.triggerer(this.triggerRelease,e,r)}break}case"noteOff":this.triggerer(this.triggerRelease,e,n);break;default:throw Error("This type is not a note")}var s,i};triggerer(t,e,n){t(e,n)}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:Pu.MidiInput})}registerAudioInput(t){return this.inputs.add({...t,ioType:Pu.AudioInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Pu.MidiOutput})}registerAudioOutput(t){return this.outputs.add({...t,ioType:Pu.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})}};class Ku{static moduleName;id;child;_name;audioModules;inputs;outputs;_numberOfVoices;constructor(t){this.id=t.id||Ko(),delete t.id,this.audioModules=[];const{child:e,props:n,...s}=t;this.child=e,Object.assign(this,s),this.numberOfVoices=1,this.inputs=new Xu(this),this.outputs=new Xu(this),Object.assign(this,{props:n})}get name(){return this._name}set name(t){this._name=t,this.audioModules.forEach((e=>e.name=t))}get props(){if(0===this.audioModules.length)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,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);Fu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.unPlugAll(),this.audioModules.forEach((t=>t.dispose()))}onMidiEvent=t=>{const e=t.voiceNo||0,n=this.findVoice(e);n?.onMidiEvent(t)};serialize(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");const t=this.constructor;return{...this.audioModules[0].serialize(),id:this.id,type:t.moduleName,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))}registerInput(t){return this.inputs.add({...t,ioType:Pu.ForwardInput})}registerOutput(t){return this.outputs.add({...t,ioType:Pu.ForwardOutput})}registerMidiInput(t){return this.inputs.add({...t,ioType:Pu.MidiInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:Pu.MidiOutput})}registerBasicOutputs(){this.registerOutput({name:"output"})}registerBasicInputs(){this.registerInput({name:"input"}),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?.dispose()}else{const t=this.audioModules.length,e=qu(this.id,t.toString()),n=0===t?{}:this.props,s=new this.child({id:e,name:this.name,props:{...n,voiceNo:t}});if(s instanceof Ku)throw Error("Polymodule not supported");this.audioModules.push(s)}this.adjustNumberOfModules()}}}!function(t){t.Attack="attack",t.Decay="decay",t.Sustain="sustain",t.Release="release"}(Yu||(Yu={}));const Ju=.01,tc={attack:Ju,decay:Ju,sustain:1,release:Ju};class ec extends Qu{activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s,internalModule:i}=t;super(i,{id:e,name:n,props:{...tc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get attack(){return this._props.attack}set attack(t){this.setStage(Yu.Attack,t)}get decay(){return this._props.decay}set decay(t){this.setStage(Yu.Decay,t)}get sustain(){return this._props.sustain}set sustain(t){this.setStage(Yu.Sustain,t)}get release(){return this._props.release}set release(t){this.setStage(Yu.Release,t)}setStage(t,e){const n=0===e?this.minTime(t):this.maxTime(t)*e;this._props={...this.props,[t]:e},this.internalModule[t]=n}triggerAttack=(t,e)=>{this.activeNote=t.fullName,this.triggeredAt=e,this.internalModule.triggerAttack(e,t.velocity)};triggerRelease=(t,e)=>{this.activeNote&&this.activeNote!==t.fullName||(this.internalModule.triggerRelease(e),this.activeNote=void 0)};maxTime(t){return t===Yu.Sustain?1:2}minTime(t){return t===Yu.Sustain?0:Ju}}class nc extends Ku{constructor(t){const{id:e,name:n,child:s,props:i}=t;super({id:e,name:n,child:s,props:{...tc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class sc extends ec{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Jr,props:s})}}class ic extends nc{static moduleName="Envelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:sc,props:{...tc,...s}})}}class rc extends ec{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new so,props:s})}}class oc extends nc{static moduleName="AmpEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:rc,props:s})}}const ac={amount:0};class uc extends ec{_frequency;_amount;filter;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new ao,props:{...ac,...s}})}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this.internalModule.baseFrequency=t}get amount(){return this._amount}set amount(t){this._amount=t,this.internalModule.octaves=t}}class cc extends nc{static moduleName="FreqEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:uc,props:s})}}const lc={noteName:"C3",fine:0,coarse:0,wave:"sine",range:0,volume:0};class hc extends Qu{_note;constructor(t){const{id:e,name:n,props:s}=t;super(new Nr,{id:e,name:n,props:{...lc,...s}}),this.registerBasicOutputs(),this.registerDefaultMidiInput(),this.start(Io())}get note(){return this._note}setNoteAt(t,e){this._note=this.getNote(t),this.updateFrequency(e)}set note(t){this._note=this.getNote(t),this.updateFrequency()}get noteName(){return this._props.noteName}set noteName(t){this._props={...this.props,noteName:t},this.note=new Po(this.noteName)}get fine(){return this._props.fine}set fine(t){this._props={...this.props,fine:Math.floor(t)},this.internalModule.detune.value=this.fine}get coarse(){return this._props.coarse}set coarse(t){this._props={...this.props,coarse:Math.floor(t)},this.updateFrequency()}get wave(){return this._props.wave}set wave(t){this._props={...this.props,wave:t},this.internalModule.type=this.wave}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}get range(){return this._props.range}set range(t){this._props={...this.props,range:t},this.updateFrequency()}start(t){if(!Fc.isStarted)return;"started"===this.internalModule.state?this.internalModule.restart(t):this.internalModule.start(t)}stop(t){this.internalModule.stop(t)}triggerAttack=(t,e)=>{this.setNoteAt(t,e),this.start(e)};triggerRelease=()=>{};updateFrequency(t){if(!this.note)return;const e=this.note.adjustFrequency(this.range,this.coarse);t?this.internalModule.frequency.linearRampToValueAtTime(e,t):this.internalModule.frequency.value=e}getNote(t){return t instanceof Po?t:new Po(t)}}class pc extends Ku{static moduleName="Oscillator";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:hc,props:{...lc,...s}}),this.registerBasicOutputs(),this.registerInput({name:"midi in"})}start(t){this.audioModules.forEach((e=>e.start(t)))}stop(t){this.audioModules.forEach((e=>e.stop(t)))}}const dc={cutoff:2e4,resonance:0,envelopeAmount:0,slope:-24,filterType:"lowpass"};class fc extends Qu{constructor(t){const{id:e,name:n,props:s}=t;super(new oo({type:"lowpass"}),{id:e,name:n,props:{...dc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get cutoff(){return this._props.cutoff}set cutoff(t){this._props={...this.props,cutoff:t},this.internalModule.frequency.value=t}get filterType(){return this._props.filterType}set filterType(t){this._props={...this.props,filterType:t},this.internalModule.type=t}get slope(){return this._props.slope}set slope(t){this._props={...this.props,slope:t},this.internalModule.rolloff=t}get frequency(){return this.internalModule.frequency}get resonance(){return this._props.resonance}set resonance(t){this._props={...this.props,resonance:t},this.internalModule.Q.value=t}get envelopeAmount(){return this._props.envelopeAmount}set envelopeAmount(t){this._props={...this.props,envelopeAmount:t}}}class _c extends Ku{static moduleName="Filter";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:fc,props:{...dc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class mc extends Qu{static moduleName="Master";constructor({id:t}){super(zi().destination,{id:t,name:"Master"}),this.registerBasicInputs()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll()}}class gc extends Ku{static moduleName="VoiceScheduler";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:vc,props:s}),this.registerInputs(),this.registerOutputs(),this.polyNumber=this.numberOfVoices}set polyNumber(t){super.numberOfVoices=t}get polyNumber(){return this.numberOfVoices}onMidiEvent=t=>{let e;switch(t.type){case"noteOn":e=this.findFreeVoice();break;case"noteOff":e=this.audioModules.find((e=>e.activeNote===t.note.fullName));break;default:throw Error("This type is not a note")}e&&(e.midiTriggered(t),t.voiceNo=e.voiceNo,this.midiOutput.onMidiEvent(t))};serialize(){const t=super.serialize();return{...t,props:{...t.props,polyNumber:this.polyNumber}}}findFreeVoice(){let t=this.audioModules.find((t=>!t.activeNote));return t||(t=this.audioModules.sort(((t,e)=>t&&e?t.triggeredAt-e.triggeredAt:0))[0]),t}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}class vc extends Qu{midiEvent;activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s}=t;super(new Zu,{id:e,name:n,props:s})}midiTriggered=t=>{if(void 0===this.voiceNo)throw Error("Voice without voiceNo");const{triggeredAt:e,note:n,type:s}=t;if(!n)return;const i=n.fullName;switch(s){case"noteOn":this.activeNote=i,this.triggeredAt=e,this.midiEvent=t;break;case"noteOff":this.activeNote=null,this.midiEvent=null;break;default:throw Error("This type is not a note")}}}const yc={selectedId:null};class wc extends Qu{static moduleName="MidiSelector";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Zu,{id:e,name:n,props:{...yc,...s}}),this.registerOutputs(),this.addEventListener(this.selectedId)}get selectedId(){return this._props.selectedId}set selectedId(t){this.removeEventListener(),this._props={...this.props,selectedId:t},this.addEventListener(t)}dispose(){this.removeEventListener(),super.dispose()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}addEventListener(t){if(!this.onMidiEvent||!t)return;const e=Fc.midiDeviceManager.find(t);e?.addEventListener(this.forwardMidiEvent)}forwardMidiEvent=t=>{this.midiOutput.onMidiEvent(t)};removeEventListener(){if(!this.selectedId)return;const t=Fc.midiDeviceManager.find(this.selectedId);t?.removeEventListener(this.forwardMidiEvent)}}const xc={volume:-1/0};class bc extends Qu{constructor(t){const{id:e,name:n,props:s}=t;super(new wr,{id:e,name:n,props:{...xc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}triggerAttack=(t,e)=>{const n=20*Math.log10(t.velocity);this.internalModule.volume.exponentialRampToValueAtTime(n,e)};triggerRelease=()=>{}}class Tc extends Ku{static moduleName="Volume";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:bc,props:{...xc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}}const Ac={activeNotes:[]};class kc extends Qu{static moduleName="VirtualMidi";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Zu,{id:e,name:n,props:{...Ac,...s}}),this.registerInputs(),this.registerOutputs()}get activeNotes(){return this._props.activeNotes}set activeNotes(t){this._props={...this.props,activeNotes:t}}sendMidi(t){this.midiOutput.onMidiEvent(t)}triggerAttack=(t,e)=>{this.activeNotes=[...this.activeNotes,t.fullName],Fc._triggerPropsUpdate(this.id,this.props),this.sendMidi(qo.fromNote(t,!0,e))};triggerRelease=(t,e)=>{this.activeNotes=this.activeNotes.filter((e=>e!==t.fullName)),Fc._triggerPropsUpdate(this.id,this.props),this.sendMidi(qo.fromNote(t,!1,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"})}}const Cc={wet:1};class Sc extends Qu{constructor(t){const{id:e,name:n,internalModule:s,props:i}=t;super(s,{id:e,name:n,props:{...Cc,...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 Oc={decay:1.5,preDelay:.025};class Mc extends Sc{static moduleName="Reverb";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new So,props:{...Oc,...s}})}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}}const Ec={delayTime:1,feedback:.3};class Dc extends Sc{static moduleName="Delay";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Co,props:{...Ec,...s}})}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}}const Ic={drive:.3};class Rc extends Sc{static moduleName="Distortion";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Ao,props:{...Ic,...s}})}get drive(){return this._props.drive}set drive(t){this._props={...this.props,drive:t},this.internalModule.distortion=this.drive}}const Nc={bits:16};class Bc extends Sc{static moduleName="BitCrusher";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new xo,props:{...Nc,...s}})}get bits(){return this._props.bits}set bits(t){this._props={...this.props,bits:t},this.internalModule.bits.value=this.bits}}class Pc extends Qu{static moduleName="Sequencer";midiOutput;part;constructor(t){const{id:e,name:n,props:s}=t;super(new Zu,{id:e,name:n,props:{sequences:[],steps:16,bars:1,...s}}),this.initializePart(),this.start(Io()),this.registerOutputs()}get props(){return super.props}set props(t){this.sequences||(this._props.sequences=[]),super.props={...this.props,...t},this.adjust()}get steps(){return this._props.steps}set steps(t){this._props={...this.props,steps:t}}get bars(){return this.props.bars}set bars(t){this._props={...this.props,bars:t}}get sequences(){return this._props.sequences}set sequences(t){const e=t;this._props={...this.props,sequences:e}}start(t){Fc.isStarted&&this.part.start(t)}stop(){this.part.stop()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}initializePart(){this.part=new mo(this.onPartEvent,[]),this.part.loop=!0,this.part.loopEnd=this.loopEnd}adjust(){this.part&&(this.adjustNumberOfBars(),this.adjustNumberOfSteps(),this.updateBarParts())}adjustNumberOfBars(){const t=this.sequences.length-this.bars,e=[...this.sequences];0!==t&&(t>0?e.pop():e.push([]),this.sequences=e,this.adjustNumberOfBars())}adjustNumberOfSteps(t=0){if(!this.bars)return;const e=[...this.sequences],n=[...e[t]],s=n.length-this.steps;if(0!==s){if(s>0)n.pop();else{const e=n.length;n.push({active:!1,time:`${t}:0:${e}`,notes:[]})}e[t]=n,this.sequences=e,this.adjustNumberOfSteps(t)}else{if(t===this.bars-1)return;this.adjustNumberOfSteps(t+1)}}updateBarParts(){this.part.clear(),this.sequences.forEach((t=>{t.forEach((t=>this.part.add(t.time,t)))})),this.part.loopEnd=this.loopEnd}get loopEnd(){return`${this.bars}:0:0`}onPartEvent=(t,e)=>{e.active&&qo.fromSequence(e,t).forEach((t=>{this.midiOutput.onMidiEvent(t)}))}}function Vc(t){const{id:e,type:n,name:s,props:i}=t,r=function(t){switch(t=Ho.upperFirst(Ho.camelCase(t))){case pc.moduleName:return pc;case ic.moduleName:return ic;case oc.moduleName:return oc;case cc.moduleName:return cc;case _c.moduleName:return _c;case Tc.moduleName:return Tc;case mc.moduleName:return mc;case gc.moduleName:return gc;case wc.moduleName:return wc;case kc.moduleName:return kc;case Mc.moduleName:return Mc;case Dc.moduleName:return Dc;case Rc.moduleName:return Rc;case Bc.moduleName:return Bc;case Pc.moduleName:return Pc;default:throw Error(`Unknown module type ${t}`)}}(n);return new r({id:e,name:s,props:i})}class qc{midiDeviceManager;static instance;context;propsUpdateCallbacks;_isStarted=!1;modules;routes;constructor(){this.modules={},this.routes={},this.propsUpdateCallbacks=[]}static getInstance(){return qc.instance||(qc.instance=new qc),qc.instance}initialize(t){return new Promise((e=>{if(this.context)return e({});this.context=new Ri(t.context),Wi(this.context),this.context.transport.start(),this.midiDeviceManager=new jo,setTimeout((()=>{e({})}),0)}))}addModule(t){const{id:e,name:n,type:s,props:i={}}=t,r=Vc({id:e,name:n,type:s,props:{}});return r.props=i,this.modules[r.id]=r,this.updateRoutes(),r.serialize()}removeModule(t){this.modules[t].dispose();const e=this.moduleRouteIds(t);return e.forEach((t=>delete this.routes[t])),this.updateRoutes(),delete this.modules[t],e}updateNameModule(t,e){const n=this.findById(t);return n.name=e,n.serialize()}onPropsUpdate(t){this.propsUpdateCallbacks.push(t)}_triggerPropsUpdate(t,e){this.propsUpdateCallbacks.forEach((n=>n(t,e)))}updatePropsModule(t,e){const n=this.findById(t),s=this.applyRoutesRequired(n,e);return n.props=e,s&&this.updateRoutes(),n.serialize()}addRoute(t){const e=function(t){const e=t.id||Ko();return{...t,id:e}}(t),n={...this.routes,[e.id]:e};return this.routes=n,this.updateRoutes(),e}removeRoute(t){delete this.routes[t],this.updateRoutes()}triggerVirtualMidi(t,e,n){this.findById(t).sendMidi(qo.fromNote(e,"noteOn"===n))}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 void 0!==this.context&&"started"===this.context.transport.state&&this._isStarted}start(){const t=Io();this._isStarted=!0,this.updateRoutes(),Object.values(this.modules).forEach((e=>{const n=e;n.start&&n.start(t)}))}stop(){const t=Io();Object.values(this.modules).forEach((e=>{const n=e;n.stop&&n.stop(t)})),this._isStarted=!1}get bpm(){return this.context.transport.bpm.value}set bpm(t){this.context.transport.bpm.value=t}updateRoutes(){var t;t=Object.values(this.routes),Object.values(Fc.modules).forEach((t=>{t.unPlugAll()})),t.map((t=>{const{sourceId:e,sourceIOId:n,destinationId:s,destinationIOId:i}=t,r=Fc.findById(e),o=Fc.findById(s),a=r.outputs.find(n),u=o.inputs.find(i);if(!u||!a)throw Error("IO not found");return Fu(u,a),!0})).every((t=>t))?console.log("######## Routes succesfully applied"):console.log("######## Routes partialy applied")}applyRoutesRequired(t,e){return!!e.polyNumber&&(t instanceof gc&&e.polyNumber!==t.polyNumber)}moduleRouteIds(t){const e={...this.routes};return Object.keys(e).filter((n=>{const{sourceId:s,destinationId:i}=e[n];return s===t||i===t}))}}var Fc=qc.getInstance();exports.MidiDevice=Fo,exports.MidiDeviceManager=jo,exports.Note=Po,exports.default=Fc;
33
33
  //# sourceMappingURL=main.cjs.js.map