braindrops.nicwands.com/app/public/drops/image-melody/assets/index-DOVFg_Mq.js
2026-07-21 12:01:40 -04:00

209 lines
No EOL
302 KiB
JavaScript

var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function t(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var n={},r=[],i=()=>{},a=()=>!1,o=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),s=e=>e.startsWith(`onUpdate:`),c=Object.assign,l=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},u=Object.prototype.hasOwnProperty,d=(e,t)=>u.call(e,t),f=Array.isArray,p=e=>S(e)===`[object Map]`,m=e=>S(e)===`[object Set]`,h=e=>S(e)===`[object Date]`,g=e=>typeof e==`function`,_=e=>typeof e==`string`,v=e=>typeof e==`symbol`,y=e=>typeof e==`object`&&!!e,b=e=>(y(e)||g(e))&&g(e.then)&&g(e.catch),x=Object.prototype.toString,S=e=>x.call(e),C=e=>S(e).slice(8,-1),w=e=>S(e)===`[object Object]`,T=e=>_(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,E=t(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),D=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},O=/-\w/g,k=D(e=>e.replace(O,e=>e.slice(1).toUpperCase())),ee=/\B([A-Z])/g,te=D(e=>e.replace(ee,`-$1`).toLowerCase()),ne=D(e=>e.charAt(0).toUpperCase()+e.slice(1)),re=D(e=>e?`on${ne(e)}`:``),A=(e,t)=>!Object.is(e,t),j=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ie=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},M=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ae=e=>{let t=_(e)?Number(e):NaN;return isNaN(t)?e:t},oe,se=()=>oe||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function N(e){if(f(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=_(r)?de(r):N(r);if(i)for(let e in i)t[e]=i[e]}return t}else if(_(e)||y(e))return e}var ce=/;(?![^(]*\))/g,le=/:([^]+)/,ue=/\/\*[^]*?\*\//g;function de(e){let t={};return e.replace(ue,``).split(ce).forEach(e=>{if(e){let n=e.split(le);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function fe(e){let t=``;if(_(e))t=e;else if(f(e))for(let n=0;n<e.length;n++){let r=fe(e[n]);r&&(t+=r+` `)}else if(y(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var pe=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,me=t(pe);pe+``;function he(e){return!!e||e===``}function ge(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=_e(e[r],t[r]);return n}function _e(e,t){if(e===t)return!0;let n=h(e),r=h(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=v(e),r=v(t),n||r)return e===t;if(n=f(e),r=f(t),n||r)return n&&r?ge(e,t):!1;if(n=y(e),r=y(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e){let r=e.hasOwnProperty(n),i=t.hasOwnProperty(n);if(r&&!i||!r&&i||!_e(e[n],t[n]))return!1}}return String(e)===String(t)}var P,ve=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&P&&(P.active?(this.parent=P,this.index=(P.scopes||=[]).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){let t=P;try{return P=this,e()}finally{P=t}}}on(){++this._on===1&&(this.prevScope=P,P=this)}off(){if(this._on>0&&--this._on===0){if(P===this)P=this.prevScope;else{let e=P;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function ye(){return P}function be(e,t=!1){P&&P.cleanups.push(e)}var F,xe=new WeakSet,Se=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,P&&(P.active?P.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,xe.has(this)&&(xe.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ee(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,ze(this),ke(this);let e=F,t=Fe;F=this,Fe=!0;try{return this.fn()}finally{Ae(this),F=e,Fe=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ne(e);this.deps=this.depsTail=void 0,ze(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?xe.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){je(this)&&this.run()}get dirty(){return je(this)}},Ce=0,we,Te;function Ee(e,t=!1){if(e.flags|=8,t){e.next=Te,Te=e;return}e.next=we,we=e}function De(){Ce++}function Oe(){if(--Ce>0)return;if(Te){let e=Te;for(Te=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;we;){let t=we;for(we=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function ke(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ae(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Ne(r),Pe(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function je(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Me(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Me(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Be)||(e.globalVersion=Be,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!je(e))))return;e.flags|=2;let t=e.dep,n=F,r=Fe;F=e,Fe=!0;try{ke(e);let n=e.fn(e._value);(t.version===0||A(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{F=n,Fe=r,Ae(e),e.flags&=-3}}function Ne(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Ne(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Pe(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Fe=!0,Ie=[];function Le(){Ie.push(Fe),Fe=!1}function Re(){let e=Ie.pop();Fe=e===void 0||e}function ze(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=F;F=void 0;try{t()}finally{F=e}}}var Be=0,Ve=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},He=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!F||!Fe||F===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==F)t=this.activeLink=new Ve(F,this),F.deps?(t.prevDep=F.depsTail,F.depsTail.nextDep=t,F.depsTail=t):F.deps=F.depsTail=t,Ue(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=F.depsTail,t.nextDep=void 0,F.depsTail.nextDep=t,F.depsTail=t,F.deps===t&&(F.deps=e)}return t}trigger(e){this.version++,Be++,this.notify(e)}notify(e){De();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Oe()}}};function Ue(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)Ue(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var We=new WeakMap,Ge=Symbol(``),Ke=Symbol(``),qe=Symbol(``);function Je(e,t,n){if(Fe&&F){let t=We.get(e);t||We.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new He),r.map=t,r.key=n),r.track()}}function Ye(e,t,n,r,i,a){let o=We.get(e);if(!o){Be++;return}let s=e=>{e&&e.trigger()};if(De(),t===`clear`)o.forEach(s);else{let i=f(e),a=i&&T(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===qe||!v(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(qe)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(Ge)),p(e)&&s(o.get(Ke)));break;case`delete`:i||(s(o.get(Ge)),p(e)&&s(o.get(Ke)));break;case`set`:p(e)&&s(o.get(Ge));break}}Oe()}function Xe(e){let t=I(e);return t===e?t:(Je(t,`iterate`,qe),Ft(e)?t:t.map(Rt))}function Ze(e){return Je(e=I(e),`iterate`,qe),e}function Qe(e,t){return Pt(e)?zt(Nt(e)?Rt(t):t):Rt(t)}var $e={__proto__:null,[Symbol.iterator](){return et(this,Symbol.iterator,e=>Qe(this,e))},concat(...e){return Xe(this).concat(...e.map(e=>f(e)?Xe(e):e))},entries(){return et(this,`entries`,e=>(e[1]=Qe(this,e[1]),e))},every(e,t){return nt(this,`every`,e,t,void 0,arguments)},filter(e,t){return nt(this,`filter`,e,t,e=>e.map(e=>Qe(this,e)),arguments)},find(e,t){return nt(this,`find`,e,t,e=>Qe(this,e),arguments)},findIndex(e,t){return nt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return nt(this,`findLast`,e,t,e=>Qe(this,e),arguments)},findLastIndex(e,t){return nt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return nt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return it(this,`includes`,e)},indexOf(...e){return it(this,`indexOf`,e)},join(e){return Xe(this).join(e)},lastIndexOf(...e){return it(this,`lastIndexOf`,e)},map(e,t){return nt(this,`map`,e,t,void 0,arguments)},pop(){return at(this,`pop`)},push(...e){return at(this,`push`,e)},reduce(e,...t){return rt(this,`reduce`,e,t)},reduceRight(e,...t){return rt(this,`reduceRight`,e,t)},shift(){return at(this,`shift`)},some(e,t){return nt(this,`some`,e,t,void 0,arguments)},splice(...e){return at(this,`splice`,e)},toReversed(){return Xe(this).toReversed()},toSorted(e){return Xe(this).toSorted(e)},toSpliced(...e){return Xe(this).toSpliced(...e)},unshift(...e){return at(this,`unshift`,e)},values(){return et(this,`values`,e=>Qe(this,e))}};function et(e,t,n){let r=Ze(e),i=r[t]();return r!==e&&!Ft(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var tt=Array.prototype;function nt(e,t,n,r,i,a){let o=Ze(e),s=o!==e&&!Ft(e),c=o[t];if(c!==tt[t]){let t=c.apply(e,a);return s?Rt(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,Qe(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function rt(e,t,n,r){let i=Ze(e),a=i!==e&&!Ft(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=Qe(e,t)),n.call(this,t,Qe(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?Qe(e,c):c}function it(e,t,n){let r=I(e);Je(r,`iterate`,qe);let i=r[t](...n);return(i===-1||i===!1)&&It(n[0])?(n[0]=I(n[0]),r[t](...n)):i}function at(e,t,n=[]){Le(),De();let r=I(e)[t].apply(e,n);return Oe(),Re(),r}var ot=t(`__proto__,__v_isRef,__isVue`),st=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(v));function ct(e){v(e)||(e=String(e));let t=I(this);return Je(t,`has`,e),t.hasOwnProperty(e)}var lt=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Dt:Et:i?Tt:wt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=f(e);if(!r){let e;if(a&&(e=$e[t]))return e;if(t===`hasOwnProperty`)return ct}let o=Reflect.get(e,t,Bt(e)?e:n);if((v(t)?st.has(t):ot(t))||(r||Je(e,`get`,t),i))return o;if(Bt(o)){let e=a&&T(t)?o:o.value;return r&&y(e)?jt(e):e}return y(o)?r?jt(o):kt(o):o}},ut=class extends lt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=f(e)&&T(t);if(!this._isShallow){let e=Pt(i);if(!Ft(n)&&!Pt(n)&&(i=I(i),n=I(n)),!a&&Bt(i)&&!Bt(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:d(e,t),s=Reflect.set(e,t,n,Bt(e)?e:r);return e===I(r)&&s&&(o?A(n,i)&&Ye(e,`set`,t,n,i):Ye(e,`add`,t,n)),s}deleteProperty(e,t){let n=d(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&Ye(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!v(t)||!st.has(t))&&Je(e,`has`,t),n}ownKeys(e){return Je(e,`iterate`,f(e)?`length`:Ge),Reflect.ownKeys(e)}},dt=class extends lt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},ft=new ut,pt=new dt,mt=new ut(!0),ht=e=>e,gt=e=>Reflect.getPrototypeOf(e);function _t(e,t,n){return function(...r){let i=this.__v_raw,a=I(i),o=p(a),s=e===`entries`||e===Symbol.iterator&&o,l=e===`keys`&&o,u=i[e](...r),d=n?ht:t?zt:Rt;return!t&&Je(a,`iterate`,l?Ke:Ge),c(Object.create(u),{next(){let{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:s?[d(e[0]),d(e[1])]:d(e),done:t}}})}}function vt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function yt(e,t){let n={get(n){let r=this.__v_raw,i=I(r),a=I(n);e||(A(n,a)&&Je(i,`get`,n),Je(i,`get`,a));let{has:o}=gt(i),s=t?ht:e?zt:Rt;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&Je(I(t),`iterate`,Ge),t.size},has(t){let n=this.__v_raw,r=I(n),i=I(t);return e||(A(t,i)&&Je(r,`has`,t),Je(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=I(a),s=t?ht:e?zt:Rt;return!e&&Je(o,`iterate`,Ge),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return c(n,e?{add:vt(`add`),set:vt(`set`),delete:vt(`delete`),clear:vt(`clear`)}:{add(e){let n=I(this),r=gt(n),i=I(e),a=!t&&!Ft(e)&&!Pt(e)?i:e;return r.has.call(n,a)||A(e,a)&&r.has.call(n,e)||A(i,a)&&r.has.call(n,i)||(n.add(a),Ye(n,`add`,a,a)),this},set(e,n){!t&&!Ft(n)&&!Pt(n)&&(n=I(n));let r=I(this),{has:i,get:a}=gt(r),o=i.call(r,e);o||=(e=I(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?A(n,s)&&Ye(r,`set`,e,n,s):Ye(r,`add`,e,n),this},delete(e){let t=I(this),{has:n,get:r}=gt(t),i=n.call(t,e);i||=(e=I(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&Ye(t,`delete`,e,void 0,a),o},clear(){let e=I(this),t=e.size!==0,n=e.clear();return t&&Ye(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=_t(r,e,t)}),n}function bt(e,t){let n=yt(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(d(n,r)&&r in t?n:t,r,i)}var xt={get:bt(!1,!1)},St={get:bt(!1,!0)},Ct={get:bt(!0,!1)},wt=new WeakMap,Tt=new WeakMap,Et=new WeakMap,Dt=new WeakMap;function Ot(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function kt(e){return Pt(e)?e:Mt(e,!1,ft,xt,wt)}function At(e){return Mt(e,!1,mt,St,Tt)}function jt(e){return Mt(e,!0,pt,Ct,Et)}function Mt(e,t,n,r,i){if(!y(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=Ot(C(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Nt(e){return Pt(e)?Nt(e.__v_raw):!!(e&&e.__v_isReactive)}function Pt(e){return!!(e&&e.__v_isReadonly)}function Ft(e){return!!(e&&e.__v_isShallow)}function It(e){return e?!!e.__v_raw:!1}function I(e){let t=e&&e.__v_raw;return t?I(t):e}function Lt(e){return!d(e,`__v_skip`)&&Object.isExtensible(e)&&ie(e,`__v_skip`,!0),e}var Rt=e=>y(e)?kt(e):e,zt=e=>y(e)?jt(e):e;function Bt(e){return e?e.__v_isRef===!0:!1}function Vt(e){return Ut(e,!1)}function Ht(e){return Ut(e,!0)}function Ut(e,t){return Bt(e)?e:new Wt(e,t)}var Wt=class{constructor(e,t){this.dep=new He,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:I(e),this._value=t?e:Rt(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Ft(e)||Pt(e);e=n?e:I(e),A(e,t)&&(this._rawValue=e,this._value=n?e:Rt(e),this.dep.trigger())}};function Gt(e){return Bt(e)?e.value:e}function Kt(e){return g(e)?e():Gt(e)}var qt={get:(e,t,n)=>t===`__v_raw`?e:Gt(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return Bt(i)&&!Bt(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function Jt(e){return Nt(e)?e:new Proxy(e,qt)}var Yt=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new He(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Be-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&F!==this)return Ee(this,!0),!0}get value(){let e=this.dep.track();return Me(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function Xt(e,t,n=!1){let r,i;return g(e)?r=e:(r=e.get,i=e.set),new Yt(r,i,n)}var Zt={},Qt=new WeakMap,$t=void 0;function en(e,t=!1,n=$t){if(n){let t=Qt.get(n);t||Qt.set(n,t=[]),t.push(e)}}function tn(e,t,r=n){let{immediate:a,deep:o,once:s,scheduler:c,augmentJob:u,call:d}=r,p=e=>o?e:Ft(e)||o===!1||o===0?nn(e,1):nn(e),m,h,_,v,y=!1,b=!1;if(Bt(e)?(h=()=>e.value,y=Ft(e)):Nt(e)?(h=()=>p(e),y=!0):f(e)?(b=!0,y=e.some(e=>Nt(e)||Ft(e)),h=()=>e.map(e=>{if(Bt(e))return e.value;if(Nt(e))return p(e);if(g(e))return d?d(e,2):e()})):h=g(e)?t?d?()=>d(e,2):e:()=>{if(_){Le();try{_()}finally{Re()}}let t=$t;$t=m;try{return d?d(e,3,[v]):e(v)}finally{$t=t}}:i,t&&o){let e=h,t=o===!0?1/0:o;h=()=>nn(e(),t)}let x=ye(),S=()=>{m.stop(),x&&x.active&&l(x.effects,m)};if(s&&t){let e=t;t=(...t)=>{let n=e(...t);return S(),n}}let C=b?Array(e.length).fill(Zt):Zt,w=e=>{if(!(!(m.flags&1)||!m.dirty&&!e))if(t){let n=m.run();if(e||o||y||(b?n.some((e,t)=>A(e,C[t])):A(n,C))){_&&_();let e=$t;$t=m;try{let e=[n,C===Zt?void 0:b&&C[0]===Zt?[]:C,v];C=n,d?d(t,3,e):t(...e)}finally{$t=e}}}else m.run()};return u&&u(w),m=new Se(h),m.scheduler=c?()=>c(w,!1):w,v=e=>en(e,!1,m),_=m.onStop=()=>{let e=Qt.get(m);if(e){if(d)d(e,4);else for(let t of e)t();Qt.delete(m)}},t?a?w(!0):C=m.run():c?c(w.bind(null,!0),!0):m.run(),S.pause=m.pause.bind(m),S.resume=m.resume.bind(m),S.stop=S,S}function nn(e,t=1/0,n){if(t<=0||!y(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Bt(e))nn(e.value,t,n);else if(f(e))for(let r=0;r<e.length;r++)nn(e[r],t,n);else if(m(e)||p(e))e.forEach(e=>{nn(e,t,n)});else if(w(e)){for(let r in e)nn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&nn(e[r],t,n)}return e}function rn(e,t,n,r){try{return r?e(...r):e()}catch(e){on(e,t,n)}}function an(e,t,n,r){if(g(e)){let i=rn(e,t,n,r);return i&&b(i)&&i.catch(e=>{on(e,t,n)}),i}if(f(e)){let i=[];for(let a=0;a<e.length;a++)i.push(an(e[a],t,n,r));return i}}function on(e,t,r,i=!0){let a=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||n;if(t){let n=t.parent,i=t.proxy,a=`https://vuejs.org/error-reference/#runtime-${r}`;for(;n;){let t=n.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,a)===!1)return}n=n.parent}if(o){Le(),rn(o,null,10,[e,i,a]),Re();return}}sn(e,r,a,i,s)}function sn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var cn=[],ln=-1,un=[],dn=null,fn=0,pn=Promise.resolve(),mn=null;function hn(e){let t=mn||pn;return e?t.then(this?e.bind(this):e):t}function gn(e){let t=ln+1,n=cn.length;for(;t<n;){let r=t+n>>>1,i=cn[r],a=Sn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function _n(e){if(!(e.flags&1)){let t=Sn(e),n=cn[cn.length-1];!n||!(e.flags&2)&&t>=Sn(n)?cn.push(e):cn.splice(gn(t),0,e),e.flags|=1,vn()}}function vn(){mn||=pn.then(Cn)}function yn(e){f(e)?un.push(...e):dn&&e.id===-1?dn.splice(fn+1,0,e):e.flags&1||(un.push(e),e.flags|=1),vn()}function bn(e,t,n=ln+1){for(;n<cn.length;n++){let t=cn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;cn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function xn(e){if(un.length){let e=[...new Set(un)].sort((e,t)=>Sn(e)-Sn(t));if(un.length=0,dn){dn.push(...e);return}for(dn=e,fn=0;fn<dn.length;fn++){let e=dn[fn];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}dn=null,fn=0}}var Sn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Cn(e){try{for(ln=0;ln<cn.length;ln++){let e=cn[ln];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),rn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;ln<cn.length;ln++){let e=cn[ln];e&&(e.flags&=-2)}ln=-1,cn.length=0,xn(e),mn=null,(cn.length||un.length)&&Cn(e)}}var wn=null,Tn=null;function En(e){let t=wn;return wn=e,Tn=e&&e.type.__scopeId||null,t}function Dn(e,t=wn,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&ea(-1);let i=En(t),a=Yi.length,o;try{o=e(...n)}finally{for(let e=Yi.length;e>a;e--)Qi();En(i),r._d&&ea(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function On(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(Le(),an(c,n,8,[e.el,s,e,t]),Re())}}function kn(e,t){if(Sa){let n=Sa.provides,r=Sa.parent&&Sa.parent.provides;r===n&&(n=Sa.provides=Object.create(r)),n[e]=t}}function An(e,t,n=!1){let r=Ca();if(r||ti){let i=ti?ti._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&g(t)?t.call(r&&r.proxy):t}}var jn=Symbol.for(`v-scx`),Mn=()=>An(jn);function Nn(e,t){return Fn(e,null,t)}function Pn(e,t,n){return Fn(e,t,n)}function Fn(e,t,r=n){let{immediate:a,deep:o,flush:s,once:l}=r,u=c({},r),d=t&&a||!t&&s!==`post`,f;if(ka){if(s===`sync`){let e=Mn();f=e.__watcherHandles||=[]}else if(!d){let e=()=>{};return e.stop=i,e.resume=i,e.pause=i,e}}let p=Sa;u.call=(e,t,n)=>an(e,p,t,n);let m=!1;s===`post`?u.scheduler=e=>{Mi(e,p&&p.suspense)}:s!==`sync`&&(m=!0,u.scheduler=(e,t)=>{t?e():_n(e)}),u.augmentJob=e=>{t&&(e.flags|=4),m&&(e.flags|=2,p&&(e.id=p.uid,e.i=p))};let h=tn(e,t,u);return ka&&(f?f.push(h):d&&h()),h}function In(e,t,n){let r=this.proxy,i=_(e)?e.includes(`.`)?Ln(r,e):()=>r[e]:e.bind(r,r),a;g(t)?a=t:(a=t.handler,n=t);let o=Ea(this),s=Fn(i,a.bind(r),n);return o(),s}function Ln(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var Rn=Symbol(`_vte`),zn=e=>e.__isTeleport,Bn=Symbol(`_leaveCb`),Vn=Symbol(`_enterCb`);function Hn(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return hr(()=>{e.isMounted=!0}),vr(()=>{e.isUnmounting=!0}),e}var Un=[Function,Array],Wn={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Un,onEnter:Un,onAfterEnter:Un,onEnterCancelled:Un,onBeforeLeave:Un,onLeave:Un,onAfterLeave:Un,onLeaveCancelled:Un,onBeforeAppear:Un,onAppear:Un,onAfterAppear:Un,onAppearCancelled:Un},Gn=e=>{let t=e.subTree;return t.component?Gn(t.component):t},Kn={name:`BaseTransition`,props:Wn,setup(e,{slots:t}){let n=Ca(),r=Hn();return()=>{let i=t.default&&er(t.default(),!0),a=i&&i.length?qn(i):n.subTree?pa():void 0;if(!a)return;let o=I(e),{mode:s}=o;if(r.isLeaving)return Zn(a);let c=Qn(a);if(!c)return Zn(a);let l=Xn(c,o,r,n,e=>l=e);c.type!==qi&&$n(c,l);let u=n.subTree&&Qn(n.subTree);if(u&&u.type!==qi&&!aa(u,c)&&Gn(n).type!==qi){let e=Xn(u,o,r,n);if($n(u,e),s===`out-in`&&c.type!==qi)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,u=void 0},Zn(a);s===`in-out`&&c.type!==qi?e.delayLeave=(e,t,n)=>{let i=Yn(r,u);i[String(u.key)]=u,e[Bn]=()=>{t(),e[Bn]=void 0,delete l.delayedLeave,u=void 0},l.delayedLeave=()=>{n(),delete l.delayedLeave,u=void 0}}:u=void 0}else u&&=void 0;return a}}};function qn(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==qi){t=n;break}}return t}var Jn=Kn;function Yn(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Xn(e,t,n,r,i){let{appear:a,mode:o,persisted:s=!1,onBeforeEnter:c,onEnter:l,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:p,onLeave:m,onAfterLeave:h,onLeaveCancelled:g,onBeforeAppear:_,onAppear:v,onAfterAppear:y,onAppearCancelled:b}=t,x=String(e.key),S=Yn(n,e),C=(e,t)=>{e&&an(e,r,9,t)},w=(e,t)=>{let n=t[1];C(e,t),f(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},T={mode:o,persisted:s,beforeEnter(t){let r=c;if(!n.isMounted)if(a)r=_||c;else return;t[Bn]&&t[Bn](!0);let i=S[x];i&&aa(e,i)&&i.el[Bn]&&i.el[Bn](),C(r,[t])},enter(t){if(S[x]===e)return;let r=l,i=u,o=d;if(!n.isMounted)if(a)r=v||l,i=y||u,o=b||d;else return;let s=!1;t[Vn]=e=>{s||(s=!0,C(e?o:i,[t]),T.delayedLeave&&T.delayedLeave(),t[Vn]=void 0)};let c=t[Vn].bind(null,!1);r?w(r,[t,c]):c()},leave(t,r){let i=String(e.key);if(t[Vn]&&t[Vn](!0),n.isUnmounting)return r();C(p,[t]);let a=!1;t[Bn]=n=>{a||(a=!0,r(),C(n?g:h,[t]),t[Bn]=void 0,S[i]===e&&delete S[i])};let o=t[Bn].bind(null,!1);S[i]=e,m?w(m,[t,o]):o()},clone(e){let a=Xn(e,t,n,r,i);return i&&i(a),a}};return T}function Zn(e){if(sr(e))return e=da(e),e.children=null,e}function Qn(e){if(!sr(e))return zn(e.type)&&e.children?qn(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&g(n.default))return n.default()}}function $n(e,t){e.shapeFlag&6&&e.component?(e.transition=t,$n(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function er(e,t=!1,n){let r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a],s=n==null?o.key:String(n)+String(o.key==null?a:o.key);o.type===Gi?(o.patchFlag&128&&i++,r=r.concat(er(o.children,t,s))):(t||o.type!==qi)&&r.push(s==null?o:da(o,{key:s}))}if(i>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function tr(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function nr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var rr=new WeakMap;function ir(e,t,r,i,o=!1){if(f(e)){e.forEach((e,n)=>ir(e,t&&(f(t)?t[n]:t),r,i,o));return}if(or(i)&&!o){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&ir(e,t,r,i.component.subTree);return}let s=i.shapeFlag&4?Ra(i.component):i.el,c=o?null:s,{i:u,r:p}=e,m=t&&t.r,h=u.refs===n?u.refs={}:u.refs,v=u.setupState,y=I(v),b=v===n?a:e=>!nr(h,e)&&d(y,e),x=(e,t)=>!(t&&nr(h,t));if(m!=null&&m!==p){if(ar(t),_(m))h[m]=null,b(m)&&(v[m]=null);else if(Bt(m)){let e=t;x(m,e.k)&&(m.value=null),e.k&&(h[e.k]=null)}}if(g(p))rn(p,u,12,[c,h]);else{let t=_(p),n=Bt(p);if(t||n){let i=()=>{if(e.f){let n=t?b(p)?v[p]:h[p]:x(p)||!e.k?p.value:h[e.k];if(o)f(n)&&l(n,s);else if(f(n))n.includes(s)||n.push(s);else if(t)h[p]=[s],b(p)&&(v[p]=h[p]);else{let t=[s];x(p,e.k)&&(p.value=t),e.k&&(h[e.k]=t)}}else t?(h[p]=c,b(p)&&(v[p]=c)):n&&(x(p,e.k)&&(p.value=c),e.k&&(h[e.k]=c))};if(c){let t=()=>{i(),rr.delete(e)};t.id=-1,rr.set(e,t),Mi(t,r)}else ar(e),i()}}}function ar(e){let t=rr.get(e);t&&(t.flags|=8,rr.delete(e))}se().requestIdleCallback,se().cancelIdleCallback;var or=e=>!!e.type.__asyncLoader,sr=e=>e.type.__isKeepAlive;function cr(e,t){ur(e,`a`,t)}function lr(e,t){ur(e,`da`,t)}function ur(e,t,n=Sa){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(fr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)sr(e.parent.vnode)&&dr(r,t,n,e),e=e.parent}}function dr(e,t,n,r){let i=fr(t,e,r,!0);yr(()=>{l(r[t],i)},n)}function fr(e,t,n=Sa,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{Le();let i=Ea(n),a=an(t,n,e,r);return i(),Re(),a};return r?i.unshift(a):i.push(a),a}}var pr=e=>(t,n=Sa)=>{(!ka||e===`sp`)&&fr(e,(...e)=>t(...e),n)},mr=pr(`bm`),hr=pr(`m`),gr=pr(`bu`),_r=pr(`u`),vr=pr(`bum`),yr=pr(`um`),br=pr(`sp`),xr=pr(`rtg`),Sr=pr(`rtc`);function Cr(e,t=Sa){fr(`ec`,e,t)}var wr=`components`;function Tr(e,t){return Or(wr,e,!0,t)||e}var Er=Symbol.for(`v-ndc`);function Dr(e){return _(e)?Or(wr,e,!1)||e:e||Er}function Or(e,t,n=!0,r=!1){let i=wn||Sa;if(i){let n=i.type;if(e===wr){let e=za(n,!1);if(e&&(e===t||e===k(t)||e===ne(k(t))))return n}let a=kr(i[e]||n[e],t)||kr(i.appContext[e],t);return!a&&r?n:a}}function kr(e,t){return e&&(e[t]||e[k(t)]||e[ne(k(t))])}function Ar(e,t,n={},r,i,a){if(wn.ce||wn.parent&&or(wn.parent)&&wn.parent.ce){let e=a!=null&&n.key==null?c({},n,{key:a}):n,i=Object.keys(e).length>0;return t!=="default"&&(e.name=t),Zi(),ra(Gi,null,[L(`slot`,e,r&&r())],i?-2:64)}let o=e[t];o&&o._c&&(o._d=!1);let s=Yi.length;Zi();let l;try{let i=o&&jr(o(n)),s=n.key||a||i&&i.key;l=ra(Gi,{key:(s&&!v(s)?s:`_${t}`)+(!i&&r?`_fb`:``)},i||(r?r():[]),i&&e._===1?64:-2)}catch(e){for(let e=Yi.length;e>s;e--)Qi();throw e}finally{o&&o._c&&(o._d=!0)}return!i&&l.scopeId&&(l.slotScopeIds=[l.scopeId+`-s`]),l}function jr(e){return e.some(e=>!ia(e)||!(e.type===qi||e.type===Gi&&!jr(e.children)))?e:null}var Mr=e=>e?Oa(e)?Ra(e):Mr(e.parent):null,Nr=c(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Mr(e.parent),$root:e=>Mr(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Hr(e),$forceUpdate:e=>e.f||=()=>{_n(e.update)},$nextTick:e=>e.n||=hn.bind(e.proxy),$watch:e=>In.bind(e)}),Pr=(e,t)=>e!==n&&!e.__isScriptSetup&&d(e,t),Fr={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:r,setupState:i,data:a,props:o,accessCache:s,type:c,appContext:l}=e;if(t[0]!==`$`){let e=s[t];if(e!==void 0)switch(e){case 1:return i[t];case 2:return a[t];case 4:return r[t];case 3:return o[t]}else if(Pr(i,t))return s[t]=1,i[t];else if(a!==n&&d(a,t))return s[t]=2,a[t];else if(d(o,t))return s[t]=3,o[t];else if(r!==n&&d(r,t))return s[t]=4,r[t];else Lr&&(s[t]=0)}let u=Nr[t],f,p;if(u)return t===`$attrs`&&Je(e.attrs,`get`,``),u(e);if((f=c.__cssModules)&&(f=f[t]))return f;if(r!==n&&d(r,t))return s[t]=4,r[t];if(p=l.config.globalProperties,d(p,t))return p[t]},set({_:e},t,r){let{data:i,setupState:a,ctx:o}=e;return Pr(a,t)?(a[t]=r,!0):i!==n&&d(i,t)?(i[t]=r,!0):d(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(o[t]=r,!0)},has({_:{data:e,setupState:t,accessCache:r,ctx:i,appContext:a,props:o,type:s}},c){let l;return!!(r[c]||e!==n&&c[0]!==`$`&&d(e,c)||Pr(t,c)||d(o,c)||d(i,c)||d(Nr,c)||d(a.config.globalProperties,c)||(l=s.__cssModules)&&l[c])},defineProperty(e,t,n){return n.get==null?d(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function Ir(e){return f(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var Lr=!0;function Rr(e){let t=Hr(e),n=e.proxy,r=e.ctx;Lr=!1,t.beforeCreate&&Br(t.beforeCreate,e,`bc`);let{data:a,computed:o,methods:s,watch:c,provide:l,inject:u,created:d,beforeMount:p,mounted:m,beforeUpdate:h,updated:_,activated:v,deactivated:b,beforeDestroy:x,beforeUnmount:S,destroyed:C,unmounted:w,render:T,renderTracked:E,renderTriggered:D,errorCaptured:O,serverPrefetch:k,expose:ee,inheritAttrs:te,components:ne,directives:re,filters:A}=t;if(u&&zr(u,r,null),s)for(let e in s){let t=s[e];g(t)&&(r[e]=t.bind(n))}if(a){let t=a.call(n,n);y(t)&&(e.data=kt(t))}if(Lr=!0,o)for(let e in o){let t=o[e],a=Va({get:g(t)?t.bind(n,n):g(t.get)?t.get.bind(n,n):i,set:!g(t)&&g(t.set)?t.set.bind(n):i});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e})}if(c)for(let e in c)Vr(c[e],r,n,e);if(l){let e=g(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{kn(t,e[t])})}d&&Br(d,e,`c`);function j(e,t){f(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(j(mr,p),j(hr,m),j(gr,h),j(_r,_),j(cr,v),j(lr,b),j(Cr,O),j(Sr,E),j(xr,D),j(vr,S),j(yr,w),j(br,k),f(ee))if(ee.length){let t=e.exposed||={};ee.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={};T&&e.render===i&&(e.render=T),te!=null&&(e.inheritAttrs=te),ne&&(e.components=ne),re&&(e.directives=re),k&&tr(e)}function zr(e,t,n=i){f(e)&&(e=qr(e));for(let n in e){let r=e[n],i;i=y(r)?`default`in r?An(r.from||n,r.default,!0):An(r.from||n):An(r),Bt(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Br(e,t,n){an(f(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Vr(e,t,n,r){let i=r.includes(`.`)?Ln(n,r):()=>n[r];if(_(e)){let n=t[e];g(n)&&Pn(i,n)}else if(g(e))Pn(i,e.bind(n));else if(y(e))if(f(e))e.forEach(e=>Vr(e,t,n,r));else{let r=g(e.handler)?e.handler.bind(n):t[e.handler];g(r)&&Pn(i,r,e)}}function Hr(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>Ur(c,e,o,!0)),Ur(c,t,o)),y(t)&&a.set(t,c),c}function Ur(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&Ur(e,a,n,!0),i&&i.forEach(t=>Ur(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Wr[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var Wr={data:Gr,props:Xr,emits:Xr,methods:Yr,computed:Yr,beforeCreate:Jr,created:Jr,beforeMount:Jr,mounted:Jr,beforeUpdate:Jr,updated:Jr,beforeDestroy:Jr,beforeUnmount:Jr,destroyed:Jr,unmounted:Jr,activated:Jr,deactivated:Jr,errorCaptured:Jr,serverPrefetch:Jr,components:Yr,directives:Yr,watch:Zr,provide:Gr,inject:Kr};function Gr(e,t){return t?e?function(){return c(g(e)?e.call(this,this):e,g(t)?t.call(this,this):t)}:t:e}function Kr(e,t){return Yr(qr(e),qr(t))}function qr(e){if(f(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Jr(e,t){return e?[...new Set([].concat(e,t))]:t}function Yr(e,t){return e?c(Object.create(null),e,t):t}function Xr(e,t){return e?f(e)&&f(t)?[...new Set([...e,...t])]:c(Object.create(null),Ir(e),Ir(t??{})):t}function Zr(e,t){if(!e)return t;if(!t)return e;let n=c(Object.create(null),e);for(let r in t)n[r]=Jr(e[r],t[r]);return n}function Qr(){return{app:null,config:{isNativeTag:a,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var $r=0;function ei(e,t){return function(n,r=null){g(n)||(n=c({},n)),r!=null&&!y(r)&&(r=null);let i=Qr(),a=new WeakSet,o=[],s=!1,l=i.app={_uid:$r++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:Ua,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&g(e.install)?(a.add(e),e.install(l,...t)):g(e)&&(a.add(e),e(l,...t))),l},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),l},component(e,t){return t?(i.components[e]=t,l):i.components[e]},directive(e,t){return t?(i.directives[e]=t,l):i.directives[e]},mount(a,o,c){if(!s){let u=l._ceVNode||L(n,r);return u.appContext=i,c===!0?c=`svg`:c===!1&&(c=void 0),o&&t?t(u,a):e(u,a,c),s=!0,l._container=a,a.__vue_app__=l,Ra(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(an(o,l._instance,16),e(null,l._container),delete l._container.__vue_app__)},provide(e,t){return i.provides[e]=t,l},runWithContext(e){let t=ti;ti=l;try{return e()}finally{ti=t}}};return l}}var ti=null,ni=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${k(t)}Modifiers`]||e[`${te(t)}Modifiers`];function ri(e,t,...r){if(e.isUnmounted)return;let i=e.vnode.props||n,a=r,o=t.startsWith(`update:`),s=o&&ni(i,t.slice(7));s&&(s.trim&&(a=r.map(e=>_(e)?e.trim():e)),s.number&&(a=r.map(M)));let c,l=i[c=re(t)]||i[c=re(k(t))];!l&&o&&(l=i[c=re(te(t))]),l&&an(l,e,6,a);let u=i[c+`Once`];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[c])return;e.emitted[c]=!0,an(u,e,6,a)}}var ii=new WeakMap;function ai(e,t,n=!1){let r=n?ii:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!g(e)){let r=e=>{let n=ai(e,t,!0);n&&(s=!0,c(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(y(e)&&r.set(e,null),null):(f(a)?a.forEach(e=>o[e]=null):c(o,a),y(e)&&r.set(e,o),o)}function oi(e,t){return!e||!o(t)?!1:(t=t.slice(2),t=t===`Once`?t:t.replace(/Once$/,``),d(e,t[0].toLowerCase()+t.slice(1))||d(e,te(t))||d(e,t))}function si(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:c,emit:l,render:u,renderCache:d,props:f,data:p,setupState:m,ctx:h,inheritAttrs:g}=e,_=En(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=ma(u.call(t,e,d,f,m,p,h)),y=c}else{let e=t;v=ma(e.length>1?e(f,{attrs:c,slots:o,emit:l}):e(f,null)),y=t.props?c:ci(c)}}catch(t){Yi.length=0,on(t,e,1),v=L(qi)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(s)&&(y=li(y,a)),b=da(b,y,!1,!0))}return n.dirs&&(b=da(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&$n(b,n.transition),v=b,En(_),v}var ci=e=>{let t;for(let n in e)(n===`class`||n===`style`||o(n))&&((t||={})[n]=e[n]);return t},li=(e,t)=>{let n={};for(let r in e)(!s(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function ui(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?di(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(fi(o,r,n)&&!oi(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||di(r,o,l):!!o;return!1}function di(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(fi(t,e,a)&&!oi(n,a))return!0}return!1}function fi(e,t,n){let r=e[n],i=t[n];return n===`style`&&y(r)&&y(i)?!_e(r,i):r!==i}function pi({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var mi={},hi=()=>Object.create(mi),gi=e=>Object.getPrototypeOf(e)===mi;function _i(e,t,n,r=!1){let i={},a=hi();e.propsDefaults=Object.create(null),yi(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);n?e.props=r?i:At(i):e.type.props?e.props=i:e.props=a,e.attrs=a}function vi(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=I(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(oi(e.emitsOptions,o))continue;let u=t[o];if(c)if(d(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=k(o);i[t]=bi(c,s,t,u,e,!1)}else u!==a[o]&&(a[o]=u,l=!0)}}}else{yi(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!d(t,a)&&((r=te(a))===a||!d(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=bi(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!d(t,e))&&(delete a[e],l=!0)}l&&Ye(e.attrs,`set`,``)}function yi(e,t,r,i){let[a,o]=e.propsOptions,s=!1,c;if(t)for(let n in t){if(E(n))continue;let l=t[n],u;a&&d(a,u=k(n))?!o||!o.includes(u)?r[u]=l:(c||={})[u]=l:oi(e.emitsOptions,n)||(!(n in i)||l!==i[n])&&(i[n]=l,s=!0)}if(o){let t=I(r),i=c||n;for(let n=0;n<o.length;n++){let s=o[n];r[s]=bi(a,t,s,i[s],e,!d(i,s))}}return s}function bi(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=d(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&g(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=Ea(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===te(n))&&(r=!0))}return r}var xi=new WeakMap;function Si(e,t,i=!1){let a=i?xi:t.propsCache,o=a.get(e);if(o)return o;let s=e.props,l={},u=[],p=!1;if(!g(e)){let n=e=>{p=!0;let[n,r]=Si(e,t,!0);c(l,n),r&&u.push(...r)};!i&&t.mixins.length&&t.mixins.forEach(n),e.extends&&n(e.extends),e.mixins&&e.mixins.forEach(n)}if(!s&&!p)return y(e)&&a.set(e,r),r;if(f(s))for(let e=0;e<s.length;e++){let t=k(s[e]);Ci(t)&&(l[t]=n)}else if(s)for(let e in s){let t=k(e);if(Ci(t)){let n=s[e],r=l[t]=f(n)||g(n)?{type:n}:c({},n),i=r.type,a=!1,o=!0;if(f(i))for(let e=0;e<i.length;++e){let t=i[e],n=g(t)&&t.name;if(n===`Boolean`){a=!0;break}else n===`String`&&(o=!1)}else a=g(i)&&i.name===`Boolean`;r[0]=a,r[1]=o,(a||d(r,`default`))&&u.push(t)}}let m=[l,u];return y(e)&&a.set(e,m),m}function Ci(e){return e[0]!==`$`&&!E(e)}var wi=e=>e===`_`||e===`_ctx`||e===`$stable`,Ti=e=>f(e)?e.map(ma):[ma(e)],Ei=(e,t,n)=>{if(t._n)return t;let r=Dn((...e)=>Ti(t(...e)),n);return r._c=!1,r},Di=(e,t,n)=>{let r=e._ctx;for(let n in e){if(wi(n))continue;let i=e[n];if(g(i))t[n]=Ei(n,i,r);else if(i!=null){let e=Ti(i);t[n]=()=>e}}},Oi=(e,t)=>{let n=Ti(t);e.slots.default=()=>n},ki=(e,t,n)=>{for(let r in t)(n||!wi(r))&&(e[r]=t[r])},Ai=(e,t,n)=>{let r=e.slots=hi();if(e.vnode.shapeFlag&32){let e=t._;e?(ki(r,t,n),n&&ie(r,`_`,e,!0)):Di(t,r)}else t&&Oi(e,t)},ji=(e,t,r)=>{let{vnode:i,slots:a}=e,o=!0,s=n;if(i.shapeFlag&32){let e=t._;e?r&&e===1?o=!1:ki(a,t,r):(o=!t.$stable,Di(t,a)),s=t}else t&&(Oi(e,t),s={default:1});if(o)for(let e in a)!wi(e)&&s[e]==null&&delete a[e]},Mi=Wi;function Ni(e){return Pi(e)}function Pi(e,t){let a=se();a.__VUE__=!0;let{insert:o,remove:s,patchProp:c,createElement:l,createText:u,createComment:d,setText:f,setElementText:p,parentNode:m,nextSibling:h,setScopeId:g=i,insertStaticContent:_}=e,v=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!aa(e,t)&&(r=he(e),ue(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null);let{type:l,ref:u,shapeFlag:d}=t;switch(l){case Ki:y(e,t,n,r);break;case qi:b(e,t,n,r);break;case Ji:e??x(t,n,r,o);break;case Gi:ne(e,t,n,r,i,a,o,s,c);break;default:d&1?w(e,t,n,r,i,a,o,s,c):d&6?re(e,t,n,r,i,a,o,s,c):(d&64||d&128)&&l.process(e,t,n,r,i,a,o,s,c,P)}u!=null&&i?ir(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&ir(e.ref,null,a,e,!0)},y=(e,t,n,r)=>{if(e==null)o(t.el=u(t.children),n,r);else{let n=t.el=e.el;t.children!==e.children&&f(n,t.children)}},b=(e,t,n,r)=>{e==null?o(t.el=d(t.children||``),n,r):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,r)=>{let i;for(;e&&e!==t;)i=h(e),o(e,n,r),e=i;o(t,n,r)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),s(e),e=n;s(t)},w=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)T(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),k(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},T=(e,t,n,r,i,a,s,u)=>{let d,f,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(d=e.el=l(e.type,a,m&&m.is,m),h&8?p(d,e.children):h&16&&O(e.children,d,null,r,i,Fi(e,a),s,u),_&&On(e,null,r,`created`),D(d,e,e.scopeId,s,r),m){for(let e in m)e!==`value`&&!E(e)&&c(d,e,null,m[e],a,r);`value`in m&&c(d,`value`,null,m.value,a),(f=m.onVnodeBeforeMount)&&va(f,r,e)}_&&On(e,null,r,`beforeMount`);let v=Li(i,g);v&&g.beforeEnter(d),o(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&Mi(()=>{try{f&&va(f,r,e),v&&g.enter(d),_&&On(e,null,r,`mounted`)}finally{}},i)},D=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||Ui(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;D(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},O=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?ha(e[l]):ma(e[l]);v(null,c,t,n,r,i,a,o,s)}},k=(e,t,r,i,a,o,s)=>{let l=t.el=e.el,{patchFlag:u,dynamicChildren:d,dirs:f}=t;u|=e.patchFlag&16;let m=e.props||n,h=t.props||n,g;if(r&&Ii(r,!1),(g=h.onVnodeBeforeUpdate)&&va(g,r,t,e),f&&On(t,e,r,`beforeUpdate`),r&&Ii(r,!0),d&&(!e.dynamicChildren||e.dynamicChildren.length!==d.length)&&(u=0,s=!1,d=null),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&p(l,``),d?ee(e.dynamicChildren,d,l,r,i,Fi(t,a),o):s||oe(e,t,l,null,r,i,Fi(t,a),o,!1),u>0){if(u&16)te(l,m,h,r,a);else if(u&2&&m.class!==h.class&&c(l,`class`,null,h.class,a),u&4&&c(l,`style`,m.style,h.style,a),u&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t],i=m[n],o=h[n];(o!==i||n===`value`)&&c(l,n,i,o,a,r)}}u&1&&e.children!==t.children&&p(l,t.children)}else!s&&d==null&&te(l,m,h,r,a);((g=h.onVnodeUpdated)||f)&&Mi(()=>{g&&va(g,r,t,e),f&&On(t,e,r,`updated`)},i)},ee=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s],u=c.el&&(c.type===Gi||!aa(c,l)||c.shapeFlag&198)?m(c.el):n;v(c,l,u,null,r,i,a,o,!0)}},te=(e,t,r,i,a)=>{if(t!==r){if(t!==n)for(let n in t)!E(n)&&!(n in r)&&c(e,n,t[n],null,a,i);for(let n in r){if(E(n))continue;let o=r[n],s=t[n];o!==s&&n!==`value`&&c(e,n,s,o,a,i)}`value`in r&&c(e,`value`,t.value,r.value,a)}},ne=(e,t,n,r,i,a,s,c,l)=>{let d=t.el=e?e.el:u(``),f=t.anchor=e?e.anchor:u(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(c=c?c.concat(h):h),e==null?(o(d,n,r),o(f,n,r),O(t.children||[],n,f,i,a,s,c,l)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(ee(e.dynamicChildren,m,n,i,a,s,c),(t.key!=null||i&&t===i.subTree)&&Ri(e,t,!0)):oe(e,t,n,f,i,a,s,c,l)},re=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):A(t,n,r,i,a,o,c):ie(e,t,c)},A=(e,t,n,r,i,a,o)=>{let s=e.component=xa(e,r,i);if(sr(e)&&(s.ctx.renderer=P),Aa(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,M,o),!e.el){let r=s.subTree=L(qi);b(null,r,t,n),e.placeholder=r.el}}else M(s,e,t,n,i,a,o)},ie=(e,t,n)=>{let r=t.component=e.component;if(ui(e,t,n))if(r.asyncDep&&!r.asyncResolved){ae(r,t,n);return}else r.next=t,r.update();else t.el=e.el,r.vnode=t},M=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=Bi(e);if(n){t&&(t.el=c.el,ae(e,t,o)),n.asyncDep.then(()=>{Mi(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;Ii(e,!1),t?(t.el=c.el,ae(e,t,o)):t=c,n&&j(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&va(d,s,t,c),Ii(e,!0);let f=si(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),he(p),e,i,a),t.el=f.el,u===null&&pi(e,f.el),r&&Mi(r,i),(d=t.props&&t.props.onVnodeUpdated)&&Mi(()=>va(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=or(t);if(Ii(e,!1),l&&j(l),!m&&(o=c&&c.onVnodeBeforeMount)&&va(o,d,t),Ii(e,!0),s&&ye){let t=()=>{e.subTree=si(e),ye(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=si(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&Mi(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;Mi(()=>va(o,d,e),i)}(t.shapeFlag&256||d&&or(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&Mi(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Se(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>_n(u),Ii(e,!0),l()},ae=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,vi(e,t.props,r,n),ji(e,t.children,n),Le(),bn(e),Re()},oe=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:f,shapeFlag:m}=t;if(f>0){if(f&128){ce(l,d,n,r,i,a,o,s,c);return}else if(f&256){N(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&me(l,i,a),d!==l&&p(n,d)):u&16?m&16?ce(l,d,n,r,i,a,o,s,c):me(l,i,a,!0):(u&8&&p(n,``),m&16&&O(d,n,r,i,a,o,s,c))},N=(e,t,n,i,a,o,s,c,l)=>{e||=r,t||=r;let u=e.length,d=t.length,f=Math.min(u,d),p;for(p=0;p<f;p++){let r=t[p]=l?ha(t[p]):ma(t[p]);v(e[p],r,n,null,a,o,s,c,l)}u>d?me(e,a,o,!0,!1,f):O(t,n,i,a,o,s,c,l,f)},ce=(e,t,n,i,a,o,s,c,l)=>{let u=0,d=t.length,f=e.length-1,p=d-1;for(;u<=f&&u<=p;){let r=e[u],i=t[u]=l?ha(t[u]):ma(t[u]);if(aa(r,i))v(r,i,n,null,a,o,s,c,l);else break;u++}for(;u<=f&&u<=p;){let r=e[f],i=t[p]=l?ha(t[p]):ma(t[p]);if(aa(r,i))v(r,i,n,null,a,o,s,c,l);else break;f--,p--}if(u>f){if(u<=p){let e=p+1,r=e<d?t[e].el:i;for(;u<=p;)v(null,t[u]=l?ha(t[u]):ma(t[u]),n,r,a,o,s,c,l),u++}}else if(u>p)for(;u<=f;)ue(e[u],a,o,!0),u++;else{let m=u,h=u,g=new Map;for(u=h;u<=p;u++){let e=t[u]=l?ha(t[u]):ma(t[u]);e.key!=null&&g.set(e.key,u)}let _,y=0,b=p-h+1,x=!1,S=0,C=Array(b);for(u=0;u<b;u++)C[u]=0;for(u=m;u<=f;u++){let r=e[u];if(y>=b){ue(r,a,o,!0);continue}let i;if(r.key!=null)i=g.get(r.key);else for(_=h;_<=p;_++)if(C[_-h]===0&&aa(r,t[_])){i=_;break}i===void 0?ue(r,a,o,!0):(C[i-h]=u+1,i>=S?S=i:x=!0,v(r,t[i],n,null,a,o,s,c,l),y++)}let w=x?zi(C):r;for(_=w.length-1,u=b-1;u>=0;u--){let e=h+u,r=t[e],f=t[e+1],p=e+1<d?f.el||Hi(f):i;C[u]===0?v(null,r,n,p,a,o,s,c,l):x&&(_<0||u!==w[_]?le(r,n,p,2):_--)}}},le=(e,t,n,r,i=null)=>{let{el:a,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){le(e.component.subTree,t,n,r);return}if(d&128){e.suspense.move(t,n,r);return}if(d&64){c.move(e,t,n,P);return}if(c===Gi){o(a,t,n);for(let e=0;e<u.length;e++)le(u[e],t,n,r);o(e.anchor,t,n);return}if(c===Ji){S(e,t,n);return}if(r!==2&&d&1&&l)if(r===0)l.persisted&&!a[Bn]?o(a,t,n):(l.beforeEnter(a),o(a,t,n),Mi(()=>l.enter(a),i));else{let{leave:r,delayLeave:i,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?s(a):o(a,t,n)},d=()=>{let e=a._isLeaving||!!a[Bn];a._isLeaving&&a[Bn](!0),l.persisted&&!e?u():r(a,()=>{u(),c&&c()})};i?i(a,u,d):d()}else o(a,t,n)},ue=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if(d===-2&&(i=!1),s!=null&&(Le(),ir(s,null,n,e,!0),Re()),p!=null&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!or(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&va(_,t,e),u&6)pe(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&On(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,P,r):l&&!l.hasOnce&&(a!==Gi||d>0&&d&64)?me(l,t,n,!1,!0):(a===Gi&&d&384||!i&&u&16)&&me(c,t,n),r&&de(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&Mi(()=>{_&&va(_,t,e),h&&On(e,null,t,`unmounted`),v&&(e.el=null)},n)},de=e=>{let{type:t,el:n,anchor:r,transition:i}=e;if(t===Gi){fe(n,r);return}if(t===Ji){C(e);return}let a=()=>{s(n),i&&!i.persisted&&i.afterLeave&&i.afterLeave()};if(e.shapeFlag&1&&i&&!i.persisted){let{leave:t,delayLeave:r}=i,o=()=>t(n,a);r?r(e.el,a,o):o()}else a()},fe=(e,t)=>{let n;for(;e!==t;)n=h(e),s(e),e=n;s(t)},pe=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Vi(c),Vi(l),r&&j(r),i.stop(),a&&(a.flags|=8,ue(o,e,t,n)),s&&Mi(s,t),Mi(()=>{e.isUnmounted=!0},t)},me=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)ue(e[o],t,n,r,i)},he=e=>{if(e.shapeFlag&6)return he(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[Rn];return n?h(n):t},ge=!1,_e=(e,t,n)=>{let r;e==null?t._vnode&&(ue(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,ge||=(ge=!0,bn(r),xn(),!1)},P={p:v,um:ue,m:le,r:de,mt:A,mc:O,pc:oe,pbc:ee,n:he,o:e},ve,ye;return t&&([ve,ye]=t(P)),{render:_e,hydrate:ve,createApp:ei(_e,ve)}}function Fi({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function Ii({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Li(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ri(e,t,n=!1){let r=e.children,i=t.children;if(f(r)&&f(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=ha(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&Ri(t,a)),a.type===Ki&&(a.patchFlag===-1&&(a=i[e]=ha(a)),a.el=t.el),a.type===qi&&!a.el&&(a.el=t.el)}}function zi(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function Bi(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Bi(t)}function Vi(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Hi(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?Hi(t.subTree):null}var Ui=e=>e.__isSuspense;function Wi(e,t){t&&t.pendingBranch?f(e)?t.effects.push(...e):t.effects.push(e):yn(e)}var Gi=Symbol.for(`v-fgt`),Ki=Symbol.for(`v-txt`),qi=Symbol.for(`v-cmt`),Ji=Symbol.for(`v-stc`),Yi=[],Xi=null;function Zi(e=!1){Yi.push(Xi=e?null:[])}function Qi(){Yi.pop(),Xi=Yi[Yi.length-1]||null}var $i=1;function ea(e,t=!1){$i+=e,e<0&&Xi&&t&&(Xi.hasOnce=!0)}function ta(e){return e.dynamicChildren=$i>0?Xi||r:null,Qi(),$i>0&&Xi&&Xi.push(e),e}function na(e,t,n,r,i,a){return ta(ca(e,t,n,r,i,a,!0))}function ra(e,t,n,r,i){return ta(L(e,t,n,r,i,!0))}function ia(e){return e?e.__v_isVNode===!0:!1}function aa(e,t){return e.type===t.type&&e.key===t.key}var oa=({key:e})=>e??null,sa=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:_(e)||Bt(e)||g(e)?{i:wn,r:e,k:t,f:!!n}:e);function ca(e,t=null,n=null,r=0,i=null,a=e===Gi?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&oa(t),ref:t&&sa(t),scopeId:Tn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:wn};return s?(ga(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=_(n)?8:16),$i>0&&!o&&Xi&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&Xi.push(c),c}var L=la;function la(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===Er)&&(e=qi),ia(e)){let r=da(e,t,!0);return n&&ga(r,n),$i>0&&!a&&Xi&&(r.shapeFlag&6?Xi[Xi.indexOf(e)]=r:Xi.push(r)),r.patchFlag=-2,r}if(Ba(e)&&(e=e.__vccOpts),t){t=ua(t);let{class:e,style:n}=t;e&&!_(e)&&(t.class=fe(e)),y(n)&&(It(n)&&!f(n)&&(n=c({},n)),t.style=N(n))}let o=_(e)?1:Ui(e)?128:zn(e)?64:y(e)?4:g(e)?2:0;return ca(e,t,n,r,i,o,a,!0)}function ua(e){return e?It(e)||gi(e)?c({},e):e:null}function da(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?_a(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&oa(l),ref:t&&t.ref?n&&a?f(a)?a.concat(sa(t)):[a,sa(t)]:sa(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Gi?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&da(e.ssContent),ssFallback:e.ssFallback&&da(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&r&&$n(u,c.clone(u)),u}function fa(e=` `,t=0){return L(Ki,null,e,t)}function pa(e=``,t=!1){return t?(Zi(),ra(qi,null,e)):L(qi,null,e)}function ma(e){return e==null||typeof e==`boolean`?L(qi):f(e)?L(Gi,null,e.slice()):ia(e)?ha(e):L(Ki,null,String(e))}function ha(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:da(e)}function ga(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(f(t))n=16;else if(typeof t==`object`)if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),ga(e,n()),n._c&&(n._d=!0));return}else{n=32;let r=t._;!r&&!gi(t)?t._ctx=wn:r===3&&wn&&(wn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(g(t)){if(r&65){ga(e,{default:t});return}t={default:t,_ctx:wn},n=32}else t=String(t),r&64?(n=16,t=[fa(t)]):n=8;e.children=t,e.shapeFlag|=n}function _a(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=fe([t.class,r.class]));else if(e===`style`)t.style=N([t.style,r.style]);else if(o(e)){let n=t[e],i=r[e];i&&n!==i&&!(f(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!s(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function va(e,t,n,r=null){an(e,t,7,[n,r])}var ya=Qr(),ba=0;function xa(e,t,r){let i=e.type,a=(t?t.appContext:e.appContext)||ya,o={uid:ba++,vnode:e,type:i,parent:t,appContext:a,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new ve(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(a.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Si(i,a),emitsOptions:ai(i,a),emit:null,emitted:null,propsDefaults:n,inheritAttrs:i.inheritAttrs,ctx:n,data:n,props:n,attrs:n,slots:n,refs:n,setupState:n,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=ri.bind(null,o),e.ce&&e.ce(o),o}var Sa=null,Ca=()=>Sa||wn,wa,Ta;{let e=se(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};wa=t(`__VUE_INSTANCE_SETTERS__`,e=>Sa=e),Ta=t(`__VUE_SSR_SETTERS__`,e=>ka=e)}var Ea=e=>{let t=Sa;return wa(e),e.scope.on(),()=>{e.scope.off(),wa(t)}},Da=()=>{Sa&&Sa.scope.off(),wa(null)};function Oa(e){return e.vnode.shapeFlag&4}var ka=!1;function Aa(e,t=!1,n=!1){t&&Ta(t);let{props:r,children:i}=e.vnode,a=Oa(e);_i(e,r,a,t),Ai(e,i,n||t);let o=a?ja(e,t):void 0;return t&&Ta(!1),o}function ja(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Fr);let{setup:r}=n;if(r){Le();let n=e.setupContext=r.length>1?La(e):null,i=Ea(e),a=rn(r,e,0,[e.props,n]),o=b(a);if(Re(),i(),(o||e.sp)&&!or(e)&&tr(e),o){if(a.then(Da,Da),t)return a.then(n=>{Ma(e,n,t)}).catch(t=>{on(t,e,0)});e.asyncDep=a}else Ma(e,a,t)}else Fa(e,t)}function Ma(e,t,n){g(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:y(t)&&(e.setupState=Jt(t)),Fa(e,n)}var Na,Pa;function Fa(e,t,n){let r=e.type;if(!e.render){if(!t&&Na&&!r.render){let t=r.template||Hr(e).template;if(t){let{isCustomElement:n,compilerOptions:i}=e.appContext.config,{delimiters:a,compilerOptions:o}=r;r.render=Na(t,c(c({isCustomElement:n,delimiters:a},i),o))}}e.render=r.render||i,Pa&&Pa(e)}{let t=Ea(e);Le();try{Rr(e)}finally{Re(),t()}}}var Ia={get(e,t){return Je(e,`get`,``),e[t]}};function La(e){return{attrs:new Proxy(e.attrs,Ia),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function Ra(e){return e.exposed?e.exposeProxy||=new Proxy(Jt(Lt(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Nr)return Nr[n](e)},has(e,t){return t in e||t in Nr}}):e.proxy}function za(e,t=!0){return g(e)?e.displayName||e.name:e.name||t&&e.__name}function Ba(e){return g(e)&&`__vccOpts`in e}var Va=(e,t)=>Xt(e,t,ka);function Ha(e,t,n){try{ea(-1);let r=arguments.length;return r===2?y(t)&&!f(t)?ia(t)?L(e,null,[t]):L(e,t):L(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&ia(n)&&(n=[n]),L(e,t,n))}finally{ea(1)}}var Ua=`3.5.40`,Wa=void 0,Ga=typeof window<`u`&&window.trustedTypes;if(Ga)try{Wa=Ga.createPolicy(`vue`,{createHTML:e=>e})}catch{}var Ka=Wa?e=>Wa.createHTML(e):e=>e,qa=`http://www.w3.org/2000/svg`,Ja=`http://www.w3.org/1998/Math/MathML`,Ya=typeof document<`u`?document:null,Xa=Ya&&Ya.createElement(`template`),Za={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?Ya.createElementNS(qa,e):t===`mathml`?Ya.createElementNS(Ja,e):n?Ya.createElement(e,{is:n}):Ya.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>Ya.createTextNode(e),createComment:e=>Ya.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ya.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),!(i===a||!(i=i.nextSibling)););else{Xa.innerHTML=Ka(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=Xa.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Qa=`transition`,$a=`animation`,eo=Symbol(`_vtc`),to={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},no=c({},Wn,to),ro=(e=>(e.displayName=`Transition`,e.props=no,e))((e,{slots:t})=>Ha(Jn,oo(e),t)),io=(e,t=[])=>{f(e)?e.forEach(e=>e(...t)):e&&e(...t)},ao=e=>e?f(e)?e.some(e=>e.length>1):e.length>1:!1;function oo(e){let t={};for(let n in e)n in to||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:l=a,appearActiveClass:u=o,appearToClass:d=s,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:m=`${n}-leave-to`}=e,h=so(i),g=h&&h[0],_=h&&h[1],{onBeforeEnter:v,onEnter:y,onEnterCancelled:b,onLeave:x,onLeaveCancelled:S,onBeforeAppear:C=v,onAppear:w=y,onAppearCancelled:T=b}=t,E=(e,t,n,r)=>{e._enterCancelled=r,uo(e,t?d:s),uo(e,t?u:o),n&&n()},D=(e,t)=>{e._isLeaving=!1,uo(e,f),uo(e,m),uo(e,p),t&&t()},O=e=>(t,n)=>{let i=e?w:y,o=()=>E(t,e,n);io(i,[t,o]),fo(()=>{uo(t,e?l:a),lo(t,e?d:s),ao(i)||mo(t,r,g,o)})};return c(t,{onBeforeEnter(e){io(v,[e]),lo(e,a),lo(e,o)},onBeforeAppear(e){io(C,[e]),lo(e,l),lo(e,u)},onEnter:O(!1),onAppear:O(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>D(e,t);lo(e,f),e._enterCancelled?(lo(e,p),vo(e)):(vo(e),lo(e,p)),fo(()=>{e._isLeaving&&(uo(e,f),lo(e,m),ao(x)||mo(e,r,_,n))}),io(x,[e,n])},onEnterCancelled(e){E(e,!1,void 0,!0),io(b,[e])},onAppearCancelled(e){E(e,!0,void 0,!0),io(T,[e])},onLeaveCancelled(e){D(e),io(S,[e])}})}function so(e){if(e==null)return null;if(y(e))return[co(e.enter),co(e.leave)];{let t=co(e);return[t,t]}}function co(e){return ae(e)}function lo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[eo]||(e[eo]=new Set)).add(t)}function uo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[eo];n&&(n.delete(t),n.size||(e[eo]=void 0))}function fo(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var po=0;function mo(e,t,n,r){let i=e._endId=++po,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=ho(e,t);if(!o)return r();let l=o+`end`,u=0,d=()=>{e.removeEventListener(l,f),a()},f=t=>{t.target===e&&++u>=c&&d()};setTimeout(()=>{u<c&&d()},s+1),e.addEventListener(l,f)}function ho(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${Qa}Delay`),a=r(`${Qa}Duration`),o=go(i,a),s=r(`${$a}Delay`),c=r(`${$a}Duration`),l=go(s,c),u=null,d=0,f=0;t===Qa?o>0&&(u=Qa,d=o,f=a.length):t===$a?l>0&&(u=$a,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?Qa:$a:null,f=u?u===Qa?a.length:c.length:0);let p=u===Qa&&/\b(?:transform|all)(?:,|$)/.test(r(`${Qa}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function go(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>_o(t)+_o(e[n])))}function _o(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function vo(e){return(e?e.ownerDocument:document).body.offsetHeight}function yo(e,t,n){let r=e[eo];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var bo=Symbol(`_vod`),xo=Symbol(`_vsh`),So=Symbol(``),Co=/(?:^|;)\s*display\s*:/;function wo(e,t,n){let r=e.style,i=_(n),a=!1;if(n&&!i){if(t)if(_(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??Eo(r,t,``)}else for(let e in t)n[e]??Eo(r,e,``);for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?Eo(r,i,``):Ao(e,i,!_(t)&&t?t[i]:void 0,o)||Eo(r,i,o)}}else if(i){if(t!==n){let e=r[So];e&&(n+=`;`+e),r.cssText=n,a=Co.test(n)}}else t&&e.removeAttribute(`style`);bo in e&&(e[bo]=a?r.display:``,e[xo]&&(r.display=`none`))}var To=/\s*!important$/;function Eo(e,t,n){if(f(n))n.forEach(n=>Eo(e,t,n));else if(n??=``,t.startsWith(`--`))e.setProperty(t,n);else{let r=ko(e,t);To.test(n)?e.setProperty(te(r),n.replace(To,``),`important`):e[r]=n}}var Do=[`Webkit`,`Moz`,`ms`],Oo={};function ko(e,t){let n=Oo[t];if(n)return n;let r=k(t);if(r!==`filter`&&r in e)return Oo[t]=r;r=ne(r);for(let n=0;n<Do.length;n++){let i=Do[n]+r;if(i in e)return Oo[t]=i}return t}function Ao(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&_(r)&&n===r}var jo=`http://www.w3.org/1999/xlink`;function Mo(e,t,n,r,i,a=me(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(jo,t.slice(6,t.length)):e.setAttributeNS(jo,t,n):n==null||a&&!he(n)?e.removeAttribute(t):e.setAttribute(t,a?``:v(n)?String(n):n)}function No(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?Ka(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=he(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function Po(e,t,n,r){e.addEventListener(t,n,r)}function Fo(e,t,n,r){e.removeEventListener(t,n,r)}var Io=Symbol(`_vei`);function Lo(e,t,n,r,i=null){let a=e[Io]||(e[Io]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=Bo(t);r?Po(e,n,a[t]=Wo(r,i),s):o&&(Fo(e,n,o,s),a[t]=void 0)}}var Ro=/(Once|Passive|Capture)$/,zo=/^on:?(?:Once|Passive|Capture)$/;function Bo(e){let t,n;for(;(n=e.match(Ro))&&!zo.test(e);)t||={},e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===`:`?e.slice(3):te(e.slice(2)),t]}var Vo=0,Ho=Promise.resolve(),Uo=()=>Vo||=(Ho.then(()=>Vo=0),Date.now());function Wo(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(f(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&an(e,t,5,a)}}else an(r,t,5,[e])};return n.value=e,n.attached=Uo(),n}var Go=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ko=(e,t,n,r,i,a)=>{let c=i===`svg`;t===`class`?yo(e,r,c):t===`style`?wo(e,n,r):o(t)?s(t)||Lo(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),!0):t[0]===`^`?(t=t.slice(1),!1):qo(e,t,r,c))?(No(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&Mo(e,t,r,c,a,t!==`value`)):e._isVueCE&&(Jo(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!_(r)))?No(e,k(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),Mo(e,t,r,c))};function qo(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&Go(t)&&g(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return Go(t)&&_(n)?!1:t in e}function Jo(e,t){let n=e._def.props;if(!n)return!1;let r=k(t);return Array.isArray(n)?n.some(e=>k(e)===r):Object.keys(n).some(e=>k(e)===r)}var Yo=c({patchProp:Ko},Za),Xo;function Zo(){return Xo||=Ni(Yo)}var Qo=((...e)=>{let t=Zo().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=es(e);if(!r)return;let i=t._component;!g(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,$o(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function $o(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function es(e){return _(e)?document.querySelector(e):e}function ts(e,t){return ye()?(be(e,t),!0):!1}function ns(){let e=new Set,t=t=>{e.delete(t)};return{on:n=>{e.add(n);let r=()=>t(n);return ts(r),{off:r}},off:t,trigger:(...t)=>Promise.all(Array.from(e).map(e=>e(...t))),clear:()=>{e.clear()}}}var rs=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var is=Object.prototype.toString,as=e=>is.call(e)===`[object Object]`,os=(e,t)=>Object.hasOwn(e,t);function ss(e){return Array.isArray(e)?e:[e]}function cs(e,t,n){return Pn(e,t,{...n,immediate:!0})}var ls=rs?window:void 0,us=rs?window.document:void 0;rs&&window.navigator,rs&&window.location;function ds(e){let t=Kt(e);return t?.$el??t}function fs(...e){let t=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),n=Va(()=>{let t=ss(Kt(e[0])).filter(e=>e!=null);return t.every(e=>typeof e!=`string`)?t:void 0});return cs(()=>[n.value?.map(e=>ds(e))??[ls].filter(e=>e!=null),ss(Kt(n.value?e[1]:e[0])),ss(Gt(n.value?e[2]:e[1])),Kt(n.value?e[3]:e[2])],([e,n,r,i],a,o)=>{if(!e?.length||!n?.length||!r?.length)return;let s=as(i)?{...i}:i,c=e.flatMap(e=>n.flatMap(n=>r.map(r=>t(e,n,r,s))));o(()=>{c.forEach(e=>e())})},{flush:`post`})}function ps(e,t={}){let n=Ht(!1),r=Ht(null),i=0,a=!0;if(rs){let o=typeof t==`function`?{onDrop:t}:t,s=o.multiple??!0,c=o.preventDefaultForUnhandled??!1,l=e=>{let t=Array.from(e.dataTransfer?.files??[]);return t.length===0?null:s?t:[t[0]]},u=e=>{let t=Gt(o.dataTypes);return typeof t==`function`?t(e):!t?.length||e.length!==0&&e.every(e=>t.some(t=>e.includes(t)))},d=e=>{if(o.checkValidity)return o.checkValidity(e);let t=u(Array.from(e??[]).map(e=>e.type)),n=s||e.length<=1;return t&&n},f=()=>/^(?:(?!chrome|android).)*safari/i.test(navigator.userAgent)&&!(`chrome`in window),p=(e,t)=>{let s=e.dataTransfer?.items;if(a=(s&&d(s))??!1,c&&e.preventDefault(),!f()&&!a){e.dataTransfer&&(e.dataTransfer.dropEffect=`none`);return}e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`);let u=l(e);switch(t){case`enter`:var p;i+=1,n.value=!0,(p=o.onEnter)==null||p.call(o,null,e);break;case`over`:var m;(m=o.onOver)==null||m.call(o,null,e);break;case`leave`:var h;--i,i===0&&(n.value=!1),(h=o.onLeave)==null||h.call(o,null,e);break;case`drop`:if(i=0,n.value=!1,a){var g;r.value=u,(g=o.onDrop)==null||g.call(o,u,e)}break}};fs(e,`dragenter`,e=>p(e,`enter`)),fs(e,`dragover`,e=>p(e,`over`)),fs(e,`dragleave`,e=>p(e,`leave`)),fs(e,`drop`,e=>p(e,`drop`))}return{files:r,isOverDropZone:n}}var ms={multiple:!0,accept:`*`,reset:!1,directory:!1};function hs(e){if(!e)return null;if(e instanceof FileList)return e;let t=new DataTransfer;for(let n of e)t.items.add(n);return t.files}function gs(e={}){let{document:t=us}=e,n=Vt(hs(e.initialFiles)),{on:r,trigger:i}=ns(),{on:a,trigger:o}=ns(),s=Va(()=>{let r=ds(e.input)??(t?t.createElement(`input`):void 0);return r&&(r.type=`file`,r.onchange=e=>{n.value=e.target.files,i(n.value)},r.oncancel=()=>{o()}),r}),c=()=>{n.value=null,s.value&&s.value.value&&(s.value.value=``,i(null))},l=e=>{let t=s.value;t&&(t.multiple=Kt(e.multiple),t.accept=Kt(e.accept),t.webkitdirectory=Kt(e.directory),os(e,`capture`)&&(t.capture=Kt(e.capture)))};return Nn(()=>{l(e)}),{files:jt(n),open:t=>{let n=s.value;if(!n)return;let r={...ms,...e,...t};l(r),Kt(r.reset)&&c(),n.click()},reset:c,onCancel:a,onChange:r}}function _s(e,t,n){if(e!==`cover`&&e!==`contain`)throw TypeError(`Invalid mode`);let r=t.width/t.height,i=n.width/n.height,{width:a}=n,{height:o}=n;return(e===`contain`?r>i:r<i)?o=a/r:a=o*r,{width:a,height:o,x:(n.width-a)/2,y:(n.height-o)/2}}var vs={key:0,class:`leading-icon`},ys={class:`text`},bs={key:1,class:`arrow`},xs={__name:`Btn`,props:{tag:{type:String,default:()=>`button`},arrow:{type:Boolean,default:()=>!1},loading:{type:Boolean,default:()=>!1}},setup(e){return(t,n)=>(Zi(),ra(Dr(e.tag),{class:`btn`},{default:Dn(()=>[e.arrow?(Zi(),na(`span`,vs,``)):pa(``,!0),ca(`span`,ys,[ca(`span`,null,[Ar(t.$slots,`default`)]),ca(`span`,null,[Ar(t.$slots,`default`)])]),e.arrow?(Zi(),na(`span`,bs,``)):pa(``,!0)]),_:3}))}},Ss=`15.1.22`,Cs=e(((e,t)=>{function n(e){if(Array.isArray(e))return e}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),ws=e(((e,t)=>{function n(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Ts=e(((e,t)=>{function n(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Es=e(((e,t)=>{var n=Ts();function r(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),Ds=e(((e,t)=>{function n(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),Os=e(((e,t)=>{var n=Cs(),r=ws(),i=Es(),a=Ds();function o(e,t){return n(e)||r(e,t)||i(e,t)||a()}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports})),ks=e(((e,t)=>{function n(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),As=e(((e,t)=>{function n(e){"@babel/helpers - typeof";return t.exports=n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},t.exports.__esModule=!0,t.exports.default=t.exports,n(e)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})),js=e(((e,t)=>{var n=As().default;function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})),Ms=e(((e,t)=>{var n=As().default,r=js();function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),Ns=e(((e,t)=>{var n=Ms();function r(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,`value`in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports})),Ps=e(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e,Os(),ks(),Ns()):typeof define==`function`&&define.amd?define([`exports`,`@babel/runtime/helpers/slicedToArray`,`@babel/runtime/helpers/classCallCheck`,`@babel/runtime/helpers/createClass`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n.automationEvents={},n._slicedToArray,n._classCallCheck,n._createClass))})(e,(function(e,t,n,r){var i=function(e,t,n){return{endTime:t,insertTime:n,type:`exponentialRampToValue`,value:e}},a=function(e,t,n){return{endTime:t,insertTime:n,type:`linearRampToValue`,value:e}},o=function(e,t){return{startTime:t,type:`setValue`,value:e}},s=function(e,t,n){return{duration:n,startTime:t,type:`setValueCurve`,values:e}},c=function(e,t,n){var r=n.startTime,i=n.target,a=n.timeConstant;return i+(t-i)*Math.exp((r-e)/a)},l=function(e){return e.type===`exponentialRampToValue`},u=function(e){return e.type===`linearRampToValue`},d=function(e){return l(e)||u(e)},f=function(e){return e.type===`setValue`},p=function(e){return e.type===`setValueCurve`},m=function(e,t,n,r){var i=e[t];return i===void 0?r:d(i)||f(i)?i.value:p(i)?i.values[i.values.length-1]:c(n,m(e,t-1,i.startTime,r),i)},h=function(e,t,n,r,i){return n===void 0?[r.insertTime,i]:d(n)?[n.endTime,n.value]:f(n)?[n.startTime,n.value]:p(n)?[n.startTime+n.duration,n.values[n.values.length-1]]:[n.startTime,m(e,t-1,n.startTime,i)]},g=function(e){return e.type===`cancelAndHold`},_=function(e){return e.type===`cancelScheduledValues`},v=function(e){return g(e)||_(e)?e.cancelTime:l(e)||u(e)?e.endTime:e.startTime},y=function(e,t,n,r){var i=r.endTime,a=r.value;return n===a?a:0<n&&0<a||n<0&&a<0?n*(a/n)**+((e-t)/(i-t)):e<i?n:a},b=function(e,t,n,r){var i=r.endTime,a=r.value;return n+(e-t)/(i-t)*(a-n)},x=function(e,t){var n=Math.floor(t);if(n===t)return e[n];var r=Math.ceil(t);return(1-(t-n))*e[n]+(1-(r-t))*e[r]},S=function(e,t){var n=t.duration,r=t.startTime,i=t.values;return x(i,(e-r)/n*(i.length-1))},C=function(e,t,n){for(var r=e.length,i=Math.max(1,Math.floor(n/t*r))+1,a=e instanceof Float32Array?new Float32Array(i):e.slice(0,i),o=0;o<i;o+=1)a[o]=x(e,o/(i-1)*n/t*(r-1));return a},w=function(e){return e.type===`setTarget`};e.AutomationEventList=function(){function e(t){n(this,e),this._automationEvents=[],this._currenTime=0,this._defaultValue=t}return r(e,[{key:Symbol.iterator,value:function(){return this._automationEvents[Symbol.iterator]()}},{key:`add`,value:function(e){var t=v(e);if(g(e)||_(e)){var n=this._automationEvents.findIndex(function(n){return _(e)&&p(n)?n.startTime+n.duration>=t:v(n)>=t}),r=this._automationEvents[n];if(n!==-1&&(this._automationEvents=this._automationEvents.slice(0,n)),g(e)){var c=this._automationEvents[this._automationEvents.length-1];if(r!==void 0&&d(r)){if(c!==void 0&&w(c))throw Error(`The internal list is malformed.`);var f=c===void 0?r.insertTime:p(c)?c.startTime+c.duration:v(c),m=c===void 0?this._defaultValue:p(c)?c.values[c.values.length-1]:c.value,h=l(r)?y(t,f,m,r):b(t,f,m,r),x=l(r)?i(h,t,this._currenTime):a(h,t,this._currenTime);this._automationEvents.push(x)}if(c!==void 0&&w(c)&&this._automationEvents.push(o(this.getValue(t),t)),c!==void 0&&p(c)&&c.startTime+c.duration>t){var S=t-c.startTime;this._automationEvents[this._automationEvents.length-1]=s(C(c.values,c.duration,S),c.startTime,S)}}}else{var T=this._automationEvents.findIndex(function(e){return v(e)>t}),E=T===-1?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[T-1];if(E!==void 0&&p(E)&&v(E)+E.duration>t)return!1;var D=l(e)?i(e.value,e.endTime,this._currenTime):u(e)?a(e.value,t,this._currenTime):e;if(T===-1)this._automationEvents.push(D);else{if(p(e)&&t+e.duration>v(this._automationEvents[T]))return!1;this._automationEvents.splice(T,0,D)}}return!0}},{key:`flush`,value:function(e){var t=this._automationEvents.findIndex(function(t){return v(t)>e});if(t>1){var n=this._automationEvents.slice(t-1),r=n[0];w(r)&&n.unshift(o(m(this._automationEvents,t-2,r.startTime,this._defaultValue),r.startTime)),this._automationEvents=n}}},{key:`getValue`,value:function(e){if(this._automationEvents.length===0)return this._defaultValue;var n=this._automationEvents.findIndex(function(t){return v(t)>e}),r=this._automationEvents[n],i=(n===-1?this._automationEvents.length:n)-1,a=this._automationEvents[i];if(a!==void 0&&w(a)&&(r===void 0||!d(r)||r.insertTime>e))return c(e,m(this._automationEvents,i-1,a.startTime,this._defaultValue),a);if(a!==void 0&&f(a)&&(r===void 0||!d(r)))return a.value;if(a!==void 0&&p(a)&&(r===void 0||!d(r)||a.startTime+a.duration>e))return e<a.startTime+a.duration?S(e,a):a.values[a.values.length-1];if(a!==void 0&&d(a)&&(r===void 0||!d(r)))return a.value;if(r!==void 0&&l(r)){var o=t(h(this._automationEvents,i,a,r,this._defaultValue),2),s=o[0],g=o[1];return y(e,s,g,r)}if(r!==void 0&&u(r)){var _=t(h(this._automationEvents,i,a,r,this._defaultValue),2),x=_[0],C=_[1];return b(e,x,C,r)}return this._defaultValue}}])}(),e.createCancelAndHoldAutomationEvent=function(e){return{cancelTime:e,type:`cancelAndHold`}},e.createCancelScheduledValuesAutomationEvent=function(e){return{cancelTime:e,type:`cancelScheduledValues`}},e.createExponentialRampToValueAutomationEvent=function(e,t){return{endTime:t,type:`exponentialRampToValue`,value:e}},e.createLinearRampToValueAutomationEvent=function(e,t){return{endTime:t,type:`linearRampToValue`,value:e}},e.createSetTargetAutomationEvent=function(e,t,n){return{startTime:t,target:e,timeConstant:n,type:`setTarget`}},e.createSetValueAutomationEvent=o,e.createSetValueCurveAutomationEvent=s}))}))(),Fs=()=>new DOMException(``,`AbortError`),Is=e=>(t,n,[r,i,a],o)=>{e(t[i],[n,r,a],e=>e[0]===n&&e[1]===r,o)},Ls=e=>(t,n,r)=>{let i=[];for(let e=0;e<r.numberOfInputs;e+=1)i.push(new Set);e.set(t,{activeInputs:i,outputs:new Set,passiveInputs:new WeakMap,renderer:n})},Rs=e=>(t,n)=>{e.set(t,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:n})},zs=new WeakSet,Bs=new WeakMap,Vs=new WeakMap,Hs=new WeakMap,Us=new WeakMap,Ws=new WeakMap,Gs=new WeakMap,Ks=new WeakMap,qs=new WeakMap,Js=new WeakMap,Ys={construct(){return Ys}},Xs=e=>{try{new new Proxy(e,Ys)}catch{return!1}return!0},Zs=/^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]*);?/,Qs=(e,t)=>{let n=[],r=e.replace(/^[\s]+/,``),i=r.match(Zs);for(;i!==null;){let e=i[1].slice(1,-1),a=i[0].replace(/([\s]+)?;?$/,``).replace(e,new URL(e,t).toString());n.push(a),r=r.slice(i[0].length).replace(/^[\s]+/,``),i=r.match(Zs)}return[n.join(`;`),r]},$s=e=>{if(e!==void 0&&!Array.isArray(e))throw TypeError(`The parameterDescriptors property of given value for processorCtor is not an array.`)},ec=e=>{if(!Xs(e))throw TypeError(`The given value for processorCtor should be a constructor.`);if(e.prototype===null||typeof e.prototype!=`object`)throw TypeError(`The given value for processorCtor should have a prototype.`)},tc=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{let p=0;return(m,h,g={credentials:`omit`})=>{let _=u.get(m);if(_!==void 0&&_.has(h))return Promise.resolve();let v=l.get(m);if(v!==void 0){let e=v.get(h);if(e!==void 0)return e}let y=a(m),b=y.audioWorklet===void 0?i(h).then(([e,t])=>{let[r,i]=Qs(e,t);return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}
})})(window,'_AWGS')`)}).then(()=>{let e=f._AWGS.pop();if(e===void 0)throw SyntaxError();r(y.currentTime,y.sampleRate,()=>e(class{},void 0,(e,n)=>{if(e.trim()===``)throw t();let r=qs.get(y);if(r!==void 0){if(r.has(e))throw t();ec(n),$s(n.parameterDescriptors),r.set(e,n)}else ec(n),$s(n.parameterDescriptors),qs.set(y,new Map([[e,n]]))},y.sampleRate,void 0,void 0))}):Promise.all([i(h),Promise.resolve(e(d,d))]).then(([[e,t],n])=>{let r=p+1;p=r;let[i,a]=Qs(e,t),l=`${i};((AudioWorkletProcessor,registerProcessor)=>{${a}
})(${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${r}',class extends AudioWorkletProcessor{process(){return !1}})`,u=new Blob([l],{type:`application/javascript; charset=utf-8`}),d=URL.createObjectURL(u);return y.audioWorklet.addModule(d,g).then(()=>{if(s(y))return y;let e=o(y);return e.audioWorklet.addModule(d,g).then(()=>e)}).then(e=>{if(c===null)throw SyntaxError();try{new c(e,`__sac${r}`)}catch{throw SyntaxError()}}).finally(()=>URL.revokeObjectURL(d))});return v===void 0?l.set(m,new Map([[h,b]])):v.set(h,b),b.then(()=>{let e=u.get(m);e===void 0?u.set(m,new Set([h])):e.add(h)}).finally(()=>{let e=l.get(m);e!==void 0&&e.delete(h)}),b}},nc=(e,t)=>{let n=e.get(t);if(n===void 0)throw Error(`A value with the given key could not be found.`);return n},rc=(e,t)=>{let n=Array.from(e).filter(t);if(n.length>1)throw Error(`More than one element was found.`);if(n.length===0)throw Error(`No element was found.`);let[r]=n;return e.delete(r),r},ic=(e,t,n,r)=>{let i=nc(e,t),a=rc(i,e=>e[0]===n&&e[1]===r);return i.size===0&&e.delete(t),a},ac=e=>nc(Gs,e),oc=e=>{if(zs.has(e))throw Error(`The AudioNode is already stored.`);zs.add(e),ac(e).forEach(e=>e(!0))},sc=e=>`port`in e,cc=e=>{if(!zs.has(e))throw Error(`The AudioNode is not stored.`);zs.delete(e),ac(e).forEach(e=>e(!1))},lc=(e,t)=>{!sc(e)&&t.every(e=>e.size===0)&&cc(e)},uc=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{let p=new WeakMap;return(m,h,g,_,v)=>{let{activeInputs:y,passiveInputs:b}=a(h),{outputs:x}=a(m),S=s(m),C=a=>{let s=c(h),l=c(m);if(a){let t=ic(b,m,g,_);e(y,m,t,!1),!v&&!d(m)&&n(l,s,g,_),f(h)&&oc(h)}else{let e=r(y,m,g,_);t(b,_,e,!1),!v&&!d(m)&&i(l,s,g,_);let n=o(h);if(n===0)u(h)&&lc(h,y);else{let e=p.get(h);e!==void 0&&clearTimeout(e),p.set(h,setTimeout(()=>{u(h)&&lc(h,y)},n*1e3))}}};return l(x,[h,g,_],e=>e[0]===h&&e[1]===g&&e[2]===_,!0)?(S.add(C),u(m)?e(y,m,[g,_,C],!0):t(b,_,[m,g,C],!0),!0):!1}},dc=e=>(t,n,[r,i,a],o)=>{let s=t.get(r);s===void 0?t.set(r,new Set([[i,n,a]])):e(s,[i,n,a],e=>e[0]===i&&e[1]===n,o)},fc=e=>(t,n)=>{let r=e(t,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:0});n.connect(r).connect(t.destination);let i=()=>{n.removeEventListener(`ended`,i),n.disconnect(r),r.disconnect()};n.addEventListener(`ended`,i)},pc=e=>(t,n)=>{e(t).add(n)},mc={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8},hc=(e,t,n,r,i,a)=>class extends e{constructor(e,n){let o=i(e),s=r(o,{...mc,...n}),c=a(o)?t():null;super(e,!1,s,c),this._nativeAnalyserNode=s}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(e){this._nativeAnalyserNode.fftSize=e}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(e){let t=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=e,!(e>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=t,n()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(e){let t=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=e,!(this._nativeAnalyserNode.maxDecibels>e))throw this._nativeAnalyserNode.minDecibels=t,n()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(e){this._nativeAnalyserNode.smoothingTimeConstant=e}getByteFrequencyData(e){this._nativeAnalyserNode.getByteFrequencyData(e)}getByteTimeDomainData(e){this._nativeAnalyserNode.getByteTimeDomainData(e)}getFloatFrequencyData(e){this._nativeAnalyserNode.getFloatFrequencyData(e)}getFloatTimeDomainData(e){this._nativeAnalyserNode.getFloatTimeDomainData(e)}},gc=(e,t)=>e.context===t,_c=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return gc(o,a)||(o=e(a,{channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,fftSize:o.fftSize,maxDecibels:o.maxDecibels,minDecibels:o.minDecibels,smoothingTimeConstant:o.smoothingTimeConstant})),r.set(a,o),await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},vc=e=>{try{e.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},yc=()=>new DOMException(``,`IndexSizeError`),bc=e=>{e.getChannelData=(t=>n=>{try{return t.call(e,n)}catch(e){throw e.code===12?yc():e}})(e.getChannelData)},xc={numberOfChannels:1},Sc=(e,t,n,r,i,a,o,s)=>{let c=null;return class l{constructor(l){if(i===null)throw Error(`Missing the native OfflineAudioContext constructor.`);let{length:u,numberOfChannels:d,sampleRate:f}={...xc,...l};c===null&&(c=new i(1,1,44100));let p=r!==null&&t(a,a)?new r({length:u,numberOfChannels:d,sampleRate:f}):c.createBuffer(d,u,f);if(p.numberOfChannels===0)throw n();return typeof p.copyFromChannel==`function`?t(vc,()=>vc(p))||s(p):(o(p),bc(p)),e.add(p),p}static[Symbol.hasInstance](t){return typeof t==`object`&&!!t&&Object.getPrototypeOf(t)===l.prototype||e.has(t)}}},Cc=-34028234663852886e22,wc=34028234663852886e22,Tc=e=>zs.has(e),Ec={buffer:null,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,loop:!1,loopEnd:0,loopStart:0,playbackRate:1},Dc=(e,t,n,r,i,a,o,s)=>class extends e{constructor(e,r){let s=a(e),c={...Ec,...r},l=i(s,c),u=o(s),d=u?t():null;super(e,!1,l,d),this._audioBufferSourceNodeRenderer=d,this._isBufferNullified=!1,this._isBufferSet=c.buffer!==null,this._nativeAudioBufferSourceNode=l,this._onended=null,this._playbackRate=n(this,u,l.playbackRate,wc,Cc)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(e){if(this._nativeAudioBufferSourceNode.buffer=e,e!==null){if(this._isBufferSet)throw r();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(e){this._nativeAudioBufferSourceNode.loop=e}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(e){this._nativeAudioBufferSourceNode.loopEnd=e}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(e){this._nativeAudioBufferSourceNode.loopStart=e}get onended(){return this._onended}set onended(e){let t=typeof e==`function`?s(this,e):null;this._nativeAudioBufferSourceNode.onended=t;let n=this._nativeAudioBufferSourceNode.onended;this._onended=n!==null&&n===t?e:n}get playbackRate(){return this._playbackRate}start(e=0,t=0,n){if(this._nativeAudioBufferSourceNode.start(e,t,n),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.start=n===void 0?[e,t]:[e,t,n]),this.context.state!==`closed`){oc(this);let e=()=>{this._nativeAudioBufferSourceNode.removeEventListener(`ended`,e),Tc(this)&&cc(this)};this._nativeAudioBufferSourceNode.addEventListener(`ended`,e)}}stop(e=0){this._nativeAudioBufferSourceNode.stop(e),this._audioBufferSourceNodeRenderer!==null&&(this._audioBufferSourceNodeRenderer.stop=e)}},Oc=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=null,s=null,c=async(c,l)=>{let u=n(c),d=gc(u,l);return d||(u=t(l,{buffer:u.buffer,channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,loop:u.loop,loopEnd:u.loopEnd,loopStart:u.loopStart,playbackRate:u.playbackRate.value}),o!==null&&u.start(...o),s!==null&&u.stop(s)),a.set(l,u),d?await e(l,c.playbackRate,u.playbackRate):await r(l,c.playbackRate,u.playbackRate),await i(c,l,u),u};return{set start(e){o=e},set stop(e){s=e},render(e,t){let n=a.get(t);return n===void 0?c(e,t):Promise.resolve(n)}}},kc=e=>`playbackRate`in e,Ac=e=>`frequency`in e&&`gain`in e,jc=e=>`offset`in e,Mc=e=>!(`frequency`in e)&&`gain`in e,Nc=e=>`detune`in e&&`frequency`in e&&!(`gain`in e),Pc=e=>`pan`in e,Fc=e=>nc(Bs,e),Ic=e=>nc(Hs,e),Lc=(e,t)=>{let{activeInputs:n}=Fc(e);n.forEach(n=>n.forEach(([n])=>{t.includes(e)||Lc(n,[...t,e])}));let r=kc(e)?[e.playbackRate]:sc(e)?Array.from(e.parameters.values()):Ac(e)?[e.Q,e.detune,e.frequency,e.gain]:jc(e)?[e.offset]:Mc(e)?[e.gain]:Nc(e)?[e.detune,e.frequency]:Pc(e)?[e.pan]:[];for(let e of r){let n=Ic(e);n!==void 0&&n.activeInputs.forEach(([e])=>Lc(e,t))}Tc(e)&&cc(e)},Rc=e=>{Lc(e.destination,[])},zc=e=>e===void 0||typeof e==`number`||typeof e==`string`&&(e===`balanced`||e===`interactive`||e===`playback`),Bc=(e,t,n,r,i,a,o,s,c)=>class extends e{constructor(e={}){if(c===null)throw Error(`Missing the native AudioContext constructor.`);let t;try{t=new c(e)}catch(e){throw e.code===12&&e.message===`sampleRate is not in range`?n():e}if(t===null)throw r();if(!zc(e.latencyHint))throw TypeError(`The provided value '${e.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);if(e.sampleRate!==void 0&&t.sampleRate!==e.sampleRate)throw n();super(t,2);let{latencyHint:i}=e,{sampleRate:a}=t;if(this._baseLatency=typeof t.baseLatency==`number`?t.baseLatency:i===`balanced`?512/a:i===`interactive`||i===void 0?256/a:i===`playback`?1024/a:Math.max(2,Math.min(128,Math.round(i*a/128)))*128/a,this._nativeAudioContext=t,c.name===`webkitAudioContext`?(this._nativeGainNode=t.createGain(),this._nativeOscillatorNode=t.createOscillator(),this._nativeGainNode.gain.value=1e-37,this._nativeOscillatorNode.connect(this._nativeGainNode).connect(t.destination),this._nativeOscillatorNode.start()):(this._nativeGainNode=null,this._nativeOscillatorNode=null),this._state=null,t.state===`running`){this._state=`suspended`;let e=()=>{this._state===`suspended`&&(this._state=null),t.removeEventListener(`statechange`,e)};t.addEventListener(`statechange`,e)}}get baseLatency(){return this._baseLatency}get state(){return this._state===null?this._nativeAudioContext.state:this._state}close(){return this.state===`closed`?this._nativeAudioContext.close().then(()=>{throw t()}):(this._state===`suspended`&&(this._state=null),this._nativeAudioContext.close().then(()=>{this._nativeGainNode!==null&&this._nativeOscillatorNode!==null&&(this._nativeOscillatorNode.stop(),this._nativeGainNode.disconnect(),this._nativeOscillatorNode.disconnect()),Rc(this)}))}createMediaElementSource(e){return new i(this,{mediaElement:e})}createMediaStreamDestination(){return new a(this)}createMediaStreamSource(e){return new o(this,{mediaStream:e})}createMediaStreamTrackSource(e){return new s(this,{mediaStreamTrack:e})}resume(){return this._state===`suspended`?new Promise((e,t)=>{let n=()=>{this._nativeAudioContext.removeEventListener(`statechange`,n),this._nativeAudioContext.state===`running`?e():this.resume().then(e,t)};this._nativeAudioContext.addEventListener(`statechange`,n)}):this._nativeAudioContext.resume().catch(e=>{throw e===void 0||e.code===15?t():e})}suspend(){return this._nativeAudioContext.suspend().catch(e=>{throw e===void 0?t():e})}},Vc=(e,t,n,r,i,a,o,s)=>class extends e{constructor(e,n){let r=a(e),c=o(r),l=i(r,n,c),u=c?t(s):null;super(e,!1,l,u),this._isNodeOfNativeOfflineAudioContext=c,this._nativeAudioDestinationNode=l}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();if(e>this._nativeAudioDestinationNode.maxChannelCount)throw n();this._nativeAudioDestinationNode.channelCount=e}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(e){if(this._isNodeOfNativeOfflineAudioContext)throw r();this._nativeAudioDestinationNode.channelCountMode=e}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}},Hc=e=>{let t=new WeakMap,n=async(n,r)=>{let i=r.destination;return t.set(r,i),await e(n,r,i),i};return{render(e,r){let i=t.get(r);return i===void 0?n(e,r):Promise.resolve(i)}}},Uc=(e,t,n,r,i,a,o,s)=>(c,l)=>{let u=l.listener,{forwardX:d,forwardY:f,forwardZ:p,positionX:m,positionY:h,positionZ:g,upX:_,upY:v,upZ:y}=u.forwardX===void 0?(()=>{let d=new Float32Array(1),f=t(l,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:9}),p=o(l),m=!1,h=[0,0,-1,0,1,0],g=[0,0,0],_=()=>{if(m)return;m=!0;let e=r(l,256,9,0);e.onaudioprocess=({inputBuffer:e})=>{let t=[a(e,d,0),a(e,d,1),a(e,d,2),a(e,d,3),a(e,d,4),a(e,d,5)];t.some((e,t)=>e!==h[t])&&(u.setOrientation(...t),h=t);let n=[a(e,d,6),a(e,d,7),a(e,d,8)];n.some((e,t)=>e!==g[t])&&(u.setPosition(...n),g=n)},f.connect(e)},v=e=>t=>{t!==h[e]&&(h[e]=t,u.setOrientation(...h))},y=e=>t=>{t!==g[e]&&(g[e]=t,u.setPosition(...g))},b=(t,r,a)=>{let o=n(l,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,offset:r});o.connect(f,0,t),o.start(),Object.defineProperty(o.offset,"defaultValue",{get(){return r}});let u=e({context:c},p,o.offset,wc,Cc);return s(u,`value`,e=>()=>e.call(u),e=>t=>{try{e.call(u,t)}catch(e){if(e.code!==9)throw e}_(),p&&a(t)}),u.cancelAndHoldAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.cancelAndHoldAtTime),u.cancelScheduledValues=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.cancelScheduledValues),u.exponentialRampToValueAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.exponentialRampToValueAtTime),u.linearRampToValueAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.linearRampToValueAtTime),u.setTargetAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.setTargetAtTime),u.setValueAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.setValueAtTime),u.setValueCurveAtTime=(e=>p?()=>{throw i()}:(...t)=>{let n=e.apply(u,t);return _(),n})(u.setValueCurveAtTime),u};return{forwardX:b(0,0,v(0)),forwardY:b(1,0,v(1)),forwardZ:b(2,-1,v(2)),positionX:b(6,0,y(0)),positionY:b(7,0,y(1)),positionZ:b(8,0,y(2)),upX:b(3,0,v(3)),upY:b(4,1,v(4)),upZ:b(5,0,v(5))}})():u;return{get forwardX(){return d},get forwardY(){return f},get forwardZ(){return p},get positionX(){return m},get positionY(){return h},get positionZ(){return g},get upX(){return _},get upY(){return v},get upZ(){return y}}},Wc=e=>`context`in e,Gc=e=>Wc(e[0]),Kc=(e,t,n,r)=>{for(let t of e)if(n(t)){if(r)return!1;throw Error(`The set contains at least one similar element.`)}return e.add(t),!0},qc=(e,t,[n,r],i)=>{Kc(e,[t,n,r],e=>e[0]===t&&e[1]===n,i)},Jc=(e,[t,n,r],i)=>{let a=e.get(t);a===void 0?e.set(t,new Set([[n,r]])):Kc(a,[n,r],e=>e[0]===n,i)},Yc=e=>`inputs`in e,Xc=(e,t,n,r)=>{if(Yc(t)){let i=t.inputs[r];return e.connect(i,n,0),[i,n,0]}return e.connect(t,n,r),[t,n,r]},Zc=(e,t,n)=>{for(let r of e)if(r[0]===t&&r[1]===n)return e.delete(r),r;return null},Qc=(e,t,n)=>rc(e,e=>e[0]===t&&e[1]===n),$c=(e,t)=>{if(!ac(e).delete(t))throw Error(`Missing the expected event listener.`)},el=(e,t,n)=>{let r=nc(e,t),i=rc(r,e=>e[0]===n);return r.size===0&&e.delete(t),i},tl=(e,t,n,r)=>{Yc(t)?e.disconnect(t.inputs[r],n,0):e.disconnect(t,n,r)},R=e=>nc(Vs,e),nl=e=>nc(Us,e),rl=e=>Ks.has(e),il=e=>!zs.has(e),al=(e,t)=>new Promise(n=>{if(t!==null)n(!0);else{let t=e.createScriptProcessor(256,1,1),r=e.createGain(),i=e.createBuffer(1,2,44100),a=i.getChannelData(0);a[0]=1,a[1]=1;let o=e.createBufferSource();o.buffer=i,o.loop=!0,o.connect(t).connect(e.destination),o.connect(r),o.disconnect(r),t.onaudioprocess=r=>{let i=r.inputBuffer.getChannelData(0);Array.prototype.some.call(i,e=>e===1)?n(!0):n(!1),o.stop(),t.onaudioprocess=null,o.disconnect(t),t.disconnect(e.destination)},o.start()}}),ol=(e,t)=>{let n=new Map;for(let t of e)for(let e of t){let t=n.get(e);n.set(e,t===void 0?1:t+1)}n.forEach((e,n)=>t(n,e))},sl=e=>`context`in e,cl=e=>{let t=new Map;e.connect=(e=>(n,r=0,i=0)=>{let a=sl(n)?e(n,r,i):e(n,r),o=t.get(n);return o===void 0?t.set(n,[{input:i,output:r}]):o.every(e=>e.input!==i||e.output!==r)&&o.push({input:i,output:r}),a})(e.connect.bind(e)),e.disconnect=(n=>(r,i,a)=>{if(n.apply(e),r===void 0)t.clear();else if(typeof r==`number`)for(let[e,n]of t){let i=n.filter(e=>e.output!==r);i.length===0?t.delete(e):t.set(e,i)}else if(t.has(r))if(i===void 0)t.delete(r);else{let e=t.get(r);if(e!==void 0){let n=e.filter(e=>e.output!==i&&(e.input!==a||a===void 0));n.length===0?t.delete(r):t.set(r,n)}}for(let[n,r]of t)r.forEach(t=>{sl(n)?e.connect(n,t.output,t.input):e.connect(n,t.output)})})(e.disconnect)},ll=(e,t,n,r)=>{let{activeInputs:i,passiveInputs:a}=Ic(t),{outputs:o}=Fc(e),s=ac(e),c=o=>{let s=R(e),c=nl(t);if(o){let t=el(a,e,n);qc(i,e,t,!1),!r&&!rl(e)&&s.connect(c,n)}else{let t=Qc(i,e,n);Jc(a,t,!1),!r&&!rl(e)&&s.disconnect(c,n)}};return Kc(o,[t,n],e=>e[0]===t&&e[1]===n,!0)?(s.add(c),Tc(e)?qc(i,e,[n,c],!0):Jc(a,[e,n,c],!0),!0):!1},ul=(e,t,n,r)=>{let{activeInputs:i,passiveInputs:a}=Fc(t),o=Zc(i[r],e,n);return o===null?[ic(a,e,n,r)[2],!1]:[o[2],!0]},dl=(e,t,n)=>{let{activeInputs:r,passiveInputs:i}=Ic(t),a=Zc(r,e,n);return a===null?[el(i,e,n)[1],!1]:[a[2],!0]},fl=(e,t,n,r,i)=>{let[a,o]=ul(e,n,r,i);if(a!==null&&($c(e,a),o&&!t&&!rl(e)&&tl(R(e),R(n),r,i)),Tc(n)){let{activeInputs:e}=Fc(n);lc(n,e)}},pl=(e,t,n,r)=>{let[i,a]=dl(e,n,r);i!==null&&($c(e,i),a&&!t&&!rl(e)&&R(e).disconnect(nl(n),r))},ml=(e,t)=>{let n=Fc(e),r=[];for(let i of n.outputs)Gc(i)?fl(e,t,...i):pl(e,t,...i),r.push(i[0]);return n.outputs.clear(),r},hl=(e,t,n)=>{let r=Fc(e),i=[];for(let a of r.outputs)a[1]===n&&(Gc(a)?fl(e,t,...a):pl(e,t,...a),i.push(a[0]),r.outputs.delete(a));return i},gl=(e,t,n,r,i)=>{let a=Fc(e);return Array.from(a.outputs).filter(e=>e[0]===n&&(r===void 0||e[1]===r)&&(i===void 0||e[2]===i)).map(n=>(Gc(n)?fl(e,t,...n):pl(e,t,...n),a.outputs.delete(n),n[0]))},_l=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)=>class extends l{constructor(t,r,i,a){super(i),this._context=t,this._nativeAudioNode=i;let o=u(t);d(o)&&!0!==n(al,()=>al(o,h))&&cl(i),Vs.set(this,i),Gs.set(this,new Set),t.state!==`closed`&&r&&oc(this),e(this,a,i)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(e){this._nativeAudioNode.channelCount=e}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(e){this._nativeAudioNode.channelCountMode=e}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(e){this._nativeAudioNode.channelInterpretation=e}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(e,n=0,s=0){if(n<0||n>=this._nativeAudioNode.numberOfOutputs)throw i();let l=m(u(this._context));if(f(e)||p(e))throw a();if(Wc(e)){let i=R(e);try{let t=Xc(this._nativeAudioNode,i,n,s),r=il(this);(l||r)&&this._nativeAudioNode.disconnect(...t),this.context.state!==`closed`&&!r&&il(e)&&oc(e)}catch(e){throw e.code===12?a():e}return t(this,e,n,s,l)&&ol(c([this],e),r(l)),e}let d=nl(e);if(d.name===`playbackRate`&&d.maxValue===1024)throw o();try{this._nativeAudioNode.connect(d,n),(l||il(this))&&this._nativeAudioNode.disconnect(d,n)}catch(e){throw e.code===12?a():e}ll(this,e,n,l)&&ol(c([this],e),r(l))}disconnect(e,t,n){let r,o=m(u(this._context));if(e===void 0)r=ml(this,o);else if(typeof e==`number`){if(e<0||e>=this.numberOfOutputs)throw i();r=hl(this,o,e)}else{if(t!==void 0&&(t<0||t>=this.numberOfOutputs)||Wc(e)&&n!==void 0&&(n<0||n>=e.numberOfInputs))throw i();if(r=gl(this,o,e,t,n),r.length===0)throw a()}for(let e of r)ol(c([this],e),s)}},vl=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>(p,m,h,g=null,_=null)=>{let v=h.value,y=new Ps.AutomationEventList(v),b=m?r(y):null,x={get defaultValue(){return v},get maxValue(){return g===null?h.maxValue:g},get minValue(){return _===null?h.minValue:_},get value(){return h.value},set value(e){h.value=e,x.setValueAtTime(e,p.context.currentTime)},cancelAndHoldAtTime(e){if(typeof h.cancelAndHoldAtTime==`function`)b===null&&y.flush(p.context.currentTime),y.add(i(e)),h.cancelAndHoldAtTime(e);else{let t=Array.from(y).pop();b===null&&y.flush(p.context.currentTime),y.add(i(e));let n=Array.from(y).pop();h.cancelScheduledValues(e),t!==n&&n!==void 0&&(n.type===`exponentialRampToValue`?h.exponentialRampToValueAtTime(n.value,n.endTime):n.type===`linearRampToValue`?h.linearRampToValueAtTime(n.value,n.endTime):n.type===`setValue`?h.setValueAtTime(n.value,n.startTime):n.type===`setValueCurve`&&h.setValueCurveAtTime(n.values,n.startTime,n.duration))}return x},cancelScheduledValues(e){return b===null&&y.flush(p.context.currentTime),y.add(a(e)),h.cancelScheduledValues(e),x},exponentialRampToValueAtTime(e,t){if(e===0||!Number.isFinite(t)||t<0)throw RangeError();let n=p.context.currentTime;return b===null&&y.flush(n),Array.from(y).length===0&&(y.add(l(v,n)),h.setValueAtTime(v,n)),y.add(o(e,t)),h.exponentialRampToValueAtTime(e,t),x},linearRampToValueAtTime(e,t){let n=p.context.currentTime;return b===null&&y.flush(n),Array.from(y).length===0&&(y.add(l(v,n)),h.setValueAtTime(v,n)),y.add(s(e,t)),h.linearRampToValueAtTime(e,t),x},setTargetAtTime(e,t,n){return b===null&&y.flush(p.context.currentTime),y.add(c(e,t,n)),h.setTargetAtTime(e,t,n),x},setValueAtTime(e,t){return b===null&&y.flush(p.context.currentTime),y.add(l(e,t)),h.setValueAtTime(e,t),x},setValueCurveAtTime(e,t,n){let r=e instanceof Float32Array?e:new Float32Array(e);if(d!==null&&d.name===`webkitAudioContext`){let e=t+n,i=p.context.sampleRate,a=Math.ceil(t*i),o=Math.floor(e*i),s=o-a,c=new Float32Array(s);for(let e=0;e<s;e+=1){let o=(r.length-1)/n*((a+e)/i-t),s=Math.floor(o),l=Math.ceil(o);c[e]=s===l?r[s]:(1-(o-s))*r[s]+(1-(l-o))*r[l]}b===null&&y.flush(p.context.currentTime),y.add(u(c,t,n)),h.setValueCurveAtTime(c,t,n);let l=o/i;l<e&&f(x,c[c.length-1],l),f(x,r[r.length-1],e)}else b===null&&y.flush(p.context.currentTime),y.add(u(r,t,n)),h.setValueCurveAtTime(r,t,n);return x}};return n.set(x,h),t.set(x,p),e(x,b),x},yl=e=>({replay(t){for(let n of e)if(n.type===`exponentialRampToValue`){let{endTime:e,value:r}=n;t.exponentialRampToValueAtTime(r,e)}else if(n.type===`linearRampToValue`){let{endTime:e,value:r}=n;t.linearRampToValueAtTime(r,e)}else if(n.type===`setTarget`){let{startTime:e,target:r,timeConstant:i}=n;t.setTargetAtTime(r,e,i)}else if(n.type===`setValue`){let{startTime:e,value:r}=n;t.setValueAtTime(r,e)}else if(n.type===`setValueCurve`){let{duration:e,startTime:r,values:i}=n;t.setValueCurveAtTime(i,r,e)}else throw Error(`Can't apply an unknown automation.`)}}),bl=class{constructor(e){this._map=new Map(e)}get size(){return this._map.size}entries(){return this._map.entries()}forEach(e,t=null){return this._map.forEach((n,r)=>e.call(t,n,r,this))}get(e){return this._map.get(e)}has(e){return this._map.has(e)}keys(){return this._map.keys()}values(){return this._map.values()}},xl={channelCount:2,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:1,numberOfOutputs:1,parameterData:{},processorOptions:{}},Sl=(e,t,n,r,i,a,o,s,c,l,u,d,f,p)=>class extends t{constructor(t,p,m){let h=s(t),g=c(h),_=u({...xl,...m});f(_);let v=qs.get(h)?.get(p),y=i(g||h.state!==`closed`?h:o(h)??h,g?null:t.baseLatency,l,p,v,_),b=g?r(p,_,v):null;super(t,!0,y,b);let x=[];y.parameters.forEach((e,t)=>{let r=n(this,g,e);x.push([t,r])}),this._nativeAudioWorkletNode=y,this._onprocessorerror=null,this._parameters=new bl(x),g&&e(h,this);let{activeInputs:S}=a(this);d(y,S)}get onprocessorerror(){return this._onprocessorerror}set onprocessorerror(e){let t=typeof e==`function`?p(this,e):null;this._nativeAudioWorkletNode.onprocessorerror=t;let n=this._nativeAudioWorkletNode.onprocessorerror;this._onprocessorerror=n!==null&&n===t?e:n}get parameters(){return this._parameters===null?this._nativeAudioWorkletNode.parameters:this._parameters}get port(){return this._nativeAudioWorkletNode.port}};function Cl(e,t,n,r,i){if(typeof e.copyFromChannel==`function`)t[n].byteLength===0&&(t[n]=new Float32Array(128)),e.copyFromChannel(t[n],r,i);else{let a=e.getChannelData(r);if(t[n].byteLength===0)t[n]=a.slice(i,i+128);else{let e=new Float32Array(a.buffer,i*Float32Array.BYTES_PER_ELEMENT,128);t[n].set(e)}}}var wl=(e,t,n,r,i)=>{typeof e.copyToChannel==`function`?t[n].byteLength!==0&&e.copyToChannel(t[n],r,i):t[n].byteLength!==0&&e.getChannelData(r).set(t[n],i)},Tl=(e,t)=>{let n=[];for(let r=0;r<e;r+=1){let e=[],i=typeof t==`number`?t:t[r];for(let t=0;t<i;t+=1)e.push(new Float32Array(128));n.push(e)}return n},El=(e,t)=>nc(nc(Js,e),R(t)),Dl=async(e,t,n,r,i,a,o)=>{let s=t===null?Math.ceil(e.context.length/128)*128:t.length,c=r.channelCount*r.numberOfInputs,l=i.reduce((e,t)=>e+t,0),u=l===0?null:n.createBuffer(l,s,n.sampleRate);if(a===void 0)throw Error(`Missing the processor constructor.`);let d=Fc(e),f=await El(n,e),p=Tl(r.numberOfInputs,r.channelCount),m=Tl(r.numberOfOutputs,i),h=Array.from(e.parameters.keys()).reduce((e,t)=>({...e,[t]:new Float32Array(128)}),{});for(let l=0;l<s;l+=128){if(r.numberOfInputs>0&&t!==null)for(let e=0;e<r.numberOfInputs;e+=1)for(let n=0;n<r.channelCount;n+=1)Cl(t,p[e],n,n,l);a.parameterDescriptors!==void 0&&t!==null&&a.parameterDescriptors.forEach(({name:e},n)=>{Cl(t,h,e,c+n,l)});for(let e=0;e<r.numberOfInputs;e+=1)for(let t=0;t<i[e];t+=1)m[e][t].byteLength===0&&(m[e][t]=new Float32Array(128));try{let e=p.map((e,t)=>d.activeInputs[t].size===0?[]:e),t=o(l/n.sampleRate,n.sampleRate,()=>f.process(e,m,h));if(u!==null)for(let e=0,t=0;e<r.numberOfOutputs;e+=1){for(let n=0;n<i[e];n+=1)wl(u,m[e],n,t+n,l);t+=i[e]}if(!t)break}catch(t){e.dispatchEvent(new ErrorEvent(`processorerror`,{colno:t.colno,filename:t.filename,lineno:t.lineno,message:t.message}));break}}return u},Ol=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)=>(g,_,v)=>{let y=new WeakMap,b=null,x=async(s,x)=>{let S=u(s),C=null,w=gc(S,x),T=Array.isArray(_.outputChannelCount)?_.outputChannelCount:Array.from(_.outputChannelCount);if(d===null){let e=T.reduce((e,t)=>e+t,0),n=i(x,{channelCount:Math.max(1,e),channelCountMode:`explicit`,channelInterpretation:`discrete`,numberOfOutputs:Math.max(1,e)}),a=[];for(let e=0;e<s.numberOfOutputs;e+=1)a.push(r(x,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:T[e]}));let l=o(x,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1});l.connect=t.bind(null,a),l.disconnect=c.bind(null,a),C=[n,a,l]}else w||(S=new d(x,g));if(y.set(x,C===null?S:C[2]),C!==null){if(b===null){if(v===void 0)throw Error(`Missing the processor constructor.`);if(f===null)throw Error(`Missing the native OfflineAudioContext constructor.`);let e=s.channelCount*s.numberOfInputs,t=v.parameterDescriptors===void 0?0:v.parameterDescriptors.length,n=e+t;b=Dl(s,n===0?null:await(async()=>{let c=new f(n,Math.ceil(s.context.length/128)*128,x.sampleRate),l=[],u=[];for(let e=0;e<_.numberOfInputs;e+=1)l.push(o(c,{channelCount:_.channelCount,channelCountMode:_.channelCountMode,channelInterpretation:_.channelInterpretation,gain:1})),u.push(i(c,{channelCount:_.channelCount,channelCountMode:`explicit`,channelInterpretation:`discrete`,numberOfOutputs:_.channelCount}));let d=await Promise.all(Array.from(s.parameters.values()).map(async e=>{let t=a(c,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,offset:e.value});return await p(c,e,t.offset),t})),g=r(c,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:Math.max(1,e+t)});for(let e=0;e<_.numberOfInputs;e+=1){l[e].connect(u[e]);for(let t=0;t<_.channelCount;t+=1)u[e].connect(g,t,e*_.channelCount+t)}for(let[t,n]of d.entries())n.connect(g,0,e+t),n.start(0);return g.connect(c.destination),await Promise.all(l.map(e=>m(s,c,e))),h(c)})(),x,_,T,v,l)}let e=await b,t=n(x,{buffer:null,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),[c,u,d]=C;e!==null&&(t.buffer=e,t.start(0)),t.connect(c);for(let e=0,t=0;e<s.numberOfOutputs;e+=1){let n=u[e];for(let r=0;r<T[e];r+=1)c.connect(n,t+r,r);t+=T[e]}return d}if(w)for(let[t,n]of s.parameters.entries())await e(x,n,S.parameters.get(t));else for(let[e,t]of s.parameters.entries())await p(x,t,S.parameters.get(e));return await m(s,x,S),S};return{render(e,t){s(t,e);let n=y.get(t);return n===void 0?x(e,t):Promise.resolve(n)}}},kl=(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y)=>class extends m{constructor(t,n){super(t,n),this._nativeContext=t,this._audioWorklet=e===void 0?void 0:{addModule:(t,n)=>e(this,t,n)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new t(this)}createBiquadFilter(){return new i(this)}createBuffer(e,t,r){return new n({length:t,numberOfChannels:e,sampleRate:r})}createBufferSource(){return new r(this)}createChannelMerger(e=6){return new a(this,{numberOfInputs:e})}createChannelSplitter(e=6){return new o(this,{numberOfOutputs:e})}createConstantSource(){return new s(this)}createConvolver(){return new c(this)}createDelay(e=1){return new u(this,{maxDelayTime:e})}createDynamicsCompressor(){return new d(this)}createGain(){return new f(this)}createIIRFilter(e,t){return new p(this,{feedback:t,feedforward:e})}createOscillator(){return new h(this)}createPanner(){return new g(this)}createPeriodicWave(e,t,n={disableNormalization:!1}){return new _(this,{...n,imag:t,real:e})}createStereoPanner(){return new v(this)}createWaveShaper(){return new y(this)}decodeAudioData(e,t,n){return l(this._nativeContext,e).then(e=>(typeof t==`function`&&t(e),e),e=>{throw typeof n==`function`&&n(e),e})}},Al={Q:1,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,detune:0,frequency:350,gain:0,type:`lowpass`},jl=(e,t,n,r,i,a,o,s)=>class extends e{constructor(e,r){let c=a(e),l=i(c,{...Al,...r}),u=o(c),d=u?n():null;super(e,!1,l,d),this._Q=t(this,u,l.Q,wc,Cc),this._detune=t(this,u,l.detune,1200*Math.log2(wc),-1200*Math.log2(wc)),this._frequency=t(this,u,l.frequency,e.sampleRate/2,0),this._gain=t(this,u,l.gain,40*Math.log10(wc),Cc),this._nativeBiquadFilterNode=l,s(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(e){this._nativeBiquadFilterNode.type=e}getFrequencyResponse(e,t,n){try{this._nativeBiquadFilterNode.getFrequencyResponse(e,t,n)}catch(e){throw e.code===11?r():e}if(e.length!==t.length||t.length!==n.length)throw r()}},Ml=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=async(o,s)=>{let c=n(o),l=gc(c,s);return l||(c=t(s,{Q:c.Q.value,channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,detune:c.detune.value,frequency:c.frequency.value,gain:c.gain.value,type:c.type})),a.set(s,c),l?(await e(s,o.Q,c.Q),await e(s,o.detune,c.detune),await e(s,o.frequency,c.frequency),await e(s,o.gain,c.gain)):(await r(s,o.Q,c.Q),await r(s,o.detune,c.detune),await r(s,o.frequency,c.frequency),await r(s,o.gain,c.gain)),await i(o,s,c),c};return{render(e,t){let n=a.get(t);return n===void 0?o(e,t):Promise.resolve(n)}}},Nl=(e,t)=>(n,r)=>{let i=t.get(n);if(i!==void 0)return i;let a=e.get(n);if(a!==void 0)return a;try{let i=r();return i instanceof Promise?(e.set(n,i),i.catch(()=>!1).then(r=>(e.delete(n),t.set(n,r),r))):(t.set(n,i),i)}catch{return t.set(n,!1),!1}},Pl={channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:6},Fl=(e,t,n,r,i)=>class extends e{constructor(e,a){let o=r(e),s=n(o,{...Pl,...a}),c=i(o)?t():null;super(e,!1,s,c)}},Il=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return gc(o,a)||(o=e(a,{channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfInputs:o.numberOfInputs})),r.set(a,o),await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},Ll={channelCount:6,channelCountMode:`explicit`,channelInterpretation:`discrete`,numberOfOutputs:6},Rl=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=r(e),c=n(s,a({...Ll,...o})),l=i(s)?t():null;super(e,!1,c,l)}},zl=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return gc(o,a)||(o=e(a,{channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,numberOfOutputs:o.numberOfOutputs})),r.set(a,o),await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},Bl=e=>(t,n,r)=>e(n,t,r),Vl=e=>(t,n,r=0,i=0)=>{let a=t[r];if(a===void 0)throw e();return sl(n)?a.connect(n,0,i):a.connect(n,0)},Hl=e=>(t,n)=>{let r=e(t,{buffer:null,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,loop:!1,loopEnd:0,loopStart:0,playbackRate:1});return r.buffer=t.createBuffer(1,2,44100),r.loop=!0,r.connect(n),r.start(),()=>{r.stop(),r.disconnect(n)}},Ul={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,offset:1},Wl=(e,t,n,r,i,a,o)=>class extends e{constructor(e,o){let s=i(e),c=r(s,{...Ul,...o}),l=a(s),u=l?n():null;super(e,!1,c,u),this._constantSourceNodeRenderer=u,this._nativeConstantSourceNode=c,this._offset=t(this,l,c.offset,wc,Cc),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(e){let t=typeof e==`function`?o(this,e):null;this._nativeConstantSourceNode.onended=t;let n=this._nativeConstantSourceNode.onended;this._onended=n!==null&&n===t?e:n}start(e=0){if(this._nativeConstantSourceNode.start(e),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.start=e),this.context.state!==`closed`){oc(this);let e=()=>{this._nativeConstantSourceNode.removeEventListener(`ended`,e),Tc(this)&&cc(this)};this._nativeConstantSourceNode.addEventListener(`ended`,e)}}stop(e=0){this._nativeConstantSourceNode.stop(e),this._constantSourceNodeRenderer!==null&&(this._constantSourceNodeRenderer.stop=e)}},Gl=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=null,s=null,c=async(c,l)=>{let u=n(c),d=gc(u,l);return d||(u=t(l,{channelCount:u.channelCount,channelCountMode:u.channelCountMode,channelInterpretation:u.channelInterpretation,offset:u.offset.value}),o!==null&&u.start(o),s!==null&&u.stop(s)),a.set(l,u),d?await e(l,c.offset,u.offset):await r(l,c.offset,u.offset),await i(c,l,u),u};return{set start(e){o=e},set stop(e){s=e},render(e,t){let n=a.get(t);return n===void 0?c(e,t):Promise.resolve(n)}}},Kl=e=>t=>(e[0]=t,e[0]),ql={buffer:null,channelCount:2,channelCountMode:`clamped-max`,channelInterpretation:`speakers`,disableNormalization:!1},Jl=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=r(e),c={...ql,...o},l=n(s,c),u=i(s)?t():null;super(e,!1,l,u),this._isBufferNullified=!1,this._nativeConvolverNode=l,c.buffer!==null&&a(this,c.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(e){if(this._nativeConvolverNode.buffer=e,e===null&&this._nativeConvolverNode.buffer!==null){let e=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=e.createBuffer(1,1,e.sampleRate),this._isBufferNullified=!0,a(this,0)}else this._isBufferNullified=!1,a(this,this._nativeConvolverNode.buffer===null?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(e){this._nativeConvolverNode.normalize=e}},Yl=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return gc(o,a)||(o=e(a,{buffer:o.buffer,channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,disableNormalization:!o.normalize})),r.set(a,o),Yc(o)?await n(i,a,o.inputs[0]):await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},Xl=(e,t)=>(n,r,i)=>{if(t===null)throw Error(`Missing the native OfflineAudioContext constructor.`);try{return new t(n,r,i)}catch(t){throw t.name===`SyntaxError`?e():t}},Zl=()=>new DOMException(``,`DataCloneError`),Ql=e=>{let{port1:t,port2:n}=new MessageChannel;return new Promise(r=>{let i=()=>{n.onmessage=null,t.close(),n.close(),r()};n.onmessage=()=>i();try{t.postMessage(e,[e])}catch{}finally{i()}})},$l=(e,t,n,r,i,a,o,s,c,l,u)=>(d,f)=>{let p=o(d)?d:a(d);if(i.has(f)){let e=n();return Promise.reject(e)}try{i.add(f)}catch{}return t(c,()=>c(p))?p.decodeAudioData(f).then(n=>(Ql(f).catch(()=>{}),t(s,()=>s(n))||u(n),e.add(n),n)):new Promise((t,n)=>{let i=async()=>{try{await Ql(f)}catch{}},a=e=>{n(e),i()};try{p.decodeAudioData(f,n=>{typeof n.copyFromChannel!=`function`&&(l(n),bc(n)),e.add(n),i().then(()=>t(n))},e=>{a(e===null?r():e)})}catch(e){a(e)}})},eu=(e,t,n,r,i,a,o,s)=>(c,l)=>{let u=t.get(c);if(u===void 0)throw Error(`Missing the expected cycle count.`);let d=s(a(c.context));if(u===l){if(t.delete(c),!d&&o(c)){let t=r(c),{outputs:a}=n(c);for(let n of a)if(Gc(n))e(t,r(n[0]),n[1],n[2]);else{let e=i(n[0]);t.connect(e,n[1])}}}else t.set(c,u-l)},tu={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,delayTime:0,maxDelayTime:1},nu=(e,t,n,r,i,a,o)=>class extends e{constructor(e,s){let c=i(e),l={...tu,...s},u=r(c,l),d=a(c),f=d?n(l.maxDelayTime):null;super(e,!1,u,f),this._delayTime=t(this,d,u.delayTime),o(this,l.maxDelayTime)}get delayTime(){return this._delayTime}},ru=(e,t,n,r,i)=>a=>{let o=new WeakMap,s=async(s,c)=>{let l=n(s),u=gc(l,c);return u||(l=t(c,{channelCount:l.channelCount,channelCountMode:l.channelCountMode,channelInterpretation:l.channelInterpretation,delayTime:l.delayTime.value,maxDelayTime:a})),o.set(c,l),u?await e(c,s.delayTime,l.delayTime):await r(c,s.delayTime,l.delayTime),await i(s,c,l),l};return{render(e,t){let n=o.get(t);return n===void 0?s(e,t):Promise.resolve(n)}}},iu=e=>(t,n,r,i)=>e(t[i],e=>e[0]===n&&e[1]===r),au=e=>(t,n)=>{e(t).delete(n)},ou=e=>`delayTime`in e,su=(e,t,n)=>function r(i,a){let o=Wc(a)?a:n(e,a);if(ou(o))return[];if(i[0]===o)return[i];if(i.includes(o))return[];let{outputs:s}=t(o);return Array.from(s).map(e=>r([...i,o],e[0])).reduce((e,t)=>e.concat(t),[])},cu=(e,t,n)=>{let r=t[n];if(r===void 0)throw e();return r},lu=e=>(t,n=void 0,r=void 0,i=0)=>n===void 0?t.forEach(e=>e.disconnect()):typeof n==`number`?cu(e,t,n).disconnect():sl(n)?r===void 0?t.forEach(e=>e.disconnect(n)):i===void 0?cu(e,t,r).disconnect(n,0):cu(e,t,r).disconnect(n,0,i):r===void 0?t.forEach(e=>e.disconnect(n)):cu(e,t,r).disconnect(n,0),uu={attack:.003,channelCount:2,channelCountMode:`clamped-max`,channelInterpretation:`speakers`,knee:30,ratio:12,release:.25,threshold:-24},du=(e,t,n,r,i,a,o,s)=>class extends e{constructor(e,i){let c=a(e),l=r(c,{...uu,...i}),u=o(c),d=u?n():null;super(e,!1,l,d),this._attack=t(this,u,l.attack),this._knee=t(this,u,l.knee),this._nativeDynamicsCompressorNode=l,this._ratio=t(this,u,l.ratio),this._release=t(this,u,l.release),this._threshold=t(this,u,l.threshold),s(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(e){let t=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=e,e>2)throw this._nativeDynamicsCompressorNode.channelCount=t,i()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(e){let t=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=e,e===`max`)throw this._nativeDynamicsCompressorNode.channelCountMode=t,i()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return typeof this._nativeDynamicsCompressorNode.reduction.value==`number`?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}},fu=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=async(o,s)=>{let c=n(o),l=gc(c,s);return l||(c=t(s,{attack:c.attack.value,channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,knee:c.knee.value,ratio:c.ratio.value,release:c.release.value,threshold:c.threshold.value})),a.set(s,c),l?(await e(s,o.attack,c.attack),await e(s,o.knee,c.knee),await e(s,o.ratio,c.ratio),await e(s,o.release,c.release),await e(s,o.threshold,c.threshold)):(await r(s,o.attack,c.attack),await r(s,o.knee,c.knee),await r(s,o.ratio,c.ratio),await r(s,o.release,c.release),await r(s,o.threshold,c.threshold)),await i(o,s,c),c};return{render(e,t){let n=a.get(t);return n===void 0?o(e,t):Promise.resolve(n)}}},pu=()=>new DOMException(``,`EncodingError`),mu=e=>t=>new Promise((n,r)=>{if(e===null){r(SyntaxError());return}let i=e.document.head;if(i===null)r(SyntaxError());else{let a=e.document.createElement(`script`),o=new Blob([t],{type:`application/javascript`}),s=URL.createObjectURL(o),c=e.onerror,l=()=>{e.onerror=c,URL.revokeObjectURL(s)};e.onerror=(t,n,i,a,o)=>{if(n===s||n===e.location.href&&i===1&&a===1)return l(),r(o),!1;if(c!==null)return c(t,n,i,a,o)},a.onerror=()=>{l(),r(SyntaxError())},a.onload=()=>{l(),n()},a.src=s,a.type=`module`,i.appendChild(a)}}),hu=e=>class{constructor(e){this._nativeEventTarget=e,this._listeners=new WeakMap}addEventListener(t,n,r){if(n!==null){let i=this._listeners.get(n);i===void 0&&(i=e(this,n),typeof n==`function`&&this._listeners.set(n,i)),this._nativeEventTarget.addEventListener(t,i,r)}}dispatchEvent(e){return this._nativeEventTarget.dispatchEvent(e)}removeEventListener(e,t,n){let r=t===null?void 0:this._listeners.get(t);this._nativeEventTarget.removeEventListener(e,r===void 0?null:r,n)}},gu=e=>(t,n,r)=>{Object.defineProperties(e,{currentFrame:{configurable:!0,get(){return Math.round(t*n)}},currentTime:{configurable:!0,get(){return t}}});try{return r()}finally{e!==null&&(delete e.currentFrame,delete e.currentTime)}},_u=e=>async t=>{try{let e=await fetch(t);if(e.ok)return[await e.text(),e.url]}catch{}throw e()},vu={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,gain:1},yu=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=i(e),c=r(s,{...vu,...o}),l=a(s),u=l?n():null;super(e,!1,c,u),this._gain=t(this,l,c.gain,wc,Cc)}get gain(){return this._gain}},bu=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=async(o,s)=>{let c=n(o),l=gc(c,s);return l||(c=t(s,{channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,gain:c.gain.value})),a.set(s,c),l?await e(s,o.gain,c.gain):await r(s,o.gain,c.gain),await i(o,s,c),c};return{render(e,t){let n=a.get(t);return n===void 0?o(e,t):Promise.resolve(n)}}},xu=(e,t)=>n=>t(e,n),Su=e=>t=>{let n=e(t);if(n.renderer===null)throw Error(`Missing the renderer of the given AudioNode in the audio graph.`);return n.renderer},Cu=e=>t=>e.get(t)??0,wu=e=>t=>{let n=e(t);if(n.renderer===null)throw Error(`Missing the renderer of the given AudioParam in the audio graph.`);return n.renderer},Tu=e=>t=>e.get(t),z=()=>new DOMException(``,`InvalidStateError`),Eu=e=>t=>{let n=e.get(t);if(n===void 0)throw z();return n},Du=(e,t)=>n=>{let r=e.get(n);if(r!==void 0)return r;if(t===null)throw Error(`Missing the native OfflineAudioContext constructor.`);return r=new t(1,1,44100),e.set(n,r),r},Ou=e=>t=>{let n=e.get(t);if(n===void 0)throw Error(`The context has no set of AudioWorkletNodes.`);return n},ku=()=>new DOMException(``,`InvalidAccessError`),Au=e=>{e.getFrequencyResponse=(t=>(n,r,i)=>{if(n.length!==r.length||r.length!==i.length)throw ku();return t.call(e,n,r,i)})(e.getFrequencyResponse)},ju={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`},Mu=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=r(e),c=i(s),l={...ju,...o},u=t(s,c?null:e.baseLatency,l),d=c?n(l.feedback,l.feedforward):null;super(e,!1,u,d),Au(u),this._nativeIIRFilterNode=u,a(this,1)}getFrequencyResponse(e,t,n){return this._nativeIIRFilterNode.getFrequencyResponse(e,t,n)}},Nu=(e,t,n,r,i,a,o,s,c,l,u)=>{let d=l.length,f=s;for(let s=0;s<d;s+=1){let d=n[0]*l[s];for(let t=1;t<i;t+=1){let r=f-t&c-1;d+=n[t]*a[r],d-=e[t]*o[r]}for(let e=i;e<r;e+=1)d+=n[e]*a[f-e&c-1];for(let n=i;n<t;n+=1)d-=e[n]*o[f-n&c-1];a[f]=l[s],o[f]=d,f=f+1&c-1,u[s]=d}return f},Pu=(e,t,n,r)=>{let i=n instanceof Float64Array?n:new Float64Array(n),a=r instanceof Float64Array?r:new Float64Array(r),o=i.length,s=a.length,c=Math.min(o,s);if(i[0]!==1){for(let e=0;e<o;e+=1)a[e]/=i[0];for(let e=1;e<s;e+=1)i[e]/=i[0]}let l=new Float32Array(32),u=new Float32Array(32),d=t.createBuffer(e.numberOfChannels,e.length,e.sampleRate),f=e.numberOfChannels;for(let t=0;t<f;t+=1){let n=e.getChannelData(t),r=d.getChannelData(t);l.fill(0),u.fill(0),Nu(i,o,a,s,c,l,u,0,32,n,r)}return d},Fu=(e,t,n,r,i)=>(a,o)=>{let s=new WeakMap,c=null,l=async(l,u)=>{let d=null,f=t(l),p=gc(f,u);if(u.createIIRFilter===void 0?d=e(u,{buffer:null,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):p||(f=u.createIIRFilter(o,a)),s.set(u,d===null?f:d),d!==null){if(c===null){if(n===null)throw Error(`Missing the native OfflineAudioContext constructor.`);let e=new n(l.context.destination.channelCount,l.context.length,u.sampleRate);c=(async()=>(await r(l,e,e.destination),Pu(await i(e),u,a,o)))()}let e=await c;return d.buffer=e,d.start(0),d}return await r(l,u,f),f};return{render(e,t){let n=s.get(t);return n===void 0?l(e,t):Promise.resolve(n)}}},Iu=(e,t,n,r,i,a)=>o=>(s,c)=>{let l=e.get(s);if(l===void 0){if(!o&&a(s)){let e=r(s),{outputs:a}=n(s);for(let n of a)if(Gc(n))t(e,r(n[0]),n[1],n[2]);else{let t=i(n[0]);e.disconnect(t,n[1])}}e.set(s,c)}else e.set(s,l+c)},Lu=(e,t)=>n=>t(e.get(n))||t(n),Ru=(e,t)=>n=>e.has(n)||t(n),zu=(e,t)=>n=>e.has(n)||t(n),Bu=(e,t)=>n=>t(e.get(n))||t(n),Vu=e=>t=>e!==null&&t instanceof e,Hu=e=>t=>e!==null&&typeof e.AudioNode==`function`&&t instanceof e.AudioNode,Uu=e=>t=>e!==null&&typeof e.AudioParam==`function`&&t instanceof e.AudioParam,Wu=(e,t)=>n=>e(n)||t(n),Gu=e=>t=>e!==null&&t instanceof e,Ku=e=>e!==null&&e.isSecureContext,qu=(e,t,n,r)=>class extends e{constructor(e,i){let a=n(e),o=t(a,i);if(r(a))throw TypeError();super(e,!0,o,null),this._nativeMediaElementAudioSourceNode=o}get mediaElement(){return this._nativeMediaElementAudioSourceNode.mediaElement}},Ju={channelCount:2,channelCountMode:`explicit`,channelInterpretation:`speakers`},Yu=(e,t,n,r)=>class extends e{constructor(e,i){let a=n(e);if(r(a))throw TypeError();let o=t(a,{...Ju,...i});super(e,!1,o,null),this._nativeMediaStreamAudioDestinationNode=o}get stream(){return this._nativeMediaStreamAudioDestinationNode.stream}},Xu=(e,t,n,r)=>class extends e{constructor(e,i){let a=n(e),o=t(a,i);if(r(a))throw TypeError();super(e,!0,o,null),this._nativeMediaStreamAudioSourceNode=o}get mediaStream(){return this._nativeMediaStreamAudioSourceNode.mediaStream}},Zu=(e,t,n)=>class extends e{constructor(e,r){let i=t(n(e),r);super(e,!0,i,null)}},Qu=(e,t,n,r,i,a)=>class extends n{constructor(n,a){super(n),this._nativeContext=n,Ws.set(this,n),r(n)&&i.set(n,new Set),this._destination=new e(this,a),this._listener=t(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(e){let t=typeof e==`function`?a(this,e):null;this._nativeContext.onstatechange=t;let n=this._nativeContext.onstatechange;this._onstatechange=n!==null&&n===t?e:n}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}},$u=e=>{let t=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{let n=e.decodeAudioData(t.buffer,()=>{});return n===void 0?!1:(n.catch(()=>{}),!0)}catch{}return!1},ed=(e,t)=>(n,r,i)=>{let a=new Set;return n.connect=(i=>(o,s=0,c=0)=>{let l=a.size===0;if(t(o))return i.call(n,o,s,c),e(a,[o,s,c],e=>e[0]===o&&e[1]===s&&e[2]===c,!0),l&&r(),o;i.call(n,o,s),e(a,[o,s],e=>e[0]===o&&e[1]===s,!0),l&&r()})(n.connect),n.disconnect=(e=>(r,o,s)=>{let c=a.size>0;if(r===void 0)e.apply(n),a.clear();else if(typeof r==`number`){e.call(n,r);for(let e of a)e[1]===r&&a.delete(e)}else{t(r)?e.call(n,r,o,s):e.call(n,r,o);for(let e of a)e[0]===r&&(o===void 0||e[1]===o)&&(s===void 0||e[2]===s)&&a.delete(e)}let l=a.size===0;c&&l&&i()})(n.disconnect),n},B=(e,t,n)=>{let r=t[n];r!==void 0&&r!==e[n]&&(e[n]=r)},V=(e,t)=>{B(e,t,`channelCount`),B(e,t,`channelCountMode`),B(e,t,`channelInterpretation`)},td=e=>typeof e.getFloatTimeDomainData==`function`,nd=e=>{e.getFloatTimeDomainData=t=>{let n=new Uint8Array(t.length);e.getByteTimeDomainData(n);let r=Math.max(n.length,e.fftSize);for(let e=0;e<r;e+=1)t[e]=(n[e]-128)*.0078125;return t}},rd=(e,t)=>(n,r)=>{let i=n.createAnalyser();if(V(i,r),!(r.maxDecibels>r.minDecibels))throw t();return B(i,r,`fftSize`),B(i,r,`maxDecibels`),B(i,r,`minDecibels`),B(i,r,`smoothingTimeConstant`),e(td,()=>td(i))||nd(i),i},id=e=>e===null?null:e.hasOwnProperty(`AudioBuffer`)?e.AudioBuffer:null,H=(e,t,n)=>{let r=t[n];r!==void 0&&r!==e[n].value&&(e[n].value=r)},ad=e=>{e.start=(t=>{let n=!1;return(r=0,i=0,a)=>{if(n)throw z();t.call(e,r,i,a),n=!0}})(e.start)},od=e=>{e.start=(t=>(n=0,r=0,i)=>{if(typeof i==`number`&&i<0||r<0||n<0)throw RangeError(`The parameters can't be negative.`);t.call(e,n,r,i)})(e.start)},sd=e=>{e.stop=(t=>(n=0)=>{if(n<0)throw RangeError(`The parameter can't be negative.`);t.call(e,n)})(e.stop)},cd=(e,t,n,r,i,a,o,s,c,l,u)=>(d,f)=>{let p=d.createBufferSource();return V(p,f),H(p,f,`playbackRate`),B(p,f,`buffer`),B(p,f,`loop`),B(p,f,`loopEnd`),B(p,f,`loopStart`),t(n,()=>n(d))||ad(p),t(r,()=>r(d))||c(p),t(i,()=>i(d))||l(p,d),t(a,()=>a(d))||od(p),t(o,()=>o(d))||u(p,d),t(s,()=>s(d))||sd(p),e(d,p),p},ld=e=>e===null?null:e.hasOwnProperty(`AudioContext`)?e.AudioContext:e.hasOwnProperty(`webkitAudioContext`)?e.webkitAudioContext:null,ud=(e,t)=>(n,r,i)=>{let a=n.destination;if(a.channelCount!==r)try{a.channelCount=r}catch{}i&&a.channelCountMode!==`explicit`&&(a.channelCountMode=`explicit`),a.maxChannelCount===0&&Object.defineProperty(a,"maxChannelCount",{value:r});let o=e(n,{channelCount:r,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,gain:1});return t(o,`channelCount`,e=>()=>e.call(o),e=>t=>{e.call(o,t);try{a.channelCount=t}catch(e){if(t>a.maxChannelCount)throw e}}),t(o,`channelCountMode`,e=>()=>e.call(o),e=>t=>{e.call(o,t),a.channelCountMode=t}),t(o,`channelInterpretation`,e=>()=>e.call(o),e=>t=>{e.call(o,t),a.channelInterpretation=t}),Object.defineProperty(o,"maxChannelCount",{get:()=>a.maxChannelCount}),o.connect(a),o},dd=e=>e===null?null:e.hasOwnProperty(`AudioWorkletNode`)?e.AudioWorkletNode:null,fd=e=>{let{port1:t}=new MessageChannel;try{t.postMessage(e)}finally{t.close()}},pd=(e,t,n,r,i)=>(a,o,s,c,l,u)=>{if(s!==null)try{let t=new s(a,c,u),r=new Map,o=null;if(Object.defineProperties(t,{channelCount:{get:()=>u.channelCount,set:()=>{throw e()}},channelCountMode:{get:()=>`explicit`,set:()=>{throw e()}},onprocessorerror:{get:()=>o,set:e=>{typeof o==`function`&&t.removeEventListener(`processorerror`,o),o=typeof e==`function`?e:null,typeof o==`function`&&t.addEventListener(`processorerror`,o)}}}),t.addEventListener=(e=>(...n)=>{if(n[0]===`processorerror`){let e=typeof n[1]==`function`?n[1]:typeof n[1]==`object`&&n[1]!==null&&typeof n[1].handleEvent==`function`?n[1].handleEvent:null;if(e!==null){let t=r.get(n[1]);t===void 0?(n[1]=t=>{t.type===`error`?(Object.defineProperties(t,{type:{value:`processorerror`}}),e(t)):e(new ErrorEvent(n[0],{...t}))},r.set(e,n[1])):n[1]=t}}return e.call(t,`error`,n[1],n[2]),e.call(t,...n)})(t.addEventListener),t.removeEventListener=(e=>(...n)=>{if(n[0]===`processorerror`){let e=r.get(n[1]);e!==void 0&&(r.delete(n[1]),n[1]=e)}return e.call(t,`error`,n[1],n[2]),e.call(t,n[0],n[1],n[2])})(t.removeEventListener),u.numberOfOutputs!==0){let e=n(a,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:0});return t.connect(e).connect(a.destination),i(t,()=>e.disconnect(),()=>e.connect(a.destination))}return t}catch(e){throw e.code===11?r():e}if(l===void 0)throw r();return fd(u),t(a,o,l,u)},md=(e,t)=>e===null?512:Math.max(512,Math.min(16384,2**Math.round(Math.log2(e*t)))),hd=e=>new Promise((t,n)=>{let{port1:r,port2:i}=new MessageChannel;r.onmessage=({data:e})=>{r.close(),i.close(),t(e)},r.onmessageerror=({data:e})=>{r.close(),i.close(),n(e)},i.postMessage(e)}),gd=async(e,t)=>new e(await hd(t)),_d=(e,t,n,r)=>{let i=Js.get(e);i===void 0&&(i=new WeakMap,Js.set(e,i));let a=gd(n,r);return i.set(t,a),a},vd=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>(p,m,h,g)=>{if(g.numberOfInputs===0&&g.numberOfOutputs===0)throw c();let _=Array.isArray(g.outputChannelCount)?g.outputChannelCount:Array.from(g.outputChannelCount);if(_.some(e=>e<1))throw c();if(_.length!==g.numberOfOutputs)throw t();if(g.channelCountMode!==`explicit`)throw c();let v=g.channelCount*g.numberOfInputs,y=_.reduce((e,t)=>e+t,0),b=h.parameterDescriptors===void 0?0:h.parameterDescriptors.length;if(v+b>6||y>6)throw c();let x=new MessageChannel,S=[],C=[];for(let e=0;e<g.numberOfInputs;e+=1)S.push(o(p,{channelCount:g.channelCount,channelCountMode:g.channelCountMode,channelInterpretation:g.channelInterpretation,gain:1})),C.push(i(p,{channelCount:g.channelCount,channelCountMode:`explicit`,channelInterpretation:`discrete`,numberOfOutputs:g.channelCount}));let w=[];if(h.parameterDescriptors!==void 0)for(let{defaultValue:e,maxValue:t,minValue:n,name:r}of h.parameterDescriptors){let i=a(p,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,offset:g.parameterData[r]===void 0?e===void 0?0:e:g.parameterData[r]});Object.defineProperties(i.offset,{defaultValue:{get:()=>e===void 0?0:e},maxValue:{get:()=>t===void 0?wc:t},minValue:{get:()=>n===void 0?Cc:n}}),w.push(i)}let T=r(p,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:Math.max(1,v+b)}),E=md(m,p.sampleRate),D=s(p,E,v+b,Math.max(1,y)),O=i(p,{channelCount:Math.max(1,y),channelCountMode:`explicit`,channelInterpretation:`discrete`,numberOfOutputs:Math.max(1,y)}),k=[];for(let e=0;e<g.numberOfOutputs;e+=1)k.push(r(p,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:_[e]}));for(let e=0;e<g.numberOfInputs;e+=1){S[e].connect(C[e]);for(let t=0;t<g.channelCount;t+=1)C[e].connect(T,t,e*g.channelCount+t)}let ee=new bl(h.parameterDescriptors===void 0?[]:h.parameterDescriptors.map(({name:e},t)=>{let n=w[t];return n.connect(T,0,v+t),n.start(0),[e,n.offset]}));T.connect(D);let te=g.channelInterpretation,ne=null,re=g.numberOfOutputs===0?[D]:k,A={get bufferSize(){return E},get channelCount(){return g.channelCount},set channelCount(e){throw n()},get channelCountMode(){return g.channelCountMode},set channelCountMode(e){throw n()},get channelInterpretation(){return te},set channelInterpretation(e){for(let t of S)t.channelInterpretation=e;te=e},get context(){return D.context},get inputs(){return S},get numberOfInputs(){return g.numberOfInputs},get numberOfOutputs(){return g.numberOfOutputs},get onprocessorerror(){return ne},set onprocessorerror(e){typeof ne==`function`&&A.removeEventListener(`processorerror`,ne),ne=typeof e==`function`?e:null,typeof ne==`function`&&A.addEventListener(`processorerror`,ne)},get parameters(){return ee},get port(){return x.port2},addEventListener(...e){return D.addEventListener(e[0],e[1],e[2])},connect:e.bind(null,re),disconnect:l.bind(null,re),dispatchEvent(...e){return D.dispatchEvent(e[0])},removeEventListener(...e){return D.removeEventListener(e[0],e[1],e[2])}},j=new Map;x.port1.addEventListener=(e=>(...t)=>{if(t[0]===`message`){let e=typeof t[1]==`function`?t[1]:typeof t[1]==`object`&&t[1]!==null&&typeof t[1].handleEvent==`function`?t[1].handleEvent:null;if(e!==null){let n=j.get(t[1]);n===void 0?(t[1]=t=>{u(p.currentTime,p.sampleRate,()=>e(t))},j.set(e,t[1])):t[1]=n}}return e.call(x.port1,t[0],t[1],t[2])})(x.port1.addEventListener),x.port1.removeEventListener=(e=>(...t)=>{if(t[0]===`message`){let e=j.get(t[1]);e!==void 0&&(j.delete(t[1]),t[1]=e)}return e.call(x.port1,t[0],t[1],t[2])})(x.port1.removeEventListener);let ie=null;Object.defineProperty(x.port1,"onmessage",{get:()=>ie,set:e=>{typeof ie==`function`&&x.port1.removeEventListener(`message`,ie),ie=typeof e==`function`?e:null,typeof ie==`function`&&(x.port1.addEventListener(`message`,ie),x.port1.start())}}),h.prototype.port=x.port1;let M=null;_d(p,A,h,g).then(e=>M=e);let ae=Tl(g.numberOfInputs,g.channelCount),oe=Tl(g.numberOfOutputs,_),se=h.parameterDescriptors===void 0?[]:h.parameterDescriptors.reduce((e,{name:t})=>({...e,[t]:new Float32Array(128)}),{}),N=!0,ce=()=>{g.numberOfOutputs>0&&D.disconnect(O);for(let e=0,t=0;e<g.numberOfOutputs;e+=1){let n=k[e];for(let r=0;r<_[e];r+=1)O.disconnect(n,t+r,r);t+=_[e]}},le=new Map;D.onaudioprocess=({inputBuffer:e,outputBuffer:t})=>{if(M!==null){let n=d(A);for(let r=0;r<E;r+=128){for(let t=0;t<g.numberOfInputs;t+=1)for(let n=0;n<g.channelCount;n+=1)Cl(e,ae[t],n,n,r);h.parameterDescriptors!==void 0&&h.parameterDescriptors.forEach(({name:t},n)=>{Cl(e,se,t,v+n,r)});for(let e=0;e<g.numberOfInputs;e+=1)for(let t=0;t<_[e];t+=1)oe[e][t].byteLength===0&&(oe[e][t]=new Float32Array(128));try{let e=ae.map((e,t)=>{if(n[t].size>0)return le.set(t,E/128),e;let r=le.get(t);return r===void 0?[]:(e.every(e=>e.every(e=>e===0))&&(r===1?le.delete(t):le.set(t,r-1)),e)});N=u(p.currentTime+r/p.sampleRate,p.sampleRate,()=>M.process(e,oe,se));for(let e=0,n=0;e<g.numberOfOutputs;e+=1){for(let i=0;i<_[e];i+=1)wl(t,oe[e],i,n+i,r);n+=_[e]}}catch(e){N=!1,A.dispatchEvent(new ErrorEvent(`processorerror`,{colno:e.colno,filename:e.filename,lineno:e.lineno,message:e.message}))}if(!N){for(let e=0;e<g.numberOfInputs;e+=1){S[e].disconnect(C[e]);for(let t=0;t<g.channelCount;t+=1)C[r].disconnect(T,t,e*g.channelCount+t)}if(h.parameterDescriptors!==void 0){let e=h.parameterDescriptors.length;for(let t=0;t<e;t+=1){let e=w[t];e.disconnect(T,0,v+t),e.stop()}}T.disconnect(D),D.onaudioprocess=null,ue?ce():pe();break}}}};let ue=!1,de=o(p,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:0}),fe=()=>D.connect(de).connect(p.destination),pe=()=>{D.disconnect(de),de.disconnect()};return fe(),f(A,()=>{if(N){pe(),g.numberOfOutputs>0&&D.connect(O);for(let e=0,t=0;e<g.numberOfOutputs;e+=1){let n=k[e];for(let r=0;r<_[e];r+=1)O.connect(n,t+r,r);t+=_[e]}}ue=!0},()=>{N&&(fe(),ce()),ue=!1})},yd=(e,t)=>{let n=e.createBiquadFilter();return V(n,t),H(n,t,`Q`),H(n,t,`detune`),H(n,t,`frequency`),H(n,t,`gain`),B(n,t,`type`),n},bd=(e,t)=>(n,r)=>{let i=n.createChannelMerger(r.numberOfInputs);return e!==null&&e.name===`webkitAudioContext`&&t(n,i),V(i,r),i},xd=e=>{let t=e.numberOfOutputs;Object.defineProperty(e,"channelCount",{get:()=>t,set:e=>{if(e!==t)throw z()}}),Object.defineProperty(e,"channelCountMode",{get:()=>`explicit`,set:e=>{if(e!==`explicit`)throw z()}}),Object.defineProperty(e,"channelInterpretation",{get:()=>`discrete`,set:e=>{if(e!==`discrete`)throw z()}})},Sd=(e,t)=>{let n=e.createChannelSplitter(t.numberOfOutputs);return V(n,t),xd(n),n},Cd=(e,t,n,r,i)=>(a,o)=>{if(a.createConstantSource===void 0)return n(a,o);let s=a.createConstantSource();return V(s,o),H(s,o,`offset`),t(r,()=>r(a))||od(s),t(i,()=>i(a))||sd(s),e(a,s),s},wd=(e,t)=>(e.connect=t.connect.bind(t),e.disconnect=t.disconnect.bind(t),e),Td=(e,t,n,r)=>(i,{offset:a,...o})=>{let s=i.createBuffer(1,2,44100),c=t(i,{buffer:null,channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),l=n(i,{...o,gain:a}),u=s.getChannelData(0);return u[0]=1,u[1]=1,c.buffer=s,c.loop=!0,e(i,c),r(wd({get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(e){l.channelCount=e},get channelCountMode(){return l.channelCountMode},set channelCountMode(e){l.channelCountMode=e},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(e){l.channelInterpretation=e},get context(){return l.context},get inputs(){return[]},get numberOfInputs(){return c.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get offset(){return l.gain},get onended(){return c.onended},set onended(e){c.onended=e},addEventListener(...e){return c.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return c.dispatchEvent(e[0])},removeEventListener(...e){return c.removeEventListener(e[0],e[1],e[2])},start(e=0){c.start.call(c,e)},stop(e=0){c.stop.call(c,e)}},l),()=>c.connect(l),()=>c.disconnect(l))},Ed=(e,t)=>(n,r)=>{let i=n.createConvolver();if(V(i,r),r.disableNormalization===i.normalize&&(i.normalize=!r.disableNormalization),B(i,r,`buffer`),r.channelCount>2||(t(i,`channelCount`,e=>()=>e.call(i),t=>n=>{if(n>2)throw e();return t.call(i,n)}),r.channelCountMode===`max`))throw e();return t(i,`channelCountMode`,e=>()=>e.call(i),t=>n=>{if(n===`max`)throw e();return t.call(i,n)}),i},Dd=(e,t)=>{let n=e.createDelay(t.maxDelayTime);return V(n,t),H(n,t,`delayTime`),n},Od=e=>(t,n)=>{let r=t.createDynamicsCompressor();if(V(r,n),n.channelCount>2||n.channelCountMode===`max`)throw e();return H(r,n,`attack`),H(r,n,`knee`),H(r,n,`ratio`),H(r,n,`release`),H(r,n,`threshold`),r},kd=(e,t)=>{let n=e.createGain();return V(n,t),H(n,t,`gain`),n},Ad=e=>(t,n,r)=>{if(t.createIIRFilter===void 0)return e(t,n,r);let i=t.createIIRFilter(r.feedforward,r.feedback);return V(i,r),i};function jd(e,t){let n=t[0]*t[0]+t[1]*t[1];return[(e[0]*t[0]+e[1]*t[1])/n,(e[1]*t[0]-e[0]*t[1])/n]}function Md(e,t){return[e[0]*t[0]-e[1]*t[1],e[0]*t[1]+e[1]*t[0]]}function Nd(e,t){let n=[0,0];for(let r=e.length-1;r>=0;--r)n=Md(n,t),n[0]+=e[r];return n}var Pd=(e,t,n,r)=>(i,a,{channelCount:o,channelCountMode:s,channelInterpretation:c,feedback:l,feedforward:u})=>{let d=md(a,i.sampleRate),f=l instanceof Float64Array?l:new Float64Array(l),p=u instanceof Float64Array?u:new Float64Array(u),m=f.length,h=p.length,g=Math.min(m,h);if(m===0||m>20)throw r();if(f[0]===0)throw t();if(h===0||h>20)throw r();if(p[0]===0)throw t();if(f[0]!==1){for(let e=0;e<h;e+=1)p[e]/=f[0];for(let e=1;e<m;e+=1)f[e]/=f[0]}let _=n(i,d,o,o);_.channelCount=o,_.channelCountMode=s,_.channelInterpretation=c;let v=[],y=[],b=[];for(let e=0;e<o;e+=1){v.push(0);let e=new Float32Array(32),t=new Float32Array(32);e.fill(0),t.fill(0),y.push(e),b.push(t)}_.onaudioprocess=e=>{let t=e.inputBuffer,n=e.outputBuffer,r=t.numberOfChannels;for(let e=0;e<r;e+=1){let r=t.getChannelData(e),i=n.getChannelData(e);v[e]=Nu(f,m,p,h,g,y[e],b[e],v[e],32,r,i)}};let x=i.sampleRate/2;return wd({get bufferSize(){return d},get channelCount(){return _.channelCount},set channelCount(e){_.channelCount=e},get channelCountMode(){return _.channelCountMode},set channelCountMode(e){_.channelCountMode=e},get channelInterpretation(){return _.channelInterpretation},set channelInterpretation(e){_.channelInterpretation=e},get context(){return _.context},get inputs(){return[_]},get numberOfInputs(){return _.numberOfInputs},get numberOfOutputs(){return _.numberOfOutputs},addEventListener(...e){return _.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return _.dispatchEvent(e[0])},getFrequencyResponse(t,n,r){if(t.length!==n.length||n.length!==r.length)throw e();let i=t.length;for(let e=0;e<i;e+=1){let i=-Math.PI*(t[e]/x),a=[Math.cos(i),Math.sin(i)],o=jd(Nd(p,a),Nd(f,a));n[e]=Math.sqrt(o[0]*o[0]+o[1]*o[1]),r[e]=Math.atan2(o[1],o[0])}},removeEventListener(...e){return _.removeEventListener(e[0],e[1],e[2])}},_)},Fd=(e,t)=>e.createMediaElementSource(t.mediaElement),Id=(e,t)=>{let n=e.createMediaStreamDestination();return V(n,t),n.numberOfOutputs===1&&Object.defineProperty(n,"numberOfOutputs",{get:()=>0}),n},Ld=(e,{mediaStream:t})=>{let n=t.getAudioTracks();n.sort((e,t)=>e.id<t.id?-1:+(e.id>t.id));let r=n.slice(0,1),i=e.createMediaStreamSource(new MediaStream(r));return Object.defineProperty(i,"mediaStream",{value:t}),i},Rd=(e,t)=>(n,{mediaStreamTrack:r})=>{if(typeof n.createMediaStreamTrackSource==`function`)return n.createMediaStreamTrackSource(r);let i=new MediaStream([r]),a=n.createMediaStreamSource(i);if(r.kind!==`audio`)throw e();if(t(n))throw TypeError();return a},zd=e=>e===null?null:e.hasOwnProperty(`OfflineAudioContext`)?e.OfflineAudioContext:e.hasOwnProperty(`webkitOfflineAudioContext`)?e.webkitOfflineAudioContext:null,Bd=(e,t,n,r,i,a)=>(o,s)=>{let c=o.createOscillator();return V(c,s),H(c,s,`detune`),H(c,s,`frequency`),s.periodicWave===void 0?B(c,s,`type`):c.setPeriodicWave(s.periodicWave),t(n,()=>n(o))||od(c),t(r,()=>r(o))||a(c,o),t(i,()=>i(o))||sd(c),e(o,c),c},Vd=e=>(t,n)=>{let r=t.createPanner();return r.orientationX===void 0?e(t,n):(V(r,n),H(r,n,`orientationX`),H(r,n,`orientationY`),H(r,n,`orientationZ`),H(r,n,`positionX`),H(r,n,`positionY`),H(r,n,`positionZ`),B(r,n,`coneInnerAngle`),B(r,n,`coneOuterAngle`),B(r,n,`coneOuterGain`),B(r,n,`distanceModel`),B(r,n,`maxDistance`),B(r,n,`panningModel`),B(r,n,`refDistance`),B(r,n,`rolloffFactor`),r)},Hd=(e,t,n,r,i,a,o,s,c,l)=>(u,{coneInnerAngle:d,coneOuterAngle:f,coneOuterGain:p,distanceModel:m,maxDistance:h,orientationX:g,orientationY:_,orientationZ:v,panningModel:y,positionX:b,positionY:x,positionZ:S,refDistance:C,rolloffFactor:w,...T})=>{let E=u.createPanner();if(T.channelCount>2||T.channelCountMode===`max`)throw o();V(E,T);let D={channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`},O=n(u,{...D,channelInterpretation:`speakers`,numberOfInputs:6}),k=r(u,{...T,gain:1}),ee=r(u,{...D,gain:1}),te=r(u,{...D,gain:0}),ne=r(u,{...D,gain:0}),re=r(u,{...D,gain:0}),A=r(u,{...D,gain:0}),j=r(u,{...D,gain:0}),ie=i(u,256,6,1),M=a(u,{...D,curve:new Float32Array([1,1]),oversample:`none`}),ae=[g,_,v],oe=[b,x,S],se=new Float32Array(1);ie.onaudioprocess=({inputBuffer:e})=>{let t=[c(e,se,0),c(e,se,1),c(e,se,2)];t.some((e,t)=>e!==ae[t])&&(E.setOrientation(...t),ae=t);let n=[c(e,se,3),c(e,se,4),c(e,se,5)];n.some((e,t)=>e!==oe[t])&&(E.setPosition(...n),oe=n)},Object.defineProperty(te.gain,"defaultValue",{get:()=>0}),Object.defineProperty(ne.gain,"defaultValue",{get:()=>0}),Object.defineProperty(re.gain,"defaultValue",{get:()=>0}),Object.defineProperty(A.gain,"defaultValue",{get:()=>0}),Object.defineProperty(j.gain,"defaultValue",{get:()=>0});let N={get bufferSize(){},get channelCount(){return E.channelCount},set channelCount(e){if(e>2)throw o();k.channelCount=e,E.channelCount=e},get channelCountMode(){return E.channelCountMode},set channelCountMode(e){if(e===`max`)throw o();k.channelCountMode=e,E.channelCountMode=e},get channelInterpretation(){return E.channelInterpretation},set channelInterpretation(e){k.channelInterpretation=e,E.channelInterpretation=e},get coneInnerAngle(){return E.coneInnerAngle},set coneInnerAngle(e){E.coneInnerAngle=e},get coneOuterAngle(){return E.coneOuterAngle},set coneOuterAngle(e){E.coneOuterAngle=e},get coneOuterGain(){return E.coneOuterGain},set coneOuterGain(e){if(e<0||e>1)throw t();E.coneOuterGain=e},get context(){return E.context},get distanceModel(){return E.distanceModel},set distanceModel(e){E.distanceModel=e},get inputs(){return[k]},get maxDistance(){return E.maxDistance},set maxDistance(e){if(e<0)throw RangeError();E.maxDistance=e},get numberOfInputs(){return E.numberOfInputs},get numberOfOutputs(){return E.numberOfOutputs},get orientationX(){return ee.gain},get orientationY(){return te.gain},get orientationZ(){return ne.gain},get panningModel(){return E.panningModel},set panningModel(e){E.panningModel=e},get positionX(){return re.gain},get positionY(){return A.gain},get positionZ(){return j.gain},get refDistance(){return E.refDistance},set refDistance(e){if(e<0)throw RangeError();E.refDistance=e},get rolloffFactor(){return E.rolloffFactor},set rolloffFactor(e){if(e<0)throw RangeError();E.rolloffFactor=e},addEventListener(...e){return k.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return k.dispatchEvent(e[0])},removeEventListener(...e){return k.removeEventListener(e[0],e[1],e[2])}};return d!==N.coneInnerAngle&&(N.coneInnerAngle=d),f!==N.coneOuterAngle&&(N.coneOuterAngle=f),p!==N.coneOuterGain&&(N.coneOuterGain=p),m!==N.distanceModel&&(N.distanceModel=m),h!==N.maxDistance&&(N.maxDistance=h),g!==N.orientationX.value&&(N.orientationX.value=g),_!==N.orientationY.value&&(N.orientationY.value=_),v!==N.orientationZ.value&&(N.orientationZ.value=v),y!==N.panningModel&&(N.panningModel=y),b!==N.positionX.value&&(N.positionX.value=b),x!==N.positionY.value&&(N.positionY.value=x),S!==N.positionZ.value&&(N.positionZ.value=S),C!==N.refDistance&&(N.refDistance=C),w!==N.rolloffFactor&&(N.rolloffFactor=w),(ae[0]!==1||ae[1]!==0||ae[2]!==0)&&E.setOrientation(...ae),(oe[0]!==0||oe[1]!==0||oe[2]!==0)&&E.setPosition(...oe),l(wd(N,E),()=>{k.connect(E),e(k,M,0,0),M.connect(ee).connect(O,0,0),M.connect(te).connect(O,0,1),M.connect(ne).connect(O,0,2),M.connect(re).connect(O,0,3),M.connect(A).connect(O,0,4),M.connect(j).connect(O,0,5),O.connect(ie).connect(u.destination)},()=>{k.disconnect(E),s(k,M,0,0),M.disconnect(ee),ee.disconnect(O),M.disconnect(te),te.disconnect(O),M.disconnect(ne),ne.disconnect(O),M.disconnect(re),re.disconnect(O),M.disconnect(A),A.disconnect(O),M.disconnect(j),j.disconnect(O),O.disconnect(ie),ie.disconnect(u.destination)})},Ud=e=>(t,{disableNormalization:n,imag:r,real:i})=>{let a=r instanceof Float32Array?r:new Float32Array(r),o=i instanceof Float32Array?i:new Float32Array(i),s=t.createPeriodicWave(o,a,{disableNormalization:n});if(Array.from(r).length<2)throw e();return s},Wd=(e,t,n,r)=>e.createScriptProcessor(t,n,r),Gd=(e,t)=>(n,r)=>{let i=r.channelCountMode;if(i===`clamped-max`)throw t();if(n.createStereoPanner===void 0)return e(n,r);let a=n.createStereoPanner();return V(a,r),H(a,r,`pan`),Object.defineProperty(a,"channelCountMode",{get:()=>i,set:e=>{if(e!==i)throw t()}}),a},Kd=(e,t,n,r,i,a)=>{let o=16385,s=new Float32Array([1,1]),c=Math.PI/2,l={channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`},u={...l,oversample:`none`},d=(e,t,i,a)=>{let d=new Float32Array(o),f=new Float32Array(o);for(let e=0;e<o;e+=1){let t=e/(o-1)*c;d[e]=Math.cos(t),f[e]=Math.sin(t)}let p=n(e,{...l,gain:0}),m=r(e,{...u,curve:d}),h=r(e,{...u,curve:s}),g=n(e,{...l,gain:0}),_=r(e,{...u,curve:f});return{connectGraph(){t.connect(p),t.connect(h.inputs===void 0?h:h.inputs[0]),t.connect(g),h.connect(i),i.connect(m.inputs===void 0?m:m.inputs[0]),i.connect(_.inputs===void 0?_:_.inputs[0]),m.connect(p.gain),_.connect(g.gain),p.connect(a,0,0),g.connect(a,0,1)},disconnectGraph(){t.disconnect(p),t.disconnect(h.inputs===void 0?h:h.inputs[0]),t.disconnect(g),h.disconnect(i),i.disconnect(m.inputs===void 0?m:m.inputs[0]),i.disconnect(_.inputs===void 0?_:_.inputs[0]),m.disconnect(p.gain),_.disconnect(g.gain),p.disconnect(a,0,0),g.disconnect(a,0,1)}}},f=(e,i,a,d)=>{let f=new Float32Array(o),p=new Float32Array(o),m=new Float32Array(o),h=new Float32Array(o),g=8192;for(let e=0;e<o;e+=1)if(e>g){let t=(e-g)/(o-1-g)*c;f[e]=Math.cos(t),p[e]=Math.sin(t),m[e]=0,h[e]=1}else{let t=e/(o-1-g)*c;f[e]=1,p[e]=0,m[e]=Math.cos(t),h[e]=Math.sin(t)}let _=t(e,{channelCount:2,channelCountMode:`explicit`,channelInterpretation:`discrete`,numberOfOutputs:2}),v=n(e,{...l,gain:0}),y=r(e,{...u,curve:f}),b=n(e,{...l,gain:0}),x=r(e,{...u,curve:p}),S=r(e,{...u,curve:s}),C=n(e,{...l,gain:0}),w=r(e,{...u,curve:m}),T=n(e,{...l,gain:0}),E=r(e,{...u,curve:h});return{connectGraph(){i.connect(_),i.connect(S.inputs===void 0?S:S.inputs[0]),_.connect(v,0),_.connect(b,0),_.connect(C,1),_.connect(T,1),S.connect(a),a.connect(y.inputs===void 0?y:y.inputs[0]),a.connect(x.inputs===void 0?x:x.inputs[0]),a.connect(w.inputs===void 0?w:w.inputs[0]),a.connect(E.inputs===void 0?E:E.inputs[0]),y.connect(v.gain),x.connect(b.gain),w.connect(C.gain),E.connect(T.gain),v.connect(d,0,0),C.connect(d,0,0),b.connect(d,0,1),T.connect(d,0,1)},disconnectGraph(){i.disconnect(_),i.disconnect(S.inputs===void 0?S:S.inputs[0]),_.disconnect(v,0),_.disconnect(b,0),_.disconnect(C,1),_.disconnect(T,1),S.disconnect(a),a.disconnect(y.inputs===void 0?y:y.inputs[0]),a.disconnect(x.inputs===void 0?x:x.inputs[0]),a.disconnect(w.inputs===void 0?w:w.inputs[0]),a.disconnect(E.inputs===void 0?E:E.inputs[0]),y.disconnect(v.gain),x.disconnect(b.gain),w.disconnect(C.gain),E.disconnect(T.gain),v.disconnect(d,0,0),C.disconnect(d,0,0),b.disconnect(d,0,1),T.disconnect(d,0,1)}}},p=(e,t,n,r,a)=>{if(t===1)return d(e,n,r,a);if(t===2)return f(e,n,r,a);throw i()};return(t,{channelCount:r,channelCountMode:o,pan:s,...c})=>{if(o===`max`)throw i();let l=e(t,{...c,channelCount:1,channelCountMode:o,numberOfInputs:2}),u=n(t,{...c,channelCount:r,channelCountMode:o,gain:1}),d=n(t,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:s}),{connectGraph:f,disconnectGraph:m}=p(t,r,u,d,l);Object.defineProperty(d.gain,"defaultValue",{get:()=>0}),Object.defineProperty(d.gain,"maxValue",{get:()=>1}),Object.defineProperty(d.gain,"minValue",{get:()=>-1});let h={get bufferSize(){},get channelCount(){return u.channelCount},set channelCount(e){u.channelCount!==e&&(g&&m(),{connectGraph:f,disconnectGraph:m}=p(t,e,u,d,l),g&&f()),u.channelCount=e},get channelCountMode(){return u.channelCountMode},set channelCountMode(e){if(e===`clamped-max`||e===`max`)throw i();u.channelCountMode=e},get channelInterpretation(){return u.channelInterpretation},set channelInterpretation(e){u.channelInterpretation=e},get context(){return u.context},get inputs(){return[u]},get numberOfInputs(){return u.numberOfInputs},get numberOfOutputs(){return u.numberOfOutputs},get pan(){return d.gain},addEventListener(...e){return u.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return u.dispatchEvent(e[0])},removeEventListener(...e){return u.removeEventListener(e[0],e[1],e[2])}},g=!1;return a(wd(h,l),()=>{f(),g=!0},()=>{m(),g=!1})}},qd=(e,t,n,r,i,a,o)=>(s,c)=>{let l=s.createWaveShaper();if(a!==null&&a.name===`webkitAudioContext`&&s.createGain().gain.automationRate===void 0)return n(s,c);V(l,c);let u=c.curve===null||c.curve instanceof Float32Array?c.curve:new Float32Array(c.curve);if(u!==null&&u.length<2)throw t();B(l,{curve:u},`curve`),B(l,c,`oversample`);let d=null,f=!1;return o(l,`curve`,e=>()=>e.call(l),t=>n=>(t.call(l,n),f&&(r(n)&&d===null?d=e(s,l):!r(n)&&d!==null&&(d(),d=null)),n)),i(l,()=>{f=!0,r(l.curve)&&(d=e(s,l))},()=>{f=!1,d!==null&&(d(),d=null)})},Jd=(e,t,n,r,i)=>(a,{curve:o,oversample:s,...c})=>{let l=a.createWaveShaper(),u=a.createWaveShaper();V(l,c),V(u,c);let d=n(a,{...c,gain:1}),f=n(a,{...c,gain:-1}),p=n(a,{...c,gain:1}),m=n(a,{...c,gain:-1}),h=null,g=!1,_=null,v={get bufferSize(){},get channelCount(){return l.channelCount},set channelCount(e){d.channelCount=e,f.channelCount=e,l.channelCount=e,p.channelCount=e,u.channelCount=e,m.channelCount=e},get channelCountMode(){return l.channelCountMode},set channelCountMode(e){d.channelCountMode=e,f.channelCountMode=e,l.channelCountMode=e,p.channelCountMode=e,u.channelCountMode=e,m.channelCountMode=e},get channelInterpretation(){return l.channelInterpretation},set channelInterpretation(e){d.channelInterpretation=e,f.channelInterpretation=e,l.channelInterpretation=e,p.channelInterpretation=e,u.channelInterpretation=e,m.channelInterpretation=e},get context(){return l.context},get curve(){return _},set curve(n){if(n!==null&&n.length<2)throw t();if(n===null)l.curve=n,u.curve=n;else{let e=n.length,t=new Float32Array(e+2-e%2),r=new Float32Array(e+2-e%2);t[0]=n[0],r[0]=-n[e-1];let i=Math.ceil((e+1)/2),a=(e+1)/2-1;for(let o=1;o<i;o+=1){let s=o/i*a,c=Math.floor(s),l=Math.ceil(s);t[o]=c===l?n[c]:(1-(s-c))*n[c]+(1-(l-s))*n[l],r[o]=c===l?-n[e-1-c]:-((1-(s-c))*n[e-1-c])-(1-(l-s))*n[e-1-l]}t[i]=e%2==1?n[i-1]:(n[i-2]+n[i-1])/2,l.curve=t,u.curve=r}_=n,g&&(r(_)&&h===null?h=e(a,d):h!==null&&(h(),h=null))},get inputs(){return[d]},get numberOfInputs(){return l.numberOfInputs},get numberOfOutputs(){return l.numberOfOutputs},get oversample(){return l.oversample},set oversample(e){l.oversample=e,u.oversample=e},addEventListener(...e){return d.addEventListener(e[0],e[1],e[2])},dispatchEvent(...e){return d.dispatchEvent(e[0])},removeEventListener(...e){return d.removeEventListener(e[0],e[1],e[2])}};return o!==null&&(v.curve=o instanceof Float32Array?o:new Float32Array(o)),s!==v.oversample&&(v.oversample=s),i(wd(v,p),()=>{d.connect(l).connect(p),d.connect(f).connect(u).connect(m).connect(p),g=!0,r(_)&&(h=e(a,d))},()=>{d.disconnect(l),l.disconnect(p),d.disconnect(f),f.disconnect(u),u.disconnect(m),m.disconnect(p),g=!1,h!==null&&(h(),h=null)})},Yd=()=>new DOMException(``,`NotSupportedError`),Xd={numberOfChannels:1},Zd=(e,t,n,r,i)=>class extends e{constructor(e,n,i){let a;if(typeof e==`number`&&n!==void 0&&i!==void 0)a={length:n,numberOfChannels:e,sampleRate:i};else if(typeof e==`object`)a=e;else throw Error(`The given parameters are not valid.`);let{length:o,numberOfChannels:s,sampleRate:c}={...Xd,...a},l=r(s,o,c);t($u,()=>$u(l))||l.addEventListener(`statechange`,(()=>{let e=0,t=n=>{this._state===`running`&&(e>0?(l.removeEventListener(`statechange`,t),n.stopImmediatePropagation(),this._waitForThePromiseToSettle(n)):e+=1)};return t})()),super(l,s),this._length=o,this._nativeOfflineAudioContext=l,this._state=null}get length(){return this._nativeOfflineAudioContext.length===void 0?this._length:this._nativeOfflineAudioContext.length}get state(){return this._state===null?this._nativeOfflineAudioContext.state:this._state}startRendering(){return this._state===`running`?Promise.reject(n()):(this._state=`running`,i(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,Rc(this)}))}_waitForThePromiseToSettle(e){this._state===null?this._nativeOfflineAudioContext.dispatchEvent(e):setTimeout(()=>this._waitForThePromiseToSettle(e))}},Qd={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,detune:0,frequency:440,periodicWave:void 0,type:`sine`},$d=(e,t,n,r,i,a,o)=>class extends e{constructor(e,o){let s=i(e),c={...Qd,...o},l=n(s,c),u=a(s),d=u?r():null,f=e.sampleRate/2;super(e,!1,l,d),this._detune=t(this,u,l.detune,153600,-153600),this._frequency=t(this,u,l.frequency,f,-f),this._nativeOscillatorNode=l,this._onended=null,this._oscillatorNodeRenderer=d,this._oscillatorNodeRenderer!==null&&c.periodicWave!==void 0&&(this._oscillatorNodeRenderer.periodicWave=c.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(e){let t=typeof e==`function`?o(this,e):null;this._nativeOscillatorNode.onended=t;let n=this._nativeOscillatorNode.onended;this._onended=n!==null&&n===t?e:n}get type(){return this._nativeOscillatorNode.type}set type(e){this._nativeOscillatorNode.type=e,this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(e){this._nativeOscillatorNode.setPeriodicWave(e),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.periodicWave=e)}start(e=0){if(this._nativeOscillatorNode.start(e),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.start=e),this.context.state!==`closed`){oc(this);let e=()=>{this._nativeOscillatorNode.removeEventListener(`ended`,e),Tc(this)&&cc(this)};this._nativeOscillatorNode.addEventListener(`ended`,e)}}stop(e=0){this._nativeOscillatorNode.stop(e),this._oscillatorNodeRenderer!==null&&(this._oscillatorNodeRenderer.stop=e)}},ef=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=null,s=null,c=null,l=async(l,u)=>{let d=n(l),f=gc(d,u);return f||(d=t(u,{channelCount:d.channelCount,channelCountMode:d.channelCountMode,channelInterpretation:d.channelInterpretation,detune:d.detune.value,frequency:d.frequency.value,periodicWave:o===null?void 0:o,type:d.type}),s!==null&&d.start(s),c!==null&&d.stop(c)),a.set(u,d),f?(await e(u,l.detune,d.detune),await e(u,l.frequency,d.frequency)):(await r(u,l.detune,d.detune),await r(u,l.frequency,d.frequency)),await i(l,u,d),d};return{set periodicWave(e){o=e},set start(e){s=e},set stop(e){c=e},render(e,t){let n=a.get(t);return n===void 0?l(e,t):Promise.resolve(n)}}},tf={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},nf=(e,t,n,r,i,a,o)=>class extends e{constructor(e,s){let c=i(e),l=n(c,{...tf,...s}),u=a(c),d=u?r():null;super(e,!1,l,d),this._nativePannerNode=l,this._orientationX=t(this,u,l.orientationX,wc,Cc),this._orientationY=t(this,u,l.orientationY,wc,Cc),this._orientationZ=t(this,u,l.orientationZ,wc,Cc),this._positionX=t(this,u,l.positionX,wc,Cc),this._positionY=t(this,u,l.positionY,wc,Cc),this._positionZ=t(this,u,l.positionZ,wc,Cc),o(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(e){this._nativePannerNode.coneInnerAngle=e}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(e){this._nativePannerNode.coneOuterAngle=e}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(e){this._nativePannerNode.coneOuterGain=e}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(e){this._nativePannerNode.distanceModel=e}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(e){this._nativePannerNode.maxDistance=e}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(e){this._nativePannerNode.panningModel=e}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(e){this._nativePannerNode.refDistance=e}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(e){this._nativePannerNode.rolloffFactor=e}},rf=(e,t,n,r,i,a,o,s,c,l)=>()=>{let u=new WeakMap,d=null,f=async(f,p)=>{let m=null,h=a(f),g={channelCount:h.channelCount,channelCountMode:h.channelCountMode,channelInterpretation:h.channelInterpretation},_={...g,coneInnerAngle:h.coneInnerAngle,coneOuterAngle:h.coneOuterAngle,coneOuterGain:h.coneOuterGain,distanceModel:h.distanceModel,maxDistance:h.maxDistance,panningModel:h.panningModel,refDistance:h.refDistance,rolloffFactor:h.rolloffFactor},v=gc(h,p);if(`bufferSize`in h?m=r(p,{...g,gain:1}):v||(h=i(p,{..._,orientationX:h.orientationX.value,orientationY:h.orientationY.value,orientationZ:h.orientationZ.value,positionX:h.positionX.value,positionY:h.positionY.value,positionZ:h.positionZ.value})),u.set(p,m===null?h:m),m!==null){if(d===null){if(o===null)throw Error(`Missing the native OfflineAudioContext constructor.`);let e=new o(6,f.context.length,p.sampleRate),r=t(e,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`speakers`,numberOfInputs:6});r.connect(e.destination),d=(async()=>{let t=await Promise.all([f.orientationX,f.orientationY,f.orientationZ,f.positionX,f.positionY,f.positionZ].map(async(t,r)=>{let i=n(e,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,offset:+(r===0)});return await s(e,t,i.offset),i}));for(let e=0;e<6;e+=1)t[e].connect(r,0,e),t[e].start(0);return l(e)})()}let e=await d,a=r(p,{...g,gain:1});await c(f,p,a);let u=[];for(let t=0;t<e.numberOfChannels;t+=1)u.push(e.getChannelData(t));let h=[u[0][0],u[1][0],u[2][0]],v=[u[3][0],u[4][0],u[5][0]],y=r(p,{...g,gain:1}),b=i(p,{..._,orientationX:h[0],orientationY:h[1],orientationZ:h[2],positionX:v[0],positionY:v[1],positionZ:v[2]});a.connect(y).connect(b.inputs[0]),b.connect(m);for(let t=128;t<e.length;t+=128){let e=[u[0][t],u[1][t],u[2][t]],n=[u[3][t],u[4][t],u[5][t]];if(e.some((e,t)=>e!==h[t])||n.some((e,t)=>e!==v[t])){h=e,v=n;let o=t/p.sampleRate;y.gain.setValueAtTime(0,o),y=r(p,{...g,gain:0}),b=i(p,{..._,orientationX:h[0],orientationY:h[1],orientationZ:h[2],positionX:v[0],positionY:v[1],positionZ:v[2]}),y.gain.setValueAtTime(1,o),a.connect(y).connect(b.inputs[0]),b.connect(m)}}return m}return v?(await e(p,f.orientationX,h.orientationX),await e(p,f.orientationY,h.orientationY),await e(p,f.orientationZ,h.orientationZ),await e(p,f.positionX,h.positionX),await e(p,f.positionY,h.positionY),await e(p,f.positionZ,h.positionZ)):(await s(p,f.orientationX,h.orientationX),await s(p,f.orientationY,h.orientationY),await s(p,f.orientationZ,h.orientationZ),await s(p,f.positionX,h.positionX),await s(p,f.positionY,h.positionY),await s(p,f.positionZ,h.positionZ)),Yc(h)?await c(f,p,h.inputs[0]):await c(f,p,h),h};return{render(e,t){let n=u.get(t);return n===void 0?f(e,t):Promise.resolve(n)}}},af={disableNormalization:!1},of=(e,t,n,r)=>class i{constructor(i,a){let o=e(t(i),r({...af,...a}));return n.add(o),o}static[Symbol.hasInstance](e){return typeof e==`object`&&!!e&&Object.getPrototypeOf(e)===i.prototype||n.has(e)}},sf=(e,t)=>(n,r,i)=>(e(r).replay(i),t(r,n,i)),cf=(e,t,n)=>async(r,i,a)=>{let o=e(r);await Promise.all(o.activeInputs.map((e,o)=>Array.from(e).map(async([e,s])=>{let c=await t(e).render(e,i),l=r.context.destination;!n(e)&&(r!==l||!n(r))&&c.connect(a,s,o)})).reduce((e,t)=>[...e,...t],[]))},lf=(e,t,n)=>async(r,i,a)=>{let o=t(r);await Promise.all(Array.from(o.activeInputs).map(async([t,r])=>{let o=await e(t).render(t,i);n(t)||o.connect(a,r)}))},uf=(e,t,n,r)=>i=>e($u,()=>$u(i))?Promise.resolve(e(r,r)).then(e=>{if(!e){let e=n(i,512,0,1);i.oncomplete=()=>{e.onaudioprocess=null,e.disconnect()},e.onaudioprocess=()=>i.currentTime,e.connect(i.destination)}return i.startRendering()}):new Promise(e=>{let n=t(i,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:0});i.oncomplete=t=>{n.disconnect(),e(t.renderedBuffer)},n.connect(i.destination),i.startRendering()}),df=e=>(t,n)=>{e.set(t,n)},ff=e=>(t,n)=>e.set(t,n),pf=(e,t,n,r,i,a,o,s)=>(c,l)=>n(c).render(c,l).then(()=>Promise.all(Array.from(r(l)).map(e=>n(e).render(e,l)))).then(()=>i(l)).then(n=>(typeof n.copyFromChannel==`function`?t(a,()=>a(n))||s(n):(o(n),bc(n)),e.add(n),n)),mf={channelCount:2,channelCountMode:`explicit`,channelInterpretation:`speakers`,pan:0},hf=(e,t,n,r,i,a)=>class extends e{constructor(e,o){let s=i(e),c=n(s,{...mf,...o}),l=a(s),u=l?r():null;super(e,!1,c,u),this._pan=t(this,l,c.pan)}get pan(){return this._pan}},gf=(e,t,n,r,i)=>()=>{let a=new WeakMap,o=async(o,s)=>{let c=n(o),l=gc(c,s);return l||(c=t(s,{channelCount:c.channelCount,channelCountMode:c.channelCountMode,channelInterpretation:c.channelInterpretation,pan:c.pan.value})),a.set(s,c),l?await e(s,o.pan,c.pan):await r(s,o.pan,c.pan),Yc(c)?await i(o,s,c.inputs[0]):await i(o,s,c),c};return{render(e,t){let n=a.get(t);return n===void 0?o(e,t):Promise.resolve(n)}}},_f=e=>()=>{if(e===null)return!1;try{new e({length:1,sampleRate:44100})}catch{return!1}return!0},vf=(e,t)=>async()=>{if(e===null)return!0;if(t===null)return!1;let 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`}),r=new t(1,128,44100),i=URL.createObjectURL(n),a=!1,o=!1;try{await r.audioWorklet.addModule(i);let t=new e(r,`a`,{numberOfOutputs:0}),n=r.createOscillator();t.port.onmessage=()=>a=!0,t.onprocessorerror=()=>o=!0,n.connect(t),n.start(0),await r.startRendering(),await new Promise(e=>setTimeout(e))}catch{}finally{URL.revokeObjectURL(i)}return a&&!o},yf=(e,t)=>()=>{if(t===null)return Promise.resolve(!1);let n=new t(1,1,44100),r=e(n,{channelCount:1,channelCountMode:`explicit`,channelInterpretation:`discrete`,gain:0});return new Promise(e=>{n.oncomplete=()=>{r.disconnect(),e(n.currentTime!==0)},n.startRendering()})},bf=()=>new DOMException(``,`UnknownError`),xf={channelCount:2,channelCountMode:`max`,channelInterpretation:`speakers`,curve:null,oversample:`none`},Sf=(e,t,n,r,i,a,o)=>class extends e{constructor(e,t){let s=i(e),c=n(s,{...xf,...t}),l=a(s)?r():null;super(e,!0,c,l),this._isCurveNullified=!1,this._nativeWaveShaperNode=c,o(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(e){if(e===null)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(e.length<2)throw t();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=e}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(e){this._nativeWaveShaperNode.oversample=e}},Cf=(e,t,n)=>()=>{let r=new WeakMap,i=async(i,a)=>{let o=t(i);return gc(o,a)||(o=e(a,{channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,curve:o.curve,oversample:o.oversample})),r.set(a,o),Yc(o)?await n(i,a,o.inputs[0]):await n(i,a,o),o};return{render(e,t){let n=r.get(t);return n===void 0?i(e,t):Promise.resolve(n)}}},wf=()=>typeof window>`u`?null:window,Tf=(e,t)=>n=>{n.copyFromChannel=(r,i,a=0)=>{let o=e(a),s=e(i);if(s>=n.numberOfChannels)throw t();let c=n.length,l=n.getChannelData(s),u=r.length;for(let e=o<0?-o:0;e+o<c&&e<u;e+=1)r[e]=l[e+o]},n.copyToChannel=(r,i,a=0)=>{let o=e(a),s=e(i);if(s>=n.numberOfChannels)throw t();let c=n.length,l=n.getChannelData(s),u=r.length;for(let e=o<0?-o:0;e+o<c&&e<u;e+=1)l[e+o]=r[e]}},Ef=e=>t=>{t.copyFromChannel=(n=>(r,i,a=0)=>{let o=e(a),s=e(i);if(o<t.length)return n.call(t,r,s,o)})(t.copyFromChannel),t.copyToChannel=(n=>(r,i,a=0)=>{let o=e(a),s=e(i);if(o<t.length)return n.call(t,r,s,o)})(t.copyToChannel)},Df=e=>(t,n)=>{let r=n.createBuffer(1,1,44100);t.buffer===null&&(t.buffer=r),e(t,`buffer`,e=>()=>{let n=e.call(t);return n===r?null:n},e=>n=>e.call(t,n===null?r:n))},Of=(e,t)=>(n,r)=>{r.channelCount=1,r.channelCountMode=`explicit`,Object.defineProperty(r,"channelCount",{get:()=>1,set:()=>{throw e()}}),Object.defineProperty(r,"channelCountMode",{get:()=>`explicit`,set:()=>{throw e()}});let i=n.createBufferSource();t(r,()=>{let e=r.numberOfInputs;for(let t=0;t<e;t+=1)i.connect(r,0,t)},()=>i.disconnect(r))},kf=(e,t,n)=>e.copyFromChannel===void 0?e.getChannelData(n)[0]:(e.copyFromChannel(t,n),t[0]),Af=e=>{if(e===null)return!1;let t=e.length;return t%2==0?e[t/2-1]+e[t/2]!==0:e[Math.floor(t/2)]!==0},jf=(e,t,n,r)=>{let i=e;for(;!i.hasOwnProperty(t);)i=Object.getPrototypeOf(i);let{get:a,set:o}=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,{get:n(a),set:r(o)})},Mf=e=>({...e,outputChannelCount:e.outputChannelCount===void 0?e.numberOfInputs===1&&e.numberOfOutputs===1?[e.channelCount]:Array.from({length:e.numberOfOutputs},()=>1):e.outputChannelCount}),Nf=e=>({...e,channelCount:e.numberOfOutputs}),Pf=e=>{let{imag:t,real:n}=e;return t===void 0?n===void 0?{...e,imag:[0,0],real:[0,0]}:{...e,imag:Array.from(n,()=>0),real:n}:n===void 0?{...e,imag:t,real:Array.from(t,()=>0)}:{...e,imag:t,real:n}},Ff=(e,t,n)=>{try{e.setValueAtTime(t,n)}catch(r){if(r.code!==9)throw r;Ff(e,t,n+1e-7)}},If=e=>{let t=e.createBufferSource();t.start();try{t.start()}catch{return!0}return!1},Lf=e=>{let t=e.createBufferSource();t.buffer=e.createBuffer(1,1,44100);try{t.start(0,1)}catch{return!1}return!0},Rf=e=>{let t=e.createBufferSource();t.start();try{t.stop()}catch{return!1}return!0},zf=e=>{let t=e.createOscillator();try{t.start(-1)}catch(e){return e instanceof RangeError}return!1},Bf=e=>{let t=e.createBuffer(1,1,44100),n=e.createBufferSource();n.buffer=t,n.start(),n.stop();try{return n.stop(),!0}catch{return!1}},Vf=e=>{let t=e.createOscillator();try{t.stop(-1)}catch(e){return e instanceof RangeError}return!1},Hf=e=>{let{port1:t,port2:n}=new MessageChannel;try{t.postMessage(e)}finally{t.close(),n.close()}},Uf=e=>{e.start=(t=>(n=0,r=0,i)=>{let a=e.buffer,o=a===null?r:Math.min(a.duration,r);a!==null&&o>a.duration-.5/e.context.sampleRate?t.call(e,n,0,0):t.call(e,n,o,i)})(e.start)},Wf=(e,t)=>{let n=t.createGain();e.connect(n);let r=(t=>()=>{t.call(e,n),e.removeEventListener(`ended`,r)})(e.disconnect);e.addEventListener(`ended`,r),wd(e,n),e.stop=(t=>{let r=!1;return(i=0)=>{if(r)try{t.call(e,i)}catch{n.gain.setValueAtTime(0,i)}else t.call(e,i),r=!0}})(e.stop)},Gf=(e,t)=>n=>{let r={value:e};return Object.defineProperties(n,{currentTarget:r,target:r}),typeof t==`function`?t.call(e,n):t.handleEvent.call(e,n)},Kf=Is(Kc),qf=dc(Kc),Jf=iu(rc),Yf=new WeakMap,Xf=Cu(Yf),Zf=Nl(new Map,new WeakMap),Qf=wf(),$f=rd(Zf,yc),ep=Su(Fc),tp=cf(Fc,ep,rl),np=_c($f,R,tp),U=Eu(Ws),rp=zd(Qf),W=Gu(rp),ip=new WeakMap,ap=hu(Gf),op=ld(Qf),sp=Vu(op),cp=Hu(Qf),lp=Uu(Qf),up=dd(Qf),G=_l(Ls(Bs),uc(Kf,qf,Xc,Jf,tl,Fc,Xf,ac,R,Kc,Tc,rl,il),Zf,Iu(Ks,tl,Fc,R,nl,Tc),yc,ku,Yd,eu(Xc,Ks,Fc,R,nl,U,Tc,W),su(ip,Fc,nc),ap,U,sp,cp,lp,W,up),dp=hc(G,np,yc,$f,U,W),fp=new WeakSet,pp=id(Qf),mp=Kl(new Uint32Array(1)),hp=Tf(mp,yc),gp=Ef(mp),_p=Sc(fp,Zf,Yd,pp,rp,_f(pp),hp,gp),vp=fc(kd),yp=lf(ep,Ic,rl),bp=Bl(yp),xp=cd(vp,Zf,If,Lf,Rf,zf,Bf,Vf,Uf,Df(jf),Wf),Sp=sf(wu(Ic),yp),Cp=Oc(bp,xp,R,Sp,tp),wp=vl(Rs(Hs),ip,Us,yl,Ps.createCancelAndHoldAutomationEvent,Ps.createCancelScheduledValuesAutomationEvent,Ps.createExponentialRampToValueAutomationEvent,Ps.createLinearRampToValueAutomationEvent,Ps.createSetTargetAutomationEvent,Ps.createSetValueAutomationEvent,Ps.createSetValueCurveAutomationEvent,op,Ff),Tp=Dc(G,Cp,wp,z,xp,U,W,Gf),Ep=Vc(G,Hc,yc,z,ud(kd,jf),U,W,tp),Dp=Ml(bp,yd,R,Sp,tp),Op=ff(Yf),kp=jl(G,wp,Dp,ku,yd,U,W,Op),Ap=ed(Kc,cp),jp=bd(op,Of(z,Ap)),Mp=Fl(G,Il(jp,R,tp),jp,U,W),Np=Rl(G,zl(Sd,R,tp),Sd,U,W,Nf),Pp=Cd(vp,Zf,Td(vp,xp,kd,Ap),zf,Vf),Fp=Wl(G,wp,Gl(bp,Pp,R,Sp,tp),Pp,U,W,Gf),Ip=Ed(Yd,jf),Lp=Jl(G,Yl(Ip,R,tp),Ip,U,W,Op),Rp=nu(G,wp,ru(bp,Dd,R,Sp,tp),Dd,U,W,Op),zp=Od(Yd),Bp=du(G,wp,fu(bp,zp,R,Sp,tp),zp,Yd,U,W,Op),Vp=yu(G,wp,bu(bp,kd,R,Sp,tp),kd,U,W),Hp=Pd(ku,z,Wd,Yd),Up=uf(Zf,kd,Wd,yf(kd,rp)),Wp=Fu(xp,R,rp,tp,Up),Gp=Mu(G,Ad(Hp),Wp,U,W,Op),Kp=Uc(wp,jp,Pp,Wd,Yd,kf,W,jf),qp=new WeakMap,Jp=Qu(Ep,Kp,ap,W,qp,Gf),Yp=Bd(vp,Zf,zf,Bf,Vf,Wf),Xp=$d(G,wp,Yp,ef(bp,Yp,R,Sp,tp),U,W,Gf),Zp=Hl(xp),Qp=qd(Zp,z,Jd(Zp,z,kd,Af,Ap),Af,Ap,op,jf),$p=Vd(Hd(Xc,z,jp,kd,Wd,Qp,Yd,tl,kf,Ap)),em=nf(G,wp,$p,rf(bp,jp,Pp,kd,$p,R,rp,Sp,tp,Up),U,W,Op),tm=of(Ud(yc),U,new WeakSet,Pf),nm=Gd(Kd(jp,Sd,kd,Qp,Yd,Ap),Yd),rm=hf(G,wp,nm,gf(bp,nm,R,Sp,tp),U,W),im=Sf(G,z,Qp,Cf(Qp,R,tp),U,W,Op),am=Ku(Qf),om=gu(Qf),sm=new WeakMap,cm=Du(sm,rp),lm=am?tc(Zf,Yd,mu(Qf),om,_u(Fs),U,cm,W,up,new WeakMap,new WeakMap,vf(up,rp),Qf):void 0,um=Wu(sp,W),dm=kl(lm,dp,_p,Tp,kp,Mp,Np,Fp,Lp,$l(fp,Zf,Zl,pu,new WeakSet,U,um,vc,$u,hp,gp),Rp,Bp,Vp,Gp,Jp,Xp,em,tm,rm,im),fm=Bc(dm,z,Yd,bf,qu(G,Fd,U,W),Yu(G,Id,U,W),Xu(G,Ld,U,W),Zu(G,Rd(z,W),U),op),pm=Ou(qp),mm=pc(pm),hm=Vl(yc),gm=au(pm),_m=lu(yc),vm=new WeakMap,ym=pd(z,vd(hm,yc,z,jp,Sd,Pp,kd,Wd,Yd,_m,om,xu(vm,nc),Ap),kd,Yd,Ap),bm=Ol(bp,hm,xp,jp,Sd,Pp,kd,gm,_m,om,R,up,rp,Sp,tp,Up),xm=Tu(sm),Sm=df(vm),Cm=am?Sl(mm,G,wp,bm,ym,Fc,xm,U,W,up,Mf,Sm,Hf,Gf):void 0,wm=Zd(dm,Zf,z,Xl(Yd,rp),pf(fp,Zf,ep,pm,Up,vc,hp,gp)),Tm=Lu(Ws,sp),Em=Ru(Vs,cp),Dm=zu(Us,lp),Om=Bu(Ws,W);function km(e){return e===void 0}function K(e){return e!==void 0}function Am(e){return typeof e==`function`}function jm(e){return typeof e==`number`}function Mm(e){return Object.prototype.toString.call(e)===`[object Object]`&&e.constructor===Object}function Nm(e){return typeof e==`boolean`}function Pm(e){return Array.isArray(e)}function Fm(e){return typeof e==`string`}function Im(e){return Fm(e)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(e)}function q(e,t){if(!e)throw Error(t)}function Lm(e,t,n=1/0){if(!(t<=e&&e<=n))throw RangeError(`Value must be within [${t}, ${n}], got: ${e}`)}function Rm(e){!e.isOffline&&e.state!==`running`&&Gm(`The AudioContext is "suspended". Invoke Tone.start() from a user action to start the audio.`)}var zm=!1,Bm=!1;function Vm(e){zm=e}function Hm(e){km(e)&&zm&&!Bm&&(Bm=!0,Gm(`Events scheduled inside of scheduled callbacks should use the passed in scheduling time. See https://github.com/Tonejs/Tone.js/wiki/Accurate-Timing`))}var Um=console;function Wm(...e){Um.log(...e)}function Gm(...e){Um.warn(...e)}function Km(e){return new fm(e)}function qm(e,t,n){return new wm(e,t,n)}var Jm=typeof self==`object`?self:null,Ym=Jm&&(Jm.hasOwnProperty(`AudioContext`)||Jm.hasOwnProperty(`webkitAudioContext`));function Xm(e,t,n){return q(K(Cm),`AudioWorkletNode only works in a secure context (https or localhost)`),new(e instanceof Jm?.BaseAudioContext?Jm?.AudioWorkletNode:Cm)(e,t,n)}function Zm(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function J(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var Qm=class{constructor(e,t,n,r){this._callback=e,this._type=t,this._minimumUpdateInterval=Math.max(128/(r||44100),.001),this.updateInterval=n,this._createClock()}_createWorker(){let e=new Blob([`
// the initial timeout time
let timeoutTime = ${(this._updateInterval*1e3).toFixed(1)};
// onmessage callback
self.onmessage = function(msg){
timeoutTime = parseInt(msg.data);
};
// the tick function which posts a message
// and schedules a new tick
function tick(){
setTimeout(tick, timeoutTime);
self.postMessage('tick');
}
// call tick initially
tick();
`],{type:`text/javascript`}),t=URL.createObjectURL(e),n=new Worker(t);n.onmessage=this._callback.bind(this),this._worker=n}_createTimeout(){this._timeout=setTimeout(()=>{this._createTimeout(),this._callback()},this._updateInterval*1e3)}_createClock(){if(this._type===`worker`)try{this._createWorker()}catch{this._type=`timeout`,this._createClock()}else this._type===`timeout`&&this._createTimeout()}_disposeClock(){this._timeout&&clearTimeout(this._timeout),this._worker&&(this._worker.terminate(),this._worker.onmessage=null)}get updateInterval(){return this._updateInterval}set updateInterval(e){var t;this._updateInterval=Math.max(e,this._minimumUpdateInterval),this._type===`worker`&&((t=this._worker)==null||t.postMessage(this._updateInterval*1e3))}get type(){return this._type}set type(e){this._disposeClock(),this._type=e,this._createClock()}dispose(){this._disposeClock()}};function $m(e){return Dm(e)}function eh(e){return Em(e)}function th(e){return Om(e)}function nh(e){return Tm(e)}function rh(e){return e instanceof _p}function ih(e,t){return e===`value`||$m(t)||eh(t)||rh(t)}function ah(e,...t){if(!t.length)return e;let n=t.shift();if(Mm(e)&&Mm(n))for(let t in n)ih(t,n[t])?e[t]=n[t]:Mm(n[t])?(e[t]||Object.assign(e,{[t]:{}}),ah(e[t],n[t])):Object.assign(e,{[t]:n[t]});return ah(e,...t)}function oh(e,t){return e.length===t.length&&e.every((e,n)=>t[n]===e)}function Y(e,t,n=[],r){let i={},a=Array.from(t);if(Mm(a[0])&&r&&!Reflect.has(a[0],r)&&(Object.keys(a[0]).some(t=>Reflect.has(e,t))||(ah(i,{[r]:a[0]}),n.splice(n.indexOf(r),1),a.shift())),a.length===1&&Mm(a[0]))ah(i,a[0]);else for(let e=0;e<n.length;e++)K(a[e])&&(i[n[e]]=a[e]);return ah(e,i)}function sh(e){return e.constructor.getDefaults()}function ch(e,t){return km(e)?t:e}function lh(e,t){return t.forEach(t=>{Reflect.has(e,t)&&delete e[t]}),e}var uh=class{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...e){(this.debug||Jm&&this.toString()===Jm.TONE_DEBUG_CLASS)&&Wm(this,...e)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}};uh.version=Ss;var dh=1e-6;function fh(e,t){return e>t+dh}function ph(e,t){return fh(e,t)||hh(e,t)}function mh(e,t){return e+dh<t}function hh(e,t){return Math.abs(e-t)<dh}function gh(e,t,n){return Math.max(Math.min(e,n),t)}var _h=class e extends uh{constructor(){super(),this.name=`Timeline`,this._timeline=[];let t=Y(e.getDefaults(),arguments,[`memory`]);this.memory=t.memory,this.increasing=t.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(e){if(q(Reflect.has(e,`time`),`Timeline: events must have a time attribute`),e.time=e.time.valueOf(),this.increasing&&this.length){let t=this._timeline[this.length-1];q(ph(e.time,t.time),`The time must be greater than or equal to the last scheduled time`),this._timeline.push(e)}else{let t=this._search(e.time);this._timeline.splice(t+1,0,e)}if(this.length>this.memory){let e=this.length-this.memory;this._timeline.splice(0,e)}return this}remove(e){let t=this._timeline.indexOf(e);return t!==-1&&this._timeline.splice(t,1),this}get(e,t=`time`){let n=this._search(e,t);return n===-1?null:this._timeline[n]}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(e,t=`time`){let n=this._search(e,t);return n+1<this._timeline.length?this._timeline[n+1]:null}getBefore(e){let t=this._timeline.length;if(t>0&&this._timeline[t-1].time<e)return this._timeline[t-1];let n=this._search(e);return n-1>=0?this._timeline[n-1]:null}cancel(e){if(this._timeline.length>1){let t=this._search(e);if(t>=0)if(hh(this._timeline[t].time,e)){for(let n=t;n>=0&&hh(this._timeline[n].time,e);n--)t=n;this._timeline=this._timeline.slice(0,t)}else this._timeline=this._timeline.slice(0,t+1);else this._timeline=[]}else this._timeline.length===1&&ph(this._timeline[0].time,e)&&(this._timeline=[]);return this}cancelBefore(e){let t=this._search(e);return t>=0&&(this._timeline=this._timeline.slice(t+1)),this}previousEvent(e){let t=this._timeline.indexOf(e);return t>0?this._timeline[t-1]:null}_search(e,t=`time`){if(this._timeline.length===0)return-1;let n=0,r=this._timeline.length,i=r;if(r>0&&this._timeline[r-1][t]<=e)return r-1;for(;n<i;){let r=Math.floor(n+(i-n)/2),a=this._timeline[r],o=this._timeline[r+1];if(hh(a[t],e)){for(let n=r;n<this._timeline.length;n++){let i=this._timeline[n];if(hh(i[t],e))r=n;else break}return r}else if(mh(a[t],e)&&fh(o[t],e))return r;else fh(a[t],e)?i=r:n=r+1}return-1}_iterate(e,t=0,n=this._timeline.length-1){this._timeline.slice(t,n+1).forEach(e)}forEach(e){return this._iterate(e),this}forEachBefore(e,t){let n=this._search(e);return n!==-1&&this._iterate(t,0,n),this}forEachAfter(e,t){let n=this._search(e);return this._iterate(t,n+1),this}forEachBetween(e,t,n){let r=this._search(e),i=this._search(t);return r!==-1&&i!==-1?(this._timeline[r].time!==e&&(r+=1),this._timeline[i].time===t&&--i,this._iterate(n,r,i)):r===-1&&this._iterate(n,0,i),this}forEachFrom(e,t){let n=this._search(e);for(;n>=0&&this._timeline[n].time>=e;)n--;return this._iterate(t,n+1),this}forEachAtTime(e,t){let n=this._search(e);if(n!==-1&&hh(this._timeline[n].time,e)){let r=n;for(let t=n;t>=0&&hh(this._timeline[t].time,e);t--)r=t;this._iterate(e=>{t(e)},r,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}},vh=[];function yh(e){vh.push(e)}function bh(e){vh.forEach(t=>t(e))}var xh=[];function Sh(e){xh.push(e)}function Ch(e){xh.forEach(t=>t(e))}var wh=class e extends uh{constructor(){super(...arguments),this.name=`Emitter`}on(e,t){return e.split(/\W+/).forEach(e=>{km(this._events)&&(this._events={}),this._events.hasOwnProperty(e)||(this._events[e]=[]),this._events[e].push(t)}),this}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}off(e,t){return e.split(/\W+/).forEach(e=>{if(km(this._events)&&(this._events={}),this._events.hasOwnProperty(e))if(km(t))this._events[e]=[];else{let n=this._events[e];for(let e=n.length-1;e>=0;e--)n[e]===t&&n.splice(e,1)}}),this}emit(e,...t){if(this._events&&this._events.hasOwnProperty(e)){let n=this._events[e].slice(0);for(let e=0,r=n.length;e<r;e++)n[e].apply(this,t)}return this}static mixin(t){[`on`,`once`,`off`,`emit`].forEach(n=>{let r=Object.getOwnPropertyDescriptor(e.prototype,n);Object.defineProperty(t.prototype,n,r)})}dispose(){return super.dispose(),this._events=void 0,this}},Th=class extends wh{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}},Eh=class e extends Th{constructor(){super(),this.name=`Context`,this._constants=new Map,this._timeouts=new _h,this._timeoutIds=0,this._initialized=!1,this._closeStarted=!1,this.isOffline=!1,this._workletPromise=null;let t=Y(e.getDefaults(),arguments,[`context`]);t.context?(this._context=t.context,this._latencyHint=arguments[0]?.latencyHint||``):(this._context=Km({latencyHint:t.latencyHint}),this._latencyHint=t.latencyHint),this._ticker=new Qm(this.emit.bind(this,`tick`),t.clockSource,t.updateInterval,this._context.sampleRate),this.on(`tick`,this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit(`statechange`,this.state)},this[arguments[0]?.hasOwnProperty(`updateInterval`)?`_lookAhead`:`lookAhead`]=t.lookAhead}static getDefaults(){return{clockSource:`worker`,latencyHint:`interactive`,lookAhead:.1,updateInterval:.05}}initialize(){return this._initialized||=(bh(this),!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(e,t,n){return this._context.createBuffer(e,t,n)}createChannelMerger(e){return this._context.createChannelMerger(e)}createChannelSplitter(e){return this._context.createChannelSplitter(e)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(e){return this._context.createDelay(e)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(e,t){return this._context.createIIRFilter(e,t)}createPanner(){return this._context.createPanner()}createPeriodicWave(e,t,n){return this._context.createPeriodicWave(e,t,n)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(e){return q(nh(this._context),`Not available if OfflineAudioContext`),this._context.createMediaStreamSource(e)}createMediaElementSource(e){return q(nh(this._context),`Not available if OfflineAudioContext`),this._context.createMediaElementSource(e)}createMediaStreamDestination(){return q(nh(this._context),`Not available if OfflineAudioContext`),this._context.createMediaStreamDestination()}decodeAudioData(e){return this._context.decodeAudioData(e)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(e){q(!this._initialized,`The listener cannot be set after initialization.`),this._listener=e}get transport(){return this.initialize(),this._transport}set transport(e){q(!this._initialized,`The transport cannot be set after initialization.`),this._transport=e}get draw(){return this.initialize(),this._draw}set draw(e){q(!this._initialized,`Draw cannot be set after initialization.`),this._draw=e}get destination(){return this.initialize(),this._destination}set destination(e){q(!this._initialized,`The destination cannot be set after initialization.`),this._destination=e}createAudioWorkletNode(e,t){return Xm(this.rawContext,e,t)}addAudioWorkletModule(e){return J(this,void 0,void 0,function*(){q(K(this.rawContext.audioWorklet),`AudioWorkletNode is only available in a secure context (https or localhost)`),this._workletPromise||=this.rawContext.audioWorklet.addModule(e),yield this._workletPromise})}workletsAreReady(){return J(this,void 0,void 0,function*(){(yield this._workletPromise)?this._workletPromise:Promise.resolve()})}get updateInterval(){return this._ticker.updateInterval}set updateInterval(e){this._ticker.updateInterval=e}get clockSource(){return this._ticker.type}set clockSource(e){this._ticker.type=e}get lookAhead(){return this._lookAhead}set lookAhead(e){this._lookAhead=e,this.updateInterval=e?e/2:.01}get latencyHint(){return this._latencyHint}get rawContext(){return this._context}now(){return this._context.currentTime+this._lookAhead}immediate(){return this._context.currentTime}resume(){return nh(this._context)?this._context.resume():Promise.resolve()}close(){return J(this,void 0,void 0,function*(){nh(this._context)&&this.state!==`closed`&&!this._closeStarted&&(this._closeStarted=!0,yield this._context.close()),this._initialized&&Ch(this)})}getConstant(e){if(this._constants.has(e))return this._constants.get(e);{let t=this._context.createBuffer(1,128,this._context.sampleRate),n=t.getChannelData(0);for(let t=0;t<n.length;t++)n[t]=e;let r=this._context.createBufferSource();return r.channelCount=1,r.channelCountMode=`explicit`,r.buffer=t,r.loop=!0,r.start(0),this._constants.set(e,r),r}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map(e=>this._constants[e].disconnect()),this.close(),this}_timeoutLoop(){let e=this.now();this._timeouts.forEachBefore(e,e=>{e.callback(),this._timeouts.remove(e)})}setTimeout(e,t){this._timeoutIds++;let n=this.now();return this._timeouts.add({callback:e,id:this._timeoutIds,time:n+t}),this._timeoutIds}clearTimeout(e){return this._timeouts.forEach(t=>{t.id===e&&this._timeouts.remove(t)}),this}clearInterval(e){return this.clearTimeout(e)}setInterval(e,t){let n=++this._timeoutIds,r=()=>{let i=this.now();this._timeouts.add({callback:()=>{e(),r()},id:n,time:i+t})};return r(),n}},Dh=class extends Th{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(e,t,n){return{}}createChannelMerger(e){return{}}createChannelSplitter(e){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(e){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(e,t){return{}}createPanner(){return{}}createPeriodicWave(e,t,n){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(e){return{}}createMediaElementSource(e){return{}}createMediaStreamDestination(){return{}}decodeAudioData(e){return Promise.resolve({})}createAudioWorkletNode(e,t){return{}}get rawContext(){return{}}addAudioWorkletModule(e){return J(this,void 0,void 0,function*(){return Promise.resolve()})}resume(){return Promise.resolve()}setTimeout(e,t){return 0}clearTimeout(e){return this}setInterval(e,t){return 0}clearInterval(e){return this}getConstant(e){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(e){}get destination(){return{}}set destination(e){}now(){return 0}immediate(){return 0}};function X(e,t){Pm(t)?t.forEach(t=>X(e,t)):Object.defineProperty(e,t,{enumerable:!0,writable:!1})}function Oh(e,t){Pm(t)?t.forEach(t=>Oh(e,t)):Object.defineProperty(e,t,{writable:!0})}var Z=()=>{},kh=class e extends uh{constructor(){super(),this.name=`ToneAudioBuffer`,this.onload=Z;let t=Y(e.getDefaults(),arguments,[`url`,`onload`,`onerror`]);this.reverse=t.reverse,this.onload=t.onload,Fm(t.url)?this.load(t.url).catch(t.onerror):t.url&&this.set(t.url)}static getDefaults(){return{onerror:Z,onload:Z,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:Nh().sampleRate}set(t){return t instanceof e?t.loaded?this._buffer=t.get():t.onload=()=>{this.set(t),this.onload(this)}:this._buffer=t,this._reversed&&this._reverse(),this}get(){return this._buffer}load(t){return J(this,void 0,void 0,function*(){let n=e.load(t).then(e=>{this.set(e),this.onload(this)});e.downloads.push(n);try{yield n}finally{let t=e.downloads.indexOf(n);e.downloads.splice(t,1)}return this})}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(e){let t=Pm(e)&&e[0].length>0,n=t?e.length:1,r=t?e[0].length:e.length,i=Nh(),a=i.createBuffer(n,r,i.sampleRate),o=!t&&n===1?[e]:e;for(let e=0;e<n;e++)a.copyToChannel(o[e],e);return this._buffer=a,this}toMono(e){if(jm(e))this.fromArray(this.toArray(e));else{let e=new Float32Array(this.length),t=this.numberOfChannels;for(let n=0;n<t;n++){let t=this.toArray(n);for(let n=0;n<t.length;n++)e[n]+=t[n]}e=e.map(e=>e/t),this.fromArray(e)}return this}toArray(e){if(jm(e))return this.getChannelData(e);if(this.numberOfChannels===1)return this.toArray(0);{let e=[];for(let t=0;t<this.numberOfChannels;t++)e[t]=this.getChannelData(t);return e}}getChannelData(e){return this._buffer?this._buffer.getChannelData(e):new Float32Array}slice(t,n=this.duration){q(this.loaded,`Buffer is not loaded`);let r=Math.floor(t*this.sampleRate),i=Math.floor(n*this.sampleRate);q(r<i,`The start time must be less than the end time`);let a=i-r,o=Nh().createBuffer(this.numberOfChannels,a,this.sampleRate);for(let e=0;e<this.numberOfChannels;e++)o.copyToChannel(this.getChannelData(e).subarray(r,i),e);return new e(o)}_reverse(){if(this.loaded)for(let e=0;e<this.numberOfChannels;e++)this.getChannelData(e).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(e){this._reversed!==e&&(this._reversed=e,this._reverse())}static fromArray(t){return new e().fromArray(t)}static fromUrl(t){return J(this,void 0,void 0,function*(){return yield new e().load(t)})}static load(t){return J(this,void 0,void 0,function*(){let n=e.baseUrl===``||e.baseUrl.endsWith(`/`)?e.baseUrl:e.baseUrl+`/`,r=yield fetch(n+t);if(!r.ok)throw Error(`could not load url: ${t}`);let i=yield r.arrayBuffer();return yield Nh().decodeAudioData(i)})}static supportsType(e){let t=e.split(`.`),n=t[t.length-1];return document.createElement(`audio`).canPlayType(`audio/`+n)!==``}static loaded(){return J(this,void 0,void 0,function*(){for(yield Promise.resolve();e.downloads.length;)yield e.downloads[0]})}};kh.baseUrl=``,kh.downloads=[];var Ah=class extends Eh{constructor(){super({clockSource:`offline`,context:th(arguments[0])?arguments[0]:qm(arguments[0],arguments[1]*arguments[2],arguments[2]),lookAhead:0,updateInterval:th(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name=`OfflineContext`,this._currentTime=0,this.isOffline=!0,this._duration=th(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(e){return J(this,void 0,void 0,function*(){let t=0;for(;this._duration-this._currentTime>=0;){this.emit(`tick`),this._currentTime+=128/this.sampleRate,t++;let n=Math.floor(this.sampleRate/128);e&&t%n===0&&(yield new Promise(e=>setTimeout(e,1)))}})}render(){return J(this,arguments,void 0,function*(e=!0){return yield this.workletsAreReady(),yield this._renderClock(e),new kh(yield this._context.startRendering())})}close(){return Promise.resolve()}},jh=new Dh,Mh=jh;function Nh(){return Mh===jh&&Ym&&Ph(new Eh),Mh}function Ph(e,t=!1){t&&Mh.dispose(),Mh=nh(e)?new Eh(e):th(e)?new Ah(e):e}if(Jm&&!Jm.TONE_SILENCE_LOGGING){let e=` * Tone.js v${Ss} * `;console.log(`%c${e}`,`background: #000; color: #fff`)}function Fh(e){return 10**(e/20)}function Ih(e){return Math.log(e)/Math.LN10*20}function Lh(e){return 2**(e/12)}var Rh=440;function zh(){return Rh}function Bh(e){Rh=e}function Vh(e){return Math.round(Hh(e))}function Hh(e){return 69+12*Math.log2(e/Rh)}function Uh(e){return Rh*2**((e-69)/12)}var Wh=class e extends uh{constructor(e,t,n){super(),this.defaultUnits=`s`,this._val=t,this._units=n,this.context=e,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:e=>this._frequencyToUnits(parseFloat(e)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:e=>this._ticksToUnits(parseInt(e,10)),regexp:/^(\d+)i$/i},m:{method:e=>this._beatsToUnits(parseInt(e,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(e,t)=>{let n=parseInt(e,10),r=t===`.`?1.5:1;return n===1?this._beatsToUnits(this._getTimeSignature())*r:this._beatsToUnits(4/n)*r},regexp:/^(\d+)n(\.?)$/i},number:{method:e=>this._expressions[this.defaultUnits].method.call(this,e),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:e=>this._secondsToUnits(parseFloat(e)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:e=>parseInt(e,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:e=>{let t=parseInt(e,10);return this._beatsToUnits(8/(Math.floor(t)*3))},regexp:/^(\d+)t$/i},tr:{method:(e,t,n)=>{let r=0;return e&&e!==`0`&&(r+=this._beatsToUnits(this._getTimeSignature()*parseFloat(e))),t&&t!==`0`&&(r+=this._beatsToUnits(parseFloat(t))),n&&n!==`0`&&(r+=this._beatsToUnits(parseFloat(n)/4)),r},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof e&&this.fromType(this._val),km(this._val))return this._noArg();if(Fm(this._val)&&km(this._units)){for(let e in this._expressions)if(this._expressions[e].regexp.test(this._val.trim())){this._units=e;break}}else if(Mm(this._val)){let e=0;for(let t in this._val)if(K(this._val[t])){let n=this._val[t],r=new this.constructor(this.context,t).valueOf()*n;e+=r}return e}if(K(this._units)){let e=this._expressions[this._units],t=this._val.toString().trim().match(e.regexp);return t?e.method.apply(this,t.slice(1)):e.method.call(this,this._val)}else if(Fm(this._val))return parseFloat(this._val);else return this._val}_frequencyToUnits(e){return 1/e}_beatsToUnits(e){return 60/this._getBpm()*e}_secondsToUnits(e){return e}_ticksToUnits(e){return e*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(e){switch(this._units=void 0,this.defaultUnits){case`s`:this._val=e.toSeconds();break;case`i`:this._val=e.toTicks();break;case`hz`:this._val=e.toFrequency();break;case`midi`:this._val=e.toMidi();break}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return this.toSeconds()*1e3}},Gh=class e extends Wh{constructor(){super(...arguments),this.name=`TimeClass`}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:e=>this._now()+new this.constructor(this.context,e).valueOf(),regexp:/^\+(.+)/},quantize:{method:t=>{let n=new e(this.context,t).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(n))},regexp:/^@(.+)/}})}quantize(e,t=1){let n=new this.constructor(this.context,e).valueOf(),r=this.valueOf();return r+(Math.round(r/n)*n-r)*t}toNotation(){let t=this.toSeconds(),n=[`1m`];for(let e=1;e<9;e++){let t=2**e;n.push(t+`n.`),n.push(t+`n`),n.push(t+`t`)}n.push(`0`);let r=n[0],i=new e(this.context,n[0]).toSeconds();return n.forEach(n=>{let a=new e(this.context,n).toSeconds();Math.abs(a-t)<Math.abs(i-t)&&(r=n,i=a)}),r}toBarsBeatsSixteenths(){let e=this._beatsToUnits(1),t=this.valueOf()/e;t=parseFloat(t.toFixed(4));let n=Math.floor(t/this._getTimeSignature()),r=t%1*4;t=Math.floor(t)%this._getTimeSignature();let i=r.toString();return i.length>3&&(r=parseFloat(parseFloat(i).toFixed(3))),[n,t,r].join(`:`)}toTicks(){let e=this._beatsToUnits(1);return this.valueOf()/e*this._getPPQ()}toSeconds(){return this.valueOf()}toMidi(){return Vh(this.toFrequency())}_now(){return this.context.now()}},Kh=class e extends Gh{constructor(){super(...arguments),this.name=`Frequency`,this.defaultUnits=`hz`}static get A4(){return zh()}static set A4(e){Bh(e)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return this.defaultUnits===`midi`?t:e.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|##|x|bb|###|#x|x#|bbb)?)(-?[0-9]+)/i,method(t,n){let r=qh[t.toLowerCase()]+(parseInt(n,10)+1)*12;return this.defaultUnits===`midi`?r:e.mtof(r)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(e,t,n){let r=1;return e&&e!==`0`&&(r*=this._beatsToUnits(this._getTimeSignature()*parseFloat(e))),t&&t!==`0`&&(r*=this._beatsToUnits(parseFloat(t))),n&&n!==`0`&&(r*=this._beatsToUnits(parseFloat(n)/4)),r}}})}transpose(t){return new e(this.context,this.valueOf()*Lh(t))}harmonize(e){return e.map(e=>this.transpose(e))}toMidi(){return Vh(this.valueOf())}toNote(){let t=this.toFrequency(),n=Math.log2(t/e.A4),r=Math.round(12*n)+57,i=Math.floor(r/12);return i<0&&(r+=-12*i),Jh[r%12]+i.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){let e=this._beatsToUnits(1),t=this.valueOf()/e;return Math.floor(t*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(e){return e}_ticksToUnits(e){return 1/(e*60/(this._getBpm()*this._getPPQ()))}_beatsToUnits(e){return 1/super._beatsToUnits(e)}_secondsToUnits(e){return 1/e}static mtof(e){return Uh(e)}static ftom(e){return Vh(e)}},qh={cbbb:-3,cbb:-2,cb:-1,c:0,"c#":1,cx:2,"c##":2,"c###":3,"cx#":3,"c#x":3,dbbb:-1,dbb:0,db:1,d:2,"d#":3,dx:4,"d##":4,"d###":5,"dx#":5,"d#x":5,ebbb:1,ebb:2,eb:3,e:4,"e#":5,ex:6,"e##":6,"e###":7,"ex#":7,"e#x":7,fbbb:2,fbb:3,fb:4,f:5,"f#":6,fx:7,"f##":7,"f###":8,"fx#":8,"f#x":8,gbbb:4,gbb:5,gb:6,g:7,"g#":8,gx:9,"g##":9,"g###":10,"gx#":10,"g#x":10,abbb:6,abb:7,ab:8,a:9,"a#":10,ax:11,"a##":11,"a###":12,"ax#":12,"a#x":12,bbbb:8,bbb:9,bb:10,b:11,"b#":12,bx:13,"b##":13,"b###":14,"bx#":14,"b#x":14},Jh=[`C`,`C#`,`D`,`D#`,`E`,`F`,`F#`,`G`,`G#`,`A`,`A#`,`B`],Yh=class extends Gh{constructor(){super(...arguments),this.name=`TransportTime`}_now(){return this.context.transport.seconds}},Xh=class e extends uh{constructor(){super();let t=Y(e.getDefaults(),arguments,[`context`]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:Nh()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(e){return Hm(e),new Gh(this.context,e).toSeconds()}toFrequency(e){return new Kh(this.context,e).toFrequency()}toTicks(e){return new Yh(this.context,e).toTicks()}_getPartialProperties(e){let t=this.get();return Object.keys(t).forEach(n=>{km(e[n])&&delete t[n]}),t}get(){let t=sh(this);return Object.keys(t).forEach(n=>{if(Reflect.has(this,n)){let r=this[n];K(r)&&K(r.value)&&K(r.setValueAtTime)?t[n]=r.value:r instanceof e?t[n]=r._getPartialProperties(t[n]):Pm(r)||jm(r)||Fm(r)||Nm(r)?t[n]=r:delete t[n]}}),t}set(t){return Object.keys(t).forEach(n=>{Reflect.has(this,n)&&K(this[n])&&(this[n]&&K(this[n].value)&&K(this[n].setValueAtTime)?this[n].value!==t[n]&&(this[n].value=t[n]):this[n]instanceof e?this[n].set(t[n]):this[n]=t[n])}),this}},Zh=class extends _h{constructor(e=`stopped`){super(),this.name=`StateTimeline`,this._initial=e,this.setStateAtTime(this._initial,0)}getValueAtTime(e){let t=this.get(e);return t===null?this._initial:t.state}setStateAtTime(e,t,n){return Lm(t,0),this.add(Object.assign({},n,{state:e,time:t})),this}getLastState(e,t){let n=this._search(t);for(let t=n;t>=0;t--){let n=this._timeline[t];if(n.state===e)return n}}getNextState(e,t){let n=this._search(t);if(n!==-1)for(let t=n;t<this._timeline.length;t++){let n=this._timeline[t];if(n.state===e)return n}}},Q=class e extends Xh{constructor(){let t=Y(e.getDefaults(),arguments,[`param`,`units`,`convert`]);for(super(t),this.name=`Param`,this.overridden=!1,this._minOutput=1e-7,q(K(t.param)&&($m(t.param)||t.param instanceof e),`param must be an AudioParam`);!$m(t.param);)t.param=t.param._param;this._swappable=K(t.swappable)?t.swappable:!1,this._swappable?(this.input=this.context.createGain(),this._param=t.param,this.input.connect(this._param)):this._param=this.input=t.param,this._events=new _h(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,K(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Xh.getDefaults(),{convert:!0,units:`number`})}get value(){let e=this.now();return this.getValueAtTime(e)}set value(e){this.cancelScheduledValues(this.now()),this.setValueAtTime(e,this.now())}get minValue(){return K(this._minValue)?this._minValue:this.units===`time`||this.units===`frequency`||this.units===`normalRange`||this.units===`positive`||this.units===`transportTime`||this.units===`ticks`||this.units===`bpm`||this.units===`hertz`||this.units===`samples`?0:this.units===`audioRange`?-1:this.units===`decibels`?-1/0:this._param.minValue}get maxValue(){return K(this._maxValue)?this._maxValue:this.units===`normalRange`||this.units===`audioRange`?1:this._param.maxValue}_is(e,t){return this.units===t}_assertRange(e){return K(this.maxValue)&&K(this.minValue)&&Lm(e,this._fromType(this.minValue),this._fromType(this.maxValue)),e}_fromType(e){return this.convert&&!this.overridden?this._is(e,`time`)?this.toSeconds(e):this._is(e,`decibels`)?Fh(e):this._is(e,`frequency`)?this.toFrequency(e):e:this.overridden?0:e}_toType(e){return this.convert&&this.units===`decibels`?Ih(e):e}setValueAtTime(e,t){let n=this.toSeconds(t),r=this._fromType(e);return q(isFinite(r)&&isFinite(n),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(e)}, ${JSON.stringify(t)}`),this._assertRange(r),this.log(this.units,`setValueAtTime`,e,n),this._events.add({time:n,type:`setValueAtTime`,value:r}),this._param.setValueAtTime(r,n),this}getValueAtTime(e){let t=Math.max(this.toSeconds(e),0),n=this._events.getAfter(t),r=this._events.get(t),i=this._initialValue;if(r===null)i=this._initialValue;else if(r.type===`setTargetAtTime`&&(n===null||n.type===`setValueAtTime`)){let e=this._events.getBefore(r.time),n;n=e===null?this._initialValue:e.value,r.type===`setTargetAtTime`&&(i=this._exponentialApproach(r.time,n,r.value,r.constant,t))}else if(n===null)i=r.value;else if(n.type===`linearRampToValueAtTime`||n.type===`exponentialRampToValueAtTime`){let e=r.value;if(r.type===`setTargetAtTime`){let t=this._events.getBefore(r.time);e=t===null?this._initialValue:t.value}i=n.type===`linearRampToValueAtTime`?this._linearInterpolate(r.time,e,n.time,n.value,t):this._exponentialInterpolate(r.time,e,n.time,n.value,t)}else i=r.value;return this._toType(i)}setRampPoint(e){e=this.toSeconds(e);let t=this.getValueAtTime(e);return this.cancelAndHoldAtTime(e),this._fromType(t)===0&&(t=this._toType(this._minOutput)),this.setValueAtTime(t,e),this}linearRampToValueAtTime(e,t){let n=this._fromType(e),r=this.toSeconds(t);return q(isFinite(n)&&isFinite(r),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(e)}, ${JSON.stringify(t)}`),this._assertRange(n),this._events.add({time:r,type:`linearRampToValueAtTime`,value:n}),this.log(this.units,`linearRampToValueAtTime`,e,r),this._param.linearRampToValueAtTime(n,r),this}exponentialRampToValueAtTime(e,t){let n=this._fromType(e);n=hh(n,0)?this._minOutput:n,this._assertRange(n);let r=this.toSeconds(t);return q(isFinite(n)&&isFinite(r),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(e)}, ${JSON.stringify(t)}`),this._events.add({time:r,type:`exponentialRampToValueAtTime`,value:n}),this.log(this.units,`exponentialRampToValueAtTime`,e,r),this._param.exponentialRampToValueAtTime(n,r),this}exponentialRampTo(e,t,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(e,n+this.toSeconds(t)),this}linearRampTo(e,t,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(e,n+this.toSeconds(t)),this}targetRampTo(e,t,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(e,n,t),this}exponentialApproachValueAtTime(e,t,n){t=this.toSeconds(t),n=this.toSeconds(n);let r=Math.log(n+1)/Math.log(200);return this.setTargetAtTime(e,t,r),this.cancelAndHoldAtTime(t+n*.9),this.linearRampToValueAtTime(e,t+n),this}setTargetAtTime(e,t,n){let r=this._fromType(e);q(isFinite(n)&&n>0,`timeConstant must be a number greater than 0`);let i=this.toSeconds(t);return this._assertRange(r),q(isFinite(r)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(e)}, ${JSON.stringify(t)}`),this._events.add({constant:n,time:i,type:`setTargetAtTime`,value:r}),this.log(this.units,`setTargetAtTime`,e,i,n),this._param.setTargetAtTime(r,i,n),this}setValueCurveAtTime(e,t,n,r=1){n=this.toSeconds(n),t=this.toSeconds(t);let i=this._fromType(e[0])*r;this.setValueAtTime(this._toType(i),t);let a=n/(e.length-1);for(let n=1;n<e.length;n++){let i=this._fromType(e[n])*r;this.linearRampToValueAtTime(this._toType(i),t+n*a)}return this}cancelScheduledValues(e){let t=this.toSeconds(e);return q(isFinite(t),`Invalid argument to cancelScheduledValues: ${JSON.stringify(e)}`),this._events.cancel(t),this._param.cancelScheduledValues(t),this.log(this.units,`cancelScheduledValues`,t),this}cancelAndHoldAtTime(e){let t=this.toSeconds(e),n=this._fromType(this.getValueAtTime(t));q(isFinite(t),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(e)}`),this.log(this.units,`cancelAndHoldAtTime`,t,`value=`+n);let r=this._events.get(t),i=this._events.getAfter(t);return r&&hh(r.time,t)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(t),this._events.cancel(t+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),i.type===`linearRampToValueAtTime`?this.linearRampToValueAtTime(this._toType(n),t):i.type===`exponentialRampToValueAtTime`&&this.exponentialRampToValueAtTime(this._toType(n),t)),this._events.add({time:t,type:`setValueAtTime`,value:n}),this._param.setValueAtTime(n,t),this}rampTo(e,t=.1,n){return this.units===`frequency`||this.units===`bpm`||this.units===`decibels`?this.exponentialRampTo(e,t,n):this.linearRampTo(e,t,n),this}apply(e){let t=this.context.currentTime;e.setValueAtTime(this.getValueAtTime(t),t);let n=this._events.get(t);if(n&&n.type===`setTargetAtTime`){let r=this._events.getAfter(n.time),i=r?r.time:t+2,a=(i-t)/10;for(let n=t;n<i;n+=a)e.linearRampToValueAtTime(this.getValueAtTime(n),n)}return this._events.forEachAfter(this.context.currentTime,t=>{t.type===`cancelScheduledValues`?e.cancelScheduledValues(t.time):t.type===`setTargetAtTime`?e.setTargetAtTime(t.value,t.time,t.constant):e[t.type](t.value,t.time)}),this}setParam(e){q(this._swappable,`The Param must be assigned as 'swappable' in the constructor`);let t=this.input;return t.disconnect(this._param),this.apply(e),this._param=e,t.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(e,t,n,r,i){return n+(t-n)*Math.exp(-(i-e)/r)}_linearInterpolate(e,t,n,r,i){return t+(r-t)*((i-e)/(n-e))}_exponentialInterpolate(e,t,n,r,i){return t*(r/t)**+((i-e)/(n-e))}},$=class e extends Xh{constructor(){super(...arguments),this._internalChannels=[]}get numberOfInputs(){return K(this.input)?$m(this.input)||this.input instanceof Q?1:this.input.numberOfInputs:0}get numberOfOutputs(){return K(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return K(t)&&(t instanceof e||eh(t))}_getInternalNodes(){let e=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&e.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&e.push(this.output),e}_setChannelProperties(e){this._getInternalNodes().forEach(t=>{t.channelCount=e.channelCount,t.channelCountMode=e.channelCountMode,t.channelInterpretation=e.channelInterpretation})}_getChannelProperties(){let e=this._getInternalNodes();q(e.length>0,`ToneAudioNode does not have any internal nodes`);let t=e[0];return{channelCount:t.channelCount,channelCountMode:t.channelCountMode,channelInterpretation:t.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(e){let t=this._getChannelProperties();this._setChannelProperties(Object.assign(t,{channelCount:e}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(e){let t=this._getChannelProperties();this._setChannelProperties(Object.assign(t,{channelCountMode:e}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(e){let t=this._getChannelProperties();this._setChannelProperties(Object.assign(t,{channelInterpretation:e}))}connect(e,t=0,n=0){return $h(this,e,t,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return Gm(`toMaster() has been renamed toDestination()`),this.toDestination()}disconnect(e,t=0,n=0){return eg(this,e,t,n),this}chain(...e){return Qh(this,...e),this}fan(...e){return e.forEach(e=>this.connect(e)),this}dispose(){return super.dispose(),K(this.input)&&(this.input instanceof e?this.input.dispose():eh(this.input)&&this.input.disconnect()),K(this.output)&&(this.output instanceof e?this.output.dispose():eh(this.output)&&this.output.disconnect()),this._internalChannels=[],this}};function Qh(...e){let t=e.shift();e.reduce((e,t)=>(e instanceof $?e.connect(t):eh(e)&&$h(e,t),t),t)}function $h(e,t,n=0,r=0){for(q(K(e),`Cannot connect from undefined node`),q(K(t),`Cannot connect to undefined node`),(t instanceof $||eh(t))&&q(t.numberOfInputs>0,`Cannot connect to node with no inputs`),q(e.numberOfOutputs>0,`Cannot connect from node with no outputs`);t instanceof $||t instanceof Q;)K(t.input)&&(t=t.input);for(;e instanceof $;)K(e.output)&&(e=e.output);$m(t)?e.connect(t,n):e.connect(t,n,r)}function eg(e,t,n=0,r=0){if(K(t))for(;t instanceof $;)t=t.input;for(;!eh(e);)K(e.output)&&(e=e.output);$m(t)?e.disconnect(t,n):eh(t)?e.disconnect(t,n,r):e.disconnect()}var tg=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments,[`gain`,`units`]);super(t),this.name=`Gain`,this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode,this.gain=new Q({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),X(this,`gain`)}static getDefaults(){return Object.assign($.getDefaults(),{convert:!0,gain:1,units:`gain`})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}},ng=class extends ${constructor(e){super(e),this.onended=Z,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new tg({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(e){let t=this.toSeconds(e);return this._startTime!==-1&&t>=this._startTime&&(this._stopTime===-1||t<=this._stopTime)?`started`:`stopped`},this._fadeIn=e.fadeIn,this._fadeOut=e.fadeOut,this._curve=e.curve,this.onended=e.onended}static getDefaults(){return Object.assign($.getDefaults(),{curve:`linear`,fadeIn:0,fadeOut:0,onended:Z})}_startGain(e,t=1){q(this._startTime===-1,`Source cannot be started more than once`);let n=this.toSeconds(this._fadeIn);return this._startTime=e+n,this._startTime=Math.max(this._startTime,this.context.currentTime),n>0?(this._gainNode.gain.setValueAtTime(0,e),this._curve===`linear`?this._gainNode.gain.linearRampToValueAtTime(t,e+n):this._gainNode.gain.exponentialApproachValueAtTime(t,e,n)):this._gainNode.gain.setValueAtTime(t,e),this}stop(e){return this.log(`stop`,e),this._stopGain(this.toSeconds(e)),this}_stopGain(e){q(this._startTime!==-1,`'start' must be called before 'stop'`),this.cancelStop();let t=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(e)+t,this._stopTime=Math.max(this._stopTime,this.now()),t>0?this._curve===`linear`?this._gainNode.gain.linearRampTo(0,t,e):this._gainNode.gain.targetRampTo(0,t,e):(this._gainNode.gain.cancelAndHoldAtTime(e),this._gainNode.gain.setValueAtTime(0,e)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(()=>{let e=this._curve===`exponential`?t*2:0;this._stopSource(this.now()+e),this._onended()},this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==Z&&(this.onended(this),this.onended=Z,!this.context.isOffline)){let e=()=>this.dispose();typeof requestIdleCallback<`u`?requestIdleCallback(e):setTimeout(e,10)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log(`cancelStop`),q(this._startTime!==-1,`Source is not started`),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}dispose(){return super.dispose(),this._gainNode.dispose(),this.onended=Z,this}},rg=class e extends ng{constructor(){let t=Y(e.getDefaults(),arguments,[`offset`]);super(t),this.name=`ToneConstantSource`,this._source=this.context.createConstantSource(),$h(this._source,this._gainNode),this.offset=new Q({context:this.context,convert:t.convert,param:this._source.offset,units:t.units,value:t.offset,minValue:t.minValue,maxValue:t.maxValue})}static getDefaults(){return Object.assign(ng.getDefaults(),{convert:!0,offset:1,units:`number`})}start(e){let t=this.toSeconds(e);return this.log(`start`,t),this._startGain(t),this._source.start(t),this}_stopSource(e){this._source.stop(e)}dispose(){return super.dispose(),this.state===`started`&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}},ig=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments,[`value`,`units`]);super(t),this.name=`Signal`,this.override=!0,this.output=this._constantSource=new rg({context:this.context,convert:t.convert,offset:t.value,units:t.units,minValue:t.minValue,maxValue:t.maxValue}),this._constantSource.start(0),this.input=this._param=this._constantSource.offset}static getDefaults(){return Object.assign($.getDefaults(),{convert:!0,units:`number`,value:0})}connect(e,t=0,n=0){return ag(this,e,t,n),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(e,t){return this._param.setValueAtTime(e,t),this}getValueAtTime(e){return this._param.getValueAtTime(e)}setRampPoint(e){return this._param.setRampPoint(e),this}linearRampToValueAtTime(e,t){return this._param.linearRampToValueAtTime(e,t),this}exponentialRampToValueAtTime(e,t){return this._param.exponentialRampToValueAtTime(e,t),this}exponentialRampTo(e,t,n){return this._param.exponentialRampTo(e,t,n),this}linearRampTo(e,t,n){return this._param.linearRampTo(e,t,n),this}targetRampTo(e,t,n){return this._param.targetRampTo(e,t,n),this}exponentialApproachValueAtTime(e,t,n){return this._param.exponentialApproachValueAtTime(e,t,n),this}setTargetAtTime(e,t,n){return this._param.setTargetAtTime(e,t,n),this}setValueCurveAtTime(e,t,n,r){return this._param.setValueCurveAtTime(e,t,n,r),this}cancelScheduledValues(e){return this._param.cancelScheduledValues(e),this}cancelAndHoldAtTime(e){return this._param.cancelAndHoldAtTime(e),this}rampTo(e,t,n){return this._param.rampTo(e,t,n),this}get value(){return this._param.value}set value(e){this._param.value=e}get convert(){return this._param.convert}set convert(e){this._param.convert=e}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(e){this._param.overridden=e}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(e){return this._param.apply(e),this}};function ag(e,t,n,r){(t instanceof Q||$m(t)||t instanceof ig&&t.override)&&(t.cancelScheduledValues(0),t.setValueAtTime(0,0),t instanceof ig&&(t.overridden=!0)),$h(e,t,n,r)}var og=class e extends Q{constructor(){let t=Y(e.getDefaults(),arguments,[`value`]);super(t),this.name=`TickParam`,this._events=new _h(1/0),this._multiplier=1,this._multiplier=t.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:`setValueAtTime`,value:this._fromType(t.value)}),this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Q.getDefaults(),{multiplier:1,units:`hertz`,value:1})}setTargetAtTime(e,t,n){t=this.toSeconds(t),this.setRampPoint(t);let r=this._fromType(e),i=this._events.get(t),a=Math.round(Math.max(1/n,1));for(let e=0;e<=a;e++){let a=n*e+t,o=this._exponentialApproach(i.time,i.value,r,n,a);this.linearRampToValueAtTime(this._toType(o),a)}return this}setValueAtTime(e,t){let n=this.toSeconds(t);super.setValueAtTime(e,t);let r=this._events.get(n),i=this._events.previousEvent(r),a=this._getTicksUntilEvent(i,n);return r.ticks=Math.max(a,0),this}linearRampToValueAtTime(e,t){let n=this.toSeconds(t);super.linearRampToValueAtTime(e,t);let r=this._events.get(n),i=this._events.previousEvent(r),a=this._getTicksUntilEvent(i,n);return r.ticks=Math.max(a,0),this}exponentialRampToValueAtTime(e,t){t=this.toSeconds(t);let n=this._fromType(e),r=this._events.get(t),i=Math.round(Math.max((t-r.time)*10,1)),a=(t-r.time)/i;for(let e=0;e<=i;e++){let i=a*e+r.time,o=this._exponentialInterpolate(r.time,r.value,t,n,i);this.linearRampToValueAtTime(this._toType(o),i)}return this}_getTicksUntilEvent(e,t){if(e===null)e={ticks:0,time:0,type:`setValueAtTime`,value:0};else if(km(e.ticks)){let t=this._events.previousEvent(e);e.ticks=this._getTicksUntilEvent(t,e.time)}let n=this._fromType(this.getValueAtTime(e.time)),r=this._fromType(this.getValueAtTime(t)),i=this._events.get(t);return i&&i.time===t&&i.type===`setValueAtTime`&&(r=this._fromType(this.getValueAtTime(t-this.sampleTime))),.5*(t-e.time)*(n+r)+e.ticks}getTicksAtTime(e){let t=this.toSeconds(e),n=this._events.get(t);return Math.max(this._getTicksUntilEvent(n,t),0)}getDurationOfTicks(e,t){let n=this.toSeconds(t),r=this.getTicksAtTime(t);return this.getTimeOfTick(r+e)-n}getTimeOfTick(e){let t=this._events.get(e,`ticks`),n=this._events.getAfter(e,`ticks`);if(t&&t.ticks===e)return t.time;if(t&&n&&n.type===`linearRampToValueAtTime`&&t.value!==n.value){let r=this._fromType(this.getValueAtTime(t.time)),i=(this._fromType(this.getValueAtTime(n.time))-r)/(n.time-t.time),a=Math.sqrt(r**2-2*i*(t.ticks-e)),o=(-r+a)/i,s=(-r-a)/i;return(o>0?o:s)+t.time}else if(t)return t.value===0?1/0:t.time+(e-t.ticks)/t.value;else return e/this._initialValue}ticksToTime(e,t){return this.getDurationOfTicks(e,t)}timeToTicks(e,t){let n=this.toSeconds(t),r=this.toSeconds(e),i=this.getTicksAtTime(n);return this.getTicksAtTime(n+r)-i}_fromType(e){return this.units===`bpm`&&this.multiplier?1/(60/e/this.multiplier):super._fromType(e)}_toType(e){return this.units===`bpm`&&this.multiplier?e/this.multiplier*60:super._toType(e)}get multiplier(){return this._multiplier}set multiplier(e){let t=this.value;this._multiplier=e,this.cancelScheduledValues(0),this.setValueAtTime(t,0)}},sg=class e extends ig{constructor(){let t=Y(e.getDefaults(),arguments,[`value`]);super(t),this.name=`TickSignal`,this.input=this._param=new og({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(ig.getDefaults(),{multiplier:1,units:`hertz`,value:1})}ticksToTime(e,t){return this._param.ticksToTime(e,t)}timeToTicks(e,t){return this._param.timeToTicks(e,t)}getTimeOfTick(e){return this._param.getTimeOfTick(e)}getDurationOfTicks(e,t){return this._param.getDurationOfTicks(e,t)}getTicksAtTime(e){return this._param.getTicksAtTime(e)}get multiplier(){return this._param.multiplier}set multiplier(e){this._param.multiplier=e}dispose(){return super.dispose(),this._param.dispose(),this}},cg=class e extends Xh{constructor(){let t=Y(e.getDefaults(),arguments,[`frequency`]);super(t),this.name=`TickSource`,this._state=new Zh,this._tickOffset=new _h,this._ticksAtTime=new _h,this._secondsAtTime=new _h,this.frequency=new sg({context:this.context,units:t.units,value:t.frequency}),X(this,`frequency`),this._state.setStateAtTime(`stopped`,0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:`hertz`},Xh.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(e,t){let n=this.toSeconds(e);return this._state.getValueAtTime(n)!==`started`&&(this._state.setStateAtTime(`started`,n),K(t)&&this.setTicksAtTime(t,n),this._ticksAtTime.cancel(n),this._secondsAtTime.cancel(n)),this}stop(e){let t=this.toSeconds(e);if(this._state.getValueAtTime(t)===`stopped`){let e=this._state.get(t);e&&e.time>0&&(this._tickOffset.cancel(e.time),this._state.cancel(e.time))}return this._state.cancel(t),this._state.setStateAtTime(`stopped`,t),this.setTicksAtTime(0,t),this._ticksAtTime.cancel(t),this._secondsAtTime.cancel(t),this}pause(e){let t=this.toSeconds(e);return this._state.getValueAtTime(t)===`started`&&(this._state.setStateAtTime(`paused`,t),this._ticksAtTime.cancel(t),this._secondsAtTime.cancel(t)),this}cancel(e){return e=this.toSeconds(e),this._state.cancel(e),this._tickOffset.cancel(e),this._ticksAtTime.cancel(e),this._secondsAtTime.cancel(e),this}getTicksAtTime(e){let t=this.toSeconds(e),n=this._state.getLastState(`stopped`,t),r=this._ticksAtTime.get(t),i={state:`paused`,time:t};this._state.add(i);let a=r||n,o=r?r.ticks:0,s=null;return this._state.forEachBetween(a.time,t+this.sampleTime,e=>{let t=a.time,n=this._tickOffset.get(e.time);n&&n.time>=a.time&&(o=n.ticks,t=n.time),a.state===`started`&&e.state!==`started`&&(o+=this.frequency.getTicksAtTime(e.time)-this.frequency.getTicksAtTime(t),e.time!==i.time&&(s={state:e.state,time:e.time,ticks:o})),a=e}),this._state.remove(i),s&&this._ticksAtTime.add(s),o}get ticks(){return this.getTicksAtTime(this.now())}set ticks(e){this.setTicksAtTime(e,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(e){let t=this.now(),n=this.frequency.timeToTicks(e,t);this.setTicksAtTime(n,t)}getSecondsAtTime(e){e=this.toSeconds(e);let t=this._state.getLastState(`stopped`,e),n={state:`paused`,time:e};this._state.add(n);let r=this._secondsAtTime.get(e),i=r||t,a=r?r.seconds:0,o=null;return this._state.forEachBetween(i.time,e+this.sampleTime,e=>{let t=i.time,r=this._tickOffset.get(e.time);r&&r.time>=i.time&&(a=r.seconds,t=r.time),i.state===`started`&&e.state!==`started`&&(a+=e.time-t,e.time!==n.time&&(o={state:e.state,time:e.time,seconds:a})),i=e}),this._state.remove(n),o&&this._secondsAtTime.add(o),a}setTicksAtTime(e,t){return t=this.toSeconds(t),this._tickOffset.cancel(t),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(e,t),ticks:e,time:t}),this._ticksAtTime.cancel(t),this._secondsAtTime.cancel(t),this}getStateAtTime(e){return e=this.toSeconds(e),this._state.getValueAtTime(e)}getTimeOfTick(e,t=this.now()){let n=this._tickOffset.get(t),r=this._state.get(t),i=Math.max(n.time,r.time),a=this.frequency.getTicksAtTime(i)+e-n.ticks;return this.frequency.getTimeOfTick(a)}forEachTickBetween(e,t,n){let r=this._state.get(e);this._state.forEachBetween(e,t,t=>{r&&r.state===`started`&&t.state!==`started`&&this.forEachTickBetween(Math.max(r.time,e),t.time-this.sampleTime,n),r=t});let i=null;if(r&&r.state===`started`){let a=Math.max(r.time,e),o=this.frequency.getTicksAtTime(a),s=o-this.frequency.getTicksAtTime(r.time),c=Math.ceil(s)-s;c=hh(c,1)?0:c;let l=this.frequency.getTimeOfTick(o+c);for(;l<t;){try{n(l,Math.round(this.getTicksAtTime(l)))}catch(e){i=e;break}l+=this.frequency.getDurationOfTicks(1,l)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this._ticksAtTime.dispose(),this._secondsAtTime.dispose(),this.frequency.dispose(),this}},lg=class e extends Xh{constructor(){let t=Y(e.getDefaults(),arguments,[`callback`,`frequency`]);super(t),this.name=`Clock`,this.callback=Z,this._lastUpdate=0,this._state=new Zh(`stopped`),this._boundLoop=this._loop.bind(this),this.callback=t.callback,this._tickSource=new cg({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,X(this,`frequency`),this._state.setStateAtTime(`stopped`,0),this.context.on(`tick`,this._boundLoop)}static getDefaults(){return Object.assign(Xh.getDefaults(),{callback:Z,frequency:1,units:`hertz`})}get state(){return this._state.getValueAtTime(this.now())}start(e,t){Rm(this.context);let n=this.toSeconds(e);return this.log(`start`,n),this._state.getValueAtTime(n)!==`started`&&(this._state.setStateAtTime(`started`,n),this._tickSource.start(n,t),n<this._lastUpdate&&this.emit(`start`,n,t)),this}stop(e){let t=this.toSeconds(e);return this.log(`stop`,t),this._state.cancel(t),this._state.setStateAtTime(`stopped`,t),this._tickSource.stop(t),t<this._lastUpdate&&this.emit(`stop`,t),this}pause(e){let t=this.toSeconds(e);return this._state.getValueAtTime(t)===`started`&&(this._state.setStateAtTime(`paused`,t),this._tickSource.pause(t),t<this._lastUpdate&&this.emit(`pause`,t)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(e){this._tickSource.ticks=e}get seconds(){return this._tickSource.seconds}set seconds(e){this._tickSource.seconds=e}getSecondsAtTime(e){return this._tickSource.getSecondsAtTime(e)}setTicksAtTime(e,t){return this._tickSource.setTicksAtTime(e,t),this}getTimeOfTick(e,t=this.now()){return this._tickSource.getTimeOfTick(e,t)}getTicksAtTime(e){return this._tickSource.getTicksAtTime(e)}nextTickTime(e,t){let n=this.toSeconds(t),r=this.getTicksAtTime(n);return this._tickSource.getTimeOfTick(r+e,n)}_loop(){let e=this._lastUpdate,t=this.now();this._lastUpdate=t,this.log(`loop`,e,t),e!==t&&(this._state.forEachBetween(e,t,e=>{switch(e.state){case`started`:let t=this._tickSource.getTicksAtTime(e.time);this.emit(`start`,e.time,t);break;case`stopped`:e.time!==0&&this.emit(`stop`,e.time);break;case`paused`:this.emit(`pause`,e.time);break}}),this._tickSource.forEachTickBetween(e,t,(e,t)=>{this.callback(e,t)}))}getStateAtTime(e){let t=this.toSeconds(e);return this._state.getValueAtTime(t)}dispose(){return super.dispose(),this.context.off(`tick`,this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}};wh.mixin(lg);var ug=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments,[`volume`]);super(t),this.name=`Volume`,this.input=this.output=new tg({context:this.context,gain:t.volume,units:`decibels`}),this.volume=this.output.gain,X(this,`volume`),this._unmutedVolume=t.volume,this.mute=t.mute}static getDefaults(){return Object.assign($.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(e){!this.mute&&e?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!e&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}},dg=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments);super(t),this.name=`Destination`,this.input=new ug({context:this.context}),this.output=new tg({context:this.context}),this.volume=this.input.volume,Qh(this.input,this.output,this.context.rawContext.destination),this.mute=t.mute,this._internalChannels=[this.input,this.context.rawContext.destination,this.output]}static getDefaults(){return Object.assign($.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(e){this.input.mute=e}chain(...e){return this.input.disconnect(),e.unshift(this.input),e.push(this.output),Qh(...e),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}};yh(e=>{e.destination=new dg({context:e})}),Sh(e=>{e.destination.dispose()});var fg=class extends ${constructor(){super(...arguments),this.name=`Listener`,this.positionX=new Q({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new Q({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new Q({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new Q({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new Q({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new Q({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new Q({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new Q({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new Q({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign($.getDefaults(),{positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:-1,upX:0,upY:1,upZ:0})}dispose(){return super.dispose(),this.positionX.dispose(),this.positionY.dispose(),this.positionZ.dispose(),this.forwardX.dispose(),this.forwardY.dispose(),this.forwardZ.dispose(),this.upX.dispose(),this.upY.dispose(),this.upZ.dispose(),this}};yh(e=>{e.listener=new fg({context:e})}),Sh(e=>{e.listener.dispose()});var pg=class e extends uh{constructor(){super(),this.name=`ToneAudioBuffers`,this._buffers=new Map,this._loadingCount=0;let t=Y(e.getDefaults(),arguments,[`urls`,`onload`,`baseUrl`],`urls`);this.baseUrl=t.baseUrl,Object.keys(t.urls).forEach(e=>{this._loadingCount++;let n=t.urls[e];this.add(e,n,this._bufferLoaded.bind(this,t.onload),t.onerror)})}static getDefaults(){return{baseUrl:``,onerror:Z,onload:Z,urls:{}}}has(e){return this._buffers.has(e.toString())}get(e){return q(this.has(e),`ToneAudioBuffers has no buffer named: ${e}`),this._buffers.get(e.toString())}_bufferLoaded(e){this._loadingCount--,this._loadingCount===0&&e&&e()}get loaded(){return Array.from(this._buffers).every(([e,t])=>t.loaded)}add(e,t,n=Z,r=Z){return Fm(t)?(this.baseUrl&&t.trim().substring(0,11).toLowerCase()===`data:audio/`&&(this.baseUrl=``),this._buffers.set(e.toString(),new kh(this.baseUrl+t,n,r))):this._buffers.set(e.toString(),new kh(t,n,r)),this}dispose(){return super.dispose(),this._buffers.forEach(e=>e.dispose()),this._buffers.clear(),this}},mg=class extends Yh{constructor(){super(...arguments),this.name=`Ticks`,this.defaultUnits=`i`}_now(){return this.context.transport.ticks}_beatsToUnits(e){return this._getPPQ()*e}_secondsToUnits(e){return Math.floor(e/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(e){return e}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}},hg=class extends Xh{constructor(){super(...arguments),this.name=`Draw`,this.expiration=.25,this.anticipation=.008,this._events=new _h,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(e,t){return this._events.add({callback:e,time:this.toSeconds(t)}),this._events.length===1&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(e){return this._events.cancel(this.toSeconds(e)),this}_drawLoop(){let e=this.context.currentTime;this._events.forEachBefore(e+this.anticipation,t=>{e-t.time<=this.expiration&&t.callback(),this._events.remove(t)}),this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}};yh(e=>{e.draw=new hg({context:e})}),Sh(e=>{e.draw.dispose()});var gg=class extends uh{constructor(){super(...arguments),this.name=`IntervalTimeline`,this._root=null,this._length=0}add(e){q(K(e.time),`Events must have a time property`),q(K(e.duration),`Events must have a duration parameter`),e.time=e.time.valueOf();let t=new _g(e.time,e.time+e.duration,e);for(this._root===null?this._root=t:this._root.insert(t),this._length++;t!==null;)t.updateHeight(),t.updateMax(),this._rebalance(t),t=t.parent;return this}remove(e){if(this._root!==null){let t=[];this._root.search(e.time,t);for(let n of t)if(n.event===e){this._removeNode(n),this._length--;break}}return this}get length(){return this._length}cancel(e){return this.forEachFrom(e,e=>this.remove(e)),this}_setRoot(e){this._root=e,this._root!==null&&(this._root.parent=null)}_replaceNodeInParent(e,t){e.parent===null?this._setRoot(t):(e.isLeftChild()?e.parent.left=t:e.parent.right=t,this._rebalance(e.parent))}_removeNode(e){if(e.left===null&&e.right===null)this._replaceNodeInParent(e,null);else if(e.right===null)this._replaceNodeInParent(e,e.left);else if(e.left===null)this._replaceNodeInParent(e,e.right);else{let t=e.getBalance(),n,r=null;if(t>0)if(e.left.right===null)n=e.left,n.right=e.right,r=n;else{for(n=e.left.right;n.right!==null;)n=n.right;n.parent&&(n.parent.right=n.left,r=n.parent,n.left=e.left,n.right=e.right)}else if(e.right.left===null)n=e.right,n.left=e.left,r=n;else{for(n=e.right.left;n.left!==null;)n=n.left;n.parent&&(n.parent.left=n.right,r=n.parent,n.left=e.left,n.right=e.right)}e.parent===null?this._setRoot(n):e.isLeftChild()?e.parent.left=n:e.parent.right=n,r&&this._rebalance(r)}e.dispose()}_rotateLeft(e){let t=e.parent,n=e.isLeftChild(),r=e.right;r&&(e.right=r.left,r.left=e),t===null?this._setRoot(r):n?t.left=r:t.right=r}_rotateRight(e){let t=e.parent,n=e.isLeftChild(),r=e.left;r&&(e.left=r.right,r.right=e),t===null?this._setRoot(r):n?t.left=r:t.right=r}_rebalance(e){let t=e.getBalance();t>1&&e.left?e.left.getBalance()<0?this._rotateLeft(e.left):this._rotateRight(e):t<-1&&e.right&&(e.right.getBalance()>0?this._rotateRight(e.right):this._rotateLeft(e))}get(e){if(this._root!==null){let t=[];if(this._root.search(e,t),t.length>0){let e=t[0];for(let n=1;n<t.length;n++)t[n].low>e.low&&(e=t[n]);return e.event}}return null}forEach(e){if(this._root!==null){let t=[];this._root.traverse(e=>t.push(e)),t.forEach(t=>{t.event&&e(t.event)})}return this}forEachAtTime(e,t){if(this._root!==null){let n=[];this._root.search(e,n),n.forEach(e=>{e.event&&t(e.event)})}return this}forEachFrom(e,t){if(this._root!==null){let n=[];this._root.searchAfter(e,n),n.forEach(e=>{e.event&&t(e.event)})}return this}dispose(){return super.dispose(),this._root!==null&&this._root.traverse(e=>e.dispose()),this._root=null,this}},_g=class{constructor(e,t,n){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=n,this.low=e,this.high=t,this.max=this.high}insert(e){e.low<=this.low?this.left===null?this.left=e:this.left.insert(e):this.right===null?this.right=e:this.right.insert(e)}search(e,t){e>this.max||(this.left!==null&&this.left.search(e,t),this.low<=e&&this.high>e&&t.push(this),!(this.low>e)&&this.right!==null&&this.right.search(e,t))}searchAfter(e,t){this.low>=e&&(t.push(this),this.left!==null&&this.left.searchAfter(e,t)),this.right!==null&&this.right.searchAfter(e,t)}traverse(e){e(this),this.left!==null&&this.left.traverse(e),this.right!==null&&this.right.traverse(e)}updateHeight(){this.left!==null&&this.right!==null?this.height=Math.max(this.left.height,this.right.height)+1:this.right===null?this.left===null?this.height=0:this.height=this.left.height+1:this.height=this.right.height+1}updateMax(){this.max=this.high,this.left!==null&&(this.max=Math.max(this.max,this.left.max)),this.right!==null&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let e=0;return this.left!==null&&this.right!==null?e=this.left.height-this.right.height:this.left===null?this.right!==null&&(e=-(this.right.height+1)):e=this.left.height+1,e}isLeftChild(){return this.parent!==null&&this.parent.left===this}get left(){return this._left}set left(e){this._left=e,e!==null&&(e.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(e){this._right=e,e!==null&&(e.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}},vg=class extends uh{constructor(e){super(),this.name=`TimelineValue`,this._timeline=new _h({memory:10}),this._initialValue=e}set(e,t){return this._timeline.add({value:e,time:t}),this}get(e){let t=this._timeline.get(e);return t?t.value:this._initialValue}},yg=class e extends ${constructor(){super(Y(e.getDefaults(),arguments,[`context`]))}connect(e,t=0,n=0){return ag(this,e,t,n),this}},bg=class e extends yg{constructor(){let t=Y(e.getDefaults(),arguments,[`mapping`,`length`]);super(t),this.name=`WaveShaper`,this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper,Pm(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):Am(t.mapping)&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(ig.getDefaults(),{length:1024})}setMap(e,t=1024){let n=new Float32Array(t);for(let r=0,i=t;r<i;r++)n[r]=e(r/(i-1)*2-1,r);return this.curve=n,this}get curve(){return this._shaper.curve}set curve(e){this._shaper.curve=e}get oversample(){return this._shaper.oversample}set oversample(e){q([`none`,`2x`,`4x`].some(t=>t.includes(e)),`oversampling must be either 'none', '2x', or '4x'`),this._shaper.oversample=e}dispose(){return super.dispose(),this._shaper.disconnect(),this}},xg=class e extends yg{constructor(){let t=Y(e.getDefaults(),arguments,[`value`]);super(t),this.name=`Pow`,this._exponentScaler=this.input=this.output=new bg({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(yg.getDefaults(),{value:1})}_expFunc(e){return t=>Math.abs(t)**+e}get value(){return this._exponent}set value(e){this._exponent=e,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}},Sg=class e{constructor(t,n){this.id=e._eventId++,this._remainderTime=0;let r=Object.assign(e.getDefaults(),n);this.transport=t,this.callback=r.callback,this._once=r.once,this.time=Math.floor(r.time),this._remainderTime=r.time-this.time}static getDefaults(){return{callback:Z,once:!1,time:0}}get floatTime(){return this.time+this._remainderTime}invoke(e){if(this.callback){let t=this.transport.bpm.getDurationOfTicks(1,e);this.callback(e+this._remainderTime*t),this._once&&this.transport.clear(this.id)}}dispose(){return this.callback=void 0,this}};Sg._eventId=0;var Cg=class e extends Sg{constructor(t,n){super(t,n),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);let r=Object.assign(e.getDefaults(),n);this.duration=r.duration,this._interval=r.interval,this._nextTick=r.time,this.transport.on(`start`,this._boundRestart),this.transport.on(`loopStart`,this._boundRestart),this.transport.on(`ticks`,this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},Sg.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(e){this._createEvents(e),super.invoke(e)}_createEvent(){return mh(this._nextTick,this.floatTime+this.duration)?this.transport.scheduleOnce(this.invoke.bind(this),new mg(this.context,this._nextTick).toSeconds()):-1}_createEvents(e){mh(this._nextTick+this._interval,this.floatTime+this.duration)&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new mg(this.context,this._nextTick).toSeconds()))}_restart(e){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.floatTime;let t=this.transport.getTicksAtTime(e);fh(t,this.time)&&(this._nextTick=this.floatTime+Math.ceil((t-this.floatTime)/this._interval)*this._interval),this._currentId=this._createEvent(),this._nextTick+=this._interval,this._nextId=this._createEvent()}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off(`start`,this._boundRestart),this.transport.off(`loopStart`,this._boundRestart),this.transport.off(`ticks`,this._boundRestart),this}},wg=class e extends Xh{constructor(){let t=Y(e.getDefaults(),arguments);super(t),this.name=`Transport`,this._loop=new vg(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new _h,this._repeatedEvents=new gg,this._syncedSignals=[],this._swingAmount=0,this._ppq=t.ppq,this._clock=new lg({callback:this._processTick.bind(this),context:this.context,frequency:0,units:`bpm`}),this._bindClockEvents(),this.bpm=this._clock.frequency,this._clock.frequency.multiplier=t.ppq,this.bpm.setValueAtTime(t.bpm,0),X(this,`bpm`),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Xh.getDefaults(),{bpm:120,loopEnd:`4m`,loopStart:0,ppq:192,swing:0,swingSubdivision:`8n`,timeSignature:4})}_processTick(e,t){if(this._loop.get(e)&&t>=this._loopEnd&&(this.emit(`loopEnd`,e),this._clock.setTicksAtTime(this._loopStart,e),t=this._loopStart,this.emit(`loopStart`,e,this._clock.getSecondsAtTime(e)),this.emit(`loop`,e)),this._swingAmount>0&&t%this._ppq!==0&&t%(this._swingTicks*2)!=0){let n=t%(this._swingTicks*2)/(this._swingTicks*2),r=Math.sin(n*Math.PI)*this._swingAmount;e+=new mg(this.context,this._swingTicks*2/3).toSeconds()*r}Vm(!0),this._timeline.forEachAtTime(t,t=>t.invoke(e)),Vm(!1)}schedule(e,t){let n=new Sg(this,{callback:e,time:new Yh(this.context,t).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(e,t,n,r=1/0){let i=new Cg(this,{callback:e,duration:new Gh(this.context,r).toTicks(),interval:new Gh(this.context,t).toTicks(),time:new Yh(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(e,t){let n=new Sg(this,{callback:e,once:!0,time:new Yh(this.context,t).toTicks()});return this._addEvent(n,this._timeline)}clear(e){if(this._scheduledEvents.hasOwnProperty(e)){let t=this._scheduledEvents[e.toString()];t.timeline.remove(t.event),t.event.dispose(),delete this._scheduledEvents[e.toString()]}return this}_addEvent(e,t){return this._scheduledEvents[e.id.toString()]={event:e,timeline:t},t.add(e),e.id}cancel(e=0){let t=this.toTicks(e);return this._timeline.forEachFrom(t,e=>this.clear(e.id)),this._repeatedEvents.forEachFrom(t,e=>this.clear(e.id)),this}_bindClockEvents(){this._clock.on(`start`,(e,t)=>{t=new mg(this.context,t).toSeconds(),this.emit(`start`,e,t)}),this._clock.on(`stop`,e=>{this.emit(`stop`,e)}),this._clock.on(`pause`,e=>{this.emit(`pause`,e)})}get state(){return this._clock.getStateAtTime(this.now())}start(e,t){this.context.resume();let n;return K(t)&&(n=this.toTicks(t)),this._clock.start(e,n),this}stop(e){return this._clock.stop(e),this}pause(e){return this._clock.pause(e),this}toggle(e){return e=this.toSeconds(e),this._clock.getStateAtTime(e)===`started`?this.stop(e):this.start(e),this}get timeSignature(){return this._timeSignature}set timeSignature(e){Pm(e)&&(e=e[0]/e[1]*4),this._timeSignature=e}get loopStart(){return new Gh(this.context,this._loopStart,`i`).toSeconds()}set loopStart(e){this._loopStart=this.toTicks(e)}get loopEnd(){return new Gh(this.context,this._loopEnd,`i`).toSeconds()}set loopEnd(e){this._loopEnd=this.toTicks(e)}get loop(){return this._loop.get(this.now())}set loop(e){this._loop.set(e,this.now())}setLoopPoints(e,t){return this.loopStart=e,this.loopEnd=t,this}get swing(){return this._swingAmount}set swing(e){this._swingAmount=e}get swingSubdivision(){return new mg(this.context,this._swingTicks).toNotation()}set swingSubdivision(e){this._swingTicks=this.toTicks(e)}get position(){let e=this.now(),t=this._clock.getTicksAtTime(e);return new mg(this.context,t).toBarsBeatsSixteenths()}set position(e){let t=this.toTicks(e);this.ticks=t}get seconds(){return this._clock.seconds}set seconds(e){let t=this.now(),n=this._clock.frequency.timeToTicks(e,t);this.ticks=n}get progress(){if(this.loop){let e=this.now();return(this._clock.getTicksAtTime(e)-this._loopStart)/(this._loopEnd-this._loopStart)}else return 0}get ticks(){return this._clock.ticks}set ticks(e){if(this._clock.ticks!==e){let t=this.now();if(this.state===`started`){let n=this._clock.getTicksAtTime(t),r=t+this._clock.frequency.getDurationOfTicks(Math.ceil(n)-n,t);this.emit(`stop`,r),this._clock.setTicksAtTime(e,r),this.emit(`start`,r,this._clock.getSecondsAtTime(r))}else this.emit(`ticks`,t),this._clock.setTicksAtTime(e,t)}}getTicksAtTime(e){return this._clock.getTicksAtTime(e)}getSecondsAtTime(e){return this._clock.getSecondsAtTime(e)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(e){this._clock.frequency.multiplier=e}nextSubdivision(e){if(e=this.toTicks(e),this.state!==`started`)return 0;{let t=this.now(),n=this.getTicksAtTime(t),r=e-n%e;return this._clock.nextTickTime(r,t)}}syncSignal(e,t){let n=this.now(),r=this.bpm,i=1/(60/r.getValueAtTime(n)/this.PPQ),a=[];if(e.units===`time`){let e=1/64/i,t=new tg(e),n=new xg(-1),o=new tg(e);r.chain(t,n,o),r=o,i=1/i,a=[t,n,o]}t||=e.getValueAtTime(n)===0?0:e.getValueAtTime(n)/i;let o=new tg(t);return r.connect(o),o.connect(e._param),a.push(o),this._syncedSignals.push({initial:e.value,nodes:a,signal:e}),e.value=0,this}unsyncSignal(e){for(let t=this._syncedSignals.length-1;t>=0;t--){let n=this._syncedSignals[t];n.signal===e&&(n.nodes.forEach(e=>e.dispose()),n.signal.value=n.initial,this._syncedSignals.splice(t,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),Oh(this,`bpm`),this._timeline.dispose(),this._repeatedEvents.dispose(),this}};wh.mixin(wg),yh(e=>{e.transport=new wg({context:e})}),Sh(e=>{e.transport.dispose()});var Tg=class extends ${constructor(e){super(e),this.input=void 0,this._state=new Zh(`stopped`),this._synced=!1,this._scheduled=[],this._syncedStart=Z,this._syncedStop=Z,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new ug({context:this.context,mute:e.mute,volume:e.volume}),this.volume=this._volume.volume,X(this,`volume`),this.onstop=e.onstop}static getDefaults(){return Object.assign($.getDefaults(),{mute:!1,onstop:Z,volume:0})}get state(){return this._synced?this.context.transport.state===`started`?this._state.getValueAtTime(this.context.transport.seconds):`stopped`:this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(e){this._volume.mute=e}_clampToCurrentTime(e){return this._synced?e:Math.max(e,this.context.currentTime)}start(e,t,n){let r=km(e)&&this._synced?this.context.transport.seconds:this.toSeconds(e);if(r=this._clampToCurrentTime(r),!this._synced&&this._state.getValueAtTime(r)===`started`)q(fh(r,this._state.get(r).time),`Start time must be strictly greater than previous start time`),this._state.cancel(r),this._state.setStateAtTime(`started`,r),this.log(`restart`,r),this.restart(r,t,n);else if(this.log(`start`,r),this._state.setStateAtTime(`started`,r),this._synced){let e=this._state.get(r);e&&(e.offset=this.toSeconds(ch(t,0)),e.duration=n?this.toSeconds(n):void 0);let i=this.context.transport.schedule(e=>{this._start(e,t,n)},r);this._scheduled.push(i),this.context.transport.state===`started`&&this.context.transport.getSecondsAtTime(this.immediate())>r&&this._syncedStart(this.now(),this.context.transport.seconds)}else Rm(this.context),this._start(r,t,n);return this}stop(e){let t=km(e)&&this._synced?this.context.transport.seconds:this.toSeconds(e);if(t=this._clampToCurrentTime(t),this._state.getValueAtTime(t)===`started`||K(this._state.getNextState(`started`,t))){if(this.log(`stop`,t),!this._synced)this._stop(t);else{let e=this.context.transport.schedule(this._stop.bind(this),t);this._scheduled.push(e)}this._state.cancel(t),this._state.setStateAtTime(`stopped`,t)}return this}restart(e,t,n){return e=this.toSeconds(e),this._state.getValueAtTime(e)===`started`&&(this._state.cancel(e),this._restart(e,t,n)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(e,t)=>{if(fh(t,0)){let n=this._state.get(t);if(n&&n.state===`started`&&n.time!==t){let r=t-this.toSeconds(n.time),i;n.duration&&(i=this.toSeconds(n.duration)-r),this._start(e,this.toSeconds(n.offset)+r,i)}}},this._syncedStop=e=>{let t=this.context.transport.getSecondsAtTime(Math.max(e-this.sampleTime,0));this._state.getValueAtTime(t)===`started`&&this._stop(e)},this.context.transport.on(`start`,this._syncedStart),this.context.transport.on(`loopStart`,this._syncedStart),this.context.transport.on(`stop`,this._syncedStop),this.context.transport.on(`pause`,this._syncedStop),this.context.transport.on(`loopEnd`,this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off(`stop`,this._syncedStop),this.context.transport.off(`pause`,this._syncedStop),this.context.transport.off(`loopEnd`,this._syncedStop),this.context.transport.off(`start`,this._syncedStart),this.context.transport.off(`loopStart`,this._syncedStart)),this._synced=!1,this._scheduled.forEach(e=>this.context.transport.clear(e)),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=Z,this.unsync(),this._volume.dispose(),this._state.dispose(),this}},Eg=class e extends ng{constructor(){let t=Y(e.getDefaults(),arguments,[`url`,`onload`]);super(t),this.name=`ToneBufferSource`,this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1,$h(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new Q({context:this.context,param:this._source.playbackRate,units:`positive`,value:t.playbackRate}),this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this._buffer=new kh(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(ng.getDefaults(),{url:new kh,loop:!1,loopEnd:0,loopStart:0,onload:Z,onerror:Z,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(e){this._fadeIn=e}get fadeOut(){return this._fadeOut}set fadeOut(e){this._fadeOut=e}get curve(){return this._curve}set curve(e){this._curve=e}start(e,t,n,r=1){q(this.buffer.loaded,`buffer is either not set or not loaded`);let i=this.toSeconds(e);this._startGain(i,r),t=this.loop?ch(t,this.loopStart):ch(t,0);let a=Math.max(this.toSeconds(t),0);if(this.loop){let e=this.toSeconds(this.loopEnd)||this.buffer.duration,t=this.toSeconds(this.loopStart),n=e-t;ph(a,e)&&(a=(a-t)%n+t),hh(a,this.buffer.duration)&&(a=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,mh(a,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,a)),K(n)){let e=this.toSeconds(n);e=Math.max(e,0),this.stop(i+e)}return this}_stopSource(e){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(e)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(e){this._source.loopStart=this.toSeconds(e)}get loopEnd(){return this._source.loopEnd}set loopEnd(e){this._source.loopEnd=this.toSeconds(e)}get buffer(){return this._buffer}set buffer(e){this._buffer.set(e)}get loop(){return this._source.loop}set loop(e){this._source.loop=e,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}};function Dg(e,t){return J(this,void 0,void 0,function*(){let n=t/e.context.sampleRate,r=new Ah(1,n,e.context.sampleRate);return new e.constructor(Object.assign(e.get(),{frequency:2/n,detune:0,context:r})).toDestination().start(0),(yield r.render()).getChannelData(0)})}var Og=class e extends ng{constructor(){let t=Y(e.getDefaults(),arguments,[`frequency`,`type`]);super(t),this.name=`ToneOscillatorNode`,this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator],$h(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new Q({context:this.context,param:this._oscillator.frequency,units:`frequency`,value:t.frequency}),this.detune=new Q({context:this.context,param:this._oscillator.detune,units:`cents`,value:t.detune}),X(this,[`frequency`,`detune`])}static getDefaults(){return Object.assign(ng.getDefaults(),{detune:0,frequency:440,type:`sine`})}start(e){let t=this.toSeconds(e);return this.log(`start`,t),this._startGain(t),this._oscillator.start(t),this}_stopSource(e){this._oscillator.stop(e)}setPeriodicWave(e){return this._oscillator.setPeriodicWave(e),this}get type(){return this._oscillator.type}set type(e){this._oscillator.type=e}dispose(){return super.dispose(),this.state===`started`&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}},kg=class e extends Tg{constructor(){let t=Y(e.getDefaults(),arguments,[`frequency`,`type`]);super(t),this.name=`Oscillator`,this._oscillator=null,this.frequency=new ig({context:this.context,units:`frequency`,value:t.frequency}),X(this,`frequency`),this.detune=new ig({context:this.context,units:`cents`,value:t.detune}),X(this,`detune`),this._partials=t.partials,this._partialCount=t.partialCount,this._type=t.type,t.partialCount&&t.type!==`custom`&&(this._type=this.baseType+t.partialCount.toString()),this.phase=t.phase}static getDefaults(){return Object.assign(Tg.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:`sine`})}_start(e){let t=this.toSeconds(e),n=new Og({context:this.context,onended:()=>this.onstop(this)});this._oscillator=n,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.start(t)}_stop(e){let t=this.toSeconds(e);this._oscillator&&this._oscillator.stop(t)}_restart(e){let t=this.toSeconds(e);return this.log(`restart`,t),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(t),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if(this._type===`custom`)return e._periodicWaveCache.find(e=>e.phase===this._phase&&oh(e.partials,this._partials));{let t=e._periodicWaveCache.find(e=>e.type===this._type&&e.phase===this._phase);return this._partialCount=t?t.partialCount:this._partialCount,t}}get type(){return this._type}set type(t){this._type=t;let n=[`sine`,`square`,`sawtooth`,`triangle`].indexOf(t)!==-1;if(this._phase===0&&n)this._wave=void 0,this._partialCount=0,this._oscillator!==null&&(this._oscillator.type=t);else{let n=this._getCachedPeriodicWave();if(K(n)){let{partials:e,wave:t}=n;this._wave=t,this._partials=e,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave)}else{let[n,r]=this._getRealImaginary(t,this._phase),i=this.context.createPeriodicWave(n,r);this._wave=i,this._oscillator!==null&&this._oscillator.setPeriodicWave(this._wave),e._periodicWaveCache.push({imag:r,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:n,type:this._type,wave:this._wave}),e._periodicWaveCache.length>100&&e._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),``)}set baseType(e){this.partialCount&&this._type!==`custom`&&e!==`custom`?this.type=e+this.partialCount:this.type=e}get partialCount(){return this._partialCount}set partialCount(e){Lm(e,0);let t=this._type,n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(t=n[1]),this._type!==`custom`)e===0?this.type=t:this.type=t+e.toString();else{let t=new Float32Array(e);this._partials.forEach((e,n)=>t[n]=e),this._partials=Array.from(t),this.type=this._type}}_getRealImaginary(e,t){let n=4096/2,r=new Float32Array(n),i=new Float32Array(n),a=1;if(e===`custom`){if(a=this._partials.length+1,this._partialCount=this._partials.length,n=a,this._partials.length===0)return[r,i]}else{let t=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(e);t?(a=parseInt(t[2],10)+1,this._partialCount=parseInt(t[2],10),e=t[1],a=Math.max(a,2),n=a):this._partialCount=0,this._partials=[]}for(let o=1;o<n;++o){let n=2/(o*Math.PI),s;switch(e){case`sine`:s=+(o<=a),this._partials[o-1]=s;break;case`square`:s=o&1?2*n:0,this._partials[o-1]=s;break;case`sawtooth`:s=n*(o&1?1:-1),this._partials[o-1]=s;break;case`triangle`:s=o&1?n*n*2*(o-1>>1&1?-1:1):0,this._partials[o-1]=s;break;case`custom`:s=this._partials[o-1];break;default:throw TypeError(`Oscillator: invalid type: `+e)}s===0?(r[o]=0,i[o]=0):(r[o]=-s*Math.sin(t*o),i[o]=s*Math.cos(t*o))}return[r,i]}_inverseFFT(e,t,n){let r=0,i=e.length;for(let a=0;a<i;a++)r+=e[a]*Math.cos(a*n)+t[a]*Math.sin(a*n);return r}getInitialValue(){let[e,t]=this._getRealImaginary(this._type,0),n=0,r=Math.PI*2;for(let i=0;i<32;i++)n=Math.max(this._inverseFFT(e,t,i/32*r),n);return gh(-this._inverseFFT(e,t,this._phase)/n,-1,1)}get partials(){return this._partials.slice(0,this.partialCount)}set partials(e){this._partials=e,this._partialCount=this._partials.length,e.length&&(this.type=`custom`)}get phase(){return this._phase*(180/Math.PI)}set phase(e){this._phase=e*Math.PI/180,this.type=this._type}asArray(){return J(this,arguments,void 0,function*(e=1024){return Dg(this,e)})}dispose(){return super.dispose(),this._oscillator!==null&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}};kg._periodicWaveCache=[];var Ag=class extends yg{constructor(){super(...arguments),this.name=`AudioToGain`,this._norm=new bg({context:this.context,mapping:e=>(e+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}},jg=class e extends ig{constructor(){let t=Y(e.getDefaults(),arguments,[`value`]);super(t),this.name=`Multiply`,this.override=!1,this._mult=this.input=this.output=new tg({context:this.context,minValue:t.minValue,maxValue:t.maxValue}),this.factor=this._param=this._mult.gain,this.factor.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(ig.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}},Mg=class e extends Tg{constructor(){let t=Y(e.getDefaults(),arguments,[`frequency`,`type`,`modulationType`]);super(t),this.name=`AMOscillator`,this._modulationScale=new Ag({context:this.context}),this._modulationNode=new tg({context:this.context}),this._carrier=new kg({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this._modulator=new kg({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new jg({context:this.context,units:`positive`,value:t.harmonicity}),this.frequency.chain(this.harmonicity,this._modulator.frequency),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),X(this,[`frequency`,`detune`,`harmonicity`])}static getDefaults(){return Object.assign(kg.getDefaults(),{harmonicity:1,modulationType:`square`})}_start(e){this._modulator.start(e),this._carrier.start(e)}_stop(e){this._modulator.stop(e),this._carrier.stop(e)}_restart(e){this._modulator.restart(e),this._carrier.restart(e)}get type(){return this._carrier.type}set type(e){this._carrier.type=e}get baseType(){return this._carrier.baseType}set baseType(e){this._carrier.baseType=e}get partialCount(){return this._carrier.partialCount}set partialCount(e){this._carrier.partialCount=e}get modulationType(){return this._modulator.type}set modulationType(e){this._modulator.type=e}get phase(){return this._carrier.phase}set phase(e){this._carrier.phase=e,this._modulator.phase=e}get partials(){return this._carrier.partials}set partials(e){this._carrier.partials=e}asArray(){return J(this,arguments,void 0,function*(e=1024){return Dg(this,e)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}},Ng=class e extends Tg{constructor(){let t=Y(e.getDefaults(),arguments,[`frequency`,`type`,`modulationType`]);super(t),this.name=`FMOscillator`,this._modulationNode=new tg({context:this.context,gain:0}),this._carrier=new kg({context:this.context,detune:t.detune,frequency:0,onstop:()=>this.onstop(this),phase:t.phase,type:t.type}),this.detune=this._carrier.detune,this.frequency=new ig({context:this.context,units:`frequency`,value:t.frequency}),this._modulator=new kg({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new jg({context:this.context,units:`positive`,value:t.harmonicity}),this.modulationIndex=new jg({context:this.context,units:`positive`,value:t.modulationIndex}),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),X(this,[`modulationIndex`,`frequency`,`detune`,`harmonicity`])}static getDefaults(){return Object.assign(kg.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:`square`})}_start(e){this._modulator.start(e),this._carrier.start(e)}_stop(e){this._modulator.stop(e),this._carrier.stop(e)}_restart(e){return this._modulator.restart(e),this._carrier.restart(e),this}get type(){return this._carrier.type}set type(e){this._carrier.type=e}get baseType(){return this._carrier.baseType}set baseType(e){this._carrier.baseType=e}get partialCount(){return this._carrier.partialCount}set partialCount(e){this._carrier.partialCount=e}get modulationType(){return this._modulator.type}set modulationType(e){this._modulator.type=e}get phase(){return this._carrier.phase}set phase(e){this._carrier.phase=e,this._modulator.phase=e}get partials(){return this._carrier.partials}set partials(e){this._carrier.partials=e}asArray(){return J(this,arguments,void 0,function*(e=1024){return Dg(this,e)})}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}},Pg=class e extends Tg{constructor(){let t=Y(e.getDefaults(),arguments,[`frequency`,`width`]);super(t),this.name=`PulseOscillator`,this._widthGate=new tg({context:this.context,gain:0}),this._thresh=new bg({context:this.context,mapping:e=>e<=0?-1:1}),this.width=new ig({context:this.context,units:`audioRange`,value:t.width}),this._triangle=new kg({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase,type:`triangle`}),this.frequency=this._triangle.frequency,this.detune=this._triangle.detune,this._triangle.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),X(this,[`width`,`frequency`,`detune`])}static getDefaults(){return Object.assign(Tg.getDefaults(),{detune:0,frequency:440,phase:0,type:`pulse`,width:.2})}_start(e){e=this.toSeconds(e),this._triangle.start(e),this._widthGate.gain.setValueAtTime(1,e)}_stop(e){e=this.toSeconds(e),this._triangle.stop(e),this._widthGate.gain.cancelScheduledValues(e),this._widthGate.gain.setValueAtTime(0,e)}_restart(e){this._triangle.restart(e),this._widthGate.gain.cancelScheduledValues(e),this._widthGate.gain.setValueAtTime(1,e)}get phase(){return this._triangle.phase}set phase(e){this._triangle.phase=e}get type(){return`pulse`}get baseType(){return`pulse`}get partials(){return[]}get partialCount(){return 0}set carrierType(e){this._triangle.type=e}asArray(){return J(this,arguments,void 0,function*(e=1024){return Dg(this,e)})}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}},Fg=class e extends Tg{constructor(){let t=Y(e.getDefaults(),arguments,[`frequency`,`type`,`spread`]);super(t),this.name=`FatOscillator`,this._oscillators=[],this.frequency=new ig({context:this.context,units:`frequency`,value:t.frequency}),this.detune=new ig({context:this.context,units:`cents`,value:t.detune}),this._spread=t.spread,this._type=t.type,this._phase=t.phase,this._partials=t.partials,this._partialCount=t.partialCount,this.count=t.count,X(this,[`frequency`,`detune`])}static getDefaults(){return Object.assign(kg.getDefaults(),{count:3,spread:20,type:`sawtooth`})}_start(e){e=this.toSeconds(e),this._forEach(t=>t.start(e))}_stop(e){e=this.toSeconds(e),this._forEach(t=>t.stop(e))}_restart(e){this._forEach(t=>t.restart(e))}_forEach(e){for(let t=0;t<this._oscillators.length;t++)e(this._oscillators[t],t)}get type(){return this._type}set type(e){this._type=e,this._forEach(t=>t.type=e)}get spread(){return this._spread}set spread(e){if(this._spread=e,this._oscillators.length>1){let t=-e/2,n=e/(this._oscillators.length-1);this._forEach((e,r)=>e.detune.value=t+n*r)}}get count(){return this._oscillators.length}set count(e){if(Lm(e,1),this._oscillators.length!==e){this._forEach(e=>e.dispose()),this._oscillators=[];for(let t=0;t<e;t++){let n=new kg({context:this.context,volume:-6-e*1.1,type:this._type,phase:this._phase+t/e*360,partialCount:this._partialCount,onstop:t===0?()=>this.onstop(this):Z});this.type===`custom`&&(n.partials=this._partials),this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.detune.overridden=!1,n.connect(this.output),this._oscillators[t]=n}this.spread=this._spread,this.state===`started`&&this._forEach(e=>e.start())}}get phase(){return this._phase}set phase(e){this._phase=e,this._forEach((e,t)=>e.phase=this._phase+t/this.count*360)}get baseType(){return this._oscillators[0].baseType}set baseType(e){this._forEach(t=>t.baseType=e),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(e){this._partials=e,this._partialCount=this._partials.length,e.length&&(this._type=`custom`,this._forEach(t=>t.partials=e))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(e){this._partialCount=e,this._forEach(t=>t.partialCount=e),this._type=this._oscillators[0].type}asArray(){return J(this,arguments,void 0,function*(e=1024){return Dg(this,e)})}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach(e=>e.dispose()),this}},Ig=class e extends Tg{constructor(){let t=Y(e.getDefaults(),arguments,[`frequency`,`modulationFrequency`]);super(t),this.name=`PWMOscillator`,this.sourceType=`pwm`,this._scale=new jg({context:this.context,value:2}),this._pulse=new Pg({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType=`sine`,this.modulationFrequency=this._pulse.frequency,this._modulator=new kg({context:this.context,detune:t.detune,frequency:t.frequency,onstop:()=>this.onstop(this),phase:t.phase}),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),X(this,[`modulationFrequency`,`frequency`,`detune`])}static getDefaults(){return Object.assign(Tg.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:`pwm`})}_start(e){e=this.toSeconds(e),this._modulator.start(e),this._pulse.start(e)}_stop(e){e=this.toSeconds(e),this._modulator.stop(e),this._pulse.stop(e)}_restart(e){this._modulator.restart(e),this._pulse.restart(e)}get type(){return`pwm`}get baseType(){return`pwm`}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(e){this._modulator.phase=e}asArray(){return J(this,arguments,void 0,function*(e=1024){return Dg(this,e)})}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}},Lg={am:Mg,fat:Fg,fm:Ng,oscillator:kg,pulse:Pg,pwm:Ig},Rg=class e extends Tg{constructor(){let t=Y(e.getDefaults(),arguments,[`frequency`,`type`]);super(t),this.name=`OmniOscillator`,this.frequency=new ig({context:this.context,units:`frequency`,value:t.frequency}),this.detune=new ig({context:this.context,units:`cents`,value:t.detune}),X(this,[`frequency`,`detune`]),this.set(t)}static getDefaults(){return Object.assign(kg.getDefaults(),Ng.getDefaults(),Mg.getDefaults(),Fg.getDefaults(),Pg.getDefaults(),Ig.getDefaults())}_start(e){this._oscillator.start(e)}_stop(e){this._oscillator.stop(e)}_restart(e){return this._oscillator.restart(e),this}get type(){let e=``;return[`am`,`fm`,`fat`].some(e=>this._sourceType===e)&&(e=this._sourceType),e+this._oscillator.type}set type(e){e.substr(0,2)===`fm`?(this._createNewOscillator(`fm`),this._oscillator=this._oscillator,this._oscillator.type=e.substr(2)):e.substr(0,2)===`am`?(this._createNewOscillator(`am`),this._oscillator=this._oscillator,this._oscillator.type=e.substr(2)):e.substr(0,3)===`fat`?(this._createNewOscillator(`fat`),this._oscillator=this._oscillator,this._oscillator.type=e.substr(3)):e===`pwm`?(this._createNewOscillator(`pwm`),this._oscillator=this._oscillator):e===`pulse`?this._createNewOscillator(`pulse`):(this._createNewOscillator(`oscillator`),this._oscillator=this._oscillator,this._oscillator.type=e)}get partials(){return this._oscillator.partials}set partials(e){!this._getOscType(this._oscillator,`pulse`)&&!this._getOscType(this._oscillator,`pwm`)&&(this._oscillator.partials=e)}get partialCount(){return this._oscillator.partialCount}set partialCount(e){!this._getOscType(this._oscillator,`pulse`)&&!this._getOscType(this._oscillator,`pwm`)&&(this._oscillator.partialCount=e)}set(e){return Reflect.has(e,`type`)&&e.type&&(this.type=e.type),super.set(e),this}_createNewOscillator(e){if(e!==this._sourceType){this._sourceType=e;let t=Lg[e],n=this.now();if(this._oscillator){let e=this._oscillator;e.stop(n),this.context.setTimeout(()=>e.dispose(),this.blockTime)}this._oscillator=new t({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),this.state===`started`&&this._oscillator.start(n)}}get phase(){return this._oscillator.phase}set phase(e){this._oscillator.phase=e}get sourceType(){return this._sourceType}set sourceType(e){let t=`sine`;this._oscillator.type!==`pwm`&&this._oscillator.type!==`pulse`&&(t=this._oscillator.type),e===`fm`?this.type=`fm`+t:e===`am`?this.type=`am`+t:e===`fat`?this.type=`fat`+t:e===`oscillator`?this.type=t:e===`pulse`?this.type=`pulse`:e===`pwm`&&(this.type=`pwm`)}_getOscType(e,t){return e instanceof Lg[t]}get baseType(){return this._oscillator.baseType}set baseType(e){!this._getOscType(this._oscillator,`pulse`)&&!this._getOscType(this._oscillator,`pwm`)&&e!==`pulse`&&e!==`pwm`&&(this._oscillator.baseType=e)}get width(){if(this._getOscType(this._oscillator,`pulse`))return this._oscillator.width}get count(){if(this._getOscType(this._oscillator,`fat`))return this._oscillator.count}set count(e){this._getOscType(this._oscillator,`fat`)&&jm(e)&&(this._oscillator.count=e)}get spread(){if(this._getOscType(this._oscillator,`fat`))return this._oscillator.spread}set spread(e){this._getOscType(this._oscillator,`fat`)&&jm(e)&&(this._oscillator.spread=e)}get modulationType(){if(this._getOscType(this._oscillator,`fm`)||this._getOscType(this._oscillator,`am`))return this._oscillator.modulationType}set modulationType(e){(this._getOscType(this._oscillator,`fm`)||this._getOscType(this._oscillator,`am`))&&Fm(e)&&(this._oscillator.modulationType=e)}get modulationIndex(){if(this._getOscType(this._oscillator,`fm`))return this._oscillator.modulationIndex}get harmonicity(){if(this._getOscType(this._oscillator,`fm`)||this._getOscType(this._oscillator,`am`))return this._oscillator.harmonicity}get modulationFrequency(){if(this._getOscType(this._oscillator,`pwm`))return this._oscillator.modulationFrequency}asArray(){return J(this,arguments,void 0,function*(e=1024){return Dg(this,e)})}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}};function zg(e,t=1/0){let n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){Lm(r,e,t),n.set(this,r)}})}}function Bg(e,t=1/0){let n=new WeakMap;return function(r,i){Reflect.defineProperty(r,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(r){Lm(this.toSeconds(r),e,t),n.set(this,r)}})}}var Vg=class e extends Tg{constructor(){let t=Y(e.getDefaults(),arguments,[`url`,`onload`]);super(t),this.name=`Player`,this._activeSources=new Set,this._buffer=new kh({onload:this._onload.bind(this,t.onload),onerror:t.onerror,reverse:t.reverse,url:t.url}),this.autostart=t.autostart,this._loop=t.loop,this._loopStart=t.loopStart,this._loopEnd=t.loopEnd,this._playbackRate=t.playbackRate,this.fadeIn=t.fadeIn,this.fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Tg.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:Z,onerror:Z,playbackRate:1,reverse:!1})}load(e){return J(this,void 0,void 0,function*(){return yield this._buffer.load(e),this._onload(),this})}_onload(e=Z){e(),this.autostart&&this.start()}_onSourceEnd(e){this.onstop(this),this._activeSources.delete(e),this._activeSources.size===0&&!this._synced&&this._state.getValueAtTime(this.now())===`started`&&(this._state.cancel(this.now()),this._state.setStateAtTime(`stopped`,this.now()))}start(e,t,n){return super.start(e,t,n),this}_start(e,t,n){t=this._loop?ch(t,this._loopStart):ch(t,0);let r=this.toSeconds(t),i=n;n=ch(n,Math.max(this._buffer.duration-r,0));let a=this.toSeconds(n);a/=this._playbackRate,e=this.toSeconds(e);let o=new Eg({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);!this._loop&&!this._synced&&(this._state.cancel(e+a),this._state.setStateAtTime(`stopped`,e+a,{implicitEnd:!0})),this._activeSources.add(o),this._loop&&km(i)?o.start(e,r):o.start(e,r,a-this.toSeconds(this.fadeOut))}_stop(e){let t=this.toSeconds(e);this._activeSources.forEach(e=>e.stop(t))}restart(e,t,n){return super.restart(e,t,n),this}_restart(e,t,n){var r;(r=[...this._activeSources].pop())==null||r.stop(e),this._start(e,t,n)}seek(e,t){let n=this.toSeconds(t);if(this._state.getValueAtTime(n)===`started`){let t=this.toSeconds(e);this._stop(n),this._start(n,t)}return this}setLoopPoints(e,t){return this.loopStart=e,this.loopEnd=t,this}get loopStart(){return this._loopStart}set loopStart(e){this._loopStart=e,this.buffer.loaded&&Lm(this.toSeconds(e),0,this.buffer.duration),this._activeSources.forEach(t=>{t.loopStart=e})}get loopEnd(){return this._loopEnd}set loopEnd(e){this._loopEnd=e,this.buffer.loaded&&Lm(this.toSeconds(e),0,this.buffer.duration),this._activeSources.forEach(t=>{t.loopEnd=e})}get buffer(){return this._buffer}set buffer(e){this._buffer.set(e)}get loop(){return this._loop}set loop(e){if(this._loop!==e&&(this._loop=e,this._activeSources.forEach(t=>{t.loop=e}),e)){let e=this._state.getNextState(`stopped`,this.now());e&&this._state.cancel(e.time)}}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=e;let t=this.now(),n=this._state.getNextState(`stopped`,t);n&&n.implicitEnd&&(this._state.cancel(n.time),this._activeSources.forEach(e=>e.cancelStop())),this._activeSources.forEach(n=>{n.playbackRate.setValueAtTime(e,t)})}get reverse(){return this._buffer.reverse}set reverse(e){this._buffer.reverse=e}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach(e=>e.dispose()),this._activeSources.clear(),this._buffer.dispose(),this}};Zm([Bg(0)],Vg.prototype,`fadeIn`,void 0),Zm([Bg(0)],Vg.prototype,`fadeOut`,void 0);var Hg=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments,[`attack`,`decay`,`sustain`,`release`]);super(t),this.name=`Envelope`,this._sig=new ig({context:this.context,value:0}),this.output=this._sig,this.input=void 0,this.attack=t.attack,this.decay=t.decay,this.sustain=t.sustain,this.release=t.release,this.attackCurve=t.attackCurve,this.releaseCurve=t.releaseCurve,this.decayCurve=t.decayCurve}static getDefaults(){return Object.assign($.getDefaults(),{attack:.01,attackCurve:`linear`,decay:.1,decayCurve:`exponential`,release:1,releaseCurve:`exponential`,sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(e,t){if(Fm(e))return e;{let n;for(n in Ug)if(Ug[n][t]===e)return n;return e}}_setCurve(e,t,n){if(Fm(n)&&Reflect.has(Ug,n)){let r=Ug[n];Mm(r)?e!==`_decayCurve`&&(this[e]=r[t]):this[e]=r}else if(Pm(n)&&e!==`_decayCurve`)this[e]=n;else throw Error(`Envelope: invalid curve: `+n)}get attackCurve(){return this._getCurve(this._attackCurve,`In`)}set attackCurve(e){this._setCurve(`_attackCurve`,`In`,e)}get releaseCurve(){return this._getCurve(this._releaseCurve,`Out`)}set releaseCurve(e){this._setCurve(`_releaseCurve`,`Out`,e)}get decayCurve(){return this._getCurve(this._decayCurve,`Out`)}set decayCurve(e){this._setCurve(`_decayCurve`,`Out`,e)}triggerAttack(e,t=1){this.log(`triggerAttack`,e,t),e=this.toSeconds(e);let n=this.toSeconds(this.attack),r=this.toSeconds(this.decay),i=this.getValueAtTime(e);if(i>0){let e=1/n;n=(1-i)/e}if(n<this.sampleTime)this._sig.cancelScheduledValues(e),this._sig.setValueAtTime(t,e);else if(this._attackCurve===`linear`)this._sig.linearRampTo(t,n,e);else if(this._attackCurve===`exponential`)this._sig.targetRampTo(t,n,e);else{this._sig.cancelAndHoldAtTime(e);let r=this._attackCurve;for(let e=1;e<r.length;e++)if(r[e-1]<=i&&i<=r[e]){r=this._attackCurve.slice(e),r[0]=i;break}this._sig.setValueCurveAtTime(r,e,n,t)}if(r&&this.sustain<1){let i=t*this.sustain,a=e+n;this.log(`decay`,a),this._decayCurve===`linear`?this._sig.linearRampToValueAtTime(i,r+a):this._sig.exponentialApproachValueAtTime(i,a,r)}return this}triggerRelease(e){this.log(`triggerRelease`,e),e=this.toSeconds(e);let t=this.getValueAtTime(e);if(t>0){let n=this.toSeconds(this.release);n<this.sampleTime?this._sig.setValueAtTime(0,e):this._releaseCurve===`linear`?this._sig.linearRampTo(0,n,e):this._releaseCurve===`exponential`?this._sig.targetRampTo(0,n,e):(q(Pm(this._releaseCurve),`releaseCurve must be either 'linear', 'exponential' or an array`),this._sig.cancelAndHoldAtTime(e),this._sig.setValueCurveAtTime(this._releaseCurve,e,n,t))}return this}getValueAtTime(e){return this._sig.getValueAtTime(e)}triggerAttackRelease(e,t,n=1){return t=this.toSeconds(t),this.triggerAttack(t,n),this.triggerRelease(t+this.toSeconds(e)),this}cancel(e){return this._sig.cancelScheduledValues(this.toSeconds(e)),this}connect(e,t=0,n=0){return ag(this,e,t,n),this}asArray(){return J(this,arguments,void 0,function*(e=1024){let t=e/this.context.sampleRate,n=new Ah(1,t,this.context.sampleRate),r=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=r+this.toSeconds(this.release),a=i*.1,o=i+a,s=new this.constructor(Object.assign(this.get(),{attack:t*this.toSeconds(this.attack)/o,decay:t*this.toSeconds(this.decay)/o,release:t*this.toSeconds(this.release)/o,context:n}));return s._sig.toDestination(),s.triggerAttackRelease(t*(r+a)/o,0),(yield n.render()).getChannelData(0)})}dispose(){return super.dispose(),this._sig.dispose(),this}};Zm([Bg(0)],Hg.prototype,`attack`,void 0),Zm([Bg(0)],Hg.prototype,`decay`,void 0),Zm([zg(0,1)],Hg.prototype,`sustain`,void 0),Zm([Bg(0)],Hg.prototype,`release`,void 0);var Ug=(()=>{let e,t,n=[];for(e=0;e<128;e++)n[e]=Math.sin(e/127*(Math.PI/2));let r=[];for(e=0;e<127;e++)t=e/127,r[e]=(Math.sin(Math.PI*2*t*6.4-Math.PI/2)+1)/10+t*.83;r[127]=1;let i=[];for(e=0;e<128;e++)i[e]=Math.ceil(e/127*5)/5;let a=[];for(e=0;e<128;e++)t=e/127,a[e]=.5*(1-Math.cos(Math.PI*t));let o=[];for(e=0;e<128;e++){t=e/127;let n=t**3*4+.2,r=Math.cos(n*Math.PI*2*t);o[e]=Math.abs(r*(1-t))}function s(e){let t=Array(e.length);for(let n=0;n<e.length;n++)t[n]=1-e[n];return t}function c(e){return e.slice(0).reverse()}return{bounce:{In:s(o),Out:o},cosine:{In:n,Out:c(n)},exponential:`exponential`,linear:`linear`,ripple:{In:r,Out:s(r)},sine:{In:a,Out:s(a)},step:{In:i,Out:s(i)}}})(),Wg=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments);super(t),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease,this._syncedRelease=e=>this._original_triggerRelease(e),this._volume=this.output=new ug({context:this.context,volume:t.volume}),this.volume=this._volume.volume,X(this,`volume`)}static getDefaults(){return Object.assign($.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod(`triggerAttack`,1),this._syncMethod(`triggerRelease`,0),this.context.transport.on(`stop`,this._syncedRelease),this.context.transport.on(`pause`,this._syncedRelease),this.context.transport.on(`loopEnd`,this._syncedRelease)),this}_syncState(){let e=!1;return this._synced||(this._synced=!0,e=!0),e}_syncMethod(e,t){let n=this[`_original_`+e]=this[e];this[e]=(...e)=>{let r=e[t],i=this.context.transport.schedule(r=>{e[t]=r,n.apply(this,e)},r);this._scheduledEvents.push(i)}}unsync(){return this._scheduledEvents.forEach(e=>this.context.transport.clear(e)),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease,this.context.transport.off(`stop`,this._syncedRelease),this.context.transport.off(`pause`,this._syncedRelease),this.context.transport.off(`loopEnd`,this._syncedRelease)),this}triggerAttackRelease(e,t,n,r){let i=this.toSeconds(n),a=this.toSeconds(t);return this.triggerAttack(e,i,r),this.triggerRelease(i+a),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}},Gg=class e extends Wg{constructor(){let t=Y(e.getDefaults(),arguments);super(t),this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(Wg.getDefaults(),{detune:0,onsilence:Z,portamento:0})}triggerAttack(e,t,n=1){this.log(`triggerAttack`,e,t,n);let r=this.toSeconds(t);return this._triggerEnvelopeAttack(r,n),this.setNote(e,r),this}triggerRelease(e){this.log(`triggerRelease`,e);let t=this.toSeconds(e);return this._triggerEnvelopeRelease(t),this}setNote(e,t){let n=this.toSeconds(t),r=e instanceof Kh?e.toFrequency():e;if(this.portamento>0&&this.getLevelAtTime(n)>.05){let e=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(r,e,n)}else this.frequency.setValueAtTime(r,n);return this}};Zm([Bg(0)],Gg.prototype,`portamento`,void 0);var Kg=class e extends Hg{constructor(){super(Y(e.getDefaults(),arguments,[`attack`,`decay`,`sustain`,`release`])),this.name=`AmplitudeEnvelope`,this._gainNode=new tg({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}dispose(){return super.dispose(),this._gainNode.dispose(),this}},qg=class e extends Gg{constructor(){let t=Y(e.getDefaults(),arguments);super(t),this.name=`Synth`,this.oscillator=new Rg(Object.assign({context:this.context,detune:t.detune,onstop:()=>this.onsilence(this)},t.oscillator)),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new Kg(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),X(this,[`oscillator`,`frequency`,`detune`,`envelope`])}static getDefaults(){return Object.assign(Gg.getDefaults(),{envelope:Object.assign(lh(Hg.getDefaults(),Object.keys($.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(lh(Rg.getDefaults(),[...Object.keys(Tg.getDefaults()),`frequency`,`detune`]),{type:`triangle`})})}_triggerEnvelopeAttack(e,t){if(this.envelope.triggerAttack(e,t),this.oscillator.start(e),this.envelope.sustain===0){let t=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(e+t+n)}}_triggerEnvelopeRelease(e){this.envelope.triggerRelease(e),this.oscillator.stop(e+this.toSeconds(this.envelope.release))}getLevelAtTime(e){return e=this.toSeconds(e),this.envelope.getValueAtTime(e)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}},Jg=class e extends qg{constructor(){let t=Y(e.getDefaults(),arguments);super(t),this.name=`MembraneSynth`,this.portamento=0,this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,X(this,[`oscillator`,`envelope`])}static getDefaults(){return ah(Gg.getDefaults(),qg.getDefaults(),{envelope:{attack:.001,attackCurve:`exponential`,decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:`sine`},pitchDecay:.05})}setNote(e,t){let n=this.toSeconds(t),r=this.toFrequency(e instanceof Kh?e.toFrequency():e),i=r*this.octaves;return this.oscillator.frequency.setValueAtTime(i,n),this.oscillator.frequency.exponentialRampToValueAtTime(r,n+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}};Zm([zg(0)],Jg.prototype,`octaves`,void 0),Zm([Bg(0)],Jg.prototype,`pitchDecay`,void 0);var Yg=new Set;function Xg(e){Yg.add(e)}function Zg(e,t){let n=`registerProcessor("${e}", ${t})`;Yg.add(n)}Xg(`
/**
* The base AudioWorkletProcessor for use in Tone.js. Works with the {@link ToneAudioWorklet}.
*/
class ToneAudioWorkletProcessor extends AudioWorkletProcessor {
constructor(options) {
super(options);
/**
* If the processor was disposed or not. Keep alive until it's disposed.
*/
this.disposed = false;
/**
* The number of samples in the processing block
*/
this.blockSize = 128;
/**
* the sample rate
*/
this.sampleRate = sampleRate;
this.port.onmessage = (event) => {
// when it receives a dispose
if (event.data === "dispose") {
this.disposed = true;
}
};
}
}
`),Xg(`
/**
* Abstract class for a single input/output processor.
* has a 'generate' function which processes one sample at a time
*/
class SingleIOProcessor extends ToneAudioWorkletProcessor {
constructor(options) {
super(Object.assign(options, {
numberOfInputs: 1,
numberOfOutputs: 1
}));
/**
* Holds the name of the parameter and a single value of that
* parameter at the current sample
* @type { [name: string]: number }
*/
this.params = {}
}
/**
* Generate an output sample from the input sample and parameters
* @abstract
* @param input number
* @param channel number
* @param parameters { [name: string]: number }
* @returns number
*/
generate(){}
/**
* Update the private params object with the
* values of the parameters at the given index
* @param parameters { [name: string]: Float32Array },
* @param index number
*/
updateParams(parameters, index) {
for (const paramName in parameters) {
const param = parameters[paramName];
if (param.length > 1) {
this.params[paramName] = parameters[paramName][index];
} else {
this.params[paramName] = parameters[paramName][0];
}
}
}
/**
* Process a single frame of the audio
* @param inputs Float32Array[][]
* @param outputs Float32Array[][]
*/
process(inputs, outputs, parameters) {
const input = inputs[0];
const output = outputs[0];
// get the parameter values
const channelCount = Math.max(input && input.length || 0, output.length);
for (let sample = 0; sample < this.blockSize; sample++) {
this.updateParams(parameters, sample);
for (let channel = 0; channel < channelCount; channel++) {
const inputSample = input && input.length ? input[channel][sample] : 0;
output[channel][sample] = this.generate(inputSample, channel, this.params);
}
}
return !this.disposed;
}
};
`),Xg(`
/**
* A multichannel buffer for use within an AudioWorkletProcessor as a delay line
*/
class DelayLine {
constructor(size, channels) {
this.buffer = [];
this.writeHead = []
this.size = size;
// create the empty channels
for (let i = 0; i < channels; i++) {
this.buffer[i] = new Float32Array(this.size);
this.writeHead[i] = 0;
}
}
/**
* Push a value onto the end
* @param channel number
* @param value number
*/
push(channel, value) {
this.writeHead[channel] += 1;
if (this.writeHead[channel] > this.size) {
this.writeHead[channel] = 0;
}
this.buffer[channel][this.writeHead[channel]] = value;
}
/**
* Get the recorded value of the channel given the delay
* @param channel number
* @param delay number delay samples
*/
get(channel, delay) {
let readHead = this.writeHead[channel] - Math.floor(delay);
if (readHead < 0) {
readHead += this.size;
}
return this.buffer[channel][readHead];
}
}
`),Zg(`feedback-comb-filter`,`
class FeedbackCombFilterWorklet extends SingleIOProcessor {
constructor(options) {
super(options);
this.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);
}
static get parameterDescriptors() {
return [{
name: "delayTime",
defaultValue: 0.1,
minValue: 0,
maxValue: 1,
automationRate: "k-rate"
}, {
name: "feedback",
defaultValue: 0.5,
minValue: 0,
maxValue: 0.9999,
automationRate: "k-rate"
}];
}
generate(input, channel, parameters) {
const delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);
this.delayLine.push(channel, input + delayedSample * parameters.feedback);
return delayedSample;
}
}
`);var Qg=class e extends Wg{constructor(){let t=Y(e.getDefaults(),arguments,[`urls`,`onload`,`baseUrl`],`urls`);super(t),this.name=`Sampler`,this._activeSources=new Map;let n={};Object.keys(t.urls).forEach(e=>{let r=parseInt(e,10);if(q(Im(e)||jm(r)&&isFinite(r),`url key is neither a note or midi pitch: ${e}`),Im(e)){let r=new Kh(this.context,e).toMidi();n[r]=t.urls[e]}else jm(r)&&isFinite(r)&&(n[r]=t.urls[r])}),this._buffers=new pg({urls:n,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.attack=t.attack,this.release=t.release,this.curve=t.curve,this._buffers.loaded&&Promise.resolve().then(t.onload)}static getDefaults(){return Object.assign(Wg.getDefaults(),{attack:0,baseUrl:``,curve:`exponential`,onload:Z,onerror:Z,release:.1,urls:{}})}_findClosest(e){let t=0;for(;t<96;){if(this._buffers.has(e+t))return-t;if(this._buffers.has(e-t))return t;t++}throw Error(`No available buffers for note: ${e}`)}triggerAttack(e,t,n=1){return this.log(`triggerAttack`,e,t,n),Array.isArray(e)||(e=[e]),e.forEach(e=>{let r=Hh(new Kh(this.context,e).toFrequency()),i=Math.round(r),a=r-i,o=this._findClosest(i),s=i-o,c=this._buffers.get(s),l=Lh(o+a),u=new Eg({url:c,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:l}).connect(this.output);u.start(t,0,c.duration/l,n),Pm(this._activeSources.get(i))||this._activeSources.set(i,[]),this._activeSources.get(i).push(u),u.onended=()=>{if(this._activeSources&&this._activeSources.has(i)){let e=this._activeSources.get(i),t=e.indexOf(u);t!==-1&&e.splice(t,1)}}}),this}triggerRelease(e,t){return this.log(`triggerRelease`,e,t),Array.isArray(e)||(e=[e]),e.forEach(e=>{let n=new Kh(this.context,e).toMidi();if(this._activeSources.has(n)&&this._activeSources.get(n).length){let e=this._activeSources.get(n);t=this.toSeconds(t),e.forEach(e=>{e.stop(t)}),this._activeSources.set(n,[])}}),this}releaseAll(e){let t=this.toSeconds(e);return this._activeSources.forEach(e=>{for(;e.length;)e.shift().stop(t)}),this}sync(){return this._syncState()&&(this._syncMethod(`triggerAttack`,1),this._syncMethod(`triggerRelease`,1)),this}triggerAttackRelease(e,t,n,r=1){let i=this.toSeconds(n);return this.triggerAttack(e,i,r),Pm(t)?(q(Pm(e),`notes must be an array when duration is array`),e.forEach((e,n)=>{let r=t[Math.min(n,t.length-1)];this.triggerRelease(e,i+this.toSeconds(r))})):this.triggerRelease(e,i+this.toSeconds(t)),this}add(e,t,n){if(q(Im(e)||isFinite(e),`note must be a pitch or midi: ${e}`),Im(e)){let r=new Kh(this.context,e).toMidi();this._buffers.add(r,t,n)}else this._buffers.add(e,t,n);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach(e=>{e.forEach(e=>e.dispose())}),this._activeSources.clear(),this}};Zm([Bg(0)],Qg.prototype,`attack`,void 0),Zm([Bg(0)],Qg.prototype,`release`,void 0);var $g=class e extends Xh{constructor(){let t=Y(e.getDefaults(),arguments,[`callback`,`value`]);super(t),this.name=`ToneEvent`,this._state=new Zh(`stopped`),this._startOffset=0,this._loop=t.loop,this.callback=t.callback,this.value=t.value,this._loopStart=this.toTicks(t.loopStart),this._loopEnd=this.toTicks(t.loopEnd),this._playbackRate=t.playbackRate,this._probability=t.probability,this._humanize=t.humanize,this.mute=t.mute,this._playbackRate=t.playbackRate,this._state.increasing=!0,this._rescheduleEvents()}static getDefaults(){return Object.assign(Xh.getDefaults(),{callback:Z,humanize:!1,loop:!1,loopEnd:`1m`,loopStart:0,mute:!1,playbackRate:1,probability:1,value:null})}_rescheduleEvents(e=-1){this._state.forEachFrom(e,e=>{let t;if(e.state===`started`){e.id!==-1&&this.context.transport.clear(e.id);let n=e.time+Math.round(this.startOffset/this._playbackRate);if(this._loop===!0||jm(this._loop)&&this._loop>1){t=1/0,jm(this._loop)&&(t=this._loop*this._getLoopDuration());let r=this._state.getAfter(n);r!==null&&(t=Math.min(t,r.time-n)),t!==1/0&&(t=new mg(this.context,t));let i=new mg(this.context,this._getLoopDuration());e.id=this.context.transport.scheduleRepeat(this._tick.bind(this),i,new mg(this.context,n),t)}else e.id=this.context.transport.schedule(this._tick.bind(this),new mg(this.context,n))}})}get state(){return this._state.getValueAtTime(this.context.transport.ticks)}get startOffset(){return this._startOffset}set startOffset(e){this._startOffset=e}get probability(){return this._probability}set probability(e){this._probability=e}get humanize(){return this._humanize}set humanize(e){this._humanize=e}start(e){let t=this.toTicks(e);return this._state.getValueAtTime(t)===`stopped`&&(this._state.add({id:-1,state:`started`,time:t}),this._rescheduleEvents(t)),this}stop(e){this.cancel(e);let t=this.toTicks(e);if(this._state.getValueAtTime(t)===`started`){this._state.setStateAtTime(`stopped`,t,{id:-1});let e=this._state.getBefore(t),n=t;e!==null&&(n=e.time),this._rescheduleEvents(n)}return this}cancel(e){e=ch(e,-1/0);let t=this.toTicks(e);return this._state.forEachFrom(t,e=>{this.context.transport.clear(e.id)}),this._state.cancel(t),this}_tick(e){let t=this.context.transport.getTicksAtTime(e);if(!this.mute&&this._state.getValueAtTime(t)===`started`){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){let t=.02;Nm(this.humanize)||(t=this.toSeconds(this.humanize)),e+=(Math.random()*2-1)*t}this.callback(e,this.value)}}_getLoopDuration(){return(this._loopEnd-this._loopStart)/this._playbackRate}get loop(){return this._loop}set loop(e){this._loop=e,this._rescheduleEvents()}get playbackRate(){return this._playbackRate}set playbackRate(e){this._playbackRate=e,this._rescheduleEvents()}get loopEnd(){return new mg(this.context,this._loopEnd).toSeconds()}set loopEnd(e){this._loopEnd=this.toTicks(e),this._loop&&this._rescheduleEvents()}get loopStart(){return new mg(this.context,this._loopStart).toSeconds()}set loopStart(e){this._loopStart=this.toTicks(e),this._loop&&this._rescheduleEvents()}get progress(){if(this._loop){let e=this.context.transport.ticks,t=this._state.get(e);if(t!==null&&t.state===`started`){let n=this._getLoopDuration();return(e-t.time)%n/n}else return 0}else return 0}dispose(){return super.dispose(),this.cancel(),this._state.dispose(),this}},e_=class e extends Xh{constructor(){let t=Y(e.getDefaults(),arguments,[`callback`,`interval`]);super(t),this.name=`Loop`,this._event=new $g({context:this.context,callback:this._tick.bind(this),loop:!0,loopEnd:t.interval,playbackRate:t.playbackRate,probability:t.probability,humanize:t.humanize}),this.callback=t.callback,this.iterations=t.iterations}static getDefaults(){return Object.assign(Xh.getDefaults(),{interval:`4n`,callback:Z,playbackRate:1,iterations:1/0,probability:1,mute:!1,humanize:!1})}start(e){return this._event.start(e),this}stop(e){return this._event.stop(e),this}cancel(e){return this._event.cancel(e),this}_tick(e){this.callback(e)}get state(){return this._event.state}get progress(){return this._event.progress}get interval(){return this._event.loopEnd}set interval(e){this._event.loopEnd=e}get playbackRate(){return this._event.playbackRate}set playbackRate(e){this._event.playbackRate=e}get humanize(){return this._event.humanize}set humanize(e){this._event.humanize=e}get probability(){return this._event.probability}set probability(e){this._event.probability=e}get mute(){return this._event.mute}set mute(e){this._event.mute=e}get iterations(){return this._event.loop===!0?1/0:this._event.loop}set iterations(e){e===1/0?this._event.loop=!0:this._event.loop=e}dispose(){return super.dispose(),this._event.dispose(),this}},t_=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments,[`pan`]);super(t),this.name=`Panner`,this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner,this.pan=new Q({context:this.context,param:this._panner.pan,value:t.pan,minValue:-1,maxValue:1}),this._panner.channelCount=t.channelCount,this._panner.channelCountMode=`explicit`,X(this,`pan`)}static getDefaults(){return Object.assign($.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}};Zg(`bit-crusher`,`
class BitCrusherWorklet extends SingleIOProcessor {
static get parameterDescriptors() {
return [{
name: "bits",
defaultValue: 12,
minValue: 1,
maxValue: 16,
automationRate: 'k-rate'
}];
}
generate(input, _channel, parameters) {
const step = Math.pow(0.5, parameters.bits - 1);
const val = step * Math.floor(input / step + 0.5);
return val;
}
}
`);var n_=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments,[`solo`]);super(t),this.name=`Solo`,this.input=this.output=new tg({context:this.context}),e._allSolos.has(this.context)||e._allSolos.set(this.context,new Set),e._allSolos.get(this.context).add(this),this.solo=t.solo}static getDefaults(){return Object.assign($.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(t){t?this._addSolo():this._removeSolo(),e._allSolos.get(this.context).forEach(e=>e._updateSolo())}get muted(){return this.input.gain.value===0}_addSolo(){e._soloed.has(this.context)||e._soloed.set(this.context,new Set),e._soloed.get(this.context).add(this)}_removeSolo(){e._soloed.has(this.context)&&e._soloed.get(this.context).delete(this)}_isSoloed(){return e._soloed.has(this.context)&&e._soloed.get(this.context).has(this)}_noSolos(){return!e._soloed.has(this.context)||e._soloed.has(this.context)&&e._soloed.get(this.context).size===0}_updateSolo(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),e._allSolos.get(this.context).delete(this),this._removeSolo(),this}};n_._allSolos=new Map,n_._soloed=new Map;var r_=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments,[`pan`,`volume`]);super(t),this.name=`PanVol`,this._panner=this.input=new t_({context:this.context,pan:t.pan,channelCount:t.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new ug({context:this.context,volume:t.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,X(this,[`pan`,`volume`])}static getDefaults(){return Object.assign($.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(e){this._volume.mute=e}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}},i_=class e extends ${constructor(){let t=Y(e.getDefaults(),arguments,[`volume`,`pan`]);super(t),this.name=`Channel`,this._solo=this.input=new n_({solo:t.solo,context:this.context}),this._panVol=this.output=new r_({context:this.context,pan:t.pan,volume:t.volume,mute:t.mute,channelCount:t.channelCount}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),X(this,[`pan`,`volume`])}static getDefaults(){return Object.assign($.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(e){this._solo.solo=e}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(e){this._panVol.mute=e}_getBus(t){return e.buses.has(t)||e.buses.set(t,new tg({context:this.context})),e.buses.get(t)}send(e,t=0){let n=this._getBus(e),r=new tg({context:this.context,units:`decibels`,gain:t});return this.connect(r),r.connect(n),r}receive(e){return this._getBus(e).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}};i_.buses=new Map;function a_(){return Nh().now()}Nh().transport;function o_(){return Nh().transport}Nh().destination,Nh().destination,Nh().listener,Nh().draw,Nh();var s_={class:`image-melody`},c_={key:1},l_={class:`images`,key:`images`},u_={key:0,class:`audio`},d_={class:`controls`},f_=500,p_={__name:`ImageMelody`,setup(e){let t=Vt(),n=Vt(0),r=Vt(),i=Vt(),a=Vt(),o=Vt(),s=Vt(),c=Vt(),l=async e=>{e?.[0]&&(r.value=!0,await new Promise(t=>{let n=new FileReader;n.onload=e=>{i.value=e.target.result,t()},n.readAsDataURL(e[0])}))},{isOverDropZone:u}=ps(t,{onDrop:l,dataTypes:[`image/jpeg`,`image/png`]}),{open:d,onChange:f}=gs({accept:[`image/jpeg`,`image/png`]});f(l);let p=(e,t)=>{e.width=f_,e.height=f_;let n=e.getContext(`2d`),{x:r,y:i,width:o,height:s}=_s(`cover`,{width:a.value.naturalWidth,height:a.value.naturalHeight},{width:e.width,height:e.height});if(t){let e=t.width/5,r=t.height/5,i=[];for(let a=0;a<5;a++)for(let o=0;o<5;o++){let s=Math.floor(o*e),c=(Math.floor(a*r)*t.width+s*t.height)*4,l=t.data[c],u=t.data[c+1],d=t.data[c+2];n.fillStyle=`rgba(${l}, ${u}, ${d}, ${t.data[c+3]/255})`,i.push(Math.round((l+u+d)/3));let f=f_/5;n.fillRect(o*f,a*f,f,f)}c.value=i}else n.drawImage(a.value,r,i,o,s);return n};Pn(i,async()=>{if(!i.value)return;a.value.src=i.value,await new Promise(e=>a.value.onload=e),r.value=!1,n.value=1,await new Promise(e=>setTimeout(e,f_));let e=p(o.value).getImageData(0,0,f_,f_);p(s.value,e)});let m=Vt(),h=(e,t)=>e.slice(0,t.length).map((e,t)=>({index:t,value:e})).sort((e,t)=>e.value-t.value).map(e=>e.index).map(e=>t[e]),g=()=>{if(m.value)return;let e=new qg().toDestination();a_();let t=h(c.value,[`C4`,`D4`,`E4`,`G4`,`A4`]),n=0;m.value=new e_(r=>{e.triggerAttackRelease(t[n],`8n`),n=(n+1)%t.length},`4n`).start(0),o_().start()},_=()=>{m.value?.dispose(),m.value=null,o_().stop()},v=()=>{_(),n.value=0,c.value=null};return(e,i)=>{let l=Tr(`svg-util-spinner`);return Zi(),na(`div`,s_,[ca(`img`,{ref_key:`image`,ref:a,hidden:``},null,512),L(ro,{name:`fade`,mode:`out-in`},{default:Dn(()=>[n.value===0?(Zi(),na(`div`,{class:fe([`drop-zone`,{active:Gt(u)}]),ref_key:`dropZone`,ref:t,key:`drop`,onClick:i[0]||=(...e)=>Gt(d)&&Gt(d)(...e)},[r.value?(Zi(),ra(l,{key:0})):(Zi(),na(`p`,c_,`Drop PNG or JPG`))],2)):n.value===1?(Zi(),na(`div`,l_,[ca(`canvas`,{ref_key:`viewCanvas`,ref:o},null,512),ca(`canvas`,{ref_key:`processCanvas`,ref:s},null,512)])):pa(``,!0)]),_:1}),c.value?(Zi(),na(`div`,u_,[ca(`div`,d_,[L(xs,{onClick:g,class:`play`},{default:Dn(()=>[...i[1]||=[fa(`Play`,-1)]]),_:1}),L(xs,{onClick:_},{default:Dn(()=>[...i[2]||=[fa(`Stop`,-1)]]),_:1})]),ca(`button`,{onClick:v,class:`reset`},`Reset`)])):pa(``,!0)])}}},m_={class:`drop theme-light`};Qo({__name:`App`,setup(e){return(e,t)=>(Zi(),na(`main`,m_,[L(p_)]))}}).mount(`#app`);