@blibliki/engine 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/core/midi/ComputerKeyboardInput.d.ts +11 -0
- package/dist/build/core/midi/MidiDevice.d.ts +8 -4
- package/dist/build/core/midi/MidiDeviceManager.d.ts +1 -0
- package/dist/build/modules/Filter.d.ts +5 -0
- package/dist/main.cjs.js +5 -5
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.esm.js +4 -4
- package/dist/main.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/core/midi/ComputerKeyboardInput.ts +57 -0
- package/src/core/midi/MidiDevice.ts +15 -8
- package/src/core/midi/MidiDeviceManager.ts +9 -4
- package/src/modules/Filter.ts +46 -4
- package/src/modules/Master.ts +4 -1
package/dist/main.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ const t="14.7.77",e=(t,e,n)=>({endTime:e,insertTime:n,type:"exponentialRampToVal
|
|
|
4
4
|
* @author Yotam Mann
|
|
5
5
|
* @license http://opensource.org/licenses/MIT MIT License
|
|
6
6
|
* @copyright 2014-2019 Yotam Mann
|
|
7
|
-
*/class wi{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||ri&&this.toString()===ri.TONE_DEBUG_CLASS)&&function(...t){Zs.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}wi.version=t;const bi=1e-6;function xi(t,e){return t>e+bi}function Ti(t,e){return xi(t,e)||ki(t,e)}function Ai(t,e){return t+bi<e}function ki(t,e){return Math.abs(t-e)<bi}class Ci extends wi{constructor(){super(),this.name="Timeline",this._timeline=[];const t=gi(Ci.getDefaults(),arguments,["memory"]);this.memory=t.memory,this.increasing=t.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(t){if($s(Reflect.has(t,"time"),"Timeline: events must have a time attribute"),t.time=t.time.valueOf(),this.increasing&&this.length){const e=this._timeline[this.length-1];$s(Ti(t.time,e.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(t)}else{const e=this._search(t.time);this._timeline.splice(e+1,0,t)}if(this.length>this.memory){const t=this.length-this.memory;this._timeline.splice(0,t)}return this}remove(t){const e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this}get(t,e="time"){const n=this._search(t,e);return-1!==n?this._timeline[n]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(t,e="time"){const n=this._search(t,e);return n+1<this._timeline.length?this._timeline[n+1]:null}getBefore(t){const e=this._timeline.length;if(e>0&&this._timeline[e-1].time<t)return this._timeline[e-1];const n=this._search(t);return n-1>=0?this._timeline[n-1]:null}cancel(t){if(this._timeline.length>1){let e=this._search(t);if(e>=0)if(ki(this._timeline[e].time,t)){for(let n=e;n>=0&&ki(this._timeline[n].time,t);n--)e=n;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&Ti(this._timeline[0].time,t)&&(this._timeline=[]);return this}cancelBefore(t){const e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this}previousEvent(t){const e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null}_search(t,e="time"){if(0===this._timeline.length)return-1;let n=0;const s=this._timeline.length;let i=s;if(s>0&&this._timeline[s-1][e]<=t)return s-1;for(;n<i;){let s=Math.floor(n+(i-n)/2);const r=this._timeline[s],o=this._timeline[s+1];if(ki(r[e],t)){for(let n=s;n<this._timeline.length;n++){if(!ki(this._timeline[n][e],t))break;s=n}return s}if(Ai(r[e],t)&&xi(o[e],t))return s;xi(r[e],t)?i=s:n=s+1}return-1}_iterate(t,e=0,n=this._timeline.length-1){this._timeline.slice(e,n+1).forEach(t)}forEach(t){return this._iterate(t),this}forEachBefore(t,e){const n=this._search(t);return-1!==n&&this._iterate(e,0,n),this}forEachAfter(t,e){const n=this._search(t);return this._iterate(e,n+1),this}forEachBetween(t,e,n){let s=this._search(t),i=this._search(e);return-1!==s&&-1!==i?(this._timeline[s].time!==t&&(s+=1),this._timeline[i].time===e&&(i-=1),this._iterate(n,s,i)):-1===s&&this._iterate(n,0,i),this}forEachFrom(t,e){let n=this._search(t);for(;n>=0&&this._timeline[n].time>=t;)n--;return this._iterate(e,n+1),this}forEachAtTime(t,e){const n=this._search(t);if(-1!==n&&ki(this._timeline[n].time,t)){let s=n;for(let e=n;e>=0&&ki(this._timeline[e].time,t);e--)s=e;this._iterate((t=>{e(t)}),s,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}const Si=[];function Oi(t){Si.push(t)}const Mi=[];function Ei(t){Mi.push(t)}class Di extends wi{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach((t=>{Qs(this._events)&&(this._events={}),this._events.hasOwnProperty(t)||(this._events[t]=[]),this._events[t].push(e)})),this}once(t,e){const n=(...s)=>{e(...s),this.off(t,n)};return this.on(t,n),this}off(t,e){return t.split(/\W+/).forEach((n=>{if(Qs(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(Qs(e))this._events[t]=[];else{const n=this._events[t];for(let t=n.length-1;t>=0;t--)n[t]===e&&n.splice(t,1)}})),this}emit(t,...e){if(this._events&&this._events.hasOwnProperty(t)){const n=this._events[t].slice(0);for(let t=0,s=n.length;t<s;t++)n[t].apply(this,e)}return this}static mixin(t){["on","once","off","emit"].forEach((e=>{const n=Object.getOwnPropertyDescriptor(Di.prototype,e);Object.defineProperty(t.prototype,e,n)}))}dispose(){return super.dispose(),this._events=void 0,this}}class Ii extends Di{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class Ri extends Ii{constructor(){super(),this.name="Context",this._constants=new Map,this._timeouts=new Ci,this._timeoutIds=0,this._initialized=!1,this.isOffline=!1,this._workletModules=new Map;const t=gi(Ri.getDefaults(),arguments,["context"]);t.context?this._context=t.context:this._context=function(t){return new ks(t)}({latencyHint:t.latencyHint}),this._ticker=new ci(this.emit.bind(this,"tick"),t.clockSource,t.updateInterval),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this._setLatencyHint(t.latencyHint),this.lookAhead=t.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){var t;return this._initialized||(t=this,Si.forEach((e=>e(t))),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(t,e,n){return this._context.createBuffer(t,e,n)}createChannelMerger(t){return this._context.createChannelMerger(t)}createChannelSplitter(t){return this._context.createChannelSplitter(t)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(t){return this._context.createDelay(t)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(t,e){return this._context.createIIRFilter(t,e)}createPanner(){return this._context.createPanner()}createPeriodicWave(t,e,n){return this._context.createPeriodicWave(t,e,n)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(t){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamDestination()}decodeAudioData(t){return this._context.decodeAudioData(t)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(t){$s(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){$s(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){$s(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){$s(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return $s(Ks(qs),"This node only works in a secure context (https or localhost)"),new qs(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t,e){return ui(this,void 0,void 0,(function*(){$s(Ks(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletModules.has(e)||this._workletModules.set(e,this.rawContext.audioWorklet.addModule(t)),yield this._workletModules.get(e)}))}workletsAreReady(){return ui(this,void 0,void 0,(function*(){const t=[];this._workletModules.forEach((e=>t.push(e))),yield Promise.all(t)}))}get updateInterval(){return this._ticker.updateInterval}set updateInterval(t){this._ticker.updateInterval=t}get clockSource(){return this._ticker.type}set clockSource(t){this._ticker.type=t}get latencyHint(){return this._latencyHint}_setLatencyHint(t){let e=0;if(this._latencyHint=t,si(t))switch(t){case"interactive":e=.1;break;case"playback":e=.5;break;case"balanced":e=.25}this.lookAhead=e,this.updateInterval=e/2}get rawContext(){return this._context}now(){return this._context.currentTime+this.lookAhead}immediate(){return this._context.currentTime}resume(){return di(this._context)?this._context.resume():Promise.resolve()}close(){return ui(this,void 0,void 0,(function*(){var t;di(this._context)&&(yield this._context.close()),this._initialized&&(t=this,Mi.forEach((e=>e(t))))}))}getConstant(t){if(this._constants.has(t))return this._constants.get(t);{const e=this._context.createBuffer(1,128,this._context.sampleRate),n=e.getChannelData(0);for(let e=0;e<n.length;e++)n[e]=t;const s=this._context.createBufferSource();return s.channelCount=1,s.channelCountMode="explicit",s.buffer=e,s.loop=!0,s.start(0),this._constants.set(t,s),s}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map((t=>this._constants[t].disconnect())),this}_timeoutLoop(){const t=this.now();let e=this._timeouts.peek();for(;this._timeouts.length&&e&&e.time<=t;)e.callback(),this._timeouts.shift(),e=this._timeouts.peek()}setTimeout(t,e){this._timeoutIds++;const n=this.now();return this._timeouts.add({callback:t,id:this._timeoutIds,time:n+e}),this._timeoutIds}clearTimeout(t){return this._timeouts.forEach((e=>{e.id===t&&this._timeouts.remove(e)})),this}clearInterval(t){return this.clearTimeout(t)}setInterval(t,e){const n=++this._timeoutIds,s=()=>{const i=this.now();this._timeouts.add({callback:()=>{t(),s()},id:n,time:i+e})};return s(),n}}function Ni(t,e){ni(e)?e.forEach((e=>Ni(t,e))):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function Bi(t,e){ni(e)?e.forEach((e=>Bi(t,e))):Object.defineProperty(t,e,{writable:!0})}const Pi=()=>{};class Vi extends wi{constructor(){super(),this.name="ToneAudioBuffer",this.onload=Pi;const t=gi(Vi.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,t.url&&fi(t.url)||t.url instanceof Vi?this.set(t.url):si(t.url)&&this.load(t.url).catch(t.onerror)}static getDefaults(){return{onerror:Pi,onload:Pi,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:zi().sampleRate}set(t){return t instanceof Vi?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 ui(this,void 0,void 0,(function*(){const e=Vi.load(t).then((t=>{this.set(t),this.onload(this)}));Vi.downloads.push(e);try{yield e}finally{const t=Vi.downloads.indexOf(e);Vi.downloads.splice(t,1)}return this}))}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=ni(t)&&t[0].length>0,n=e?t.length:1,s=e?t[0].length:t.length,i=zi(),r=i.createBuffer(n,s,i.sampleRate),o=e||1!==n?t:[t];for(let t=0;t<n;t++)r.copyToChannel(o[t],t);return this._buffer=r,this}toMono(t){if(Js(t))this.fromArray(this.toArray(t));else{let t=new Float32Array(this.length);const e=this.numberOfChannels;for(let n=0;n<e;n++){const e=this.toArray(n);for(let n=0;n<e.length;n++)t[n]+=e[n]}t=t.map((t=>t/e)),this.fromArray(t)}return this}toArray(t){if(Js(t))return this.getChannelData(t);if(1===this.numberOfChannels)return this.toArray(0);{const t=[];for(let e=0;e<this.numberOfChannels;e++)t[e]=this.getChannelData(e);return t}}getChannelData(t){return this._buffer?this._buffer.getChannelData(t):new Float32Array(0)}slice(t,e=this.duration){const n=Math.floor(t*this.sampleRate),s=Math.floor(e*this.sampleRate);$s(n<s,"The start time must be less than the end time");const i=s-n,r=zi().createBuffer(this.numberOfChannels,i,this.sampleRate);for(let t=0;t<this.numberOfChannels;t++)r.copyToChannel(this.getChannelData(t).subarray(n,s),t);return new Vi(r)}_reverse(){if(this.loaded)for(let t=0;t<this.numberOfChannels;t++)this.getChannelData(t).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(t){this._reversed!==t&&(this._reversed=t,this._reverse())}static fromArray(t){return(new Vi).fromArray(t)}static fromUrl(t){return ui(this,void 0,void 0,(function*(){const e=new Vi;return yield e.load(t)}))}static load(t){return ui(this,void 0,void 0,(function*(){const e=t.match(/\[([^\]\[]+\|.+)\]$/);if(e){const n=e[1].split("|");let s=n[0];for(const t of n)if(Vi.supportsType(t)){s=t;break}t=t.replace(e[0],s)}const n=""===Vi.baseUrl||Vi.baseUrl.endsWith("/")?Vi.baseUrl:Vi.baseUrl+"/",s=yield fetch(n+t);if(!s.ok)throw new Error(`could not load url: ${t}`);const i=yield s.arrayBuffer();return yield zi().decodeAudioData(i)}))}static supportsType(t){const e=t.split("."),n=e[e.length-1];return""!==document.createElement("audio").canPlayType("audio/"+n)}static loaded(){return ui(this,void 0,void 0,(function*(){for(yield Promise.resolve();Vi.downloads.length;)yield Vi.downloads[0]}))}}Vi.baseUrl="",Vi.downloads=[];class qi extends Ri{constructor(){var t,e,n;super({clockSource:"offline",context:pi(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new zs(t,e,n)),lookAhead:0,updateInterval:pi(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=pi(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(t){return ui(this,void 0,void 0,(function*(){let e=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,e++;const n=Math.floor(this.sampleRate/128);t&&e%n==0&&(yield new Promise((t=>setTimeout(t,1))))}}))}render(t=!0){return ui(this,void 0,void 0,(function*(){yield this.workletsAreReady(),yield this._renderClock(t);const e=yield this._context.startRendering();return new Vi(e)}))}close(){return Promise.resolve()}}const Fi=new class extends Ii{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(t,e,n){return{}}createChannelMerger(t){return{}}createChannelSplitter(t){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(t){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(t,e){return{}}createPanner(){return{}}createPeriodicWave(t,e,n){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(t){return{}}createMediaElementSource(t){return{}}createMediaStreamDestination(){return{}}decodeAudioData(t){return Promise.resolve({})}createAudioWorkletNode(t,e){return{}}get rawContext(){return{}}addAudioWorkletModule(t,e){return ui(this,void 0,void 0,(function*(){return Promise.resolve()}))}resume(){return Promise.resolve()}setTimeout(t,e){return 0}clearTimeout(t){return this}setInterval(t,e){return 0}clearInterval(t){return this}getConstant(t){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(t){}get destination(){return{}}set destination(t){}now(){return 0}immediate(){return 0}};let ji=Fi;function zi(){return ji===Fi&&oi&&Wi(new Ri),ji}function Wi(t){ji=di(t)?new Ri(t):pi(t)?new qi(t):t}if(ri&&!ri.TONE_SILENCE_LOGGING){const e=` * Tone.js ${"v"}${t} * `;console.log(`%c${e}`,"background: #000; color: #fff")}function Li(t){return Math.pow(2,t/12)}let Ui=440;function Hi(t){return Math.round($i(t))}function $i(t){return 69+12*Math.log2(t/Ui)}class Gi extends wi{constructor(t,e,n){super(),this.defaultUnits="s",this._val=e,this._units=n,this.context=t,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:t=>this._frequencyToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:t=>this._ticksToUnits(parseInt(t,10)),regexp:/^(\d+)i$/i},m:{method:t=>this._beatsToUnits(parseInt(t,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(t,e)=>{const n=parseInt(t,10),s="."===e?1.5:1;return 1===n?this._beatsToUnits(this._getTimeSignature())*s:this._beatsToUnits(4/n)*s},regexp:/^(\d+)n(\.?)$/i},number:{method:t=>this._expressions[this.defaultUnits].method.call(this,t),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:t=>this._secondsToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:t=>parseInt(t,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:t=>{const e=parseInt(t,10);return this._beatsToUnits(8/(3*Math.floor(e)))},regexp:/^(\d+)t$/i},tr:{method:(t,e,n)=>{let s=0;return t&&"0"!==t&&(s+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(s+=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(s+=this._beatsToUnits(parseFloat(n)/4)),s},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof Gi&&this.fromType(this._val),Qs(this._val))return this._noArg();if(si(this._val)&&Qs(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(ti(this._val)){let t=0;for(const e in this._val)if(Ks(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(Ks(this._units)){const t=this._expressions[this._units],e=this._val.toString().trim().match(t.regexp);return e?t.method.apply(this,e.slice(1)):t.method.call(this,this._val)}return si(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(t){return 1/t}_beatsToUnits(t){return 60/this._getBpm()*t}_secondsToUnits(t){return t}_ticksToUnits(t){return t*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(t){switch(this._units=void 0,this.defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi()}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return 1e3*this.toSeconds()}}class Xi extends Gi{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:t=>this._now()+new this.constructor(this.context,t).valueOf(),regexp:/^\+(.+)/},quantize:{method:t=>{const e=new Xi(this.context,t).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(e))},regexp:/^@(.+)/}})}quantize(t,e=1){const n=new this.constructor(this.context,t).valueOf(),s=this.valueOf();return s+(Math.round(s/n)*n-s)*e}toNotation(){const t=this.toSeconds(),e=["1m"];for(let t=1;t<9;t++){const n=Math.pow(2,t);e.push(n+"n."),e.push(n+"n"),e.push(n+"t")}e.push("0");let n=e[0],s=new Xi(this.context,e[0]).toSeconds();return e.forEach((e=>{const i=new Xi(this.context,e).toSeconds();Math.abs(i-t)<Math.abs(s-t)&&(n=e,s=i)})),n}toBarsBeatsSixteenths(){const t=this._beatsToUnits(1);let e=this.valueOf()/t;e=parseFloat(e.toFixed(4));const n=Math.floor(e/this._getTimeSignature());let s=e%1*4;e=Math.floor(e)%this._getTimeSignature();const i=s.toString();i.length>3&&(s=parseFloat(parseFloat(i).toFixed(3)));return[n,e,s].join(":")}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.round(e*this._getPPQ())}toSeconds(){return this.valueOf()}toMidi(){return Hi(this.toFrequency())}_now(){return this.context.now()}}class Zi extends Xi{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return Ui}static set A4(t){!function(t){Ui=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Zi.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method(t,e){const n=Yi[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Zi.mtof(n)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(t,e,n){let s=1;return t&&"0"!==t&&(s*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(s*=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(s*=this._beatsToUnits(parseFloat(n)/4)),s}}})}transpose(t){return new Zi(this.context,this.valueOf()*Li(t))}harmonize(t){return t.map((t=>this.transpose(t)))}toMidi(){return Hi(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Zi.A4);let n=Math.round(12*e)+57;const s=Math.floor(n/12);s<0&&(n+=-12*s);return Qi[n%12]+s.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.floor(e*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(t){return t}_ticksToUnits(t){return 1/(60*t/(this._getBpm()*this._getPPQ()))}_beatsToUnits(t){return 1/super._beatsToUnits(t)}_secondsToUnits(t){return 1/t}static mtof(t){return function(t){return Ui*Math.pow(2,(t-69)/12)}(t)}static ftom(t){return Hi(t)}}const Yi={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},Qi=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Ki extends Xi{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Ji extends wi{constructor(){super();const t=gi(Ji.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:zi()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(t){return new Xi(this.context,t).toSeconds()}toFrequency(t){return new Zi(this.context,t).toFrequency()}toTicks(t){return new Ki(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach((n=>{Qs(t[n])&&delete e[n]})),e}get(){const t=this.constructor.getDefaults();return Object.keys(t).forEach((e=>{if(Reflect.has(this,e)){const n=this[e];Ks(n)&&Ks(n.value)&&Ks(n.setValueAtTime)?t[e]=n.value:n instanceof Ji?t[e]=n._getPartialProperties(t[e]):ni(n)||Js(n)||si(n)||ei(n)?t[e]=n:delete t[e]}})),t}set(t){return Object.keys(t).forEach((e=>{Reflect.has(this,e)&&Ks(this[e])&&(this[e]&&Ks(this[e].value)&&Ks(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Ji?this[e].set(t[e]):this[e]=t[e])})),this}}class tr extends Ci{constructor(t="stopped"){super(),this.name="StateTimeline",this._initial=t,this.setStateAtTime(this._initial,0)}getValueAtTime(t){const e=this.get(t);return null!==e?e.state:this._initial}setStateAtTime(t,e,n){return Gs(e,0),this.add(Object.assign({},n,{state:t,time:e})),this}getLastState(t,e){for(let n=this._search(e);n>=0;n--){const e=this._timeline[n];if(e.state===t)return e}}getNextState(t,e){const n=this._search(e);if(-1!==n)for(let e=n;e<this._timeline.length;e++){const n=this._timeline[e];if(n.state===t)return n}}}class er extends Ji{constructor(){super(gi(er.getDefaults(),arguments,["param","units","convert"])),this.name="Param",this.overridden=!1,this._minOutput=1e-7;const t=gi(er.getDefaults(),arguments,["param","units","convert"]);for($s(Ks(t.param)&&(li(t.param)||t.param instanceof er),"param must be an AudioParam");!li(t.param);)t.param=t.param._param;this._swappable=!!Ks(t.swappable)&&t.swappable,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 Ci(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,Ks(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Ji.getDefaults(),{convert:!0,units:"number"})}get value(){const t=this.now();return this.getValueAtTime(t)}set value(t){this.cancelScheduledValues(this.now()),this.setValueAtTime(t,this.now())}get minValue(){return Ks(this._minValue)?this._minValue:"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"===this.units?0:"audioRange"===this.units?-1:"decibels"===this.units?-1/0:this._param.minValue}get maxValue(){return Ks(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return Ks(this.maxValue)&&Ks(this.minValue)&&Gs(t,this._fromType(this.minValue),this._fromType(this.maxValue)),t}_fromType(t){return this.convert&&!this.overridden?this._is(t,"time")?this.toSeconds(t):this._is(t,"decibels")?(e=t,Math.pow(10,e/20)):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t;var e}_toType(t){return this.convert&&"decibels"===this.units?(e=t,Math.log(e)/Math.LN10*20):t;var e}setValueAtTime(t,e){const n=this.toSeconds(e),s=this._fromType(t);return $s(isFinite(s)&&isFinite(n),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(s),this.log(this.units,"setValueAtTime",t,n),this._events.add({time:n,type:"setValueAtTime",value:s}),this._param.setValueAtTime(s,n),this}getValueAtTime(t){const e=Math.max(this.toSeconds(t),0),n=this._events.getAfter(e),s=this._events.get(e);let i=this._initialValue;if(null===s)i=this._initialValue;else if("setTargetAtTime"!==s.type||null!==n&&"setValueAtTime"!==n.type)if(null===n)i=s.value;else if("linearRampToValueAtTime"===n.type||"exponentialRampToValueAtTime"===n.type){let t=s.value;if("setTargetAtTime"===s.type){const e=this._events.getBefore(s.time);t=null===e?this._initialValue:e.value}i="linearRampToValueAtTime"===n.type?this._linearInterpolate(s.time,t,n.time,n.value,e):this._exponentialInterpolate(s.time,t,n.time,n.value,e)}else i=s.value;else{const t=this._events.getBefore(s.time);let n;n=null===t?this._initialValue:t.value,"setTargetAtTime"===s.type&&(i=this._exponentialApproach(s.time,n,s.value,s.constant,e))}return this._toType(i)}setRampPoint(t){t=this.toSeconds(t);let e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),0===this._fromType(e)&&(e=this._toType(this._minOutput)),this.setValueAtTime(e,t),this}linearRampToValueAtTime(t,e){const n=this._fromType(t),s=this.toSeconds(e);return $s(isFinite(n)&&isFinite(s),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(n),this._events.add({time:s,type:"linearRampToValueAtTime",value:n}),this.log(this.units,"linearRampToValueAtTime",t,s),this._param.linearRampToValueAtTime(n,s),this}exponentialRampToValueAtTime(t,e){let n=this._fromType(t);n=ki(n,0)?this._minOutput:n,this._assertRange(n);const s=this.toSeconds(e);return $s(isFinite(n)&&isFinite(s),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({time:s,type:"exponentialRampToValueAtTime",value:n}),this.log(this.units,"exponentialRampToValueAtTime",t,s),this._param.exponentialRampToValueAtTime(n,s),this}exponentialRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(t,n+this.toSeconds(e)),this}linearRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(t,n+this.toSeconds(e)),this}targetRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(t,n,e),this}exponentialApproachValueAtTime(t,e,n){e=this.toSeconds(e),n=this.toSeconds(n);const s=Math.log(n+1)/Math.log(200);return this.setTargetAtTime(t,e,s),this.cancelAndHoldAtTime(e+.9*n),this.linearRampToValueAtTime(t,e+n),this}setTargetAtTime(t,e,n){const s=this._fromType(t);$s(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(s),$s(isFinite(s)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({constant:n,time:i,type:"setTargetAtTime",value:s}),this.log(this.units,"setTargetAtTime",t,i,n),this._param.setTargetAtTime(s,i,n),this}setValueCurveAtTime(t,e,n,s=1){n=this.toSeconds(n),e=this.toSeconds(e);const i=this._fromType(t[0])*s;this.setValueAtTime(this._toType(i),e);const r=n/(t.length-1);for(let n=1;n<t.length;n++){const i=this._fromType(t[n])*s;this.linearRampToValueAtTime(this._toType(i),e+n*r)}return this}cancelScheduledValues(t){const e=this.toSeconds(t);return $s(isFinite(e),`Invalid argument to cancelScheduledValues: ${JSON.stringify(t)}`),this._events.cancel(e),this._param.cancelScheduledValues(e),this.log(this.units,"cancelScheduledValues",e),this}cancelAndHoldAtTime(t){const e=this.toSeconds(t),n=this._fromType(this.getValueAtTime(e));$s(isFinite(e),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(t)}`),this.log(this.units,"cancelAndHoldAtTime",e,"value="+n);const s=this._events.get(e),i=this._events.getAfter(e);return s&&ki(s.time,e)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(e),this._events.cancel(e+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),"linearRampToValueAtTime"===i.type?this.linearRampToValueAtTime(this._toType(n),e):"exponentialRampToValueAtTime"===i.type&&this.exponentialRampToValueAtTime(this._toType(n),e)),this._events.add({time:e,type:"setValueAtTime",value:n}),this._param.setValueAtTime(n,e),this}rampTo(t,e=.1,n){return"frequency"===this.units||"bpm"===this.units||"decibels"===this.units?this.exponentialRampTo(t,e,n):this.linearRampTo(t,e,n),this}apply(t){const e=this.context.currentTime;t.setValueAtTime(this.getValueAtTime(e),e);const n=this._events.get(e);if(n&&"setTargetAtTime"===n.type){const s=this._events.getAfter(n.time),i=s?s.time:e+2,r=(i-e)/10;for(let n=e;n<i;n+=r)t.linearRampToValueAtTime(this.getValueAtTime(n),n)}return this._events.forEachAfter(this.context.currentTime,(e=>{"cancelScheduledValues"===e.type?t.cancelScheduledValues(e.time):"setTargetAtTime"===e.type?t.setTargetAtTime(e.value,e.time,e.constant):t[e.type](e.value,e.time)})),this}setParam(t){$s(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const e=this.input;return e.disconnect(this._param),this.apply(t),this._param=t,e.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(t,e,n,s,i){return n+(e-n)*Math.exp(-(i-t)/s)}_linearInterpolate(t,e,n,s,i){return e+(i-t)/(n-t)*(s-e)}_exponentialInterpolate(t,e,n,s,i){return e*Math.pow(s/e,(i-t)/(n-t))}}class nr extends Ji{constructor(){super(...arguments),this.name="ToneAudioNode",this._internalChannels=[]}get numberOfInputs(){return Ks(this.input)?li(this.input)||this.input instanceof er?1:this.input.numberOfInputs:0}get numberOfOutputs(){return Ks(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return Ks(t)&&(t instanceof nr||hi(t))}_getInternalNodes(){const t=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&t.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&t.push(this.output),t}_setChannelProperties(t){this._getInternalNodes().forEach((e=>{e.channelCount=t.channelCount,e.channelCountMode=t.channelCountMode,e.channelInterpretation=t.channelInterpretation}))}_getChannelProperties(){const t=this._getInternalNodes();$s(t.length>0,"ToneAudioNode does not have any internal nodes");const e=t[0];return{channelCount:e.channelCount,channelCountMode:e.channelCountMode,channelInterpretation:e.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCount:t}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCountMode:t}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelInterpretation:t}))}connect(t,e=0,n=0){return ir(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return Ys("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return function(t,e,n=0,s=0){if(Ks(e))for(;e instanceof nr;)e=e.input;for(;!hi(t);)Ks(t.output)&&(t=t.output);li(e)?t.disconnect(e,n):hi(e)?t.disconnect(e,n,s):t.disconnect()}(this,t,e,n),this}chain(...t){return sr(this,...t),this}fan(...t){return t.forEach((t=>this.connect(t))),this}dispose(){return super.dispose(),Ks(this.input)&&(this.input instanceof nr?this.input.dispose():hi(this.input)&&this.input.disconnect()),Ks(this.output)&&(this.output instanceof nr?this.output.dispose():hi(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function sr(...t){const e=t.shift();t.reduce(((t,e)=>(t instanceof nr?t.connect(e):hi(t)&&ir(t,e),e)),e)}function ir(t,e,n=0,s=0){for($s(Ks(t),"Cannot connect from undefined node"),$s(Ks(e),"Cannot connect to undefined node"),(e instanceof nr||hi(e))&&$s(e.numberOfInputs>0,"Cannot connect to node with no inputs"),$s(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof nr||e instanceof er;)Ks(e.input)&&(e=e.input);for(;t instanceof nr;)Ks(t.output)&&(t=t.output);li(e)?t.connect(e,n):t.connect(e,n,s)}class rr extends nr{constructor(){super(gi(rr.getDefaults(),arguments,["gain","units"])),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode;const t=gi(rr.getDefaults(),arguments,["gain","units"]);this.gain=new er({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),Ni(this,"gain")}static getDefaults(){return Object.assign(nr.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class or extends nr{constructor(t){super(t),this.onended=Pi,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new rr({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(t){const e=this.toSeconds(t);return-1!==this._startTime&&e>=this._startTime&&(-1===this._stopTime||e<=this._stopTime)?"started":"stopped"},this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut,this._curve=t.curve,this.onended=t.onended}static getDefaults(){return Object.assign(nr.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:Pi})}_startGain(t,e=1){$s(-1===this._startTime,"Source cannot be started more than once");const n=this.toSeconds(this._fadeIn);return this._startTime=t+n,this._startTime=Math.max(this._startTime,this.context.currentTime),n>0?(this._gainNode.gain.setValueAtTime(0,t),"linear"===this._curve?this._gainNode.gain.linearRampToValueAtTime(e,t+n):this._gainNode.gain.exponentialApproachValueAtTime(e,t,n)):this._gainNode.gain.setValueAtTime(e,t),this}stop(t){return this.log("stop",t),this._stopGain(this.toSeconds(t)),this}_stopGain(t){$s(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop();const e=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(t)+e,this._stopTime=Math.max(this._stopTime,this.context.currentTime),e>0?"linear"===this._curve?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout((()=>{const t="exponential"===this._curve?2*e:0;this._stopSource(this.now()+t),this._onended()}),this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==Pi&&(this.onended(this),this.onended=Pi,!this.context.isOffline)){const t=()=>this.dispose();void 0!==window.requestIdleCallback?window.requestIdleCallback(t):setTimeout(t,1e3)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),$s(-1!==this._startTime,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}dispose(){return super.dispose(),this._gainNode.disconnect(),this}}class ar extends or{constructor(){super(gi(ar.getDefaults(),arguments,["offset"])),this.name="ToneConstantSource",this._source=this.context.createConstantSource();const t=gi(ar.getDefaults(),arguments,["offset"]);ir(this._source,this._gainNode),this.offset=new er({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(or.getDefaults(),{convert:!0,offset:1,units:"number"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._source.start(e),this}_stopSource(t){this._source.stop(t)}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}class ur extends nr{constructor(){super(gi(ur.getDefaults(),arguments,["value","units"])),this.name="Signal",this.override=!0;const t=gi(ur.getDefaults(),arguments,["value","units"]);this.output=this._constantSource=new ar({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(nr.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return cr(this,t,e,n),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(t,e){return this._param.setValueAtTime(t,e),this}getValueAtTime(t){return this._param.getValueAtTime(t)}setRampPoint(t){return this._param.setRampPoint(t),this}linearRampToValueAtTime(t,e){return this._param.linearRampToValueAtTime(t,e),this}exponentialRampToValueAtTime(t,e){return this._param.exponentialRampToValueAtTime(t,e),this}exponentialRampTo(t,e,n){return this._param.exponentialRampTo(t,e,n),this}linearRampTo(t,e,n){return this._param.linearRampTo(t,e,n),this}targetRampTo(t,e,n){return this._param.targetRampTo(t,e,n),this}exponentialApproachValueAtTime(t,e,n){return this._param.exponentialApproachValueAtTime(t,e,n),this}setTargetAtTime(t,e,n){return this._param.setTargetAtTime(t,e,n),this}setValueCurveAtTime(t,e,n,s){return this._param.setValueCurveAtTime(t,e,n,s),this}cancelScheduledValues(t){return this._param.cancelScheduledValues(t),this}cancelAndHoldAtTime(t){return this._param.cancelAndHoldAtTime(t),this}rampTo(t,e,n){return this._param.rampTo(t,e,n),this}get value(){return this._param.value}set value(t){this._param.value=t}get convert(){return this._param.convert}set convert(t){this._param.convert=t}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(t){this._param.overridden=t}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(t){return this._param.apply(t),this}}function cr(t,e,n,s){(e instanceof er||li(e)||e instanceof ur&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof ur&&(e.overridden=!0)),ir(t,e,n,s)}class lr extends er{constructor(){super(gi(lr.getDefaults(),arguments,["value"])),this.name="TickParam",this._events=new Ci(1/0),this._multiplier=1;const t=gi(lr.getDefaults(),arguments,["value"]);this._multiplier=t.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(t.value)}),this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(er.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(t,e,n){e=this.toSeconds(e),this.setRampPoint(e);const s=this._fromType(t),i=this._events.get(e),r=Math.round(Math.max(1/n,1));for(let t=0;t<=r;t++){const r=n*t+e,o=this._exponentialApproach(i.time,i.value,s,n,r);this.linearRampToValueAtTime(this._toType(o),r)}return this}setValueAtTime(t,e){const n=this.toSeconds(e);super.setValueAtTime(t,e);const s=this._events.get(n),i=this._events.previousEvent(s),r=this._getTicksUntilEvent(i,n);return s.ticks=Math.max(r,0),this}linearRampToValueAtTime(t,e){const n=this.toSeconds(e);super.linearRampToValueAtTime(t,e);const s=this._events.get(n),i=this._events.previousEvent(s),r=this._getTicksUntilEvent(i,n);return s.ticks=Math.max(r,0),this}exponentialRampToValueAtTime(t,e){e=this.toSeconds(e);const n=this._fromType(t),s=this._events.get(e),i=Math.round(Math.max(10*(e-s.time),1)),r=(e-s.time)/i;for(let t=0;t<=i;t++){const i=r*t+s.time,o=this._exponentialInterpolate(s.time,s.value,e,n,i);this.linearRampToValueAtTime(this._toType(o),i)}return this}_getTicksUntilEvent(t,e){if(null===t)t={ticks:0,time:0,type:"setValueAtTime",value:0};else if(Qs(t.ticks)){const e=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(e,t.time)}const n=this._fromType(this.getValueAtTime(t.time));let s=this._fromType(this.getValueAtTime(e));const i=this._events.get(e);return i&&i.time===e&&"setValueAtTime"===i.type&&(s=this._fromType(this.getValueAtTime(e-this.sampleTime))),.5*(e-t.time)*(n+s)+t.ticks}getTicksAtTime(t){const e=this.toSeconds(t),n=this._events.get(e);return Math.max(this._getTicksUntilEvent(n,e),0)}getDurationOfTicks(t,e){const n=this.toSeconds(e),s=this.getTicksAtTime(e);return this.getTimeOfTick(s+t)-n}getTimeOfTick(t){const e=this._events.get(t,"ticks"),n=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&n&&"linearRampToValueAtTime"===n.type&&e.value!==n.value){const s=this._fromType(this.getValueAtTime(e.time)),i=(this._fromType(this.getValueAtTime(n.time))-s)/(n.time-e.time),r=Math.sqrt(Math.pow(s,2)-2*i*(e.ticks-t)),o=(-s+r)/i;return(o>0?o:(-s-r)/i)+e.time}return e?0===e.value?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue}ticksToTime(t,e){return this.getDurationOfTicks(t,e)}timeToTicks(t,e){const n=this.toSeconds(e),s=this.toSeconds(t),i=this.getTicksAtTime(n);return this.getTicksAtTime(n+s)-i}_fromType(t){return"bpm"===this.units&&this.multiplier?1/(60/t/this.multiplier):super._fromType(t)}_toType(t){return"bpm"===this.units&&this.multiplier?t/this.multiplier*60:super._toType(t)}get multiplier(){return this._multiplier}set multiplier(t){const e=this.value;this._multiplier=t,this.cancelScheduledValues(0),this.setValueAtTime(e,0)}}class hr extends ur{constructor(){super(gi(hr.getDefaults(),arguments,["value"])),this.name="TickSignal";const t=gi(hr.getDefaults(),arguments,["value"]);this.input=this._param=new lr({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(ur.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(t,e){return this._param.ticksToTime(t,e)}timeToTicks(t,e){return this._param.timeToTicks(t,e)}getTimeOfTick(t){return this._param.getTimeOfTick(t)}getDurationOfTicks(t,e){return this._param.getDurationOfTicks(t,e)}getTicksAtTime(t){return this._param.getTicksAtTime(t)}get multiplier(){return this._param.multiplier}set multiplier(t){this._param.multiplier=t}dispose(){return super.dispose(),this._param.dispose(),this}}class pr extends Ji{constructor(){super(gi(pr.getDefaults(),arguments,["frequency"])),this.name="TickSource",this._state=new tr,this._tickOffset=new Ci;const t=gi(pr.getDefaults(),arguments,["frequency"]);this.frequency=new hr({context:this.context,units:t.units,value:t.frequency}),Ni(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Ji.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(t,e){const n=this.toSeconds(t);return"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),Ks(e)&&this.setTicksAtTime(e,n)),this}stop(t){const e=this.toSeconds(t);if("stopped"===this._state.getValueAtTime(e)){const t=this._state.get(e);t&&t.time>0&&(this._tickOffset.cancel(t.time),this._state.cancel(t.time))}return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this.setTicksAtTime(0,e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&this._state.setStateAtTime("paused",e),this}cancel(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this}getTicksAtTime(t){const e=this.toSeconds(t),n=this._state.getLastState("stopped",e),s={state:"paused",time:e};this._state.add(s);let i=n,r=0;return this._state.forEachBetween(n.time,e+this.sampleTime,(t=>{let e=i.time;const n=this._tickOffset.get(t.time);n&&n.time>=i.time&&(r=n.ticks,e=n.time),"started"===i.state&&"started"!==t.state&&(r+=this.frequency.getTicksAtTime(t.time)-this.frequency.getTicksAtTime(e)),i=t})),this._state.remove(s),r}get ticks(){return this.getTicksAtTime(this.now())}set ticks(t){this.setTicksAtTime(t,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(t){const e=this.now(),n=this.frequency.timeToTicks(t,e);this.setTicksAtTime(n,e)}getSecondsAtTime(t){t=this.toSeconds(t);const e=this._state.getLastState("stopped",t),n={state:"paused",time:t};this._state.add(n);let s=e,i=0;return this._state.forEachBetween(e.time,t+this.sampleTime,(t=>{let e=s.time;const n=this._tickOffset.get(t.time);n&&n.time>=s.time&&(i=n.seconds,e=n.time),"started"===s.state&&"started"!==t.state&&(i+=t.time-e),s=t})),this._state.remove(n),i}setTicksAtTime(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(t,e),ticks:t,time:e}),this}getStateAtTime(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)}getTimeOfTick(t,e=this.now()){const n=this._tickOffset.get(e),s=this._state.get(e),i=Math.max(n.time,s.time),r=this.frequency.getTicksAtTime(i)+t-n.ticks;return this.frequency.getTimeOfTick(r)}forEachTickBetween(t,e,n){let s=this._state.get(t);this._state.forEachBetween(t,e,(e=>{s&&"started"===s.state&&"started"!==e.state&&this.forEachTickBetween(Math.max(s.time,t),e.time-this.sampleTime,n),s=e}));let i=null;if(s&&"started"===s.state){const r=Math.max(s.time,t),o=this.frequency.getTicksAtTime(r),a=o-this.frequency.getTicksAtTime(s.time);let u=Math.ceil(a)-a;u=ki(u,1)?0:u;let c=this.frequency.getTimeOfTick(o+u);for(;c<e;){try{n(c,Math.round(this.getTicksAtTime(c)))}catch(t){i=t;break}c+=this.frequency.getDurationOfTicks(1,c)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this.frequency.dispose(),this}}class dr extends Ji{constructor(){super(gi(dr.getDefaults(),arguments,["callback","frequency"])),this.name="Clock",this.callback=Pi,this._lastUpdate=0,this._state=new tr("stopped"),this._boundLoop=this._loop.bind(this);const t=gi(dr.getDefaults(),arguments,["callback","frequency"]);this.callback=t.callback,this._tickSource=new pr({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,Ni(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Ji.getDefaults(),{callback:Pi,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){Xs(this.context);const n=this.toSeconds(t);return this.log("start",n),"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),this._tickSource.start(n,e),n<this._lastUpdate&&this.emit("start",n,e)),this}stop(t){const e=this.toSeconds(t);return this.log("stop",e),this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._tickSource.stop(e),e<this._lastUpdate&&this.emit("stop",e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._tickSource.pause(e),e<this._lastUpdate&&this.emit("pause",e)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(t){this._tickSource.ticks=t}get seconds(){return this._tickSource.seconds}set seconds(t){this._tickSource.seconds=t}getSecondsAtTime(t){return this._tickSource.getSecondsAtTime(t)}setTicksAtTime(t,e){return this._tickSource.setTicksAtTime(t,e),this}getTimeOfTick(t,e=this.now()){return this._tickSource.getTimeOfTick(t,e)}getTicksAtTime(t){return this._tickSource.getTicksAtTime(t)}nextTickTime(t,e){const n=this.toSeconds(e),s=this.getTicksAtTime(n);return this._tickSource.getTimeOfTick(s+t,n)}_loop(){const t=this._lastUpdate,e=this.now();this._lastUpdate=e,this.log("loop",t,e),t!==e&&(this._state.forEachBetween(t,e,(t=>{switch(t.state){case"started":const e=this._tickSource.getTicksAtTime(t.time);this.emit("start",t.time,e);break;case"stopped":0!==t.time&&this.emit("stop",t.time);break;case"paused":this.emit("pause",t.time)}})),this._tickSource.forEachTickBetween(t,e,((t,e)=>{this.callback(t,e)})))}getStateAtTime(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}Di.mixin(dr);let fr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["delayTime","maxDelay"])),this.name="Delay";const e=gi(t.getDefaults(),arguments,["delayTime","maxDelay"]),n=this.toSeconds(e.maxDelay);this._maxDelay=Math.max(n,this.toSeconds(e.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(n),this.delayTime=new er({context:this.context,param:this._delayNode.delayTime,units:"time",value:e.delayTime,minValue:0,maxValue:this.maxDelay}),Ni(this,"delayTime")}static getDefaults(){return Object.assign(nr.getDefaults(),{delayTime:0,maxDelay:1})}get maxDelay(){return this._maxDelay}dispose(){return super.dispose(),this._delayNode.disconnect(),this.delayTime.dispose(),this}};class _r extends wi{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=gi(_r.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=t.baseUrl,Object.keys(t.urls).forEach((e=>{this._loadingCount++;const n=t.urls[e];this.add(e,n,this._bufferLoaded.bind(this,t.onload),t.onerror)}))}static getDefaults(){return{baseUrl:"",onerror:Pi,onload:Pi,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return $s(this.has(t),`ToneAudioBuffers has no buffer named: ${t}`),this._buffers.get(t.toString())}_bufferLoaded(t){this._loadingCount--,0===this._loadingCount&&t&&t()}get loaded(){return Array.from(this._buffers).every((([t,e])=>e.loaded))}add(t,e,n=Pi,s=Pi){return si(e)?this._buffers.set(t.toString(),new Vi(this.baseUrl+e,n,s)):this._buffers.set(t.toString(),new Vi(e,n,s)),this}dispose(){return super.dispose(),this._buffers.forEach((t=>t.dispose())),this._buffers.clear(),this}}class mr extends Ki{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(t){return this._getPPQ()*t}_secondsToUnits(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(t){return t}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class gr extends Ji{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new Ci,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(t,e){return this._events.add({callback:t,time:this.toSeconds(e)}),1===this._events.length&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(t){return this._events.cancel(this.toSeconds(t)),this}_drawLoop(){const t=this.context.currentTime;for(;this._events.length&&this._events.peek().time-this.anticipation<=t;){const e=this._events.shift();e&&t-e.time<=this.expiration&&e.callback()}this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}Oi((t=>{t.draw=new gr({context:t})})),Ei((t=>{t.draw.dispose()}));class vr extends wi{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){$s(Ks(t.time),"Events must have a time property"),$s(Ks(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new yr(t.time,t.time+t.duration,t);for(null===this._root?this._root=e:this._root.insert(e),this._length++;null!==e;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this}remove(t){if(null!==this._root){const e=[];this._root.search(t.time,e);for(const n of e)if(n.event===t){this._removeNode(n),this._length--;break}}return this}get length(){return this._length}cancel(t){return this.forEachFrom(t,(t=>this.remove(t))),this}_setRoot(t){this._root=t,null!==this._root&&(this._root.parent=null)}_replaceNodeInParent(t,e){null!==t.parent?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)}_removeNode(t){if(null===t.left&&null===t.right)this._replaceNodeInParent(t,null);else if(null===t.right)this._replaceNodeInParent(t,t.left);else if(null===t.left)this._replaceNodeInParent(t,t.right);else{let e,n=null;if(t.getBalance()>0)if(null===t.left.right)e=t.left,e.right=t.right,n=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent&&(e.parent.right=e.left,n=e.parent,e.left=t.left,e.right=t.right)}else if(null===t.right.left)e=t.right,e.left=t.left,n=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent&&(e.parent.left=e.right,n=e.parent,e.left=t.left,e.right=t.right)}null!==t.parent?t.isLeftChild()?t.parent.left=e:t.parent.right=e:this._setRoot(e),n&&this._rebalance(n)}t.dispose()}_rotateLeft(t){const e=t.parent,n=t.isLeftChild(),s=t.right;s&&(t.right=s.left,s.left=t),null!==e?n?e.left=s:e.right=s:this._setRoot(s)}_rotateRight(t){const e=t.parent,n=t.isLeftChild(),s=t.left;s&&(t.left=s.right,s.right=t),null!==e?n?e.left=s:e.right=s:this._setRoot(s)}_rebalance(t){const e=t.getBalance();e>1&&t.left?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&t.right&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))}get(t){if(null!==this._root){const e=[];if(this._root.search(t,e),e.length>0){let t=e[0];for(let n=1;n<e.length;n++)e[n].low>t.low&&(t=e[n]);return t.event}}return null}forEach(t){if(null!==this._root){const e=[];this._root.traverse((t=>e.push(t))),e.forEach((e=>{e.event&&t(e.event)}))}return this}forEachAtTime(t,e){if(null!==this._root){const n=[];this._root.search(t,n),n.forEach((t=>{t.event&&e(t.event)}))}return this}forEachFrom(t,e){if(null!==this._root){const n=[];this._root.searchAfter(t,n),n.forEach((t=>{t.event&&e(t.event)}))}return this}dispose(){return super.dispose(),null!==this._root&&this._root.traverse((t=>t.dispose())),this._root=null,this}}class yr{constructor(t,e,n){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=n,this.low=t,this.high=e,this.max=this.high}insert(t){t.low<=this.low?null===this.left?this.left=t:this.left.insert(t):null===this.right?this.right=t:this.right.insert(t)}search(t,e){t>this.max||(null!==this.left&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),this.low>t||null!==this.right&&this.right.search(t,e))}searchAfter(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)}traverse(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)}updateHeight(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let t=0;return null!==this.left&&null!==this.right?t=this.left.height-this.right.height:null!==this.left?t=this.left.height+1:null!==this.right&&(t=-(this.right.height+1)),t}isLeftChild(){return null!==this.parent&&this.parent.left===this}get left(){return this._left}set left(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}let wr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["volume"])),this.name="Volume";const e=gi(t.getDefaults(),arguments,["volume"]);this.input=this.output=new rr({context:this.context,gain:e.volume,units:"decibels"}),this.volume=this.output.gain,Ni(this,"volume"),this._unmutedVolume=e.volume,this.mute=e.mute}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}};class br extends nr{constructor(){super(gi(br.getDefaults(),arguments)),this.name="Destination",this.input=new wr({context:this.context}),this.output=new rr({context:this.context}),this.volume=this.input.volume;const t=gi(br.getDefaults(),arguments);sr(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(nr.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(t){this.input.mute=t}chain(...t){return this.input.disconnect(),t.unshift(this.input),t.push(this.output),sr(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}Oi((t=>{t.destination=new br({context:t})})),Ei((t=>{t.destination.dispose()}));class xr extends wi{constructor(t){super(),this.name="TimelineValue",this._timeline=new Ci({memory:10}),this._initialValue=t}set(t,e){return this._timeline.add({value:t,time:e}),this}get(t){const e=this._timeline.get(t);return e?e.value:this._initialValue}}class Tr{constructor(t,e){this.id=Tr._eventId++;const n=Object.assign(Tr.getDefaults(),e);this.transport=t,this.callback=n.callback,this._once=n.once,this.time=n.time}static getDefaults(){return{callback:Pi,once:!1,time:0}}invoke(t){this.callback&&(this.callback(t),this._once&&this.transport.clear(this.id))}dispose(){return this.callback=void 0,this}}Tr._eventId=0;class Ar extends Tr{constructor(t,e){super(t,e),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const n=Object.assign(Ar.getDefaults(),e);this.duration=new mr(t.context,n.duration).valueOf(),this._interval=new mr(t.context,n.interval).valueOf(),this._nextTick=n.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},Tr.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvents(t){const e=this.transport.getTicksAtTime(t);e>=this.time&&e>=this._nextTick&&this._nextTick+this._interval<this.time+this.duration&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds()))}_restart(t){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.time;const e=this.transport.getTicksAtTime(t);e>this.time&&(this._nextTick=this.time+Math.ceil((e-this.time)/this._interval)*this._interval),this._currentId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds()),this._nextTick+=this._interval,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds())}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this}}class kr extends Ji{constructor(){super(gi(kr.getDefaults(),arguments)),this.name="Transport",this._loop=new xr(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Ci,this._repeatedEvents=new vr,this._syncedSignals=[],this._swingAmount=0;const t=gi(kr.getDefaults(),arguments);this._ppq=t.ppq,this._clock=new dr({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),Ni(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Ji.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(t,e){if(this._loop.get(t)&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._swingAmount>0&&e%this._ppq!=0&&e%(2*this._swingTicks)!=0){const n=e%(2*this._swingTicks)/(2*this._swingTicks),s=Math.sin(n*Math.PI)*this._swingAmount;t+=new mr(this.context,2*this._swingTicks/3).toSeconds()*s}this._timeline.forEachAtTime(e,(e=>e.invoke(t)))}schedule(t,e){const n=new Tr(this,{callback:t,time:new Ki(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,s=1/0){const i=new Ar(this,{callback:t,duration:new Xi(this.context,s).toTicks(),interval:new Xi(this.context,e).toTicks(),time:new Ki(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new Tr(this,{callback:t,once:!0,time:new Ki(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}clear(t){if(this._scheduledEvents.hasOwnProperty(t)){const e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this}_addEvent(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id}cancel(t=0){const e=this.toTicks(t);return this._timeline.forEachFrom(e,(t=>this.clear(t.id))),this._repeatedEvents.forEachFrom(e,(t=>this.clear(t.id))),this}_bindClockEvents(){this._clock.on("start",((t,e)=>{e=new mr(this.context,e).toSeconds(),this.emit("start",t,e)})),this._clock.on("stop",(t=>{this.emit("stop",t)})),this._clock.on("pause",(t=>{this.emit("pause",t)}))}get state(){return this._clock.getStateAtTime(this.now())}start(t,e){let n;return Ks(e)&&(n=this.toTicks(e)),this._clock.start(t,n),this}stop(t){return this._clock.stop(t),this}pause(t){return this._clock.pause(t),this}toggle(t){return t=this.toSeconds(t),"started"!==this._clock.getStateAtTime(t)?this.start(t):this.stop(t),this}get timeSignature(){return this._timeSignature}set timeSignature(t){ni(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Xi(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Xi(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t)}get loop(){return this._loop.get(this.now())}set loop(t){this._loop.set(t,this.now())}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get swing(){return this._swingAmount}set swing(t){this._swingAmount=t}get swingSubdivision(){return new mr(this.context,this._swingTicks).toNotation()}set swingSubdivision(t){this._swingTicks=this.toTicks(t)}get position(){const t=this.now(),e=this._clock.getTicksAtTime(t);return new mr(this.context,e).toBarsBeatsSixteenths()}set position(t){const e=this.toTicks(t);this.ticks=e}get seconds(){return this._clock.seconds}set seconds(t){const e=this.now(),n=this._clock.frequency.timeToTicks(t,e);this.ticks=n}get progress(){if(this.loop){const t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}get ticks(){return this._clock.ticks}set ticks(t){if(this._clock.ticks!==t){const e=this.now();if("started"===this.state){const n=this._clock.getTicksAtTime(e),s=e+this._clock.frequency.getDurationOfTicks(Math.ceil(n)-n,e);this.emit("stop",s),this._clock.setTicksAtTime(t,s),this.emit("start",s,this._clock.getSecondsAtTime(s))}else this._clock.setTicksAtTime(t,e)}}getTicksAtTime(t){return Math.round(this._clock.getTicksAtTime(t))}getSecondsAtTime(t){return this._clock.getSecondsAtTime(t)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(t){this._clock.frequency.multiplier=t}nextSubdivision(t){if(t=this.toTicks(t),"started"!==this.state)return 0;{const e=this.now(),n=t-this.getTicksAtTime(e)%t;return this._clock.nextTickTime(n,e)}}syncSignal(t,e){if(!e){const n=this.now();if(0!==t.getValueAtTime(n)){const s=1/(60/this.bpm.getValueAtTime(n)/this.PPQ);e=t.getValueAtTime(n)/s}else e=0}const n=new rr(e);return this.bpm.connect(n),n.connect(t._param),this._syncedSignals.push({initial:t.value,ratio:n,signal:t}),t.value=0,this}unsyncSignal(t){for(let e=this._syncedSignals.length-1;e>=0;e--){const n=this._syncedSignals[e];n.signal===t&&(n.ratio.dispose(),n.signal.value=n.initial,this._syncedSignals.splice(e,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),Bi(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Di.mixin(kr),Oi((t=>{t.transport=new kr({context:t})})),Ei((t=>{t.transport.dispose()}));class Cr extends nr{constructor(t){super(t),this.input=void 0,this._state=new tr("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=Pi,this._syncedStop=Pi,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new wr({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,Ni(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,onstop:Pi,volume:0})}get state(){return this._synced?"started"===this.context.transport.state?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}_clampToCurrentTime(t){return this._synced?t:Math.max(t,this.context.currentTime)}start(t,e,n){let s=Qs(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(s=this._clampToCurrentTime(s),this._synced||"started"!==this._state.getValueAtTime(s))if(this.log("start",s),this._state.setStateAtTime("started",s),this._synced){const t=this._state.get(s);t&&(t.offset=this.toSeconds(vi(e,0)),t.duration=n?this.toSeconds(n):void 0);const i=this.context.transport.schedule((t=>{this._start(t,e,n)}),s);this._scheduled.push(i),"started"===this.context.transport.state&&this.context.transport.getSecondsAtTime(this.immediate())>s&&this._syncedStart(this.now(),this.context.transport.seconds)}else Xs(this.context),this._start(s,e,n);else $s(xi(s,this._state.get(s).time),"Start time must be strictly greater than previous start time"),this._state.cancel(s),this._state.setStateAtTime("started",s),this.log("restart",s),this.restart(s,e,n);return this}stop(t){let e=Qs(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||Ks(this._state.getNextState("started",e))){if(this.log("stop",e),this._synced){const t=this.context.transport.schedule(this._stop.bind(this),e);this._scheduled.push(t)}else this._stop(e);this._state.cancel(e),this._state.setStateAtTime("stopped",e)}return this}restart(t,e,n){return t=this.toSeconds(t),"started"===this._state.getValueAtTime(t)&&(this._state.cancel(t),this._restart(t,e,n)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(t,e)=>{if(e>0){const n=this._state.get(e);if(n&&"started"===n.state&&n.time!==e){const s=e-this.toSeconds(n.time);let i;n.duration&&(i=this.toSeconds(n.duration)-s),this._start(t,this.toSeconds(n.offset)+s,i)}}},this._syncedStop=t=>{const e=this.context.transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));"started"===this._state.getValueAtTime(e)&&this._stop(t)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach((t=>this.context.transport.clear(t))),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=Pi,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class Sr extends or{constructor(){super(gi(Sr.getDefaults(),arguments,["url","onload"])),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1;const t=gi(Sr.getDefaults(),arguments,["url","onload"]);ir(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new er({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 Vi(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(or.getDefaults(),{url:new Vi,loop:!1,loopEnd:0,loopStart:0,onload:Pi,onerror:Pi,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t}get curve(){return this._curve}set curve(t){this._curve=t}start(t,e,n,s=1){$s(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,s),e=this.loop?vi(e,this.loopStart):vi(e,0);let r=Math.max(this.toSeconds(e),0);if(this.loop){const t=this.toSeconds(this.loopEnd)||this.buffer.duration,e=this.toSeconds(this.loopStart),n=t-e;Ti(r,t)&&(r=(r-e)%n+e),ki(r,this.buffer.duration)&&(r=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Ai(r,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,r)),Ks(n)){let t=this.toSeconds(n);t=Math.max(t,0),this.stop(i+t)}return this}_stopSource(t){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(t)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(t){this._source.loopStart=this.toSeconds(t)}get loopEnd(){return this._source.loopEnd}set loopEnd(t){this._source.loopEnd=this.toSeconds(t)}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._source.loop}set loop(t){this._source.loop=t,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}class Or extends Cr{constructor(){super(gi(Or.getDefaults(),arguments,["type"])),this.name="Noise",this._source=null;const t=gi(Or.getDefaults(),arguments,["type"]);this._playbackRate=t.playbackRate,this.type=t.type,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Cr.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if($s(t in Dr,"Noise: invalid type: "+t),this._type!==t&&(this._type=t,"started"===this.state)){const t=this.now();this._stop(t),this._start(t)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}_start(t){const e=Dr[this._type];this._source=new Sr({url:e,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(t),Math.random()*(e.duration-.001))}_stop(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(t){this._stop(t),this._start(t)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}}const Mr=220500,Er={brown:null,pink:null,white:null},Dr={get brown(){if(!Er.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);t[e]=n;let s=0;for(let t=0;t<Mr;t++){const e=2*Math.random()-1;n[t]=(s+.02*e)/1.02,s=n[t],n[t]*=3.5}}Er.brown=(new Vi).fromArray(t)}return Er.brown},get pink(){if(!Er.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);let s,i,r,o,a,u,c;t[e]=n,s=i=r=o=a=u=c=0;for(let t=0;t<Mr;t++){const e=2*Math.random()-1;s=.99886*s+.0555179*e,i=.99332*i+.0750759*e,r=.969*r+.153852*e,o=.8665*o+.3104856*e,a=.55*a+.5329522*e,u=-.7616*u-.016898*e,n[t]=s+i+r+o+a+u+c+.5362*e,n[t]*=.11,c=.115926*e}}Er.pink=(new Vi).fromArray(t)}return Er.pink},get white(){if(!Er.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);t[e]=n;for(let t=0;t<Mr;t++)n[t]=2*Math.random()-1}Er.white=(new Vi).fromArray(t)}return Er.white}};function Ir(t,e){return ui(this,void 0,void 0,(function*(){const n=e/t.context.sampleRate,s=new qi(1,n,t.context.sampleRate);new t.constructor(Object.assign(t.get(),{frequency:2/n,detune:0,context:s})).toDestination().start(0);return(yield s.render()).getChannelData(0)}))}class Rr extends or{constructor(){super(gi(Rr.getDefaults(),arguments,["frequency","type"])),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator];const t=gi(Rr.getDefaults(),arguments,["frequency","type"]);ir(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new er({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new er({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),Ni(this,["frequency","detune"])}static getDefaults(){return Object.assign(or.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._oscillator.start(e),this}_stopSource(t){this._oscillator.stop(t)}setPeriodicWave(t){return this._oscillator.setPeriodicWave(t),this}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}let Nr=class t extends Cr{constructor(){super(gi(t.getDefaults(),arguments,["frequency","type"])),this.name="Oscillator",this._oscillator=null;const e=gi(t.getDefaults(),arguments,["frequency","type"]);this.frequency=new ur({context:this.context,units:"frequency",value:e.frequency}),Ni(this,"frequency"),this.detune=new ur({context:this.context,units:"cents",value:e.detune}),Ni(this,"detune"),this._partials=e.partials,this._partialCount=e.partialCount,this._type=e.type,e.partialCount&&"custom"!==e.type&&(this._type=this.baseType+e.partialCount.toString()),this.phase=e.phase}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new Rr({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(e)}_stop(t){const e=this.toSeconds(t);this._oscillator&&this._oscillator.stop(e)}_restart(t){const e=this.toSeconds(t);return this.log("restart",e),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(e),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if("custom"===this._type){return t._periodicWaveCache.find((t=>{return t.phase===this._phase&&(e=t.partials,n=this._partials,e.length===n.length&&e.every(((t,e)=>n[e]===t)));var e,n}))}{const e=t._periodicWaveCache.find((t=>t.type===this._type&&t.phase===this._phase));return this._partialCount=e?e.partialCount:this._partialCount,e}}get type(){return this._type}set type(e){this._type=e;const n=-1!==["sine","square","sawtooth","triangle"].indexOf(e);if(0===this._phase&&n)this._wave=void 0,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=e);else{const n=this._getCachedPeriodicWave();if(Ks(n)){const{partials:t,wave:e}=n;this._wave=e,this._partials=t,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}else{const[n,s]=this._getRealImaginary(e,this._phase),i=this.context.createPeriodicWave(n,s);this._wave=i,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave),t._periodicWaveCache.push({imag:s,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:n,type:this._type,wave:this._wave}),t._periodicWaveCache.length>100&&t._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(t){this.partialCount&&"custom"!==this._type&&"custom"!==t?this.type=t+this.partialCount:this.type=t}get partialCount(){return this._partialCount}set partialCount(t){Gs(t,0);let e=this._type;const n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(e=n[1]),"custom"!==this._type)this.type=0===t?e:e+t.toString();else{const e=new Float32Array(t);this._partials.forEach(((t,n)=>e[n]=t)),this._partials=Array.from(e),this.type=this._type}}_getRealImaginary(t,e){let n=2048;const s=new Float32Array(n),i=new Float32Array(n);let r=1;if("custom"===t){if(r=this._partials.length+1,this._partialCount=this._partials.length,n=r,0===this._partials.length)return[s,i]}else{const e=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);e?(r=parseInt(e[2],10)+1,this._partialCount=parseInt(e[2],10),t=e[1],r=Math.max(r,2),n=r):this._partialCount=0,this._partials=[]}for(let o=1;o<n;++o){const n=2/(o*Math.PI);let a;switch(t){case"sine":a=o<=r?1:0,this._partials[o-1]=a;break;case"square":a=1&o?2*n:0,this._partials[o-1]=a;break;case"sawtooth":a=n*(1&o?1:-1),this._partials[o-1]=a;break;case"triangle":a=1&o?n*n*2*(o-1>>1&1?-1:1):0,this._partials[o-1]=a;break;case"custom":a=this._partials[o-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}0!==a?(s[o]=-a*Math.sin(e*o),i[o]=a*Math.cos(e*o)):(s[o]=0,i[o]=0)}return[s,i]}_inverseFFT(t,e,n){let s=0;const i=t.length;for(let r=0;r<i;r++)s+=t[r]*Math.cos(r*n)+e[r]*Math.sin(r*n);return s}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let n=0;const s=2*Math.PI;for(let i=0;i<32;i++)n=Math.max(this._inverseFFT(t,e,i/32*s),n);return i=-this._inverseFFT(t,e,this._phase)/n,r=-1,o=1,Math.max(Math.min(i,o),r);var i,r,o}get partials(){return this._partials.slice(0,this.partialCount)}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(t){this._phase=t*Math.PI/180,this.type=this._type}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}};Nr._periodicWaveCache=[];class Br extends nr{constructor(){super(Object.assign(gi(Br.getDefaults(),arguments,["context"])))}connect(t,e=0,n=0){return cr(this,t,e,n),this}}class Pr extends Br{constructor(){super(Object.assign(gi(Pr.getDefaults(),arguments,["mapping","length"]))),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper;const t=gi(Pr.getDefaults(),arguments,["mapping","length"]);ni(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):"function"==typeof t.mapping&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(ur.getDefaults(),{length:1024})}setMap(t,e=1024){const n=new Float32Array(e);for(let s=0,i=e;s<i;s++){const e=s/(i-1)*2-1;n[s]=t(e,s)}return this.curve=n,this}get curve(){return this._shaper.curve}set curve(t){this._shaper.curve=t}get oversample(){return this._shaper.oversample}set oversample(t){$s(["none","2x","4x"].some((e=>e.includes(t))),"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class Vr extends Br{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new Pr({context:this.context,mapping:t=>(t+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class qr extends ur{constructor(){super(Object.assign(gi(qr.getDefaults(),arguments,["value"]))),this.name="Multiply",this.override=!1;const t=gi(qr.getDefaults(),arguments,["value"]);this._mult=this.input=this.output=new rr({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(ur.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}class Fr extends Cr{constructor(){super(gi(Fr.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="AMOscillator",this._modulationScale=new Vr({context:this.context}),this._modulationNode=new rr({context:this.context});const t=gi(Fr.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Nr({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 Nr({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new qr({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),Ni(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){this._modulator.restart(t),this._carrier.restart(t)}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}class jr extends Cr{constructor(){super(gi(jr.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="FMOscillator",this._modulationNode=new rr({context:this.context,gain:0});const t=gi(jr.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Nr({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 ur({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new Nr({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new qr({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new qr({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),Ni(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){return this._modulator.restart(t),this._carrier.restart(t),this}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}}class zr extends Cr{constructor(){super(gi(zr.getDefaults(),arguments,["frequency","width"])),this.name="PulseOscillator",this._widthGate=new rr({context:this.context,gain:0}),this._thresh=new Pr({context:this.context,mapping:t=>t<=0?-1:1});const t=gi(zr.getDefaults(),arguments,["frequency","width"]);this.width=new ur({context:this.context,units:"audioRange",value:t.width}),this._triangle=new Nr({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),Ni(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(t){t=this.toSeconds(t),this._triangle.start(t),this._widthGate.gain.setValueAtTime(1,t)}_stop(t){t=this.toSeconds(t),this._triangle.stop(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(0,t)}_restart(t){this._triangle.restart(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(1,t)}get phase(){return this._triangle.phase}set phase(t){this._triangle.phase=t}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(t){this._triangle.type=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class Wr extends Cr{constructor(){super(gi(Wr.getDefaults(),arguments,["frequency","type","spread"])),this.name="FatOscillator",this._oscillators=[];const t=gi(Wr.getDefaults(),arguments,["frequency","type","spread"]);this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ur({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,Ni(this,["frequency","detune"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{count:3,spread:20,type:"sawtooth"})}_start(t){t=this.toSeconds(t),this._forEach((e=>e.start(t)))}_stop(t){t=this.toSeconds(t),this._forEach((e=>e.stop(t)))}_restart(t){this._forEach((e=>e.restart(t)))}_forEach(t){for(let e=0;e<this._oscillators.length;e++)t(this._oscillators[e],e)}get type(){return this._type}set type(t){this._type=t,this._forEach((e=>e.type=t))}get spread(){return this._spread}set spread(t){if(this._spread=t,this._oscillators.length>1){const e=-t/2,n=t/(this._oscillators.length-1);this._forEach(((t,s)=>t.detune.value=e+n*s))}}get count(){return this._oscillators.length}set count(t){if(Gs(t,1),this._oscillators.length!==t){this._forEach((t=>t.dispose())),this._oscillators=[];for(let e=0;e<t;e++){const n=new Nr({context:this.context,volume:-6-1.1*t,type:this._type,phase:this._phase+e/t*360,partialCount:this._partialCount,onstop:0===e?()=>this.onstop(this):Pi});"custom"===this.type&&(n.partials=this._partials),this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.detune.overridden=!1,n.connect(this.output),this._oscillators[e]=n}this.spread=this._spread,"started"===this.state&&this._forEach((t=>t.start()))}}get phase(){return this._phase}set phase(t){this._phase=t,this._forEach(((t,e)=>t.phase=this._phase+e/this.count*360))}get baseType(){return this._oscillators[0].baseType}set baseType(t){this._forEach((e=>e.baseType=t)),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this._type="custom",this._forEach((e=>e.partials=t)))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(t){this._partialCount=t,this._forEach((e=>e.partialCount=t)),this._type=this._oscillators[0].type}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach((t=>t.dispose())),this}}class Lr extends Cr{constructor(){super(gi(Lr.getDefaults(),arguments,["frequency","modulationFrequency"])),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new qr({context:this.context,value:2});const t=gi(Lr.getDefaults(),arguments,["frequency","modulationFrequency"]);this._pulse=new zr({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Nr({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),Ni(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)}_stop(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)}_restart(t){this._modulator.restart(t),this._pulse.restart(t)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(t){this._modulator.phase=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const Ur={am:Fr,fat:Wr,fm:jr,oscillator:Nr,pulse:zr,pwm:Lr};class Hr extends Cr{constructor(){super(gi(Hr.getDefaults(),arguments,["frequency","type"])),this.name="OmniOscillator";const t=gi(Hr.getDefaults(),arguments,["frequency","type"]);this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ur({context:this.context,units:"cents",value:t.detune}),Ni(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(Nr.getDefaults(),jr.getDefaults(),Fr.getDefaults(),Wr.getDefaults(),zr.getDefaults(),Lr.getDefaults())}_start(t){this._oscillator.start(t)}_stop(t){this._oscillator.stop(t)}_restart(t){return this._oscillator.restart(t),this}get type(){let t="";return["am","fm","fat"].some((t=>this._sourceType===t))&&(t=this._sourceType),t+this._oscillator.type}set type(t){"fm"===t.substr(0,2)?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"am"===t.substr(0,2)?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"fat"===t.substr(0,3)?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(3)):"pwm"===t?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):"pulse"===t?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=t)}get partials(){return this._oscillator.partials}set partials(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partials=t)}get partialCount(){return this._oscillator.partialCount}set partialCount(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partialCount=t)}set(t){return Reflect.has(t,"type")&&t.type&&(this.type=t.type),super.set(t),this}_createNewOscillator(t){if(t!==this._sourceType){this._sourceType=t;const e=Ur[t],n=this.now();if(this._oscillator){const t=this._oscillator;t.stop(n),this.context.setTimeout((()=>t.dispose()),this.blockTime)}this._oscillator=new e({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),"started"===this.state&&this._oscillator.start(n)}}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t}get sourceType(){return this._sourceType}set sourceType(t){let e="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(e=this._oscillator.type),"fm"===t?this.type="fm"+e:"am"===t?this.type="am"+e:"fat"===t?this.type="fat"+e:"oscillator"===t?this.type=e:"pulse"===t?this.type="pulse":"pwm"===t&&(this.type="pwm")}_getOscType(t,e){return t instanceof Ur[e]}get baseType(){return this._oscillator.baseType}set baseType(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||"pulse"===t||"pwm"===t||(this._oscillator.baseType=t)}get width(){return this._getOscType(this._oscillator,"pulse")?this._oscillator.width:void 0}get count(){return this._getOscType(this._oscillator,"fat")?this._oscillator.count:void 0}set count(t){this._getOscType(this._oscillator,"fat")&&Js(t)&&(this._oscillator.count=t)}get spread(){return this._getOscType(this._oscillator,"fat")?this._oscillator.spread:void 0}set spread(t){this._getOscType(this._oscillator,"fat")&&Js(t)&&(this._oscillator.spread=t)}get modulationType(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.modulationType:void 0}set modulationType(t){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&si(t)&&(this._oscillator.modulationType=t)}get modulationIndex(){return this._getOscType(this._oscillator,"fm")?this._oscillator.modulationIndex:void 0}get harmonicity(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.harmonicity:void 0}get modulationFrequency(){return this._getOscType(this._oscillator,"pwm")?this._oscillator.modulationFrequency:void 0}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class $r extends ur{constructor(){super(Object.assign(gi($r.getDefaults(),arguments,["value"]))),this.override=!1,this.name="Add",this._sum=new rr({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,sr(this._constantSource,this._sum)}static getDefaults(){return Object.assign(ur.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Gr extends Br{constructor(){super(Object.assign(gi(Gr.getDefaults(),arguments,["min","max"]))),this.name="Scale";const t=gi(Gr.getDefaults(),arguments,["min","max"]);this._mult=this.input=new qr({context:this.context,value:t.max-t.min}),this._add=this.output=new $r({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(Br.getDefaults(),{max:1,min:0})}get min(){return this._min}set min(t){this._min=t,this._setRange()}get max(){return this._max}set max(t){this._max=t,this._setRange()}_setRange(){this._add.value=this._min,this._mult.value=this._max-this._min}dispose(){return super.dispose(),this._add.dispose(),this._mult.dispose(),this}}function Xr(t,e=1/0){const n=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(s){Gs(s,t,e),n.set(this,s)}})}}function Zr(t,e=1/0){const n=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(s){Gs(this.toSeconds(s),t,e),n.set(this,s)}})}}class Yr extends Cr{constructor(){super(gi(Yr.getDefaults(),arguments,["url","onload"])),this.name="Player",this._activeSources=new Set;const t=gi(Yr.getDefaults(),arguments,["url","onload"]);this._buffer=new Vi({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(Cr.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:Pi,onerror:Pi,playbackRate:1,reverse:!1})}load(t){return ui(this,void 0,void 0,(function*(){return yield this._buffer.load(t),this._onload(),this}))}_onload(t=Pi){t(),this.autostart&&this.start()}_onSourceEnd(t){this.onstop(this),this._activeSources.delete(t),0!==this._activeSources.size||this._synced||"started"!==this._state.getValueAtTime(this.now())||(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}start(t,e,n){return super.start(t,e,n),this}_start(t,e,n){e=this._loop?vi(e,this._loopStart):vi(e,0);const s=this.toSeconds(e),i=n;n=vi(n,Math.max(this._buffer.duration-s,0));let r=this.toSeconds(n);r/=this._playbackRate,t=this.toSeconds(t);const o=new Sr({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);this._loop||this._synced||(this._state.cancel(t+r),this._state.setStateAtTime("stopped",t+r,{implicitEnd:!0})),this._activeSources.add(o),this._loop&&Qs(i)?o.start(t,s):o.start(t,s,r-this.toSeconds(this.fadeOut))}_stop(t){const e=this.toSeconds(t);this._activeSources.forEach((t=>t.stop(e)))}restart(t,e,n){return super.restart(t,e,n),this}_restart(t,e,n){this._stop(t),this._start(t,e,n)}seek(t,e){const n=this.toSeconds(e);if("started"===this._state.getValueAtTime(n)){const e=this.toSeconds(t);this._stop(n),this._start(n,e)}return this}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get loopStart(){return this._loopStart}set loopStart(t){this._loopStart=t,this.buffer.loaded&&Gs(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach((e=>{e.loopStart=t}))}get loopEnd(){return this._loopEnd}set loopEnd(t){this._loopEnd=t,this.buffer.loaded&&Gs(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach((e=>{e.loopEnd=t}))}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._loop}set loop(t){if(this._loop!==t&&(this._loop=t,this._activeSources.forEach((e=>{e.loop=t})),t)){const t=this._state.getNextState("stopped",this.now());t&&this._state.cancel(t.time)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t;const e=this.now(),n=this._state.getNextState("stopped",e);n&&n.implicitEnd&&(this._state.cancel(n.time),this._activeSources.forEach((t=>t.cancelStop()))),this._activeSources.forEach((n=>{n.playbackRate.setValueAtTime(t,e)}))}get reverse(){return this._buffer.reverse}set reverse(t){this._buffer.reverse=t}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach((t=>t.dispose())),this._activeSources.clear(),this._buffer.dispose(),this}}ai([Zr(0)],Yr.prototype,"fadeIn",void 0),ai([Zr(0)],Yr.prototype,"fadeOut",void 0);class Qr extends Br{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new Pr({context:this.context,mapping:t=>2*Math.abs(t)-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Kr extends Br{constructor(){super(Object.assign(gi(Kr.getDefaults(),arguments,["value"]))),this.name="Pow";const t=gi(Kr.getDefaults(),arguments,["value"]);this._exponentScaler=this.input=this.output=new Pr({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(Br.getDefaults(),{value:1})}_expFunc(t){return e=>Math.pow(Math.abs(e),t)}get value(){return this._exponent}set value(t){this._exponent=t,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}}let Jr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="Envelope",this._sig=new ur({context:this.context,value:0}),this.output=this._sig,this.input=void 0;const e=gi(t.getDefaults(),arguments,["attack","decay","sustain","release"]);this.attack=e.attack,this.decay=e.decay,this.sustain=e.sustain,this.release=e.release,this.attackCurve=e.attackCurve,this.releaseCurve=e.releaseCurve,this.decayCurve=e.decayCurve}static getDefaults(){return Object.assign(nr.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(t,e){if(si(t))return t;{let n;for(n in to)if(to[n][e]===t)return n;return t}}_setCurve(t,e,n){if(si(n)&&Reflect.has(to,n)){const s=to[n];ti(s)?"_decayCurve"!==t&&(this[t]=s[e]):this[t]=s}else{if(!ni(n)||"_decayCurve"===t)throw new Error("Envelope: invalid curve: "+n);this[t]=n}}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(t){this._setCurve("_attackCurve","In",t)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(t){this._setCurve("_releaseCurve","Out",t)}get decayCurve(){return this._decayCurve}set decayCurve(t){$s(["linear","exponential"].some((e=>e===t)),`Invalid envelope curve: ${t}`),this._decayCurve=t}triggerAttack(t,e=1){this.log("triggerAttack",t,e),t=this.toSeconds(t);let n=this.toSeconds(this.attack);const s=this.toSeconds(this.decay),i=this.getValueAtTime(t);if(i>0){n=(1-i)/(1/n)}if(n<this.sampleTime)this._sig.cancelScheduledValues(t),this._sig.setValueAtTime(e,t);else if("linear"===this._attackCurve)this._sig.linearRampTo(e,n,t);else if("exponential"===this._attackCurve)this._sig.targetRampTo(e,n,t);else{this._sig.cancelAndHoldAtTime(t);let s=this._attackCurve;for(let t=1;t<s.length;t++)if(s[t-1]<=i&&i<=s[t]){s=this._attackCurve.slice(t),s[0]=i;break}this._sig.setValueCurveAtTime(s,t,n,e)}if(s&&this.sustain<1){const i=e*this.sustain,r=t+n;this.log("decay",r),"linear"===this._decayCurve?this._sig.linearRampToValueAtTime(i,s+r):this._sig.exponentialApproachValueAtTime(i,r,s)}return this}triggerRelease(t){this.log("triggerRelease",t),t=this.toSeconds(t);const e=this.getValueAtTime(t);if(e>0){const n=this.toSeconds(this.release);n<this.sampleTime?this._sig.setValueAtTime(0,t):"linear"===this._releaseCurve?this._sig.linearRampTo(0,n,t):"exponential"===this._releaseCurve?this._sig.targetRampTo(0,n,t):($s(ni(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(this._releaseCurve,t,n,e))}return this}getValueAtTime(t){return this._sig.getValueAtTime(t)}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),this.triggerAttack(e,n),this.triggerRelease(e+this.toSeconds(t)),this}cancel(t){return this._sig.cancelScheduledValues(this.toSeconds(t)),this}connect(t,e=0,n=0){return cr(this,t,e,n),this}asArray(t=1024){return ui(this,void 0,void 0,(function*(){const e=t/this.context.sampleRate,n=new qi(1,e,this.context.sampleRate),s=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=s+this.toSeconds(this.release),r=.1*i,o=i+r,a=new this.constructor(Object.assign(this.get(),{attack:e*this.toSeconds(this.attack)/o,decay:e*this.toSeconds(this.decay)/o,release:e*this.toSeconds(this.release)/o,context:n}));a._sig.toDestination(),a.triggerAttackRelease(e*(s+r)/o,0);return(yield n.render()).getChannelData(0)}))}dispose(){return super.dispose(),this._sig.dispose(),this}};ai([Zr(0)],Jr.prototype,"attack",void 0),ai([Zr(0)],Jr.prototype,"decay",void 0),ai([Xr(0,1)],Jr.prototype,"sustain",void 0),ai([Zr(0)],Jr.prototype,"release",void 0);const to=(()=>{const t=128;let e,n;const s=[];for(e=0;e<t;e++)s[e]=Math.sin(e/127*(Math.PI/2));const i=[];for(e=0;e<127;e++){n=e/127;const t=Math.sin(n*(2*Math.PI)*6.4-Math.PI/2)+1;i[e]=t/10+.83*n}i[127]=1;const r=[];for(e=0;e<t;e++)r[e]=Math.ceil(e/127*5)/5;const o=[];for(e=0;e<t;e++)n=e/127,o[e]=.5*(1-Math.cos(Math.PI*n));const a=[];for(e=0;e<t;e++){n=e/127;const t=4*Math.pow(n,3)+.2,s=Math.cos(t*Math.PI*2*n);a[e]=Math.abs(s*(1-n))}function u(t){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=1-t[n];return e}return{bounce:{In:u(a),Out:a},cosine:{In:s,Out:(c=s,c.slice(0).reverse())},exponential:"exponential",linear:"linear",ripple:{In:i,Out:u(i)},sine:{In:o,Out:u(o)},step:{In:r,Out:u(r)}};var c})();class eo extends nr{constructor(){super(gi(eo.getDefaults(),arguments)),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease;const t=gi(eo.getDefaults(),arguments);this._volume=this.output=new wr({context:this.context,volume:t.volume}),this.volume=this._volume.volume,Ni(this,"volume")}static getDefaults(){return Object.assign(nr.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0)),this}_syncState(){let t=!1;return this._synced||(this._synced=!0,t=!0),t}_syncMethod(t,e){const n=this["_original_"+t]=this[t];this[t]=(...t)=>{const s=t[e],i=this.context.transport.schedule((s=>{t[e]=s,n.apply(this,t)}),s);this._scheduledEvents.push(i)}}unsync(){return this._scheduledEvents.forEach((t=>this.context.transport.clear(t))),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease),this}triggerAttackRelease(t,e,n,s){const i=this.toSeconds(n),r=this.toSeconds(e);return this.triggerAttack(t,i,s),this.triggerRelease(i+r),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class no extends eo{constructor(){super(gi(no.getDefaults(),arguments));const t=gi(no.getDefaults(),arguments);this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(eo.getDefaults(),{detune:0,onsilence:Pi,portamento:0})}triggerAttack(t,e,n=1){this.log("triggerAttack",t,e,n);const s=this.toSeconds(e);return this._triggerEnvelopeAttack(s,n),this.setNote(t,s),this}triggerRelease(t){this.log("triggerRelease",t);const e=this.toSeconds(t);return this._triggerEnvelopeRelease(e),this}setNote(t,e){const n=this.toSeconds(e),s=t instanceof Zi?t.toFrequency():t;if(this.portamento>0&&this.getLevelAtTime(n)>.05){const t=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(s,t,n)}else this.frequency.setValueAtTime(s,n);return this}}ai([Zr(0)],no.prototype,"portamento",void 0);class so extends Jr{constructor(){super(gi(so.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new rr({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}dispose(){return super.dispose(),this._gainNode.dispose(),this}}class io extends no{constructor(){super(gi(io.getDefaults(),arguments)),this.name="Synth";const t=gi(io.getDefaults(),arguments);this.oscillator=new Hr(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 so(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),Ni(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(no.getDefaults(),{envelope:Object.assign(yi(Jr.getDefaults(),Object.keys(nr.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(yi(Hr.getDefaults(),[...Object.keys(Cr.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(t,e){if(this.envelope.triggerAttack(t,e),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}}class ro extends nr{constructor(){super(gi(ro.getDefaults(),arguments,["frequency","type"])),this.name="BiquadFilter";const t=gi(ro.getDefaults(),arguments,["frequency","type"]);this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new er({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new er({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new er({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new er({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(nr.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){$s(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._filter.type=t}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const s=19980*Math.pow(n/t,2)+20;e[n]=s}const n=new Float32Array(t),s=new Float32Array(t),i=this.context.createBiquadFilter();return i.type=this.type,i.Q.value=this.Q.value,i.frequency.value=this.frequency.value,i.gain.value=this.gain.value,i.getFrequencyResponse(e,n,s),n}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}let oo=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["frequency","type","rolloff"])),this.name="Filter",this.input=new rr({context:this.context}),this.output=new rr({context:this.context}),this._filters=[];const e=gi(t.getDefaults(),arguments,["frequency","type","rolloff"]);this._filters=[],this.Q=new ur({context:this.context,units:"positive",value:e.Q}),this.frequency=new ur({context:this.context,units:"frequency",value:e.frequency}),this.detune=new ur({context:this.context,units:"cents",value:e.detune}),this.gain=new ur({context:this.context,units:"decibels",convert:!1,value:e.gain}),this._type=e.type,this.rolloff=e.rolloff,Ni(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(nr.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){$s(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._type=t,this._filters.forEach((e=>e.type=t))}get rolloff(){return this._rolloff}set rolloff(t){const e=Js(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let s=n.indexOf(e);$s(-1!==s,`rolloff can only be ${n.join(", ")}`),s+=1,this._rolloff=e,this.input.disconnect(),this._filters.forEach((t=>t.disconnect())),this._filters=new Array(s);for(let t=0;t<s;t++){const e=new ro({context:this.context});e.type=this._type,this.frequency.connect(e.frequency),this.detune.connect(e.detune),this.Q.connect(e.Q),this.gain.connect(e.gain),this._filters[t]=e}this._internalChannels=this._filters,sr(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new ro({frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),n=new Float32Array(t).map((()=>1));return this._filters.forEach((()=>{e.getFrequencyResponse(t).forEach(((t,e)=>n[e]*=t))})),e.dispose(),n}dispose(){return super.dispose(),this._filters.forEach((t=>{t.dispose()})),Bi(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}};class ao extends Jr{constructor(){super(gi(ao.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="FrequencyEnvelope";const t=gi(ao.getDefaults(),arguments,["attack","decay","sustain","release"]);this._octaves=t.octaves,this._baseFrequency=this.toFrequency(t.baseFrequency),this._exponent=this.input=new Kr({context:this.context,value:t.exponent}),this._scale=this.output=new Gr({context:this.context,min:this._baseFrequency,max:this._baseFrequency*Math.pow(2,this._octaves)}),this._sig.chain(this._exponent,this._scale)}static getDefaults(){return Object.assign(Jr.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);Gs(e,0),this._baseFrequency=e,this._scale.min=this._baseFrequency,this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._scale.max=this._baseFrequency*Math.pow(2,t)}get exponent(){return this._exponent.value}set exponent(t){this._exponent.value=t}dispose(){return super.dispose(),this._exponent.dispose(),this._scale.dispose(),this}}class uo extends io{constructor(){super(gi(uo.getDefaults(),arguments)),this.name="MembraneSynth",this.portamento=0;const t=gi(uo.getDefaults(),arguments);this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,Ni(this,["oscillator","envelope"])}static getDefaults(){return mi(no.getDefaults(),io.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(t,e){const n=this.toSeconds(e),s=this.toFrequency(t instanceof Zi?t.toFrequency():t),i=s*this.octaves;return this.oscillator.frequency.setValueAtTime(i,n),this.oscillator.frequency.exponentialRampToValueAtTime(s,n+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}ai([Xr(0)],uo.prototype,"octaves",void 0),ai([Zr(0)],uo.prototype,"pitchDecay",void 0);const co=new Set;function lo(t){co.add(t)}function ho(t,e){const n=`registerProcessor("${t}", ${e})`;co.add(n)}class po extends nr{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=Pi;const e=URL.createObjectURL(new Blob([Array.from(co).join("\n")],{type:"text/javascript"})),n=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(e,n).then((()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(n,this.workletOptions),this._worklet.onprocessorerror=this.onprocessorerror.bind(this),this.onReady(this._worklet))}))}dispose(){return super.dispose(),this._dummyGain.disconnect(),this._worklet&&(this._worklet.port.postMessage("dispose"),this._worklet.disconnect()),this}}lo('\n\t/**\n\t * The base AudioWorkletProcessor for use in Tone.js. Works with the [[ToneAudioWorklet]]. \n\t */\n\tclass ToneAudioWorkletProcessor extends AudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\t\n\t\t\tsuper(options);\n\t\t\t/**\n\t\t\t * If the processor was disposed or not. Keep alive until it\'s disposed.\n\t\t\t */\n\t\t\tthis.disposed = false;\n\t\t \t/** \n\t\t\t * The number of samples in the processing block\n\t\t\t */\n\t\t\tthis.blockSize = 128;\n\t\t\t/**\n\t\t\t * the sample rate\n\t\t\t */\n\t\t\tthis.sampleRate = sampleRate;\n\n\t\t\tthis.port.onmessage = (event) => {\n\t\t\t\t// when it receives a dispose \n\t\t\t\tif (event.data === "dispose") {\n\t\t\t\t\tthis.disposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n');lo("\n\t/**\n\t * Abstract class for a single input/output processor. \n\t * has a 'generate' function which processes one sample at a time\n\t */\n\tclass SingleIOProcessor extends ToneAudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(Object.assign(options, {\n\t\t\t\tnumberOfInputs: 1,\n\t\t\t\tnumberOfOutputs: 1\n\t\t\t}));\n\t\t\t/**\n\t\t\t * Holds the name of the parameter and a single value of that\n\t\t\t * parameter at the current sample\n\t\t\t * @type { [name: string]: number }\n\t\t\t */\n\t\t\tthis.params = {}\n\t\t}\n\n\t\t/**\n\t\t * Generate an output sample from the input sample and parameters\n\t\t * @abstract\n\t\t * @param input number\n\t\t * @param channel number\n\t\t * @param parameters { [name: string]: number }\n\t\t * @returns number\n\t\t */\n\t\tgenerate(){}\n\n\t\t/**\n\t\t * Update the private params object with the \n\t\t * values of the parameters at the given index\n\t\t * @param parameters { [name: string]: Float32Array },\n\t\t * @param index number\n\t\t */\n\t\tupdateParams(parameters, index) {\n\t\t\tfor (const paramName in parameters) {\n\t\t\t\tconst param = parameters[paramName];\n\t\t\t\tif (param.length > 1) {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][index];\n\t\t\t\t} else {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process a single frame of the audio\n\t\t * @param inputs Float32Array[][]\n\t\t * @param outputs Float32Array[][]\n\t\t */\n\t\tprocess(inputs, outputs, parameters) {\n\t\t\tconst input = inputs[0];\n\t\t\tconst output = outputs[0];\n\t\t\t// get the parameter values\n\t\t\tconst channelCount = Math.max(input && input.length || 0, output.length);\n\t\t\tfor (let sample = 0; sample < this.blockSize; sample++) {\n\t\t\t\tthis.updateParams(parameters, sample);\n\t\t\t\tfor (let channel = 0; channel < channelCount; channel++) {\n\t\t\t\t\tconst inputSample = input && input.length ? input[channel][sample] : 0;\n\t\t\t\t\toutput[channel][sample] = this.generate(inputSample, channel, this.params);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn !this.disposed;\n\t\t}\n\t};\n");lo("\n\t/**\n\t * A multichannel buffer for use within an AudioWorkletProcessor as a delay line\n\t */\n\tclass DelayLine {\n\t\t\n\t\tconstructor(size, channels) {\n\t\t\tthis.buffer = [];\n\t\t\tthis.writeHead = []\n\t\t\tthis.size = size;\n\n\t\t\t// create the empty channels\n\t\t\tfor (let i = 0; i < channels; i++) {\n\t\t\t\tthis.buffer[i] = new Float32Array(this.size);\n\t\t\t\tthis.writeHead[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Push a value onto the end\n\t\t * @param channel number\n\t\t * @param value number\n\t\t */\n\t\tpush(channel, value) {\n\t\t\tthis.writeHead[channel] += 1;\n\t\t\tif (this.writeHead[channel] > this.size) {\n\t\t\t\tthis.writeHead[channel] = 0;\n\t\t\t}\n\t\t\tthis.buffer[channel][this.writeHead[channel]] = value;\n\t\t}\n\n\t\t/**\n\t\t * Get the recorded value of the channel given the delay\n\t\t * @param channel number\n\t\t * @param delay number delay samples\n\t\t */\n\t\tget(channel, delay) {\n\t\t\tlet readHead = this.writeHead[channel] - Math.floor(delay);\n\t\t\tif (readHead < 0) {\n\t\t\t\treadHead += this.size;\n\t\t\t}\n\t\t\treturn this.buffer[channel][readHead];\n\t\t}\n\t}\n");ho("feedback-comb-filter",'\n\tclass FeedbackCombFilterWorklet extends SingleIOProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(options);\n\t\t\tthis.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);\n\t\t}\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: "delayTime",\n\t\t\t\tdefaultValue: 0.1,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 1,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}, {\n\t\t\t\tname: "feedback",\n\t\t\t\tdefaultValue: 0.5,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 0.9999,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, channel, parameters) {\n\t\t\tconst delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);\n\t\t\tthis.delayLine.push(channel, input + delayedSample * parameters.feedback);\n\t\t\treturn delayedSample;\n\t\t}\n\t}\n');class fo extends eo{constructor(){super(gi(fo.getDefaults(),arguments,["urls","onload","baseUrl"],"urls")),this.name="Sampler",this._activeSources=new Map;const t=gi(fo.getDefaults(),arguments,["urls","onload","baseUrl"],"urls"),e={};Object.keys(t.urls).forEach((n=>{const s=parseInt(n,10);if($s(ii(n)||Js(s)&&isFinite(s),`url key is neither a note or midi pitch: ${n}`),ii(n)){const s=new Zi(this.context,n).toMidi();e[s]=t.urls[n]}else Js(s)&&isFinite(s)&&(e[s]=t.urls[s])})),this._buffers=new _r({urls:e,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.attack=t.attack,this.release=t.release,this.curve=t.curve,this._buffers.loaded&&Promise.resolve().then(t.onload)}static getDefaults(){return Object.assign(eo.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:Pi,onerror:Pi,release:.1,urls:{}})}_findClosest(t){let e=0;for(;e<96;){if(this._buffers.has(t+e))return-e;if(this._buffers.has(t-e))return e;e++}throw new Error(`No available buffers for note: ${t}`)}triggerAttack(t,e,n=1){return this.log("triggerAttack",t,e,n),Array.isArray(t)||(t=[t]),t.forEach((t=>{const s=$i(new Zi(this.context,t).toFrequency()),i=Math.round(s),r=s-i,o=this._findClosest(i),a=i-o,u=this._buffers.get(a),c=Li(o+r),l=new Sr({url:u,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:c}).connect(this.output);l.start(e,0,u.duration/c,n),ni(this._activeSources.get(i))||this._activeSources.set(i,[]),this._activeSources.get(i).push(l),l.onended=()=>{if(this._activeSources&&this._activeSources.has(i)){const t=this._activeSources.get(i),e=t.indexOf(l);-1!==e&&t.splice(e,1)}}})),this}triggerRelease(t,e){return this.log("triggerRelease",t,e),Array.isArray(t)||(t=[t]),t.forEach((t=>{const n=new Zi(this.context,t).toMidi();if(this._activeSources.has(n)&&this._activeSources.get(n).length){const t=this._activeSources.get(n);e=this.toSeconds(e),t.forEach((t=>{t.stop(e)})),this._activeSources.set(n,[])}})),this}releaseAll(t){const e=this.toSeconds(t);return this._activeSources.forEach((t=>{for(;t.length;){t.shift().stop(e)}})),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(t,e,n,s=1){const i=this.toSeconds(n);return this.triggerAttack(t,i,s),ni(e)?($s(ni(t),"notes must be an array when duration is array"),t.forEach(((t,n)=>{const s=e[Math.min(n,e.length-1)];this.triggerRelease(t,i+this.toSeconds(s))}))):this.triggerRelease(t,i+this.toSeconds(e)),this}add(t,e,n){if($s(ii(t)||isFinite(t),`note must be a pitch or midi: ${t}`),ii(t)){const s=new Zi(this.context,t).toMidi();this._buffers.add(s,e,n)}else this._buffers.add(t,e,n);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach((t=>{t.forEach((t=>t.dispose()))})),this._activeSources.clear(),this}}ai([Zr(0)],fo.prototype,"attack",void 0),ai([Zr(0)],fo.prototype,"release",void 0);class _o extends Ji{constructor(){super(gi(_o.getDefaults(),arguments,["callback","value"])),this.name="ToneEvent",this._state=new tr("stopped"),this._startOffset=0;const t=gi(_o.getDefaults(),arguments,["callback","value"]);this._loop=t.loop,this.callback=t.callback,this.value=t.value,this._loopStart=this.toTicks(t.loopStart),this._loopEnd=this.toTicks(t.loopEnd),this._playbackRate=t.playbackRate,this._probability=t.probability,this._humanize=t.humanize,this.mute=t.mute,this._playbackRate=t.playbackRate,this._state.increasing=!0,this._rescheduleEvents()}static getDefaults(){return Object.assign(Ji.getDefaults(),{callback:Pi,humanize:!1,loop:!1,loopEnd:"1m",loopStart:0,mute:!1,playbackRate:1,probability:1,value:null})}_rescheduleEvents(t=-1){this._state.forEachFrom(t,(t=>{let e;if("started"===t.state){-1!==t.id&&this.context.transport.clear(t.id);const n=t.time+Math.round(this.startOffset/this._playbackRate);if(!0===this._loop||Js(this._loop)&&this._loop>1){e=1/0,Js(this._loop)&&(e=this._loop*this._getLoopDuration());const s=this._state.getAfter(n);null!==s&&(e=Math.min(e,s.time-n)),e!==1/0&&(this._state.setStateAtTime("stopped",n+e+1,{id:-1}),e=new mr(this.context,e));const i=new mr(this.context,this._getLoopDuration());t.id=this.context.transport.scheduleRepeat(this._tick.bind(this),i,new mr(this.context,n),e)}else t.id=this.context.transport.schedule(this._tick.bind(this),new mr(this.context,n))}}))}get state(){return this._state.getValueAtTime(this.context.transport.ticks)}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t}get probability(){return this._probability}set probability(t){this._probability=t}get humanize(){return this._humanize}set humanize(t){this._humanize=t}start(t){const e=this.toTicks(t);return"stopped"===this._state.getValueAtTime(e)&&(this._state.add({id:-1,state:"started",time:e}),this._rescheduleEvents(e)),this}stop(t){this.cancel(t);const e=this.toTicks(t);if("started"===this._state.getValueAtTime(e)){this._state.setStateAtTime("stopped",e,{id:-1});const t=this._state.getBefore(e);let n=e;null!==t&&(n=t.time),this._rescheduleEvents(n)}return this}cancel(t){t=vi(t,-1/0);const e=this.toTicks(t);return this._state.forEachFrom(e,(t=>{this.context.transport.clear(t.id)})),this._state.cancel(e),this}_tick(t){const e=this.context.transport.getTicksAtTime(t);if(!this.mute&&"started"===this._state.getValueAtTime(e)){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){let e=.02;ei(this.humanize)||(e=this.toSeconds(this.humanize)),t+=(2*Math.random()-1)*e}this.callback(t,this.value)}}_getLoopDuration(){return Math.round((this._loopEnd-this._loopStart)/this._playbackRate)}get loop(){return this._loop}set loop(t){this._loop=t,this._rescheduleEvents()}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._rescheduleEvents()}get loopEnd(){return new mr(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}get loopStart(){return new mr(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._rescheduleEvents()}get progress(){if(this._loop){const t=this.context.transport.ticks,e=this._state.get(t);if(null!==e&&"started"===e.state){const n=this._getLoopDuration();return(t-e.time)%n/n}return 0}return 0}dispose(){return super.dispose(),this.cancel(),this._state.dispose(),this}}class mo extends _o{constructor(){super(gi(mo.getDefaults(),arguments,["callback","events"])),this.name="Part",this._state=new tr("stopped"),this._events=new Set;const t=gi(mo.getDefaults(),arguments,["callback","events"]);this._state.increasing=!0,t.events.forEach((t=>{ni(t)?this.add(t[0],t[1]):this.add(t)}))}static getDefaults(){return Object.assign(_o.getDefaults(),{events:[]})}start(t,e){const n=this.toTicks(t);if("started"!==this._state.getValueAtTime(n)){e=vi(e,this._loop?this._loopStart:0),e=this._loop?vi(e,this._loopStart):vi(e,0);const t=this.toTicks(e);this._state.add({id:-1,offset:t,state:"started",time:n}),this._forEach((e=>{this._startNote(e,n,t)}))}return this}_startNote(t,e,n){e-=n,this._loop?t.startOffset>=this._loopStart&&t.startOffset<this._loopEnd?(t.startOffset<n&&(e+=this._getLoopDuration()),t.start(new mr(this.context,e))):t.startOffset<this._loopStart&&t.startOffset>=n&&(t.loop=!1,t.start(new mr(this.context,e))):t.startOffset>=n&&t.start(new mr(this.context,e))}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t,this._forEach((t=>{t.startOffset+=this._startOffset}))}stop(t){const e=this.toTicks(t);return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._forEach((e=>{e.stop(t)})),this}at(t,e){const n=new Ki(this.context,t).toTicks(),s=new mr(this.context,1).toSeconds(),i=this._events.values();let r=i.next();for(;!r.done;){const t=r.value;if(Math.abs(n-t.startOffset)<s)return Ks(e)&&(t.value=e),t;r=i.next()}return Ks(e)?(this.add(t,e),this.at(t)):null}add(t,e){t instanceof Object&&Reflect.has(t,"time")&&(t=(e=t).time);const n=this.toTicks(t);let s;return e instanceof _o?(s=e,s.callback=this._tick.bind(this)):s=new _o({callback:this._tick.bind(this),context:this.context,value:e}),s.startOffset=n,s.set({humanize:this.humanize,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,playbackRate:this.playbackRate,probability:this.probability}),this._events.add(s),this._restartEvent(s),this}_restartEvent(t){this._state.forEach((e=>{"started"===e.state?this._startNote(t,e.time,e.offset):t.stop(new mr(this.context,e.time))}))}remove(t,e){return ti(t)&&t.hasOwnProperty("time")&&(t=(e=t).time),t=this.toTicks(t),this._events.forEach((n=>{n.startOffset===t&&(Qs(e)||Ks(e)&&n.value===e)&&(this._events.delete(n),n.dispose())})),this}clear(){return this._forEach((t=>t.dispose())),this._events.clear(),this}cancel(t){return this._forEach((e=>e.cancel(t))),this._state.cancel(this.toTicks(t)),this}_forEach(t){return this._events&&this._events.forEach((e=>{e instanceof mo?e._forEach(t):t(e)})),this}_setAll(t,e){this._forEach((n=>{n[t]=e}))}_tick(t,e){this.mute||this.callback(t,e)}_testLoopBoundries(t){this._loop&&(t.startOffset<this._loopStart||t.startOffset>=this._loopEnd)?t.cancel(0):"stopped"===t.state&&this._restartEvent(t)}get probability(){return this._probability}set probability(t){this._probability=t,this._setAll("probability",t)}get humanize(){return this._humanize}set humanize(t){this._humanize=t,this._setAll("humanize",t)}get loop(){return this._loop}set loop(t){this._loop=t,this._forEach((e=>{e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.loop=t,this._testLoopBoundries(e)}))}get loopEnd(){return new mr(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._forEach((e=>{e.loopEnd=t,this._testLoopBoundries(e)}))}get loopStart(){return new mr(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._forEach((t=>{t.loopStart=this.loopStart,this._testLoopBoundries(t)}))}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._setAll("playbackRate",t)}get length(){return this._events.size}dispose(){return super.dispose(),this.clear(),this}}class go extends nr{constructor(){super(Object.assign(gi(go.getDefaults(),arguments,["fade"]))),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new Qr({context:this.context}),this.a=new rr({context:this.context,gain:0}),this.b=new rr({context:this.context,gain:0}),this.output=new rr({context:this.context}),this._internalChannels=[this.a,this.b];const t=gi(go.getDefaults(),arguments,["fade"]);this.fade=new ur({context:this.context,units:"normalRange",value:t.fade}),Ni(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",ir(this._split,this.a.gain,0),ir(this._split,this.b.gain,1),this.fade.chain(this._g2a,this._panner.pan),this.a.connect(this.output),this.b.connect(this.output)}static getDefaults(){return Object.assign(nr.getDefaults(),{fade:.5})}dispose(){return super.dispose(),this.a.dispose(),this.b.dispose(),this.output.dispose(),this.fade.dispose(),this._g2a.dispose(),this._panner.disconnect(),this._split.disconnect(),this}}let vo=class extends nr{constructor(t){super(t),this.name="Effect",this._dryWet=new go({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new rr({context:this.context}),this.effectReturn=new rr({context:this.context}),this.input=new rr({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(t.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],Ni(this,"wet")}static getDefaults(){return Object.assign(nr.getDefaults(),{wet:1})}connectEffect(t){return this._internalChannels.push(t),this.effectSend.chain(t,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}};class yo extends nr{constructor(){super(Object.assign(gi(yo.getDefaults(),arguments,["pan"]))),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner;const t=gi(yo.getDefaults(),arguments,["pan"]);this.pan=new er({context:this.context,param:this._panner.pan,value:t.pan,minValue:-1,maxValue:1}),this._panner.channelCount=t.channelCount,this._panner.channelCountMode="explicit",Ni(this,"pan")}static getDefaults(){return Object.assign(nr.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}}const wo="bit-crusher";ho(wo,"\n\tclass BitCrusherWorklet extends SingleIOProcessor {\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: \"bits\",\n\t\t\t\tdefaultValue: 12,\n\t\t\t\tminValue: 1,\n\t\t\t\tmaxValue: 16,\n\t\t\t\tautomationRate: 'k-rate'\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, _channel, parameters) {\n\t\t\tconst step = Math.pow(0.5, parameters.bits - 1);\n\t\t\tconst val = step * Math.floor(input / step + 0.5);\n\t\t\treturn val;\n\t\t}\n\t}\n");let bo=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["bits"])),this.name="BitCrusher";const e=gi(t.getDefaults(),arguments,["bits"]);this._bitCrusherWorklet=new xo({context:this.context,bits:e.bits}),this.connectEffect(this._bitCrusherWorklet),this.bits=this._bitCrusherWorklet.bits}static getDefaults(){return Object.assign(vo.getDefaults(),{bits:4})}dispose(){return super.dispose(),this._bitCrusherWorklet.dispose(),this}};class xo extends po{constructor(){super(gi(xo.getDefaults(),arguments)),this.name="BitCrusherWorklet";const t=gi(xo.getDefaults(),arguments);this.input=new rr({context:this.context}),this.output=new rr({context:this.context}),this.bits=new er({context:this.context,value:t.bits,units:"positive",minValue:1,maxValue:16,param:this._dummyParam,swappable:!0})}static getDefaults(){return Object.assign(po.getDefaults(),{bits:12})}_audioWorkletName(){return wo}onReady(t){sr(this.input,t,this.output);const e=t.parameters.get("bits");this.bits.setParam(e)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.bits.dispose(),this}}class To extends nr{constructor(){super(gi(To.getDefaults(),arguments,["channels"])),this.name="Merge";const t=gi(To.getDefaults(),arguments,["channels"]);this._merger=this.output=this.input=this.context.createChannelMerger(t.channels)}static getDefaults(){return Object.assign(nr.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}}let Ao=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["distortion"])),this.name="Distortion";const e=gi(t.getDefaults(),arguments,["distortion"]);this._shaper=new Pr({context:this.context,length:4096}),this._distortion=e.distortion,this.connectEffect(this._shaper),this.distortion=e.distortion,this.oversample=e.oversample}static getDefaults(){return Object.assign(vo.getDefaults(),{distortion:.4,oversample:"none"})}get distortion(){return this._distortion}set distortion(t){this._distortion=t;const e=100*t,n=Math.PI/180;this._shaper.setMap((t=>Math.abs(t)<.001?0:(3+e)*t*20*n/(Math.PI+e*Math.abs(t))))}get oversample(){return this._shaper.oversample}set oversample(t){this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.dispose(),this}};class ko extends vo{constructor(t){super(t),this.name="FeedbackEffect",this._feedbackGain=new rr({context:this.context,gain:t.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,Ni(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(vo.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}}class Co extends ko{constructor(){super(gi(Co.getDefaults(),arguments,["delayTime","feedback"])),this.name="FeedbackDelay";const t=gi(Co.getDefaults(),arguments,["delayTime","feedback"]);this._delayNode=new fr({context:this.context,delayTime:t.delayTime,maxDelay:t.maxDelay}),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),Ni(this,"delayTime")}static getDefaults(){return Object.assign(ko.getDefaults(),{delayTime:.25,maxDelay:1})}dispose(){return super.dispose(),this._delayNode.dispose(),this.delayTime.dispose(),this}}let So=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["decay"])),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve();const e=gi(t.getDefaults(),arguments,["decay"]);this._decay=e.decay,this._preDelay=e.preDelay,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(vo.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(t){Gs(t=this.toSeconds(t),.001),this._decay=t,this.generate()}get preDelay(){return this._preDelay}set preDelay(t){Gs(t=this.toSeconds(t),0),this._preDelay=t,this.generate()}generate(){return ui(this,void 0,void 0,(function*(){const t=this.ready,e=new qi(2,this._decay+this._preDelay,this.context.sampleRate),n=new Or({context:e}),s=new Or({context:e}),i=new To({context:e});n.connect(i,0,0),s.connect(i,0,1);const r=new rr({context:e}).toDestination();i.connect(r),n.start(0),s.start(0),r.gain.setValueAtTime(0,0),r.gain.setValueAtTime(1,this._preDelay),r.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const o=e.render();return this.ready=o.then(Pi),yield t,this._convolver.buffer=(yield o).get(),this}))}dispose(){return super.dispose(),this._convolver.disconnect(),this}};class Oo extends nr{constructor(){super(gi(Oo.getDefaults(),arguments,["solo"])),this.name="Solo";const t=gi(Oo.getDefaults(),arguments,["solo"]);this.input=this.output=new rr({context:this.context}),Oo._allSolos.has(this.context)||Oo._allSolos.set(this.context,new Set),Oo._allSolos.get(this.context).add(this),this.solo=t.solo}static getDefaults(){return Object.assign(nr.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(t){t?this._addSolo():this._removeSolo(),Oo._allSolos.get(this.context).forEach((t=>t._updateSolo()))}get muted(){return 0===this.input.gain.value}_addSolo(){Oo._soloed.has(this.context)||Oo._soloed.set(this.context,new Set),Oo._soloed.get(this.context).add(this)}_removeSolo(){Oo._soloed.has(this.context)&&Oo._soloed.get(this.context).delete(this)}_isSoloed(){return Oo._soloed.has(this.context)&&Oo._soloed.get(this.context).has(this)}_noSolos(){return!Oo._soloed.has(this.context)||Oo._soloed.has(this.context)&&0===Oo._soloed.get(this.context).size}_updateSolo(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),Oo._allSolos.get(this.context).delete(this),this._removeSolo(),this}}Oo._allSolos=new Map,Oo._soloed=new Map;class Mo extends nr{constructor(){super(gi(Mo.getDefaults(),arguments,["pan","volume"])),this.name="PanVol";const t=gi(Mo.getDefaults(),arguments,["pan","volume"]);this._panner=this.input=new yo({context:this.context,pan:t.pan,channelCount:t.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new wr({context:this.context,volume:t.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,Ni(this,["pan","volume"])}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class Eo extends nr{constructor(){super(gi(Eo.getDefaults(),arguments,["volume","pan"])),this.name="Channel";const t=gi(Eo.getDefaults(),arguments,["volume","pan"]);this._solo=this.input=new Oo({solo:t.solo,context:this.context}),this._panVol=this.output=new Mo({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),Ni(this,["pan","volume"])}static getDefaults(){return Object.assign(nr.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(t){this._solo.solo=t}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(t){this._panVol.mute=t}_getBus(t){return Eo.buses.has(t)||Eo.buses.set(t,new rr({context:this.context})),Eo.buses.get(t)}send(t,e=0){const n=this._getBus(t),s=new rr({context:this.context,units:"decibels",gain:e});return this.connect(s),s.connect(n),s}receive(t){return this._getBus(t).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}Eo.buses=new Map;class Do extends nr{constructor(){super(...arguments),this.name="Listener",this.positionX=new er({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new er({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new er({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new er({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new er({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new er({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new er({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new er({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new er({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign(nr.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}}function Io(){return zi().now()}Oi((t=>{t.listener=new Do({context:t})})),Ei((t=>{t.listener.dispose()})),zi().transport,zi().destination,zi().destination,zi().listener,zi().draw,zi();const Ro={C0:16.35,"C#0":17.32,Db0:17.32,D0:18.35,"D#0":19.45,Eb0:19.45,E0:20.6,F0:21.83,"F#0":23.12,Gb0:23.12,G0:24.5,"G#0":25.96,Ab0:25.96,A0:27.5,"A#0":29.14,Bb0:29.14,B0:30.87,C1:32.7,"C#1":34.65,Db1:34.65,D1:36.71,"D#1":38.89,Eb1:38.89,E1:41.2,F1:43.65,"F#1":46.25,Gb1:46.25,G1:49,"G#1":51.91,Ab1:51.91,A1:55,"A#1":58.27,Bb1:58.27,B1:61.74,C2:65.41,"C#2":69.3,Db2:69.3,D2:73.42,"D#2":77.78,Eb2:77.78,E2:82.41,F2:87.31,"F#2":92.5,Gb2:92.5,G2:98,"G#2":103.83,Ab2:103.83,A2:110,"A#2":116.54,Bb2:116.54,B2:123.47,C3:130.81,"C#3":138.59,Db3:138.59,D3:146.83,"D#3":155.56,Eb3:155.56,E3:164.81,F3:174.61,"F#3":185,Gb3:185,G3:196,"G#3":207.65,Ab3:207.65,A3:220,"A#3":233.08,Bb3:233.08,B3:246.94,C4:261.63,"C#4":277.18,Db4:277.18,D4:293.66,"D#4":311.13,Eb4:311.13,E4:329.63,F4:349.23,"F#4":369.99,Gb4:369.99,G4:392,"G#4":415.3,Ab4:415.3,A4:440,"A#4":466.16,Bb4:466.16,B4:493.88,C5:523.25,"C#5":554.37,Db5:554.37,D5:587.33,"D#5":622.25,Eb5:622.25,E5:659.26,F5:698.46,"F#5":739.99,Gb5:739.99,G5:783.99,"G#5":830.61,Ab5:830.61,A5:880,"A#5":932.33,Bb5:932.33,B5:987.77,C6:1046.5,"C#6":1108.73,Db6:1108.73,D6:1174.66,"D#6":1244.51,Eb6:1244.51,E6:1318.51,F6:1396.91,"F#6":1479.98,Gb6:1479.98,G6:1567.98,"G#6":1661.22,Ab6:1661.22,A6:1760,"A#6":1864.66,Bb6:1864.66,B6:1975.53,C7:2093,"C#7":2217.46,Db7:2217.46,D7:2349.32,"D#7":2489.02,Eb7:2489.02,E7:2637.02,F7:2793.83,"F#7":2959.96,Gb7:2959.96,G7:3135.96,"G#7":3322.44,Ab7:3322.44,A7:3520,"A#7":3729.31,Bb7:3729.31,B7:3951.07,C8:4186.01,"C#8":4434.92,Db8:4434.92,D8:4698.64,"D#8":4978.03,Eb8:4978.03},No=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Bo=No.length;class Po{static _notes;name;octave;velocity=1;duration;frequency;constructor(t){"number"==typeof t?this.fromFrequency(t):"string"==typeof t?this.fromString(t):t instanceof MIDIMessageEvent?this.fromEvent(t):this.fromProps(t)}static notes(t=3){return No.map((e=>new Po(`${e}${t}`)))}get isSemi(){return"#"===this.name.slice(-1)}get fullName(){return`${this.name}${this.octave}`}midiData(t=!0){return new Uint8Array([t?144:128,0,100*this.velocity])}get midiNumber(){return 12*(this.octave+2)+this.noteIndex}get noteIndex(){return No.indexOf(this.name)}adjustFrequency(t=0,e=0){if(this.frequency)return this.frequency;let n=this.octave+t;const s=No.indexOf(this.name)+e;let i=s;s>=Bo?(n++,i=s%Bo):s<0&&(n--,i=Bo+i);const r=No[i];return Ro[`${r}${n}`]}valueOf(){return this.fullName}serialize(){return{note:this.fullName,frequency:this.frequency,velocity:this.velocity,duration:this.duration}}fromFrequency(t){this.frequency=t}fromString(t){const e=t.match(/(\w#?)(\d)?/)||[];this.name=e[1],this.octave=e[2]?parseInt(e[2]):1}fromEvent(t){this.name=No[t.data[1]%12],this.octave=Math.floor(t.data[1]/12)-2}fromProps(t){if(Object.assign(this,t),!t.note)throw Error("note props is mandatory");this.fromString(t.note)}}const Vo={128:"noteOff",144:"noteOn",176:"cc"};class qo{note;voiceNo;triggeredAt;_type;data;event;static fromSequence(t,e){return t.notes.map((t=>this.fromNote(t,!0,e)))}static fromNote(t,e=!0,n){const s=t instanceof Po?t:new Po(t),i=new qo(new MIDIMessageEvent("",{data:s.midiData(e)}),n);return i.note=s,i}static fromCC(t,e,n){return new qo(new MIDIMessageEvent("",{data:new Uint8Array([176,t,e])}),n)}constructor(t,e){this.event=t,this.triggeredAt=e||Io(),this.data=t.data,this.defineNotes()}get statusByte(){return this.data[0]}get firstData(){return this.data[1]}get secondData(){return this.data[2]}get type(){if(this._type)return this._type;let t=Vo[240&this.statusByte];return"noteOn"===t&&0===this.secondData&&(t="noteOff"),this._type=t}get isNote(){return"noteOn"===this.type||"noteOff"===this.type}defineNotes(){this.isNote&&(this.note||(this.note=new Po(this.event)))}}class Fo{id;name;state;eventListerCallbacks=[];_midi;constructor(t){this.id=t.id,this.name=t.name||`Device ${t.id}`,this.state=t.state,this._midi=t,this.connect()}connect(){this._midi.onmidimessage=t=>{t instanceof MIDIMessageEvent&&this.processEvent(t)}}disconnect(){this._midi.onmidimessage=null}serialize(){const{id:t,name:e,state:n}=this;return{id:t,name:e,state:n}}addEventListener(t){this.eventListerCallbacks.push(t)}removeEventListener(t){this.eventListerCallbacks=this.eventListerCallbacks.filter((e=>e!==t))}processEvent(t){const e=new qo(t);switch(e.type){case"noteOn":case"noteOff":this.eventListerCallbacks.forEach((t=>t(e)))}}}class jo{devices={};initialized=!1;constructor(){this.initializeDevices().then((()=>{this.listenChanges(),this.initialized=!0})).catch((()=>{}))}find(t){const e=this.devices[t];return e||null}onStateChange(t){navigator.requestMIDIAccess().then((e=>{e.onstatechange=e=>{if(!(e instanceof MIDIConnectionEvent))return;if(e.port instanceof MIDIOutput)return;const n=e.port,s=new Fo(n);t(s)}})).catch((()=>{}))}listenChanges(){this.onStateChange((t=>{"disconnected"===t.state?(t.disconnect(),delete this.devices[t.id]):this.devices[t.id]=t}))}async initializeDevices(){return this.initialized||(await this.inputs()).forEach((t=>{this.devices[t.id]||(this.devices[t.id]=new Fo(t))})),Object.values(this.devices)}async inputs(){const t=[];return(await navigator.requestMIDIAccess()).inputs.forEach((e=>t.push(e))),t}}var zo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Wo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Lo,Uo,Ho={exports:{}};
|
|
7
|
+
*/class wi{constructor(){this.debug=!1,this._wasDisposed=!1}static getDefaults(){return{}}log(...t){(this.debug||ri&&this.toString()===ri.TONE_DEBUG_CLASS)&&function(...t){Zs.log(...t)}(this,...t)}dispose(){return this._wasDisposed=!0,this}get disposed(){return this._wasDisposed}toString(){return this.name}}wi.version=t;const bi=1e-6;function xi(t,e){return t>e+bi}function Ti(t,e){return xi(t,e)||ki(t,e)}function Ai(t,e){return t+bi<e}function ki(t,e){return Math.abs(t-e)<bi}class Ci extends wi{constructor(){super(),this.name="Timeline",this._timeline=[];const t=gi(Ci.getDefaults(),arguments,["memory"]);this.memory=t.memory,this.increasing=t.increasing}static getDefaults(){return{memory:1/0,increasing:!1}}get length(){return this._timeline.length}add(t){if($s(Reflect.has(t,"time"),"Timeline: events must have a time attribute"),t.time=t.time.valueOf(),this.increasing&&this.length){const e=this._timeline[this.length-1];$s(Ti(t.time,e.time),"The time must be greater than or equal to the last scheduled time"),this._timeline.push(t)}else{const e=this._search(t.time);this._timeline.splice(e+1,0,t)}if(this.length>this.memory){const t=this.length-this.memory;this._timeline.splice(0,t)}return this}remove(t){const e=this._timeline.indexOf(t);return-1!==e&&this._timeline.splice(e,1),this}get(t,e="time"){const n=this._search(t,e);return-1!==n?this._timeline[n]:null}peek(){return this._timeline[0]}shift(){return this._timeline.shift()}getAfter(t,e="time"){const n=this._search(t,e);return n+1<this._timeline.length?this._timeline[n+1]:null}getBefore(t){const e=this._timeline.length;if(e>0&&this._timeline[e-1].time<t)return this._timeline[e-1];const n=this._search(t);return n-1>=0?this._timeline[n-1]:null}cancel(t){if(this._timeline.length>1){let e=this._search(t);if(e>=0)if(ki(this._timeline[e].time,t)){for(let n=e;n>=0&&ki(this._timeline[n].time,t);n--)e=n;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&Ti(this._timeline[0].time,t)&&(this._timeline=[]);return this}cancelBefore(t){const e=this._search(t);return e>=0&&(this._timeline=this._timeline.slice(e+1)),this}previousEvent(t){const e=this._timeline.indexOf(t);return e>0?this._timeline[e-1]:null}_search(t,e="time"){if(0===this._timeline.length)return-1;let n=0;const s=this._timeline.length;let i=s;if(s>0&&this._timeline[s-1][e]<=t)return s-1;for(;n<i;){let s=Math.floor(n+(i-n)/2);const r=this._timeline[s],o=this._timeline[s+1];if(ki(r[e],t)){for(let n=s;n<this._timeline.length;n++){if(!ki(this._timeline[n][e],t))break;s=n}return s}if(Ai(r[e],t)&&xi(o[e],t))return s;xi(r[e],t)?i=s:n=s+1}return-1}_iterate(t,e=0,n=this._timeline.length-1){this._timeline.slice(e,n+1).forEach(t)}forEach(t){return this._iterate(t),this}forEachBefore(t,e){const n=this._search(t);return-1!==n&&this._iterate(e,0,n),this}forEachAfter(t,e){const n=this._search(t);return this._iterate(e,n+1),this}forEachBetween(t,e,n){let s=this._search(t),i=this._search(e);return-1!==s&&-1!==i?(this._timeline[s].time!==t&&(s+=1),this._timeline[i].time===e&&(i-=1),this._iterate(n,s,i)):-1===s&&this._iterate(n,0,i),this}forEachFrom(t,e){let n=this._search(t);for(;n>=0&&this._timeline[n].time>=t;)n--;return this._iterate(e,n+1),this}forEachAtTime(t,e){const n=this._search(t);if(-1!==n&&ki(this._timeline[n].time,t)){let s=n;for(let e=n;e>=0&&ki(this._timeline[e].time,t);e--)s=e;this._iterate((t=>{e(t)}),s,n)}return this}dispose(){return super.dispose(),this._timeline=[],this}}const Si=[];function Oi(t){Si.push(t)}const Mi=[];function Ei(t){Mi.push(t)}class Di extends wi{constructor(){super(...arguments),this.name="Emitter"}on(t,e){return t.split(/\W+/).forEach((t=>{Qs(this._events)&&(this._events={}),this._events.hasOwnProperty(t)||(this._events[t]=[]),this._events[t].push(e)})),this}once(t,e){const n=(...s)=>{e(...s),this.off(t,n)};return this.on(t,n),this}off(t,e){return t.split(/\W+/).forEach((n=>{if(Qs(this._events)&&(this._events={}),this._events.hasOwnProperty(t))if(Qs(e))this._events[t]=[];else{const n=this._events[t];for(let t=n.length-1;t>=0;t--)n[t]===e&&n.splice(t,1)}})),this}emit(t,...e){if(this._events&&this._events.hasOwnProperty(t)){const n=this._events[t].slice(0);for(let t=0,s=n.length;t<s;t++)n[t].apply(this,e)}return this}static mixin(t){["on","once","off","emit"].forEach((e=>{const n=Object.getOwnPropertyDescriptor(Di.prototype,e);Object.defineProperty(t.prototype,e,n)}))}dispose(){return super.dispose(),this._events=void 0,this}}class Ii extends Di{constructor(){super(...arguments),this.isOffline=!1}toJSON(){return{}}}class Ri extends Ii{constructor(){super(),this.name="Context",this._constants=new Map,this._timeouts=new Ci,this._timeoutIds=0,this._initialized=!1,this.isOffline=!1,this._workletModules=new Map;const t=gi(Ri.getDefaults(),arguments,["context"]);t.context?this._context=t.context:this._context=function(t){return new ks(t)}({latencyHint:t.latencyHint}),this._ticker=new ci(this.emit.bind(this,"tick"),t.clockSource,t.updateInterval),this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=()=>{this.emit("statechange",this.state)},this._setLatencyHint(t.latencyHint),this.lookAhead=t.lookAhead}static getDefaults(){return{clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.05}}initialize(){var t;return this._initialized||(t=this,Si.forEach((e=>e(t))),this._initialized=!0),this}createAnalyser(){return this._context.createAnalyser()}createOscillator(){return this._context.createOscillator()}createBufferSource(){return this._context.createBufferSource()}createBiquadFilter(){return this._context.createBiquadFilter()}createBuffer(t,e,n){return this._context.createBuffer(t,e,n)}createChannelMerger(t){return this._context.createChannelMerger(t)}createChannelSplitter(t){return this._context.createChannelSplitter(t)}createConstantSource(){return this._context.createConstantSource()}createConvolver(){return this._context.createConvolver()}createDelay(t){return this._context.createDelay(t)}createDynamicsCompressor(){return this._context.createDynamicsCompressor()}createGain(){return this._context.createGain()}createIIRFilter(t,e){return this._context.createIIRFilter(t,e)}createPanner(){return this._context.createPanner()}createPeriodicWave(t,e,n){return this._context.createPeriodicWave(t,e,n)}createStereoPanner(){return this._context.createStereoPanner()}createWaveShaper(){return this._context.createWaveShaper()}createMediaStreamSource(t){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamSource(t)}createMediaElementSource(t){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaElementSource(t)}createMediaStreamDestination(){$s(di(this._context),"Not available if OfflineAudioContext");return this._context.createMediaStreamDestination()}decodeAudioData(t){return this._context.decodeAudioData(t)}get currentTime(){return this._context.currentTime}get state(){return this._context.state}get sampleRate(){return this._context.sampleRate}get listener(){return this.initialize(),this._listener}set listener(t){$s(!this._initialized,"The listener cannot be set after initialization."),this._listener=t}get transport(){return this.initialize(),this._transport}set transport(t){$s(!this._initialized,"The transport cannot be set after initialization."),this._transport=t}get draw(){return this.initialize(),this._draw}set draw(t){$s(!this._initialized,"Draw cannot be set after initialization."),this._draw=t}get destination(){return this.initialize(),this._destination}set destination(t){$s(!this._initialized,"The destination cannot be set after initialization."),this._destination=t}createAudioWorkletNode(t,e){return function(t,e,n){return $s(Ks(qs),"This node only works in a secure context (https or localhost)"),new qs(t,e,n)}(this.rawContext,t,e)}addAudioWorkletModule(t,e){return ui(this,void 0,void 0,(function*(){$s(Ks(this.rawContext.audioWorklet),"AudioWorkletNode is only available in a secure context (https or localhost)"),this._workletModules.has(e)||this._workletModules.set(e,this.rawContext.audioWorklet.addModule(t)),yield this._workletModules.get(e)}))}workletsAreReady(){return ui(this,void 0,void 0,(function*(){const t=[];this._workletModules.forEach((e=>t.push(e))),yield Promise.all(t)}))}get updateInterval(){return this._ticker.updateInterval}set updateInterval(t){this._ticker.updateInterval=t}get clockSource(){return this._ticker.type}set clockSource(t){this._ticker.type=t}get latencyHint(){return this._latencyHint}_setLatencyHint(t){let e=0;if(this._latencyHint=t,si(t))switch(t){case"interactive":e=.1;break;case"playback":e=.5;break;case"balanced":e=.25}this.lookAhead=e,this.updateInterval=e/2}get rawContext(){return this._context}now(){return this._context.currentTime+this.lookAhead}immediate(){return this._context.currentTime}resume(){return di(this._context)?this._context.resume():Promise.resolve()}close(){return ui(this,void 0,void 0,(function*(){var t;di(this._context)&&(yield this._context.close()),this._initialized&&(t=this,Mi.forEach((e=>e(t))))}))}getConstant(t){if(this._constants.has(t))return this._constants.get(t);{const e=this._context.createBuffer(1,128,this._context.sampleRate),n=e.getChannelData(0);for(let e=0;e<n.length;e++)n[e]=t;const s=this._context.createBufferSource();return s.channelCount=1,s.channelCountMode="explicit",s.buffer=e,s.loop=!0,s.start(0),this._constants.set(t,s),s}}dispose(){return super.dispose(),this._ticker.dispose(),this._timeouts.dispose(),Object.keys(this._constants).map((t=>this._constants[t].disconnect())),this}_timeoutLoop(){const t=this.now();let e=this._timeouts.peek();for(;this._timeouts.length&&e&&e.time<=t;)e.callback(),this._timeouts.shift(),e=this._timeouts.peek()}setTimeout(t,e){this._timeoutIds++;const n=this.now();return this._timeouts.add({callback:t,id:this._timeoutIds,time:n+e}),this._timeoutIds}clearTimeout(t){return this._timeouts.forEach((e=>{e.id===t&&this._timeouts.remove(e)})),this}clearInterval(t){return this.clearTimeout(t)}setInterval(t,e){const n=++this._timeoutIds,s=()=>{const i=this.now();this._timeouts.add({callback:()=>{t(),s()},id:n,time:i+e})};return s(),n}}function Ni(t,e){ni(e)?e.forEach((e=>Ni(t,e))):Object.defineProperty(t,e,{enumerable:!0,writable:!1})}function Bi(t,e){ni(e)?e.forEach((e=>Bi(t,e))):Object.defineProperty(t,e,{writable:!0})}const Pi=()=>{};class Vi extends wi{constructor(){super(),this.name="ToneAudioBuffer",this.onload=Pi;const t=gi(Vi.getDefaults(),arguments,["url","onload","onerror"]);this.reverse=t.reverse,this.onload=t.onload,t.url&&fi(t.url)||t.url instanceof Vi?this.set(t.url):si(t.url)&&this.load(t.url).catch(t.onerror)}static getDefaults(){return{onerror:Pi,onload:Pi,reverse:!1}}get sampleRate(){return this._buffer?this._buffer.sampleRate:zi().sampleRate}set(t){return t instanceof Vi?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 ui(this,void 0,void 0,(function*(){const e=Vi.load(t).then((t=>{this.set(t),this.onload(this)}));Vi.downloads.push(e);try{yield e}finally{const t=Vi.downloads.indexOf(e);Vi.downloads.splice(t,1)}return this}))}dispose(){return super.dispose(),this._buffer=void 0,this}fromArray(t){const e=ni(t)&&t[0].length>0,n=e?t.length:1,s=e?t[0].length:t.length,i=zi(),r=i.createBuffer(n,s,i.sampleRate),o=e||1!==n?t:[t];for(let t=0;t<n;t++)r.copyToChannel(o[t],t);return this._buffer=r,this}toMono(t){if(Js(t))this.fromArray(this.toArray(t));else{let t=new Float32Array(this.length);const e=this.numberOfChannels;for(let n=0;n<e;n++){const e=this.toArray(n);for(let n=0;n<e.length;n++)t[n]+=e[n]}t=t.map((t=>t/e)),this.fromArray(t)}return this}toArray(t){if(Js(t))return this.getChannelData(t);if(1===this.numberOfChannels)return this.toArray(0);{const t=[];for(let e=0;e<this.numberOfChannels;e++)t[e]=this.getChannelData(e);return t}}getChannelData(t){return this._buffer?this._buffer.getChannelData(t):new Float32Array(0)}slice(t,e=this.duration){const n=Math.floor(t*this.sampleRate),s=Math.floor(e*this.sampleRate);$s(n<s,"The start time must be less than the end time");const i=s-n,r=zi().createBuffer(this.numberOfChannels,i,this.sampleRate);for(let t=0;t<this.numberOfChannels;t++)r.copyToChannel(this.getChannelData(t).subarray(n,s),t);return new Vi(r)}_reverse(){if(this.loaded)for(let t=0;t<this.numberOfChannels;t++)this.getChannelData(t).reverse();return this}get loaded(){return this.length>0}get duration(){return this._buffer?this._buffer.duration:0}get length(){return this._buffer?this._buffer.length:0}get numberOfChannels(){return this._buffer?this._buffer.numberOfChannels:0}get reverse(){return this._reversed}set reverse(t){this._reversed!==t&&(this._reversed=t,this._reverse())}static fromArray(t){return(new Vi).fromArray(t)}static fromUrl(t){return ui(this,void 0,void 0,(function*(){const e=new Vi;return yield e.load(t)}))}static load(t){return ui(this,void 0,void 0,(function*(){const e=t.match(/\[([^\]\[]+\|.+)\]$/);if(e){const n=e[1].split("|");let s=n[0];for(const t of n)if(Vi.supportsType(t)){s=t;break}t=t.replace(e[0],s)}const n=""===Vi.baseUrl||Vi.baseUrl.endsWith("/")?Vi.baseUrl:Vi.baseUrl+"/",s=yield fetch(n+t);if(!s.ok)throw new Error(`could not load url: ${t}`);const i=yield s.arrayBuffer();return yield zi().decodeAudioData(i)}))}static supportsType(t){const e=t.split("."),n=e[e.length-1];return""!==document.createElement("audio").canPlayType("audio/"+n)}static loaded(){return ui(this,void 0,void 0,(function*(){for(yield Promise.resolve();Vi.downloads.length;)yield Vi.downloads[0]}))}}Vi.baseUrl="",Vi.downloads=[];class qi extends Ri{constructor(){var t,e,n;super({clockSource:"offline",context:pi(arguments[0])?arguments[0]:(t=arguments[0],e=arguments[1]*arguments[2],n=arguments[2],new zs(t,e,n)),lookAhead:0,updateInterval:pi(arguments[0])?128/arguments[0].sampleRate:128/arguments[2]}),this.name="OfflineContext",this._currentTime=0,this.isOffline=!0,this._duration=pi(arguments[0])?arguments[0].length/arguments[0].sampleRate:arguments[1]}now(){return this._currentTime}get currentTime(){return this._currentTime}_renderClock(t){return ui(this,void 0,void 0,(function*(){let e=0;for(;this._duration-this._currentTime>=0;){this.emit("tick"),this._currentTime+=128/this.sampleRate,e++;const n=Math.floor(this.sampleRate/128);t&&e%n==0&&(yield new Promise((t=>setTimeout(t,1))))}}))}render(t=!0){return ui(this,void 0,void 0,(function*(){yield this.workletsAreReady(),yield this._renderClock(t);const e=yield this._context.startRendering();return new Vi(e)}))}close(){return Promise.resolve()}}const Fi=new class extends Ii{constructor(){super(...arguments),this.lookAhead=0,this.latencyHint=0,this.isOffline=!1}createAnalyser(){return{}}createOscillator(){return{}}createBufferSource(){return{}}createBiquadFilter(){return{}}createBuffer(t,e,n){return{}}createChannelMerger(t){return{}}createChannelSplitter(t){return{}}createConstantSource(){return{}}createConvolver(){return{}}createDelay(t){return{}}createDynamicsCompressor(){return{}}createGain(){return{}}createIIRFilter(t,e){return{}}createPanner(){return{}}createPeriodicWave(t,e,n){return{}}createStereoPanner(){return{}}createWaveShaper(){return{}}createMediaStreamSource(t){return{}}createMediaElementSource(t){return{}}createMediaStreamDestination(){return{}}decodeAudioData(t){return Promise.resolve({})}createAudioWorkletNode(t,e){return{}}get rawContext(){return{}}addAudioWorkletModule(t,e){return ui(this,void 0,void 0,(function*(){return Promise.resolve()}))}resume(){return Promise.resolve()}setTimeout(t,e){return 0}clearTimeout(t){return this}setInterval(t,e){return 0}clearInterval(t){return this}getConstant(t){return{}}get currentTime(){return 0}get state(){return{}}get sampleRate(){return 0}get listener(){return{}}get transport(){return{}}get draw(){return{}}set draw(t){}get destination(){return{}}set destination(t){}now(){return 0}immediate(){return 0}};let ji=Fi;function zi(){return ji===Fi&&oi&&Wi(new Ri),ji}function Wi(t){ji=di(t)?new Ri(t):pi(t)?new qi(t):t}if(ri&&!ri.TONE_SILENCE_LOGGING){const e=` * Tone.js ${"v"}${t} * `;console.log(`%c${e}`,"background: #000; color: #fff")}function Li(t){return Math.pow(2,t/12)}let Ui=440;function Hi(t){return Math.round($i(t))}function $i(t){return 69+12*Math.log2(t/Ui)}class Gi extends wi{constructor(t,e,n){super(),this.defaultUnits="s",this._val=e,this._units=n,this.context=t,this._expressions=this._getExpressions()}_getExpressions(){return{hz:{method:t=>this._frequencyToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)hz$/i},i:{method:t=>this._ticksToUnits(parseInt(t,10)),regexp:/^(\d+)i$/i},m:{method:t=>this._beatsToUnits(parseInt(t,10)*this._getTimeSignature()),regexp:/^(\d+)m$/i},n:{method:(t,e)=>{const n=parseInt(t,10),s="."===e?1.5:1;return 1===n?this._beatsToUnits(this._getTimeSignature())*s:this._beatsToUnits(4/n)*s},regexp:/^(\d+)n(\.?)$/i},number:{method:t=>this._expressions[this.defaultUnits].method.call(this,t),regexp:/^(\d+(?:\.\d+)?)$/},s:{method:t=>this._secondsToUnits(parseFloat(t)),regexp:/^(\d+(?:\.\d+)?)s$/},samples:{method:t=>parseInt(t,10)/this.context.sampleRate,regexp:/^(\d+)samples$/},t:{method:t=>{const e=parseInt(t,10);return this._beatsToUnits(8/(3*Math.floor(e)))},regexp:/^(\d+)t$/i},tr:{method:(t,e,n)=>{let s=0;return t&&"0"!==t&&(s+=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(s+=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(s+=this._beatsToUnits(parseFloat(n)/4)),s},regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/}}}valueOf(){if(this._val instanceof Gi&&this.fromType(this._val),Qs(this._val))return this._noArg();if(si(this._val)&&Qs(this._units)){for(const t in this._expressions)if(this._expressions[t].regexp.test(this._val.trim())){this._units=t;break}}else if(ti(this._val)){let t=0;for(const e in this._val)if(Ks(this._val[e])){const n=this._val[e];t+=new this.constructor(this.context,e).valueOf()*n}return t}if(Ks(this._units)){const t=this._expressions[this._units],e=this._val.toString().trim().match(t.regexp);return e?t.method.apply(this,e.slice(1)):t.method.call(this,this._val)}return si(this._val)?parseFloat(this._val):this._val}_frequencyToUnits(t){return 1/t}_beatsToUnits(t){return 60/this._getBpm()*t}_secondsToUnits(t){return t}_ticksToUnits(t){return t*this._beatsToUnits(1)/this._getPPQ()}_noArg(){return this._now()}_getBpm(){return this.context.transport.bpm.value}_getTimeSignature(){return this.context.transport.timeSignature}_getPPQ(){return this.context.transport.PPQ}fromType(t){switch(this._units=void 0,this.defaultUnits){case"s":this._val=t.toSeconds();break;case"i":this._val=t.toTicks();break;case"hz":this._val=t.toFrequency();break;case"midi":this._val=t.toMidi()}return this}toFrequency(){return 1/this.toSeconds()}toSamples(){return this.toSeconds()*this.context.sampleRate}toMilliseconds(){return 1e3*this.toSeconds()}}class Xi extends Gi{constructor(){super(...arguments),this.name="TimeClass"}_getExpressions(){return Object.assign(super._getExpressions(),{now:{method:t=>this._now()+new this.constructor(this.context,t).valueOf(),regexp:/^\+(.+)/},quantize:{method:t=>{const e=new Xi(this.context,t).valueOf();return this._secondsToUnits(this.context.transport.nextSubdivision(e))},regexp:/^@(.+)/}})}quantize(t,e=1){const n=new this.constructor(this.context,t).valueOf(),s=this.valueOf();return s+(Math.round(s/n)*n-s)*e}toNotation(){const t=this.toSeconds(),e=["1m"];for(let t=1;t<9;t++){const n=Math.pow(2,t);e.push(n+"n."),e.push(n+"n"),e.push(n+"t")}e.push("0");let n=e[0],s=new Xi(this.context,e[0]).toSeconds();return e.forEach((e=>{const i=new Xi(this.context,e).toSeconds();Math.abs(i-t)<Math.abs(s-t)&&(n=e,s=i)})),n}toBarsBeatsSixteenths(){const t=this._beatsToUnits(1);let e=this.valueOf()/t;e=parseFloat(e.toFixed(4));const n=Math.floor(e/this._getTimeSignature());let s=e%1*4;e=Math.floor(e)%this._getTimeSignature();const i=s.toString();i.length>3&&(s=parseFloat(parseFloat(i).toFixed(3)));return[n,e,s].join(":")}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.round(e*this._getPPQ())}toSeconds(){return this.valueOf()}toMidi(){return Hi(this.toFrequency())}_now(){return this.context.now()}}class Zi extends Xi{constructor(){super(...arguments),this.name="Frequency",this.defaultUnits="hz"}static get A4(){return Ui}static set A4(t){!function(t){Ui=t}(t)}_getExpressions(){return Object.assign({},super._getExpressions(),{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method(t){return"midi"===this.defaultUnits?t:Zi.mtof(t)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method(t,e){const n=Yi[t.toLowerCase()]+12*(parseInt(e,10)+1);return"midi"===this.defaultUnits?n:Zi.mtof(n)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method(t,e,n){let s=1;return t&&"0"!==t&&(s*=this._beatsToUnits(this._getTimeSignature()*parseFloat(t))),e&&"0"!==e&&(s*=this._beatsToUnits(parseFloat(e))),n&&"0"!==n&&(s*=this._beatsToUnits(parseFloat(n)/4)),s}}})}transpose(t){return new Zi(this.context,this.valueOf()*Li(t))}harmonize(t){return t.map((t=>this.transpose(t)))}toMidi(){return Hi(this.valueOf())}toNote(){const t=this.toFrequency(),e=Math.log2(t/Zi.A4);let n=Math.round(12*e)+57;const s=Math.floor(n/12);s<0&&(n+=-12*s);return Qi[n%12]+s.toString()}toSeconds(){return 1/super.toSeconds()}toTicks(){const t=this._beatsToUnits(1),e=this.valueOf()/t;return Math.floor(e*this._getPPQ())}_noArg(){return 0}_frequencyToUnits(t){return t}_ticksToUnits(t){return 1/(60*t/(this._getBpm()*this._getPPQ()))}_beatsToUnits(t){return 1/super._beatsToUnits(t)}_secondsToUnits(t){return 1/t}static mtof(t){return function(t){return Ui*Math.pow(2,(t-69)/12)}(t)}static ftom(t){return Hi(t)}}const Yi={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},Qi=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];class Ki extends Xi{constructor(){super(...arguments),this.name="TransportTime"}_now(){return this.context.transport.seconds}}class Ji extends wi{constructor(){super();const t=gi(Ji.getDefaults(),arguments,["context"]);this.defaultContext?this.context=this.defaultContext:this.context=t.context}static getDefaults(){return{context:zi()}}now(){return this.context.currentTime+this.context.lookAhead}immediate(){return this.context.currentTime}get sampleTime(){return 1/this.context.sampleRate}get blockTime(){return 128/this.context.sampleRate}toSeconds(t){return new Xi(this.context,t).toSeconds()}toFrequency(t){return new Zi(this.context,t).toFrequency()}toTicks(t){return new Ki(this.context,t).toTicks()}_getPartialProperties(t){const e=this.get();return Object.keys(e).forEach((n=>{Qs(t[n])&&delete e[n]})),e}get(){const t=this.constructor.getDefaults();return Object.keys(t).forEach((e=>{if(Reflect.has(this,e)){const n=this[e];Ks(n)&&Ks(n.value)&&Ks(n.setValueAtTime)?t[e]=n.value:n instanceof Ji?t[e]=n._getPartialProperties(t[e]):ni(n)||Js(n)||si(n)||ei(n)?t[e]=n:delete t[e]}})),t}set(t){return Object.keys(t).forEach((e=>{Reflect.has(this,e)&&Ks(this[e])&&(this[e]&&Ks(this[e].value)&&Ks(this[e].setValueAtTime)?this[e].value!==t[e]&&(this[e].value=t[e]):this[e]instanceof Ji?this[e].set(t[e]):this[e]=t[e])})),this}}class tr extends Ci{constructor(t="stopped"){super(),this.name="StateTimeline",this._initial=t,this.setStateAtTime(this._initial,0)}getValueAtTime(t){const e=this.get(t);return null!==e?e.state:this._initial}setStateAtTime(t,e,n){return Gs(e,0),this.add(Object.assign({},n,{state:t,time:e})),this}getLastState(t,e){for(let n=this._search(e);n>=0;n--){const e=this._timeline[n];if(e.state===t)return e}}getNextState(t,e){const n=this._search(e);if(-1!==n)for(let e=n;e<this._timeline.length;e++){const n=this._timeline[e];if(n.state===t)return n}}}class er extends Ji{constructor(){super(gi(er.getDefaults(),arguments,["param","units","convert"])),this.name="Param",this.overridden=!1,this._minOutput=1e-7;const t=gi(er.getDefaults(),arguments,["param","units","convert"]);for($s(Ks(t.param)&&(li(t.param)||t.param instanceof er),"param must be an AudioParam");!li(t.param);)t.param=t.param._param;this._swappable=!!Ks(t.swappable)&&t.swappable,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 Ci(1e3),this._initialValue=this._param.defaultValue,this.units=t.units,this.convert=t.convert,this._minValue=t.minValue,this._maxValue=t.maxValue,Ks(t.value)&&t.value!==this._toType(this._initialValue)&&this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(Ji.getDefaults(),{convert:!0,units:"number"})}get value(){const t=this.now();return this.getValueAtTime(t)}set value(t){this.cancelScheduledValues(this.now()),this.setValueAtTime(t,this.now())}get minValue(){return Ks(this._minValue)?this._minValue:"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"===this.units?0:"audioRange"===this.units?-1:"decibels"===this.units?-1/0:this._param.minValue}get maxValue(){return Ks(this._maxValue)?this._maxValue:"normalRange"===this.units||"audioRange"===this.units?1:this._param.maxValue}_is(t,e){return this.units===e}_assertRange(t){return Ks(this.maxValue)&&Ks(this.minValue)&&Gs(t,this._fromType(this.minValue),this._fromType(this.maxValue)),t}_fromType(t){return this.convert&&!this.overridden?this._is(t,"time")?this.toSeconds(t):this._is(t,"decibels")?(e=t,Math.pow(10,e/20)):this._is(t,"frequency")?this.toFrequency(t):t:this.overridden?0:t;var e}_toType(t){return this.convert&&"decibels"===this.units?(e=t,Math.log(e)/Math.LN10*20):t;var e}setValueAtTime(t,e){const n=this.toSeconds(e),s=this._fromType(t);return $s(isFinite(s)&&isFinite(n),`Invalid argument(s) to setValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(s),this.log(this.units,"setValueAtTime",t,n),this._events.add({time:n,type:"setValueAtTime",value:s}),this._param.setValueAtTime(s,n),this}getValueAtTime(t){const e=Math.max(this.toSeconds(t),0),n=this._events.getAfter(e),s=this._events.get(e);let i=this._initialValue;if(null===s)i=this._initialValue;else if("setTargetAtTime"!==s.type||null!==n&&"setValueAtTime"!==n.type)if(null===n)i=s.value;else if("linearRampToValueAtTime"===n.type||"exponentialRampToValueAtTime"===n.type){let t=s.value;if("setTargetAtTime"===s.type){const e=this._events.getBefore(s.time);t=null===e?this._initialValue:e.value}i="linearRampToValueAtTime"===n.type?this._linearInterpolate(s.time,t,n.time,n.value,e):this._exponentialInterpolate(s.time,t,n.time,n.value,e)}else i=s.value;else{const t=this._events.getBefore(s.time);let n;n=null===t?this._initialValue:t.value,"setTargetAtTime"===s.type&&(i=this._exponentialApproach(s.time,n,s.value,s.constant,e))}return this._toType(i)}setRampPoint(t){t=this.toSeconds(t);let e=this.getValueAtTime(t);return this.cancelAndHoldAtTime(t),0===this._fromType(e)&&(e=this._toType(this._minOutput)),this.setValueAtTime(e,t),this}linearRampToValueAtTime(t,e){const n=this._fromType(t),s=this.toSeconds(e);return $s(isFinite(n)&&isFinite(s),`Invalid argument(s) to linearRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._assertRange(n),this._events.add({time:s,type:"linearRampToValueAtTime",value:n}),this.log(this.units,"linearRampToValueAtTime",t,s),this._param.linearRampToValueAtTime(n,s),this}exponentialRampToValueAtTime(t,e){let n=this._fromType(t);n=ki(n,0)?this._minOutput:n,this._assertRange(n);const s=this.toSeconds(e);return $s(isFinite(n)&&isFinite(s),`Invalid argument(s) to exponentialRampToValueAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({time:s,type:"exponentialRampToValueAtTime",value:n}),this.log(this.units,"exponentialRampToValueAtTime",t,s),this._param.exponentialRampToValueAtTime(n,s),this}exponentialRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialRampToValueAtTime(t,n+this.toSeconds(e)),this}linearRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.linearRampToValueAtTime(t,n+this.toSeconds(e)),this}targetRampTo(t,e,n){return n=this.toSeconds(n),this.setRampPoint(n),this.exponentialApproachValueAtTime(t,n,e),this}exponentialApproachValueAtTime(t,e,n){e=this.toSeconds(e),n=this.toSeconds(n);const s=Math.log(n+1)/Math.log(200);return this.setTargetAtTime(t,e,s),this.cancelAndHoldAtTime(e+.9*n),this.linearRampToValueAtTime(t,e+n),this}setTargetAtTime(t,e,n){const s=this._fromType(t);$s(isFinite(n)&&n>0,"timeConstant must be a number greater than 0");const i=this.toSeconds(e);return this._assertRange(s),$s(isFinite(s)&&isFinite(i),`Invalid argument(s) to setTargetAtTime: ${JSON.stringify(t)}, ${JSON.stringify(e)}`),this._events.add({constant:n,time:i,type:"setTargetAtTime",value:s}),this.log(this.units,"setTargetAtTime",t,i,n),this._param.setTargetAtTime(s,i,n),this}setValueCurveAtTime(t,e,n,s=1){n=this.toSeconds(n),e=this.toSeconds(e);const i=this._fromType(t[0])*s;this.setValueAtTime(this._toType(i),e);const r=n/(t.length-1);for(let n=1;n<t.length;n++){const i=this._fromType(t[n])*s;this.linearRampToValueAtTime(this._toType(i),e+n*r)}return this}cancelScheduledValues(t){const e=this.toSeconds(t);return $s(isFinite(e),`Invalid argument to cancelScheduledValues: ${JSON.stringify(t)}`),this._events.cancel(e),this._param.cancelScheduledValues(e),this.log(this.units,"cancelScheduledValues",e),this}cancelAndHoldAtTime(t){const e=this.toSeconds(t),n=this._fromType(this.getValueAtTime(e));$s(isFinite(e),`Invalid argument to cancelAndHoldAtTime: ${JSON.stringify(t)}`),this.log(this.units,"cancelAndHoldAtTime",e,"value="+n);const s=this._events.get(e),i=this._events.getAfter(e);return s&&ki(s.time,e)?i?(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time)):(this._param.cancelAndHoldAtTime(e),this._events.cancel(e+this.sampleTime)):i&&(this._param.cancelScheduledValues(i.time),this._events.cancel(i.time),"linearRampToValueAtTime"===i.type?this.linearRampToValueAtTime(this._toType(n),e):"exponentialRampToValueAtTime"===i.type&&this.exponentialRampToValueAtTime(this._toType(n),e)),this._events.add({time:e,type:"setValueAtTime",value:n}),this._param.setValueAtTime(n,e),this}rampTo(t,e=.1,n){return"frequency"===this.units||"bpm"===this.units||"decibels"===this.units?this.exponentialRampTo(t,e,n):this.linearRampTo(t,e,n),this}apply(t){const e=this.context.currentTime;t.setValueAtTime(this.getValueAtTime(e),e);const n=this._events.get(e);if(n&&"setTargetAtTime"===n.type){const s=this._events.getAfter(n.time),i=s?s.time:e+2,r=(i-e)/10;for(let n=e;n<i;n+=r)t.linearRampToValueAtTime(this.getValueAtTime(n),n)}return this._events.forEachAfter(this.context.currentTime,(e=>{"cancelScheduledValues"===e.type?t.cancelScheduledValues(e.time):"setTargetAtTime"===e.type?t.setTargetAtTime(e.value,e.time,e.constant):t[e.type](e.value,e.time)})),this}setParam(t){$s(this._swappable,"The Param must be assigned as 'swappable' in the constructor");const e=this.input;return e.disconnect(this._param),this.apply(t),this._param=t,e.connect(this._param),this}dispose(){return super.dispose(),this._events.dispose(),this}get defaultValue(){return this._toType(this._param.defaultValue)}_exponentialApproach(t,e,n,s,i){return n+(e-n)*Math.exp(-(i-t)/s)}_linearInterpolate(t,e,n,s,i){return e+(i-t)/(n-t)*(s-e)}_exponentialInterpolate(t,e,n,s,i){return e*Math.pow(s/e,(i-t)/(n-t))}}class nr extends Ji{constructor(){super(...arguments),this.name="ToneAudioNode",this._internalChannels=[]}get numberOfInputs(){return Ks(this.input)?li(this.input)||this.input instanceof er?1:this.input.numberOfInputs:0}get numberOfOutputs(){return Ks(this.output)?this.output.numberOfOutputs:0}_isAudioNode(t){return Ks(t)&&(t instanceof nr||hi(t))}_getInternalNodes(){const t=this._internalChannels.slice(0);return this._isAudioNode(this.input)&&t.push(this.input),this._isAudioNode(this.output)&&this.input!==this.output&&t.push(this.output),t}_setChannelProperties(t){this._getInternalNodes().forEach((e=>{e.channelCount=t.channelCount,e.channelCountMode=t.channelCountMode,e.channelInterpretation=t.channelInterpretation}))}_getChannelProperties(){const t=this._getInternalNodes();$s(t.length>0,"ToneAudioNode does not have any internal nodes");const e=t[0];return{channelCount:e.channelCount,channelCountMode:e.channelCountMode,channelInterpretation:e.channelInterpretation}}get channelCount(){return this._getChannelProperties().channelCount}set channelCount(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCount:t}))}get channelCountMode(){return this._getChannelProperties().channelCountMode}set channelCountMode(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelCountMode:t}))}get channelInterpretation(){return this._getChannelProperties().channelInterpretation}set channelInterpretation(t){const e=this._getChannelProperties();this._setChannelProperties(Object.assign(e,{channelInterpretation:t}))}connect(t,e=0,n=0){return ir(this,t,e,n),this}toDestination(){return this.connect(this.context.destination),this}toMaster(){return Ys("toMaster() has been renamed toDestination()"),this.toDestination()}disconnect(t,e=0,n=0){return function(t,e,n=0,s=0){if(Ks(e))for(;e instanceof nr;)e=e.input;for(;!hi(t);)Ks(t.output)&&(t=t.output);li(e)?t.disconnect(e,n):hi(e)?t.disconnect(e,n,s):t.disconnect()}(this,t,e,n),this}chain(...t){return sr(this,...t),this}fan(...t){return t.forEach((t=>this.connect(t))),this}dispose(){return super.dispose(),Ks(this.input)&&(this.input instanceof nr?this.input.dispose():hi(this.input)&&this.input.disconnect()),Ks(this.output)&&(this.output instanceof nr?this.output.dispose():hi(this.output)&&this.output.disconnect()),this._internalChannels=[],this}}function sr(...t){const e=t.shift();t.reduce(((t,e)=>(t instanceof nr?t.connect(e):hi(t)&&ir(t,e),e)),e)}function ir(t,e,n=0,s=0){for($s(Ks(t),"Cannot connect from undefined node"),$s(Ks(e),"Cannot connect to undefined node"),(e instanceof nr||hi(e))&&$s(e.numberOfInputs>0,"Cannot connect to node with no inputs"),$s(t.numberOfOutputs>0,"Cannot connect from node with no outputs");e instanceof nr||e instanceof er;)Ks(e.input)&&(e=e.input);for(;t instanceof nr;)Ks(t.output)&&(t=t.output);li(e)?t.connect(e,n):t.connect(e,n,s)}class rr extends nr{constructor(){super(gi(rr.getDefaults(),arguments,["gain","units"])),this.name="Gain",this._gainNode=this.context.createGain(),this.input=this._gainNode,this.output=this._gainNode;const t=gi(rr.getDefaults(),arguments,["gain","units"]);this.gain=new er({context:this.context,convert:t.convert,param:this._gainNode.gain,units:t.units,value:t.gain,minValue:t.minValue,maxValue:t.maxValue}),Ni(this,"gain")}static getDefaults(){return Object.assign(nr.getDefaults(),{convert:!0,gain:1,units:"gain"})}dispose(){return super.dispose(),this._gainNode.disconnect(),this.gain.dispose(),this}}class or extends nr{constructor(t){super(t),this.onended=Pi,this._startTime=-1,this._stopTime=-1,this._timeout=-1,this.output=new rr({context:this.context,gain:0}),this._gainNode=this.output,this.getStateAtTime=function(t){const e=this.toSeconds(t);return-1!==this._startTime&&e>=this._startTime&&(-1===this._stopTime||e<=this._stopTime)?"started":"stopped"},this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut,this._curve=t.curve,this.onended=t.onended}static getDefaults(){return Object.assign(nr.getDefaults(),{curve:"linear",fadeIn:0,fadeOut:0,onended:Pi})}_startGain(t,e=1){$s(-1===this._startTime,"Source cannot be started more than once");const n=this.toSeconds(this._fadeIn);return this._startTime=t+n,this._startTime=Math.max(this._startTime,this.context.currentTime),n>0?(this._gainNode.gain.setValueAtTime(0,t),"linear"===this._curve?this._gainNode.gain.linearRampToValueAtTime(e,t+n):this._gainNode.gain.exponentialApproachValueAtTime(e,t,n)):this._gainNode.gain.setValueAtTime(e,t),this}stop(t){return this.log("stop",t),this._stopGain(this.toSeconds(t)),this}_stopGain(t){$s(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop();const e=this.toSeconds(this._fadeOut);return this._stopTime=this.toSeconds(t)+e,this._stopTime=Math.max(this._stopTime,this.context.currentTime),e>0?"linear"===this._curve?this._gainNode.gain.linearRampTo(0,e,t):this._gainNode.gain.targetRampTo(0,e,t):(this._gainNode.gain.cancelAndHoldAtTime(t),this._gainNode.gain.setValueAtTime(0,t)),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout((()=>{const t="exponential"===this._curve?2*e:0;this._stopSource(this.now()+t),this._onended()}),this._stopTime-this.context.currentTime),this}_onended(){if(this.onended!==Pi&&(this.onended(this),this.onended=Pi,!this.context.isOffline)){const t=()=>this.dispose();void 0!==window.requestIdleCallback?window.requestIdleCallback(t):setTimeout(t,1e3)}}get state(){return this.getStateAtTime(this.now())}cancelStop(){return this.log("cancelStop"),$s(-1!==this._startTime,"Source is not started"),this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1,this}dispose(){return super.dispose(),this._gainNode.disconnect(),this}}class ar extends or{constructor(){super(gi(ar.getDefaults(),arguments,["offset"])),this.name="ToneConstantSource",this._source=this.context.createConstantSource();const t=gi(ar.getDefaults(),arguments,["offset"]);ir(this._source,this._gainNode),this.offset=new er({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(or.getDefaults(),{convert:!0,offset:1,units:"number"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._source.start(e),this}_stopSource(t){this._source.stop(t)}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._source.disconnect(),this.offset.dispose(),this}}class ur extends nr{constructor(){super(gi(ur.getDefaults(),arguments,["value","units"])),this.name="Signal",this.override=!0;const t=gi(ur.getDefaults(),arguments,["value","units"]);this.output=this._constantSource=new ar({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(nr.getDefaults(),{convert:!0,units:"number",value:0})}connect(t,e=0,n=0){return cr(this,t,e,n),this}dispose(){return super.dispose(),this._param.dispose(),this._constantSource.dispose(),this}setValueAtTime(t,e){return this._param.setValueAtTime(t,e),this}getValueAtTime(t){return this._param.getValueAtTime(t)}setRampPoint(t){return this._param.setRampPoint(t),this}linearRampToValueAtTime(t,e){return this._param.linearRampToValueAtTime(t,e),this}exponentialRampToValueAtTime(t,e){return this._param.exponentialRampToValueAtTime(t,e),this}exponentialRampTo(t,e,n){return this._param.exponentialRampTo(t,e,n),this}linearRampTo(t,e,n){return this._param.linearRampTo(t,e,n),this}targetRampTo(t,e,n){return this._param.targetRampTo(t,e,n),this}exponentialApproachValueAtTime(t,e,n){return this._param.exponentialApproachValueAtTime(t,e,n),this}setTargetAtTime(t,e,n){return this._param.setTargetAtTime(t,e,n),this}setValueCurveAtTime(t,e,n,s){return this._param.setValueCurveAtTime(t,e,n,s),this}cancelScheduledValues(t){return this._param.cancelScheduledValues(t),this}cancelAndHoldAtTime(t){return this._param.cancelAndHoldAtTime(t),this}rampTo(t,e,n){return this._param.rampTo(t,e,n),this}get value(){return this._param.value}set value(t){this._param.value=t}get convert(){return this._param.convert}set convert(t){this._param.convert=t}get units(){return this._param.units}get overridden(){return this._param.overridden}set overridden(t){this._param.overridden=t}get maxValue(){return this._param.maxValue}get minValue(){return this._param.minValue}apply(t){return this._param.apply(t),this}}function cr(t,e,n,s){(e instanceof er||li(e)||e instanceof ur&&e.override)&&(e.cancelScheduledValues(0),e.setValueAtTime(0,0),e instanceof ur&&(e.overridden=!0)),ir(t,e,n,s)}class lr extends er{constructor(){super(gi(lr.getDefaults(),arguments,["value"])),this.name="TickParam",this._events=new Ci(1/0),this._multiplier=1;const t=gi(lr.getDefaults(),arguments,["value"]);this._multiplier=t.multiplier,this._events.cancel(0),this._events.add({ticks:0,time:0,type:"setValueAtTime",value:this._fromType(t.value)}),this.setValueAtTime(t.value,0)}static getDefaults(){return Object.assign(er.getDefaults(),{multiplier:1,units:"hertz",value:1})}setTargetAtTime(t,e,n){e=this.toSeconds(e),this.setRampPoint(e);const s=this._fromType(t),i=this._events.get(e),r=Math.round(Math.max(1/n,1));for(let t=0;t<=r;t++){const r=n*t+e,o=this._exponentialApproach(i.time,i.value,s,n,r);this.linearRampToValueAtTime(this._toType(o),r)}return this}setValueAtTime(t,e){const n=this.toSeconds(e);super.setValueAtTime(t,e);const s=this._events.get(n),i=this._events.previousEvent(s),r=this._getTicksUntilEvent(i,n);return s.ticks=Math.max(r,0),this}linearRampToValueAtTime(t,e){const n=this.toSeconds(e);super.linearRampToValueAtTime(t,e);const s=this._events.get(n),i=this._events.previousEvent(s),r=this._getTicksUntilEvent(i,n);return s.ticks=Math.max(r,0),this}exponentialRampToValueAtTime(t,e){e=this.toSeconds(e);const n=this._fromType(t),s=this._events.get(e),i=Math.round(Math.max(10*(e-s.time),1)),r=(e-s.time)/i;for(let t=0;t<=i;t++){const i=r*t+s.time,o=this._exponentialInterpolate(s.time,s.value,e,n,i);this.linearRampToValueAtTime(this._toType(o),i)}return this}_getTicksUntilEvent(t,e){if(null===t)t={ticks:0,time:0,type:"setValueAtTime",value:0};else if(Qs(t.ticks)){const e=this._events.previousEvent(t);t.ticks=this._getTicksUntilEvent(e,t.time)}const n=this._fromType(this.getValueAtTime(t.time));let s=this._fromType(this.getValueAtTime(e));const i=this._events.get(e);return i&&i.time===e&&"setValueAtTime"===i.type&&(s=this._fromType(this.getValueAtTime(e-this.sampleTime))),.5*(e-t.time)*(n+s)+t.ticks}getTicksAtTime(t){const e=this.toSeconds(t),n=this._events.get(e);return Math.max(this._getTicksUntilEvent(n,e),0)}getDurationOfTicks(t,e){const n=this.toSeconds(e),s=this.getTicksAtTime(e);return this.getTimeOfTick(s+t)-n}getTimeOfTick(t){const e=this._events.get(t,"ticks"),n=this._events.getAfter(t,"ticks");if(e&&e.ticks===t)return e.time;if(e&&n&&"linearRampToValueAtTime"===n.type&&e.value!==n.value){const s=this._fromType(this.getValueAtTime(e.time)),i=(this._fromType(this.getValueAtTime(n.time))-s)/(n.time-e.time),r=Math.sqrt(Math.pow(s,2)-2*i*(e.ticks-t)),o=(-s+r)/i;return(o>0?o:(-s-r)/i)+e.time}return e?0===e.value?1/0:e.time+(t-e.ticks)/e.value:t/this._initialValue}ticksToTime(t,e){return this.getDurationOfTicks(t,e)}timeToTicks(t,e){const n=this.toSeconds(e),s=this.toSeconds(t),i=this.getTicksAtTime(n);return this.getTicksAtTime(n+s)-i}_fromType(t){return"bpm"===this.units&&this.multiplier?1/(60/t/this.multiplier):super._fromType(t)}_toType(t){return"bpm"===this.units&&this.multiplier?t/this.multiplier*60:super._toType(t)}get multiplier(){return this._multiplier}set multiplier(t){const e=this.value;this._multiplier=t,this.cancelScheduledValues(0),this.setValueAtTime(e,0)}}class hr extends ur{constructor(){super(gi(hr.getDefaults(),arguments,["value"])),this.name="TickSignal";const t=gi(hr.getDefaults(),arguments,["value"]);this.input=this._param=new lr({context:this.context,convert:t.convert,multiplier:t.multiplier,param:this._constantSource.offset,units:t.units,value:t.value})}static getDefaults(){return Object.assign(ur.getDefaults(),{multiplier:1,units:"hertz",value:1})}ticksToTime(t,e){return this._param.ticksToTime(t,e)}timeToTicks(t,e){return this._param.timeToTicks(t,e)}getTimeOfTick(t){return this._param.getTimeOfTick(t)}getDurationOfTicks(t,e){return this._param.getDurationOfTicks(t,e)}getTicksAtTime(t){return this._param.getTicksAtTime(t)}get multiplier(){return this._param.multiplier}set multiplier(t){this._param.multiplier=t}dispose(){return super.dispose(),this._param.dispose(),this}}class pr extends Ji{constructor(){super(gi(pr.getDefaults(),arguments,["frequency"])),this.name="TickSource",this._state=new tr,this._tickOffset=new Ci;const t=gi(pr.getDefaults(),arguments,["frequency"]);this.frequency=new hr({context:this.context,units:t.units,value:t.frequency}),Ni(this,"frequency"),this._state.setStateAtTime("stopped",0),this.setTicksAtTime(0,0)}static getDefaults(){return Object.assign({frequency:1,units:"hertz"},Ji.getDefaults())}get state(){return this.getStateAtTime(this.now())}start(t,e){const n=this.toSeconds(t);return"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),Ks(e)&&this.setTicksAtTime(e,n)),this}stop(t){const e=this.toSeconds(t);if("stopped"===this._state.getValueAtTime(e)){const t=this._state.get(e);t&&t.time>0&&(this._tickOffset.cancel(t.time),this._state.cancel(t.time))}return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this.setTicksAtTime(0,e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&this._state.setStateAtTime("paused",e),this}cancel(t){return t=this.toSeconds(t),this._state.cancel(t),this._tickOffset.cancel(t),this}getTicksAtTime(t){const e=this.toSeconds(t),n=this._state.getLastState("stopped",e),s={state:"paused",time:e};this._state.add(s);let i=n,r=0;return this._state.forEachBetween(n.time,e+this.sampleTime,(t=>{let e=i.time;const n=this._tickOffset.get(t.time);n&&n.time>=i.time&&(r=n.ticks,e=n.time),"started"===i.state&&"started"!==t.state&&(r+=this.frequency.getTicksAtTime(t.time)-this.frequency.getTicksAtTime(e)),i=t})),this._state.remove(s),r}get ticks(){return this.getTicksAtTime(this.now())}set ticks(t){this.setTicksAtTime(t,this.now())}get seconds(){return this.getSecondsAtTime(this.now())}set seconds(t){const e=this.now(),n=this.frequency.timeToTicks(t,e);this.setTicksAtTime(n,e)}getSecondsAtTime(t){t=this.toSeconds(t);const e=this._state.getLastState("stopped",t),n={state:"paused",time:t};this._state.add(n);let s=e,i=0;return this._state.forEachBetween(e.time,t+this.sampleTime,(t=>{let e=s.time;const n=this._tickOffset.get(t.time);n&&n.time>=s.time&&(i=n.seconds,e=n.time),"started"===s.state&&"started"!==t.state&&(i+=t.time-e),s=t})),this._state.remove(n),i}setTicksAtTime(t,e){return e=this.toSeconds(e),this._tickOffset.cancel(e),this._tickOffset.add({seconds:this.frequency.getDurationOfTicks(t,e),ticks:t,time:e}),this}getStateAtTime(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)}getTimeOfTick(t,e=this.now()){const n=this._tickOffset.get(e),s=this._state.get(e),i=Math.max(n.time,s.time),r=this.frequency.getTicksAtTime(i)+t-n.ticks;return this.frequency.getTimeOfTick(r)}forEachTickBetween(t,e,n){let s=this._state.get(t);this._state.forEachBetween(t,e,(e=>{s&&"started"===s.state&&"started"!==e.state&&this.forEachTickBetween(Math.max(s.time,t),e.time-this.sampleTime,n),s=e}));let i=null;if(s&&"started"===s.state){const r=Math.max(s.time,t),o=this.frequency.getTicksAtTime(r),a=o-this.frequency.getTicksAtTime(s.time);let u=Math.ceil(a)-a;u=ki(u,1)?0:u;let c=this.frequency.getTimeOfTick(o+u);for(;c<e;){try{n(c,Math.round(this.getTicksAtTime(c)))}catch(t){i=t;break}c+=this.frequency.getDurationOfTicks(1,c)}}if(i)throw i;return this}dispose(){return super.dispose(),this._state.dispose(),this._tickOffset.dispose(),this.frequency.dispose(),this}}class dr extends Ji{constructor(){super(gi(dr.getDefaults(),arguments,["callback","frequency"])),this.name="Clock",this.callback=Pi,this._lastUpdate=0,this._state=new tr("stopped"),this._boundLoop=this._loop.bind(this);const t=gi(dr.getDefaults(),arguments,["callback","frequency"]);this.callback=t.callback,this._tickSource=new pr({context:this.context,frequency:t.frequency,units:t.units}),this._lastUpdate=0,this.frequency=this._tickSource.frequency,Ni(this,"frequency"),this._state.setStateAtTime("stopped",0),this.context.on("tick",this._boundLoop)}static getDefaults(){return Object.assign(Ji.getDefaults(),{callback:Pi,frequency:1,units:"hertz"})}get state(){return this._state.getValueAtTime(this.now())}start(t,e){Xs(this.context);const n=this.toSeconds(t);return this.log("start",n),"started"!==this._state.getValueAtTime(n)&&(this._state.setStateAtTime("started",n),this._tickSource.start(n,e),n<this._lastUpdate&&this.emit("start",n,e)),this}stop(t){const e=this.toSeconds(t);return this.log("stop",e),this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._tickSource.stop(e),e<this._lastUpdate&&this.emit("stop",e),this}pause(t){const e=this.toSeconds(t);return"started"===this._state.getValueAtTime(e)&&(this._state.setStateAtTime("paused",e),this._tickSource.pause(e),e<this._lastUpdate&&this.emit("pause",e)),this}get ticks(){return Math.ceil(this.getTicksAtTime(this.now()))}set ticks(t){this._tickSource.ticks=t}get seconds(){return this._tickSource.seconds}set seconds(t){this._tickSource.seconds=t}getSecondsAtTime(t){return this._tickSource.getSecondsAtTime(t)}setTicksAtTime(t,e){return this._tickSource.setTicksAtTime(t,e),this}getTimeOfTick(t,e=this.now()){return this._tickSource.getTimeOfTick(t,e)}getTicksAtTime(t){return this._tickSource.getTicksAtTime(t)}nextTickTime(t,e){const n=this.toSeconds(e),s=this.getTicksAtTime(n);return this._tickSource.getTimeOfTick(s+t,n)}_loop(){const t=this._lastUpdate,e=this.now();this._lastUpdate=e,this.log("loop",t,e),t!==e&&(this._state.forEachBetween(t,e,(t=>{switch(t.state){case"started":const e=this._tickSource.getTicksAtTime(t.time);this.emit("start",t.time,e);break;case"stopped":0!==t.time&&this.emit("stop",t.time);break;case"paused":this.emit("pause",t.time)}})),this._tickSource.forEachTickBetween(t,e,((t,e)=>{this.callback(t,e)})))}getStateAtTime(t){const e=this.toSeconds(t);return this._state.getValueAtTime(e)}dispose(){return super.dispose(),this.context.off("tick",this._boundLoop),this._tickSource.dispose(),this._state.dispose(),this}}Di.mixin(dr);let fr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["delayTime","maxDelay"])),this.name="Delay";const e=gi(t.getDefaults(),arguments,["delayTime","maxDelay"]),n=this.toSeconds(e.maxDelay);this._maxDelay=Math.max(n,this.toSeconds(e.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(n),this.delayTime=new er({context:this.context,param:this._delayNode.delayTime,units:"time",value:e.delayTime,minValue:0,maxValue:this.maxDelay}),Ni(this,"delayTime")}static getDefaults(){return Object.assign(nr.getDefaults(),{delayTime:0,maxDelay:1})}get maxDelay(){return this._maxDelay}dispose(){return super.dispose(),this._delayNode.disconnect(),this.delayTime.dispose(),this}};class _r extends wi{constructor(){super(),this.name="ToneAudioBuffers",this._buffers=new Map,this._loadingCount=0;const t=gi(_r.getDefaults(),arguments,["urls","onload","baseUrl"],"urls");this.baseUrl=t.baseUrl,Object.keys(t.urls).forEach((e=>{this._loadingCount++;const n=t.urls[e];this.add(e,n,this._bufferLoaded.bind(this,t.onload),t.onerror)}))}static getDefaults(){return{baseUrl:"",onerror:Pi,onload:Pi,urls:{}}}has(t){return this._buffers.has(t.toString())}get(t){return $s(this.has(t),`ToneAudioBuffers has no buffer named: ${t}`),this._buffers.get(t.toString())}_bufferLoaded(t){this._loadingCount--,0===this._loadingCount&&t&&t()}get loaded(){return Array.from(this._buffers).every((([t,e])=>e.loaded))}add(t,e,n=Pi,s=Pi){return si(e)?this._buffers.set(t.toString(),new Vi(this.baseUrl+e,n,s)):this._buffers.set(t.toString(),new Vi(e,n,s)),this}dispose(){return super.dispose(),this._buffers.forEach((t=>t.dispose())),this._buffers.clear(),this}}class mr extends Ki{constructor(){super(...arguments),this.name="Ticks",this.defaultUnits="i"}_now(){return this.context.transport.ticks}_beatsToUnits(t){return this._getPPQ()*t}_secondsToUnits(t){return Math.floor(t/(60/this._getBpm())*this._getPPQ())}_ticksToUnits(t){return t}toTicks(){return this.valueOf()}toSeconds(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())}}class gr extends Ji{constructor(){super(...arguments),this.name="Draw",this.expiration=.25,this.anticipation=.008,this._events=new Ci,this._boundDrawLoop=this._drawLoop.bind(this),this._animationFrame=-1}schedule(t,e){return this._events.add({callback:t,time:this.toSeconds(e)}),1===this._events.length&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop)),this}cancel(t){return this._events.cancel(this.toSeconds(t)),this}_drawLoop(){const t=this.context.currentTime;for(;this._events.length&&this._events.peek().time-this.anticipation<=t;){const e=this._events.shift();e&&t-e.time<=this.expiration&&e.callback()}this._events.length>0&&(this._animationFrame=requestAnimationFrame(this._boundDrawLoop))}dispose(){return super.dispose(),this._events.dispose(),cancelAnimationFrame(this._animationFrame),this}}Oi((t=>{t.draw=new gr({context:t})})),Ei((t=>{t.draw.dispose()}));class vr extends wi{constructor(){super(...arguments),this.name="IntervalTimeline",this._root=null,this._length=0}add(t){$s(Ks(t.time),"Events must have a time property"),$s(Ks(t.duration),"Events must have a duration parameter"),t.time=t.time.valueOf();let e=new yr(t.time,t.time+t.duration,t);for(null===this._root?this._root=e:this._root.insert(e),this._length++;null!==e;)e.updateHeight(),e.updateMax(),this._rebalance(e),e=e.parent;return this}remove(t){if(null!==this._root){const e=[];this._root.search(t.time,e);for(const n of e)if(n.event===t){this._removeNode(n),this._length--;break}}return this}get length(){return this._length}cancel(t){return this.forEachFrom(t,(t=>this.remove(t))),this}_setRoot(t){this._root=t,null!==this._root&&(this._root.parent=null)}_replaceNodeInParent(t,e){null!==t.parent?(t.isLeftChild()?t.parent.left=e:t.parent.right=e,this._rebalance(t.parent)):this._setRoot(e)}_removeNode(t){if(null===t.left&&null===t.right)this._replaceNodeInParent(t,null);else if(null===t.right)this._replaceNodeInParent(t,t.left);else if(null===t.left)this._replaceNodeInParent(t,t.right);else{let e,n=null;if(t.getBalance()>0)if(null===t.left.right)e=t.left,e.right=t.right,n=e;else{for(e=t.left.right;null!==e.right;)e=e.right;e.parent&&(e.parent.right=e.left,n=e.parent,e.left=t.left,e.right=t.right)}else if(null===t.right.left)e=t.right,e.left=t.left,n=e;else{for(e=t.right.left;null!==e.left;)e=e.left;e.parent&&(e.parent.left=e.right,n=e.parent,e.left=t.left,e.right=t.right)}null!==t.parent?t.isLeftChild()?t.parent.left=e:t.parent.right=e:this._setRoot(e),n&&this._rebalance(n)}t.dispose()}_rotateLeft(t){const e=t.parent,n=t.isLeftChild(),s=t.right;s&&(t.right=s.left,s.left=t),null!==e?n?e.left=s:e.right=s:this._setRoot(s)}_rotateRight(t){const e=t.parent,n=t.isLeftChild(),s=t.left;s&&(t.left=s.right,s.right=t),null!==e?n?e.left=s:e.right=s:this._setRoot(s)}_rebalance(t){const e=t.getBalance();e>1&&t.left?t.left.getBalance()<0?this._rotateLeft(t.left):this._rotateRight(t):e<-1&&t.right&&(t.right.getBalance()>0?this._rotateRight(t.right):this._rotateLeft(t))}get(t){if(null!==this._root){const e=[];if(this._root.search(t,e),e.length>0){let t=e[0];for(let n=1;n<e.length;n++)e[n].low>t.low&&(t=e[n]);return t.event}}return null}forEach(t){if(null!==this._root){const e=[];this._root.traverse((t=>e.push(t))),e.forEach((e=>{e.event&&t(e.event)}))}return this}forEachAtTime(t,e){if(null!==this._root){const n=[];this._root.search(t,n),n.forEach((t=>{t.event&&e(t.event)}))}return this}forEachFrom(t,e){if(null!==this._root){const n=[];this._root.searchAfter(t,n),n.forEach((t=>{t.event&&e(t.event)}))}return this}dispose(){return super.dispose(),null!==this._root&&this._root.traverse((t=>t.dispose())),this._root=null,this}}class yr{constructor(t,e,n){this._left=null,this._right=null,this.parent=null,this.height=0,this.event=n,this.low=t,this.high=e,this.max=this.high}insert(t){t.low<=this.low?null===this.left?this.left=t:this.left.insert(t):null===this.right?this.right=t:this.right.insert(t)}search(t,e){t>this.max||(null!==this.left&&this.left.search(t,e),this.low<=t&&this.high>t&&e.push(this),this.low>t||null!==this.right&&this.right.search(t,e))}searchAfter(t,e){this.low>=t&&(e.push(this),null!==this.left&&this.left.searchAfter(t,e)),null!==this.right&&this.right.searchAfter(t,e)}traverse(t){t(this),null!==this.left&&this.left.traverse(t),null!==this.right&&this.right.traverse(t)}updateHeight(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0}updateMax(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))}getBalance(){let t=0;return null!==this.left&&null!==this.right?t=this.left.height-this.right.height:null!==this.left?t=this.left.height+1:null!==this.right&&(t=-(this.right.height+1)),t}isLeftChild(){return null!==this.parent&&this.parent.left===this}get left(){return this._left}set left(t){this._left=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}get right(){return this._right}set right(t){this._right=t,null!==t&&(t.parent=this),this.updateHeight(),this.updateMax()}dispose(){this.parent=null,this._left=null,this._right=null,this.event=null}}let wr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["volume"])),this.name="Volume";const e=gi(t.getDefaults(),arguments,["volume"]);this.input=this.output=new rr({context:this.context,gain:e.volume,units:"decibels"}),this.volume=this.output.gain,Ni(this,"volume"),this._unmutedVolume=e.volume,this.mute=e.mute}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,volume:0})}get mute(){return this.volume.value===-1/0}set mute(t){!this.mute&&t?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!t&&(this.volume.value=this._unmutedVolume)}dispose(){return super.dispose(),this.input.dispose(),this.volume.dispose(),this}};class br extends nr{constructor(){super(gi(br.getDefaults(),arguments)),this.name="Destination",this.input=new wr({context:this.context}),this.output=new rr({context:this.context}),this.volume=this.input.volume;const t=gi(br.getDefaults(),arguments);sr(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(nr.getDefaults(),{mute:!1,volume:0})}get mute(){return this.input.mute}set mute(t){this.input.mute=t}chain(...t){return this.input.disconnect(),t.unshift(this.input),t.push(this.output),sr(...t),this}get maxChannelCount(){return this.context.rawContext.destination.maxChannelCount}dispose(){return super.dispose(),this.volume.dispose(),this}}Oi((t=>{t.destination=new br({context:t})})),Ei((t=>{t.destination.dispose()}));class xr extends wi{constructor(t){super(),this.name="TimelineValue",this._timeline=new Ci({memory:10}),this._initialValue=t}set(t,e){return this._timeline.add({value:t,time:e}),this}get(t){const e=this._timeline.get(t);return e?e.value:this._initialValue}}class Tr{constructor(t,e){this.id=Tr._eventId++;const n=Object.assign(Tr.getDefaults(),e);this.transport=t,this.callback=n.callback,this._once=n.once,this.time=n.time}static getDefaults(){return{callback:Pi,once:!1,time:0}}invoke(t){this.callback&&(this.callback(t),this._once&&this.transport.clear(this.id))}dispose(){return this.callback=void 0,this}}Tr._eventId=0;class Ar extends Tr{constructor(t,e){super(t,e),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this);const n=Object.assign(Ar.getDefaults(),e);this.duration=new mr(t.context,n.duration).valueOf(),this._interval=new mr(t.context,n.interval).valueOf(),this._nextTick=n.time,this.transport.on("start",this._boundRestart),this.transport.on("loopStart",this._boundRestart),this.context=this.transport.context,this._restart()}static getDefaults(){return Object.assign({},Tr.getDefaults(),{duration:1/0,interval:1,once:!1})}invoke(t){this._createEvents(t),super.invoke(t)}_createEvents(t){const e=this.transport.getTicksAtTime(t);e>=this.time&&e>=this._nextTick&&this._nextTick+this._interval<this.time+this.duration&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds()))}_restart(t){this.transport.clear(this._currentId),this.transport.clear(this._nextId),this._nextTick=this.time;const e=this.transport.getTicksAtTime(t);e>this.time&&(this._nextTick=this.time+Math.ceil((e-this.time)/this._interval)*this._interval),this._currentId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds()),this._nextTick+=this._interval,this._nextId=this.transport.scheduleOnce(this.invoke.bind(this),new mr(this.context,this._nextTick).toSeconds())}dispose(){return super.dispose(),this.transport.clear(this._currentId),this.transport.clear(this._nextId),this.transport.off("start",this._boundRestart),this.transport.off("loopStart",this._boundRestart),this}}class kr extends Ji{constructor(){super(gi(kr.getDefaults(),arguments)),this.name="Transport",this._loop=new xr(!1),this._loopStart=0,this._loopEnd=0,this._scheduledEvents={},this._timeline=new Ci,this._repeatedEvents=new vr,this._syncedSignals=[],this._swingAmount=0;const t=gi(kr.getDefaults(),arguments);this._ppq=t.ppq,this._clock=new dr({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),Ni(this,"bpm"),this._timeSignature=t.timeSignature,this._swingTicks=t.ppq/2}static getDefaults(){return Object.assign(Ji.getDefaults(),{bpm:120,loopEnd:"4m",loopStart:0,ppq:192,swing:0,swingSubdivision:"8n",timeSignature:4})}_processTick(t,e){if(this._loop.get(t)&&e>=this._loopEnd&&(this.emit("loopEnd",t),this._clock.setTicksAtTime(this._loopStart,t),e=this._loopStart,this.emit("loopStart",t,this._clock.getSecondsAtTime(t)),this.emit("loop",t)),this._swingAmount>0&&e%this._ppq!=0&&e%(2*this._swingTicks)!=0){const n=e%(2*this._swingTicks)/(2*this._swingTicks),s=Math.sin(n*Math.PI)*this._swingAmount;t+=new mr(this.context,2*this._swingTicks/3).toSeconds()*s}this._timeline.forEachAtTime(e,(e=>e.invoke(t)))}schedule(t,e){const n=new Tr(this,{callback:t,time:new Ki(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}scheduleRepeat(t,e,n,s=1/0){const i=new Ar(this,{callback:t,duration:new Xi(this.context,s).toTicks(),interval:new Xi(this.context,e).toTicks(),time:new Ki(this.context,n).toTicks()});return this._addEvent(i,this._repeatedEvents)}scheduleOnce(t,e){const n=new Tr(this,{callback:t,once:!0,time:new Ki(this.context,e).toTicks()});return this._addEvent(n,this._timeline)}clear(t){if(this._scheduledEvents.hasOwnProperty(t)){const e=this._scheduledEvents[t.toString()];e.timeline.remove(e.event),e.event.dispose(),delete this._scheduledEvents[t.toString()]}return this}_addEvent(t,e){return this._scheduledEvents[t.id.toString()]={event:t,timeline:e},e.add(t),t.id}cancel(t=0){const e=this.toTicks(t);return this._timeline.forEachFrom(e,(t=>this.clear(t.id))),this._repeatedEvents.forEachFrom(e,(t=>this.clear(t.id))),this}_bindClockEvents(){this._clock.on("start",((t,e)=>{e=new mr(this.context,e).toSeconds(),this.emit("start",t,e)})),this._clock.on("stop",(t=>{this.emit("stop",t)})),this._clock.on("pause",(t=>{this.emit("pause",t)}))}get state(){return this._clock.getStateAtTime(this.now())}start(t,e){let n;return Ks(e)&&(n=this.toTicks(e)),this._clock.start(t,n),this}stop(t){return this._clock.stop(t),this}pause(t){return this._clock.pause(t),this}toggle(t){return t=this.toSeconds(t),"started"!==this._clock.getStateAtTime(t)?this.start(t):this.stop(t),this}get timeSignature(){return this._timeSignature}set timeSignature(t){ni(t)&&(t=t[0]/t[1]*4),this._timeSignature=t}get loopStart(){return new Xi(this.context,this._loopStart,"i").toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t)}get loopEnd(){return new Xi(this.context,this._loopEnd,"i").toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t)}get loop(){return this._loop.get(this.now())}set loop(t){this._loop.set(t,this.now())}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get swing(){return this._swingAmount}set swing(t){this._swingAmount=t}get swingSubdivision(){return new mr(this.context,this._swingTicks).toNotation()}set swingSubdivision(t){this._swingTicks=this.toTicks(t)}get position(){const t=this.now(),e=this._clock.getTicksAtTime(t);return new mr(this.context,e).toBarsBeatsSixteenths()}set position(t){const e=this.toTicks(t);this.ticks=e}get seconds(){return this._clock.seconds}set seconds(t){const e=this.now(),n=this._clock.frequency.timeToTicks(t,e);this.ticks=n}get progress(){if(this.loop){const t=this.now();return(this._clock.getTicksAtTime(t)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}get ticks(){return this._clock.ticks}set ticks(t){if(this._clock.ticks!==t){const e=this.now();if("started"===this.state){const n=this._clock.getTicksAtTime(e),s=e+this._clock.frequency.getDurationOfTicks(Math.ceil(n)-n,e);this.emit("stop",s),this._clock.setTicksAtTime(t,s),this.emit("start",s,this._clock.getSecondsAtTime(s))}else this._clock.setTicksAtTime(t,e)}}getTicksAtTime(t){return Math.round(this._clock.getTicksAtTime(t))}getSecondsAtTime(t){return this._clock.getSecondsAtTime(t)}get PPQ(){return this._clock.frequency.multiplier}set PPQ(t){this._clock.frequency.multiplier=t}nextSubdivision(t){if(t=this.toTicks(t),"started"!==this.state)return 0;{const e=this.now(),n=t-this.getTicksAtTime(e)%t;return this._clock.nextTickTime(n,e)}}syncSignal(t,e){if(!e){const n=this.now();if(0!==t.getValueAtTime(n)){const s=1/(60/this.bpm.getValueAtTime(n)/this.PPQ);e=t.getValueAtTime(n)/s}else e=0}const n=new rr(e);return this.bpm.connect(n),n.connect(t._param),this._syncedSignals.push({initial:t.value,ratio:n,signal:t}),t.value=0,this}unsyncSignal(t){for(let e=this._syncedSignals.length-1;e>=0;e--){const n=this._syncedSignals[e];n.signal===t&&(n.ratio.dispose(),n.signal.value=n.initial,this._syncedSignals.splice(e,1))}return this}dispose(){return super.dispose(),this._clock.dispose(),Bi(this,"bpm"),this._timeline.dispose(),this._repeatedEvents.dispose(),this}}Di.mixin(kr),Oi((t=>{t.transport=new kr({context:t})})),Ei((t=>{t.transport.dispose()}));class Cr extends nr{constructor(t){super(t),this.input=void 0,this._state=new tr("stopped"),this._synced=!1,this._scheduled=[],this._syncedStart=Pi,this._syncedStop=Pi,this._state.memory=100,this._state.increasing=!0,this._volume=this.output=new wr({context:this.context,mute:t.mute,volume:t.volume}),this.volume=this._volume.volume,Ni(this,"volume"),this.onstop=t.onstop}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,onstop:Pi,volume:0})}get state(){return this._synced?"started"===this.context.transport.state?this._state.getValueAtTime(this.context.transport.seconds):"stopped":this._state.getValueAtTime(this.now())}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}_clampToCurrentTime(t){return this._synced?t:Math.max(t,this.context.currentTime)}start(t,e,n){let s=Qs(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(s=this._clampToCurrentTime(s),this._synced||"started"!==this._state.getValueAtTime(s))if(this.log("start",s),this._state.setStateAtTime("started",s),this._synced){const t=this._state.get(s);t&&(t.offset=this.toSeconds(vi(e,0)),t.duration=n?this.toSeconds(n):void 0);const i=this.context.transport.schedule((t=>{this._start(t,e,n)}),s);this._scheduled.push(i),"started"===this.context.transport.state&&this.context.transport.getSecondsAtTime(this.immediate())>s&&this._syncedStart(this.now(),this.context.transport.seconds)}else Xs(this.context),this._start(s,e,n);else $s(xi(s,this._state.get(s).time),"Start time must be strictly greater than previous start time"),this._state.cancel(s),this._state.setStateAtTime("started",s),this.log("restart",s),this.restart(s,e,n);return this}stop(t){let e=Qs(t)&&this._synced?this.context.transport.seconds:this.toSeconds(t);if(e=this._clampToCurrentTime(e),"started"===this._state.getValueAtTime(e)||Ks(this._state.getNextState("started",e))){if(this.log("stop",e),this._synced){const t=this.context.transport.schedule(this._stop.bind(this),e);this._scheduled.push(t)}else this._stop(e);this._state.cancel(e),this._state.setStateAtTime("stopped",e)}return this}restart(t,e,n){return t=this.toSeconds(t),"started"===this._state.getValueAtTime(t)&&(this._state.cancel(t),this._restart(t,e,n)),this}sync(){return this._synced||(this._synced=!0,this._syncedStart=(t,e)=>{if(e>0){const n=this._state.get(e);if(n&&"started"===n.state&&n.time!==e){const s=e-this.toSeconds(n.time);let i;n.duration&&(i=this.toSeconds(n.duration)-s),this._start(t,this.toSeconds(n.offset)+s,i)}}},this._syncedStop=t=>{const e=this.context.transport.getSecondsAtTime(Math.max(t-this.sampleTime,0));"started"===this._state.getValueAtTime(e)&&this._stop(t)},this.context.transport.on("start",this._syncedStart),this.context.transport.on("loopStart",this._syncedStart),this.context.transport.on("stop",this._syncedStop),this.context.transport.on("pause",this._syncedStop),this.context.transport.on("loopEnd",this._syncedStop)),this}unsync(){return this._synced&&(this.context.transport.off("stop",this._syncedStop),this.context.transport.off("pause",this._syncedStop),this.context.transport.off("loopEnd",this._syncedStop),this.context.transport.off("start",this._syncedStart),this.context.transport.off("loopStart",this._syncedStart)),this._synced=!1,this._scheduled.forEach((t=>this.context.transport.clear(t))),this._scheduled=[],this._state.cancel(0),this._stop(0),this}dispose(){return super.dispose(),this.onstop=Pi,this.unsync(),this._volume.dispose(),this._state.dispose(),this}}class Sr extends or{constructor(){super(gi(Sr.getDefaults(),arguments,["url","onload"])),this.name="ToneBufferSource",this._source=this.context.createBufferSource(),this._internalChannels=[this._source],this._sourceStarted=!1,this._sourceStopped=!1;const t=gi(Sr.getDefaults(),arguments,["url","onload"]);ir(this._source,this._gainNode),this._source.onended=()=>this._stopSource(),this.playbackRate=new er({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 Vi(t.url,t.onload,t.onerror),this._internalChannels.push(this._source)}static getDefaults(){return Object.assign(or.getDefaults(),{url:new Vi,loop:!1,loopEnd:0,loopStart:0,onload:Pi,onerror:Pi,playbackRate:1})}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t}get curve(){return this._curve}set curve(t){this._curve=t}start(t,e,n,s=1){$s(this.buffer.loaded,"buffer is either not set or not loaded");const i=this.toSeconds(t);this._startGain(i,s),e=this.loop?vi(e,this.loopStart):vi(e,0);let r=Math.max(this.toSeconds(e),0);if(this.loop){const t=this.toSeconds(this.loopEnd)||this.buffer.duration,e=this.toSeconds(this.loopStart),n=t-e;Ti(r,t)&&(r=(r-e)%n+e),ki(r,this.buffer.duration)&&(r=0)}if(this._source.buffer=this.buffer.get(),this._source.loopEnd=this.toSeconds(this.loopEnd)||this.buffer.duration,Ai(r,this.buffer.duration)&&(this._sourceStarted=!0,this._source.start(i,r)),Ks(n)){let t=this.toSeconds(n);t=Math.max(t,0),this.stop(i+t)}return this}_stopSource(t){!this._sourceStopped&&this._sourceStarted&&(this._sourceStopped=!0,this._source.stop(this.toSeconds(t)),this._onended())}get loopStart(){return this._source.loopStart}set loopStart(t){this._source.loopStart=this.toSeconds(t)}get loopEnd(){return this._source.loopEnd}set loopEnd(t){this._source.loopEnd=this.toSeconds(t)}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._source.loop}set loop(t){this._source.loop=t,this._sourceStarted&&this.cancelStop()}dispose(){return super.dispose(),this._source.onended=null,this._source.disconnect(),this._buffer.dispose(),this.playbackRate.dispose(),this}}class Or extends Cr{constructor(){super(gi(Or.getDefaults(),arguments,["type"])),this.name="Noise",this._source=null;const t=gi(Or.getDefaults(),arguments,["type"]);this._playbackRate=t.playbackRate,this.type=t.type,this._fadeIn=t.fadeIn,this._fadeOut=t.fadeOut}static getDefaults(){return Object.assign(Cr.getDefaults(),{fadeIn:0,fadeOut:0,playbackRate:1,type:"white"})}get type(){return this._type}set type(t){if($s(t in Dr,"Noise: invalid type: "+t),this._type!==t&&(this._type=t,"started"===this.state)){const t=this.now();this._stop(t),this._start(t)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._source&&(this._source.playbackRate.value=t)}_start(t){const e=Dr[this._type];this._source=new Sr({url:e,context:this.context,fadeIn:this._fadeIn,fadeOut:this._fadeOut,loop:!0,onended:()=>this.onstop(this),playbackRate:this._playbackRate}).connect(this.output),this._source.start(this.toSeconds(t),Math.random()*(e.duration-.001))}_stop(t){this._source&&(this._source.stop(this.toSeconds(t)),this._source=null)}get fadeIn(){return this._fadeIn}set fadeIn(t){this._fadeIn=t,this._source&&(this._source.fadeIn=this._fadeIn)}get fadeOut(){return this._fadeOut}set fadeOut(t){this._fadeOut=t,this._source&&(this._source.fadeOut=this._fadeOut)}_restart(t){this._stop(t),this._start(t)}dispose(){return super.dispose(),this._source&&this._source.disconnect(),this}}const Mr=220500,Er={brown:null,pink:null,white:null},Dr={get brown(){if(!Er.brown){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);t[e]=n;let s=0;for(let t=0;t<Mr;t++){const e=2*Math.random()-1;n[t]=(s+.02*e)/1.02,s=n[t],n[t]*=3.5}}Er.brown=(new Vi).fromArray(t)}return Er.brown},get pink(){if(!Er.pink){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);let s,i,r,o,a,u,c;t[e]=n,s=i=r=o=a=u=c=0;for(let t=0;t<Mr;t++){const e=2*Math.random()-1;s=.99886*s+.0555179*e,i=.99332*i+.0750759*e,r=.969*r+.153852*e,o=.8665*o+.3104856*e,a=.55*a+.5329522*e,u=-.7616*u-.016898*e,n[t]=s+i+r+o+a+u+c+.5362*e,n[t]*=.11,c=.115926*e}}Er.pink=(new Vi).fromArray(t)}return Er.pink},get white(){if(!Er.white){const t=[];for(let e=0;e<2;e++){const n=new Float32Array(Mr);t[e]=n;for(let t=0;t<Mr;t++)n[t]=2*Math.random()-1}Er.white=(new Vi).fromArray(t)}return Er.white}};function Ir(t,e){return ui(this,void 0,void 0,(function*(){const n=e/t.context.sampleRate,s=new qi(1,n,t.context.sampleRate);new t.constructor(Object.assign(t.get(),{frequency:2/n,detune:0,context:s})).toDestination().start(0);return(yield s.render()).getChannelData(0)}))}class Rr extends or{constructor(){super(gi(Rr.getDefaults(),arguments,["frequency","type"])),this.name="ToneOscillatorNode",this._oscillator=this.context.createOscillator(),this._internalChannels=[this._oscillator];const t=gi(Rr.getDefaults(),arguments,["frequency","type"]);ir(this._oscillator,this._gainNode),this.type=t.type,this.frequency=new er({context:this.context,param:this._oscillator.frequency,units:"frequency",value:t.frequency}),this.detune=new er({context:this.context,param:this._oscillator.detune,units:"cents",value:t.detune}),Ni(this,["frequency","detune"])}static getDefaults(){return Object.assign(or.getDefaults(),{detune:0,frequency:440,type:"sine"})}start(t){const e=this.toSeconds(t);return this.log("start",e),this._startGain(e),this._oscillator.start(e),this}_stopSource(t){this._oscillator.stop(t)}setPeriodicWave(t){return this._oscillator.setPeriodicWave(t),this}get type(){return this._oscillator.type}set type(t){this._oscillator.type=t}dispose(){return super.dispose(),"started"===this.state&&this.stop(),this._oscillator.disconnect(),this.frequency.dispose(),this.detune.dispose(),this}}let Nr=class t extends Cr{constructor(){super(gi(t.getDefaults(),arguments,["frequency","type"])),this.name="Oscillator",this._oscillator=null;const e=gi(t.getDefaults(),arguments,["frequency","type"]);this.frequency=new ur({context:this.context,units:"frequency",value:e.frequency}),Ni(this,"frequency"),this.detune=new ur({context:this.context,units:"cents",value:e.detune}),Ni(this,"detune"),this._partials=e.partials,this._partialCount=e.partialCount,this._type=e.type,e.partialCount&&"custom"!==e.type&&(this._type=this.baseType+e.partialCount.toString()),this.phase=e.phase}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,partialCount:0,partials:[],phase:0,type:"sine"})}_start(t){const e=this.toSeconds(t),n=new Rr({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(e)}_stop(t){const e=this.toSeconds(t);this._oscillator&&this._oscillator.stop(e)}_restart(t){const e=this.toSeconds(t);return this.log("restart",e),this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(e),this}syncFrequency(){return this.context.transport.syncSignal(this.frequency),this}unsyncFrequency(){return this.context.transport.unsyncSignal(this.frequency),this}_getCachedPeriodicWave(){if("custom"===this._type){return t._periodicWaveCache.find((t=>{return t.phase===this._phase&&(e=t.partials,n=this._partials,e.length===n.length&&e.every(((t,e)=>n[e]===t)));var e,n}))}{const e=t._periodicWaveCache.find((t=>t.type===this._type&&t.phase===this._phase));return this._partialCount=e?e.partialCount:this._partialCount,e}}get type(){return this._type}set type(e){this._type=e;const n=-1!==["sine","square","sawtooth","triangle"].indexOf(e);if(0===this._phase&&n)this._wave=void 0,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=e);else{const n=this._getCachedPeriodicWave();if(Ks(n)){const{partials:t,wave:e}=n;this._wave=e,this._partials=t,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}else{const[n,s]=this._getRealImaginary(e,this._phase),i=this.context.createPeriodicWave(n,s);this._wave=i,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave),t._periodicWaveCache.push({imag:s,partialCount:this._partialCount,partials:this._partials,phase:this._phase,real:n,type:this._type,wave:this._wave}),t._periodicWaveCache.length>100&&t._periodicWaveCache.shift()}}}get baseType(){return this._type.replace(this.partialCount.toString(),"")}set baseType(t){this.partialCount&&"custom"!==this._type&&"custom"!==t?this.type=t+this.partialCount:this.type=t}get partialCount(){return this._partialCount}set partialCount(t){Gs(t,0);let e=this._type;const n=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);if(n&&(e=n[1]),"custom"!==this._type)this.type=0===t?e:e+t.toString();else{const e=new Float32Array(t);this._partials.forEach(((t,n)=>e[n]=t)),this._partials=Array.from(e),this.type=this._type}}_getRealImaginary(t,e){let n=2048;const s=new Float32Array(n),i=new Float32Array(n);let r=1;if("custom"===t){if(r=this._partials.length+1,this._partialCount=this._partials.length,n=r,0===this._partials.length)return[s,i]}else{const e=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(t);e?(r=parseInt(e[2],10)+1,this._partialCount=parseInt(e[2],10),t=e[1],r=Math.max(r,2),n=r):this._partialCount=0,this._partials=[]}for(let o=1;o<n;++o){const n=2/(o*Math.PI);let a;switch(t){case"sine":a=o<=r?1:0,this._partials[o-1]=a;break;case"square":a=1&o?2*n:0,this._partials[o-1]=a;break;case"sawtooth":a=n*(1&o?1:-1),this._partials[o-1]=a;break;case"triangle":a=1&o?n*n*2*(o-1>>1&1?-1:1):0,this._partials[o-1]=a;break;case"custom":a=this._partials[o-1];break;default:throw new TypeError("Oscillator: invalid type: "+t)}0!==a?(s[o]=-a*Math.sin(e*o),i[o]=a*Math.cos(e*o)):(s[o]=0,i[o]=0)}return[s,i]}_inverseFFT(t,e,n){let s=0;const i=t.length;for(let r=0;r<i;r++)s+=t[r]*Math.cos(r*n)+e[r]*Math.sin(r*n);return s}getInitialValue(){const[t,e]=this._getRealImaginary(this._type,0);let n=0;const s=2*Math.PI;for(let i=0;i<32;i++)n=Math.max(this._inverseFFT(t,e,i/32*s),n);return i=-this._inverseFFT(t,e,this._phase)/n,r=-1,o=1,Math.max(Math.min(i,o),r);var i,r,o}get partials(){return this._partials.slice(0,this.partialCount)}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this.type="custom")}get phase(){return this._phase*(180/Math.PI)}set phase(t){this._phase=t*Math.PI/180,this.type=this._type}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),null!==this._oscillator&&this._oscillator.dispose(),this._wave=void 0,this.frequency.dispose(),this.detune.dispose(),this}};Nr._periodicWaveCache=[];class Br extends nr{constructor(){super(Object.assign(gi(Br.getDefaults(),arguments,["context"])))}connect(t,e=0,n=0){return cr(this,t,e,n),this}}class Pr extends Br{constructor(){super(Object.assign(gi(Pr.getDefaults(),arguments,["mapping","length"]))),this.name="WaveShaper",this._shaper=this.context.createWaveShaper(),this.input=this._shaper,this.output=this._shaper;const t=gi(Pr.getDefaults(),arguments,["mapping","length"]);ni(t.mapping)||t.mapping instanceof Float32Array?this.curve=Float32Array.from(t.mapping):"function"==typeof t.mapping&&this.setMap(t.mapping,t.length)}static getDefaults(){return Object.assign(ur.getDefaults(),{length:1024})}setMap(t,e=1024){const n=new Float32Array(e);for(let s=0,i=e;s<i;s++){const e=s/(i-1)*2-1;n[s]=t(e,s)}return this.curve=n,this}get curve(){return this._shaper.curve}set curve(t){this._shaper.curve=t}get oversample(){return this._shaper.oversample}set oversample(t){$s(["none","2x","4x"].some((e=>e.includes(t))),"oversampling must be either 'none', '2x', or '4x'"),this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.disconnect(),this}}class Vr extends Br{constructor(){super(...arguments),this.name="AudioToGain",this._norm=new Pr({context:this.context,mapping:t=>(t+1)/2}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class qr extends ur{constructor(){super(Object.assign(gi(qr.getDefaults(),arguments,["value"]))),this.name="Multiply",this.override=!1;const t=gi(qr.getDefaults(),arguments,["value"]);this._mult=this.input=this.output=new rr({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(ur.getDefaults(),{value:0})}dispose(){return super.dispose(),this._mult.dispose(),this}}class Fr extends Cr{constructor(){super(gi(Fr.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="AMOscillator",this._modulationScale=new Vr({context:this.context}),this._modulationNode=new rr({context:this.context});const t=gi(Fr.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Nr({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 Nr({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new qr({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),Ni(this,["frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{harmonicity:1,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){this._modulator.restart(t),this._carrier.restart(t)}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this._modulationScale.dispose(),this}}class jr extends Cr{constructor(){super(gi(jr.getDefaults(),arguments,["frequency","type","modulationType"])),this.name="FMOscillator",this._modulationNode=new rr({context:this.context,gain:0});const t=gi(jr.getDefaults(),arguments,["frequency","type","modulationType"]);this._carrier=new Nr({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 ur({context:this.context,units:"frequency",value:t.frequency}),this._modulator=new Nr({context:this.context,phase:t.phase,type:t.modulationType}),this.harmonicity=new qr({context:this.context,units:"positive",value:t.harmonicity}),this.modulationIndex=new qr({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),Ni(this,["modulationIndex","frequency","detune","harmonicity"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{harmonicity:1,modulationIndex:2,modulationType:"square"})}_start(t){this._modulator.start(t),this._carrier.start(t)}_stop(t){this._modulator.stop(t),this._carrier.stop(t)}_restart(t){return this._modulator.restart(t),this._carrier.restart(t),this}get type(){return this._carrier.type}set type(t){this._carrier.type=t}get baseType(){return this._carrier.baseType}set baseType(t){this._carrier.baseType=t}get partialCount(){return this._carrier.partialCount}set partialCount(t){this._carrier.partialCount=t}get modulationType(){return this._modulator.type}set modulationType(t){this._modulator.type=t}get phase(){return this._carrier.phase}set phase(t){this._carrier.phase=t,this._modulator.phase=t}get partials(){return this._carrier.partials}set partials(t){this._carrier.partials=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.harmonicity.dispose(),this._carrier.dispose(),this._modulator.dispose(),this._modulationNode.dispose(),this.modulationIndex.dispose(),this}}class zr extends Cr{constructor(){super(gi(zr.getDefaults(),arguments,["frequency","width"])),this.name="PulseOscillator",this._widthGate=new rr({context:this.context,gain:0}),this._thresh=new Pr({context:this.context,mapping:t=>t<=0?-1:1});const t=gi(zr.getDefaults(),arguments,["frequency","width"]);this.width=new ur({context:this.context,units:"audioRange",value:t.width}),this._triangle=new Nr({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),Ni(this,["width","frequency","detune"])}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,phase:0,type:"pulse",width:.2})}_start(t){t=this.toSeconds(t),this._triangle.start(t),this._widthGate.gain.setValueAtTime(1,t)}_stop(t){t=this.toSeconds(t),this._triangle.stop(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(0,t)}_restart(t){this._triangle.restart(t),this._widthGate.gain.cancelScheduledValues(t),this._widthGate.gain.setValueAtTime(1,t)}get phase(){return this._triangle.phase}set phase(t){this._triangle.phase=t}get type(){return"pulse"}get baseType(){return"pulse"}get partials(){return[]}get partialCount(){return 0}set carrierType(t){this._triangle.type=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this._triangle.dispose(),this.width.dispose(),this._widthGate.dispose(),this._thresh.dispose(),this}}class Wr extends Cr{constructor(){super(gi(Wr.getDefaults(),arguments,["frequency","type","spread"])),this.name="FatOscillator",this._oscillators=[];const t=gi(Wr.getDefaults(),arguments,["frequency","type","spread"]);this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ur({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,Ni(this,["frequency","detune"])}static getDefaults(){return Object.assign(Nr.getDefaults(),{count:3,spread:20,type:"sawtooth"})}_start(t){t=this.toSeconds(t),this._forEach((e=>e.start(t)))}_stop(t){t=this.toSeconds(t),this._forEach((e=>e.stop(t)))}_restart(t){this._forEach((e=>e.restart(t)))}_forEach(t){for(let e=0;e<this._oscillators.length;e++)t(this._oscillators[e],e)}get type(){return this._type}set type(t){this._type=t,this._forEach((e=>e.type=t))}get spread(){return this._spread}set spread(t){if(this._spread=t,this._oscillators.length>1){const e=-t/2,n=t/(this._oscillators.length-1);this._forEach(((t,s)=>t.detune.value=e+n*s))}}get count(){return this._oscillators.length}set count(t){if(Gs(t,1),this._oscillators.length!==t){this._forEach((t=>t.dispose())),this._oscillators=[];for(let e=0;e<t;e++){const n=new Nr({context:this.context,volume:-6-1.1*t,type:this._type,phase:this._phase+e/t*360,partialCount:this._partialCount,onstop:0===e?()=>this.onstop(this):Pi});"custom"===this.type&&(n.partials=this._partials),this.frequency.connect(n.frequency),this.detune.connect(n.detune),n.detune.overridden=!1,n.connect(this.output),this._oscillators[e]=n}this.spread=this._spread,"started"===this.state&&this._forEach((t=>t.start()))}}get phase(){return this._phase}set phase(t){this._phase=t,this._forEach(((t,e)=>t.phase=this._phase+e/this.count*360))}get baseType(){return this._oscillators[0].baseType}set baseType(t){this._forEach((e=>e.baseType=t)),this._type=this._oscillators[0].type}get partials(){return this._oscillators[0].partials}set partials(t){this._partials=t,this._partialCount=this._partials.length,t.length&&(this._type="custom",this._forEach((e=>e.partials=t)))}get partialCount(){return this._oscillators[0].partialCount}set partialCount(t){this._partialCount=t,this._forEach((e=>e.partialCount=t)),this._type=this._oscillators[0].type}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.frequency.dispose(),this.detune.dispose(),this._forEach((t=>t.dispose())),this}}class Lr extends Cr{constructor(){super(gi(Lr.getDefaults(),arguments,["frequency","modulationFrequency"])),this.name="PWMOscillator",this.sourceType="pwm",this._scale=new qr({context:this.context,value:2});const t=gi(Lr.getDefaults(),arguments,["frequency","modulationFrequency"]);this._pulse=new zr({context:this.context,frequency:t.modulationFrequency}),this._pulse.carrierType="sine",this.modulationFrequency=this._pulse.frequency,this._modulator=new Nr({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),Ni(this,["modulationFrequency","frequency","detune"])}static getDefaults(){return Object.assign(Cr.getDefaults(),{detune:0,frequency:440,modulationFrequency:.4,phase:0,type:"pwm"})}_start(t){t=this.toSeconds(t),this._modulator.start(t),this._pulse.start(t)}_stop(t){t=this.toSeconds(t),this._modulator.stop(t),this._pulse.stop(t)}_restart(t){this._modulator.restart(t),this._pulse.restart(t)}get type(){return"pwm"}get baseType(){return"pwm"}get partials(){return[]}get partialCount(){return 0}get phase(){return this._modulator.phase}set phase(t){this._modulator.phase=t}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this._pulse.dispose(),this._scale.dispose(),this._modulator.dispose(),this}}const Ur={am:Fr,fat:Wr,fm:jr,oscillator:Nr,pulse:zr,pwm:Lr};class Hr extends Cr{constructor(){super(gi(Hr.getDefaults(),arguments,["frequency","type"])),this.name="OmniOscillator";const t=gi(Hr.getDefaults(),arguments,["frequency","type"]);this.frequency=new ur({context:this.context,units:"frequency",value:t.frequency}),this.detune=new ur({context:this.context,units:"cents",value:t.detune}),Ni(this,["frequency","detune"]),this.set(t)}static getDefaults(){return Object.assign(Nr.getDefaults(),jr.getDefaults(),Fr.getDefaults(),Wr.getDefaults(),zr.getDefaults(),Lr.getDefaults())}_start(t){this._oscillator.start(t)}_stop(t){this._oscillator.stop(t)}_restart(t){return this._oscillator.restart(t),this}get type(){let t="";return["am","fm","fat"].some((t=>this._sourceType===t))&&(t=this._sourceType),t+this._oscillator.type}set type(t){"fm"===t.substr(0,2)?(this._createNewOscillator("fm"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"am"===t.substr(0,2)?(this._createNewOscillator("am"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(2)):"fat"===t.substr(0,3)?(this._createNewOscillator("fat"),this._oscillator=this._oscillator,this._oscillator.type=t.substr(3)):"pwm"===t?(this._createNewOscillator("pwm"),this._oscillator=this._oscillator):"pulse"===t?this._createNewOscillator("pulse"):(this._createNewOscillator("oscillator"),this._oscillator=this._oscillator,this._oscillator.type=t)}get partials(){return this._oscillator.partials}set partials(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partials=t)}get partialCount(){return this._oscillator.partialCount}set partialCount(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||(this._oscillator.partialCount=t)}set(t){return Reflect.has(t,"type")&&t.type&&(this.type=t.type),super.set(t),this}_createNewOscillator(t){if(t!==this._sourceType){this._sourceType=t;const e=Ur[t],n=this.now();if(this._oscillator){const t=this._oscillator;t.stop(n),this.context.setTimeout((()=>t.dispose()),this.blockTime)}this._oscillator=new e({context:this.context}),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this._oscillator.onstop=()=>this.onstop(this),"started"===this.state&&this._oscillator.start(n)}}get phase(){return this._oscillator.phase}set phase(t){this._oscillator.phase=t}get sourceType(){return this._sourceType}set sourceType(t){let e="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(e=this._oscillator.type),"fm"===t?this.type="fm"+e:"am"===t?this.type="am"+e:"fat"===t?this.type="fat"+e:"oscillator"===t?this.type=e:"pulse"===t?this.type="pulse":"pwm"===t&&(this.type="pwm")}_getOscType(t,e){return t instanceof Ur[e]}get baseType(){return this._oscillator.baseType}set baseType(t){this._getOscType(this._oscillator,"pulse")||this._getOscType(this._oscillator,"pwm")||"pulse"===t||"pwm"===t||(this._oscillator.baseType=t)}get width(){return this._getOscType(this._oscillator,"pulse")?this._oscillator.width:void 0}get count(){return this._getOscType(this._oscillator,"fat")?this._oscillator.count:void 0}set count(t){this._getOscType(this._oscillator,"fat")&&Js(t)&&(this._oscillator.count=t)}get spread(){return this._getOscType(this._oscillator,"fat")?this._oscillator.spread:void 0}set spread(t){this._getOscType(this._oscillator,"fat")&&Js(t)&&(this._oscillator.spread=t)}get modulationType(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.modulationType:void 0}set modulationType(t){(this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am"))&&si(t)&&(this._oscillator.modulationType=t)}get modulationIndex(){return this._getOscType(this._oscillator,"fm")?this._oscillator.modulationIndex:void 0}get harmonicity(){return this._getOscType(this._oscillator,"fm")||this._getOscType(this._oscillator,"am")?this._oscillator.harmonicity:void 0}get modulationFrequency(){return this._getOscType(this._oscillator,"pwm")?this._oscillator.modulationFrequency:void 0}asArray(t=1024){return ui(this,void 0,void 0,(function*(){return Ir(this,t)}))}dispose(){return super.dispose(),this.detune.dispose(),this.frequency.dispose(),this._oscillator.dispose(),this}}class $r extends ur{constructor(){super(Object.assign(gi($r.getDefaults(),arguments,["value"]))),this.override=!1,this.name="Add",this._sum=new rr({context:this.context}),this.input=this._sum,this.output=this._sum,this.addend=this._param,sr(this._constantSource,this._sum)}static getDefaults(){return Object.assign(ur.getDefaults(),{value:0})}dispose(){return super.dispose(),this._sum.dispose(),this}}class Gr extends Br{constructor(){super(Object.assign(gi(Gr.getDefaults(),arguments,["min","max"]))),this.name="Scale";const t=gi(Gr.getDefaults(),arguments,["min","max"]);this._mult=this.input=new qr({context:this.context,value:t.max-t.min}),this._add=this.output=new $r({context:this.context,value:t.min}),this._min=t.min,this._max=t.max,this.input.connect(this.output)}static getDefaults(){return Object.assign(Br.getDefaults(),{max:1,min:0})}get min(){return this._min}set min(t){this._min=t,this._setRange()}get max(){return this._max}set max(t){this._max=t,this._setRange()}_setRange(){this._add.value=this._min,this._mult.value=this._max-this._min}dispose(){return super.dispose(),this._add.dispose(),this._mult.dispose(),this}}function Xr(t,e=1/0){const n=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(s){Gs(s,t,e),n.set(this,s)}})}}function Zr(t,e=1/0){const n=new WeakMap;return function(s,i){Reflect.defineProperty(s,i,{configurable:!0,enumerable:!0,get:function(){return n.get(this)},set:function(s){Gs(this.toSeconds(s),t,e),n.set(this,s)}})}}class Yr extends Cr{constructor(){super(gi(Yr.getDefaults(),arguments,["url","onload"])),this.name="Player",this._activeSources=new Set;const t=gi(Yr.getDefaults(),arguments,["url","onload"]);this._buffer=new Vi({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(Cr.getDefaults(),{autostart:!1,fadeIn:0,fadeOut:0,loop:!1,loopEnd:0,loopStart:0,onload:Pi,onerror:Pi,playbackRate:1,reverse:!1})}load(t){return ui(this,void 0,void 0,(function*(){return yield this._buffer.load(t),this._onload(),this}))}_onload(t=Pi){t(),this.autostart&&this.start()}_onSourceEnd(t){this.onstop(this),this._activeSources.delete(t),0!==this._activeSources.size||this._synced||"started"!==this._state.getValueAtTime(this.now())||(this._state.cancel(this.now()),this._state.setStateAtTime("stopped",this.now()))}start(t,e,n){return super.start(t,e,n),this}_start(t,e,n){e=this._loop?vi(e,this._loopStart):vi(e,0);const s=this.toSeconds(e),i=n;n=vi(n,Math.max(this._buffer.duration-s,0));let r=this.toSeconds(n);r/=this._playbackRate,t=this.toSeconds(t);const o=new Sr({url:this._buffer,context:this.context,fadeIn:this.fadeIn,fadeOut:this.fadeOut,loop:this._loop,loopEnd:this._loopEnd,loopStart:this._loopStart,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate}).connect(this.output);this._loop||this._synced||(this._state.cancel(t+r),this._state.setStateAtTime("stopped",t+r,{implicitEnd:!0})),this._activeSources.add(o),this._loop&&Qs(i)?o.start(t,s):o.start(t,s,r-this.toSeconds(this.fadeOut))}_stop(t){const e=this.toSeconds(t);this._activeSources.forEach((t=>t.stop(e)))}restart(t,e,n){return super.restart(t,e,n),this}_restart(t,e,n){this._stop(t),this._start(t,e,n)}seek(t,e){const n=this.toSeconds(e);if("started"===this._state.getValueAtTime(n)){const e=this.toSeconds(t);this._stop(n),this._start(n,e)}return this}setLoopPoints(t,e){return this.loopStart=t,this.loopEnd=e,this}get loopStart(){return this._loopStart}set loopStart(t){this._loopStart=t,this.buffer.loaded&&Gs(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach((e=>{e.loopStart=t}))}get loopEnd(){return this._loopEnd}set loopEnd(t){this._loopEnd=t,this.buffer.loaded&&Gs(this.toSeconds(t),0,this.buffer.duration),this._activeSources.forEach((e=>{e.loopEnd=t}))}get buffer(){return this._buffer}set buffer(t){this._buffer.set(t)}get loop(){return this._loop}set loop(t){if(this._loop!==t&&(this._loop=t,this._activeSources.forEach((e=>{e.loop=t})),t)){const t=this._state.getNextState("stopped",this.now());t&&this._state.cancel(t.time)}}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t;const e=this.now(),n=this._state.getNextState("stopped",e);n&&n.implicitEnd&&(this._state.cancel(n.time),this._activeSources.forEach((t=>t.cancelStop()))),this._activeSources.forEach((n=>{n.playbackRate.setValueAtTime(t,e)}))}get reverse(){return this._buffer.reverse}set reverse(t){this._buffer.reverse=t}get loaded(){return this._buffer.loaded}dispose(){return super.dispose(),this._activeSources.forEach((t=>t.dispose())),this._activeSources.clear(),this._buffer.dispose(),this}}ai([Zr(0)],Yr.prototype,"fadeIn",void 0),ai([Zr(0)],Yr.prototype,"fadeOut",void 0);class Qr extends Br{constructor(){super(...arguments),this.name="GainToAudio",this._norm=new Pr({context:this.context,mapping:t=>2*Math.abs(t)-1}),this.input=this._norm,this.output=this._norm}dispose(){return super.dispose(),this._norm.dispose(),this}}class Kr extends Br{constructor(){super(Object.assign(gi(Kr.getDefaults(),arguments,["value"]))),this.name="Pow";const t=gi(Kr.getDefaults(),arguments,["value"]);this._exponentScaler=this.input=this.output=new Pr({context:this.context,mapping:this._expFunc(t.value),length:8192}),this._exponent=t.value}static getDefaults(){return Object.assign(Br.getDefaults(),{value:1})}_expFunc(t){return e=>Math.pow(Math.abs(e),t)}get value(){return this._exponent}set value(t){this._exponent=t,this._exponentScaler.setMap(this._expFunc(this._exponent))}dispose(){return super.dispose(),this._exponentScaler.dispose(),this}}let Jr=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="Envelope",this._sig=new ur({context:this.context,value:0}),this.output=this._sig,this.input=void 0;const e=gi(t.getDefaults(),arguments,["attack","decay","sustain","release"]);this.attack=e.attack,this.decay=e.decay,this.sustain=e.sustain,this.release=e.release,this.attackCurve=e.attackCurve,this.releaseCurve=e.releaseCurve,this.decayCurve=e.decayCurve}static getDefaults(){return Object.assign(nr.getDefaults(),{attack:.01,attackCurve:"linear",decay:.1,decayCurve:"exponential",release:1,releaseCurve:"exponential",sustain:.5})}get value(){return this.getValueAtTime(this.now())}_getCurve(t,e){if(si(t))return t;{let n;for(n in to)if(to[n][e]===t)return n;return t}}_setCurve(t,e,n){if(si(n)&&Reflect.has(to,n)){const s=to[n];ti(s)?"_decayCurve"!==t&&(this[t]=s[e]):this[t]=s}else{if(!ni(n)||"_decayCurve"===t)throw new Error("Envelope: invalid curve: "+n);this[t]=n}}get attackCurve(){return this._getCurve(this._attackCurve,"In")}set attackCurve(t){this._setCurve("_attackCurve","In",t)}get releaseCurve(){return this._getCurve(this._releaseCurve,"Out")}set releaseCurve(t){this._setCurve("_releaseCurve","Out",t)}get decayCurve(){return this._decayCurve}set decayCurve(t){$s(["linear","exponential"].some((e=>e===t)),`Invalid envelope curve: ${t}`),this._decayCurve=t}triggerAttack(t,e=1){this.log("triggerAttack",t,e),t=this.toSeconds(t);let n=this.toSeconds(this.attack);const s=this.toSeconds(this.decay),i=this.getValueAtTime(t);if(i>0){n=(1-i)/(1/n)}if(n<this.sampleTime)this._sig.cancelScheduledValues(t),this._sig.setValueAtTime(e,t);else if("linear"===this._attackCurve)this._sig.linearRampTo(e,n,t);else if("exponential"===this._attackCurve)this._sig.targetRampTo(e,n,t);else{this._sig.cancelAndHoldAtTime(t);let s=this._attackCurve;for(let t=1;t<s.length;t++)if(s[t-1]<=i&&i<=s[t]){s=this._attackCurve.slice(t),s[0]=i;break}this._sig.setValueCurveAtTime(s,t,n,e)}if(s&&this.sustain<1){const i=e*this.sustain,r=t+n;this.log("decay",r),"linear"===this._decayCurve?this._sig.linearRampToValueAtTime(i,s+r):this._sig.exponentialApproachValueAtTime(i,r,s)}return this}triggerRelease(t){this.log("triggerRelease",t),t=this.toSeconds(t);const e=this.getValueAtTime(t);if(e>0){const n=this.toSeconds(this.release);n<this.sampleTime?this._sig.setValueAtTime(0,t):"linear"===this._releaseCurve?this._sig.linearRampTo(0,n,t):"exponential"===this._releaseCurve?this._sig.targetRampTo(0,n,t):($s(ni(this._releaseCurve),"releaseCurve must be either 'linear', 'exponential' or an array"),this._sig.cancelAndHoldAtTime(t),this._sig.setValueCurveAtTime(this._releaseCurve,t,n,e))}return this}getValueAtTime(t){return this._sig.getValueAtTime(t)}triggerAttackRelease(t,e,n=1){return e=this.toSeconds(e),this.triggerAttack(e,n),this.triggerRelease(e+this.toSeconds(t)),this}cancel(t){return this._sig.cancelScheduledValues(this.toSeconds(t)),this}connect(t,e=0,n=0){return cr(this,t,e,n),this}asArray(t=1024){return ui(this,void 0,void 0,(function*(){const e=t/this.context.sampleRate,n=new qi(1,e,this.context.sampleRate),s=this.toSeconds(this.attack)+this.toSeconds(this.decay),i=s+this.toSeconds(this.release),r=.1*i,o=i+r,a=new this.constructor(Object.assign(this.get(),{attack:e*this.toSeconds(this.attack)/o,decay:e*this.toSeconds(this.decay)/o,release:e*this.toSeconds(this.release)/o,context:n}));a._sig.toDestination(),a.triggerAttackRelease(e*(s+r)/o,0);return(yield n.render()).getChannelData(0)}))}dispose(){return super.dispose(),this._sig.dispose(),this}};ai([Zr(0)],Jr.prototype,"attack",void 0),ai([Zr(0)],Jr.prototype,"decay",void 0),ai([Xr(0,1)],Jr.prototype,"sustain",void 0),ai([Zr(0)],Jr.prototype,"release",void 0);const to=(()=>{const t=128;let e,n;const s=[];for(e=0;e<t;e++)s[e]=Math.sin(e/127*(Math.PI/2));const i=[];for(e=0;e<127;e++){n=e/127;const t=Math.sin(n*(2*Math.PI)*6.4-Math.PI/2)+1;i[e]=t/10+.83*n}i[127]=1;const r=[];for(e=0;e<t;e++)r[e]=Math.ceil(e/127*5)/5;const o=[];for(e=0;e<t;e++)n=e/127,o[e]=.5*(1-Math.cos(Math.PI*n));const a=[];for(e=0;e<t;e++){n=e/127;const t=4*Math.pow(n,3)+.2,s=Math.cos(t*Math.PI*2*n);a[e]=Math.abs(s*(1-n))}function u(t){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=1-t[n];return e}return{bounce:{In:u(a),Out:a},cosine:{In:s,Out:(c=s,c.slice(0).reverse())},exponential:"exponential",linear:"linear",ripple:{In:i,Out:u(i)},sine:{In:o,Out:u(o)},step:{In:r,Out:u(r)}};var c})();class eo extends nr{constructor(){super(gi(eo.getDefaults(),arguments)),this._scheduledEvents=[],this._synced=!1,this._original_triggerAttack=this.triggerAttack,this._original_triggerRelease=this.triggerRelease;const t=gi(eo.getDefaults(),arguments);this._volume=this.output=new wr({context:this.context,volume:t.volume}),this.volume=this._volume.volume,Ni(this,"volume")}static getDefaults(){return Object.assign(nr.getDefaults(),{volume:0})}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0)),this}_syncState(){let t=!1;return this._synced||(this._synced=!0,t=!0),t}_syncMethod(t,e){const n=this["_original_"+t]=this[t];this[t]=(...t)=>{const s=t[e],i=this.context.transport.schedule((s=>{t[e]=s,n.apply(this,t)}),s);this._scheduledEvents.push(i)}}unsync(){return this._scheduledEvents.forEach((t=>this.context.transport.clear(t))),this._scheduledEvents=[],this._synced&&(this._synced=!1,this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease),this}triggerAttackRelease(t,e,n,s){const i=this.toSeconds(n),r=this.toSeconds(e);return this.triggerAttack(t,i,s),this.triggerRelease(i+r),this}dispose(){return super.dispose(),this._volume.dispose(),this.unsync(),this._scheduledEvents=[],this}}class no extends eo{constructor(){super(gi(no.getDefaults(),arguments));const t=gi(no.getDefaults(),arguments);this.portamento=t.portamento,this.onsilence=t.onsilence}static getDefaults(){return Object.assign(eo.getDefaults(),{detune:0,onsilence:Pi,portamento:0})}triggerAttack(t,e,n=1){this.log("triggerAttack",t,e,n);const s=this.toSeconds(e);return this._triggerEnvelopeAttack(s,n),this.setNote(t,s),this}triggerRelease(t){this.log("triggerRelease",t);const e=this.toSeconds(t);return this._triggerEnvelopeRelease(e),this}setNote(t,e){const n=this.toSeconds(e),s=t instanceof Zi?t.toFrequency():t;if(this.portamento>0&&this.getLevelAtTime(n)>.05){const t=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(s,t,n)}else this.frequency.setValueAtTime(s,n);return this}}ai([Zr(0)],no.prototype,"portamento",void 0);class so extends Jr{constructor(){super(gi(so.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="AmplitudeEnvelope",this._gainNode=new rr({context:this.context,gain:0}),this.output=this._gainNode,this.input=this._gainNode,this._sig.connect(this._gainNode.gain),this.output=this._gainNode,this.input=this._gainNode}dispose(){return super.dispose(),this._gainNode.dispose(),this}}class io extends no{constructor(){super(gi(io.getDefaults(),arguments)),this.name="Synth";const t=gi(io.getDefaults(),arguments);this.oscillator=new Hr(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 so(Object.assign({context:this.context},t.envelope)),this.oscillator.chain(this.envelope,this.output),Ni(this,["oscillator","frequency","detune","envelope"])}static getDefaults(){return Object.assign(no.getDefaults(),{envelope:Object.assign(yi(Jr.getDefaults(),Object.keys(nr.getDefaults())),{attack:.005,decay:.1,release:1,sustain:.3}),oscillator:Object.assign(yi(Hr.getDefaults(),[...Object.keys(Cr.getDefaults()),"frequency","detune"]),{type:"triangle"})})}_triggerEnvelopeAttack(t,e){if(this.envelope.triggerAttack(t,e),this.oscillator.start(t),0===this.envelope.sustain){const e=this.toSeconds(this.envelope.attack),n=this.toSeconds(this.envelope.decay);this.oscillator.stop(t+e+n)}}_triggerEnvelopeRelease(t){this.envelope.triggerRelease(t),this.oscillator.stop(t+this.toSeconds(this.envelope.release))}getLevelAtTime(t){return t=this.toSeconds(t),this.envelope.getValueAtTime(t)}dispose(){return super.dispose(),this.oscillator.dispose(),this.envelope.dispose(),this}}class ro extends nr{constructor(){super(gi(ro.getDefaults(),arguments,["frequency","type"])),this.name="BiquadFilter";const t=gi(ro.getDefaults(),arguments,["frequency","type"]);this._filter=this.context.createBiquadFilter(),this.input=this.output=this._filter,this.Q=new er({context:this.context,units:"number",value:t.Q,param:this._filter.Q}),this.frequency=new er({context:this.context,units:"frequency",value:t.frequency,param:this._filter.frequency}),this.detune=new er({context:this.context,units:"cents",value:t.detune,param:this._filter.detune}),this.gain=new er({context:this.context,units:"decibels",convert:!1,value:t.gain,param:this._filter.gain}),this.type=t.type}static getDefaults(){return Object.assign(nr.getDefaults(),{Q:1,type:"lowpass",frequency:350,detune:0,gain:0})}get type(){return this._filter.type}set type(t){$s(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._filter.type=t}getFrequencyResponse(t=128){const e=new Float32Array(t);for(let n=0;n<t;n++){const s=19980*Math.pow(n/t,2)+20;e[n]=s}const n=new Float32Array(t),s=new Float32Array(t),i=this.context.createBiquadFilter();return i.type=this.type,i.Q.value=this.Q.value,i.frequency.value=this.frequency.value,i.gain.value=this.gain.value,i.getFrequencyResponse(e,n,s),n}dispose(){return super.dispose(),this._filter.disconnect(),this.Q.dispose(),this.frequency.dispose(),this.gain.dispose(),this.detune.dispose(),this}}let oo=class t extends nr{constructor(){super(gi(t.getDefaults(),arguments,["frequency","type","rolloff"])),this.name="Filter",this.input=new rr({context:this.context}),this.output=new rr({context:this.context}),this._filters=[];const e=gi(t.getDefaults(),arguments,["frequency","type","rolloff"]);this._filters=[],this.Q=new ur({context:this.context,units:"positive",value:e.Q}),this.frequency=new ur({context:this.context,units:"frequency",value:e.frequency}),this.detune=new ur({context:this.context,units:"cents",value:e.detune}),this.gain=new ur({context:this.context,units:"decibels",convert:!1,value:e.gain}),this._type=e.type,this.rolloff=e.rolloff,Ni(this,["detune","frequency","gain","Q"])}static getDefaults(){return Object.assign(nr.getDefaults(),{Q:1,detune:0,frequency:350,gain:0,rolloff:-12,type:"lowpass"})}get type(){return this._type}set type(t){$s(-1!==["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(t),`Invalid filter type: ${t}`),this._type=t,this._filters.forEach((e=>e.type=t))}get rolloff(){return this._rolloff}set rolloff(t){const e=Js(t)?t:parseInt(t,10),n=[-12,-24,-48,-96];let s=n.indexOf(e);$s(-1!==s,`rolloff can only be ${n.join(", ")}`),s+=1,this._rolloff=e,this.input.disconnect(),this._filters.forEach((t=>t.disconnect())),this._filters=new Array(s);for(let t=0;t<s;t++){const e=new ro({context:this.context});e.type=this._type,this.frequency.connect(e.frequency),this.detune.connect(e.detune),this.Q.connect(e.Q),this.gain.connect(e.gain),this._filters[t]=e}this._internalChannels=this._filters,sr(this.input,...this._internalChannels,this.output)}getFrequencyResponse(t=128){const e=new ro({frequency:this.frequency.value,gain:this.gain.value,Q:this.Q.value,type:this._type,detune:this.detune.value}),n=new Float32Array(t).map((()=>1));return this._filters.forEach((()=>{e.getFrequencyResponse(t).forEach(((t,e)=>n[e]*=t))})),e.dispose(),n}dispose(){return super.dispose(),this._filters.forEach((t=>{t.dispose()})),Bi(this,["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.detune.dispose(),this.gain.dispose(),this}};class ao extends Jr{constructor(){super(gi(ao.getDefaults(),arguments,["attack","decay","sustain","release"])),this.name="FrequencyEnvelope";const t=gi(ao.getDefaults(),arguments,["attack","decay","sustain","release"]);this._octaves=t.octaves,this._baseFrequency=this.toFrequency(t.baseFrequency),this._exponent=this.input=new Kr({context:this.context,value:t.exponent}),this._scale=this.output=new Gr({context:this.context,min:this._baseFrequency,max:this._baseFrequency*Math.pow(2,this._octaves)}),this._sig.chain(this._exponent,this._scale)}static getDefaults(){return Object.assign(Jr.getDefaults(),{baseFrequency:200,exponent:1,octaves:4})}get baseFrequency(){return this._baseFrequency}set baseFrequency(t){const e=this.toFrequency(t);Gs(e,0),this._baseFrequency=e,this._scale.min=this._baseFrequency,this.octaves=this._octaves}get octaves(){return this._octaves}set octaves(t){this._octaves=t,this._scale.max=this._baseFrequency*Math.pow(2,t)}get exponent(){return this._exponent.value}set exponent(t){this._exponent.value=t}dispose(){return super.dispose(),this._exponent.dispose(),this._scale.dispose(),this}}class uo extends io{constructor(){super(gi(uo.getDefaults(),arguments)),this.name="MembraneSynth",this.portamento=0;const t=gi(uo.getDefaults(),arguments);this.pitchDecay=t.pitchDecay,this.octaves=t.octaves,Ni(this,["oscillator","envelope"])}static getDefaults(){return mi(no.getDefaults(),io.getDefaults(),{envelope:{attack:.001,attackCurve:"exponential",decay:.4,release:1.4,sustain:.01},octaves:10,oscillator:{type:"sine"},pitchDecay:.05})}setNote(t,e){const n=this.toSeconds(e),s=this.toFrequency(t instanceof Zi?t.toFrequency():t),i=s*this.octaves;return this.oscillator.frequency.setValueAtTime(i,n),this.oscillator.frequency.exponentialRampToValueAtTime(s,n+this.toSeconds(this.pitchDecay)),this}dispose(){return super.dispose(),this}}ai([Xr(0)],uo.prototype,"octaves",void 0),ai([Zr(0)],uo.prototype,"pitchDecay",void 0);const co=new Set;function lo(t){co.add(t)}function ho(t,e){const n=`registerProcessor("${t}", ${e})`;co.add(n)}class po extends nr{constructor(t){super(t),this.name="ToneAudioWorklet",this.workletOptions={},this.onprocessorerror=Pi;const e=URL.createObjectURL(new Blob([Array.from(co).join("\n")],{type:"text/javascript"})),n=this._audioWorkletName();this._dummyGain=this.context.createGain(),this._dummyParam=this._dummyGain.gain,this.context.addAudioWorkletModule(e,n).then((()=>{this.disposed||(this._worklet=this.context.createAudioWorkletNode(n,this.workletOptions),this._worklet.onprocessorerror=this.onprocessorerror.bind(this),this.onReady(this._worklet))}))}dispose(){return super.dispose(),this._dummyGain.disconnect(),this._worklet&&(this._worklet.port.postMessage("dispose"),this._worklet.disconnect()),this}}lo('\n\t/**\n\t * The base AudioWorkletProcessor for use in Tone.js. Works with the [[ToneAudioWorklet]]. \n\t */\n\tclass ToneAudioWorkletProcessor extends AudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\t\n\t\t\tsuper(options);\n\t\t\t/**\n\t\t\t * If the processor was disposed or not. Keep alive until it\'s disposed.\n\t\t\t */\n\t\t\tthis.disposed = false;\n\t\t \t/** \n\t\t\t * The number of samples in the processing block\n\t\t\t */\n\t\t\tthis.blockSize = 128;\n\t\t\t/**\n\t\t\t * the sample rate\n\t\t\t */\n\t\t\tthis.sampleRate = sampleRate;\n\n\t\t\tthis.port.onmessage = (event) => {\n\t\t\t\t// when it receives a dispose \n\t\t\t\tif (event.data === "dispose") {\n\t\t\t\t\tthis.disposed = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n');lo("\n\t/**\n\t * Abstract class for a single input/output processor. \n\t * has a 'generate' function which processes one sample at a time\n\t */\n\tclass SingleIOProcessor extends ToneAudioWorkletProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(Object.assign(options, {\n\t\t\t\tnumberOfInputs: 1,\n\t\t\t\tnumberOfOutputs: 1\n\t\t\t}));\n\t\t\t/**\n\t\t\t * Holds the name of the parameter and a single value of that\n\t\t\t * parameter at the current sample\n\t\t\t * @type { [name: string]: number }\n\t\t\t */\n\t\t\tthis.params = {}\n\t\t}\n\n\t\t/**\n\t\t * Generate an output sample from the input sample and parameters\n\t\t * @abstract\n\t\t * @param input number\n\t\t * @param channel number\n\t\t * @param parameters { [name: string]: number }\n\t\t * @returns number\n\t\t */\n\t\tgenerate(){}\n\n\t\t/**\n\t\t * Update the private params object with the \n\t\t * values of the parameters at the given index\n\t\t * @param parameters { [name: string]: Float32Array },\n\t\t * @param index number\n\t\t */\n\t\tupdateParams(parameters, index) {\n\t\t\tfor (const paramName in parameters) {\n\t\t\t\tconst param = parameters[paramName];\n\t\t\t\tif (param.length > 1) {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][index];\n\t\t\t\t} else {\n\t\t\t\t\tthis.params[paramName] = parameters[paramName][0];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Process a single frame of the audio\n\t\t * @param inputs Float32Array[][]\n\t\t * @param outputs Float32Array[][]\n\t\t */\n\t\tprocess(inputs, outputs, parameters) {\n\t\t\tconst input = inputs[0];\n\t\t\tconst output = outputs[0];\n\t\t\t// get the parameter values\n\t\t\tconst channelCount = Math.max(input && input.length || 0, output.length);\n\t\t\tfor (let sample = 0; sample < this.blockSize; sample++) {\n\t\t\t\tthis.updateParams(parameters, sample);\n\t\t\t\tfor (let channel = 0; channel < channelCount; channel++) {\n\t\t\t\t\tconst inputSample = input && input.length ? input[channel][sample] : 0;\n\t\t\t\t\toutput[channel][sample] = this.generate(inputSample, channel, this.params);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn !this.disposed;\n\t\t}\n\t};\n");lo("\n\t/**\n\t * A multichannel buffer for use within an AudioWorkletProcessor as a delay line\n\t */\n\tclass DelayLine {\n\t\t\n\t\tconstructor(size, channels) {\n\t\t\tthis.buffer = [];\n\t\t\tthis.writeHead = []\n\t\t\tthis.size = size;\n\n\t\t\t// create the empty channels\n\t\t\tfor (let i = 0; i < channels; i++) {\n\t\t\t\tthis.buffer[i] = new Float32Array(this.size);\n\t\t\t\tthis.writeHead[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Push a value onto the end\n\t\t * @param channel number\n\t\t * @param value number\n\t\t */\n\t\tpush(channel, value) {\n\t\t\tthis.writeHead[channel] += 1;\n\t\t\tif (this.writeHead[channel] > this.size) {\n\t\t\t\tthis.writeHead[channel] = 0;\n\t\t\t}\n\t\t\tthis.buffer[channel][this.writeHead[channel]] = value;\n\t\t}\n\n\t\t/**\n\t\t * Get the recorded value of the channel given the delay\n\t\t * @param channel number\n\t\t * @param delay number delay samples\n\t\t */\n\t\tget(channel, delay) {\n\t\t\tlet readHead = this.writeHead[channel] - Math.floor(delay);\n\t\t\tif (readHead < 0) {\n\t\t\t\treadHead += this.size;\n\t\t\t}\n\t\t\treturn this.buffer[channel][readHead];\n\t\t}\n\t}\n");ho("feedback-comb-filter",'\n\tclass FeedbackCombFilterWorklet extends SingleIOProcessor {\n\n\t\tconstructor(options) {\n\t\t\tsuper(options);\n\t\t\tthis.delayLine = new DelayLine(this.sampleRate, options.channelCount || 2);\n\t\t}\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: "delayTime",\n\t\t\t\tdefaultValue: 0.1,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 1,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}, {\n\t\t\t\tname: "feedback",\n\t\t\t\tdefaultValue: 0.5,\n\t\t\t\tminValue: 0,\n\t\t\t\tmaxValue: 0.9999,\n\t\t\t\tautomationRate: "k-rate"\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, channel, parameters) {\n\t\t\tconst delayedSample = this.delayLine.get(channel, parameters.delayTime * this.sampleRate);\n\t\t\tthis.delayLine.push(channel, input + delayedSample * parameters.feedback);\n\t\t\treturn delayedSample;\n\t\t}\n\t}\n');class fo extends eo{constructor(){super(gi(fo.getDefaults(),arguments,["urls","onload","baseUrl"],"urls")),this.name="Sampler",this._activeSources=new Map;const t=gi(fo.getDefaults(),arguments,["urls","onload","baseUrl"],"urls"),e={};Object.keys(t.urls).forEach((n=>{const s=parseInt(n,10);if($s(ii(n)||Js(s)&&isFinite(s),`url key is neither a note or midi pitch: ${n}`),ii(n)){const s=new Zi(this.context,n).toMidi();e[s]=t.urls[n]}else Js(s)&&isFinite(s)&&(e[s]=t.urls[s])})),this._buffers=new _r({urls:e,onload:t.onload,baseUrl:t.baseUrl,onerror:t.onerror}),this.attack=t.attack,this.release=t.release,this.curve=t.curve,this._buffers.loaded&&Promise.resolve().then(t.onload)}static getDefaults(){return Object.assign(eo.getDefaults(),{attack:0,baseUrl:"",curve:"exponential",onload:Pi,onerror:Pi,release:.1,urls:{}})}_findClosest(t){let e=0;for(;e<96;){if(this._buffers.has(t+e))return-e;if(this._buffers.has(t-e))return e;e++}throw new Error(`No available buffers for note: ${t}`)}triggerAttack(t,e,n=1){return this.log("triggerAttack",t,e,n),Array.isArray(t)||(t=[t]),t.forEach((t=>{const s=$i(new Zi(this.context,t).toFrequency()),i=Math.round(s),r=s-i,o=this._findClosest(i),a=i-o,u=this._buffers.get(a),c=Li(o+r),l=new Sr({url:u,context:this.context,curve:this.curve,fadeIn:this.attack,fadeOut:this.release,playbackRate:c}).connect(this.output);l.start(e,0,u.duration/c,n),ni(this._activeSources.get(i))||this._activeSources.set(i,[]),this._activeSources.get(i).push(l),l.onended=()=>{if(this._activeSources&&this._activeSources.has(i)){const t=this._activeSources.get(i),e=t.indexOf(l);-1!==e&&t.splice(e,1)}}})),this}triggerRelease(t,e){return this.log("triggerRelease",t,e),Array.isArray(t)||(t=[t]),t.forEach((t=>{const n=new Zi(this.context,t).toMidi();if(this._activeSources.has(n)&&this._activeSources.get(n).length){const t=this._activeSources.get(n);e=this.toSeconds(e),t.forEach((t=>{t.stop(e)})),this._activeSources.set(n,[])}})),this}releaseAll(t){const e=this.toSeconds(t);return this._activeSources.forEach((t=>{for(;t.length;){t.shift().stop(e)}})),this}sync(){return this._syncState()&&(this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1)),this}triggerAttackRelease(t,e,n,s=1){const i=this.toSeconds(n);return this.triggerAttack(t,i,s),ni(e)?($s(ni(t),"notes must be an array when duration is array"),t.forEach(((t,n)=>{const s=e[Math.min(n,e.length-1)];this.triggerRelease(t,i+this.toSeconds(s))}))):this.triggerRelease(t,i+this.toSeconds(e)),this}add(t,e,n){if($s(ii(t)||isFinite(t),`note must be a pitch or midi: ${t}`),ii(t)){const s=new Zi(this.context,t).toMidi();this._buffers.add(s,e,n)}else this._buffers.add(t,e,n);return this}get loaded(){return this._buffers.loaded}dispose(){return super.dispose(),this._buffers.dispose(),this._activeSources.forEach((t=>{t.forEach((t=>t.dispose()))})),this._activeSources.clear(),this}}ai([Zr(0)],fo.prototype,"attack",void 0),ai([Zr(0)],fo.prototype,"release",void 0);class _o extends Ji{constructor(){super(gi(_o.getDefaults(),arguments,["callback","value"])),this.name="ToneEvent",this._state=new tr("stopped"),this._startOffset=0;const t=gi(_o.getDefaults(),arguments,["callback","value"]);this._loop=t.loop,this.callback=t.callback,this.value=t.value,this._loopStart=this.toTicks(t.loopStart),this._loopEnd=this.toTicks(t.loopEnd),this._playbackRate=t.playbackRate,this._probability=t.probability,this._humanize=t.humanize,this.mute=t.mute,this._playbackRate=t.playbackRate,this._state.increasing=!0,this._rescheduleEvents()}static getDefaults(){return Object.assign(Ji.getDefaults(),{callback:Pi,humanize:!1,loop:!1,loopEnd:"1m",loopStart:0,mute:!1,playbackRate:1,probability:1,value:null})}_rescheduleEvents(t=-1){this._state.forEachFrom(t,(t=>{let e;if("started"===t.state){-1!==t.id&&this.context.transport.clear(t.id);const n=t.time+Math.round(this.startOffset/this._playbackRate);if(!0===this._loop||Js(this._loop)&&this._loop>1){e=1/0,Js(this._loop)&&(e=this._loop*this._getLoopDuration());const s=this._state.getAfter(n);null!==s&&(e=Math.min(e,s.time-n)),e!==1/0&&(this._state.setStateAtTime("stopped",n+e+1,{id:-1}),e=new mr(this.context,e));const i=new mr(this.context,this._getLoopDuration());t.id=this.context.transport.scheduleRepeat(this._tick.bind(this),i,new mr(this.context,n),e)}else t.id=this.context.transport.schedule(this._tick.bind(this),new mr(this.context,n))}}))}get state(){return this._state.getValueAtTime(this.context.transport.ticks)}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t}get probability(){return this._probability}set probability(t){this._probability=t}get humanize(){return this._humanize}set humanize(t){this._humanize=t}start(t){const e=this.toTicks(t);return"stopped"===this._state.getValueAtTime(e)&&(this._state.add({id:-1,state:"started",time:e}),this._rescheduleEvents(e)),this}stop(t){this.cancel(t);const e=this.toTicks(t);if("started"===this._state.getValueAtTime(e)){this._state.setStateAtTime("stopped",e,{id:-1});const t=this._state.getBefore(e);let n=e;null!==t&&(n=t.time),this._rescheduleEvents(n)}return this}cancel(t){t=vi(t,-1/0);const e=this.toTicks(t);return this._state.forEachFrom(e,(t=>{this.context.transport.clear(t.id)})),this._state.cancel(e),this}_tick(t){const e=this.context.transport.getTicksAtTime(t);if(!this.mute&&"started"===this._state.getValueAtTime(e)){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){let e=.02;ei(this.humanize)||(e=this.toSeconds(this.humanize)),t+=(2*Math.random()-1)*e}this.callback(t,this.value)}}_getLoopDuration(){return Math.round((this._loopEnd-this._loopStart)/this._playbackRate)}get loop(){return this._loop}set loop(t){this._loop=t,this._rescheduleEvents()}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._rescheduleEvents()}get loopEnd(){return new mr(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._rescheduleEvents()}get loopStart(){return new mr(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._rescheduleEvents()}get progress(){if(this._loop){const t=this.context.transport.ticks,e=this._state.get(t);if(null!==e&&"started"===e.state){const n=this._getLoopDuration();return(t-e.time)%n/n}return 0}return 0}dispose(){return super.dispose(),this.cancel(),this._state.dispose(),this}}class mo extends _o{constructor(){super(gi(mo.getDefaults(),arguments,["callback","events"])),this.name="Part",this._state=new tr("stopped"),this._events=new Set;const t=gi(mo.getDefaults(),arguments,["callback","events"]);this._state.increasing=!0,t.events.forEach((t=>{ni(t)?this.add(t[0],t[1]):this.add(t)}))}static getDefaults(){return Object.assign(_o.getDefaults(),{events:[]})}start(t,e){const n=this.toTicks(t);if("started"!==this._state.getValueAtTime(n)){e=vi(e,this._loop?this._loopStart:0),e=this._loop?vi(e,this._loopStart):vi(e,0);const t=this.toTicks(e);this._state.add({id:-1,offset:t,state:"started",time:n}),this._forEach((e=>{this._startNote(e,n,t)}))}return this}_startNote(t,e,n){e-=n,this._loop?t.startOffset>=this._loopStart&&t.startOffset<this._loopEnd?(t.startOffset<n&&(e+=this._getLoopDuration()),t.start(new mr(this.context,e))):t.startOffset<this._loopStart&&t.startOffset>=n&&(t.loop=!1,t.start(new mr(this.context,e))):t.startOffset>=n&&t.start(new mr(this.context,e))}get startOffset(){return this._startOffset}set startOffset(t){this._startOffset=t,this._forEach((t=>{t.startOffset+=this._startOffset}))}stop(t){const e=this.toTicks(t);return this._state.cancel(e),this._state.setStateAtTime("stopped",e),this._forEach((e=>{e.stop(t)})),this}at(t,e){const n=new Ki(this.context,t).toTicks(),s=new mr(this.context,1).toSeconds(),i=this._events.values();let r=i.next();for(;!r.done;){const t=r.value;if(Math.abs(n-t.startOffset)<s)return Ks(e)&&(t.value=e),t;r=i.next()}return Ks(e)?(this.add(t,e),this.at(t)):null}add(t,e){t instanceof Object&&Reflect.has(t,"time")&&(t=(e=t).time);const n=this.toTicks(t);let s;return e instanceof _o?(s=e,s.callback=this._tick.bind(this)):s=new _o({callback:this._tick.bind(this),context:this.context,value:e}),s.startOffset=n,s.set({humanize:this.humanize,loop:this.loop,loopEnd:this.loopEnd,loopStart:this.loopStart,playbackRate:this.playbackRate,probability:this.probability}),this._events.add(s),this._restartEvent(s),this}_restartEvent(t){this._state.forEach((e=>{"started"===e.state?this._startNote(t,e.time,e.offset):t.stop(new mr(this.context,e.time))}))}remove(t,e){return ti(t)&&t.hasOwnProperty("time")&&(t=(e=t).time),t=this.toTicks(t),this._events.forEach((n=>{n.startOffset===t&&(Qs(e)||Ks(e)&&n.value===e)&&(this._events.delete(n),n.dispose())})),this}clear(){return this._forEach((t=>t.dispose())),this._events.clear(),this}cancel(t){return this._forEach((e=>e.cancel(t))),this._state.cancel(this.toTicks(t)),this}_forEach(t){return this._events&&this._events.forEach((e=>{e instanceof mo?e._forEach(t):t(e)})),this}_setAll(t,e){this._forEach((n=>{n[t]=e}))}_tick(t,e){this.mute||this.callback(t,e)}_testLoopBoundries(t){this._loop&&(t.startOffset<this._loopStart||t.startOffset>=this._loopEnd)?t.cancel(0):"stopped"===t.state&&this._restartEvent(t)}get probability(){return this._probability}set probability(t){this._probability=t,this._setAll("probability",t)}get humanize(){return this._humanize}set humanize(t){this._humanize=t,this._setAll("humanize",t)}get loop(){return this._loop}set loop(t){this._loop=t,this._forEach((e=>{e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.loop=t,this._testLoopBoundries(e)}))}get loopEnd(){return new mr(this.context,this._loopEnd).toSeconds()}set loopEnd(t){this._loopEnd=this.toTicks(t),this._loop&&this._forEach((e=>{e.loopEnd=t,this._testLoopBoundries(e)}))}get loopStart(){return new mr(this.context,this._loopStart).toSeconds()}set loopStart(t){this._loopStart=this.toTicks(t),this._loop&&this._forEach((t=>{t.loopStart=this.loopStart,this._testLoopBoundries(t)}))}get playbackRate(){return this._playbackRate}set playbackRate(t){this._playbackRate=t,this._setAll("playbackRate",t)}get length(){return this._events.size}dispose(){return super.dispose(),this.clear(),this}}class go extends nr{constructor(){super(Object.assign(gi(go.getDefaults(),arguments,["fade"]))),this.name="CrossFade",this._panner=this.context.createStereoPanner(),this._split=this.context.createChannelSplitter(2),this._g2a=new Qr({context:this.context}),this.a=new rr({context:this.context,gain:0}),this.b=new rr({context:this.context,gain:0}),this.output=new rr({context:this.context}),this._internalChannels=[this.a,this.b];const t=gi(go.getDefaults(),arguments,["fade"]);this.fade=new ur({context:this.context,units:"normalRange",value:t.fade}),Ni(this,"fade"),this.context.getConstant(1).connect(this._panner),this._panner.connect(this._split),this._panner.channelCount=1,this._panner.channelCountMode="explicit",ir(this._split,this.a.gain,0),ir(this._split,this.b.gain,1),this.fade.chain(this._g2a,this._panner.pan),this.a.connect(this.output),this.b.connect(this.output)}static getDefaults(){return Object.assign(nr.getDefaults(),{fade:.5})}dispose(){return super.dispose(),this.a.dispose(),this.b.dispose(),this.output.dispose(),this.fade.dispose(),this._g2a.dispose(),this._panner.disconnect(),this._split.disconnect(),this}}let vo=class extends nr{constructor(t){super(t),this.name="Effect",this._dryWet=new go({context:this.context}),this.wet=this._dryWet.fade,this.effectSend=new rr({context:this.context}),this.effectReturn=new rr({context:this.context}),this.input=new rr({context:this.context}),this.output=this._dryWet,this.input.fan(this._dryWet.a,this.effectSend),this.effectReturn.connect(this._dryWet.b),this.wet.setValueAtTime(t.wet,0),this._internalChannels=[this.effectReturn,this.effectSend],Ni(this,"wet")}static getDefaults(){return Object.assign(nr.getDefaults(),{wet:1})}connectEffect(t){return this._internalChannels.push(t),this.effectSend.chain(t,this.effectReturn),this}dispose(){return super.dispose(),this._dryWet.dispose(),this.effectSend.dispose(),this.effectReturn.dispose(),this.wet.dispose(),this}};class yo extends nr{constructor(){super(Object.assign(gi(yo.getDefaults(),arguments,["pan"]))),this.name="Panner",this._panner=this.context.createStereoPanner(),this.input=this._panner,this.output=this._panner;const t=gi(yo.getDefaults(),arguments,["pan"]);this.pan=new er({context:this.context,param:this._panner.pan,value:t.pan,minValue:-1,maxValue:1}),this._panner.channelCount=t.channelCount,this._panner.channelCountMode="explicit",Ni(this,"pan")}static getDefaults(){return Object.assign(nr.getDefaults(),{pan:0,channelCount:1})}dispose(){return super.dispose(),this._panner.disconnect(),this.pan.dispose(),this}}const wo="bit-crusher";ho(wo,"\n\tclass BitCrusherWorklet extends SingleIOProcessor {\n\n\t\tstatic get parameterDescriptors() {\n\t\t\treturn [{\n\t\t\t\tname: \"bits\",\n\t\t\t\tdefaultValue: 12,\n\t\t\t\tminValue: 1,\n\t\t\t\tmaxValue: 16,\n\t\t\t\tautomationRate: 'k-rate'\n\t\t\t}];\n\t\t}\n\n\t\tgenerate(input, _channel, parameters) {\n\t\t\tconst step = Math.pow(0.5, parameters.bits - 1);\n\t\t\tconst val = step * Math.floor(input / step + 0.5);\n\t\t\treturn val;\n\t\t}\n\t}\n");let bo=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["bits"])),this.name="BitCrusher";const e=gi(t.getDefaults(),arguments,["bits"]);this._bitCrusherWorklet=new xo({context:this.context,bits:e.bits}),this.connectEffect(this._bitCrusherWorklet),this.bits=this._bitCrusherWorklet.bits}static getDefaults(){return Object.assign(vo.getDefaults(),{bits:4})}dispose(){return super.dispose(),this._bitCrusherWorklet.dispose(),this}};class xo extends po{constructor(){super(gi(xo.getDefaults(),arguments)),this.name="BitCrusherWorklet";const t=gi(xo.getDefaults(),arguments);this.input=new rr({context:this.context}),this.output=new rr({context:this.context}),this.bits=new er({context:this.context,value:t.bits,units:"positive",minValue:1,maxValue:16,param:this._dummyParam,swappable:!0})}static getDefaults(){return Object.assign(po.getDefaults(),{bits:12})}_audioWorkletName(){return wo}onReady(t){sr(this.input,t,this.output);const e=t.parameters.get("bits");this.bits.setParam(e)}dispose(){return super.dispose(),this.input.dispose(),this.output.dispose(),this.bits.dispose(),this}}class To extends nr{constructor(){super(gi(To.getDefaults(),arguments,["channels"])),this.name="Merge";const t=gi(To.getDefaults(),arguments,["channels"]);this._merger=this.output=this.input=this.context.createChannelMerger(t.channels)}static getDefaults(){return Object.assign(nr.getDefaults(),{channels:2})}dispose(){return super.dispose(),this._merger.disconnect(),this}}let Ao=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["distortion"])),this.name="Distortion";const e=gi(t.getDefaults(),arguments,["distortion"]);this._shaper=new Pr({context:this.context,length:4096}),this._distortion=e.distortion,this.connectEffect(this._shaper),this.distortion=e.distortion,this.oversample=e.oversample}static getDefaults(){return Object.assign(vo.getDefaults(),{distortion:.4,oversample:"none"})}get distortion(){return this._distortion}set distortion(t){this._distortion=t;const e=100*t,n=Math.PI/180;this._shaper.setMap((t=>Math.abs(t)<.001?0:(3+e)*t*20*n/(Math.PI+e*Math.abs(t))))}get oversample(){return this._shaper.oversample}set oversample(t){this._shaper.oversample=t}dispose(){return super.dispose(),this._shaper.dispose(),this}};class ko extends vo{constructor(t){super(t),this.name="FeedbackEffect",this._feedbackGain=new rr({context:this.context,gain:t.feedback,units:"normalRange"}),this.feedback=this._feedbackGain.gain,Ni(this,"feedback"),this.effectReturn.chain(this._feedbackGain,this.effectSend)}static getDefaults(){return Object.assign(vo.getDefaults(),{feedback:.125})}dispose(){return super.dispose(),this._feedbackGain.dispose(),this.feedback.dispose(),this}}class Co extends ko{constructor(){super(gi(Co.getDefaults(),arguments,["delayTime","feedback"])),this.name="FeedbackDelay";const t=gi(Co.getDefaults(),arguments,["delayTime","feedback"]);this._delayNode=new fr({context:this.context,delayTime:t.delayTime,maxDelay:t.maxDelay}),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),Ni(this,"delayTime")}static getDefaults(){return Object.assign(ko.getDefaults(),{delayTime:.25,maxDelay:1})}dispose(){return super.dispose(),this._delayNode.dispose(),this.delayTime.dispose(),this}}let So=class t extends vo{constructor(){super(gi(t.getDefaults(),arguments,["decay"])),this.name="Reverb",this._convolver=this.context.createConvolver(),this.ready=Promise.resolve();const e=gi(t.getDefaults(),arguments,["decay"]);this._decay=e.decay,this._preDelay=e.preDelay,this.generate(),this.connectEffect(this._convolver)}static getDefaults(){return Object.assign(vo.getDefaults(),{decay:1.5,preDelay:.01})}get decay(){return this._decay}set decay(t){Gs(t=this.toSeconds(t),.001),this._decay=t,this.generate()}get preDelay(){return this._preDelay}set preDelay(t){Gs(t=this.toSeconds(t),0),this._preDelay=t,this.generate()}generate(){return ui(this,void 0,void 0,(function*(){const t=this.ready,e=new qi(2,this._decay+this._preDelay,this.context.sampleRate),n=new Or({context:e}),s=new Or({context:e}),i=new To({context:e});n.connect(i,0,0),s.connect(i,0,1);const r=new rr({context:e}).toDestination();i.connect(r),n.start(0),s.start(0),r.gain.setValueAtTime(0,0),r.gain.setValueAtTime(1,this._preDelay),r.gain.exponentialApproachValueAtTime(0,this._preDelay,this.decay);const o=e.render();return this.ready=o.then(Pi),yield t,this._convolver.buffer=(yield o).get(),this}))}dispose(){return super.dispose(),this._convolver.disconnect(),this}};class Oo extends nr{constructor(){super(gi(Oo.getDefaults(),arguments,["solo"])),this.name="Solo";const t=gi(Oo.getDefaults(),arguments,["solo"]);this.input=this.output=new rr({context:this.context}),Oo._allSolos.has(this.context)||Oo._allSolos.set(this.context,new Set),Oo._allSolos.get(this.context).add(this),this.solo=t.solo}static getDefaults(){return Object.assign(nr.getDefaults(),{solo:!1})}get solo(){return this._isSoloed()}set solo(t){t?this._addSolo():this._removeSolo(),Oo._allSolos.get(this.context).forEach((t=>t._updateSolo()))}get muted(){return 0===this.input.gain.value}_addSolo(){Oo._soloed.has(this.context)||Oo._soloed.set(this.context,new Set),Oo._soloed.get(this.context).add(this)}_removeSolo(){Oo._soloed.has(this.context)&&Oo._soloed.get(this.context).delete(this)}_isSoloed(){return Oo._soloed.has(this.context)&&Oo._soloed.get(this.context).has(this)}_noSolos(){return!Oo._soloed.has(this.context)||Oo._soloed.has(this.context)&&0===Oo._soloed.get(this.context).size}_updateSolo(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0}dispose(){return super.dispose(),Oo._allSolos.get(this.context).delete(this),this._removeSolo(),this}}Oo._allSolos=new Map,Oo._soloed=new Map;class Mo extends nr{constructor(){super(gi(Mo.getDefaults(),arguments,["pan","volume"])),this.name="PanVol";const t=gi(Mo.getDefaults(),arguments,["pan","volume"]);this._panner=this.input=new yo({context:this.context,pan:t.pan,channelCount:t.channelCount}),this.pan=this._panner.pan,this._volume=this.output=new wr({context:this.context,volume:t.volume}),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=t.mute,Ni(this,["pan","volume"])}static getDefaults(){return Object.assign(nr.getDefaults(),{mute:!1,pan:0,volume:0,channelCount:1})}get mute(){return this._volume.mute}set mute(t){this._volume.mute=t}dispose(){return super.dispose(),this._panner.dispose(),this.pan.dispose(),this._volume.dispose(),this.volume.dispose(),this}}class Eo extends nr{constructor(){super(gi(Eo.getDefaults(),arguments,["volume","pan"])),this.name="Channel";const t=gi(Eo.getDefaults(),arguments,["volume","pan"]);this._solo=this.input=new Oo({solo:t.solo,context:this.context}),this._panVol=this.output=new Mo({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),Ni(this,["pan","volume"])}static getDefaults(){return Object.assign(nr.getDefaults(),{pan:0,volume:0,mute:!1,solo:!1,channelCount:1})}get solo(){return this._solo.solo}set solo(t){this._solo.solo=t}get muted(){return this._solo.muted||this.mute}get mute(){return this._panVol.mute}set mute(t){this._panVol.mute=t}_getBus(t){return Eo.buses.has(t)||Eo.buses.set(t,new rr({context:this.context})),Eo.buses.get(t)}send(t,e=0){const n=this._getBus(t),s=new rr({context:this.context,units:"decibels",gain:e});return this.connect(s),s.connect(n),s}receive(t){return this._getBus(t).connect(this),this}dispose(){return super.dispose(),this._panVol.dispose(),this.pan.dispose(),this.volume.dispose(),this._solo.dispose(),this}}Eo.buses=new Map;class Do extends nr{constructor(){super(...arguments),this.name="Listener",this.positionX=new er({context:this.context,param:this.context.rawContext.listener.positionX}),this.positionY=new er({context:this.context,param:this.context.rawContext.listener.positionY}),this.positionZ=new er({context:this.context,param:this.context.rawContext.listener.positionZ}),this.forwardX=new er({context:this.context,param:this.context.rawContext.listener.forwardX}),this.forwardY=new er({context:this.context,param:this.context.rawContext.listener.forwardY}),this.forwardZ=new er({context:this.context,param:this.context.rawContext.listener.forwardZ}),this.upX=new er({context:this.context,param:this.context.rawContext.listener.upX}),this.upY=new er({context:this.context,param:this.context.rawContext.listener.upY}),this.upZ=new er({context:this.context,param:this.context.rawContext.listener.upZ})}static getDefaults(){return Object.assign(nr.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}}function Io(){return zi().now()}Oi((t=>{t.listener=new Do({context:t})})),Ei((t=>{t.listener.dispose()})),zi().transport,zi().destination,zi().destination,zi().listener,zi().draw,zi();const Ro={C0:16.35,"C#0":17.32,Db0:17.32,D0:18.35,"D#0":19.45,Eb0:19.45,E0:20.6,F0:21.83,"F#0":23.12,Gb0:23.12,G0:24.5,"G#0":25.96,Ab0:25.96,A0:27.5,"A#0":29.14,Bb0:29.14,B0:30.87,C1:32.7,"C#1":34.65,Db1:34.65,D1:36.71,"D#1":38.89,Eb1:38.89,E1:41.2,F1:43.65,"F#1":46.25,Gb1:46.25,G1:49,"G#1":51.91,Ab1:51.91,A1:55,"A#1":58.27,Bb1:58.27,B1:61.74,C2:65.41,"C#2":69.3,Db2:69.3,D2:73.42,"D#2":77.78,Eb2:77.78,E2:82.41,F2:87.31,"F#2":92.5,Gb2:92.5,G2:98,"G#2":103.83,Ab2:103.83,A2:110,"A#2":116.54,Bb2:116.54,B2:123.47,C3:130.81,"C#3":138.59,Db3:138.59,D3:146.83,"D#3":155.56,Eb3:155.56,E3:164.81,F3:174.61,"F#3":185,Gb3:185,G3:196,"G#3":207.65,Ab3:207.65,A3:220,"A#3":233.08,Bb3:233.08,B3:246.94,C4:261.63,"C#4":277.18,Db4:277.18,D4:293.66,"D#4":311.13,Eb4:311.13,E4:329.63,F4:349.23,"F#4":369.99,Gb4:369.99,G4:392,"G#4":415.3,Ab4:415.3,A4:440,"A#4":466.16,Bb4:466.16,B4:493.88,C5:523.25,"C#5":554.37,Db5:554.37,D5:587.33,"D#5":622.25,Eb5:622.25,E5:659.26,F5:698.46,"F#5":739.99,Gb5:739.99,G5:783.99,"G#5":830.61,Ab5:830.61,A5:880,"A#5":932.33,Bb5:932.33,B5:987.77,C6:1046.5,"C#6":1108.73,Db6:1108.73,D6:1174.66,"D#6":1244.51,Eb6:1244.51,E6:1318.51,F6:1396.91,"F#6":1479.98,Gb6:1479.98,G6:1567.98,"G#6":1661.22,Ab6:1661.22,A6:1760,"A#6":1864.66,Bb6:1864.66,B6:1975.53,C7:2093,"C#7":2217.46,Db7:2217.46,D7:2349.32,"D#7":2489.02,Eb7:2489.02,E7:2637.02,F7:2793.83,"F#7":2959.96,Gb7:2959.96,G7:3135.96,"G#7":3322.44,Ab7:3322.44,A7:3520,"A#7":3729.31,Bb7:3729.31,B7:3951.07,C8:4186.01,"C#8":4434.92,Db8:4434.92,D8:4698.64,"D#8":4978.03,Eb8:4978.03},No=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Bo=No.length;class Po{static _notes;name;octave;velocity=1;duration;frequency;constructor(t){"number"==typeof t?this.fromFrequency(t):"string"==typeof t?this.fromString(t):t instanceof MIDIMessageEvent?this.fromEvent(t):this.fromProps(t)}static notes(t=3){return No.map((e=>new Po(`${e}${t}`)))}get isSemi(){return"#"===this.name.slice(-1)}get fullName(){return`${this.name}${this.octave}`}midiData(t=!0){return new Uint8Array([t?144:128,0,100*this.velocity])}get midiNumber(){return 12*(this.octave+2)+this.noteIndex}get noteIndex(){return No.indexOf(this.name)}adjustFrequency(t=0,e=0){if(this.frequency)return this.frequency;let n=this.octave+t;const s=No.indexOf(this.name)+e;let i=s;s>=Bo?(n++,i=s%Bo):s<0&&(n--,i=Bo+i);const r=No[i];return Ro[`${r}${n}`]}valueOf(){return this.fullName}serialize(){return{note:this.fullName,frequency:this.frequency,velocity:this.velocity,duration:this.duration}}fromFrequency(t){this.frequency=t}fromString(t){const e=t.match(/(\w#?)(\d)?/)||[];this.name=e[1],this.octave=e[2]?parseInt(e[2]):1}fromEvent(t){this.name=No[t.data[1]%12],this.octave=Math.floor(t.data[1]/12)-2}fromProps(t){if(Object.assign(this,t),!t.note)throw Error("note props is mandatory");this.fromString(t.note)}}const Vo={128:"noteOff",144:"noteOn",176:"cc"};class qo{note;voiceNo;triggeredAt;_type;data;event;static fromSequence(t,e){return t.notes.map((t=>this.fromNote(t,!0,e)))}static fromNote(t,e=!0,n){const s=t instanceof Po?t:new Po(t),i=new qo(new MIDIMessageEvent("",{data:s.midiData(e)}),n);return i.note=s,i}static fromCC(t,e,n){return new qo(new MIDIMessageEvent("",{data:new Uint8Array([176,t,e])}),n)}constructor(t,e){this.event=t,this.triggeredAt=e||Io(),this.data=t.data,this.defineNotes()}get statusByte(){return this.data[0]}get firstData(){return this.data[1]}get secondData(){return this.data[2]}get type(){if(this._type)return this._type;let t=Vo[240&this.statusByte];return"noteOn"===t&&0===this.secondData&&(t="noteOff"),this._type=t}get isNote(){return"noteOn"===this.type||"noteOff"===this.type}defineNotes(){this.isNote&&(this.note||(this.note=new Po(this.event)))}}class Fo{id;name;state;eventListerCallbacks=[];_midi;constructor(t){this.id=t.id,this.name=t.name||`Device ${t.id}`,this.state=t.state,this._midi=t,this.connect()}connect(){this._midi.onmidimessage=t=>{(t instanceof MIDIMessageEvent||t instanceof qo)&&this.processEvent(t)}}disconnect(){this._midi.onmidimessage=null}serialize(){const{id:t,name:e,state:n}=this;return{id:t,name:e,state:n}}addEventListener(t){this.eventListerCallbacks.push(t)}removeEventListener(t){this.eventListerCallbacks=this.eventListerCallbacks.filter((e=>e!==t))}processEvent(t){const e=t instanceof qo?t:new qo(t);switch(e.type){case"noteOn":case"noteOff":this.eventListerCallbacks.forEach((t=>t(e)))}}}const jo={a:new Po("C3"),s:new Po("D3"),d:new Po("E3"),f:new Po("F3"),g:new Po("G3"),h:new Po("A3"),j:new Po("B3"),k:new Po("C4"),l:new Po("D4"),w:new Po("C#3"),e:new Po("D#3"),t:new Po("F#3"),y:new Po("G#3"),u:new Po("A#3"),o:new Po("C#4"),p:new Po("D#4")},zo={id:"computer_keyboard",name:"Computer Keyboard",state:"connected"};class Wo{id;name;state;onmidimessage;constructor(){Object.assign(this,zo),document.addEventListener("keydown",this.onKeyTrigger(!0)),document.addEventListener("keyup",this.onKeyTrigger(!1))}onKeyTrigger=t=>e=>{if(!this.onmidimessage)return;const n=this.extractNote(e);if(!n)return;const s=qo.fromNote(n,t);this.onmidimessage(s)};extractNote(t){if(!t.repeat)return jo[t.key]}}class Lo{devices={};initialized=!1;computerKeyboardInput;constructor(){this.computerKeyboardInput=new Wo,this.initializeDevices().then((()=>{this.listenChanges(),this.initialized=!0})).catch((()=>{}))}find(t){const e=this.devices[t];return e||null}onStateChange(t){navigator.requestMIDIAccess().then((e=>{e.onstatechange=e=>{if(!(e instanceof MIDIConnectionEvent))return;if(e.port instanceof MIDIOutput)return;const n=e.port,s=new Fo(n);t(s)}})).catch((()=>{}))}listenChanges(){this.onStateChange((t=>{"disconnected"===t.state?(t.disconnect(),delete this.devices[t.id]):this.devices[t.id]=t}))}async initializeDevices(){return this.initialized||(await this.inputs()).forEach((t=>{this.devices[t.id]||(this.devices[t.id]=new Fo(t))})),Object.values(this.devices)}async inputs(){const t=[this.computerKeyboardInput];return(await navigator.requestMIDIAccess()).inputs.forEach((e=>t.push(e))),t}}var Uo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ho(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $o,Go,Xo={exports:{}};
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Lodash <https://lodash.com/>
|
|
@@ -12,13 +12,13 @@ const t="14.7.77",e=(t,e,n)=>({endTime:e,insertTime:n,type:"exponentialRampToVal
|
|
|
12
12
|
* Released under MIT license <https://lodash.com/license>
|
|
13
13
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
14
14
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
15
|
-
*/Lo=Ho,Uo=Ho.exports,function(){var t,e="Expected a function",n="__lodash_hash_undefined__",s="__lodash_placeholder__",i=16,r=32,o=64,a=128,u=256,c=1/0,l=9007199254740991,h=NaN,p=4294967295,d=[["ary",a],["bind",1],["bindKey",2],["curry",8],["curryRight",i],["flip",512],["partial",r],["partialRight",o],["rearg",u]],f="[object Arguments]",_="[object Array]",m="[object Boolean]",g="[object Date]",v="[object Error]",y="[object Function]",w="[object GeneratorFunction]",b="[object Map]",x="[object Number]",T="[object Object]",A="[object Promise]",k="[object RegExp]",C="[object Set]",S="[object String]",O="[object Symbol]",M="[object WeakMap]",E="[object ArrayBuffer]",D="[object DataView]",I="[object Float32Array]",R="[object Float64Array]",N="[object Int8Array]",B="[object Int16Array]",P="[object Int32Array]",V="[object Uint8Array]",q="[object Uint8ClampedArray]",F="[object Uint16Array]",j="[object Uint32Array]",z=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,U=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,$=RegExp(U.source),G=RegExp(H.source),X=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,J=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,et=RegExp(tt.source),nt=/^\s+/,st=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,rt=/\{\n\/\* \[wrapped with (.+)\] \*/,ot=/,? & /,at=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ut=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ht=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,dt=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,_t=/^0o[0-7]+$/i,mt=/^(?:0|[1-9]\d*)$/,gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,yt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",bt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",xt="\\u2700-\\u27bf",Tt="a-z\\xdf-\\xf6\\xf8-\\xff",At="A-Z\\xc0-\\xd6\\xd8-\\xde",kt="\\ufe0e\\ufe0f",Ct="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",St="['’]",Ot="["+wt+"]",Mt="["+Ct+"]",Et="["+bt+"]",Dt="\\d+",It="["+xt+"]",Rt="["+Tt+"]",Nt="[^"+wt+Ct+Dt+xt+Tt+At+"]",Bt="\\ud83c[\\udffb-\\udfff]",Pt="[^"+wt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",qt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ft="["+At+"]",jt="\\u200d",zt="(?:"+Rt+"|"+Nt+")",Wt="(?:"+Ft+"|"+Nt+")",Lt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ut="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ht="(?:"+Et+"|"+Bt+")?",$t="["+kt+"]?",Gt=$t+Ht+"(?:"+jt+"(?:"+[Pt,Vt,qt].join("|")+")"+$t+Ht+")*",Xt="(?:"+[It,Vt,qt].join("|")+")"+Gt,Zt="(?:"+[Pt+Et+"?",Et,Vt,qt,Ot].join("|")+")",Yt=RegExp(St,"g"),Qt=RegExp(Et,"g"),Kt=RegExp(Bt+"(?="+Bt+")|"+Zt+Gt,"g"),Jt=RegExp([Ft+"?"+Rt+"+"+Lt+"(?="+[Mt,Ft,"$"].join("|")+")",Wt+"+"+Ut+"(?="+[Mt,Ft+zt,"$"].join("|")+")",Ft+"?"+zt+"+"+Lt,Ft+"+"+Ut,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Dt,Xt].join("|"),"g"),te=RegExp("["+jt+wt+bt+kt+"]"),ee=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ne=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],se=-1,ie={};ie[I]=ie[R]=ie[N]=ie[B]=ie[P]=ie[V]=ie[q]=ie[F]=ie[j]=!0,ie[f]=ie[_]=ie[E]=ie[m]=ie[D]=ie[g]=ie[v]=ie[y]=ie[b]=ie[x]=ie[T]=ie[k]=ie[C]=ie[S]=ie[M]=!1;var re={};re[f]=re[_]=re[E]=re[D]=re[m]=re[g]=re[I]=re[R]=re[N]=re[B]=re[P]=re[b]=re[x]=re[T]=re[k]=re[C]=re[S]=re[O]=re[V]=re[q]=re[F]=re[j]=!0,re[v]=re[y]=re[M]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ae=parseFloat,ue=parseInt,ce="object"==typeof zo&&zo&&zo.Object===Object&&zo,le="object"==typeof self&&self&&self.Object===Object&&self,he=ce||le||Function("return this")(),pe=Uo&&!Uo.nodeType&&Uo,de=pe&&Lo&&!Lo.nodeType&&Lo,fe=de&&de.exports===pe,_e=fe&&ce.process,me=function(){try{var t=de&&de.require&&de.require("util").types;return t||_e&&_e.binding&&_e.binding("util")}catch(t){}}(),ge=me&&me.isArrayBuffer,ve=me&&me.isDate,ye=me&&me.isMap,we=me&&me.isRegExp,be=me&&me.isSet,xe=me&&me.isTypedArray;function Te(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ae(t,e,n,s){for(var i=-1,r=null==t?0:t.length;++i<r;){var o=t[i];e(s,o,n(o),t)}return s}function ke(t,e){for(var n=-1,s=null==t?0:t.length;++n<s&&!1!==e(t[n],n,t););return t}function Ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Se(t,e){for(var n=-1,s=null==t?0:t.length;++n<s;)if(!e(t[n],n,t))return!1;return!0}function Oe(t,e){for(var n=-1,s=null==t?0:t.length,i=0,r=[];++n<s;){var o=t[n];e(o,n,t)&&(r[i++]=o)}return r}function Me(t,e){return!(null==t||!t.length)&&Fe(t,e,0)>-1}function Ee(t,e,n){for(var s=-1,i=null==t?0:t.length;++s<i;)if(n(e,t[s]))return!0;return!1}function De(t,e){for(var n=-1,s=null==t?0:t.length,i=Array(s);++n<s;)i[n]=e(t[n],n,t);return i}function Ie(t,e){for(var n=-1,s=e.length,i=t.length;++n<s;)t[i+n]=e[n];return t}function Re(t,e,n,s){var i=-1,r=null==t?0:t.length;for(s&&r&&(n=t[++i]);++i<r;)n=e(n,t[i],i,t);return n}function Ne(t,e,n,s){var i=null==t?0:t.length;for(s&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Be(t,e){for(var n=-1,s=null==t?0:t.length;++n<s;)if(e(t[n],n,t))return!0;return!1}var Pe=Le("length");function Ve(t,e,n){var s;return n(t,(function(t,n,i){if(e(t,n,i))return s=n,!1})),s}function qe(t,e,n,s){for(var i=t.length,r=n+(s?1:-1);s?r--:++r<i;)if(e(t[r],r,t))return r;return-1}function Fe(t,e,n){return e==e?function(t,e,n){for(var s=n-1,i=t.length;++s<i;)if(t[s]===e)return s;return-1}(t,e,n):qe(t,ze,n)}function je(t,e,n,s){for(var i=n-1,r=t.length;++i<r;)if(s(t[i],e))return i;return-1}function ze(t){return t!=t}function We(t,e){var n=null==t?0:t.length;return n?$e(t,e)/n:h}function Le(e){return function(n){return null==n?t:n[e]}}function Ue(e){return function(n){return null==e?t:e[n]}}function He(t,e,n,s,i){return i(t,(function(t,i,r){n=s?(s=!1,t):e(n,t,i,r)})),n}function $e(e,n){for(var s,i=-1,r=e.length;++i<r;){var o=n(e[i]);o!==t&&(s=s===t?o:s+o)}return s}function Ge(t,e){for(var n=-1,s=Array(t);++n<t;)s[n]=e(n);return s}function Xe(t){return t?t.slice(0,pn(t)+1).replace(nt,""):t}function Ze(t){return function(e){return t(e)}}function Ye(t,e){return De(e,(function(e){return t[e]}))}function Qe(t,e){return t.has(e)}function Ke(t,e){for(var n=-1,s=t.length;++n<s&&Fe(e,t[n],0)>-1;);return n}function Je(t,e){for(var n=t.length;n--&&Fe(e,t[n],0)>-1;);return n}var tn=Ue({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),en=Ue({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(t){return"\\"+oe[t]}function sn(t){return te.test(t)}function rn(t){var e=-1,n=Array(t.size);return t.forEach((function(t,s){n[++e]=[s,t]})),n}function on(t,e){return function(n){return t(e(n))}}function an(t,e){for(var n=-1,i=t.length,r=0,o=[];++n<i;){var a=t[n];a!==e&&a!==s||(t[n]=s,o[r++]=n)}return o}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function cn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function ln(t){return sn(t)?function(t){for(var e=Kt.lastIndex=0;Kt.test(t);)++e;return e}(t):Pe(t)}function hn(t){return sn(t)?function(t){return t.match(Kt)||[]}(t):function(t){return t.split("")}(t)}function pn(t){for(var e=t.length;e--&&st.test(t.charAt(e)););return e}var dn=Ue({"&":"&","<":"<",">":">",""":'"',"'":"'"}),fn=function st(wt){var bt,xt=(wt=null==wt?he:fn.defaults(he.Object(),wt,fn.pick(he,ne))).Array,Tt=wt.Date,At=wt.Error,kt=wt.Function,Ct=wt.Math,St=wt.Object,Ot=wt.RegExp,Mt=wt.String,Et=wt.TypeError,Dt=xt.prototype,It=kt.prototype,Rt=St.prototype,Nt=wt["__core-js_shared__"],Bt=It.toString,Pt=Rt.hasOwnProperty,Vt=0,qt=(bt=/[^.]+$/.exec(Nt&&Nt.keys&&Nt.keys.IE_PROTO||""))?"Symbol(src)_1."+bt:"",Ft=Rt.toString,jt=Bt.call(St),zt=he._,Wt=Ot("^"+Bt.call(Pt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Lt=fe?wt.Buffer:t,Ut=wt.Symbol,Ht=wt.Uint8Array,$t=Lt?Lt.allocUnsafe:t,Gt=on(St.getPrototypeOf,St),Xt=St.create,Zt=Rt.propertyIsEnumerable,Kt=Dt.splice,te=Ut?Ut.isConcatSpreadable:t,oe=Ut?Ut.iterator:t,ce=Ut?Ut.toStringTag:t,le=function(){try{var t=pr(St,"defineProperty");return t({},"",{}),t}catch(t){}}(),pe=wt.clearTimeout!==he.clearTimeout&&wt.clearTimeout,de=Tt&&Tt.now!==he.Date.now&&Tt.now,_e=wt.setTimeout!==he.setTimeout&&wt.setTimeout,me=Ct.ceil,Pe=Ct.floor,Ue=St.getOwnPropertySymbols,_n=Lt?Lt.isBuffer:t,mn=wt.isFinite,gn=Dt.join,vn=on(St.keys,St),yn=Ct.max,wn=Ct.min,bn=Tt.now,xn=wt.parseInt,Tn=Ct.random,An=Dt.reverse,kn=pr(wt,"DataView"),Cn=pr(wt,"Map"),Sn=pr(wt,"Promise"),On=pr(wt,"Set"),Mn=pr(wt,"WeakMap"),En=pr(St,"create"),Dn=Mn&&new Mn,In={},Rn=qr(kn),Nn=qr(Cn),Bn=qr(Sn),Pn=qr(On),Vn=qr(Mn),qn=Ut?Ut.prototype:t,Fn=qn?qn.valueOf:t,jn=qn?qn.toString:t;function zn(t){if(na(t)&&!Ho(t)&&!(t instanceof Hn)){if(t instanceof Un)return t;if(Pt.call(t,"__wrapped__"))return Fr(t)}return new Un(t)}var Wn=function(){function e(){}return function(n){if(!ea(n))return{};if(Xt)return Xt(n);e.prototype=n;var s=new e;return e.prototype=t,s}}();function Ln(){}function Un(e,n){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=t}function Hn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Gn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Xn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Zn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Xn;++e<n;)this.add(t[e])}function Yn(t){var e=this.__data__=new Gn(t);this.size=e.size}function Qn(t,e){var n=Ho(t),s=!n&&Uo(t),i=!n&&!s&&Zo(t),r=!n&&!s&&!i&&la(t),o=n||s||i||r,a=o?Ge(t.length,Mt):[],u=a.length;for(var c in t)!e&&!Pt.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yr(c,u))||a.push(c);return a}function Kn(e){var n=e.length;return n?e[Zs(0,n-1)]:t}function Jn(t,e){return Br(Ei(t),us(e,0,t.length))}function ts(t){return Br(Ei(t))}function es(e,n,s){(s!==t&&!zo(e[n],s)||s===t&&!(n in e))&&os(e,n,s)}function ns(e,n,s){var i=e[n];Pt.call(e,n)&&zo(i,s)&&(s!==t||n in e)||os(e,n,s)}function ss(t,e){for(var n=t.length;n--;)if(zo(t[n][0],e))return n;return-1}function is(t,e,n,s){return ds(t,(function(t,i,r){e(s,t,n(t),r)})),s}function rs(t,e){return t&&Di(e,Ia(e),t)}function os(t,e,n){"__proto__"==e&&le?le(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function as(e,n){for(var s=-1,i=n.length,r=xt(i),o=null==e;++s<i;)r[s]=o?t:Sa(e,n[s]);return r}function us(e,n,s){return e==e&&(s!==t&&(e=e<=s?e:s),n!==t&&(e=e>=n?e:n)),e}function cs(e,n,s,i,r,o){var a,u=1&n,c=2&n,l=4&n;if(s&&(a=r?s(e,i,r,o):s(e)),a!==t)return a;if(!ea(e))return e;var h=Ho(e);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Pt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(e),!u)return Ei(e,a)}else{var p=_r(e),d=p==y||p==w;if(Zo(e))return Ai(e,u);if(p==T||p==f||d&&!r){if(a=c||d?{}:gr(e),!u)return c?function(t,e){return Di(t,fr(t),e)}(e,function(t,e){return t&&Di(e,Ra(e),t)}(a,e)):function(t,e){return Di(t,dr(t),e)}(e,rs(a,e))}else{if(!re[p])return r?e:{};a=function(t,e,n){var s,i=t.constructor;switch(e){case E:return ki(t);case m:case g:return new i(+t);case D:return function(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case I:case R:case N:case B:case P:case V:case q:case F:case j:return Ci(t,n);case b:return new i;case x:case S:return new i(t);case k:return function(t){var e=new t.constructor(t.source,ht.exec(t));return e.lastIndex=t.lastIndex,e}(t);case C:return new i;case O:return s=t,Fn?St(Fn.call(s)):{}}}(e,p,u)}}o||(o=new Yn);var _=o.get(e);if(_)return _;o.set(e,a),aa(e)?e.forEach((function(t){a.add(cs(t,n,s,t,e,o))})):sa(e)&&e.forEach((function(t,i){a.set(i,cs(t,n,s,i,e,o))}));var v=h?t:(l?c?rr:ir:c?Ra:Ia)(e);return ke(v||e,(function(t,i){v&&(t=e[i=t]),ns(a,i,cs(t,n,s,i,e,o))})),a}function ls(e,n,s){var i=s.length;if(null==e)return!i;for(e=St(e);i--;){var r=s[i],o=n[r],a=e[r];if(a===t&&!(r in e)||!o(a))return!1}return!0}function hs(n,s,i){if("function"!=typeof n)throw new Et(e);return Dr((function(){n.apply(t,i)}),s)}function ps(t,e,n,s){var i=-1,r=Me,o=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=De(e,Ze(n))),s?(r=Ee,o=!1):e.length>=200&&(r=Qe,o=!1,e=new Zn(e));t:for(;++i<a;){var l=t[i],h=null==n?l:n(l);if(l=s||0!==l?l:0,o&&h==h){for(var p=c;p--;)if(e[p]===h)continue t;u.push(l)}else r(e,h,s)||u.push(l)}return u}zn.templateSettings={escape:X,evaluate:Z,interpolate:Y,variable:"",imports:{_:zn}},zn.prototype=Ln.prototype,zn.prototype.constructor=zn,Un.prototype=Wn(Ln.prototype),Un.prototype.constructor=Un,Hn.prototype=Wn(Ln.prototype),Hn.prototype.constructor=Hn,$n.prototype.clear=function(){this.__data__=En?En(null):{},this.size=0},$n.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$n.prototype.get=function(e){var s=this.__data__;if(En){var i=s[e];return i===n?t:i}return Pt.call(s,e)?s[e]:t},$n.prototype.has=function(e){var n=this.__data__;return En?n[e]!==t:Pt.call(n,e)},$n.prototype.set=function(e,s){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=En&&s===t?n:s,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(t){var e=this.__data__,n=ss(e,t);return!(n<0||(n==e.length-1?e.pop():Kt.call(e,n,1),--this.size,0))},Gn.prototype.get=function(e){var n=this.__data__,s=ss(n,e);return s<0?t:n[s][1]},Gn.prototype.has=function(t){return ss(this.__data__,t)>-1},Gn.prototype.set=function(t,e){var n=this.__data__,s=ss(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this},Xn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(Cn||Gn),string:new $n}},Xn.prototype.delete=function(t){var e=lr(this,t).delete(t);return this.size-=e?1:0,e},Xn.prototype.get=function(t){return lr(this,t).get(t)},Xn.prototype.has=function(t){return lr(this,t).has(t)},Xn.prototype.set=function(t,e){var n=lr(this,t),s=n.size;return n.set(t,e),this.size+=n.size==s?0:1,this},Zn.prototype.add=Zn.prototype.push=function(t){return this.__data__.set(t,n),this},Zn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Yn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Yn.prototype.get=function(t){return this.__data__.get(t)},Yn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Gn){var s=n.__data__;if(!Cn||s.length<199)return s.push([t,e]),this.size=++n.size,this;n=this.__data__=new Xn(s)}return n.set(t,e),this.size=n.size,this};var ds=Ni(bs),fs=Ni(xs,!0);function _s(t,e){var n=!0;return ds(t,(function(t,s,i){return n=!!e(t,s,i)})),n}function ms(e,n,s){for(var i=-1,r=e.length;++i<r;){var o=e[i],a=n(o);if(null!=a&&(u===t?a==a&&!ca(a):s(a,u)))var u=a,c=o}return c}function gs(t,e){var n=[];return ds(t,(function(t,s,i){e(t,s,i)&&n.push(t)})),n}function vs(t,e,n,s,i){var r=-1,o=t.length;for(n||(n=vr),i||(i=[]);++r<o;){var a=t[r];e>0&&n(a)?e>1?vs(a,e-1,n,s,i):Ie(i,a):s||(i[i.length]=a)}return i}var ys=Bi(),ws=Bi(!0);function bs(t,e){return t&&ys(t,e,Ia)}function xs(t,e){return t&&ws(t,e,Ia)}function Ts(t,e){return Oe(e,(function(e){return Ko(t[e])}))}function As(e,n){for(var s=0,i=(n=wi(n,e)).length;null!=e&&s<i;)e=e[Vr(n[s++])];return s&&s==i?e:t}function ks(t,e,n){var s=e(t);return Ho(t)?s:Ie(s,n(t))}function Cs(e){return null==e?e===t?"[object Undefined]":"[object Null]":ce&&ce in St(e)?function(e){var n=Pt.call(e,ce),s=e[ce];try{e[ce]=t;var i=!0}catch(t){}var r=Ft.call(e);return i&&(n?e[ce]=s:delete e[ce]),r}(e):function(t){return Ft.call(t)}(e)}function Ss(t,e){return t>e}function Os(t,e){return null!=t&&Pt.call(t,e)}function Ms(t,e){return null!=t&&e in St(t)}function Es(e,n,s){for(var i=s?Ee:Me,r=e[0].length,o=e.length,a=o,u=xt(o),c=1/0,l=[];a--;){var h=e[a];a&&n&&(h=De(h,Ze(n))),c=wn(h.length,c),u[a]=!s&&(n||r>=120&&h.length>=120)?new Zn(a&&h):t}h=e[0];var p=-1,d=u[0];t:for(;++p<r&&l.length<c;){var f=h[p],_=n?n(f):f;if(f=s||0!==f?f:0,!(d?Qe(d,_):i(l,_,s))){for(a=o;--a;){var m=u[a];if(!(m?Qe(m,_):i(e[a],_,s)))continue t}d&&d.push(_),l.push(f)}}return l}function Ds(e,n,s){var i=null==(e=Or(e,n=wi(n,e)))?e:e[Vr(Yr(n))];return null==i?t:Te(i,e,s)}function Is(t){return na(t)&&Cs(t)==f}function Rs(e,n,s,i,r){return e===n||(null==e||null==n||!na(e)&&!na(n)?e!=e&&n!=n:function(e,n,s,i,r,o){var a=Ho(e),u=Ho(n),c=a?_:_r(e),l=u?_:_r(n),h=(c=c==f?T:c)==T,p=(l=l==f?T:l)==T,d=c==l;if(d&&Zo(e)){if(!Zo(n))return!1;a=!0,h=!1}if(d&&!h)return o||(o=new Yn),a||la(e)?nr(e,n,s,i,r,o):function(t,e,n,s,i,r,o){switch(n){case D:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case E:return!(t.byteLength!=e.byteLength||!r(new Ht(t),new Ht(e)));case m:case g:case x:return zo(+t,+e);case v:return t.name==e.name&&t.message==e.message;case k:case S:return t==e+"";case b:var a=rn;case C:var u=1&s;if(a||(a=un),t.size!=e.size&&!u)return!1;var c=o.get(t);if(c)return c==e;s|=2,o.set(t,e);var l=nr(a(t),a(e),s,i,r,o);return o.delete(t),l;case O:if(Fn)return Fn.call(t)==Fn.call(e)}return!1}(e,n,c,s,i,r,o);if(!(1&s)){var y=h&&Pt.call(e,"__wrapped__"),w=p&&Pt.call(n,"__wrapped__");if(y||w){var A=y?e.value():e,M=w?n.value():n;return o||(o=new Yn),r(A,M,s,i,o)}}return!!d&&(o||(o=new Yn),function(e,n,s,i,r,o){var a=1&s,u=ir(e),c=u.length,l=ir(n),h=l.length;if(c!=h&&!a)return!1;for(var p=c;p--;){var d=u[p];if(!(a?d in n:Pt.call(n,d)))return!1}var f=o.get(e),_=o.get(n);if(f&&_)return f==n&&_==e;var m=!0;o.set(e,n),o.set(n,e);for(var g=a;++p<c;){var v=e[d=u[p]],y=n[d];if(i)var w=a?i(y,v,d,n,e,o):i(v,y,d,e,n,o);if(!(w===t?v===y||r(v,y,s,i,o):w)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var b=e.constructor,x=n.constructor;b==x||!("constructor"in e)||!("constructor"in n)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(m=!1)}return o.delete(e),o.delete(n),m}(e,n,s,i,r,o))}(e,n,s,i,Rs,r))}function Ns(e,n,s,i){var r=s.length,o=r,a=!i;if(null==e)return!o;for(e=St(e);r--;){var u=s[r];if(a&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++r<o;){var c=(u=s[r])[0],l=e[c],h=u[1];if(a&&u[2]){if(l===t&&!(c in e))return!1}else{var p=new Yn;if(i)var d=i(l,h,c,e,n,p);if(!(d===t?Rs(h,l,3,i,p):d))return!1}}return!0}function Bs(t){return!(!ea(t)||(e=t,qt&&qt in e))&&(Ko(t)?Wt:ft).test(qr(t));var e}function Ps(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?Ho(t)?Ws(t[0],t[1]):zs(t):du(t)}function Vs(t){if(!Ar(t))return vn(t);var e=[];for(var n in St(t))Pt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function qs(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in St(t))e.push(n);return e}(t);var e=Ar(t),n=[];for(var s in t)("constructor"!=s||!e&&Pt.call(t,s))&&n.push(s);return n}function Fs(t,e){return t<e}function js(t,e){var n=-1,s=Go(t)?xt(t.length):[];return ds(t,(function(t,i,r){s[++n]=e(t,i,r)})),s}function zs(t){var e=hr(t);return 1==e.length&&e[0][2]?Cr(e[0][0],e[0][1]):function(n){return n===t||Ns(n,t,e)}}function Ws(e,n){return br(e)&&kr(n)?Cr(Vr(e),n):function(s){var i=Sa(s,e);return i===t&&i===n?Oa(s,e):Rs(n,i,3)}}function Ls(e,n,s,i,r){e!==n&&ys(n,(function(o,a){if(r||(r=new Yn),ea(o))!function(e,n,s,i,r,o,a){var u=Mr(e,s),c=Mr(n,s),l=a.get(c);if(l)es(e,s,l);else{var h=o?o(u,c,s+"",e,n,a):t,p=h===t;if(p){var d=Ho(c),f=!d&&Zo(c),_=!d&&!f&&la(c);h=c,d||f||_?Ho(u)?h=u:Xo(u)?h=Ei(u):f?(p=!1,h=Ai(c,!0)):_?(p=!1,h=Ci(c,!0)):h=[]:ra(c)||Uo(c)?(h=u,Uo(u)?h=va(u):ea(u)&&!Ko(u)||(h=gr(c))):p=!1}p&&(a.set(c,h),r(h,c,i,o,a),a.delete(c)),es(e,s,h)}}(e,n,a,s,Ls,i,r);else{var u=i?i(Mr(e,a),o,a+"",e,n,r):t;u===t&&(u=o),es(e,a,u)}}),Ra)}function Us(e,n){var s=e.length;if(s)return yr(n+=n<0?s:0,s)?e[n]:t}function Hs(t,e,n){e=e.length?De(e,(function(t){return Ho(t)?function(e){return As(e,1===t.length?t[0]:t)}:t})):[iu];var s=-1;e=De(e,Ze(cr()));var i=js(t,(function(t,n,i){var r=De(e,(function(e){return e(t)}));return{criteria:r,index:++s,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){for(var s=-1,i=t.criteria,r=e.criteria,o=i.length,a=n.length;++s<o;){var u=Si(i[s],r[s]);if(u)return s>=a?u:u*("desc"==n[s]?-1:1)}return t.index-e.index}(t,e,n)}))}function $s(t,e,n){for(var s=-1,i=e.length,r={};++s<i;){var o=e[s],a=As(t,o);n(a,o)&&ti(r,wi(o,t),a)}return r}function Gs(t,e,n,s){var i=s?je:Fe,r=-1,o=e.length,a=t;for(t===e&&(e=Ei(e)),n&&(a=De(t,Ze(n)));++r<o;)for(var u=0,c=e[r],l=n?n(c):c;(u=i(a,l,u,s))>-1;)a!==t&&Kt.call(a,u,1),Kt.call(t,u,1);return t}function Xs(t,e){for(var n=t?e.length:0,s=n-1;n--;){var i=e[n];if(n==s||i!==r){var r=i;yr(i)?Kt.call(t,i,1):pi(t,i)}}return t}function Zs(t,e){return t+Pe(Tn()*(e-t+1))}function Ys(t,e){var n="";if(!t||e<1||e>l)return n;do{e%2&&(n+=t),(e=Pe(e/2))&&(t+=t)}while(e);return n}function Qs(t,e){return Ir(Sr(t,e,iu),t+"")}function Ks(t){return Kn(za(t))}function Js(t,e){var n=za(t);return Br(n,us(e,0,n.length))}function ti(e,n,s,i){if(!ea(e))return e;for(var r=-1,o=(n=wi(n,e)).length,a=o-1,u=e;null!=u&&++r<o;){var c=Vr(n[r]),l=s;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(r!=a){var h=u[c];(l=i?i(h,c,u):t)===t&&(l=ea(h)?h:yr(n[r+1])?[]:{})}ns(u,c,l),u=u[c]}return e}var ei=Dn?function(t,e){return Dn.set(t,e),t}:iu,ni=le?function(t,e){return le(t,"toString",{configurable:!0,enumerable:!1,value:eu(e),writable:!0})}:iu;function si(t){return Br(za(t))}function ii(t,e,n){var s=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=xt(i);++s<i;)r[s]=t[s+e];return r}function ri(t,e){var n;return ds(t,(function(t,s,i){return!(n=e(t,s,i))})),!!n}function oi(t,e,n){var s=0,i=null==t?s:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;s<i;){var r=s+i>>>1,o=t[r];null!==o&&!ca(o)&&(n?o<=e:o<e)?s=r+1:i=r}return i}return ai(t,e,iu,n)}function ai(e,n,s,i){var r=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(n=s(n))!=n,u=null===n,c=ca(n),l=n===t;r<o;){var h=Pe((r+o)/2),p=s(e[h]),d=p!==t,f=null===p,_=p==p,m=ca(p);if(a)var g=i||_;else g=l?_&&(i||d):u?_&&d&&(i||!f):c?_&&d&&!f&&(i||!m):!f&&!m&&(i?p<=n:p<n);g?r=h+1:o=h}return wn(o,4294967294)}function ui(t,e){for(var n=-1,s=t.length,i=0,r=[];++n<s;){var o=t[n],a=e?e(o):o;if(!n||!zo(a,u)){var u=a;r[i++]=0===o?0:o}}return r}function ci(t){return"number"==typeof t?t:ca(t)?h:+t}function li(t){if("string"==typeof t)return t;if(Ho(t))return De(t,li)+"";if(ca(t))return jn?jn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hi(t,e,n){var s=-1,i=Me,r=t.length,o=!0,a=[],u=a;if(n)o=!1,i=Ee;else if(r>=200){var c=e?null:Yi(t);if(c)return un(c);o=!1,i=Qe,u=new Zn}else u=e?[]:a;t:for(;++s<r;){var l=t[s],h=e?e(l):l;if(l=n||0!==l?l:0,o&&h==h){for(var p=u.length;p--;)if(u[p]===h)continue t;e&&u.push(h),a.push(l)}else i(u,h,n)||(u!==a&&u.push(h),a.push(l))}return a}function pi(t,e){return null==(t=Or(t,e=wi(e,t)))||delete t[Vr(Yr(e))]}function di(t,e,n,s){return ti(t,e,n(As(t,e)),s)}function fi(t,e,n,s){for(var i=t.length,r=s?i:-1;(s?r--:++r<i)&&e(t[r],r,t););return n?ii(t,s?0:r,s?r+1:i):ii(t,s?r+1:0,s?i:r)}function _i(t,e){var n=t;return n instanceof Hn&&(n=n.value()),Re(e,(function(t,e){return e.func.apply(e.thisArg,Ie([t],e.args))}),n)}function mi(t,e,n){var s=t.length;if(s<2)return s?hi(t[0]):[];for(var i=-1,r=xt(s);++i<s;)for(var o=t[i],a=-1;++a<s;)a!=i&&(r[i]=ps(r[i]||o,t[a],e,n));return hi(vs(r,1),e,n)}function gi(e,n,s){for(var i=-1,r=e.length,o=n.length,a={};++i<r;){var u=i<o?n[i]:t;s(a,e[i],u)}return a}function vi(t){return Xo(t)?t:[]}function yi(t){return"function"==typeof t?t:iu}function wi(t,e){return Ho(t)?t:br(t,e)?[t]:Pr(ya(t))}var bi=Qs;function xi(e,n,s){var i=e.length;return s=s===t?i:s,!n&&s>=i?e:ii(e,n,s)}var Ti=pe||function(t){return he.clearTimeout(t)};function Ai(t,e){if(e)return t.slice();var n=t.length,s=$t?$t(n):new t.constructor(n);return t.copy(s),s}function ki(t){var e=new t.constructor(t.byteLength);return new Ht(e).set(new Ht(t)),e}function Ci(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Si(e,n){if(e!==n){var s=e!==t,i=null===e,r=e==e,o=ca(e),a=n!==t,u=null===n,c=n==n,l=ca(n);if(!u&&!l&&!o&&e>n||o&&a&&c&&!u&&!l||i&&a&&c||!s&&c||!r)return 1;if(!i&&!o&&!l&&e<n||l&&s&&r&&!i&&!o||u&&s&&r||!a&&r||!c)return-1}return 0}function Oi(t,e,n,s){for(var i=-1,r=t.length,o=n.length,a=-1,u=e.length,c=yn(r-o,0),l=xt(u+c),h=!s;++a<u;)l[a]=e[a];for(;++i<o;)(h||i<r)&&(l[n[i]]=t[i]);for(;c--;)l[a++]=t[i++];return l}function Mi(t,e,n,s){for(var i=-1,r=t.length,o=-1,a=n.length,u=-1,c=e.length,l=yn(r-a,0),h=xt(l+c),p=!s;++i<l;)h[i]=t[i];for(var d=i;++u<c;)h[d+u]=e[u];for(;++o<a;)(p||i<r)&&(h[d+n[o]]=t[i++]);return h}function Ei(t,e){var n=-1,s=t.length;for(e||(e=xt(s));++n<s;)e[n]=t[n];return e}function Di(e,n,s,i){var r=!s;s||(s={});for(var o=-1,a=n.length;++o<a;){var u=n[o],c=i?i(s[u],e[u],u,s,e):t;c===t&&(c=e[u]),r?os(s,u,c):ns(s,u,c)}return s}function Ii(t,e){return function(n,s){var i=Ho(n)?Ae:is,r=e?e():{};return i(n,t,cr(s,2),r)}}function Ri(e){return Qs((function(n,s){var i=-1,r=s.length,o=r>1?s[r-1]:t,a=r>2?s[2]:t;for(o=e.length>3&&"function"==typeof o?(r--,o):t,a&&wr(s[0],s[1],a)&&(o=r<3?t:o,r=1),n=St(n);++i<r;){var u=s[i];u&&e(n,u,i,o)}return n}))}function Ni(t,e){return function(n,s){if(null==n)return n;if(!Go(n))return t(n,s);for(var i=n.length,r=e?i:-1,o=St(n);(e?r--:++r<i)&&!1!==s(o[r],r,o););return n}}function Bi(t){return function(e,n,s){for(var i=-1,r=St(e),o=s(e),a=o.length;a--;){var u=o[t?a:++i];if(!1===n(r[u],u,r))break}return e}}function Pi(e){return function(n){var s=sn(n=ya(n))?hn(n):t,i=s?s[0]:n.charAt(0),r=s?xi(s,1).join(""):n.slice(1);return i[e]()+r}}function Vi(t){return function(e){return Re(Ka(Ua(e).replace(Yt,"")),t,"")}}function qi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Wn(t.prototype),s=t.apply(n,e);return ea(s)?s:n}}function Fi(e){return function(n,s,i){var r=St(n);if(!Go(n)){var o=cr(s,3);n=Ia(n),s=function(t){return o(r[t],t,r)}}var a=e(n,s,i);return a>-1?r[o?n[a]:a]:t}}function ji(n){return sr((function(s){var i=s.length,r=i,o=Un.prototype.thru;for(n&&s.reverse();r--;){var a=s[r];if("function"!=typeof a)throw new Et(e);if(o&&!u&&"wrapper"==ar(a))var u=new Un([],!0)}for(r=u?r:i;++r<i;){var c=ar(a=s[r]),l="wrapper"==c?or(a):t;u=l&&xr(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ar(l[0])].apply(u,l[3]):1==a.length&&xr(a)?u[c]():u.thru(a)}return function(){var t=arguments,e=t[0];if(u&&1==t.length&&Ho(e))return u.plant(e).value();for(var n=0,r=i?s[n].apply(this,t):e;++n<i;)r=s[n].call(this,r);return r}}))}function zi(e,n,s,i,r,o,u,c,l,h){var p=n&a,d=1&n,f=2&n,_=24&n,m=512&n,g=f?t:qi(e);return function a(){for(var v=arguments.length,y=xt(v),w=v;w--;)y[w]=arguments[w];if(_)var b=ur(a),x=function(t,e){for(var n=t.length,s=0;n--;)t[n]===e&&++s;return s}(y,b);if(i&&(y=Oi(y,i,r,_)),o&&(y=Mi(y,o,u,_)),v-=x,_&&v<h){var T=an(y,b);return Xi(e,n,zi,a.placeholder,s,y,T,c,l,h-v)}var A=d?s:this,k=f?A[e]:e;return v=y.length,c?y=function(e,n){for(var s=e.length,i=wn(n.length,s),r=Ei(e);i--;){var o=n[i];e[i]=yr(o,s)?r[o]:t}return e}(y,c):m&&v>1&&y.reverse(),p&&l<v&&(y.length=l),this&&this!==he&&this instanceof a&&(k=g||qi(k)),k.apply(A,y)}}function Wi(t,e){return function(n,s){return function(t,e,n,s){return bs(t,(function(t,i,r){e(s,n(t),i,r)})),s}(n,t,e(s),{})}}function Li(e,n){return function(s,i){var r;if(s===t&&i===t)return n;if(s!==t&&(r=s),i!==t){if(r===t)return i;"string"==typeof s||"string"==typeof i?(s=li(s),i=li(i)):(s=ci(s),i=ci(i)),r=e(s,i)}return r}}function Ui(t){return sr((function(e){return e=De(e,Ze(cr())),Qs((function(n){var s=this;return t(e,(function(t){return Te(t,s,n)}))}))}))}function Hi(e,n){var s=(n=n===t?" ":li(n)).length;if(s<2)return s?Ys(n,e):n;var i=Ys(n,me(e/ln(n)));return sn(n)?xi(hn(i),0,e).join(""):i.slice(0,e)}function $i(e){return function(n,s,i){return i&&"number"!=typeof i&&wr(n,s,i)&&(s=i=t),n=fa(n),s===t?(s=n,n=0):s=fa(s),function(t,e,n,s){for(var i=-1,r=yn(me((e-t)/(n||1)),0),o=xt(r);r--;)o[s?r:++i]=t,t+=n;return o}(n,s,i=i===t?n<s?1:-1:fa(i),e)}}function Gi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ga(e),n=ga(n)),t(e,n)}}function Xi(e,n,s,i,a,u,c,l,h,p){var d=8&n;n|=d?r:o,4&(n&=~(d?o:r))||(n&=-4);var f=[e,n,a,d?u:t,d?c:t,d?t:u,d?t:c,l,h,p],_=s.apply(t,f);return xr(e)&&Er(_,f),_.placeholder=i,Rr(_,e,n)}function Zi(t){var e=Ct[t];return function(t,n){if(t=ga(t),(n=null==n?0:wn(_a(n),292))&&mn(t)){var s=(ya(t)+"e").split("e");return+((s=(ya(e(s[0]+"e"+(+s[1]+n)))+"e").split("e"))[0]+"e"+(+s[1]-n))}return e(t)}}var Yi=On&&1/un(new On([,-0]))[1]==c?function(t){return new On(t)}:cu;function Qi(t){return function(e){var n=_r(e);return n==b?rn(e):n==C?cn(e):function(t,e){return De(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Ki(n,c,l,h,p,d,f,_){var m=2&c;if(!m&&"function"!=typeof n)throw new Et(e);var g=h?h.length:0;if(g||(c&=-97,h=p=t),f=f===t?f:yn(_a(f),0),_=_===t?_:_a(_),g-=p?p.length:0,c&o){var v=h,y=p;h=p=t}var w=m?t:or(n),b=[n,c,l,h,p,v,y,d,f,_];if(w&&function(t,e){var n=t[1],i=e[1],r=n|i,o=r<131,c=i==a&&8==n||i==a&&n==u&&t[7].length<=e[8]||384==i&&e[7].length<=e[8]&&8==n;if(!o&&!c)return t;1&i&&(t[2]=e[2],r|=1&n?0:4);var l=e[3];if(l){var h=t[3];t[3]=h?Oi(h,l,e[4]):l,t[4]=h?an(t[3],s):e[4]}(l=e[5])&&(h=t[5],t[5]=h?Mi(h,l,e[6]):l,t[6]=h?an(t[5],s):e[6]),(l=e[7])&&(t[7]=l),i&a&&(t[8]=null==t[8]?e[8]:wn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=r}(b,w),n=b[0],c=b[1],l=b[2],h=b[3],p=b[4],!(_=b[9]=b[9]===t?m?0:n.length:yn(b[9]-g,0))&&24&c&&(c&=-25),c&&1!=c)x=8==c||c==i?function(e,n,s){var i=qi(e);return function r(){for(var o=arguments.length,a=xt(o),u=o,c=ur(r);u--;)a[u]=arguments[u];var l=o<3&&a[0]!==c&&a[o-1]!==c?[]:an(a,c);return(o-=l.length)<s?Xi(e,n,zi,r.placeholder,t,a,l,t,t,s-o):Te(this&&this!==he&&this instanceof r?i:e,this,a)}}(n,c,_):c!=r&&33!=c||p.length?zi.apply(t,b):function(t,e,n,s){var i=1&e,r=qi(t);return function e(){for(var o=-1,a=arguments.length,u=-1,c=s.length,l=xt(c+a),h=this&&this!==he&&this instanceof e?r:t;++u<c;)l[u]=s[u];for(;a--;)l[u++]=arguments[++o];return Te(h,i?n:this,l)}}(n,c,l,h);else var x=function(t,e,n){var s=1&e,i=qi(t);return function e(){return(this&&this!==he&&this instanceof e?i:t).apply(s?n:this,arguments)}}(n,c,l);return Rr((w?ei:Er)(x,b),n,c)}function Ji(e,n,s,i){return e===t||zo(e,Rt[s])&&!Pt.call(i,s)?n:e}function tr(e,n,s,i,r,o){return ea(e)&&ea(n)&&(o.set(n,e),Ls(e,n,t,tr,o),o.delete(n)),e}function er(e){return ra(e)?t:e}function nr(e,n,s,i,r,o){var a=1&s,u=e.length,c=n.length;if(u!=c&&!(a&&c>u))return!1;var l=o.get(e),h=o.get(n);if(l&&h)return l==n&&h==e;var p=-1,d=!0,f=2&s?new Zn:t;for(o.set(e,n),o.set(n,e);++p<u;){var _=e[p],m=n[p];if(i)var g=a?i(m,_,p,n,e,o):i(_,m,p,e,n,o);if(g!==t){if(g)continue;d=!1;break}if(f){if(!Be(n,(function(t,e){if(!Qe(f,e)&&(_===t||r(_,t,s,i,o)))return f.push(e)}))){d=!1;break}}else if(_!==m&&!r(_,m,s,i,o)){d=!1;break}}return o.delete(e),o.delete(n),d}function sr(e){return Ir(Sr(e,t,Hr),e+"")}function ir(t){return ks(t,Ia,dr)}function rr(t){return ks(t,Ra,fr)}var or=Dn?function(t){return Dn.get(t)}:cu;function ar(t){for(var e=t.name+"",n=In[e],s=Pt.call(In,e)?n.length:0;s--;){var i=n[s],r=i.func;if(null==r||r==t)return i.name}return e}function ur(t){return(Pt.call(zn,"placeholder")?zn:t).placeholder}function cr(){var t=zn.iteratee||ru;return t=t===ru?Ps:t,arguments.length?t(arguments[0],arguments[1]):t}function lr(t,e){var n,s,i=t.__data__;return("string"==(s=typeof(n=e))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function hr(t){for(var e=Ia(t),n=e.length;n--;){var s=e[n],i=t[s];e[n]=[s,i,kr(i)]}return e}function pr(e,n){var s=function(e,n){return null==e?t:e[n]}(e,n);return Bs(s)?s:t}var dr=Ue?function(t){return null==t?[]:(t=St(t),Oe(Ue(t),(function(e){return Zt.call(t,e)})))}:mu,fr=Ue?function(t){for(var e=[];t;)Ie(e,dr(t)),t=Gt(t);return e}:mu,_r=Cs;function mr(t,e,n){for(var s=-1,i=(e=wi(e,t)).length,r=!1;++s<i;){var o=Vr(e[s]);if(!(r=null!=t&&n(t,o)))break;t=t[o]}return r||++s!=i?r:!!(i=null==t?0:t.length)&&ta(i)&&yr(o,i)&&(Ho(t)||Uo(t))}function gr(t){return"function"!=typeof t.constructor||Ar(t)?{}:Wn(Gt(t))}function vr(t){return Ho(t)||Uo(t)||!!(te&&t&&t[te])}function yr(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&&mt.test(t))&&t>-1&&t%1==0&&t<e}function wr(t,e,n){if(!ea(n))return!1;var s=typeof e;return!!("number"==s?Go(n)&&yr(e,n.length):"string"==s&&e in n)&&zo(n[e],t)}function br(t,e){if(Ho(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||K.test(t)||!Q.test(t)||null!=e&&t in St(e)}function xr(t){var e=ar(t),n=zn[e];if("function"!=typeof n||!(e in Hn.prototype))return!1;if(t===n)return!0;var s=or(n);return!!s&&t===s[0]}(kn&&_r(new kn(new ArrayBuffer(1)))!=D||Cn&&_r(new Cn)!=b||Sn&&_r(Sn.resolve())!=A||On&&_r(new On)!=C||Mn&&_r(new Mn)!=M)&&(_r=function(e){var n=Cs(e),s=n==T?e.constructor:t,i=s?qr(s):"";if(i)switch(i){case Rn:return D;case Nn:return b;case Bn:return A;case Pn:return C;case Vn:return M}return n});var Tr=Nt?Ko:gu;function Ar(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Rt)}function kr(t){return t==t&&!ea(t)}function Cr(e,n){return function(s){return null!=s&&s[e]===n&&(n!==t||e in St(s))}}function Sr(e,n,s){return n=yn(n===t?e.length-1:n,0),function(){for(var t=arguments,i=-1,r=yn(t.length-n,0),o=xt(r);++i<r;)o[i]=t[n+i];i=-1;for(var a=xt(n+1);++i<n;)a[i]=t[i];return a[n]=s(o),Te(e,this,a)}}function Or(t,e){return e.length<2?t:As(t,ii(e,0,-1))}function Mr(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Er=Nr(ei),Dr=_e||function(t,e){return he.setTimeout(t,e)},Ir=Nr(ni);function Rr(t,e,n){var s=e+"";return Ir(t,function(t,e){var n=e.length;if(!n)return t;var s=n-1;return e[s]=(n>1?"& ":"")+e[s],e=e.join(n>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+e+"] */\n")}(s,function(t,e){return ke(d,(function(n){var s="_."+n[0];e&n[1]&&!Me(t,s)&&t.push(s)})),t.sort()}(function(t){var e=t.match(rt);return e?e[1].split(ot):[]}(s),n)))}function Nr(e){var n=0,s=0;return function(){var i=bn(),r=16-(i-s);if(s=i,r>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(t,arguments)}}function Br(e,n){var s=-1,i=e.length,r=i-1;for(n=n===t?i:n;++s<n;){var o=Zs(s,r),a=e[o];e[o]=e[s],e[s]=a}return e.length=n,e}var Pr=function(t){var e=Bo(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(J,(function(t,n,s,i){e.push(s?i.replace(ct,"$1"):n||t)})),e}));function Vr(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function qr(t){if(null!=t){try{return Bt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fr(t){if(t instanceof Hn)return t.clone();var e=new Un(t.__wrapped__,t.__chain__);return e.__actions__=Ei(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var jr=Qs((function(t,e){return Xo(t)?ps(t,vs(e,1,Xo,!0)):[]})),zr=Qs((function(e,n){var s=Yr(n);return Xo(s)&&(s=t),Xo(e)?ps(e,vs(n,1,Xo,!0),cr(s,2)):[]})),Wr=Qs((function(e,n){var s=Yr(n);return Xo(s)&&(s=t),Xo(e)?ps(e,vs(n,1,Xo,!0),t,s):[]}));function Lr(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var i=null==n?0:_a(n);return i<0&&(i=yn(s+i,0)),qe(t,cr(e,3),i)}function Ur(e,n,s){var i=null==e?0:e.length;if(!i)return-1;var r=i-1;return s!==t&&(r=_a(s),r=s<0?yn(i+r,0):wn(r,i-1)),qe(e,cr(n,3),r,!0)}function Hr(t){return null!=t&&t.length?vs(t,1):[]}function $r(e){return e&&e.length?e[0]:t}var Gr=Qs((function(t){var e=De(t,vi);return e.length&&e[0]===t[0]?Es(e):[]})),Xr=Qs((function(e){var n=Yr(e),s=De(e,vi);return n===Yr(s)?n=t:s.pop(),s.length&&s[0]===e[0]?Es(s,cr(n,2)):[]})),Zr=Qs((function(e){var n=Yr(e),s=De(e,vi);return(n="function"==typeof n?n:t)&&s.pop(),s.length&&s[0]===e[0]?Es(s,t,n):[]}));function Yr(e){var n=null==e?0:e.length;return n?e[n-1]:t}var Qr=Qs(Kr);function Kr(t,e){return t&&t.length&&e&&e.length?Gs(t,e):t}var Jr=sr((function(t,e){var n=null==t?0:t.length,s=as(t,e);return Xs(t,De(e,(function(t){return yr(t,n)?+t:t})).sort(Si)),s}));function to(t){return null==t?t:An.call(t)}var eo=Qs((function(t){return hi(vs(t,1,Xo,!0))})),no=Qs((function(e){var n=Yr(e);return Xo(n)&&(n=t),hi(vs(e,1,Xo,!0),cr(n,2))})),so=Qs((function(e){var n=Yr(e);return n="function"==typeof n?n:t,hi(vs(e,1,Xo,!0),t,n)}));function io(t){if(!t||!t.length)return[];var e=0;return t=Oe(t,(function(t){if(Xo(t))return e=yn(t.length,e),!0})),Ge(e,(function(e){return De(t,Le(e))}))}function ro(e,n){if(!e||!e.length)return[];var s=io(e);return null==n?s:De(s,(function(e){return Te(n,t,e)}))}var oo=Qs((function(t,e){return Xo(t)?ps(t,e):[]})),ao=Qs((function(t){return mi(Oe(t,Xo))})),uo=Qs((function(e){var n=Yr(e);return Xo(n)&&(n=t),mi(Oe(e,Xo),cr(n,2))})),co=Qs((function(e){var n=Yr(e);return n="function"==typeof n?n:t,mi(Oe(e,Xo),t,n)})),lo=Qs(io),ho=Qs((function(e){var n=e.length,s=n>1?e[n-1]:t;return s="function"==typeof s?(e.pop(),s):t,ro(e,s)}));function po(t){var e=zn(t);return e.__chain__=!0,e}function fo(t,e){return e(t)}var _o=sr((function(e){var n=e.length,s=n?e[0]:0,i=this.__wrapped__,r=function(t){return as(t,e)};return!(n>1||this.__actions__.length)&&i instanceof Hn&&yr(s)?((i=i.slice(s,+s+(n?1:0))).__actions__.push({func:fo,args:[r],thisArg:t}),new Un(i,this.__chain__).thru((function(e){return n&&!e.length&&e.push(t),e}))):this.thru(r)})),mo=Ii((function(t,e,n){Pt.call(t,n)?++t[n]:os(t,n,1)})),go=Fi(Lr),vo=Fi(Ur);function yo(t,e){return(Ho(t)?ke:ds)(t,cr(e,3))}function wo(t,e){return(Ho(t)?Ce:fs)(t,cr(e,3))}var bo=Ii((function(t,e,n){Pt.call(t,n)?t[n].push(e):os(t,n,[e])})),xo=Qs((function(t,e,n){var s=-1,i="function"==typeof e,r=Go(t)?xt(t.length):[];return ds(t,(function(t){r[++s]=i?Te(e,t,n):Ds(t,e,n)})),r})),To=Ii((function(t,e,n){os(t,n,e)}));function Ao(t,e){return(Ho(t)?De:js)(t,cr(e,3))}var ko=Ii((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),Co=Qs((function(t,e){if(null==t)return[];var n=e.length;return n>1&&wr(t,e[0],e[1])?e=[]:n>2&&wr(e[0],e[1],e[2])&&(e=[e[0]]),Hs(t,vs(e,1),[])})),So=de||function(){return he.Date.now()};function Oo(e,n,s){return n=s?t:n,n=e&&null==n?e.length:n,Ki(e,a,t,t,t,t,n)}function Mo(n,s){var i;if("function"!=typeof s)throw new Et(e);return n=_a(n),function(){return--n>0&&(i=s.apply(this,arguments)),n<=1&&(s=t),i}}var Eo=Qs((function(t,e,n){var s=1;if(n.length){var i=an(n,ur(Eo));s|=r}return Ki(t,s,e,n,i)})),Do=Qs((function(t,e,n){var s=3;if(n.length){var i=an(n,ur(Do));s|=r}return Ki(e,s,t,n,i)}));function Io(n,s,i){var r,o,a,u,c,l,h=0,p=!1,d=!1,f=!0;if("function"!=typeof n)throw new Et(e);function _(e){var s=r,i=o;return r=o=t,h=e,u=n.apply(i,s)}function m(e){var n=e-l;return l===t||n>=s||n<0||d&&e-h>=a}function g(){var t=So();if(m(t))return v(t);c=Dr(g,function(t){var e=s-(t-l);return d?wn(e,a-(t-h)):e}(t))}function v(e){return c=t,f&&r?_(e):(r=o=t,u)}function y(){var e=So(),n=m(e);if(r=arguments,o=this,l=e,n){if(c===t)return function(t){return h=t,c=Dr(g,s),p?_(t):u}(l);if(d)return Ti(c),c=Dr(g,s),_(l)}return c===t&&(c=Dr(g,s)),u}return s=ga(s)||0,ea(i)&&(p=!!i.leading,a=(d="maxWait"in i)?yn(ga(i.maxWait)||0,s):a,f="trailing"in i?!!i.trailing:f),y.cancel=function(){c!==t&&Ti(c),h=0,r=l=o=c=t},y.flush=function(){return c===t?u:v(So())},y}var Ro=Qs((function(t,e){return hs(t,1,e)})),No=Qs((function(t,e,n){return hs(t,ga(e)||0,n)}));function Bo(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new Et(e);var s=function(){var e=arguments,i=n?n.apply(this,e):e[0],r=s.cache;if(r.has(i))return r.get(i);var o=t.apply(this,e);return s.cache=r.set(i,o)||r,o};return s.cache=new(Bo.Cache||Xn),s}function Po(t){if("function"!=typeof t)throw new Et(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Bo.Cache=Xn;var Vo=bi((function(t,e){var n=(e=1==e.length&&Ho(e[0])?De(e[0],Ze(cr())):De(vs(e,1),Ze(cr()))).length;return Qs((function(s){for(var i=-1,r=wn(s.length,n);++i<r;)s[i]=e[i].call(this,s[i]);return Te(t,this,s)}))})),qo=Qs((function(e,n){var s=an(n,ur(qo));return Ki(e,r,t,n,s)})),Fo=Qs((function(e,n){var s=an(n,ur(Fo));return Ki(e,o,t,n,s)})),jo=sr((function(e,n){return Ki(e,u,t,t,t,n)}));function zo(t,e){return t===e||t!=t&&e!=e}var Wo=Gi(Ss),Lo=Gi((function(t,e){return t>=e})),Uo=Is(function(){return arguments}())?Is:function(t){return na(t)&&Pt.call(t,"callee")&&!Zt.call(t,"callee")},Ho=xt.isArray,$o=ge?Ze(ge):function(t){return na(t)&&Cs(t)==E};function Go(t){return null!=t&&ta(t.length)&&!Ko(t)}function Xo(t){return na(t)&&Go(t)}var Zo=_n||gu,Yo=ve?Ze(ve):function(t){return na(t)&&Cs(t)==g};function Qo(t){if(!na(t))return!1;var e=Cs(t);return e==v||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ra(t)}function Ko(t){if(!ea(t))return!1;var e=Cs(t);return e==y||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Jo(t){return"number"==typeof t&&t==_a(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=l}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var sa=ye?Ze(ye):function(t){return na(t)&&_r(t)==b};function ia(t){return"number"==typeof t||na(t)&&Cs(t)==x}function ra(t){if(!na(t)||Cs(t)!=T)return!1;var e=Gt(t);if(null===e)return!0;var n=Pt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Bt.call(n)==jt}var oa=we?Ze(we):function(t){return na(t)&&Cs(t)==k},aa=be?Ze(be):function(t){return na(t)&&_r(t)==C};function ua(t){return"string"==typeof t||!Ho(t)&&na(t)&&Cs(t)==S}function ca(t){return"symbol"==typeof t||na(t)&&Cs(t)==O}var la=xe?Ze(xe):function(t){return na(t)&&ta(t.length)&&!!ie[Cs(t)]},ha=Gi(Fs),pa=Gi((function(t,e){return t<=e}));function da(t){if(!t)return[];if(Go(t))return ua(t)?hn(t):Ei(t);if(oe&&t[oe])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[oe]());var e=_r(t);return(e==b?rn:e==C?un:za)(t)}function fa(t){return t?(t=ga(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function _a(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ma(t){return t?us(_a(t),0,p):0}function ga(t){if("number"==typeof t)return t;if(ca(t))return h;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Xe(t);var n=dt.test(t);return n||_t.test(t)?ue(t.slice(2),n?2:8):pt.test(t)?h:+t}function va(t){return Di(t,Ra(t))}function ya(t){return null==t?"":li(t)}var wa=Ri((function(t,e){if(Ar(e)||Go(e))Di(e,Ia(e),t);else for(var n in e)Pt.call(e,n)&&ns(t,n,e[n])})),ba=Ri((function(t,e){Di(e,Ra(e),t)})),xa=Ri((function(t,e,n,s){Di(e,Ra(e),t,s)})),Ta=Ri((function(t,e,n,s){Di(e,Ia(e),t,s)})),Aa=sr(as),ka=Qs((function(e,n){e=St(e);var s=-1,i=n.length,r=i>2?n[2]:t;for(r&&wr(n[0],n[1],r)&&(i=1);++s<i;)for(var o=n[s],a=Ra(o),u=-1,c=a.length;++u<c;){var l=a[u],h=e[l];(h===t||zo(h,Rt[l])&&!Pt.call(e,l))&&(e[l]=o[l])}return e})),Ca=Qs((function(e){return e.push(t,tr),Te(Ba,t,e)}));function Sa(e,n,s){var i=null==e?t:As(e,n);return i===t?s:i}function Oa(t,e){return null!=t&&mr(t,e,Ms)}var Ma=Wi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),t[e]=n}),eu(iu)),Ea=Wi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),Pt.call(t,e)?t[e].push(n):t[e]=[n]}),cr),Da=Qs(Ds);function Ia(t){return Go(t)?Qn(t):Vs(t)}function Ra(t){return Go(t)?Qn(t,!0):qs(t)}var Na=Ri((function(t,e,n){Ls(t,e,n)})),Ba=Ri((function(t,e,n,s){Ls(t,e,n,s)})),Pa=sr((function(t,e){var n={};if(null==t)return n;var s=!1;e=De(e,(function(e){return e=wi(e,t),s||(s=e.length>1),e})),Di(t,rr(t),n),s&&(n=cs(n,7,er));for(var i=e.length;i--;)pi(n,e[i]);return n})),Va=sr((function(t,e){return null==t?{}:function(t,e){return $s(t,e,(function(e,n){return Oa(t,n)}))}(t,e)}));function qa(t,e){if(null==t)return{};var n=De(rr(t),(function(t){return[t]}));return e=cr(e),$s(t,n,(function(t,n){return e(t,n[0])}))}var Fa=Qi(Ia),ja=Qi(Ra);function za(t){return null==t?[]:Ye(t,Ia(t))}var Wa=Vi((function(t,e,n){return e=e.toLowerCase(),t+(n?La(e):e)}));function La(t){return Qa(ya(t).toLowerCase())}function Ua(t){return(t=ya(t))&&t.replace(gt,tn).replace(Qt,"")}var Ha=Vi((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),$a=Vi((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Ga=Pi("toLowerCase"),Xa=Vi((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()})),Za=Vi((function(t,e,n){return t+(n?" ":"")+Qa(e)})),Ya=Vi((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Qa=Pi("toUpperCase");function Ka(e,n,s){return e=ya(e),(n=s?t:n)===t?function(t){return ee.test(t)}(e)?function(t){return t.match(Jt)||[]}(e):function(t){return t.match(at)||[]}(e):e.match(n)||[]}var Ja=Qs((function(e,n){try{return Te(e,t,n)}catch(t){return Qo(t)?t:new At(t)}})),tu=sr((function(t,e){return ke(e,(function(e){e=Vr(e),os(t,e,Eo(t[e],t))})),t}));function eu(t){return function(){return t}}var nu=ji(),su=ji(!0);function iu(t){return t}function ru(t){return Ps("function"==typeof t?t:cs(t,1))}var ou=Qs((function(t,e){return function(n){return Ds(n,t,e)}})),au=Qs((function(t,e){return function(n){return Ds(t,n,e)}}));function uu(t,e,n){var s=Ia(e),i=Ts(e,s);null!=n||ea(e)&&(i.length||!s.length)||(n=e,e=t,t=this,i=Ts(e,Ia(e)));var r=!(ea(n)&&"chain"in n&&!n.chain),o=Ko(t);return ke(i,(function(n){var s=e[n];t[n]=s,o&&(t.prototype[n]=function(){var e=this.__chain__;if(r||e){var n=t(this.__wrapped__);return(n.__actions__=Ei(this.__actions__)).push({func:s,args:arguments,thisArg:t}),n.__chain__=e,n}return s.apply(t,Ie([this.value()],arguments))})})),t}function cu(){}var lu=Ui(De),hu=Ui(Se),pu=Ui(Be);function du(t){return br(t)?Le(Vr(t)):function(t){return function(e){return As(e,t)}}(t)}var fu=$i(),_u=$i(!0);function mu(){return[]}function gu(){return!1}var vu,yu=Li((function(t,e){return t+e}),0),wu=Zi("ceil"),bu=Li((function(t,e){return t/e}),1),xu=Zi("floor"),Tu=Li((function(t,e){return t*e}),1),Au=Zi("round"),ku=Li((function(t,e){return t-e}),0);return zn.after=function(t,n){if("function"!=typeof n)throw new Et(e);return t=_a(t),function(){if(--t<1)return n.apply(this,arguments)}},zn.ary=Oo,zn.assign=wa,zn.assignIn=ba,zn.assignInWith=xa,zn.assignWith=Ta,zn.at=Aa,zn.before=Mo,zn.bind=Eo,zn.bindAll=tu,zn.bindKey=Do,zn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ho(t)?t:[t]},zn.chain=po,zn.chunk=function(e,n,s){n=(s?wr(e,n,s):n===t)?1:yn(_a(n),0);var i=null==e?0:e.length;if(!i||n<1)return[];for(var r=0,o=0,a=xt(me(i/n));r<i;)a[o++]=ii(e,r,r+=n);return a},zn.compact=function(t){for(var e=-1,n=null==t?0:t.length,s=0,i=[];++e<n;){var r=t[e];r&&(i[s++]=r)}return i},zn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=xt(t-1),n=arguments[0],s=t;s--;)e[s-1]=arguments[s];return Ie(Ho(n)?Ei(n):[n],vs(e,1))},zn.cond=function(t){var n=null==t?0:t.length,s=cr();return t=n?De(t,(function(t){if("function"!=typeof t[1])throw new Et(e);return[s(t[0]),t[1]]})):[],Qs((function(e){for(var s=-1;++s<n;){var i=t[s];if(Te(i[0],this,e))return Te(i[1],this,e)}}))},zn.conforms=function(t){return function(t){var e=Ia(t);return function(n){return ls(n,t,e)}}(cs(t,1))},zn.constant=eu,zn.countBy=mo,zn.create=function(t,e){var n=Wn(t);return null==e?n:rs(n,e)},zn.curry=function e(n,s,i){var r=Ki(n,8,t,t,t,t,t,s=i?t:s);return r.placeholder=e.placeholder,r},zn.curryRight=function e(n,s,r){var o=Ki(n,i,t,t,t,t,t,s=r?t:s);return o.placeholder=e.placeholder,o},zn.debounce=Io,zn.defaults=ka,zn.defaultsDeep=Ca,zn.defer=Ro,zn.delay=No,zn.difference=jr,zn.differenceBy=zr,zn.differenceWith=Wr,zn.drop=function(e,n,s){var i=null==e?0:e.length;return i?ii(e,(n=s||n===t?1:_a(n))<0?0:n,i):[]},zn.dropRight=function(e,n,s){var i=null==e?0:e.length;return i?ii(e,0,(n=i-(n=s||n===t?1:_a(n)))<0?0:n):[]},zn.dropRightWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!0,!0):[]},zn.dropWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!0):[]},zn.fill=function(e,n,s,i){var r=null==e?0:e.length;return r?(s&&"number"!=typeof s&&wr(e,n,s)&&(s=0,i=r),function(e,n,s,i){var r=e.length;for((s=_a(s))<0&&(s=-s>r?0:r+s),(i=i===t||i>r?r:_a(i))<0&&(i+=r),i=s>i?0:ma(i);s<i;)e[s++]=n;return e}(e,n,s,i)):[]},zn.filter=function(t,e){return(Ho(t)?Oe:gs)(t,cr(e,3))},zn.flatMap=function(t,e){return vs(Ao(t,e),1)},zn.flatMapDeep=function(t,e){return vs(Ao(t,e),c)},zn.flatMapDepth=function(e,n,s){return s=s===t?1:_a(s),vs(Ao(e,n),s)},zn.flatten=Hr,zn.flattenDeep=function(t){return null!=t&&t.length?vs(t,c):[]},zn.flattenDepth=function(e,n){return null!=e&&e.length?vs(e,n=n===t?1:_a(n)):[]},zn.flip=function(t){return Ki(t,512)},zn.flow=nu,zn.flowRight=su,zn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,s={};++e<n;){var i=t[e];s[i[0]]=i[1]}return s},zn.functions=function(t){return null==t?[]:Ts(t,Ia(t))},zn.functionsIn=function(t){return null==t?[]:Ts(t,Ra(t))},zn.groupBy=bo,zn.initial=function(t){return null!=t&&t.length?ii(t,0,-1):[]},zn.intersection=Gr,zn.intersectionBy=Xr,zn.intersectionWith=Zr,zn.invert=Ma,zn.invertBy=Ea,zn.invokeMap=xo,zn.iteratee=ru,zn.keyBy=To,zn.keys=Ia,zn.keysIn=Ra,zn.map=Ao,zn.mapKeys=function(t,e){var n={};return e=cr(e,3),bs(t,(function(t,s,i){os(n,e(t,s,i),t)})),n},zn.mapValues=function(t,e){var n={};return e=cr(e,3),bs(t,(function(t,s,i){os(n,s,e(t,s,i))})),n},zn.matches=function(t){return zs(cs(t,1))},zn.matchesProperty=function(t,e){return Ws(t,cs(e,1))},zn.memoize=Bo,zn.merge=Na,zn.mergeWith=Ba,zn.method=ou,zn.methodOf=au,zn.mixin=uu,zn.negate=Po,zn.nthArg=function(t){return t=_a(t),Qs((function(e){return Us(e,t)}))},zn.omit=Pa,zn.omitBy=function(t,e){return qa(t,Po(cr(e)))},zn.once=function(t){return Mo(2,t)},zn.orderBy=function(e,n,s,i){return null==e?[]:(Ho(n)||(n=null==n?[]:[n]),Ho(s=i?t:s)||(s=null==s?[]:[s]),Hs(e,n,s))},zn.over=lu,zn.overArgs=Vo,zn.overEvery=hu,zn.overSome=pu,zn.partial=qo,zn.partialRight=Fo,zn.partition=ko,zn.pick=Va,zn.pickBy=qa,zn.property=du,zn.propertyOf=function(e){return function(n){return null==e?t:As(e,n)}},zn.pull=Qr,zn.pullAll=Kr,zn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Gs(t,e,cr(n,2)):t},zn.pullAllWith=function(e,n,s){return e&&e.length&&n&&n.length?Gs(e,n,t,s):e},zn.pullAt=Jr,zn.range=fu,zn.rangeRight=_u,zn.rearg=jo,zn.reject=function(t,e){return(Ho(t)?Oe:gs)(t,Po(cr(e,3)))},zn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var s=-1,i=[],r=t.length;for(e=cr(e,3);++s<r;){var o=t[s];e(o,s,t)&&(n.push(o),i.push(s))}return Xs(t,i),n},zn.rest=function(n,s){if("function"!=typeof n)throw new Et(e);return Qs(n,s=s===t?s:_a(s))},zn.reverse=to,zn.sampleSize=function(e,n,s){return n=(s?wr(e,n,s):n===t)?1:_a(n),(Ho(e)?Jn:Js)(e,n)},zn.set=function(t,e,n){return null==t?t:ti(t,e,n)},zn.setWith=function(e,n,s,i){return i="function"==typeof i?i:t,null==e?e:ti(e,n,s,i)},zn.shuffle=function(t){return(Ho(t)?ts:si)(t)},zn.slice=function(e,n,s){var i=null==e?0:e.length;return i?(s&&"number"!=typeof s&&wr(e,n,s)?(n=0,s=i):(n=null==n?0:_a(n),s=s===t?i:_a(s)),ii(e,n,s)):[]},zn.sortBy=Co,zn.sortedUniq=function(t){return t&&t.length?ui(t):[]},zn.sortedUniqBy=function(t,e){return t&&t.length?ui(t,cr(e,2)):[]},zn.split=function(e,n,s){return s&&"number"!=typeof s&&wr(e,n,s)&&(n=s=t),(s=s===t?p:s>>>0)?(e=ya(e))&&("string"==typeof n||null!=n&&!oa(n))&&!(n=li(n))&&sn(e)?xi(hn(e),0,s):e.split(n,s):[]},zn.spread=function(t,n){if("function"!=typeof t)throw new Et(e);return n=null==n?0:yn(_a(n),0),Qs((function(e){var s=e[n],i=xi(e,0,n);return s&&Ie(i,s),Te(t,this,i)}))},zn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},zn.take=function(e,n,s){return e&&e.length?ii(e,0,(n=s||n===t?1:_a(n))<0?0:n):[]},zn.takeRight=function(e,n,s){var i=null==e?0:e.length;return i?ii(e,(n=i-(n=s||n===t?1:_a(n)))<0?0:n,i):[]},zn.takeRightWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!1,!0):[]},zn.takeWhile=function(t,e){return t&&t.length?fi(t,cr(e,3)):[]},zn.tap=function(t,e){return e(t),t},zn.throttle=function(t,n,s){var i=!0,r=!0;if("function"!=typeof t)throw new Et(e);return ea(s)&&(i="leading"in s?!!s.leading:i,r="trailing"in s?!!s.trailing:r),Io(t,n,{leading:i,maxWait:n,trailing:r})},zn.thru=fo,zn.toArray=da,zn.toPairs=Fa,zn.toPairsIn=ja,zn.toPath=function(t){return Ho(t)?De(t,Vr):ca(t)?[t]:Ei(Pr(ya(t)))},zn.toPlainObject=va,zn.transform=function(t,e,n){var s=Ho(t),i=s||Zo(t)||la(t);if(e=cr(e,4),null==n){var r=t&&t.constructor;n=i?s?new r:[]:ea(t)&&Ko(r)?Wn(Gt(t)):{}}return(i?ke:bs)(t,(function(t,s,i){return e(n,t,s,i)})),n},zn.unary=function(t){return Oo(t,1)},zn.union=eo,zn.unionBy=no,zn.unionWith=so,zn.uniq=function(t){return t&&t.length?hi(t):[]},zn.uniqBy=function(t,e){return t&&t.length?hi(t,cr(e,2)):[]},zn.uniqWith=function(e,n){return n="function"==typeof n?n:t,e&&e.length?hi(e,t,n):[]},zn.unset=function(t,e){return null==t||pi(t,e)},zn.unzip=io,zn.unzipWith=ro,zn.update=function(t,e,n){return null==t?t:di(t,e,yi(n))},zn.updateWith=function(e,n,s,i){return i="function"==typeof i?i:t,null==e?e:di(e,n,yi(s),i)},zn.values=za,zn.valuesIn=function(t){return null==t?[]:Ye(t,Ra(t))},zn.without=oo,zn.words=Ka,zn.wrap=function(t,e){return qo(yi(e),t)},zn.xor=ao,zn.xorBy=uo,zn.xorWith=co,zn.zip=lo,zn.zipObject=function(t,e){return gi(t||[],e||[],ns)},zn.zipObjectDeep=function(t,e){return gi(t||[],e||[],ti)},zn.zipWith=ho,zn.entries=Fa,zn.entriesIn=ja,zn.extend=ba,zn.extendWith=xa,uu(zn,zn),zn.add=yu,zn.attempt=Ja,zn.camelCase=Wa,zn.capitalize=La,zn.ceil=wu,zn.clamp=function(e,n,s){return s===t&&(s=n,n=t),s!==t&&(s=(s=ga(s))==s?s:0),n!==t&&(n=(n=ga(n))==n?n:0),us(ga(e),n,s)},zn.clone=function(t){return cs(t,4)},zn.cloneDeep=function(t){return cs(t,5)},zn.cloneDeepWith=function(e,n){return cs(e,5,n="function"==typeof n?n:t)},zn.cloneWith=function(e,n){return cs(e,4,n="function"==typeof n?n:t)},zn.conformsTo=function(t,e){return null==e||ls(t,e,Ia(e))},zn.deburr=Ua,zn.defaultTo=function(t,e){return null==t||t!=t?e:t},zn.divide=bu,zn.endsWith=function(e,n,s){e=ya(e),n=li(n);var i=e.length,r=s=s===t?i:us(_a(s),0,i);return(s-=n.length)>=0&&e.slice(s,r)==n},zn.eq=zo,zn.escape=function(t){return(t=ya(t))&&G.test(t)?t.replace(H,en):t},zn.escapeRegExp=function(t){return(t=ya(t))&&et.test(t)?t.replace(tt,"\\$&"):t},zn.every=function(e,n,s){var i=Ho(e)?Se:_s;return s&&wr(e,n,s)&&(n=t),i(e,cr(n,3))},zn.find=go,zn.findIndex=Lr,zn.findKey=function(t,e){return Ve(t,cr(e,3),bs)},zn.findLast=vo,zn.findLastIndex=Ur,zn.findLastKey=function(t,e){return Ve(t,cr(e,3),xs)},zn.floor=xu,zn.forEach=yo,zn.forEachRight=wo,zn.forIn=function(t,e){return null==t?t:ys(t,cr(e,3),Ra)},zn.forInRight=function(t,e){return null==t?t:ws(t,cr(e,3),Ra)},zn.forOwn=function(t,e){return t&&bs(t,cr(e,3))},zn.forOwnRight=function(t,e){return t&&xs(t,cr(e,3))},zn.get=Sa,zn.gt=Wo,zn.gte=Lo,zn.has=function(t,e){return null!=t&&mr(t,e,Os)},zn.hasIn=Oa,zn.head=$r,zn.identity=iu,zn.includes=function(t,e,n,s){t=Go(t)?t:za(t),n=n&&!s?_a(n):0;var i=t.length;return n<0&&(n=yn(i+n,0)),ua(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Fe(t,e,n)>-1},zn.indexOf=function(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var i=null==n?0:_a(n);return i<0&&(i=yn(s+i,0)),Fe(t,e,i)},zn.inRange=function(e,n,s){return n=fa(n),s===t?(s=n,n=0):s=fa(s),function(t,e,n){return t>=wn(e,n)&&t<yn(e,n)}(e=ga(e),n,s)},zn.invoke=Da,zn.isArguments=Uo,zn.isArray=Ho,zn.isArrayBuffer=$o,zn.isArrayLike=Go,zn.isArrayLikeObject=Xo,zn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Cs(t)==m},zn.isBuffer=Zo,zn.isDate=Yo,zn.isElement=function(t){return na(t)&&1===t.nodeType&&!ra(t)},zn.isEmpty=function(t){if(null==t)return!0;if(Go(t)&&(Ho(t)||"string"==typeof t||"function"==typeof t.splice||Zo(t)||la(t)||Uo(t)))return!t.length;var e=_r(t);if(e==b||e==C)return!t.size;if(Ar(t))return!Vs(t).length;for(var n in t)if(Pt.call(t,n))return!1;return!0},zn.isEqual=function(t,e){return Rs(t,e)},zn.isEqualWith=function(e,n,s){var i=(s="function"==typeof s?s:t)?s(e,n):t;return i===t?Rs(e,n,t,s):!!i},zn.isError=Qo,zn.isFinite=function(t){return"number"==typeof t&&mn(t)},zn.isFunction=Ko,zn.isInteger=Jo,zn.isLength=ta,zn.isMap=sa,zn.isMatch=function(t,e){return t===e||Ns(t,e,hr(e))},zn.isMatchWith=function(e,n,s){return s="function"==typeof s?s:t,Ns(e,n,hr(n),s)},zn.isNaN=function(t){return ia(t)&&t!=+t},zn.isNative=function(t){if(Tr(t))throw new At("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Bs(t)},zn.isNil=function(t){return null==t},zn.isNull=function(t){return null===t},zn.isNumber=ia,zn.isObject=ea,zn.isObjectLike=na,zn.isPlainObject=ra,zn.isRegExp=oa,zn.isSafeInteger=function(t){return Jo(t)&&t>=-9007199254740991&&t<=l},zn.isSet=aa,zn.isString=ua,zn.isSymbol=ca,zn.isTypedArray=la,zn.isUndefined=function(e){return e===t},zn.isWeakMap=function(t){return na(t)&&_r(t)==M},zn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Cs(t)},zn.join=function(t,e){return null==t?"":gn.call(t,e)},zn.kebabCase=Ha,zn.last=Yr,zn.lastIndexOf=function(e,n,s){var i=null==e?0:e.length;if(!i)return-1;var r=i;return s!==t&&(r=(r=_a(s))<0?yn(i+r,0):wn(r,i-1)),n==n?function(t,e,n){for(var s=n+1;s--;)if(t[s]===e)return s;return s}(e,n,r):qe(e,ze,r,!0)},zn.lowerCase=$a,zn.lowerFirst=Ga,zn.lt=ha,zn.lte=pa,zn.max=function(e){return e&&e.length?ms(e,iu,Ss):t},zn.maxBy=function(e,n){return e&&e.length?ms(e,cr(n,2),Ss):t},zn.mean=function(t){return We(t,iu)},zn.meanBy=function(t,e){return We(t,cr(e,2))},zn.min=function(e){return e&&e.length?ms(e,iu,Fs):t},zn.minBy=function(e,n){return e&&e.length?ms(e,cr(n,2),Fs):t},zn.stubArray=mu,zn.stubFalse=gu,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=Tu,zn.nth=function(e,n){return e&&e.length?Us(e,_a(n)):t},zn.noConflict=function(){return he._===this&&(he._=zt),this},zn.noop=cu,zn.now=So,zn.pad=function(t,e,n){t=ya(t);var s=(e=_a(e))?ln(t):0;if(!e||s>=e)return t;var i=(e-s)/2;return Hi(Pe(i),n)+t+Hi(me(i),n)},zn.padEnd=function(t,e,n){t=ya(t);var s=(e=_a(e))?ln(t):0;return e&&s<e?t+Hi(e-s,n):t},zn.padStart=function(t,e,n){t=ya(t);var s=(e=_a(e))?ln(t):0;return e&&s<e?Hi(e-s,n)+t:t},zn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),xn(ya(t).replace(nt,""),e||0)},zn.random=function(e,n,s){if(s&&"boolean"!=typeof s&&wr(e,n,s)&&(n=s=t),s===t&&("boolean"==typeof n?(s=n,n=t):"boolean"==typeof e&&(s=e,e=t)),e===t&&n===t?(e=0,n=1):(e=fa(e),n===t?(n=e,e=0):n=fa(n)),e>n){var i=e;e=n,n=i}if(s||e%1||n%1){var r=Tn();return wn(e+r*(n-e+ae("1e-"+((r+"").length-1))),n)}return Zs(e,n)},zn.reduce=function(t,e,n){var s=Ho(t)?Re:He,i=arguments.length<3;return s(t,cr(e,4),n,i,ds)},zn.reduceRight=function(t,e,n){var s=Ho(t)?Ne:He,i=arguments.length<3;return s(t,cr(e,4),n,i,fs)},zn.repeat=function(e,n,s){return n=(s?wr(e,n,s):n===t)?1:_a(n),Ys(ya(e),n)},zn.replace=function(){var t=arguments,e=ya(t[0]);return t.length<3?e:e.replace(t[1],t[2])},zn.result=function(e,n,s){var i=-1,r=(n=wi(n,e)).length;for(r||(r=1,e=t);++i<r;){var o=null==e?t:e[Vr(n[i])];o===t&&(i=r,o=s),e=Ko(o)?o.call(e):o}return e},zn.round=Au,zn.runInContext=st,zn.sample=function(t){return(Ho(t)?Kn:Ks)(t)},zn.size=function(t){if(null==t)return 0;if(Go(t))return ua(t)?ln(t):t.length;var e=_r(t);return e==b||e==C?t.size:Vs(t).length},zn.snakeCase=Xa,zn.some=function(e,n,s){var i=Ho(e)?Be:ri;return s&&wr(e,n,s)&&(n=t),i(e,cr(n,3))},zn.sortedIndex=function(t,e){return oi(t,e)},zn.sortedIndexBy=function(t,e,n){return ai(t,e,cr(n,2))},zn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var s=oi(t,e);if(s<n&&zo(t[s],e))return s}return-1},zn.sortedLastIndex=function(t,e){return oi(t,e,!0)},zn.sortedLastIndexBy=function(t,e,n){return ai(t,e,cr(n,2),!0)},zn.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=oi(t,e,!0)-1;if(zo(t[n],e))return n}return-1},zn.startCase=Za,zn.startsWith=function(t,e,n){return t=ya(t),n=null==n?0:us(_a(n),0,t.length),e=li(e),t.slice(n,n+e.length)==e},zn.subtract=ku,zn.sum=function(t){return t&&t.length?$e(t,iu):0},zn.sumBy=function(t,e){return t&&t.length?$e(t,cr(e,2)):0},zn.template=function(e,n,s){var i=zn.templateSettings;s&&wr(e,n,s)&&(n=t),e=ya(e),n=xa({},n,i,Ji);var r,o,a=xa({},n.imports,i.imports,Ji),u=Ia(a),c=Ye(a,u),l=0,h=n.interpolate||vt,p="__p += '",d=Ot((n.escape||vt).source+"|"+h.source+"|"+(h===Y?lt:vt).source+"|"+(n.evaluate||vt).source+"|$","g"),f="//# sourceURL="+(Pt.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++se+"]")+"\n";e.replace(d,(function(t,n,s,i,a,u){return s||(s=i),p+=e.slice(l,u).replace(yt,nn),n&&(r=!0,p+="' +\n__e("+n+") +\n'"),a&&(o=!0,p+="';\n"+a+";\n__p += '"),s&&(p+="' +\n((__t = ("+s+")) == null ? '' : __t) +\n'"),l=u+t.length,t})),p+="';\n";var _=Pt.call(n,"variable")&&n.variable;if(_){if(ut.test(_))throw new At("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(o?p.replace(z,""):p).replace(W,"$1").replace(L,"$1;"),p="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Ja((function(){return kt(u,f+"return "+p).apply(t,c)}));if(m.source=p,Qo(m))throw m;return m},zn.times=function(t,e){if((t=_a(t))<1||t>l)return[];var n=p,s=wn(t,p);e=cr(e),t-=p;for(var i=Ge(s,e);++n<t;)e(n);return i},zn.toFinite=fa,zn.toInteger=_a,zn.toLength=ma,zn.toLower=function(t){return ya(t).toLowerCase()},zn.toNumber=ga,zn.toSafeInteger=function(t){return t?us(_a(t),-9007199254740991,l):0===t?t:0},zn.toString=ya,zn.toUpper=function(t){return ya(t).toUpperCase()},zn.trim=function(e,n,s){if((e=ya(e))&&(s||n===t))return Xe(e);if(!e||!(n=li(n)))return e;var i=hn(e),r=hn(n);return xi(i,Ke(i,r),Je(i,r)+1).join("")},zn.trimEnd=function(e,n,s){if((e=ya(e))&&(s||n===t))return e.slice(0,pn(e)+1);if(!e||!(n=li(n)))return e;var i=hn(e);return xi(i,0,Je(i,hn(n))+1).join("")},zn.trimStart=function(e,n,s){if((e=ya(e))&&(s||n===t))return e.replace(nt,"");if(!e||!(n=li(n)))return e;var i=hn(e);return xi(i,Ke(i,hn(n))).join("")},zn.truncate=function(e,n){var s=30,i="...";if(ea(n)){var r="separator"in n?n.separator:r;s="length"in n?_a(n.length):s,i="omission"in n?li(n.omission):i}var o=(e=ya(e)).length;if(sn(e)){var a=hn(e);o=a.length}if(s>=o)return e;var u=s-ln(i);if(u<1)return i;var c=a?xi(a,0,u).join(""):e.slice(0,u);if(r===t)return c+i;if(a&&(u+=c.length-u),oa(r)){if(e.slice(u).search(r)){var l,h=c;for(r.global||(r=Ot(r.source,ya(ht.exec(r))+"g")),r.lastIndex=0;l=r.exec(h);)var p=l.index;c=c.slice(0,p===t?u:p)}}else if(e.indexOf(li(r),u)!=u){var d=c.lastIndexOf(r);d>-1&&(c=c.slice(0,d))}return c+i},zn.unescape=function(t){return(t=ya(t))&&$.test(t)?t.replace(U,dn):t},zn.uniqueId=function(t){var e=++Vt;return ya(t)+e},zn.upperCase=Ya,zn.upperFirst=Qa,zn.each=yo,zn.eachRight=wo,zn.first=$r,uu(zn,(vu={},bs(zn,(function(t,e){Pt.call(zn.prototype,e)||(vu[e]=t)})),vu),{chain:!1}),zn.VERSION="4.17.21",ke(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){zn[t].placeholder=zn})),ke(["drop","take"],(function(e,n){Hn.prototype[e]=function(s){s=s===t?1:yn(_a(s),0);var i=this.__filtered__&&!n?new Hn(this):this.clone();return i.__filtered__?i.__takeCount__=wn(s,i.__takeCount__):i.__views__.push({size:wn(s,p),type:e+(i.__dir__<0?"Right":"")}),i},Hn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),ke(["filter","map","takeWhile"],(function(t,e){var n=e+1,s=1==n||3==n;Hn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:cr(t,3),type:n}),e.__filtered__=e.__filtered__||s,e}})),ke(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Hn.prototype[t]=function(){return this[n](1).value()[0]}})),ke(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Hn.prototype[t]=function(){return this.__filtered__?new Hn(this):this[n](1)}})),Hn.prototype.compact=function(){return this.filter(iu)},Hn.prototype.find=function(t){return this.filter(t).head()},Hn.prototype.findLast=function(t){return this.reverse().find(t)},Hn.prototype.invokeMap=Qs((function(t,e){return"function"==typeof t?new Hn(this):this.map((function(n){return Ds(n,t,e)}))})),Hn.prototype.reject=function(t){return this.filter(Po(cr(t)))},Hn.prototype.slice=function(e,n){e=_a(e);var s=this;return s.__filtered__&&(e>0||n<0)?new Hn(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),n!==t&&(s=(n=_a(n))<0?s.dropRight(-n):s.take(n-e)),s)},Hn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Hn.prototype.toArray=function(){return this.take(p)},bs(Hn.prototype,(function(e,n){var s=/^(?:filter|find|map|reject)|While$/.test(n),i=/^(?:head|last)$/.test(n),r=zn[i?"take"+("last"==n?"Right":""):n],o=i||/^find/.test(n);r&&(zn.prototype[n]=function(){var n=this.__wrapped__,a=i?[1]:arguments,u=n instanceof Hn,c=a[0],l=u||Ho(n),h=function(t){var e=r.apply(zn,Ie([t],a));return i&&p?e[0]:e};l&&s&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,d=!!this.__actions__.length,f=o&&!p,_=u&&!d;if(!o&&l){n=_?n:new Hn(this);var m=e.apply(n,a);return m.__actions__.push({func:fo,args:[h],thisArg:t}),new Un(m,p)}return f&&_?e.apply(this,a):(m=this.thru(h),f?i?m.value()[0]:m.value():m)})})),ke(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Dt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",s=/^(?:pop|shift)$/.test(t);zn.prototype[t]=function(){var t=arguments;if(s&&!this.__chain__){var i=this.value();return e.apply(Ho(i)?i:[],t)}return this[n]((function(n){return e.apply(Ho(n)?n:[],t)}))}})),bs(Hn.prototype,(function(t,e){var n=zn[e];if(n){var s=n.name+"";Pt.call(In,s)||(In[s]=[]),In[s].push({name:e,func:n})}})),In[zi(t,2).name]=[{name:"wrapper",func:t}],Hn.prototype.clone=function(){var t=new Hn(this.__wrapped__);return t.__actions__=Ei(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ei(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ei(this.__views__),t},Hn.prototype.reverse=function(){if(this.__filtered__){var t=new Hn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Hn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Ho(t),s=e<0,i=n?t.length:0,r=function(t,e,n){for(var s=-1,i=n.length;++s<i;){var r=n[s],o=r.size;switch(r.type){case"drop":t+=o;break;case"dropRight":e-=o;break;case"take":e=wn(e,t+o);break;case"takeRight":t=yn(t,e-o)}}return{start:t,end:e}}(0,i,this.__views__),o=r.start,a=r.end,u=a-o,c=s?a:o-1,l=this.__iteratees__,h=l.length,p=0,d=wn(u,this.__takeCount__);if(!n||!s&&i==u&&d==u)return _i(t,this.__actions__);var f=[];t:for(;u--&&p<d;){for(var _=-1,m=t[c+=e];++_<h;){var g=l[_],v=g.iteratee,y=g.type,w=v(m);if(2==y)m=w;else if(!w){if(1==y)continue t;break t}}f[p++]=m}return f},zn.prototype.at=_o,zn.prototype.chain=function(){return po(this)},zn.prototype.commit=function(){return new Un(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===t&&(this.__values__=da(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?t:this.__values__[this.__index__++]}},zn.prototype.plant=function(e){for(var n,s=this;s instanceof Ln;){var i=Fr(s);i.__index__=0,i.__values__=t,n?r.__wrapped__=i:n=i;var r=i;s=s.__wrapped__}return r.__wrapped__=e,n},zn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Hn){var n=e;return this.__actions__.length&&(n=new Hn(this)),(n=n.reverse()).__actions__.push({func:fo,args:[to],thisArg:t}),new Un(n,this.__chain__)}return this.thru(to)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return _i(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,oe&&(zn.prototype[oe]=function(){return this}),zn}();de?((de.exports=fn)._=fn,pe._=fn):he._=fn}.call(zo);var $o,Go=Ho.exports,Xo=new Uint8Array(16);function Zo(){if(!$o&&!($o="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return $o(Xo)}var Yo=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var Qo=[],Ko=0;Ko<256;++Ko)Qo.push((Ko+256).toString(16).substr(1));function Jo(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Qo[t[e+0]]+Qo[t[e+1]]+Qo[t[e+2]]+Qo[t[e+3]]+"-"+Qo[t[e+4]]+Qo[t[e+5]]+"-"+Qo[t[e+6]]+Qo[t[e+7]]+"-"+Qo[t[e+8]]+Qo[t[e+9]]+"-"+Qo[t[e+10]]+Qo[t[e+11]]+Qo[t[e+12]]+Qo[t[e+13]]+Qo[t[e+14]]+Qo[t[e+15]]).toLowerCase();if(!function(t){return"string"==typeof t&&Yo.test(t)}(n))throw TypeError("Stringified UUID is invalid");return n}function ta(t,e,n){var s=(t=t||{}).random||(t.rng||Zo)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=s[i];return e}return Jo(s)}var ea={exports:{}};var na,sa={exports:{}};function ia(){return na||(na=1,sa.exports=function(){var t=t||function(t,e){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==zo&&zo.crypto&&(n=zo.crypto),!n)try{n=require("crypto")}catch(t){}var s=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),r={},o=r.lib={},a=o.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},u=o.WordArray=a.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,n=t.words,s=this.sigBytes,i=t.sigBytes;if(this.clamp(),s%4)for(var r=0;r<i;r++){var o=n[r>>>2]>>>24-r%4*8&255;e[s+r>>>2]|=o<<24-(s+r)%4*8}else for(var a=0;a<i;a+=4)e[s+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(s());return new u.init(e,t)}}),c=r.enc={},l=c.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push((r>>>4).toString(16)),s.push((15&r).toString(16))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s+=2)n[s>>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new u.init(n,e/2)}},h=c.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push(String.fromCharCode(r))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s++)n[s>>>2]|=(255&t.charCodeAt(s))<<24-s%4*8;return new u.init(n,e)}},p=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},d=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,s=this._data,i=s.words,r=s.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*o,l=t.min(4*c,r);if(c){for(var h=0;h<c;h+=o)this._doProcessBlock(i,h);n=i.splice(0,c),s.sigBytes-=l}return new u.init(n,l)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});o.Hasher=d.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}});var f=r.algo={};return r}(Math);return t}()),sa.exports}var ra,oa={exports:{}};function aa(){return ra||(ra=1,oa.exports=function(t){return s=(n=t).lib,i=s.Base,r=s.WordArray,(o=n.x64={}).Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),o.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],s=0;s<e;s++){var i=t[s];n.push(i.high),n.push(i.low)}return r.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,s=0;s<n;s++)e[s]=e[s].clone();return t}}),t;var e,n,s,i,r,o}(ia())),oa.exports}var ua,ca={exports:{}};function la(){return ua||(ua=1,ca.exports=function(t){return function(){if("function"==typeof ArrayBuffer){var e=t.lib.WordArray,n=e.init,s=e.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var e=t.byteLength,s=[],i=0;i<e;i++)s[i>>>2]|=t[i]<<24-i%4*8;n.call(this,s,e)}else n.apply(this,arguments)};s.prototype=e}}(),t.lib.WordArray}(ia())),ca.exports}var ha,pa={exports:{}};function da(){return ha||(ha=1,pa.exports=function(t){return function(){var e=t,n=e.lib.WordArray,s=e.enc;function i(t){return t<<8&4278255360|t>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i+=2){var r=e[i>>>2]>>>16-i%4*8&65535;s.push(String.fromCharCode(r))}return s.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i++)s[i>>>1]|=t.charCodeAt(i)<<16-i%2*16;return n.create(s,2*e)}},s.Utf16LE={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],r=0;r<n;r+=2){var o=i(e[r>>>2]>>>16-r%4*8&65535);s.push(String.fromCharCode(o))}return s.join("")},parse:function(t){for(var e=t.length,s=[],r=0;r<e;r++)s[r>>>1]|=i(t.charCodeAt(r)<<16-r%2*16);return n.create(s,2*e)}}}(),t.enc.Utf16}(ia())),pa.exports}var fa,_a={exports:{}};function ma(){return fa||(fa=1,_a.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function s(t,e,s){for(var i=[],r=0,o=0;o<e;o++)if(o%4){var a=s[t.charCodeAt(o-1)]<<o%4*2|s[t.charCodeAt(o)]>>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return n.create(i,r)}e.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,s=this._map;t.clamp();for(var i=[],r=0;r<n;r+=3)for(var o=(e[r>>>2]>>>24-r%4*8&255)<<16|(e[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|e[r+2>>>2]>>>24-(r+2)%4*8&255,a=0;a<4&&r+.75*a<n;a++)i.push(s.charAt(o>>>6*(3-a)&63));var u=s.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(t){var e=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var r=0;r<n.length;r++)i[n.charCodeAt(r)]=r}var o=n.charAt(64);if(o){var a=t.indexOf(o);-1!==a&&(e=a)}return s(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.enc.Base64}(ia())),_a.exports}var ga,va={exports:{}};function ya(){return ga||(ga=1,va.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function s(t,e,s){for(var i=[],r=0,o=0;o<e;o++)if(o%4){var a=s[t.charCodeAt(o-1)]<<o%4*2|s[t.charCodeAt(o)]>>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return n.create(i,r)}e.enc.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var n=t.words,s=t.sigBytes,i=e?this._safe_map:this._map;t.clamp();for(var r=[],o=0;o<s;o+=3)for(var a=(n[o>>>2]>>>24-o%4*8&255)<<16|(n[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|n[o+2>>>2]>>>24-(o+2)%4*8&255,u=0;u<4&&o+.75*u<s;u++)r.push(i.charAt(a>>>6*(3-u)&63));var c=i.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(t,e){void 0===e&&(e=!0);var n=t.length,i=e?this._safe_map:this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<i.length;o++)r[i.charCodeAt(o)]=o}var a=i.charAt(64);if(a){var u=t.indexOf(a);-1!==u&&(n=u)}return s(t,n,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),t.enc.Base64url}(ia())),va.exports}var wa,ba={exports:{}};function xa(){return wa||(wa=1,ba.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=o.MD5=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r=this._hash.words,o=t[e+0],u=t[e+1],d=t[e+2],f=t[e+3],_=t[e+4],m=t[e+5],g=t[e+6],v=t[e+7],y=t[e+8],w=t[e+9],b=t[e+10],x=t[e+11],T=t[e+12],A=t[e+13],k=t[e+14],C=t[e+15],S=r[0],O=r[1],M=r[2],E=r[3];S=c(S,O,M,E,o,7,a[0]),E=c(E,S,O,M,u,12,a[1]),M=c(M,E,S,O,d,17,a[2]),O=c(O,M,E,S,f,22,a[3]),S=c(S,O,M,E,_,7,a[4]),E=c(E,S,O,M,m,12,a[5]),M=c(M,E,S,O,g,17,a[6]),O=c(O,M,E,S,v,22,a[7]),S=c(S,O,M,E,y,7,a[8]),E=c(E,S,O,M,w,12,a[9]),M=c(M,E,S,O,b,17,a[10]),O=c(O,M,E,S,x,22,a[11]),S=c(S,O,M,E,T,7,a[12]),E=c(E,S,O,M,A,12,a[13]),M=c(M,E,S,O,k,17,a[14]),S=l(S,O=c(O,M,E,S,C,22,a[15]),M,E,u,5,a[16]),E=l(E,S,O,M,g,9,a[17]),M=l(M,E,S,O,x,14,a[18]),O=l(O,M,E,S,o,20,a[19]),S=l(S,O,M,E,m,5,a[20]),E=l(E,S,O,M,b,9,a[21]),M=l(M,E,S,O,C,14,a[22]),O=l(O,M,E,S,_,20,a[23]),S=l(S,O,M,E,w,5,a[24]),E=l(E,S,O,M,k,9,a[25]),M=l(M,E,S,O,f,14,a[26]),O=l(O,M,E,S,y,20,a[27]),S=l(S,O,M,E,A,5,a[28]),E=l(E,S,O,M,d,9,a[29]),M=l(M,E,S,O,v,14,a[30]),S=h(S,O=l(O,M,E,S,T,20,a[31]),M,E,m,4,a[32]),E=h(E,S,O,M,y,11,a[33]),M=h(M,E,S,O,x,16,a[34]),O=h(O,M,E,S,k,23,a[35]),S=h(S,O,M,E,u,4,a[36]),E=h(E,S,O,M,_,11,a[37]),M=h(M,E,S,O,v,16,a[38]),O=h(O,M,E,S,b,23,a[39]),S=h(S,O,M,E,A,4,a[40]),E=h(E,S,O,M,o,11,a[41]),M=h(M,E,S,O,f,16,a[42]),O=h(O,M,E,S,g,23,a[43]),S=h(S,O,M,E,w,4,a[44]),E=h(E,S,O,M,T,11,a[45]),M=h(M,E,S,O,C,16,a[46]),S=p(S,O=h(O,M,E,S,d,23,a[47]),M,E,o,6,a[48]),E=p(E,S,O,M,v,10,a[49]),M=p(M,E,S,O,k,15,a[50]),O=p(O,M,E,S,m,21,a[51]),S=p(S,O,M,E,T,6,a[52]),E=p(E,S,O,M,f,10,a[53]),M=p(M,E,S,O,b,15,a[54]),O=p(O,M,E,S,u,21,a[55]),S=p(S,O,M,E,y,6,a[56]),E=p(E,S,O,M,C,10,a[57]),M=p(M,E,S,O,g,15,a[58]),O=p(O,M,E,S,A,21,a[59]),S=p(S,O,M,E,_,6,a[60]),E=p(E,S,O,M,x,10,a[61]),M=p(M,E,S,O,d,15,a[62]),O=p(O,M,E,S,w,21,a[63]),r[0]=r[0]+S|0,r[1]=r[1]+O|0,r[2]=r[2]+M|0,r[3]=r[3]+E|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var r=e.floor(s/4294967296),o=s;n[15+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),n[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,u=a.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,n,s,i,r,o){var a=t+(e&n|~e&s)+i+o;return(a<<r|a>>>32-r)+e}function l(t,e,n,s,i,r,o){var a=t+(e&s|n&~s)+i+o;return(a<<r|a>>>32-r)+e}function h(t,e,n,s,i,r,o){var a=t+(e^n^s)+i+o;return(a<<r|a>>>32-r)+e}function p(t,e,n,s,i,r,o){var a=t+(n^(e|~s))+i+o;return(a<<r|a>>>32-r)+e}n.MD5=r._createHelper(u),n.HmacMD5=r._createHmacHelper(u)}(Math),t.MD5}(ia())),ba.exports}var Ta,Aa={exports:{}};function ka(){return Ta||(Ta=1,Aa.exports=function(t){return n=(e=t).lib,s=n.WordArray,i=n.Hasher,r=e.algo,o=[],a=r.SHA1=i.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],a=n[3],u=n[4],c=0;c<80;c++){if(c<16)o[c]=0|t[e+c];else{var l=o[c-3]^o[c-8]^o[c-14]^o[c-16];o[c]=l<<1|l>>>31}var h=(s<<5|s>>>27)+u+o[c];h+=c<20?1518500249+(i&r|~i&a):c<40?1859775393+(i^r^a):c<60?(i&r|i&a|r&a)-1894007588:(i^r^a)-899497514,u=a,a=r,r=i<<30|i>>>2,i=s,s=h}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;return e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(s+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA1=i._createHelper(a),e.HmacSHA1=i._createHmacHelper(a),t.SHA1;var e,n,s,i,r,o,a}(ia())),Aa.exports}var Ca,Sa={exports:{}};function Oa(){return Ca||(Ca=1,Sa.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),s=2;s<=n;s++)if(!(t%s))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var s=2,i=0;i<64;)t(s)&&(i<8&&(a[i]=n(e.pow(s,.5))),u[i]=n(e.pow(s,1/3)),i++),s++}();var c=[],l=o.SHA256=r.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],o=n[3],a=n[4],l=n[5],h=n[6],p=n[7],d=0;d<64;d++){if(d<16)c[d]=0|t[e+d];else{var f=c[d-15],_=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,m=c[d-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;c[d]=_+c[d-7]+g+c[d-16]}var v=s&i^s&r^i&r,y=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),w=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+u[d]+c[d];p=h,h=l,l=a,a=o+w|0,o=r,r=i,i=s,s=w+(y+v)|0}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+o|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+h|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(s/4294967296),n[15+(i+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=r._createHelper(l),n.HmacSHA256=r._createHmacHelper(l)}(Math),t.SHA256}(ia())),Sa.exports}var Ma,Ea={exports:{}};var Da,Ia={exports:{}};function Ra(){return Da||(Da=1,Ia.exports=function(t){return function(){var e=t,n=e.lib.Hasher,s=e.x64,i=s.Word,r=s.WordArray,o=e.algo;function a(){return i.create.apply(i,arguments)}var u=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],c=[];!function(){for(var t=0;t<80;t++)c[t]=a()}();var l=o.SHA512=n.extend({_doReset:function(){this._hash=new r.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],o=n[3],a=n[4],l=n[5],h=n[6],p=n[7],d=s.high,f=s.low,_=i.high,m=i.low,g=r.high,v=r.low,y=o.high,w=o.low,b=a.high,x=a.low,T=l.high,A=l.low,k=h.high,C=h.low,S=p.high,O=p.low,M=d,E=f,D=_,I=m,R=g,N=v,B=y,P=w,V=b,q=x,F=T,j=A,z=k,W=C,L=S,U=O,H=0;H<80;H++){var $,G,X=c[H];if(H<16)G=X.high=0|t[e+2*H],$=X.low=0|t[e+2*H+1];else{var Z=c[H-15],Y=Z.high,Q=Z.low,K=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,J=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),tt=c[H-2],et=tt.high,nt=tt.low,st=(et>>>19|nt<<13)^(et<<3|nt>>>29)^et>>>6,it=(nt>>>19|et<<13)^(nt<<3|et>>>29)^(nt>>>6|et<<26),rt=c[H-7],ot=rt.high,at=rt.low,ut=c[H-16],ct=ut.high,lt=ut.low;G=(G=(G=K+ot+(($=J+at)>>>0<J>>>0?1:0))+st+(($+=it)>>>0<it>>>0?1:0))+ct+(($+=lt)>>>0<lt>>>0?1:0),X.high=G,X.low=$}var ht,pt=V&F^~V&z,dt=q&j^~q&W,ft=M&D^M&R^D&R,_t=E&I^E&N^I&N,mt=(M>>>28|E<<4)^(M<<30|E>>>2)^(M<<25|E>>>7),gt=(E>>>28|M<<4)^(E<<30|M>>>2)^(E<<25|M>>>7),vt=(V>>>14|q<<18)^(V>>>18|q<<14)^(V<<23|q>>>9),yt=(q>>>14|V<<18)^(q>>>18|V<<14)^(q<<23|V>>>9),wt=u[H],bt=wt.high,xt=wt.low,Tt=L+vt+((ht=U+yt)>>>0<U>>>0?1:0),At=gt+_t;L=z,U=W,z=F,W=j,F=V,j=q,V=B+(Tt=(Tt=(Tt=Tt+pt+((ht+=dt)>>>0<dt>>>0?1:0))+bt+((ht+=xt)>>>0<xt>>>0?1:0))+G+((ht+=$)>>>0<$>>>0?1:0))+((q=P+ht|0)>>>0<P>>>0?1:0)|0,B=R,P=N,R=D,N=I,D=M,I=E,M=Tt+(mt+ft+(At>>>0<gt>>>0?1:0))+((E=ht+At|0)>>>0<ht>>>0?1:0)|0}f=s.low=f+E,s.high=d+M+(f>>>0<E>>>0?1:0),m=i.low=m+I,i.high=_+D+(m>>>0<I>>>0?1:0),v=r.low=v+N,r.high=g+R+(v>>>0<N>>>0?1:0),w=o.low=w+P,o.high=y+B+(w>>>0<P>>>0?1:0),x=a.low=x+q,a.high=b+V+(x>>>0<q>>>0?1:0),A=l.low=A+j,l.high=T+F+(A>>>0<j>>>0?1:0),C=h.low=C+W,h.high=k+z+(C>>>0<W>>>0?1:0),O=p.low=O+U,p.high=S+L+(O>>>0<U>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;return e[s>>>5]|=128<<24-s%32,e[30+(s+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(s+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=n._createHelper(l),e.HmacSHA512=n._createHmacHelper(l)}(),t.SHA512}(ia(),aa())),Ia.exports}var Na,Ba={exports:{}};var Pa,Va={exports:{}};function qa(){return Pa||(Pa=1,Va.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.x64.Word,a=n.algo,u=[],c=[],l=[];!function(){for(var t=1,e=0,n=0;n<24;n++){u[t+5*e]=(n+1)*(n+2)/2%64;var s=(2*t+3*e)%5;t=e%5,e=s}for(t=0;t<5;t++)for(e=0;e<5;e++)c[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,r=0;r<24;r++){for(var a=0,h=0,p=0;p<7;p++){if(1&i){var d=(1<<p)-1;d<32?h^=1<<d:a^=1<<d-32}128&i?i=i<<1^113:i<<=1}l[r]=o.create(a,h)}}();var h=[];!function(){for(var t=0;t<25;t++)h[t]=o.create()}();var p=a.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,s=this.blockSize/2,i=0;i<s;i++){var r=t[e+2*i],o=t[e+2*i+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(O=n[i]).high^=o,O.low^=r}for(var a=0;a<24;a++){for(var p=0;p<5;p++){for(var d=0,f=0,_=0;_<5;_++)d^=(O=n[p+5*_]).high,f^=O.low;var m=h[p];m.high=d,m.low=f}for(p=0;p<5;p++){var g=h[(p+4)%5],v=h[(p+1)%5],y=v.high,w=v.low;for(d=g.high^(y<<1|w>>>31),f=g.low^(w<<1|y>>>31),_=0;_<5;_++)(O=n[p+5*_]).high^=d,O.low^=f}for(var b=1;b<25;b++){var x=(O=n[b]).high,T=O.low,A=u[b];A<32?(d=x<<A|T>>>32-A,f=T<<A|x>>>32-A):(d=T<<A-32|x>>>64-A,f=x<<A-32|T>>>64-A);var k=h[c[b]];k.high=d,k.low=f}var C=h[0],S=n[0];for(C.high=S.high,C.low=S.low,p=0;p<5;p++)for(_=0;_<5;_++){var O=n[b=p+5*_],M=h[b],E=h[(p+1)%5+5*_],D=h[(p+2)%5+5*_];O.high=M.high^~E.high&D.high,O.low=M.low^~E.low&D.low}O=n[0];var I=l[a];O.high^=I.high,O.low^=I.low}},_doFinalize:function(){var t=this._data,n=t.words;this._nDataBytes;var s=8*t.sigBytes,r=32*this.blockSize;n[s>>>5]|=1<<24-s%32,n[(e.ceil((s+1)/r)*r>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,u=a/8,c=[],l=0;l<u;l++){var h=o[l],p=h.high,d=h.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),c.push(d),c.push(p)}return new i.init(c,a)},clone:function(){for(var t=r.clone.call(this),e=t._state=this._state.slice(0),n=0;n<25;n++)e[n]=e[n].clone();return t}});n.SHA3=r._createHelper(p),n.HmacSHA3=r._createHmacHelper(p)}(Math),t.SHA3}(ia(),aa())),Va.exports}var Fa,ja={exports:{}};var za,Wa={exports:{}};function La(){return za||(za=1,Wa.exports=function(t){var e,n,s;n=(e=t).lib.Base,s=e.enc.Utf8,e.algo.HMAC=n.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var n=t.blockSize,i=4*n;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var r=this._oKey=e.clone(),o=this._iKey=e.clone(),a=r.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;r.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})}(ia())),Wa.exports}var Ua,Ha={exports:{}};var $a,Ga={exports:{}};function Xa(){return $a||($a=1,Ga.exports=function(t){return n=(e=t).lib,s=n.Base,i=n.WordArray,r=e.algo,o=r.MD5,a=r.EvpKDF=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n,s=this.cfg,r=s.hasher.create(),o=i.create(),a=o.words,u=s.keySize,c=s.iterations;a.length<u;){n&&r.update(n),n=r.update(t).finalize(e),r.reset();for(var l=1;l<c;l++)n=r.finalize(n),r.reset();o.concat(n)}return o.sigBytes=4*u,o}}),e.EvpKDF=function(t,e,n){return a.create(n).compute(t,e)},t.EvpKDF;var e,n,s,i,r,o,a}(ia(),ka(),La())),Ga.exports}var Za,Ya={exports:{}};function Qa(){return Za||(Za=1,Ya.exports=function(t){t.lib.Cipher||function(e){var n=t,s=n.lib,i=s.Base,r=s.WordArray,o=s.BufferedBlockAlgorithm,a=n.enc;a.Utf8;var u=a.Base64,c=n.algo.EvpKDF,l=s.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?y:g}return function(e){return{encrypt:function(n,s,i){return t(s).encrypt(e,n,s,i)},decrypt:function(n,s,i){return t(s).decrypt(e,n,s,i)}}}}()});s.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=n.mode={},p=s.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),d=h.CBC=function(){var t=p.extend();function n(t,n,s){var i,r=this._iv;r?(i=r,this._iv=e):i=this._prevBlock;for(var o=0;o<s;o++)t[n+o]^=i[o]}return t.Encryptor=t.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize;n.call(this,t,e,i),s.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),t.Decryptor=t.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize,r=t.slice(e,e+i);s.decryptBlock(t,e),n.call(this,t,e,i),this._prevBlock=r}}),t}(),f=(n.pad={}).Pkcs7={pad:function(t,e){for(var n=4*e,s=n-t.sigBytes%n,i=s<<24|s<<16|s<<8|s,o=[],a=0;a<s;a+=4)o.push(i);var u=r.create(o,s);t.concat(u)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};s.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:f}),reset:function(){var t;l.reset.call(this);var e=this.cfg,n=e.iv,s=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=s.createEncryptor:(t=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,n&&n.words):(this._mode=t.call(s,this,n&&n.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var _=s.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),m=(n.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,n=t.salt;return(n?r.create([1398893684,1701076831]).concat(n).concat(e):e).toString(u)},parse:function(t){var e,n=u.parse(t),s=n.words;return 1398893684==s[0]&&1701076831==s[1]&&(e=r.create(s.slice(2,4)),s.splice(0,4),n.sigBytes-=16),_.create({ciphertext:n,salt:e})}},g=s.SerializableCipher=i.extend({cfg:i.extend({format:m}),encrypt:function(t,e,n,s){s=this.cfg.extend(s);var i=t.createEncryptor(n,s),r=i.finalize(e),o=i.cfg;return _.create({ciphertext:r,key:n,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:s.format})},decrypt:function(t,e,n,s){return s=this.cfg.extend(s),e=this._parse(e,s.format),t.createDecryptor(n,s).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),v=(n.kdf={}).OpenSSL={execute:function(t,e,n,s,i){if(s||(s=r.random(8)),i)o=c.create({keySize:e+n,hasher:i}).compute(t,s);else var o=c.create({keySize:e+n}).compute(t,s);var a=r.create(o.words.slice(e),4*n);return o.sigBytes=4*e,_.create({key:o,iv:a,salt:s})}},y=s.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:v}),encrypt:function(t,e,n,s){var i=(s=this.cfg.extend(s)).kdf.execute(n,t.keySize,t.ivSize,s.salt,s.hasher);s.iv=i.iv;var r=g.encrypt.call(this,t,e,i.key,s);return r.mixIn(i),r},decrypt:function(t,e,n,s){s=this.cfg.extend(s),e=this._parse(e,s.format);var i=s.kdf.execute(n,t.keySize,t.ivSize,e.salt,s.hasher);return s.iv=i.iv,g.decrypt.call(this,t,e,i.key,s)}})}()}(ia(),Xa())),Ya.exports}var Ka,Ja={exports:{}};function tu(){return Ka||(Ka=1,Ja.exports=function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function n(t,e,n,s){var i,r=this._iv;r?(i=r.slice(0),this._iv=void 0):i=this._prevBlock,s.encryptBlock(i,0);for(var o=0;o<n;o++)t[e+o]^=i[o]}return e.Encryptor=e.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize;n.call(this,t,e,i,s),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize,r=t.slice(e,e+i);n.call(this,t,e,i,s),this._prevBlock=r}}),e}(),t.mode.CFB}(ia(),Qa())),Ja.exports}var eu,nu={exports:{}};function su(){return eu||(eu=1,nu.exports=function(t){return t.mode.CTR=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,s=n.blockSize,i=this._iv,r=this._counter;i&&(r=this._counter=i.slice(0),this._iv=void 0);var o=r.slice(0);n.encryptBlock(o,0),r[s-1]=r[s-1]+1|0;for(var a=0;a<s;a++)t[e+a]^=o[a]}}),e.Decryptor=n,e),t.mode.CTR;var e,n}(ia(),Qa())),nu.exports}var iu,ru={exports:{}};function ou(){return iu||(iu=1,ru.exports=function(t){
|
|
15
|
+
*/$o=Xo,Go=Xo.exports,function(){var t,e="Expected a function",n="__lodash_hash_undefined__",s="__lodash_placeholder__",i=16,r=32,o=64,a=128,u=256,c=1/0,l=9007199254740991,h=NaN,p=4294967295,d=[["ary",a],["bind",1],["bindKey",2],["curry",8],["curryRight",i],["flip",512],["partial",r],["partialRight",o],["rearg",u]],f="[object Arguments]",_="[object Array]",m="[object Boolean]",g="[object Date]",v="[object Error]",y="[object Function]",w="[object GeneratorFunction]",b="[object Map]",x="[object Number]",T="[object Object]",A="[object Promise]",k="[object RegExp]",C="[object Set]",S="[object String]",O="[object Symbol]",M="[object WeakMap]",E="[object ArrayBuffer]",D="[object DataView]",I="[object Float32Array]",R="[object Float64Array]",N="[object Int8Array]",B="[object Int16Array]",P="[object Int32Array]",V="[object Uint8Array]",q="[object Uint8ClampedArray]",F="[object Uint16Array]",j="[object Uint32Array]",z=/\b__p \+= '';/g,W=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,U=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,$=RegExp(U.source),G=RegExp(H.source),X=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,Y=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,J=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,et=RegExp(tt.source),nt=/^\s+/,st=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,rt=/\{\n\/\* \[wrapped with (.+)\] \*/,ot=/,? & /,at=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ut=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ht=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,dt=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,_t=/^0o[0-7]+$/i,mt=/^(?:0|[1-9]\d*)$/,gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,yt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",bt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",xt="\\u2700-\\u27bf",Tt="a-z\\xdf-\\xf6\\xf8-\\xff",At="A-Z\\xc0-\\xd6\\xd8-\\xde",kt="\\ufe0e\\ufe0f",Ct="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",St="['’]",Ot="["+wt+"]",Mt="["+Ct+"]",Et="["+bt+"]",Dt="\\d+",It="["+xt+"]",Rt="["+Tt+"]",Nt="[^"+wt+Ct+Dt+xt+Tt+At+"]",Bt="\\ud83c[\\udffb-\\udfff]",Pt="[^"+wt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",qt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ft="["+At+"]",jt="\\u200d",zt="(?:"+Rt+"|"+Nt+")",Wt="(?:"+Ft+"|"+Nt+")",Lt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ut="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ht="(?:"+Et+"|"+Bt+")?",$t="["+kt+"]?",Gt=$t+Ht+"(?:"+jt+"(?:"+[Pt,Vt,qt].join("|")+")"+$t+Ht+")*",Xt="(?:"+[It,Vt,qt].join("|")+")"+Gt,Zt="(?:"+[Pt+Et+"?",Et,Vt,qt,Ot].join("|")+")",Yt=RegExp(St,"g"),Qt=RegExp(Et,"g"),Kt=RegExp(Bt+"(?="+Bt+")|"+Zt+Gt,"g"),Jt=RegExp([Ft+"?"+Rt+"+"+Lt+"(?="+[Mt,Ft,"$"].join("|")+")",Wt+"+"+Ut+"(?="+[Mt,Ft+zt,"$"].join("|")+")",Ft+"?"+zt+"+"+Lt,Ft+"+"+Ut,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Dt,Xt].join("|"),"g"),te=RegExp("["+jt+wt+bt+kt+"]"),ee=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ne=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],se=-1,ie={};ie[I]=ie[R]=ie[N]=ie[B]=ie[P]=ie[V]=ie[q]=ie[F]=ie[j]=!0,ie[f]=ie[_]=ie[E]=ie[m]=ie[D]=ie[g]=ie[v]=ie[y]=ie[b]=ie[x]=ie[T]=ie[k]=ie[C]=ie[S]=ie[M]=!1;var re={};re[f]=re[_]=re[E]=re[D]=re[m]=re[g]=re[I]=re[R]=re[N]=re[B]=re[P]=re[b]=re[x]=re[T]=re[k]=re[C]=re[S]=re[O]=re[V]=re[q]=re[F]=re[j]=!0,re[v]=re[y]=re[M]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ae=parseFloat,ue=parseInt,ce="object"==typeof Uo&&Uo&&Uo.Object===Object&&Uo,le="object"==typeof self&&self&&self.Object===Object&&self,he=ce||le||Function("return this")(),pe=Go&&!Go.nodeType&&Go,de=pe&&$o&&!$o.nodeType&&$o,fe=de&&de.exports===pe,_e=fe&&ce.process,me=function(){try{var t=de&&de.require&&de.require("util").types;return t||_e&&_e.binding&&_e.binding("util")}catch(t){}}(),ge=me&&me.isArrayBuffer,ve=me&&me.isDate,ye=me&&me.isMap,we=me&&me.isRegExp,be=me&&me.isSet,xe=me&&me.isTypedArray;function Te(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ae(t,e,n,s){for(var i=-1,r=null==t?0:t.length;++i<r;){var o=t[i];e(s,o,n(o),t)}return s}function ke(t,e){for(var n=-1,s=null==t?0:t.length;++n<s&&!1!==e(t[n],n,t););return t}function Ce(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Se(t,e){for(var n=-1,s=null==t?0:t.length;++n<s;)if(!e(t[n],n,t))return!1;return!0}function Oe(t,e){for(var n=-1,s=null==t?0:t.length,i=0,r=[];++n<s;){var o=t[n];e(o,n,t)&&(r[i++]=o)}return r}function Me(t,e){return!(null==t||!t.length)&&Fe(t,e,0)>-1}function Ee(t,e,n){for(var s=-1,i=null==t?0:t.length;++s<i;)if(n(e,t[s]))return!0;return!1}function De(t,e){for(var n=-1,s=null==t?0:t.length,i=Array(s);++n<s;)i[n]=e(t[n],n,t);return i}function Ie(t,e){for(var n=-1,s=e.length,i=t.length;++n<s;)t[i+n]=e[n];return t}function Re(t,e,n,s){var i=-1,r=null==t?0:t.length;for(s&&r&&(n=t[++i]);++i<r;)n=e(n,t[i],i,t);return n}function Ne(t,e,n,s){var i=null==t?0:t.length;for(s&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Be(t,e){for(var n=-1,s=null==t?0:t.length;++n<s;)if(e(t[n],n,t))return!0;return!1}var Pe=Le("length");function Ve(t,e,n){var s;return n(t,(function(t,n,i){if(e(t,n,i))return s=n,!1})),s}function qe(t,e,n,s){for(var i=t.length,r=n+(s?1:-1);s?r--:++r<i;)if(e(t[r],r,t))return r;return-1}function Fe(t,e,n){return e==e?function(t,e,n){for(var s=n-1,i=t.length;++s<i;)if(t[s]===e)return s;return-1}(t,e,n):qe(t,ze,n)}function je(t,e,n,s){for(var i=n-1,r=t.length;++i<r;)if(s(t[i],e))return i;return-1}function ze(t){return t!=t}function We(t,e){var n=null==t?0:t.length;return n?$e(t,e)/n:h}function Le(e){return function(n){return null==n?t:n[e]}}function Ue(e){return function(n){return null==e?t:e[n]}}function He(t,e,n,s,i){return i(t,(function(t,i,r){n=s?(s=!1,t):e(n,t,i,r)})),n}function $e(e,n){for(var s,i=-1,r=e.length;++i<r;){var o=n(e[i]);o!==t&&(s=s===t?o:s+o)}return s}function Ge(t,e){for(var n=-1,s=Array(t);++n<t;)s[n]=e(n);return s}function Xe(t){return t?t.slice(0,pn(t)+1).replace(nt,""):t}function Ze(t){return function(e){return t(e)}}function Ye(t,e){return De(e,(function(e){return t[e]}))}function Qe(t,e){return t.has(e)}function Ke(t,e){for(var n=-1,s=t.length;++n<s&&Fe(e,t[n],0)>-1;);return n}function Je(t,e){for(var n=t.length;n--&&Fe(e,t[n],0)>-1;);return n}var tn=Ue({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),en=Ue({"&":"&","<":"<",">":">",'"':""","'":"'"});function nn(t){return"\\"+oe[t]}function sn(t){return te.test(t)}function rn(t){var e=-1,n=Array(t.size);return t.forEach((function(t,s){n[++e]=[s,t]})),n}function on(t,e){return function(n){return t(e(n))}}function an(t,e){for(var n=-1,i=t.length,r=0,o=[];++n<i;){var a=t[n];a!==e&&a!==s||(t[n]=s,o[r++]=n)}return o}function un(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}function cn(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=[t,t]})),n}function ln(t){return sn(t)?function(t){for(var e=Kt.lastIndex=0;Kt.test(t);)++e;return e}(t):Pe(t)}function hn(t){return sn(t)?function(t){return t.match(Kt)||[]}(t):function(t){return t.split("")}(t)}function pn(t){for(var e=t.length;e--&&st.test(t.charAt(e)););return e}var dn=Ue({"&":"&","<":"<",">":">",""":'"',"'":"'"}),fn=function st(wt){var bt,xt=(wt=null==wt?he:fn.defaults(he.Object(),wt,fn.pick(he,ne))).Array,Tt=wt.Date,At=wt.Error,kt=wt.Function,Ct=wt.Math,St=wt.Object,Ot=wt.RegExp,Mt=wt.String,Et=wt.TypeError,Dt=xt.prototype,It=kt.prototype,Rt=St.prototype,Nt=wt["__core-js_shared__"],Bt=It.toString,Pt=Rt.hasOwnProperty,Vt=0,qt=(bt=/[^.]+$/.exec(Nt&&Nt.keys&&Nt.keys.IE_PROTO||""))?"Symbol(src)_1."+bt:"",Ft=Rt.toString,jt=Bt.call(St),zt=he._,Wt=Ot("^"+Bt.call(Pt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Lt=fe?wt.Buffer:t,Ut=wt.Symbol,Ht=wt.Uint8Array,$t=Lt?Lt.allocUnsafe:t,Gt=on(St.getPrototypeOf,St),Xt=St.create,Zt=Rt.propertyIsEnumerable,Kt=Dt.splice,te=Ut?Ut.isConcatSpreadable:t,oe=Ut?Ut.iterator:t,ce=Ut?Ut.toStringTag:t,le=function(){try{var t=pr(St,"defineProperty");return t({},"",{}),t}catch(t){}}(),pe=wt.clearTimeout!==he.clearTimeout&&wt.clearTimeout,de=Tt&&Tt.now!==he.Date.now&&Tt.now,_e=wt.setTimeout!==he.setTimeout&&wt.setTimeout,me=Ct.ceil,Pe=Ct.floor,Ue=St.getOwnPropertySymbols,_n=Lt?Lt.isBuffer:t,mn=wt.isFinite,gn=Dt.join,vn=on(St.keys,St),yn=Ct.max,wn=Ct.min,bn=Tt.now,xn=wt.parseInt,Tn=Ct.random,An=Dt.reverse,kn=pr(wt,"DataView"),Cn=pr(wt,"Map"),Sn=pr(wt,"Promise"),On=pr(wt,"Set"),Mn=pr(wt,"WeakMap"),En=pr(St,"create"),Dn=Mn&&new Mn,In={},Rn=qr(kn),Nn=qr(Cn),Bn=qr(Sn),Pn=qr(On),Vn=qr(Mn),qn=Ut?Ut.prototype:t,Fn=qn?qn.valueOf:t,jn=qn?qn.toString:t;function zn(t){if(na(t)&&!Ho(t)&&!(t instanceof Hn)){if(t instanceof Un)return t;if(Pt.call(t,"__wrapped__"))return Fr(t)}return new Un(t)}var Wn=function(){function e(){}return function(n){if(!ea(n))return{};if(Xt)return Xt(n);e.prototype=n;var s=new e;return e.prototype=t,s}}();function Ln(){}function Un(e,n){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=t}function Hn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Gn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Xn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var s=t[e];this.set(s[0],s[1])}}function Zn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Xn;++e<n;)this.add(t[e])}function Yn(t){var e=this.__data__=new Gn(t);this.size=e.size}function Qn(t,e){var n=Ho(t),s=!n&&Uo(t),i=!n&&!s&&Zo(t),r=!n&&!s&&!i&&la(t),o=n||s||i||r,a=o?Ge(t.length,Mt):[],u=a.length;for(var c in t)!e&&!Pt.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||yr(c,u))||a.push(c);return a}function Kn(e){var n=e.length;return n?e[Zs(0,n-1)]:t}function Jn(t,e){return Br(Ei(t),us(e,0,t.length))}function ts(t){return Br(Ei(t))}function es(e,n,s){(s!==t&&!zo(e[n],s)||s===t&&!(n in e))&&os(e,n,s)}function ns(e,n,s){var i=e[n];Pt.call(e,n)&&zo(i,s)&&(s!==t||n in e)||os(e,n,s)}function ss(t,e){for(var n=t.length;n--;)if(zo(t[n][0],e))return n;return-1}function is(t,e,n,s){return ds(t,(function(t,i,r){e(s,t,n(t),r)})),s}function rs(t,e){return t&&Di(e,Ia(e),t)}function os(t,e,n){"__proto__"==e&&le?le(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function as(e,n){for(var s=-1,i=n.length,r=xt(i),o=null==e;++s<i;)r[s]=o?t:Sa(e,n[s]);return r}function us(e,n,s){return e==e&&(s!==t&&(e=e<=s?e:s),n!==t&&(e=e>=n?e:n)),e}function cs(e,n,s,i,r,o){var a,u=1&n,c=2&n,l=4&n;if(s&&(a=r?s(e,i,r,o):s(e)),a!==t)return a;if(!ea(e))return e;var h=Ho(e);if(h){if(a=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Pt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(e),!u)return Ei(e,a)}else{var p=_r(e),d=p==y||p==w;if(Zo(e))return Ai(e,u);if(p==T||p==f||d&&!r){if(a=c||d?{}:gr(e),!u)return c?function(t,e){return Di(t,fr(t),e)}(e,function(t,e){return t&&Di(e,Ra(e),t)}(a,e)):function(t,e){return Di(t,dr(t),e)}(e,rs(a,e))}else{if(!re[p])return r?e:{};a=function(t,e,n){var s,i=t.constructor;switch(e){case E:return ki(t);case m:case g:return new i(+t);case D:return function(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case I:case R:case N:case B:case P:case V:case q:case F:case j:return Ci(t,n);case b:return new i;case x:case S:return new i(t);case k:return function(t){var e=new t.constructor(t.source,ht.exec(t));return e.lastIndex=t.lastIndex,e}(t);case C:return new i;case O:return s=t,Fn?St(Fn.call(s)):{}}}(e,p,u)}}o||(o=new Yn);var _=o.get(e);if(_)return _;o.set(e,a),aa(e)?e.forEach((function(t){a.add(cs(t,n,s,t,e,o))})):sa(e)&&e.forEach((function(t,i){a.set(i,cs(t,n,s,i,e,o))}));var v=h?t:(l?c?rr:ir:c?Ra:Ia)(e);return ke(v||e,(function(t,i){v&&(t=e[i=t]),ns(a,i,cs(t,n,s,i,e,o))})),a}function ls(e,n,s){var i=s.length;if(null==e)return!i;for(e=St(e);i--;){var r=s[i],o=n[r],a=e[r];if(a===t&&!(r in e)||!o(a))return!1}return!0}function hs(n,s,i){if("function"!=typeof n)throw new Et(e);return Dr((function(){n.apply(t,i)}),s)}function ps(t,e,n,s){var i=-1,r=Me,o=!0,a=t.length,u=[],c=e.length;if(!a)return u;n&&(e=De(e,Ze(n))),s?(r=Ee,o=!1):e.length>=200&&(r=Qe,o=!1,e=new Zn(e));t:for(;++i<a;){var l=t[i],h=null==n?l:n(l);if(l=s||0!==l?l:0,o&&h==h){for(var p=c;p--;)if(e[p]===h)continue t;u.push(l)}else r(e,h,s)||u.push(l)}return u}zn.templateSettings={escape:X,evaluate:Z,interpolate:Y,variable:"",imports:{_:zn}},zn.prototype=Ln.prototype,zn.prototype.constructor=zn,Un.prototype=Wn(Ln.prototype),Un.prototype.constructor=Un,Hn.prototype=Wn(Ln.prototype),Hn.prototype.constructor=Hn,$n.prototype.clear=function(){this.__data__=En?En(null):{},this.size=0},$n.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},$n.prototype.get=function(e){var s=this.__data__;if(En){var i=s[e];return i===n?t:i}return Pt.call(s,e)?s[e]:t},$n.prototype.has=function(e){var n=this.__data__;return En?n[e]!==t:Pt.call(n,e)},$n.prototype.set=function(e,s){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=En&&s===t?n:s,this},Gn.prototype.clear=function(){this.__data__=[],this.size=0},Gn.prototype.delete=function(t){var e=this.__data__,n=ss(e,t);return!(n<0||(n==e.length-1?e.pop():Kt.call(e,n,1),--this.size,0))},Gn.prototype.get=function(e){var n=this.__data__,s=ss(n,e);return s<0?t:n[s][1]},Gn.prototype.has=function(t){return ss(this.__data__,t)>-1},Gn.prototype.set=function(t,e){var n=this.__data__,s=ss(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this},Xn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(Cn||Gn),string:new $n}},Xn.prototype.delete=function(t){var e=lr(this,t).delete(t);return this.size-=e?1:0,e},Xn.prototype.get=function(t){return lr(this,t).get(t)},Xn.prototype.has=function(t){return lr(this,t).has(t)},Xn.prototype.set=function(t,e){var n=lr(this,t),s=n.size;return n.set(t,e),this.size+=n.size==s?0:1,this},Zn.prototype.add=Zn.prototype.push=function(t){return this.__data__.set(t,n),this},Zn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Yn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Yn.prototype.get=function(t){return this.__data__.get(t)},Yn.prototype.has=function(t){return this.__data__.has(t)},Yn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Gn){var s=n.__data__;if(!Cn||s.length<199)return s.push([t,e]),this.size=++n.size,this;n=this.__data__=new Xn(s)}return n.set(t,e),this.size=n.size,this};var ds=Ni(bs),fs=Ni(xs,!0);function _s(t,e){var n=!0;return ds(t,(function(t,s,i){return n=!!e(t,s,i)})),n}function ms(e,n,s){for(var i=-1,r=e.length;++i<r;){var o=e[i],a=n(o);if(null!=a&&(u===t?a==a&&!ca(a):s(a,u)))var u=a,c=o}return c}function gs(t,e){var n=[];return ds(t,(function(t,s,i){e(t,s,i)&&n.push(t)})),n}function vs(t,e,n,s,i){var r=-1,o=t.length;for(n||(n=vr),i||(i=[]);++r<o;){var a=t[r];e>0&&n(a)?e>1?vs(a,e-1,n,s,i):Ie(i,a):s||(i[i.length]=a)}return i}var ys=Bi(),ws=Bi(!0);function bs(t,e){return t&&ys(t,e,Ia)}function xs(t,e){return t&&ws(t,e,Ia)}function Ts(t,e){return Oe(e,(function(e){return Ko(t[e])}))}function As(e,n){for(var s=0,i=(n=wi(n,e)).length;null!=e&&s<i;)e=e[Vr(n[s++])];return s&&s==i?e:t}function ks(t,e,n){var s=e(t);return Ho(t)?s:Ie(s,n(t))}function Cs(e){return null==e?e===t?"[object Undefined]":"[object Null]":ce&&ce in St(e)?function(e){var n=Pt.call(e,ce),s=e[ce];try{e[ce]=t;var i=!0}catch(t){}var r=Ft.call(e);return i&&(n?e[ce]=s:delete e[ce]),r}(e):function(t){return Ft.call(t)}(e)}function Ss(t,e){return t>e}function Os(t,e){return null!=t&&Pt.call(t,e)}function Ms(t,e){return null!=t&&e in St(t)}function Es(e,n,s){for(var i=s?Ee:Me,r=e[0].length,o=e.length,a=o,u=xt(o),c=1/0,l=[];a--;){var h=e[a];a&&n&&(h=De(h,Ze(n))),c=wn(h.length,c),u[a]=!s&&(n||r>=120&&h.length>=120)?new Zn(a&&h):t}h=e[0];var p=-1,d=u[0];t:for(;++p<r&&l.length<c;){var f=h[p],_=n?n(f):f;if(f=s||0!==f?f:0,!(d?Qe(d,_):i(l,_,s))){for(a=o;--a;){var m=u[a];if(!(m?Qe(m,_):i(e[a],_,s)))continue t}d&&d.push(_),l.push(f)}}return l}function Ds(e,n,s){var i=null==(e=Or(e,n=wi(n,e)))?e:e[Vr(Yr(n))];return null==i?t:Te(i,e,s)}function Is(t){return na(t)&&Cs(t)==f}function Rs(e,n,s,i,r){return e===n||(null==e||null==n||!na(e)&&!na(n)?e!=e&&n!=n:function(e,n,s,i,r,o){var a=Ho(e),u=Ho(n),c=a?_:_r(e),l=u?_:_r(n),h=(c=c==f?T:c)==T,p=(l=l==f?T:l)==T,d=c==l;if(d&&Zo(e)){if(!Zo(n))return!1;a=!0,h=!1}if(d&&!h)return o||(o=new Yn),a||la(e)?nr(e,n,s,i,r,o):function(t,e,n,s,i,r,o){switch(n){case D:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case E:return!(t.byteLength!=e.byteLength||!r(new Ht(t),new Ht(e)));case m:case g:case x:return zo(+t,+e);case v:return t.name==e.name&&t.message==e.message;case k:case S:return t==e+"";case b:var a=rn;case C:var u=1&s;if(a||(a=un),t.size!=e.size&&!u)return!1;var c=o.get(t);if(c)return c==e;s|=2,o.set(t,e);var l=nr(a(t),a(e),s,i,r,o);return o.delete(t),l;case O:if(Fn)return Fn.call(t)==Fn.call(e)}return!1}(e,n,c,s,i,r,o);if(!(1&s)){var y=h&&Pt.call(e,"__wrapped__"),w=p&&Pt.call(n,"__wrapped__");if(y||w){var A=y?e.value():e,M=w?n.value():n;return o||(o=new Yn),r(A,M,s,i,o)}}return!!d&&(o||(o=new Yn),function(e,n,s,i,r,o){var a=1&s,u=ir(e),c=u.length,l=ir(n),h=l.length;if(c!=h&&!a)return!1;for(var p=c;p--;){var d=u[p];if(!(a?d in n:Pt.call(n,d)))return!1}var f=o.get(e),_=o.get(n);if(f&&_)return f==n&&_==e;var m=!0;o.set(e,n),o.set(n,e);for(var g=a;++p<c;){var v=e[d=u[p]],y=n[d];if(i)var w=a?i(y,v,d,n,e,o):i(v,y,d,e,n,o);if(!(w===t?v===y||r(v,y,s,i,o):w)){m=!1;break}g||(g="constructor"==d)}if(m&&!g){var b=e.constructor,x=n.constructor;b==x||!("constructor"in e)||!("constructor"in n)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(m=!1)}return o.delete(e),o.delete(n),m}(e,n,s,i,r,o))}(e,n,s,i,Rs,r))}function Ns(e,n,s,i){var r=s.length,o=r,a=!i;if(null==e)return!o;for(e=St(e);r--;){var u=s[r];if(a&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++r<o;){var c=(u=s[r])[0],l=e[c],h=u[1];if(a&&u[2]){if(l===t&&!(c in e))return!1}else{var p=new Yn;if(i)var d=i(l,h,c,e,n,p);if(!(d===t?Rs(h,l,3,i,p):d))return!1}}return!0}function Bs(t){return!(!ea(t)||(e=t,qt&&qt in e))&&(Ko(t)?Wt:ft).test(qr(t));var e}function Ps(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?Ho(t)?Ws(t[0],t[1]):zs(t):du(t)}function Vs(t){if(!Ar(t))return vn(t);var e=[];for(var n in St(t))Pt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function qs(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var n in St(t))e.push(n);return e}(t);var e=Ar(t),n=[];for(var s in t)("constructor"!=s||!e&&Pt.call(t,s))&&n.push(s);return n}function Fs(t,e){return t<e}function js(t,e){var n=-1,s=Go(t)?xt(t.length):[];return ds(t,(function(t,i,r){s[++n]=e(t,i,r)})),s}function zs(t){var e=hr(t);return 1==e.length&&e[0][2]?Cr(e[0][0],e[0][1]):function(n){return n===t||Ns(n,t,e)}}function Ws(e,n){return br(e)&&kr(n)?Cr(Vr(e),n):function(s){var i=Sa(s,e);return i===t&&i===n?Oa(s,e):Rs(n,i,3)}}function Ls(e,n,s,i,r){e!==n&&ys(n,(function(o,a){if(r||(r=new Yn),ea(o))!function(e,n,s,i,r,o,a){var u=Mr(e,s),c=Mr(n,s),l=a.get(c);if(l)es(e,s,l);else{var h=o?o(u,c,s+"",e,n,a):t,p=h===t;if(p){var d=Ho(c),f=!d&&Zo(c),_=!d&&!f&&la(c);h=c,d||f||_?Ho(u)?h=u:Xo(u)?h=Ei(u):f?(p=!1,h=Ai(c,!0)):_?(p=!1,h=Ci(c,!0)):h=[]:ra(c)||Uo(c)?(h=u,Uo(u)?h=va(u):ea(u)&&!Ko(u)||(h=gr(c))):p=!1}p&&(a.set(c,h),r(h,c,i,o,a),a.delete(c)),es(e,s,h)}}(e,n,a,s,Ls,i,r);else{var u=i?i(Mr(e,a),o,a+"",e,n,r):t;u===t&&(u=o),es(e,a,u)}}),Ra)}function Us(e,n){var s=e.length;if(s)return yr(n+=n<0?s:0,s)?e[n]:t}function Hs(t,e,n){e=e.length?De(e,(function(t){return Ho(t)?function(e){return As(e,1===t.length?t[0]:t)}:t})):[iu];var s=-1;e=De(e,Ze(cr()));var i=js(t,(function(t,n,i){var r=De(e,(function(e){return e(t)}));return{criteria:r,index:++s,value:t}}));return function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}(i,(function(t,e){return function(t,e,n){for(var s=-1,i=t.criteria,r=e.criteria,o=i.length,a=n.length;++s<o;){var u=Si(i[s],r[s]);if(u)return s>=a?u:u*("desc"==n[s]?-1:1)}return t.index-e.index}(t,e,n)}))}function $s(t,e,n){for(var s=-1,i=e.length,r={};++s<i;){var o=e[s],a=As(t,o);n(a,o)&&ti(r,wi(o,t),a)}return r}function Gs(t,e,n,s){var i=s?je:Fe,r=-1,o=e.length,a=t;for(t===e&&(e=Ei(e)),n&&(a=De(t,Ze(n)));++r<o;)for(var u=0,c=e[r],l=n?n(c):c;(u=i(a,l,u,s))>-1;)a!==t&&Kt.call(a,u,1),Kt.call(t,u,1);return t}function Xs(t,e){for(var n=t?e.length:0,s=n-1;n--;){var i=e[n];if(n==s||i!==r){var r=i;yr(i)?Kt.call(t,i,1):pi(t,i)}}return t}function Zs(t,e){return t+Pe(Tn()*(e-t+1))}function Ys(t,e){var n="";if(!t||e<1||e>l)return n;do{e%2&&(n+=t),(e=Pe(e/2))&&(t+=t)}while(e);return n}function Qs(t,e){return Ir(Sr(t,e,iu),t+"")}function Ks(t){return Kn(za(t))}function Js(t,e){var n=za(t);return Br(n,us(e,0,n.length))}function ti(e,n,s,i){if(!ea(e))return e;for(var r=-1,o=(n=wi(n,e)).length,a=o-1,u=e;null!=u&&++r<o;){var c=Vr(n[r]),l=s;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(r!=a){var h=u[c];(l=i?i(h,c,u):t)===t&&(l=ea(h)?h:yr(n[r+1])?[]:{})}ns(u,c,l),u=u[c]}return e}var ei=Dn?function(t,e){return Dn.set(t,e),t}:iu,ni=le?function(t,e){return le(t,"toString",{configurable:!0,enumerable:!1,value:eu(e),writable:!0})}:iu;function si(t){return Br(za(t))}function ii(t,e,n){var s=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=xt(i);++s<i;)r[s]=t[s+e];return r}function ri(t,e){var n;return ds(t,(function(t,s,i){return!(n=e(t,s,i))})),!!n}function oi(t,e,n){var s=0,i=null==t?s:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;s<i;){var r=s+i>>>1,o=t[r];null!==o&&!ca(o)&&(n?o<=e:o<e)?s=r+1:i=r}return i}return ai(t,e,iu,n)}function ai(e,n,s,i){var r=0,o=null==e?0:e.length;if(0===o)return 0;for(var a=(n=s(n))!=n,u=null===n,c=ca(n),l=n===t;r<o;){var h=Pe((r+o)/2),p=s(e[h]),d=p!==t,f=null===p,_=p==p,m=ca(p);if(a)var g=i||_;else g=l?_&&(i||d):u?_&&d&&(i||!f):c?_&&d&&!f&&(i||!m):!f&&!m&&(i?p<=n:p<n);g?r=h+1:o=h}return wn(o,4294967294)}function ui(t,e){for(var n=-1,s=t.length,i=0,r=[];++n<s;){var o=t[n],a=e?e(o):o;if(!n||!zo(a,u)){var u=a;r[i++]=0===o?0:o}}return r}function ci(t){return"number"==typeof t?t:ca(t)?h:+t}function li(t){if("string"==typeof t)return t;if(Ho(t))return De(t,li)+"";if(ca(t))return jn?jn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function hi(t,e,n){var s=-1,i=Me,r=t.length,o=!0,a=[],u=a;if(n)o=!1,i=Ee;else if(r>=200){var c=e?null:Yi(t);if(c)return un(c);o=!1,i=Qe,u=new Zn}else u=e?[]:a;t:for(;++s<r;){var l=t[s],h=e?e(l):l;if(l=n||0!==l?l:0,o&&h==h){for(var p=u.length;p--;)if(u[p]===h)continue t;e&&u.push(h),a.push(l)}else i(u,h,n)||(u!==a&&u.push(h),a.push(l))}return a}function pi(t,e){return null==(t=Or(t,e=wi(e,t)))||delete t[Vr(Yr(e))]}function di(t,e,n,s){return ti(t,e,n(As(t,e)),s)}function fi(t,e,n,s){for(var i=t.length,r=s?i:-1;(s?r--:++r<i)&&e(t[r],r,t););return n?ii(t,s?0:r,s?r+1:i):ii(t,s?r+1:0,s?i:r)}function _i(t,e){var n=t;return n instanceof Hn&&(n=n.value()),Re(e,(function(t,e){return e.func.apply(e.thisArg,Ie([t],e.args))}),n)}function mi(t,e,n){var s=t.length;if(s<2)return s?hi(t[0]):[];for(var i=-1,r=xt(s);++i<s;)for(var o=t[i],a=-1;++a<s;)a!=i&&(r[i]=ps(r[i]||o,t[a],e,n));return hi(vs(r,1),e,n)}function gi(e,n,s){for(var i=-1,r=e.length,o=n.length,a={};++i<r;){var u=i<o?n[i]:t;s(a,e[i],u)}return a}function vi(t){return Xo(t)?t:[]}function yi(t){return"function"==typeof t?t:iu}function wi(t,e){return Ho(t)?t:br(t,e)?[t]:Pr(ya(t))}var bi=Qs;function xi(e,n,s){var i=e.length;return s=s===t?i:s,!n&&s>=i?e:ii(e,n,s)}var Ti=pe||function(t){return he.clearTimeout(t)};function Ai(t,e){if(e)return t.slice();var n=t.length,s=$t?$t(n):new t.constructor(n);return t.copy(s),s}function ki(t){var e=new t.constructor(t.byteLength);return new Ht(e).set(new Ht(t)),e}function Ci(t,e){var n=e?ki(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Si(e,n){if(e!==n){var s=e!==t,i=null===e,r=e==e,o=ca(e),a=n!==t,u=null===n,c=n==n,l=ca(n);if(!u&&!l&&!o&&e>n||o&&a&&c&&!u&&!l||i&&a&&c||!s&&c||!r)return 1;if(!i&&!o&&!l&&e<n||l&&s&&r&&!i&&!o||u&&s&&r||!a&&r||!c)return-1}return 0}function Oi(t,e,n,s){for(var i=-1,r=t.length,o=n.length,a=-1,u=e.length,c=yn(r-o,0),l=xt(u+c),h=!s;++a<u;)l[a]=e[a];for(;++i<o;)(h||i<r)&&(l[n[i]]=t[i]);for(;c--;)l[a++]=t[i++];return l}function Mi(t,e,n,s){for(var i=-1,r=t.length,o=-1,a=n.length,u=-1,c=e.length,l=yn(r-a,0),h=xt(l+c),p=!s;++i<l;)h[i]=t[i];for(var d=i;++u<c;)h[d+u]=e[u];for(;++o<a;)(p||i<r)&&(h[d+n[o]]=t[i++]);return h}function Ei(t,e){var n=-1,s=t.length;for(e||(e=xt(s));++n<s;)e[n]=t[n];return e}function Di(e,n,s,i){var r=!s;s||(s={});for(var o=-1,a=n.length;++o<a;){var u=n[o],c=i?i(s[u],e[u],u,s,e):t;c===t&&(c=e[u]),r?os(s,u,c):ns(s,u,c)}return s}function Ii(t,e){return function(n,s){var i=Ho(n)?Ae:is,r=e?e():{};return i(n,t,cr(s,2),r)}}function Ri(e){return Qs((function(n,s){var i=-1,r=s.length,o=r>1?s[r-1]:t,a=r>2?s[2]:t;for(o=e.length>3&&"function"==typeof o?(r--,o):t,a&&wr(s[0],s[1],a)&&(o=r<3?t:o,r=1),n=St(n);++i<r;){var u=s[i];u&&e(n,u,i,o)}return n}))}function Ni(t,e){return function(n,s){if(null==n)return n;if(!Go(n))return t(n,s);for(var i=n.length,r=e?i:-1,o=St(n);(e?r--:++r<i)&&!1!==s(o[r],r,o););return n}}function Bi(t){return function(e,n,s){for(var i=-1,r=St(e),o=s(e),a=o.length;a--;){var u=o[t?a:++i];if(!1===n(r[u],u,r))break}return e}}function Pi(e){return function(n){var s=sn(n=ya(n))?hn(n):t,i=s?s[0]:n.charAt(0),r=s?xi(s,1).join(""):n.slice(1);return i[e]()+r}}function Vi(t){return function(e){return Re(Ka(Ua(e).replace(Yt,"")),t,"")}}function qi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Wn(t.prototype),s=t.apply(n,e);return ea(s)?s:n}}function Fi(e){return function(n,s,i){var r=St(n);if(!Go(n)){var o=cr(s,3);n=Ia(n),s=function(t){return o(r[t],t,r)}}var a=e(n,s,i);return a>-1?r[o?n[a]:a]:t}}function ji(n){return sr((function(s){var i=s.length,r=i,o=Un.prototype.thru;for(n&&s.reverse();r--;){var a=s[r];if("function"!=typeof a)throw new Et(e);if(o&&!u&&"wrapper"==ar(a))var u=new Un([],!0)}for(r=u?r:i;++r<i;){var c=ar(a=s[r]),l="wrapper"==c?or(a):t;u=l&&xr(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ar(l[0])].apply(u,l[3]):1==a.length&&xr(a)?u[c]():u.thru(a)}return function(){var t=arguments,e=t[0];if(u&&1==t.length&&Ho(e))return u.plant(e).value();for(var n=0,r=i?s[n].apply(this,t):e;++n<i;)r=s[n].call(this,r);return r}}))}function zi(e,n,s,i,r,o,u,c,l,h){var p=n&a,d=1&n,f=2&n,_=24&n,m=512&n,g=f?t:qi(e);return function a(){for(var v=arguments.length,y=xt(v),w=v;w--;)y[w]=arguments[w];if(_)var b=ur(a),x=function(t,e){for(var n=t.length,s=0;n--;)t[n]===e&&++s;return s}(y,b);if(i&&(y=Oi(y,i,r,_)),o&&(y=Mi(y,o,u,_)),v-=x,_&&v<h){var T=an(y,b);return Xi(e,n,zi,a.placeholder,s,y,T,c,l,h-v)}var A=d?s:this,k=f?A[e]:e;return v=y.length,c?y=function(e,n){for(var s=e.length,i=wn(n.length,s),r=Ei(e);i--;){var o=n[i];e[i]=yr(o,s)?r[o]:t}return e}(y,c):m&&v>1&&y.reverse(),p&&l<v&&(y.length=l),this&&this!==he&&this instanceof a&&(k=g||qi(k)),k.apply(A,y)}}function Wi(t,e){return function(n,s){return function(t,e,n,s){return bs(t,(function(t,i,r){e(s,n(t),i,r)})),s}(n,t,e(s),{})}}function Li(e,n){return function(s,i){var r;if(s===t&&i===t)return n;if(s!==t&&(r=s),i!==t){if(r===t)return i;"string"==typeof s||"string"==typeof i?(s=li(s),i=li(i)):(s=ci(s),i=ci(i)),r=e(s,i)}return r}}function Ui(t){return sr((function(e){return e=De(e,Ze(cr())),Qs((function(n){var s=this;return t(e,(function(t){return Te(t,s,n)}))}))}))}function Hi(e,n){var s=(n=n===t?" ":li(n)).length;if(s<2)return s?Ys(n,e):n;var i=Ys(n,me(e/ln(n)));return sn(n)?xi(hn(i),0,e).join(""):i.slice(0,e)}function $i(e){return function(n,s,i){return i&&"number"!=typeof i&&wr(n,s,i)&&(s=i=t),n=fa(n),s===t?(s=n,n=0):s=fa(s),function(t,e,n,s){for(var i=-1,r=yn(me((e-t)/(n||1)),0),o=xt(r);r--;)o[s?r:++i]=t,t+=n;return o}(n,s,i=i===t?n<s?1:-1:fa(i),e)}}function Gi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ga(e),n=ga(n)),t(e,n)}}function Xi(e,n,s,i,a,u,c,l,h,p){var d=8&n;n|=d?r:o,4&(n&=~(d?o:r))||(n&=-4);var f=[e,n,a,d?u:t,d?c:t,d?t:u,d?t:c,l,h,p],_=s.apply(t,f);return xr(e)&&Er(_,f),_.placeholder=i,Rr(_,e,n)}function Zi(t){var e=Ct[t];return function(t,n){if(t=ga(t),(n=null==n?0:wn(_a(n),292))&&mn(t)){var s=(ya(t)+"e").split("e");return+((s=(ya(e(s[0]+"e"+(+s[1]+n)))+"e").split("e"))[0]+"e"+(+s[1]-n))}return e(t)}}var Yi=On&&1/un(new On([,-0]))[1]==c?function(t){return new On(t)}:cu;function Qi(t){return function(e){var n=_r(e);return n==b?rn(e):n==C?cn(e):function(t,e){return De(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Ki(n,c,l,h,p,d,f,_){var m=2&c;if(!m&&"function"!=typeof n)throw new Et(e);var g=h?h.length:0;if(g||(c&=-97,h=p=t),f=f===t?f:yn(_a(f),0),_=_===t?_:_a(_),g-=p?p.length:0,c&o){var v=h,y=p;h=p=t}var w=m?t:or(n),b=[n,c,l,h,p,v,y,d,f,_];if(w&&function(t,e){var n=t[1],i=e[1],r=n|i,o=r<131,c=i==a&&8==n||i==a&&n==u&&t[7].length<=e[8]||384==i&&e[7].length<=e[8]&&8==n;if(!o&&!c)return t;1&i&&(t[2]=e[2],r|=1&n?0:4);var l=e[3];if(l){var h=t[3];t[3]=h?Oi(h,l,e[4]):l,t[4]=h?an(t[3],s):e[4]}(l=e[5])&&(h=t[5],t[5]=h?Mi(h,l,e[6]):l,t[6]=h?an(t[5],s):e[6]),(l=e[7])&&(t[7]=l),i&a&&(t[8]=null==t[8]?e[8]:wn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=r}(b,w),n=b[0],c=b[1],l=b[2],h=b[3],p=b[4],!(_=b[9]=b[9]===t?m?0:n.length:yn(b[9]-g,0))&&24&c&&(c&=-25),c&&1!=c)x=8==c||c==i?function(e,n,s){var i=qi(e);return function r(){for(var o=arguments.length,a=xt(o),u=o,c=ur(r);u--;)a[u]=arguments[u];var l=o<3&&a[0]!==c&&a[o-1]!==c?[]:an(a,c);return(o-=l.length)<s?Xi(e,n,zi,r.placeholder,t,a,l,t,t,s-o):Te(this&&this!==he&&this instanceof r?i:e,this,a)}}(n,c,_):c!=r&&33!=c||p.length?zi.apply(t,b):function(t,e,n,s){var i=1&e,r=qi(t);return function e(){for(var o=-1,a=arguments.length,u=-1,c=s.length,l=xt(c+a),h=this&&this!==he&&this instanceof e?r:t;++u<c;)l[u]=s[u];for(;a--;)l[u++]=arguments[++o];return Te(h,i?n:this,l)}}(n,c,l,h);else var x=function(t,e,n){var s=1&e,i=qi(t);return function e(){return(this&&this!==he&&this instanceof e?i:t).apply(s?n:this,arguments)}}(n,c,l);return Rr((w?ei:Er)(x,b),n,c)}function Ji(e,n,s,i){return e===t||zo(e,Rt[s])&&!Pt.call(i,s)?n:e}function tr(e,n,s,i,r,o){return ea(e)&&ea(n)&&(o.set(n,e),Ls(e,n,t,tr,o),o.delete(n)),e}function er(e){return ra(e)?t:e}function nr(e,n,s,i,r,o){var a=1&s,u=e.length,c=n.length;if(u!=c&&!(a&&c>u))return!1;var l=o.get(e),h=o.get(n);if(l&&h)return l==n&&h==e;var p=-1,d=!0,f=2&s?new Zn:t;for(o.set(e,n),o.set(n,e);++p<u;){var _=e[p],m=n[p];if(i)var g=a?i(m,_,p,n,e,o):i(_,m,p,e,n,o);if(g!==t){if(g)continue;d=!1;break}if(f){if(!Be(n,(function(t,e){if(!Qe(f,e)&&(_===t||r(_,t,s,i,o)))return f.push(e)}))){d=!1;break}}else if(_!==m&&!r(_,m,s,i,o)){d=!1;break}}return o.delete(e),o.delete(n),d}function sr(e){return Ir(Sr(e,t,Hr),e+"")}function ir(t){return ks(t,Ia,dr)}function rr(t){return ks(t,Ra,fr)}var or=Dn?function(t){return Dn.get(t)}:cu;function ar(t){for(var e=t.name+"",n=In[e],s=Pt.call(In,e)?n.length:0;s--;){var i=n[s],r=i.func;if(null==r||r==t)return i.name}return e}function ur(t){return(Pt.call(zn,"placeholder")?zn:t).placeholder}function cr(){var t=zn.iteratee||ru;return t=t===ru?Ps:t,arguments.length?t(arguments[0],arguments[1]):t}function lr(t,e){var n,s,i=t.__data__;return("string"==(s=typeof(n=e))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function hr(t){for(var e=Ia(t),n=e.length;n--;){var s=e[n],i=t[s];e[n]=[s,i,kr(i)]}return e}function pr(e,n){var s=function(e,n){return null==e?t:e[n]}(e,n);return Bs(s)?s:t}var dr=Ue?function(t){return null==t?[]:(t=St(t),Oe(Ue(t),(function(e){return Zt.call(t,e)})))}:mu,fr=Ue?function(t){for(var e=[];t;)Ie(e,dr(t)),t=Gt(t);return e}:mu,_r=Cs;function mr(t,e,n){for(var s=-1,i=(e=wi(e,t)).length,r=!1;++s<i;){var o=Vr(e[s]);if(!(r=null!=t&&n(t,o)))break;t=t[o]}return r||++s!=i?r:!!(i=null==t?0:t.length)&&ta(i)&&yr(o,i)&&(Ho(t)||Uo(t))}function gr(t){return"function"!=typeof t.constructor||Ar(t)?{}:Wn(Gt(t))}function vr(t){return Ho(t)||Uo(t)||!!(te&&t&&t[te])}function yr(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&&mt.test(t))&&t>-1&&t%1==0&&t<e}function wr(t,e,n){if(!ea(n))return!1;var s=typeof e;return!!("number"==s?Go(n)&&yr(e,n.length):"string"==s&&e in n)&&zo(n[e],t)}function br(t,e){if(Ho(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ca(t))||K.test(t)||!Q.test(t)||null!=e&&t in St(e)}function xr(t){var e=ar(t),n=zn[e];if("function"!=typeof n||!(e in Hn.prototype))return!1;if(t===n)return!0;var s=or(n);return!!s&&t===s[0]}(kn&&_r(new kn(new ArrayBuffer(1)))!=D||Cn&&_r(new Cn)!=b||Sn&&_r(Sn.resolve())!=A||On&&_r(new On)!=C||Mn&&_r(new Mn)!=M)&&(_r=function(e){var n=Cs(e),s=n==T?e.constructor:t,i=s?qr(s):"";if(i)switch(i){case Rn:return D;case Nn:return b;case Bn:return A;case Pn:return C;case Vn:return M}return n});var Tr=Nt?Ko:gu;function Ar(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Rt)}function kr(t){return t==t&&!ea(t)}function Cr(e,n){return function(s){return null!=s&&s[e]===n&&(n!==t||e in St(s))}}function Sr(e,n,s){return n=yn(n===t?e.length-1:n,0),function(){for(var t=arguments,i=-1,r=yn(t.length-n,0),o=xt(r);++i<r;)o[i]=t[n+i];i=-1;for(var a=xt(n+1);++i<n;)a[i]=t[i];return a[n]=s(o),Te(e,this,a)}}function Or(t,e){return e.length<2?t:As(t,ii(e,0,-1))}function Mr(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Er=Nr(ei),Dr=_e||function(t,e){return he.setTimeout(t,e)},Ir=Nr(ni);function Rr(t,e,n){var s=e+"";return Ir(t,function(t,e){var n=e.length;if(!n)return t;var s=n-1;return e[s]=(n>1?"& ":"")+e[s],e=e.join(n>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+e+"] */\n")}(s,function(t,e){return ke(d,(function(n){var s="_."+n[0];e&n[1]&&!Me(t,s)&&t.push(s)})),t.sort()}(function(t){var e=t.match(rt);return e?e[1].split(ot):[]}(s),n)))}function Nr(e){var n=0,s=0;return function(){var i=bn(),r=16-(i-s);if(s=i,r>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(t,arguments)}}function Br(e,n){var s=-1,i=e.length,r=i-1;for(n=n===t?i:n;++s<n;){var o=Zs(s,r),a=e[o];e[o]=e[s],e[s]=a}return e.length=n,e}var Pr=function(t){var e=Bo(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(J,(function(t,n,s,i){e.push(s?i.replace(ct,"$1"):n||t)})),e}));function Vr(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function qr(t){if(null!=t){try{return Bt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fr(t){if(t instanceof Hn)return t.clone();var e=new Un(t.__wrapped__,t.__chain__);return e.__actions__=Ei(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var jr=Qs((function(t,e){return Xo(t)?ps(t,vs(e,1,Xo,!0)):[]})),zr=Qs((function(e,n){var s=Yr(n);return Xo(s)&&(s=t),Xo(e)?ps(e,vs(n,1,Xo,!0),cr(s,2)):[]})),Wr=Qs((function(e,n){var s=Yr(n);return Xo(s)&&(s=t),Xo(e)?ps(e,vs(n,1,Xo,!0),t,s):[]}));function Lr(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var i=null==n?0:_a(n);return i<0&&(i=yn(s+i,0)),qe(t,cr(e,3),i)}function Ur(e,n,s){var i=null==e?0:e.length;if(!i)return-1;var r=i-1;return s!==t&&(r=_a(s),r=s<0?yn(i+r,0):wn(r,i-1)),qe(e,cr(n,3),r,!0)}function Hr(t){return null!=t&&t.length?vs(t,1):[]}function $r(e){return e&&e.length?e[0]:t}var Gr=Qs((function(t){var e=De(t,vi);return e.length&&e[0]===t[0]?Es(e):[]})),Xr=Qs((function(e){var n=Yr(e),s=De(e,vi);return n===Yr(s)?n=t:s.pop(),s.length&&s[0]===e[0]?Es(s,cr(n,2)):[]})),Zr=Qs((function(e){var n=Yr(e),s=De(e,vi);return(n="function"==typeof n?n:t)&&s.pop(),s.length&&s[0]===e[0]?Es(s,t,n):[]}));function Yr(e){var n=null==e?0:e.length;return n?e[n-1]:t}var Qr=Qs(Kr);function Kr(t,e){return t&&t.length&&e&&e.length?Gs(t,e):t}var Jr=sr((function(t,e){var n=null==t?0:t.length,s=as(t,e);return Xs(t,De(e,(function(t){return yr(t,n)?+t:t})).sort(Si)),s}));function to(t){return null==t?t:An.call(t)}var eo=Qs((function(t){return hi(vs(t,1,Xo,!0))})),no=Qs((function(e){var n=Yr(e);return Xo(n)&&(n=t),hi(vs(e,1,Xo,!0),cr(n,2))})),so=Qs((function(e){var n=Yr(e);return n="function"==typeof n?n:t,hi(vs(e,1,Xo,!0),t,n)}));function io(t){if(!t||!t.length)return[];var e=0;return t=Oe(t,(function(t){if(Xo(t))return e=yn(t.length,e),!0})),Ge(e,(function(e){return De(t,Le(e))}))}function ro(e,n){if(!e||!e.length)return[];var s=io(e);return null==n?s:De(s,(function(e){return Te(n,t,e)}))}var oo=Qs((function(t,e){return Xo(t)?ps(t,e):[]})),ao=Qs((function(t){return mi(Oe(t,Xo))})),uo=Qs((function(e){var n=Yr(e);return Xo(n)&&(n=t),mi(Oe(e,Xo),cr(n,2))})),co=Qs((function(e){var n=Yr(e);return n="function"==typeof n?n:t,mi(Oe(e,Xo),t,n)})),lo=Qs(io),ho=Qs((function(e){var n=e.length,s=n>1?e[n-1]:t;return s="function"==typeof s?(e.pop(),s):t,ro(e,s)}));function po(t){var e=zn(t);return e.__chain__=!0,e}function fo(t,e){return e(t)}var _o=sr((function(e){var n=e.length,s=n?e[0]:0,i=this.__wrapped__,r=function(t){return as(t,e)};return!(n>1||this.__actions__.length)&&i instanceof Hn&&yr(s)?((i=i.slice(s,+s+(n?1:0))).__actions__.push({func:fo,args:[r],thisArg:t}),new Un(i,this.__chain__).thru((function(e){return n&&!e.length&&e.push(t),e}))):this.thru(r)})),mo=Ii((function(t,e,n){Pt.call(t,n)?++t[n]:os(t,n,1)})),go=Fi(Lr),vo=Fi(Ur);function yo(t,e){return(Ho(t)?ke:ds)(t,cr(e,3))}function wo(t,e){return(Ho(t)?Ce:fs)(t,cr(e,3))}var bo=Ii((function(t,e,n){Pt.call(t,n)?t[n].push(e):os(t,n,[e])})),xo=Qs((function(t,e,n){var s=-1,i="function"==typeof e,r=Go(t)?xt(t.length):[];return ds(t,(function(t){r[++s]=i?Te(e,t,n):Ds(t,e,n)})),r})),To=Ii((function(t,e,n){os(t,n,e)}));function Ao(t,e){return(Ho(t)?De:js)(t,cr(e,3))}var ko=Ii((function(t,e,n){t[n?0:1].push(e)}),(function(){return[[],[]]})),Co=Qs((function(t,e){if(null==t)return[];var n=e.length;return n>1&&wr(t,e[0],e[1])?e=[]:n>2&&wr(e[0],e[1],e[2])&&(e=[e[0]]),Hs(t,vs(e,1),[])})),So=de||function(){return he.Date.now()};function Oo(e,n,s){return n=s?t:n,n=e&&null==n?e.length:n,Ki(e,a,t,t,t,t,n)}function Mo(n,s){var i;if("function"!=typeof s)throw new Et(e);return n=_a(n),function(){return--n>0&&(i=s.apply(this,arguments)),n<=1&&(s=t),i}}var Eo=Qs((function(t,e,n){var s=1;if(n.length){var i=an(n,ur(Eo));s|=r}return Ki(t,s,e,n,i)})),Do=Qs((function(t,e,n){var s=3;if(n.length){var i=an(n,ur(Do));s|=r}return Ki(e,s,t,n,i)}));function Io(n,s,i){var r,o,a,u,c,l,h=0,p=!1,d=!1,f=!0;if("function"!=typeof n)throw new Et(e);function _(e){var s=r,i=o;return r=o=t,h=e,u=n.apply(i,s)}function m(e){var n=e-l;return l===t||n>=s||n<0||d&&e-h>=a}function g(){var t=So();if(m(t))return v(t);c=Dr(g,function(t){var e=s-(t-l);return d?wn(e,a-(t-h)):e}(t))}function v(e){return c=t,f&&r?_(e):(r=o=t,u)}function y(){var e=So(),n=m(e);if(r=arguments,o=this,l=e,n){if(c===t)return function(t){return h=t,c=Dr(g,s),p?_(t):u}(l);if(d)return Ti(c),c=Dr(g,s),_(l)}return c===t&&(c=Dr(g,s)),u}return s=ga(s)||0,ea(i)&&(p=!!i.leading,a=(d="maxWait"in i)?yn(ga(i.maxWait)||0,s):a,f="trailing"in i?!!i.trailing:f),y.cancel=function(){c!==t&&Ti(c),h=0,r=l=o=c=t},y.flush=function(){return c===t?u:v(So())},y}var Ro=Qs((function(t,e){return hs(t,1,e)})),No=Qs((function(t,e,n){return hs(t,ga(e)||0,n)}));function Bo(t,n){if("function"!=typeof t||null!=n&&"function"!=typeof n)throw new Et(e);var s=function(){var e=arguments,i=n?n.apply(this,e):e[0],r=s.cache;if(r.has(i))return r.get(i);var o=t.apply(this,e);return s.cache=r.set(i,o)||r,o};return s.cache=new(Bo.Cache||Xn),s}function Po(t){if("function"!=typeof t)throw new Et(e);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Bo.Cache=Xn;var Vo=bi((function(t,e){var n=(e=1==e.length&&Ho(e[0])?De(e[0],Ze(cr())):De(vs(e,1),Ze(cr()))).length;return Qs((function(s){for(var i=-1,r=wn(s.length,n);++i<r;)s[i]=e[i].call(this,s[i]);return Te(t,this,s)}))})),qo=Qs((function(e,n){var s=an(n,ur(qo));return Ki(e,r,t,n,s)})),Fo=Qs((function(e,n){var s=an(n,ur(Fo));return Ki(e,o,t,n,s)})),jo=sr((function(e,n){return Ki(e,u,t,t,t,n)}));function zo(t,e){return t===e||t!=t&&e!=e}var Wo=Gi(Ss),Lo=Gi((function(t,e){return t>=e})),Uo=Is(function(){return arguments}())?Is:function(t){return na(t)&&Pt.call(t,"callee")&&!Zt.call(t,"callee")},Ho=xt.isArray,$o=ge?Ze(ge):function(t){return na(t)&&Cs(t)==E};function Go(t){return null!=t&&ta(t.length)&&!Ko(t)}function Xo(t){return na(t)&&Go(t)}var Zo=_n||gu,Yo=ve?Ze(ve):function(t){return na(t)&&Cs(t)==g};function Qo(t){if(!na(t))return!1;var e=Cs(t);return e==v||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ra(t)}function Ko(t){if(!ea(t))return!1;var e=Cs(t);return e==y||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Jo(t){return"number"==typeof t&&t==_a(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=l}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function na(t){return null!=t&&"object"==typeof t}var sa=ye?Ze(ye):function(t){return na(t)&&_r(t)==b};function ia(t){return"number"==typeof t||na(t)&&Cs(t)==x}function ra(t){if(!na(t)||Cs(t)!=T)return!1;var e=Gt(t);if(null===e)return!0;var n=Pt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Bt.call(n)==jt}var oa=we?Ze(we):function(t){return na(t)&&Cs(t)==k},aa=be?Ze(be):function(t){return na(t)&&_r(t)==C};function ua(t){return"string"==typeof t||!Ho(t)&&na(t)&&Cs(t)==S}function ca(t){return"symbol"==typeof t||na(t)&&Cs(t)==O}var la=xe?Ze(xe):function(t){return na(t)&&ta(t.length)&&!!ie[Cs(t)]},ha=Gi(Fs),pa=Gi((function(t,e){return t<=e}));function da(t){if(!t)return[];if(Go(t))return ua(t)?hn(t):Ei(t);if(oe&&t[oe])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[oe]());var e=_r(t);return(e==b?rn:e==C?un:za)(t)}function fa(t){return t?(t=ga(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function _a(t){var e=fa(t),n=e%1;return e==e?n?e-n:e:0}function ma(t){return t?us(_a(t),0,p):0}function ga(t){if("number"==typeof t)return t;if(ca(t))return h;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Xe(t);var n=dt.test(t);return n||_t.test(t)?ue(t.slice(2),n?2:8):pt.test(t)?h:+t}function va(t){return Di(t,Ra(t))}function ya(t){return null==t?"":li(t)}var wa=Ri((function(t,e){if(Ar(e)||Go(e))Di(e,Ia(e),t);else for(var n in e)Pt.call(e,n)&&ns(t,n,e[n])})),ba=Ri((function(t,e){Di(e,Ra(e),t)})),xa=Ri((function(t,e,n,s){Di(e,Ra(e),t,s)})),Ta=Ri((function(t,e,n,s){Di(e,Ia(e),t,s)})),Aa=sr(as),ka=Qs((function(e,n){e=St(e);var s=-1,i=n.length,r=i>2?n[2]:t;for(r&&wr(n[0],n[1],r)&&(i=1);++s<i;)for(var o=n[s],a=Ra(o),u=-1,c=a.length;++u<c;){var l=a[u],h=e[l];(h===t||zo(h,Rt[l])&&!Pt.call(e,l))&&(e[l]=o[l])}return e})),Ca=Qs((function(e){return e.push(t,tr),Te(Ba,t,e)}));function Sa(e,n,s){var i=null==e?t:As(e,n);return i===t?s:i}function Oa(t,e){return null!=t&&mr(t,e,Ms)}var Ma=Wi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),t[e]=n}),eu(iu)),Ea=Wi((function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),Pt.call(t,e)?t[e].push(n):t[e]=[n]}),cr),Da=Qs(Ds);function Ia(t){return Go(t)?Qn(t):Vs(t)}function Ra(t){return Go(t)?Qn(t,!0):qs(t)}var Na=Ri((function(t,e,n){Ls(t,e,n)})),Ba=Ri((function(t,e,n,s){Ls(t,e,n,s)})),Pa=sr((function(t,e){var n={};if(null==t)return n;var s=!1;e=De(e,(function(e){return e=wi(e,t),s||(s=e.length>1),e})),Di(t,rr(t),n),s&&(n=cs(n,7,er));for(var i=e.length;i--;)pi(n,e[i]);return n})),Va=sr((function(t,e){return null==t?{}:function(t,e){return $s(t,e,(function(e,n){return Oa(t,n)}))}(t,e)}));function qa(t,e){if(null==t)return{};var n=De(rr(t),(function(t){return[t]}));return e=cr(e),$s(t,n,(function(t,n){return e(t,n[0])}))}var Fa=Qi(Ia),ja=Qi(Ra);function za(t){return null==t?[]:Ye(t,Ia(t))}var Wa=Vi((function(t,e,n){return e=e.toLowerCase(),t+(n?La(e):e)}));function La(t){return Qa(ya(t).toLowerCase())}function Ua(t){return(t=ya(t))&&t.replace(gt,tn).replace(Qt,"")}var Ha=Vi((function(t,e,n){return t+(n?"-":"")+e.toLowerCase()})),$a=Vi((function(t,e,n){return t+(n?" ":"")+e.toLowerCase()})),Ga=Pi("toLowerCase"),Xa=Vi((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()})),Za=Vi((function(t,e,n){return t+(n?" ":"")+Qa(e)})),Ya=Vi((function(t,e,n){return t+(n?" ":"")+e.toUpperCase()})),Qa=Pi("toUpperCase");function Ka(e,n,s){return e=ya(e),(n=s?t:n)===t?function(t){return ee.test(t)}(e)?function(t){return t.match(Jt)||[]}(e):function(t){return t.match(at)||[]}(e):e.match(n)||[]}var Ja=Qs((function(e,n){try{return Te(e,t,n)}catch(t){return Qo(t)?t:new At(t)}})),tu=sr((function(t,e){return ke(e,(function(e){e=Vr(e),os(t,e,Eo(t[e],t))})),t}));function eu(t){return function(){return t}}var nu=ji(),su=ji(!0);function iu(t){return t}function ru(t){return Ps("function"==typeof t?t:cs(t,1))}var ou=Qs((function(t,e){return function(n){return Ds(n,t,e)}})),au=Qs((function(t,e){return function(n){return Ds(t,n,e)}}));function uu(t,e,n){var s=Ia(e),i=Ts(e,s);null!=n||ea(e)&&(i.length||!s.length)||(n=e,e=t,t=this,i=Ts(e,Ia(e)));var r=!(ea(n)&&"chain"in n&&!n.chain),o=Ko(t);return ke(i,(function(n){var s=e[n];t[n]=s,o&&(t.prototype[n]=function(){var e=this.__chain__;if(r||e){var n=t(this.__wrapped__);return(n.__actions__=Ei(this.__actions__)).push({func:s,args:arguments,thisArg:t}),n.__chain__=e,n}return s.apply(t,Ie([this.value()],arguments))})})),t}function cu(){}var lu=Ui(De),hu=Ui(Se),pu=Ui(Be);function du(t){return br(t)?Le(Vr(t)):function(t){return function(e){return As(e,t)}}(t)}var fu=$i(),_u=$i(!0);function mu(){return[]}function gu(){return!1}var vu,yu=Li((function(t,e){return t+e}),0),wu=Zi("ceil"),bu=Li((function(t,e){return t/e}),1),xu=Zi("floor"),Tu=Li((function(t,e){return t*e}),1),Au=Zi("round"),ku=Li((function(t,e){return t-e}),0);return zn.after=function(t,n){if("function"!=typeof n)throw new Et(e);return t=_a(t),function(){if(--t<1)return n.apply(this,arguments)}},zn.ary=Oo,zn.assign=wa,zn.assignIn=ba,zn.assignInWith=xa,zn.assignWith=Ta,zn.at=Aa,zn.before=Mo,zn.bind=Eo,zn.bindAll=tu,zn.bindKey=Do,zn.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ho(t)?t:[t]},zn.chain=po,zn.chunk=function(e,n,s){n=(s?wr(e,n,s):n===t)?1:yn(_a(n),0);var i=null==e?0:e.length;if(!i||n<1)return[];for(var r=0,o=0,a=xt(me(i/n));r<i;)a[o++]=ii(e,r,r+=n);return a},zn.compact=function(t){for(var e=-1,n=null==t?0:t.length,s=0,i=[];++e<n;){var r=t[e];r&&(i[s++]=r)}return i},zn.concat=function(){var t=arguments.length;if(!t)return[];for(var e=xt(t-1),n=arguments[0],s=t;s--;)e[s-1]=arguments[s];return Ie(Ho(n)?Ei(n):[n],vs(e,1))},zn.cond=function(t){var n=null==t?0:t.length,s=cr();return t=n?De(t,(function(t){if("function"!=typeof t[1])throw new Et(e);return[s(t[0]),t[1]]})):[],Qs((function(e){for(var s=-1;++s<n;){var i=t[s];if(Te(i[0],this,e))return Te(i[1],this,e)}}))},zn.conforms=function(t){return function(t){var e=Ia(t);return function(n){return ls(n,t,e)}}(cs(t,1))},zn.constant=eu,zn.countBy=mo,zn.create=function(t,e){var n=Wn(t);return null==e?n:rs(n,e)},zn.curry=function e(n,s,i){var r=Ki(n,8,t,t,t,t,t,s=i?t:s);return r.placeholder=e.placeholder,r},zn.curryRight=function e(n,s,r){var o=Ki(n,i,t,t,t,t,t,s=r?t:s);return o.placeholder=e.placeholder,o},zn.debounce=Io,zn.defaults=ka,zn.defaultsDeep=Ca,zn.defer=Ro,zn.delay=No,zn.difference=jr,zn.differenceBy=zr,zn.differenceWith=Wr,zn.drop=function(e,n,s){var i=null==e?0:e.length;return i?ii(e,(n=s||n===t?1:_a(n))<0?0:n,i):[]},zn.dropRight=function(e,n,s){var i=null==e?0:e.length;return i?ii(e,0,(n=i-(n=s||n===t?1:_a(n)))<0?0:n):[]},zn.dropRightWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!0,!0):[]},zn.dropWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!0):[]},zn.fill=function(e,n,s,i){var r=null==e?0:e.length;return r?(s&&"number"!=typeof s&&wr(e,n,s)&&(s=0,i=r),function(e,n,s,i){var r=e.length;for((s=_a(s))<0&&(s=-s>r?0:r+s),(i=i===t||i>r?r:_a(i))<0&&(i+=r),i=s>i?0:ma(i);s<i;)e[s++]=n;return e}(e,n,s,i)):[]},zn.filter=function(t,e){return(Ho(t)?Oe:gs)(t,cr(e,3))},zn.flatMap=function(t,e){return vs(Ao(t,e),1)},zn.flatMapDeep=function(t,e){return vs(Ao(t,e),c)},zn.flatMapDepth=function(e,n,s){return s=s===t?1:_a(s),vs(Ao(e,n),s)},zn.flatten=Hr,zn.flattenDeep=function(t){return null!=t&&t.length?vs(t,c):[]},zn.flattenDepth=function(e,n){return null!=e&&e.length?vs(e,n=n===t?1:_a(n)):[]},zn.flip=function(t){return Ki(t,512)},zn.flow=nu,zn.flowRight=su,zn.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,s={};++e<n;){var i=t[e];s[i[0]]=i[1]}return s},zn.functions=function(t){return null==t?[]:Ts(t,Ia(t))},zn.functionsIn=function(t){return null==t?[]:Ts(t,Ra(t))},zn.groupBy=bo,zn.initial=function(t){return null!=t&&t.length?ii(t,0,-1):[]},zn.intersection=Gr,zn.intersectionBy=Xr,zn.intersectionWith=Zr,zn.invert=Ma,zn.invertBy=Ea,zn.invokeMap=xo,zn.iteratee=ru,zn.keyBy=To,zn.keys=Ia,zn.keysIn=Ra,zn.map=Ao,zn.mapKeys=function(t,e){var n={};return e=cr(e,3),bs(t,(function(t,s,i){os(n,e(t,s,i),t)})),n},zn.mapValues=function(t,e){var n={};return e=cr(e,3),bs(t,(function(t,s,i){os(n,s,e(t,s,i))})),n},zn.matches=function(t){return zs(cs(t,1))},zn.matchesProperty=function(t,e){return Ws(t,cs(e,1))},zn.memoize=Bo,zn.merge=Na,zn.mergeWith=Ba,zn.method=ou,zn.methodOf=au,zn.mixin=uu,zn.negate=Po,zn.nthArg=function(t){return t=_a(t),Qs((function(e){return Us(e,t)}))},zn.omit=Pa,zn.omitBy=function(t,e){return qa(t,Po(cr(e)))},zn.once=function(t){return Mo(2,t)},zn.orderBy=function(e,n,s,i){return null==e?[]:(Ho(n)||(n=null==n?[]:[n]),Ho(s=i?t:s)||(s=null==s?[]:[s]),Hs(e,n,s))},zn.over=lu,zn.overArgs=Vo,zn.overEvery=hu,zn.overSome=pu,zn.partial=qo,zn.partialRight=Fo,zn.partition=ko,zn.pick=Va,zn.pickBy=qa,zn.property=du,zn.propertyOf=function(e){return function(n){return null==e?t:As(e,n)}},zn.pull=Qr,zn.pullAll=Kr,zn.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?Gs(t,e,cr(n,2)):t},zn.pullAllWith=function(e,n,s){return e&&e.length&&n&&n.length?Gs(e,n,t,s):e},zn.pullAt=Jr,zn.range=fu,zn.rangeRight=_u,zn.rearg=jo,zn.reject=function(t,e){return(Ho(t)?Oe:gs)(t,Po(cr(e,3)))},zn.remove=function(t,e){var n=[];if(!t||!t.length)return n;var s=-1,i=[],r=t.length;for(e=cr(e,3);++s<r;){var o=t[s];e(o,s,t)&&(n.push(o),i.push(s))}return Xs(t,i),n},zn.rest=function(n,s){if("function"!=typeof n)throw new Et(e);return Qs(n,s=s===t?s:_a(s))},zn.reverse=to,zn.sampleSize=function(e,n,s){return n=(s?wr(e,n,s):n===t)?1:_a(n),(Ho(e)?Jn:Js)(e,n)},zn.set=function(t,e,n){return null==t?t:ti(t,e,n)},zn.setWith=function(e,n,s,i){return i="function"==typeof i?i:t,null==e?e:ti(e,n,s,i)},zn.shuffle=function(t){return(Ho(t)?ts:si)(t)},zn.slice=function(e,n,s){var i=null==e?0:e.length;return i?(s&&"number"!=typeof s&&wr(e,n,s)?(n=0,s=i):(n=null==n?0:_a(n),s=s===t?i:_a(s)),ii(e,n,s)):[]},zn.sortBy=Co,zn.sortedUniq=function(t){return t&&t.length?ui(t):[]},zn.sortedUniqBy=function(t,e){return t&&t.length?ui(t,cr(e,2)):[]},zn.split=function(e,n,s){return s&&"number"!=typeof s&&wr(e,n,s)&&(n=s=t),(s=s===t?p:s>>>0)?(e=ya(e))&&("string"==typeof n||null!=n&&!oa(n))&&!(n=li(n))&&sn(e)?xi(hn(e),0,s):e.split(n,s):[]},zn.spread=function(t,n){if("function"!=typeof t)throw new Et(e);return n=null==n?0:yn(_a(n),0),Qs((function(e){var s=e[n],i=xi(e,0,n);return s&&Ie(i,s),Te(t,this,i)}))},zn.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},zn.take=function(e,n,s){return e&&e.length?ii(e,0,(n=s||n===t?1:_a(n))<0?0:n):[]},zn.takeRight=function(e,n,s){var i=null==e?0:e.length;return i?ii(e,(n=i-(n=s||n===t?1:_a(n)))<0?0:n,i):[]},zn.takeRightWhile=function(t,e){return t&&t.length?fi(t,cr(e,3),!1,!0):[]},zn.takeWhile=function(t,e){return t&&t.length?fi(t,cr(e,3)):[]},zn.tap=function(t,e){return e(t),t},zn.throttle=function(t,n,s){var i=!0,r=!0;if("function"!=typeof t)throw new Et(e);return ea(s)&&(i="leading"in s?!!s.leading:i,r="trailing"in s?!!s.trailing:r),Io(t,n,{leading:i,maxWait:n,trailing:r})},zn.thru=fo,zn.toArray=da,zn.toPairs=Fa,zn.toPairsIn=ja,zn.toPath=function(t){return Ho(t)?De(t,Vr):ca(t)?[t]:Ei(Pr(ya(t)))},zn.toPlainObject=va,zn.transform=function(t,e,n){var s=Ho(t),i=s||Zo(t)||la(t);if(e=cr(e,4),null==n){var r=t&&t.constructor;n=i?s?new r:[]:ea(t)&&Ko(r)?Wn(Gt(t)):{}}return(i?ke:bs)(t,(function(t,s,i){return e(n,t,s,i)})),n},zn.unary=function(t){return Oo(t,1)},zn.union=eo,zn.unionBy=no,zn.unionWith=so,zn.uniq=function(t){return t&&t.length?hi(t):[]},zn.uniqBy=function(t,e){return t&&t.length?hi(t,cr(e,2)):[]},zn.uniqWith=function(e,n){return n="function"==typeof n?n:t,e&&e.length?hi(e,t,n):[]},zn.unset=function(t,e){return null==t||pi(t,e)},zn.unzip=io,zn.unzipWith=ro,zn.update=function(t,e,n){return null==t?t:di(t,e,yi(n))},zn.updateWith=function(e,n,s,i){return i="function"==typeof i?i:t,null==e?e:di(e,n,yi(s),i)},zn.values=za,zn.valuesIn=function(t){return null==t?[]:Ye(t,Ra(t))},zn.without=oo,zn.words=Ka,zn.wrap=function(t,e){return qo(yi(e),t)},zn.xor=ao,zn.xorBy=uo,zn.xorWith=co,zn.zip=lo,zn.zipObject=function(t,e){return gi(t||[],e||[],ns)},zn.zipObjectDeep=function(t,e){return gi(t||[],e||[],ti)},zn.zipWith=ho,zn.entries=Fa,zn.entriesIn=ja,zn.extend=ba,zn.extendWith=xa,uu(zn,zn),zn.add=yu,zn.attempt=Ja,zn.camelCase=Wa,zn.capitalize=La,zn.ceil=wu,zn.clamp=function(e,n,s){return s===t&&(s=n,n=t),s!==t&&(s=(s=ga(s))==s?s:0),n!==t&&(n=(n=ga(n))==n?n:0),us(ga(e),n,s)},zn.clone=function(t){return cs(t,4)},zn.cloneDeep=function(t){return cs(t,5)},zn.cloneDeepWith=function(e,n){return cs(e,5,n="function"==typeof n?n:t)},zn.cloneWith=function(e,n){return cs(e,4,n="function"==typeof n?n:t)},zn.conformsTo=function(t,e){return null==e||ls(t,e,Ia(e))},zn.deburr=Ua,zn.defaultTo=function(t,e){return null==t||t!=t?e:t},zn.divide=bu,zn.endsWith=function(e,n,s){e=ya(e),n=li(n);var i=e.length,r=s=s===t?i:us(_a(s),0,i);return(s-=n.length)>=0&&e.slice(s,r)==n},zn.eq=zo,zn.escape=function(t){return(t=ya(t))&&G.test(t)?t.replace(H,en):t},zn.escapeRegExp=function(t){return(t=ya(t))&&et.test(t)?t.replace(tt,"\\$&"):t},zn.every=function(e,n,s){var i=Ho(e)?Se:_s;return s&&wr(e,n,s)&&(n=t),i(e,cr(n,3))},zn.find=go,zn.findIndex=Lr,zn.findKey=function(t,e){return Ve(t,cr(e,3),bs)},zn.findLast=vo,zn.findLastIndex=Ur,zn.findLastKey=function(t,e){return Ve(t,cr(e,3),xs)},zn.floor=xu,zn.forEach=yo,zn.forEachRight=wo,zn.forIn=function(t,e){return null==t?t:ys(t,cr(e,3),Ra)},zn.forInRight=function(t,e){return null==t?t:ws(t,cr(e,3),Ra)},zn.forOwn=function(t,e){return t&&bs(t,cr(e,3))},zn.forOwnRight=function(t,e){return t&&xs(t,cr(e,3))},zn.get=Sa,zn.gt=Wo,zn.gte=Lo,zn.has=function(t,e){return null!=t&&mr(t,e,Os)},zn.hasIn=Oa,zn.head=$r,zn.identity=iu,zn.includes=function(t,e,n,s){t=Go(t)?t:za(t),n=n&&!s?_a(n):0;var i=t.length;return n<0&&(n=yn(i+n,0)),ua(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Fe(t,e,n)>-1},zn.indexOf=function(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var i=null==n?0:_a(n);return i<0&&(i=yn(s+i,0)),Fe(t,e,i)},zn.inRange=function(e,n,s){return n=fa(n),s===t?(s=n,n=0):s=fa(s),function(t,e,n){return t>=wn(e,n)&&t<yn(e,n)}(e=ga(e),n,s)},zn.invoke=Da,zn.isArguments=Uo,zn.isArray=Ho,zn.isArrayBuffer=$o,zn.isArrayLike=Go,zn.isArrayLikeObject=Xo,zn.isBoolean=function(t){return!0===t||!1===t||na(t)&&Cs(t)==m},zn.isBuffer=Zo,zn.isDate=Yo,zn.isElement=function(t){return na(t)&&1===t.nodeType&&!ra(t)},zn.isEmpty=function(t){if(null==t)return!0;if(Go(t)&&(Ho(t)||"string"==typeof t||"function"==typeof t.splice||Zo(t)||la(t)||Uo(t)))return!t.length;var e=_r(t);if(e==b||e==C)return!t.size;if(Ar(t))return!Vs(t).length;for(var n in t)if(Pt.call(t,n))return!1;return!0},zn.isEqual=function(t,e){return Rs(t,e)},zn.isEqualWith=function(e,n,s){var i=(s="function"==typeof s?s:t)?s(e,n):t;return i===t?Rs(e,n,t,s):!!i},zn.isError=Qo,zn.isFinite=function(t){return"number"==typeof t&&mn(t)},zn.isFunction=Ko,zn.isInteger=Jo,zn.isLength=ta,zn.isMap=sa,zn.isMatch=function(t,e){return t===e||Ns(t,e,hr(e))},zn.isMatchWith=function(e,n,s){return s="function"==typeof s?s:t,Ns(e,n,hr(n),s)},zn.isNaN=function(t){return ia(t)&&t!=+t},zn.isNative=function(t){if(Tr(t))throw new At("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Bs(t)},zn.isNil=function(t){return null==t},zn.isNull=function(t){return null===t},zn.isNumber=ia,zn.isObject=ea,zn.isObjectLike=na,zn.isPlainObject=ra,zn.isRegExp=oa,zn.isSafeInteger=function(t){return Jo(t)&&t>=-9007199254740991&&t<=l},zn.isSet=aa,zn.isString=ua,zn.isSymbol=ca,zn.isTypedArray=la,zn.isUndefined=function(e){return e===t},zn.isWeakMap=function(t){return na(t)&&_r(t)==M},zn.isWeakSet=function(t){return na(t)&&"[object WeakSet]"==Cs(t)},zn.join=function(t,e){return null==t?"":gn.call(t,e)},zn.kebabCase=Ha,zn.last=Yr,zn.lastIndexOf=function(e,n,s){var i=null==e?0:e.length;if(!i)return-1;var r=i;return s!==t&&(r=(r=_a(s))<0?yn(i+r,0):wn(r,i-1)),n==n?function(t,e,n){for(var s=n+1;s--;)if(t[s]===e)return s;return s}(e,n,r):qe(e,ze,r,!0)},zn.lowerCase=$a,zn.lowerFirst=Ga,zn.lt=ha,zn.lte=pa,zn.max=function(e){return e&&e.length?ms(e,iu,Ss):t},zn.maxBy=function(e,n){return e&&e.length?ms(e,cr(n,2),Ss):t},zn.mean=function(t){return We(t,iu)},zn.meanBy=function(t,e){return We(t,cr(e,2))},zn.min=function(e){return e&&e.length?ms(e,iu,Fs):t},zn.minBy=function(e,n){return e&&e.length?ms(e,cr(n,2),Fs):t},zn.stubArray=mu,zn.stubFalse=gu,zn.stubObject=function(){return{}},zn.stubString=function(){return""},zn.stubTrue=function(){return!0},zn.multiply=Tu,zn.nth=function(e,n){return e&&e.length?Us(e,_a(n)):t},zn.noConflict=function(){return he._===this&&(he._=zt),this},zn.noop=cu,zn.now=So,zn.pad=function(t,e,n){t=ya(t);var s=(e=_a(e))?ln(t):0;if(!e||s>=e)return t;var i=(e-s)/2;return Hi(Pe(i),n)+t+Hi(me(i),n)},zn.padEnd=function(t,e,n){t=ya(t);var s=(e=_a(e))?ln(t):0;return e&&s<e?t+Hi(e-s,n):t},zn.padStart=function(t,e,n){t=ya(t);var s=(e=_a(e))?ln(t):0;return e&&s<e?Hi(e-s,n)+t:t},zn.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),xn(ya(t).replace(nt,""),e||0)},zn.random=function(e,n,s){if(s&&"boolean"!=typeof s&&wr(e,n,s)&&(n=s=t),s===t&&("boolean"==typeof n?(s=n,n=t):"boolean"==typeof e&&(s=e,e=t)),e===t&&n===t?(e=0,n=1):(e=fa(e),n===t?(n=e,e=0):n=fa(n)),e>n){var i=e;e=n,n=i}if(s||e%1||n%1){var r=Tn();return wn(e+r*(n-e+ae("1e-"+((r+"").length-1))),n)}return Zs(e,n)},zn.reduce=function(t,e,n){var s=Ho(t)?Re:He,i=arguments.length<3;return s(t,cr(e,4),n,i,ds)},zn.reduceRight=function(t,e,n){var s=Ho(t)?Ne:He,i=arguments.length<3;return s(t,cr(e,4),n,i,fs)},zn.repeat=function(e,n,s){return n=(s?wr(e,n,s):n===t)?1:_a(n),Ys(ya(e),n)},zn.replace=function(){var t=arguments,e=ya(t[0]);return t.length<3?e:e.replace(t[1],t[2])},zn.result=function(e,n,s){var i=-1,r=(n=wi(n,e)).length;for(r||(r=1,e=t);++i<r;){var o=null==e?t:e[Vr(n[i])];o===t&&(i=r,o=s),e=Ko(o)?o.call(e):o}return e},zn.round=Au,zn.runInContext=st,zn.sample=function(t){return(Ho(t)?Kn:Ks)(t)},zn.size=function(t){if(null==t)return 0;if(Go(t))return ua(t)?ln(t):t.length;var e=_r(t);return e==b||e==C?t.size:Vs(t).length},zn.snakeCase=Xa,zn.some=function(e,n,s){var i=Ho(e)?Be:ri;return s&&wr(e,n,s)&&(n=t),i(e,cr(n,3))},zn.sortedIndex=function(t,e){return oi(t,e)},zn.sortedIndexBy=function(t,e,n){return ai(t,e,cr(n,2))},zn.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var s=oi(t,e);if(s<n&&zo(t[s],e))return s}return-1},zn.sortedLastIndex=function(t,e){return oi(t,e,!0)},zn.sortedLastIndexBy=function(t,e,n){return ai(t,e,cr(n,2),!0)},zn.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=oi(t,e,!0)-1;if(zo(t[n],e))return n}return-1},zn.startCase=Za,zn.startsWith=function(t,e,n){return t=ya(t),n=null==n?0:us(_a(n),0,t.length),e=li(e),t.slice(n,n+e.length)==e},zn.subtract=ku,zn.sum=function(t){return t&&t.length?$e(t,iu):0},zn.sumBy=function(t,e){return t&&t.length?$e(t,cr(e,2)):0},zn.template=function(e,n,s){var i=zn.templateSettings;s&&wr(e,n,s)&&(n=t),e=ya(e),n=xa({},n,i,Ji);var r,o,a=xa({},n.imports,i.imports,Ji),u=Ia(a),c=Ye(a,u),l=0,h=n.interpolate||vt,p="__p += '",d=Ot((n.escape||vt).source+"|"+h.source+"|"+(h===Y?lt:vt).source+"|"+(n.evaluate||vt).source+"|$","g"),f="//# sourceURL="+(Pt.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++se+"]")+"\n";e.replace(d,(function(t,n,s,i,a,u){return s||(s=i),p+=e.slice(l,u).replace(yt,nn),n&&(r=!0,p+="' +\n__e("+n+") +\n'"),a&&(o=!0,p+="';\n"+a+";\n__p += '"),s&&(p+="' +\n((__t = ("+s+")) == null ? '' : __t) +\n'"),l=u+t.length,t})),p+="';\n";var _=Pt.call(n,"variable")&&n.variable;if(_){if(ut.test(_))throw new At("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(o?p.replace(z,""):p).replace(W,"$1").replace(L,"$1;"),p="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(r?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Ja((function(){return kt(u,f+"return "+p).apply(t,c)}));if(m.source=p,Qo(m))throw m;return m},zn.times=function(t,e){if((t=_a(t))<1||t>l)return[];var n=p,s=wn(t,p);e=cr(e),t-=p;for(var i=Ge(s,e);++n<t;)e(n);return i},zn.toFinite=fa,zn.toInteger=_a,zn.toLength=ma,zn.toLower=function(t){return ya(t).toLowerCase()},zn.toNumber=ga,zn.toSafeInteger=function(t){return t?us(_a(t),-9007199254740991,l):0===t?t:0},zn.toString=ya,zn.toUpper=function(t){return ya(t).toUpperCase()},zn.trim=function(e,n,s){if((e=ya(e))&&(s||n===t))return Xe(e);if(!e||!(n=li(n)))return e;var i=hn(e),r=hn(n);return xi(i,Ke(i,r),Je(i,r)+1).join("")},zn.trimEnd=function(e,n,s){if((e=ya(e))&&(s||n===t))return e.slice(0,pn(e)+1);if(!e||!(n=li(n)))return e;var i=hn(e);return xi(i,0,Je(i,hn(n))+1).join("")},zn.trimStart=function(e,n,s){if((e=ya(e))&&(s||n===t))return e.replace(nt,"");if(!e||!(n=li(n)))return e;var i=hn(e);return xi(i,Ke(i,hn(n))).join("")},zn.truncate=function(e,n){var s=30,i="...";if(ea(n)){var r="separator"in n?n.separator:r;s="length"in n?_a(n.length):s,i="omission"in n?li(n.omission):i}var o=(e=ya(e)).length;if(sn(e)){var a=hn(e);o=a.length}if(s>=o)return e;var u=s-ln(i);if(u<1)return i;var c=a?xi(a,0,u).join(""):e.slice(0,u);if(r===t)return c+i;if(a&&(u+=c.length-u),oa(r)){if(e.slice(u).search(r)){var l,h=c;for(r.global||(r=Ot(r.source,ya(ht.exec(r))+"g")),r.lastIndex=0;l=r.exec(h);)var p=l.index;c=c.slice(0,p===t?u:p)}}else if(e.indexOf(li(r),u)!=u){var d=c.lastIndexOf(r);d>-1&&(c=c.slice(0,d))}return c+i},zn.unescape=function(t){return(t=ya(t))&&$.test(t)?t.replace(U,dn):t},zn.uniqueId=function(t){var e=++Vt;return ya(t)+e},zn.upperCase=Ya,zn.upperFirst=Qa,zn.each=yo,zn.eachRight=wo,zn.first=$r,uu(zn,(vu={},bs(zn,(function(t,e){Pt.call(zn.prototype,e)||(vu[e]=t)})),vu),{chain:!1}),zn.VERSION="4.17.21",ke(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){zn[t].placeholder=zn})),ke(["drop","take"],(function(e,n){Hn.prototype[e]=function(s){s=s===t?1:yn(_a(s),0);var i=this.__filtered__&&!n?new Hn(this):this.clone();return i.__filtered__?i.__takeCount__=wn(s,i.__takeCount__):i.__views__.push({size:wn(s,p),type:e+(i.__dir__<0?"Right":"")}),i},Hn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),ke(["filter","map","takeWhile"],(function(t,e){var n=e+1,s=1==n||3==n;Hn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:cr(t,3),type:n}),e.__filtered__=e.__filtered__||s,e}})),ke(["head","last"],(function(t,e){var n="take"+(e?"Right":"");Hn.prototype[t]=function(){return this[n](1).value()[0]}})),ke(["initial","tail"],(function(t,e){var n="drop"+(e?"":"Right");Hn.prototype[t]=function(){return this.__filtered__?new Hn(this):this[n](1)}})),Hn.prototype.compact=function(){return this.filter(iu)},Hn.prototype.find=function(t){return this.filter(t).head()},Hn.prototype.findLast=function(t){return this.reverse().find(t)},Hn.prototype.invokeMap=Qs((function(t,e){return"function"==typeof t?new Hn(this):this.map((function(n){return Ds(n,t,e)}))})),Hn.prototype.reject=function(t){return this.filter(Po(cr(t)))},Hn.prototype.slice=function(e,n){e=_a(e);var s=this;return s.__filtered__&&(e>0||n<0)?new Hn(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),n!==t&&(s=(n=_a(n))<0?s.dropRight(-n):s.take(n-e)),s)},Hn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Hn.prototype.toArray=function(){return this.take(p)},bs(Hn.prototype,(function(e,n){var s=/^(?:filter|find|map|reject)|While$/.test(n),i=/^(?:head|last)$/.test(n),r=zn[i?"take"+("last"==n?"Right":""):n],o=i||/^find/.test(n);r&&(zn.prototype[n]=function(){var n=this.__wrapped__,a=i?[1]:arguments,u=n instanceof Hn,c=a[0],l=u||Ho(n),h=function(t){var e=r.apply(zn,Ie([t],a));return i&&p?e[0]:e};l&&s&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,d=!!this.__actions__.length,f=o&&!p,_=u&&!d;if(!o&&l){n=_?n:new Hn(this);var m=e.apply(n,a);return m.__actions__.push({func:fo,args:[h],thisArg:t}),new Un(m,p)}return f&&_?e.apply(this,a):(m=this.thru(h),f?i?m.value()[0]:m.value():m)})})),ke(["pop","push","shift","sort","splice","unshift"],(function(t){var e=Dt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",s=/^(?:pop|shift)$/.test(t);zn.prototype[t]=function(){var t=arguments;if(s&&!this.__chain__){var i=this.value();return e.apply(Ho(i)?i:[],t)}return this[n]((function(n){return e.apply(Ho(n)?n:[],t)}))}})),bs(Hn.prototype,(function(t,e){var n=zn[e];if(n){var s=n.name+"";Pt.call(In,s)||(In[s]=[]),In[s].push({name:e,func:n})}})),In[zi(t,2).name]=[{name:"wrapper",func:t}],Hn.prototype.clone=function(){var t=new Hn(this.__wrapped__);return t.__actions__=Ei(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ei(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ei(this.__views__),t},Hn.prototype.reverse=function(){if(this.__filtered__){var t=new Hn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Hn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=Ho(t),s=e<0,i=n?t.length:0,r=function(t,e,n){for(var s=-1,i=n.length;++s<i;){var r=n[s],o=r.size;switch(r.type){case"drop":t+=o;break;case"dropRight":e-=o;break;case"take":e=wn(e,t+o);break;case"takeRight":t=yn(t,e-o)}}return{start:t,end:e}}(0,i,this.__views__),o=r.start,a=r.end,u=a-o,c=s?a:o-1,l=this.__iteratees__,h=l.length,p=0,d=wn(u,this.__takeCount__);if(!n||!s&&i==u&&d==u)return _i(t,this.__actions__);var f=[];t:for(;u--&&p<d;){for(var _=-1,m=t[c+=e];++_<h;){var g=l[_],v=g.iteratee,y=g.type,w=v(m);if(2==y)m=w;else if(!w){if(1==y)continue t;break t}}f[p++]=m}return f},zn.prototype.at=_o,zn.prototype.chain=function(){return po(this)},zn.prototype.commit=function(){return new Un(this.value(),this.__chain__)},zn.prototype.next=function(){this.__values__===t&&(this.__values__=da(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?t:this.__values__[this.__index__++]}},zn.prototype.plant=function(e){for(var n,s=this;s instanceof Ln;){var i=Fr(s);i.__index__=0,i.__values__=t,n?r.__wrapped__=i:n=i;var r=i;s=s.__wrapped__}return r.__wrapped__=e,n},zn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Hn){var n=e;return this.__actions__.length&&(n=new Hn(this)),(n=n.reverse()).__actions__.push({func:fo,args:[to],thisArg:t}),new Un(n,this.__chain__)}return this.thru(to)},zn.prototype.toJSON=zn.prototype.valueOf=zn.prototype.value=function(){return _i(this.__wrapped__,this.__actions__)},zn.prototype.first=zn.prototype.head,oe&&(zn.prototype[oe]=function(){return this}),zn}();de?((de.exports=fn)._=fn,pe._=fn):he._=fn}.call(Uo);var Zo,Yo=Xo.exports,Qo=new Uint8Array(16);function Ko(){if(!Zo&&!(Zo="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Zo(Qo)}var Jo=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var ta=[],ea=0;ea<256;++ea)ta.push((ea+256).toString(16).substr(1));function na(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(ta[t[e+0]]+ta[t[e+1]]+ta[t[e+2]]+ta[t[e+3]]+"-"+ta[t[e+4]]+ta[t[e+5]]+"-"+ta[t[e+6]]+ta[t[e+7]]+"-"+ta[t[e+8]]+ta[t[e+9]]+"-"+ta[t[e+10]]+ta[t[e+11]]+ta[t[e+12]]+ta[t[e+13]]+ta[t[e+14]]+ta[t[e+15]]).toLowerCase();if(!function(t){return"string"==typeof t&&Jo.test(t)}(n))throw TypeError("Stringified UUID is invalid");return n}function sa(t,e,n){var s=(t=t||{}).random||(t.rng||Ko)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=s[i];return e}return na(s)}var ia={exports:{}};var ra,oa={exports:{}};function aa(){return ra||(ra=1,oa.exports=function(){var t=t||function(t,e){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==Uo&&Uo.crypto&&(n=Uo.crypto),!n)try{n=require("crypto")}catch(t){}var s=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),r={},o=r.lib={},a=o.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},u=o.WordArray=a.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,n=t.words,s=this.sigBytes,i=t.sigBytes;if(this.clamp(),s%4)for(var r=0;r<i;r++){var o=n[r>>>2]>>>24-r%4*8&255;e[s+r>>>2]|=o<<24-(s+r)%4*8}else for(var a=0;a<i;a+=4)e[s+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(s());return new u.init(e,t)}}),c=r.enc={},l=c.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push((r>>>4).toString(16)),s.push((15&r).toString(16))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s+=2)n[s>>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new u.init(n,e/2)}},h=c.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i++){var r=e[i>>>2]>>>24-i%4*8&255;s.push(String.fromCharCode(r))}return s.join("")},parse:function(t){for(var e=t.length,n=[],s=0;s<e;s++)n[s>>>2]|=(255&t.charCodeAt(s))<<24-s%4*8;return new u.init(n,e)}},p=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},d=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,s=this._data,i=s.words,r=s.sigBytes,o=this.blockSize,a=r/(4*o),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*o,l=t.min(4*c,r);if(c){for(var h=0;h<c;h+=o)this._doProcessBlock(i,h);n=i.splice(0,c),s.sigBytes-=l}return new u.init(n,l)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});o.Hasher=d.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){d.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}});var f=r.algo={};return r}(Math);return t}()),oa.exports}var ua,ca={exports:{}};function la(){return ua||(ua=1,ca.exports=function(t){return s=(n=t).lib,i=s.Base,r=s.WordArray,(o=n.x64={}).Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),o.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],s=0;s<e;s++){var i=t[s];n.push(i.high),n.push(i.low)}return r.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,s=0;s<n;s++)e[s]=e[s].clone();return t}}),t;var e,n,s,i,r,o}(aa())),ca.exports}var ha,pa={exports:{}};function da(){return ha||(ha=1,pa.exports=function(t){return function(){if("function"==typeof ArrayBuffer){var e=t.lib.WordArray,n=e.init,s=e.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var e=t.byteLength,s=[],i=0;i<e;i++)s[i>>>2]|=t[i]<<24-i%4*8;n.call(this,s,e)}else n.apply(this,arguments)};s.prototype=e}}(),t.lib.WordArray}(aa())),pa.exports}var fa,_a={exports:{}};function ma(){return fa||(fa=1,_a.exports=function(t){return function(){var e=t,n=e.lib.WordArray,s=e.enc;function i(t){return t<<8&4278255360|t>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],i=0;i<n;i+=2){var r=e[i>>>2]>>>16-i%4*8&65535;s.push(String.fromCharCode(r))}return s.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i++)s[i>>>1]|=t.charCodeAt(i)<<16-i%2*16;return n.create(s,2*e)}},s.Utf16LE={stringify:function(t){for(var e=t.words,n=t.sigBytes,s=[],r=0;r<n;r+=2){var o=i(e[r>>>2]>>>16-r%4*8&65535);s.push(String.fromCharCode(o))}return s.join("")},parse:function(t){for(var e=t.length,s=[],r=0;r<e;r++)s[r>>>1]|=i(t.charCodeAt(r)<<16-r%2*16);return n.create(s,2*e)}}}(),t.enc.Utf16}(aa())),_a.exports}var ga,va={exports:{}};function ya(){return ga||(ga=1,va.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function s(t,e,s){for(var i=[],r=0,o=0;o<e;o++)if(o%4){var a=s[t.charCodeAt(o-1)]<<o%4*2|s[t.charCodeAt(o)]>>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return n.create(i,r)}e.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,s=this._map;t.clamp();for(var i=[],r=0;r<n;r+=3)for(var o=(e[r>>>2]>>>24-r%4*8&255)<<16|(e[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|e[r+2>>>2]>>>24-(r+2)%4*8&255,a=0;a<4&&r+.75*a<n;a++)i.push(s.charAt(o>>>6*(3-a)&63));var u=s.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(t){var e=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var r=0;r<n.length;r++)i[n.charCodeAt(r)]=r}var o=n.charAt(64);if(o){var a=t.indexOf(o);-1!==a&&(e=a)}return s(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),t.enc.Base64}(aa())),va.exports}var wa,ba={exports:{}};function xa(){return wa||(wa=1,ba.exports=function(t){return function(){var e=t,n=e.lib.WordArray;function s(t,e,s){for(var i=[],r=0,o=0;o<e;o++)if(o%4){var a=s[t.charCodeAt(o-1)]<<o%4*2|s[t.charCodeAt(o)]>>>6-o%4*2;i[r>>>2]|=a<<24-r%4*8,r++}return n.create(i,r)}e.enc.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var n=t.words,s=t.sigBytes,i=e?this._safe_map:this._map;t.clamp();for(var r=[],o=0;o<s;o+=3)for(var a=(n[o>>>2]>>>24-o%4*8&255)<<16|(n[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|n[o+2>>>2]>>>24-(o+2)%4*8&255,u=0;u<4&&o+.75*u<s;u++)r.push(i.charAt(a>>>6*(3-u)&63));var c=i.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(t,e){void 0===e&&(e=!0);var n=t.length,i=e?this._safe_map:this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<i.length;o++)r[i.charCodeAt(o)]=o}var a=i.charAt(64);if(a){var u=t.indexOf(a);-1!==u&&(n=u)}return s(t,n,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),t.enc.Base64url}(aa())),ba.exports}var Ta,Aa={exports:{}};function ka(){return Ta||(Ta=1,Aa.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=o.MD5=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r=this._hash.words,o=t[e+0],u=t[e+1],d=t[e+2],f=t[e+3],_=t[e+4],m=t[e+5],g=t[e+6],v=t[e+7],y=t[e+8],w=t[e+9],b=t[e+10],x=t[e+11],T=t[e+12],A=t[e+13],k=t[e+14],C=t[e+15],S=r[0],O=r[1],M=r[2],E=r[3];S=c(S,O,M,E,o,7,a[0]),E=c(E,S,O,M,u,12,a[1]),M=c(M,E,S,O,d,17,a[2]),O=c(O,M,E,S,f,22,a[3]),S=c(S,O,M,E,_,7,a[4]),E=c(E,S,O,M,m,12,a[5]),M=c(M,E,S,O,g,17,a[6]),O=c(O,M,E,S,v,22,a[7]),S=c(S,O,M,E,y,7,a[8]),E=c(E,S,O,M,w,12,a[9]),M=c(M,E,S,O,b,17,a[10]),O=c(O,M,E,S,x,22,a[11]),S=c(S,O,M,E,T,7,a[12]),E=c(E,S,O,M,A,12,a[13]),M=c(M,E,S,O,k,17,a[14]),S=l(S,O=c(O,M,E,S,C,22,a[15]),M,E,u,5,a[16]),E=l(E,S,O,M,g,9,a[17]),M=l(M,E,S,O,x,14,a[18]),O=l(O,M,E,S,o,20,a[19]),S=l(S,O,M,E,m,5,a[20]),E=l(E,S,O,M,b,9,a[21]),M=l(M,E,S,O,C,14,a[22]),O=l(O,M,E,S,_,20,a[23]),S=l(S,O,M,E,w,5,a[24]),E=l(E,S,O,M,k,9,a[25]),M=l(M,E,S,O,f,14,a[26]),O=l(O,M,E,S,y,20,a[27]),S=l(S,O,M,E,A,5,a[28]),E=l(E,S,O,M,d,9,a[29]),M=l(M,E,S,O,v,14,a[30]),S=h(S,O=l(O,M,E,S,T,20,a[31]),M,E,m,4,a[32]),E=h(E,S,O,M,y,11,a[33]),M=h(M,E,S,O,x,16,a[34]),O=h(O,M,E,S,k,23,a[35]),S=h(S,O,M,E,u,4,a[36]),E=h(E,S,O,M,_,11,a[37]),M=h(M,E,S,O,v,16,a[38]),O=h(O,M,E,S,b,23,a[39]),S=h(S,O,M,E,A,4,a[40]),E=h(E,S,O,M,o,11,a[41]),M=h(M,E,S,O,f,16,a[42]),O=h(O,M,E,S,g,23,a[43]),S=h(S,O,M,E,w,4,a[44]),E=h(E,S,O,M,T,11,a[45]),M=h(M,E,S,O,C,16,a[46]),S=p(S,O=h(O,M,E,S,d,23,a[47]),M,E,o,6,a[48]),E=p(E,S,O,M,v,10,a[49]),M=p(M,E,S,O,k,15,a[50]),O=p(O,M,E,S,m,21,a[51]),S=p(S,O,M,E,T,6,a[52]),E=p(E,S,O,M,f,10,a[53]),M=p(M,E,S,O,b,15,a[54]),O=p(O,M,E,S,u,21,a[55]),S=p(S,O,M,E,y,6,a[56]),E=p(E,S,O,M,C,10,a[57]),M=p(M,E,S,O,g,15,a[58]),O=p(O,M,E,S,A,21,a[59]),S=p(S,O,M,E,_,6,a[60]),E=p(E,S,O,M,x,10,a[61]),M=p(M,E,S,O,d,15,a[62]),O=p(O,M,E,S,w,21,a[63]),r[0]=r[0]+S|0,r[1]=r[1]+O|0,r[2]=r[2]+M|0,r[3]=r[3]+E|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var r=e.floor(s/4294967296),o=s;n[15+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),n[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,u=a.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,n,s,i,r,o){var a=t+(e&n|~e&s)+i+o;return(a<<r|a>>>32-r)+e}function l(t,e,n,s,i,r,o){var a=t+(e&s|n&~s)+i+o;return(a<<r|a>>>32-r)+e}function h(t,e,n,s,i,r,o){var a=t+(e^n^s)+i+o;return(a<<r|a>>>32-r)+e}function p(t,e,n,s,i,r,o){var a=t+(n^(e|~s))+i+o;return(a<<r|a>>>32-r)+e}n.MD5=r._createHelper(u),n.HmacMD5=r._createHmacHelper(u)}(Math),t.MD5}(aa())),Aa.exports}var Ca,Sa={exports:{}};function Oa(){return Ca||(Ca=1,Sa.exports=function(t){return n=(e=t).lib,s=n.WordArray,i=n.Hasher,r=e.algo,o=[],a=r.SHA1=i.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],a=n[3],u=n[4],c=0;c<80;c++){if(c<16)o[c]=0|t[e+c];else{var l=o[c-3]^o[c-8]^o[c-14]^o[c-16];o[c]=l<<1|l>>>31}var h=(s<<5|s>>>27)+u+o[c];h+=c<20?1518500249+(i&r|~i&a):c<40?1859775393+(i^r^a):c<60?(i&r|i&a|r&a)-1894007588:(i^r^a)-899497514,u=a,a=r,r=i<<30|i>>>2,i=s,s=h}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;return e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(s+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA1=i._createHelper(a),e.HmacSHA1=i._createHmacHelper(a),t.SHA1;var e,n,s,i,r,o,a}(aa())),Sa.exports}var Ma,Ea={exports:{}};function Da(){return Ma||(Ma=1,Ea.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=[],u=[];!function(){function t(t){for(var n=e.sqrt(t),s=2;s<=n;s++)if(!(t%s))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var s=2,i=0;i<64;)t(s)&&(i<8&&(a[i]=n(e.pow(s,.5))),u[i]=n(e.pow(s,1/3)),i++),s++}();var c=[],l=o.SHA256=r.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],o=n[3],a=n[4],l=n[5],h=n[6],p=n[7],d=0;d<64;d++){if(d<16)c[d]=0|t[e+d];else{var f=c[d-15],_=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,m=c[d-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;c[d]=_+c[d-7]+g+c[d-16]}var v=s&i^s&r^i&r,y=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),w=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&h)+u[d]+c[d];p=h,h=l,l=a,a=o+w|0,o=r,r=i,i=s,s=w+(y+v)|0}n[0]=n[0]+s|0,n[1]=n[1]+i|0,n[2]=n[2]+r|0,n[3]=n[3]+o|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+h|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(s/4294967296),n[15+(i+64>>>9<<4)]=s,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});n.SHA256=r._createHelper(l),n.HmacSHA256=r._createHmacHelper(l)}(Math),t.SHA256}(aa())),Ea.exports}var Ia,Ra={exports:{}};var Na,Ba={exports:{}};function Pa(){return Na||(Na=1,Ba.exports=function(t){return function(){var e=t,n=e.lib.Hasher,s=e.x64,i=s.Word,r=s.WordArray,o=e.algo;function a(){return i.create.apply(i,arguments)}var u=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],c=[];!function(){for(var t=0;t<80;t++)c[t]=a()}();var l=o.SHA512=n.extend({_doReset:function(){this._hash=new r.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=this._hash.words,s=n[0],i=n[1],r=n[2],o=n[3],a=n[4],l=n[5],h=n[6],p=n[7],d=s.high,f=s.low,_=i.high,m=i.low,g=r.high,v=r.low,y=o.high,w=o.low,b=a.high,x=a.low,T=l.high,A=l.low,k=h.high,C=h.low,S=p.high,O=p.low,M=d,E=f,D=_,I=m,R=g,N=v,B=y,P=w,V=b,q=x,F=T,j=A,z=k,W=C,L=S,U=O,H=0;H<80;H++){var $,G,X=c[H];if(H<16)G=X.high=0|t[e+2*H],$=X.low=0|t[e+2*H+1];else{var Z=c[H-15],Y=Z.high,Q=Z.low,K=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,J=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),tt=c[H-2],et=tt.high,nt=tt.low,st=(et>>>19|nt<<13)^(et<<3|nt>>>29)^et>>>6,it=(nt>>>19|et<<13)^(nt<<3|et>>>29)^(nt>>>6|et<<26),rt=c[H-7],ot=rt.high,at=rt.low,ut=c[H-16],ct=ut.high,lt=ut.low;G=(G=(G=K+ot+(($=J+at)>>>0<J>>>0?1:0))+st+(($+=it)>>>0<it>>>0?1:0))+ct+(($+=lt)>>>0<lt>>>0?1:0),X.high=G,X.low=$}var ht,pt=V&F^~V&z,dt=q&j^~q&W,ft=M&D^M&R^D&R,_t=E&I^E&N^I&N,mt=(M>>>28|E<<4)^(M<<30|E>>>2)^(M<<25|E>>>7),gt=(E>>>28|M<<4)^(E<<30|M>>>2)^(E<<25|M>>>7),vt=(V>>>14|q<<18)^(V>>>18|q<<14)^(V<<23|q>>>9),yt=(q>>>14|V<<18)^(q>>>18|V<<14)^(q<<23|V>>>9),wt=u[H],bt=wt.high,xt=wt.low,Tt=L+vt+((ht=U+yt)>>>0<U>>>0?1:0),At=gt+_t;L=z,U=W,z=F,W=j,F=V,j=q,V=B+(Tt=(Tt=(Tt=Tt+pt+((ht+=dt)>>>0<dt>>>0?1:0))+bt+((ht+=xt)>>>0<xt>>>0?1:0))+G+((ht+=$)>>>0<$>>>0?1:0))+((q=P+ht|0)>>>0<P>>>0?1:0)|0,B=R,P=N,R=D,N=I,D=M,I=E,M=Tt+(mt+ft+(At>>>0<gt>>>0?1:0))+((E=ht+At|0)>>>0<ht>>>0?1:0)|0}f=s.low=f+E,s.high=d+M+(f>>>0<E>>>0?1:0),m=i.low=m+I,i.high=_+D+(m>>>0<I>>>0?1:0),v=r.low=v+N,r.high=g+R+(v>>>0<N>>>0?1:0),w=o.low=w+P,o.high=y+B+(w>>>0<P>>>0?1:0),x=a.low=x+q,a.high=b+V+(x>>>0<q>>>0?1:0),A=l.low=A+j,l.high=T+F+(A>>>0<j>>>0?1:0),C=h.low=C+W,h.high=k+z+(C>>>0<W>>>0?1:0),O=p.low=O+U,p.high=S+L+(O>>>0<U>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;return e[s>>>5]|=128<<24-s%32,e[30+(s+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(s+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.SHA512=n._createHelper(l),e.HmacSHA512=n._createHmacHelper(l)}(),t.SHA512}(aa(),la())),Ba.exports}var Va,qa={exports:{}};var Fa,ja={exports:{}};function za(){return Fa||(Fa=1,ja.exports=function(t){return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.x64.Word,a=n.algo,u=[],c=[],l=[];!function(){for(var t=1,e=0,n=0;n<24;n++){u[t+5*e]=(n+1)*(n+2)/2%64;var s=(2*t+3*e)%5;t=e%5,e=s}for(t=0;t<5;t++)for(e=0;e<5;e++)c[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,r=0;r<24;r++){for(var a=0,h=0,p=0;p<7;p++){if(1&i){var d=(1<<p)-1;d<32?h^=1<<d:a^=1<<d-32}128&i?i=i<<1^113:i<<=1}l[r]=o.create(a,h)}}();var h=[];!function(){for(var t=0;t<25;t++)h[t]=o.create()}();var p=a.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,s=this.blockSize/2,i=0;i<s;i++){var r=t[e+2*i],o=t[e+2*i+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(O=n[i]).high^=o,O.low^=r}for(var a=0;a<24;a++){for(var p=0;p<5;p++){for(var d=0,f=0,_=0;_<5;_++)d^=(O=n[p+5*_]).high,f^=O.low;var m=h[p];m.high=d,m.low=f}for(p=0;p<5;p++){var g=h[(p+4)%5],v=h[(p+1)%5],y=v.high,w=v.low;for(d=g.high^(y<<1|w>>>31),f=g.low^(w<<1|y>>>31),_=0;_<5;_++)(O=n[p+5*_]).high^=d,O.low^=f}for(var b=1;b<25;b++){var x=(O=n[b]).high,T=O.low,A=u[b];A<32?(d=x<<A|T>>>32-A,f=T<<A|x>>>32-A):(d=T<<A-32|x>>>64-A,f=x<<A-32|T>>>64-A);var k=h[c[b]];k.high=d,k.low=f}var C=h[0],S=n[0];for(C.high=S.high,C.low=S.low,p=0;p<5;p++)for(_=0;_<5;_++){var O=n[b=p+5*_],M=h[b],E=h[(p+1)%5+5*_],D=h[(p+2)%5+5*_];O.high=M.high^~E.high&D.high,O.low=M.low^~E.low&D.low}O=n[0];var I=l[a];O.high^=I.high,O.low^=I.low}},_doFinalize:function(){var t=this._data,n=t.words;this._nDataBytes;var s=8*t.sigBytes,r=32*this.blockSize;n[s>>>5]|=1<<24-s%32,n[(e.ceil((s+1)/r)*r>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var o=this._state,a=this.cfg.outputLength/8,u=a/8,c=[],l=0;l<u;l++){var h=o[l],p=h.high,d=h.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),c.push(d),c.push(p)}return new i.init(c,a)},clone:function(){for(var t=r.clone.call(this),e=t._state=this._state.slice(0),n=0;n<25;n++)e[n]=e[n].clone();return t}});n.SHA3=r._createHelper(p),n.HmacSHA3=r._createHmacHelper(p)}(Math),t.SHA3}(aa(),la())),ja.exports}var Wa,La={exports:{}};var Ua,Ha={exports:{}};function $a(){return Ua||(Ua=1,Ha.exports=function(t){var e,n,s;n=(e=t).lib.Base,s=e.enc.Utf8,e.algo.HMAC=n.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var n=t.blockSize,i=4*n;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var r=this._oKey=e.clone(),o=this._iKey=e.clone(),a=r.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;r.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})}(aa())),Ha.exports}var Ga,Xa={exports:{}};var Za,Ya={exports:{}};function Qa(){return Za||(Za=1,Ya.exports=function(t){return n=(e=t).lib,s=n.Base,i=n.WordArray,r=e.algo,o=r.MD5,a=r.EvpKDF=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n,s=this.cfg,r=s.hasher.create(),o=i.create(),a=o.words,u=s.keySize,c=s.iterations;a.length<u;){n&&r.update(n),n=r.update(t).finalize(e),r.reset();for(var l=1;l<c;l++)n=r.finalize(n),r.reset();o.concat(n)}return o.sigBytes=4*u,o}}),e.EvpKDF=function(t,e,n){return a.create(n).compute(t,e)},t.EvpKDF;var e,n,s,i,r,o,a}(aa(),Oa(),$a())),Ya.exports}var Ka,Ja={exports:{}};function tu(){return Ka||(Ka=1,Ja.exports=function(t){t.lib.Cipher||function(e){var n=t,s=n.lib,i=s.Base,r=s.WordArray,o=s.BufferedBlockAlgorithm,a=n.enc;a.Utf8;var u=a.Base64,c=n.algo.EvpKDF,l=s.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?y:g}return function(e){return{encrypt:function(n,s,i){return t(s).encrypt(e,n,s,i)},decrypt:function(n,s,i){return t(s).decrypt(e,n,s,i)}}}}()});s.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=n.mode={},p=s.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),d=h.CBC=function(){var t=p.extend();function n(t,n,s){var i,r=this._iv;r?(i=r,this._iv=e):i=this._prevBlock;for(var o=0;o<s;o++)t[n+o]^=i[o]}return t.Encryptor=t.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize;n.call(this,t,e,i),s.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),t.Decryptor=t.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize,r=t.slice(e,e+i);s.decryptBlock(t,e),n.call(this,t,e,i),this._prevBlock=r}}),t}(),f=(n.pad={}).Pkcs7={pad:function(t,e){for(var n=4*e,s=n-t.sigBytes%n,i=s<<24|s<<16|s<<8|s,o=[],a=0;a<s;a+=4)o.push(i);var u=r.create(o,s);t.concat(u)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};s.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:f}),reset:function(){var t;l.reset.call(this);var e=this.cfg,n=e.iv,s=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=s.createEncryptor:(t=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,n&&n.words):(this._mode=t.call(s,this,n&&n.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4});var _=s.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),m=(n.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,n=t.salt;return(n?r.create([1398893684,1701076831]).concat(n).concat(e):e).toString(u)},parse:function(t){var e,n=u.parse(t),s=n.words;return 1398893684==s[0]&&1701076831==s[1]&&(e=r.create(s.slice(2,4)),s.splice(0,4),n.sigBytes-=16),_.create({ciphertext:n,salt:e})}},g=s.SerializableCipher=i.extend({cfg:i.extend({format:m}),encrypt:function(t,e,n,s){s=this.cfg.extend(s);var i=t.createEncryptor(n,s),r=i.finalize(e),o=i.cfg;return _.create({ciphertext:r,key:n,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:s.format})},decrypt:function(t,e,n,s){return s=this.cfg.extend(s),e=this._parse(e,s.format),t.createDecryptor(n,s).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),v=(n.kdf={}).OpenSSL={execute:function(t,e,n,s,i){if(s||(s=r.random(8)),i)o=c.create({keySize:e+n,hasher:i}).compute(t,s);else var o=c.create({keySize:e+n}).compute(t,s);var a=r.create(o.words.slice(e),4*n);return o.sigBytes=4*e,_.create({key:o,iv:a,salt:s})}},y=s.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:v}),encrypt:function(t,e,n,s){var i=(s=this.cfg.extend(s)).kdf.execute(n,t.keySize,t.ivSize,s.salt,s.hasher);s.iv=i.iv;var r=g.encrypt.call(this,t,e,i.key,s);return r.mixIn(i),r},decrypt:function(t,e,n,s){s=this.cfg.extend(s),e=this._parse(e,s.format);var i=s.kdf.execute(n,t.keySize,t.ivSize,e.salt,s.hasher);return s.iv=i.iv,g.decrypt.call(this,t,e,i.key,s)}})}()}(aa(),Qa())),Ja.exports}var eu,nu={exports:{}};function su(){return eu||(eu=1,nu.exports=function(t){return t.mode.CFB=function(){var e=t.lib.BlockCipherMode.extend();function n(t,e,n,s){var i,r=this._iv;r?(i=r.slice(0),this._iv=void 0):i=this._prevBlock,s.encryptBlock(i,0);for(var o=0;o<n;o++)t[e+o]^=i[o]}return e.Encryptor=e.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize;n.call(this,t,e,i,s),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var s=this._cipher,i=s.blockSize,r=t.slice(e,e+i);n.call(this,t,e,i,s),this._prevBlock=r}}),e}(),t.mode.CFB}(aa(),tu())),nu.exports}var iu,ru={exports:{}};function ou(){return iu||(iu=1,ru.exports=function(t){return t.mode.CTR=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,s=n.blockSize,i=this._iv,r=this._counter;i&&(r=this._counter=i.slice(0),this._iv=void 0);var o=r.slice(0);n.encryptBlock(o,0),r[s-1]=r[s-1]+1|0;for(var a=0;a<s;a++)t[e+a]^=o[a]}}),e.Decryptor=n,e),t.mode.CTR;var e,n}(aa(),tu())),ru.exports}var au,uu={exports:{}};function cu(){return au||(au=1,uu.exports=function(t){
|
|
16
16
|
/** @preserve
|
|
17
17
|
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
18
18
|
* derived from CryptoJS.mode.CTR
|
|
19
19
|
* Jan Hruby jhruby.web@gmail.com
|
|
20
20
|
*/
|
|
21
|
-
return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function n(t){if(255==(t>>24&255)){var e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}else t+=1<<24;return t}function s(t){return 0===(t[0]=n(t[0]))&&(t[1]=n(t[1])),t}var i=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,r=this._iv,o=this._counter;r&&(o=this._counter=r.slice(0),this._iv=void 0),s(o);var a=o.slice(0);n.encryptBlock(a,0);for(var u=0;u<i;u++)t[e+u]^=a[u]}});return e.Decryptor=i,e}(),t.mode.CTRGladman}(ia(),Qa())),ru.exports}var au,uu={exports:{}};function cu(){return au||(au=1,uu.exports=function(t){return t.mode.OFB=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,s=n.blockSize,i=this._iv,r=this._keystream;i&&(r=this._keystream=i.slice(0),this._iv=void 0),n.encryptBlock(r,0);for(var o=0;o<s;o++)t[e+o]^=r[o]}}),e.Decryptor=n,e),t.mode.OFB;var e,n}(ia(),Qa())),uu.exports}var lu,hu={exports:{}};var pu,du={exports:{}};var fu,_u={exports:{}};var mu,gu={exports:{}};var vu,yu={exports:{}};var wu,bu={exports:{}};var xu,Tu={exports:{}};var Au,ku={exports:{}};var Cu,Su={exports:{}};function Ou(){return Cu||(Cu=1,Su.exports=function(t){return function(){var e=t,n=e.lib,s=n.WordArray,i=n.BlockCipher,r=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=r.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],n=0;n<56;n++){var s=o[n]-1;e[n]=t[s>>>5]>>>31-s%32&1}for(var i=this._subKeys=[],r=0;r<16;r++){var c=i[r]=[],l=u[r];for(n=0;n<24;n++)c[n/6|0]|=e[(a[n]-1+l)%28]<<31-n%6,c[4+(n/6|0)]|=e[28+(a[n+24]-1+l)%28]<<31-n%6;for(c[0]=c[0]<<1|c[0]>>>31,n=1;n<7;n++)c[n]=c[n]>>>4*(n-1)+3;c[7]=c[7]<<5|c[7]>>>27}var h=this._invSubKeys=[];for(n=0;n<16;n++)h[n]=i[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,n){this._lBlock=t[e],this._rBlock=t[e+1],p.call(this,4,252645135),p.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),p.call(this,1,1431655765);for(var s=0;s<16;s++){for(var i=n[s],r=this._lBlock,o=this._rBlock,a=0,u=0;u<8;u++)a|=c[u][((o^i[u])&l[u])>>>0];this._lBlock=o,this._rBlock=r^a}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,p.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(t,e){var n=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=n,this._lBlock^=n<<t}function d(t,e){var n=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=n,this._rBlock^=n<<t}e.DES=i._createHelper(h);var f=r.TripleDES=i.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),n=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=h.createEncryptor(s.create(e)),this._des2=h.createEncryptor(s.create(n)),this._des3=h.createEncryptor(s.create(i))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(f)}(),t.TripleDES}(ia(),ma(),xa(),Xa(),Qa())),Su.exports}var Mu,Eu={exports:{}};var Du,Iu={exports:{}};var Ru,Nu={exports:{}};var Bu,Pu={exports:{}};function Vu(){return Bu||(Bu=1,Pu.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo;const i=16,r=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function u(t,e){let n=e>>24&255,s=e>>16&255,i=e>>8&255,r=255&e,o=t.sbox[0][n]+t.sbox[1][s];return o^=t.sbox[2][i],o+=t.sbox[3][r],o}function c(t,e,n){let s,r=e,o=n;for(let e=0;e<i;++e)r^=t.pbox[e],o=u(t,r)^o,s=r,r=o,o=s;return s=r,r=o,o=s,o^=t.pbox[i],r^=t.pbox[i+1],{left:r,right:o}}function l(t,e,n){let s,r=e,o=n;for(let e=i+1;e>1;--e)r^=t.pbox[e],o=u(t,r)^o,s=r,r=o,o=s;return s=r,r=o,o=s,o^=t.pbox[1],r^=t.pbox[0],{left:r,right:o}}function h(t,e,n){for(let e=0;e<4;e++){t.sbox[e]=[];for(let n=0;n<256;n++)t.sbox[e][n]=o[e][n]}let s=0;for(let o=0;o<i+2;o++)t.pbox[o]=r[o]^e[s],s++,s>=n&&(s=0);let a=0,u=0,l=0;for(let e=0;e<i+2;e+=2)l=c(t,a,u),a=l.left,u=l.right,t.pbox[e]=a,t.pbox[e+1]=u;for(let e=0;e<4;e++)for(let n=0;n<256;n+=2)l=c(t,a,u),a=l.left,u=l.right,t.sbox[e][n]=a,t.sbox[e][n+1]=u;return!0}var p=s.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4;h(a,e,n)}},encryptBlock:function(t,e){var n=c(a,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},decryptBlock:function(t,e){var n=l(a,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=n._createHelper(p)}(),t.Blowfish}(ia(),ma(),xa(),Xa(),Qa())),Pu.exports}ea.exports=function(t){return t}(ia(),aa(),la(),da(),ma(),ya(),xa(),ka(),Oa(),Ma||(Ma=1,Ea.exports=function(t){return n=(e=t).lib.WordArray,s=e.algo,i=s.SHA256,r=s.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=i._doFinalize.call(this);return t.sigBytes-=4,t}}),e.SHA224=i._createHelper(r),e.HmacSHA224=i._createHmacHelper(r),t.SHA224;var e,n,s,i,r}(ia(),Oa())),Ra(),Na||(Na=1,Ba.exports=function(t){return n=(e=t).x64,s=n.Word,i=n.WordArray,r=e.algo,o=r.SHA512,a=r.SHA384=o.extend({_doReset:function(){this._hash=new i.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=16,t}}),e.SHA384=o._createHelper(a),e.HmacSHA384=o._createHmacHelper(a),t.SHA384;var e,n,s,i,r,o,a}(ia(),aa(),Ra())),qa(),Fa||(Fa=1,ja.exports=function(t){
|
|
21
|
+
return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();function n(t){if(255==(t>>24&255)){var e=t>>16&255,n=t>>8&255,s=255&t;255===e?(e=0,255===n?(n=0,255===s?s=0:++s):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=s}else t+=1<<24;return t}function s(t){return 0===(t[0]=n(t[0]))&&(t[1]=n(t[1])),t}var i=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,r=this._iv,o=this._counter;r&&(o=this._counter=r.slice(0),this._iv=void 0),s(o);var a=o.slice(0);n.encryptBlock(a,0);for(var u=0;u<i;u++)t[e+u]^=a[u]}});return e.Decryptor=i,e}(),t.mode.CTRGladman}(aa(),tu())),uu.exports}var lu,hu={exports:{}};function pu(){return lu||(lu=1,hu.exports=function(t){return t.mode.OFB=(e=t.lib.BlockCipherMode.extend(),n=e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,s=n.blockSize,i=this._iv,r=this._keystream;i&&(r=this._keystream=i.slice(0),this._iv=void 0),n.encryptBlock(r,0);for(var o=0;o<s;o++)t[e+o]^=r[o]}}),e.Decryptor=n,e),t.mode.OFB;var e,n}(aa(),tu())),hu.exports}var du,fu={exports:{}};var _u,mu={exports:{}};var gu,vu={exports:{}};var yu,wu={exports:{}};var bu,xu={exports:{}};var Tu,Au={exports:{}};var ku,Cu={exports:{}};var Su,Ou={exports:{}};var Mu,Eu={exports:{}};function Du(){return Mu||(Mu=1,Eu.exports=function(t){return function(){var e=t,n=e.lib,s=n.WordArray,i=n.BlockCipher,r=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=r.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],n=0;n<56;n++){var s=o[n]-1;e[n]=t[s>>>5]>>>31-s%32&1}for(var i=this._subKeys=[],r=0;r<16;r++){var c=i[r]=[],l=u[r];for(n=0;n<24;n++)c[n/6|0]|=e[(a[n]-1+l)%28]<<31-n%6,c[4+(n/6|0)]|=e[28+(a[n+24]-1+l)%28]<<31-n%6;for(c[0]=c[0]<<1|c[0]>>>31,n=1;n<7;n++)c[n]=c[n]>>>4*(n-1)+3;c[7]=c[7]<<5|c[7]>>>27}var h=this._invSubKeys=[];for(n=0;n<16;n++)h[n]=i[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,n){this._lBlock=t[e],this._rBlock=t[e+1],p.call(this,4,252645135),p.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),p.call(this,1,1431655765);for(var s=0;s<16;s++){for(var i=n[s],r=this._lBlock,o=this._rBlock,a=0,u=0;u<8;u++)a|=c[u][((o^i[u])&l[u])>>>0];this._lBlock=o,this._rBlock=r^a}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,p.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),p.call(this,16,65535),p.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function p(t,e){var n=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=n,this._lBlock^=n<<t}function d(t,e){var n=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=n,this._rBlock^=n<<t}e.DES=i._createHelper(h);var f=r.TripleDES=i.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),n=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=h.createEncryptor(s.create(e)),this._des2=h.createEncryptor(s.create(n)),this._des3=h.createEncryptor(s.create(i))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(f)}(),t.TripleDES}(aa(),ya(),ka(),Qa(),tu())),Eu.exports}var Iu,Ru={exports:{}};var Nu,Bu={exports:{}};var Pu,Vu={exports:{}};var qu,Fu={exports:{}};function ju(){return qu||(qu=1,Fu.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo;const i=16,r=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function u(t,e){let n=e>>24&255,s=e>>16&255,i=e>>8&255,r=255&e,o=t.sbox[0][n]+t.sbox[1][s];return o^=t.sbox[2][i],o+=t.sbox[3][r],o}function c(t,e,n){let s,r=e,o=n;for(let e=0;e<i;++e)r^=t.pbox[e],o=u(t,r)^o,s=r,r=o,o=s;return s=r,r=o,o=s,o^=t.pbox[i],r^=t.pbox[i+1],{left:r,right:o}}function l(t,e,n){let s,r=e,o=n;for(let e=i+1;e>1;--e)r^=t.pbox[e],o=u(t,r)^o,s=r,r=o,o=s;return s=r,r=o,o=s,o^=t.pbox[1],r^=t.pbox[0],{left:r,right:o}}function h(t,e,n){for(let e=0;e<4;e++){t.sbox[e]=[];for(let n=0;n<256;n++)t.sbox[e][n]=o[e][n]}let s=0;for(let o=0;o<i+2;o++)t.pbox[o]=r[o]^e[s],s++,s>=n&&(s=0);let a=0,u=0,l=0;for(let e=0;e<i+2;e+=2)l=c(t,a,u),a=l.left,u=l.right,t.pbox[e]=a,t.pbox[e+1]=u;for(let e=0;e<4;e++)for(let n=0;n<256;n+=2)l=c(t,a,u),a=l.left,u=l.right,t.sbox[e][n]=a,t.sbox[e][n+1]=u;return!0}var p=s.Blowfish=n.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4;h(a,e,n)}},encryptBlock:function(t,e){var n=c(a,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},decryptBlock:function(t,e){var n=l(a,t[e],t[e+1]);t[e]=n.left,t[e+1]=n.right},blockSize:2,keySize:4,ivSize:2});e.Blowfish=n._createHelper(p)}(),t.Blowfish}(aa(),ya(),ka(),Qa(),tu())),Fu.exports}ia.exports=function(t){return t}(aa(),la(),da(),ma(),ya(),xa(),ka(),Oa(),Da(),Ia||(Ia=1,Ra.exports=function(t){return n=(e=t).lib.WordArray,s=e.algo,i=s.SHA256,r=s.SHA224=i.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=i._doFinalize.call(this);return t.sigBytes-=4,t}}),e.SHA224=i._createHelper(r),e.HmacSHA224=i._createHmacHelper(r),t.SHA224;var e,n,s,i,r}(aa(),Da())),Pa(),Va||(Va=1,qa.exports=function(t){return n=(e=t).x64,s=n.Word,i=n.WordArray,r=e.algo,o=r.SHA512,a=r.SHA384=o.extend({_doReset:function(){this._hash=new i.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=16,t}}),e.SHA384=o._createHelper(a),e.HmacSHA384=o._createHmacHelper(a),t.SHA384;var e,n,s,i,r,o,a}(aa(),la(),Pa())),za(),Wa||(Wa=1,La.exports=function(t){
|
|
22
22
|
/** @preserve
|
|
23
23
|
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
24
24
|
|
|
@@ -29,5 +29,5 @@ return t.mode.CTRGladman=function(){var e=t.lib.BlockCipherMode.extend();functio
|
|
|
29
29
|
|
|
30
30
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
31
|
*/
|
|
32
|
-
return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=r.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,o,d,w,b,x,T,A,k,C,S,O=this._hash.words,M=h.words,E=p.words,D=a.words,I=u.words,R=c.words,N=l.words;for(x=r=O[0],T=o=O[1],A=d=O[2],k=w=O[3],C=b=O[4],n=0;n<80;n+=1)S=r+t[e+D[n]]|0,S+=n<16?f(o,d,w)+M[0]:n<32?_(o,d,w)+M[1]:n<48?m(o,d,w)+M[2]:n<64?g(o,d,w)+M[3]:v(o,d,w)+M[4],S=(S=y(S|=0,R[n]))+b|0,r=b,b=w,w=y(d,10),d=o,o=S,S=x+t[e+I[n]]|0,S+=n<16?v(T,A,k)+E[0]:n<32?g(T,A,k)+E[1]:n<48?m(T,A,k)+E[2]:n<64?_(T,A,k)+E[3]:f(T,A,k)+E[4],S=(S=y(S|=0,N[n]))+C|0,x=C,C=k,k=y(A,10),A=T,T=S;S=O[1]+d+k|0,O[1]=O[2]+w+C|0,O[2]=O[3]+b+x|0,O[3]=O[4]+r+T|0,O[4]=O[0]+o+A|0,O[0]=S},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var a=r[o];r[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function f(t,e,n){return t^e^n}function _(t,e,n){return t&e|~t&n}function m(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function v(t,e,n){return t^(e|~n)}function y(t,e){return t<<e|t>>>32-e}n.RIPEMD160=r._createHelper(d),n.HmacRIPEMD160=r._createHmacHelper(d)}(),t.RIPEMD160}(ia())),La(),Ua||(Ua=1,Ha.exports=function(t){return s=(n=(e=t).lib).Base,i=n.WordArray,o=(r=e.algo).SHA256,a=r.HMAC,u=r.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,s=a.create(n.hasher,t),r=i.create(),o=i.create([1]),u=r.words,c=o.words,l=n.keySize,h=n.iterations;u.length<l;){var p=s.update(e).finalize(o);s.reset();for(var d=p.words,f=d.length,_=p,m=1;m<h;m++){_=s.finalize(_),s.reset();for(var g=_.words,v=0;v<f;v++)d[v]^=g[v]}r.concat(p),c[0]++}return r.sigBytes=4*l,r}}),e.PBKDF2=function(t,e,n){return u.create(n).compute(t,e)},t.PBKDF2;var e,n,s,i,r,o,a,u}(ia(),Oa(),La())),Xa(),Qa(),tu(),su(),ou(),cu(),lu||(lu=1,hu.exports=function(t){return t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e),t.mode.ECB;var e}(ia(),Qa())),pu||(pu=1,du.exports=function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,s=4*e,i=s-n%s,r=n+i-1;t.clamp(),t.words[r>>>2]|=i<<24-r%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923}(ia(),Qa())),fu||(fu=1,_u.exports=function(t){return t.pad.Iso10126={pad:function(e,n){var s=4*n,i=s-e.sigBytes%s;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126}(ia(),Qa())),mu||(mu=1,gu.exports=function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971}(ia(),Qa())),vu||(vu=1,yu.exports=function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},t.pad.ZeroPadding}(ia(),Qa())),wu||(wu=1,bu.exports=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}(ia(),Qa())),xu||(xu=1,Tu.exports=function(t){return n=(e=t).lib.CipherParams,s=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return n.create({ciphertext:e})}},t.format.Hex;var e,n,s}(ia(),Qa())),Au||(Au=1,ku.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo,i=[],r=[],o=[],a=[],u=[],c=[],l=[],h=[],p=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,s=0;for(e=0;e<256;e++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,i[n]=f,r[f]=n;var _=t[n],m=t[_],g=t[m],v=257*t[f]^16843008*f;o[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,u[n]=v<<8|v>>>24,c[n]=v,v=16843009*g^65537*m^257*_^16843008*n,l[f]=v<<24|v>>>8,h[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,d[f]=v,n?(n=_^t[t[t[g^_]]],s^=t[t[s]]):n=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=s.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,s=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o<s;o++)o<n?r[o]=e[o]:(c=r[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=f[o/n|0]<<24),r[o]=r[o-n]^c);for(var a=this._invKeySchedule=[],u=0;u<s;u++){if(o=s-u,u%4)var c=r[o];else c=r[o-4];a[u]=u<4||o<=4?c:l[i[c>>>24]]^h[i[c>>>16&255]]^p[i[c>>>8&255]]^d[i[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,o,a,u,c,i)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,l,h,p,d,r),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,s,i,r,o,a){for(var u=this._nRounds,c=t[e]^n[0],l=t[e+1]^n[1],h=t[e+2]^n[2],p=t[e+3]^n[3],d=4,f=1;f<u;f++){var _=s[c>>>24]^i[l>>>16&255]^r[h>>>8&255]^o[255&p]^n[d++],m=s[l>>>24]^i[h>>>16&255]^r[p>>>8&255]^o[255&c]^n[d++],g=s[h>>>24]^i[p>>>16&255]^r[c>>>8&255]^o[255&l]^n[d++],v=s[p>>>24]^i[c>>>16&255]^r[l>>>8&255]^o[255&h]^n[d++];c=_,l=m,h=g,p=v}_=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&p])^n[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^n[d++],g=(a[h>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],v=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],t[e]=_,t[e+1]=m,t[e+2]=g,t[e+3]=v},keySize:8});e.AES=n._createHelper(_)}(),t.AES}(ia(),ma(),xa(),Xa(),Qa())),Ou(),Mu||(Mu=1,Eu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=s.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,s=this._S=[],i=0;i<256;i++)s[i]=i;i=0;for(var r=0;i<256;i++){var o=i%n,a=e[o>>>2]>>>24-o%4*8&255;r=(r+s[i]+a)%256;var u=s[i];s[i]=s[r],s[r]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var t=this._S,e=this._i,n=this._j,s=0,i=0;i<4;i++){n=(n+t[e=(e+1)%256])%256;var r=t[e];t[e]=t[n],t[n]=r,s|=t[(t[e]+t[n])%256]<<24-8*i}return this._i=e,this._j=n,s}e.RC4=n._createHelper(i);var o=s.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)r.call(this)}});e.RC4Drop=n._createHelper(o)}(),t.RC4}(ia(),ma(),xa(),Xa(),Qa())),Du||(Du=1,Iu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var s=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=s[n+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=l,i[3]^=p,i[4]^=c,i[5]^=h,i[6]^=l,i[7]^=p,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=n._createHelper(a)}(),t.Rabbit}(ia(),ma(),xa(),Xa(),Qa())),Ru||(Ru=1,Nu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],s=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)u.call(this);for(i=0;i<8;i++)s[i]^=n[i+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(s[0]^=c,s[1]^=h,s[2]^=l,s[3]^=p,s[4]^=c,s[5]^=h,s[6]^=l,s[7]^=p,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=n._createHelper(a)}(),t.RabbitLegacy}(ia(),ma(),xa(),Xa(),Qa())),Vu());var qu,Fu=Wo(ea.exports);function ju(t,e){const n=`${t}:${e}`,s=Fu.SHA256(n).toString(Fu.enc.Hex);return`${s.substring(0,8)}-${s.substring(8,12)}-4${s.substring(13,16)}-${"89AB"[parseInt(s.substring(17,18),16)%4]}${s.substring(18,21)}-${s.substring(21,33)}`}function zu(t,e){if(t instanceof $u&&e instanceof Gu)t.plug(e);else if(t instanceof Xu&&e instanceof Zu)t.plug(e);else if(t instanceof Uu&&e instanceof Hu)t.plug(e);else if(t instanceof Uu&&e instanceof Zu)t.plug(e);else if(t instanceof Uu&&e instanceof Gu)t.plug(e);else if(t instanceof $u&&e instanceof Hu)t.plug(e);else{if(!(t instanceof Xu&&e instanceof Hu))throw Error("Input and output type is not compatible");t.plug(e)}}function Wu(t,e){if(t instanceof $u&&e instanceof Gu)t.unPlug(e);else if(t instanceof Xu&&e instanceof Zu)t.unPlug(e);else if(t instanceof Uu&&e instanceof Hu)t.unPlug(e);else if(t instanceof Uu&&e instanceof Zu)t.unPlug(e);else if(t instanceof Uu&&e instanceof Gu)t.unPlug(e);else if(t instanceof $u&&e instanceof Hu)t.unPlug(e);else{if(!(t instanceof Xu&&e instanceof Hu))throw Error("Input and output type is not compatible");t.unPlug(e)}}!function(t){t.AudioInput="audioInput",t.AudioOutput="audioOutput",t.MidiInput="midiInput",t.MidiOutput="midiOutput",t.ForwardInput="forwardInput",t.ForwardOutput="forwardOutput"}(qu||(qu={}));class Lu{id;ioType;name;plugableModule;connections=[];static unPlugAll(t){t.connections.forEach((e=>t.unPlug(e)))}constructor(t,e){this.plugableModule=t,this.id=ju(t.id,e.name),Object.assign(this,e)}plug(t,e=!0){this.connections.push(t),e&&t.plug(this,!1)}unPlug(t,e=!0){this.connections=this.connections.filter((e=>e.id!==t.id)),e&&t.unPlug(this,!1)}serialize(){return{id:this.id,name:this.name,moduleId:this.plugableModule.id,moduleName:this.plugableModule.name,ioType:this.ioType}}}class Uu extends Lu{constructor(t,e){super(t,e),this.checkNameValidity()}get subInputs(){return this.plugableModule.audioModules.map((t=>{const e=t.inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subInput(t){const e=this.subModule(t).inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Hu||(t instanceof Hu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);zu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>zu(e,t))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Hu||(t instanceof Hu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);Wu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>Wu(e,t))))}unPlugAll(){Lu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].inputs.findByName(this.name))throw Error("You should forward to existing input")}}class Hu extends Lu{constructor(t,e){super(t,e),this.checkNameValidity()}get subOutputs(){return this.subModules.map((t=>{const e=t.outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subOutput(t){const e=this.subModule(t).outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Uu||(t instanceof Uu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);zu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>zu(t,e))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Uu||(t instanceof Uu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);Wu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>Wu(t,e))))}unPlugAll(){Lu.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].outputs.findByName(this.name))throw Error("You should forward to existing output")}}class $u extends Lu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Lu.unPlugAll(this)}}class Gu extends Lu{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e),t instanceof Uu||this.internalModule.connect(t.internalModule)}unPlug(t,e=!0){super.unPlug(t,e),t instanceof Uu||this.internalModule.disconnect(t.internalModule)}unPlugAll(){Lu.unPlugAll(this)}}class Xu extends Lu{onMidiEvent;constructor(t,e){super(t,e),this.onMidiEvent=e.onMidiEvent}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Lu.unPlugAll(this)}}class Zu extends Lu{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){Lu.unPlugAll(this)}onMidiEvent=t=>{this.midiConnections.forEach((e=>{e.onMidiEvent(t)}))};get midiConnections(){return this.connections.filter((t=>t instanceof Xu))}}class Yu{plugableModule;collection=[];constructor(t){this.plugableModule=t}add(t){let e;switch(t.ioType){case qu.AudioInput:if(this.plugableModule instanceof tc)throw Error("PolyModule is not supported");e=new $u(this.plugableModule,t);break;case qu.AudioOutput:if(this.plugableModule instanceof tc)throw Error("PolyModule is not supported");e=new Gu(this.plugableModule,t);break;case qu.ForwardInput:if(this.plugableModule instanceof Ju)throw Error("MonoModule is not supported");e=new Uu(this.plugableModule,t);break;case qu.ForwardOutput:if(this.plugableModule instanceof Ju)throw Error("MonoModule is not supported");e=new Hu(this.plugableModule,t);break;case qu.MidiInput:e=new Xu(this.plugableModule,t);break;case qu.MidiOutput:e=new Zu(this.plugableModule,t);break;default:throw Error("Unknown IOType")}return this.collection.push(e),e}unPlugAll(){this.collection.forEach((t=>t.unPlugAll()))}find(t){return this.collection.find((e=>e.id===t))}findByName(t){return this.collection.find((e=>e.name===t))}serialize(){return this.collection.map((t=>t.serialize()))}}class Qu{connect(){throw Error("This module is not connectable")}disconnect(){throw Error("This module is not connectable")}dispose(){}}var Ku,Ju=class{static moduleName;id;name;internalModule;inputs;outputs;voiceNo;updatedAt;_props={};constructor(t,e){this.internalModule=t,this.id=e.id||ta(),delete e.id,this.inputs=new Yu(this),this.outputs=new Yu(this),Object.assign(this,e)}set props(t){t&&(this.updatedAt=new Date,Object.assign(this,t))}get props(){return this._props}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);zu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll(),this.internalModule.dispose()}triggerAttack=(t,e)=>{throw Error("triggerAttack not implemented")};triggerRelease=(t,e)=>{throw Error("triggerRelease not implemented")};onMidiEvent=t=>{if(void 0!==t.voiceNo&&t.voiceNo!==this.voiceNo)return;const{note:e,triggeredAt:n}=t;switch(t.type){case"noteOn":{const{duration:t}=e;if(this.triggerer(this.triggerAttack,e,n),t){const r=n+(s=t,new Xi(zi(),s,i)).toSeconds();this.triggerer(this.triggerRelease,e,r)}break}case"noteOff":this.triggerer(this.triggerRelease,e,n);break;default:throw Error("This type is not a note")}var s,i};triggerer(t,e,n){t(e,n)}serialize(){const t=this.constructor;return{id:this.id,name:this.name,type:t.moduleName,props:this.props,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}registerMidiInput(t){return this.inputs.add({...t,ioType:qu.MidiInput})}registerAudioInput(t){return this.inputs.add({...t,ioType:qu.AudioInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:qu.MidiOutput})}registerAudioOutput(t){return this.outputs.add({...t,ioType:qu.AudioOutput})}registerBasicOutputs(){this.registerAudioOutput({name:"output",internalModule:this.internalModule})}registerBasicInputs(){this.registerAudioInput({name:"input",internalModule:this.internalModule}),this.registerDefaultMidiInput()}registerDefaultMidiInput(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}};class tc{static moduleName;id;child;_name;audioModules;inputs;outputs;_numberOfVoices;constructor(t){this.id=t.id||ta(),delete t.id,this.audioModules=[];const{child:e,props:n,...s}=t;this.child=e,Object.assign(this,s),this.numberOfVoices=1,this.inputs=new Yu(this),this.outputs=new Yu(this),Object.assign(this,{props:n})}get name(){return this._name}set name(t){this._name=t,this.audioModules.forEach((e=>e.name=t))}get props(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");return this.audioModules[0].props}set props(t){Object.assign(this,t),this.audioModules.forEach((e=>e.props=t))}get numberOfVoices(){return this._numberOfVoices}set numberOfVoices(t){this._numberOfVoices=t,this.adjustNumberOfModules()}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);zu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.unPlugAll(),this.audioModules.forEach((t=>t.dispose()))}onMidiEvent=t=>{const e=t.voiceNo||0,n=this.findVoice(e);n?.onMidiEvent(t)};serialize(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");const t=this.constructor;return{...this.audioModules[0].serialize(),id:this.id,type:t.moduleName,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}find(t){const e=this.audioModules.find(t);if(!e)throw Error("Audio module not found");return e}findVoice(t){return this.audioModules.find((e=>e.voiceNo===t))}registerInput(t){return this.inputs.add({...t,ioType:qu.ForwardInput})}registerOutput(t){return this.outputs.add({...t,ioType:qu.ForwardOutput})}registerMidiInput(t){return this.inputs.add({...t,ioType:qu.MidiInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:qu.MidiOutput})}registerBasicOutputs(){this.registerOutput({name:"output"})}registerBasicInputs(){this.registerInput({name:"input"}),this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}adjustNumberOfModules(){if(this.audioModules.length!==this.numberOfVoices){if(this.audioModules.length>this.numberOfVoices){const t=this.audioModules.pop();t?.dispose()}else{const t=this.audioModules.length,e=ju(this.id,t.toString()),n=0===t?{}:this.props,s=new this.child({id:e,name:this.name,props:{...n,voiceNo:t}});if(s instanceof tc)throw Error("Polymodule not supported");this.audioModules.push(s)}this.adjustNumberOfModules()}}}!function(t){t.Attack="attack",t.Decay="decay",t.Sustain="sustain",t.Release="release"}(Ku||(Ku={}));const ec=.01,nc={attack:ec,decay:ec,sustain:1,release:ec};class sc extends Ju{activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s,internalModule:i}=t;super(i,{id:e,name:n,props:{...nc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get attack(){return this._props.attack}set attack(t){this.setStage(Ku.Attack,t)}get decay(){return this._props.decay}set decay(t){this.setStage(Ku.Decay,t)}get sustain(){return this._props.sustain}set sustain(t){this.setStage(Ku.Sustain,t)}get release(){return this._props.release}set release(t){this.setStage(Ku.Release,t)}setStage(t,e){const n=0===e?this.minTime(t):this.maxTime(t)*e;this._props={...this.props,[t]:e},this.internalModule[t]=n}triggerAttack=(t,e)=>{this.activeNote=t.fullName,this.triggeredAt=e,this.internalModule.triggerAttack(e,t.velocity)};triggerRelease=(t,e)=>{this.activeNote&&this.activeNote!==t.fullName||(this.internalModule.triggerRelease(e),this.activeNote=void 0)};maxTime(t){return t===Ku.Sustain?1:2}minTime(t){return t===Ku.Sustain?0:ec}}class ic extends tc{constructor(t){const{id:e,name:n,child:s,props:i}=t;super({id:e,name:n,child:s,props:{...nc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class rc extends sc{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Jr,props:s})}}class oc extends ic{static moduleName="Envelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:rc,props:{...nc,...s}})}}class ac extends sc{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new so,props:s})}}class uc extends ic{static moduleName="AmpEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:ac,props:s})}}const cc={amount:0};class lc extends sc{_frequency;_amount;filter;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new ao,props:{...cc,...s}})}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this.internalModule.baseFrequency=t}get amount(){return this._amount}set amount(t){this._amount=t,this.internalModule.octaves=t}}class hc extends ic{static moduleName="FreqEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:lc,props:s})}}const pc={noteName:"C3",fine:0,coarse:0,wave:"sine",range:0,volume:0};class dc extends Ju{_note;constructor(t){const{id:e,name:n,props:s}=t;super(new Nr,{id:e,name:n,props:{...pc,...s}}),this.registerBasicOutputs(),this.registerDefaultMidiInput(),this.start(Io())}get note(){return this._note}setNoteAt(t,e){this._note=this.getNote(t),this.updateFrequency(e)}set note(t){this._note=this.getNote(t),this.updateFrequency()}get noteName(){return this._props.noteName}set noteName(t){this._props={...this.props,noteName:t},this.note=new Po(this.noteName)}get fine(){return this._props.fine}set fine(t){this._props={...this.props,fine:Math.floor(t)},this.internalModule.detune.value=this.fine}get coarse(){return this._props.coarse}set coarse(t){this._props={...this.props,coarse:Math.floor(t)},this.updateFrequency()}get wave(){return this._props.wave}set wave(t){this._props={...this.props,wave:t},this.internalModule.type=this.wave}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}get range(){return this._props.range}set range(t){this._props={...this.props,range:t},this.updateFrequency()}start(t){if(!zc.isStarted)return;"started"===this.internalModule.state?this.internalModule.restart(t):this.internalModule.start(t)}stop(t){this.internalModule.stop(t)}triggerAttack=(t,e)=>{this.setNoteAt(t,e),this.start(e)};triggerRelease=()=>{};updateFrequency(t){if(!this.note)return;const e=this.note.adjustFrequency(this.range,this.coarse);t?this.internalModule.frequency.linearRampToValueAtTime(e,t):this.internalModule.frequency.value=e}getNote(t){return t instanceof Po?t:new Po(t)}}class fc extends tc{static moduleName="Oscillator";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:dc,props:{...pc,...s}}),this.registerBasicOutputs(),this.registerInput({name:"midi in"})}start(t){this.audioModules.forEach((e=>e.start(t)))}stop(t){this.audioModules.forEach((e=>e.stop(t)))}}const _c={cutoff:2e4,resonance:0,envelopeAmount:0,slope:-24,filterType:"lowpass"};class mc extends Ju{constructor(t){const{id:e,name:n,props:s}=t;super(new oo({type:"lowpass"}),{id:e,name:n,props:{..._c,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get cutoff(){return this._props.cutoff}set cutoff(t){this._props={...this.props,cutoff:t},this.internalModule.frequency.value=t}get filterType(){return this._props.filterType}set filterType(t){this._props={...this.props,filterType:t},this.internalModule.type=t}get slope(){return this._props.slope}set slope(t){this._props={...this.props,slope:t},this.internalModule.rolloff=t}get frequency(){return this.internalModule.frequency}get resonance(){return this._props.resonance}set resonance(t){this._props={...this.props,resonance:t},this.internalModule.Q.value=t}get envelopeAmount(){return this._props.envelopeAmount}set envelopeAmount(t){this._props={...this.props,envelopeAmount:t}}}class gc extends tc{static moduleName="Filter";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:mc,props:{..._c,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class vc extends Ju{static moduleName="Master";constructor({id:t}){super(zi().destination,{id:t,name:"Master"}),this.registerBasicInputs()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll()}}class yc extends tc{static moduleName="VoiceScheduler";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:wc,props:s}),this.registerInputs(),this.registerOutputs(),this.polyNumber=this.numberOfVoices}set polyNumber(t){super.numberOfVoices=t}get polyNumber(){return this.numberOfVoices}onMidiEvent=t=>{let e;switch(t.type){case"noteOn":e=this.findFreeVoice();break;case"noteOff":e=this.audioModules.find((e=>e.activeNote===t.note.fullName));break;default:throw Error("This type is not a note")}e&&(e.midiTriggered(t),t.voiceNo=e.voiceNo,this.midiOutput.onMidiEvent(t))};serialize(){const t=super.serialize();return{...t,props:{...t.props,polyNumber:this.polyNumber}}}findFreeVoice(){let t=this.audioModules.find((t=>!t.activeNote));return t||(t=this.audioModules.sort(((t,e)=>t&&e?t.triggeredAt-e.triggeredAt:0))[0]),t}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}class wc extends Ju{midiEvent;activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s}=t;super(new Qu,{id:e,name:n,props:s})}midiTriggered=t=>{if(void 0===this.voiceNo)throw Error("Voice without voiceNo");const{triggeredAt:e,note:n,type:s}=t;if(!n)return;const i=n.fullName;switch(s){case"noteOn":this.activeNote=i,this.triggeredAt=e,this.midiEvent=t;break;case"noteOff":this.activeNote=null,this.midiEvent=null;break;default:throw Error("This type is not a note")}}}const bc={selectedId:null};class xc extends Ju{static moduleName="MidiSelector";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Qu,{id:e,name:n,props:{...bc,...s}}),this.registerOutputs(),this.addEventListener(this.selectedId)}get selectedId(){return this._props.selectedId}set selectedId(t){this.removeEventListener(),this._props={...this.props,selectedId:t},this.addEventListener(t)}dispose(){this.removeEventListener(),super.dispose()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}addEventListener(t){if(!this.onMidiEvent||!t)return;const e=zc.midiDeviceManager.find(t);e?.addEventListener(this.forwardMidiEvent)}forwardMidiEvent=t=>{this.midiOutput.onMidiEvent(t)};removeEventListener(){if(!this.selectedId)return;const t=zc.midiDeviceManager.find(this.selectedId);t?.removeEventListener(this.forwardMidiEvent)}}const Tc={volume:-1/0};class Ac extends Ju{constructor(t){const{id:e,name:n,props:s}=t;super(new wr,{id:e,name:n,props:{...Tc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}triggerAttack=(t,e)=>{const n=20*Math.log10(t.velocity);this.internalModule.volume.exponentialRampToValueAtTime(n,e)};triggerRelease=()=>{}}class kc extends tc{static moduleName="Volume";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:Ac,props:{...Tc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}}const Cc={activeNotes:[]};class Sc extends Ju{static moduleName="VirtualMidi";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new Qu,{id:e,name:n,props:{...Cc,...s}}),this.registerInputs(),this.registerOutputs()}get activeNotes(){return this._props.activeNotes}set activeNotes(t){this._props={...this.props,activeNotes:t}}sendMidi(t){this.midiOutput.onMidiEvent(t)}triggerAttack=(t,e)=>{this.activeNotes=[...this.activeNotes,t.fullName],zc._triggerPropsUpdate(this.id,this.props),this.sendMidi(qo.fromNote(t,!0,e))};triggerRelease=(t,e)=>{this.activeNotes=this.activeNotes.filter((e=>e!==t.fullName)),zc._triggerPropsUpdate(this.id,this.props),this.sendMidi(qo.fromNote(t,!1,e))};serialize(){return{...super.serialize(),activeNotes:this.activeNotes}}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}const Oc={wet:1};class Mc extends Ju{constructor(t){const{id:e,name:n,internalModule:s,props:i}=t;super(s,{id:e,name:n,props:{...Oc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}get wet(){return this._props.wet}set wet(t){this._props={...this.props,wet:t},this.internalModule.wet.value=this.wet}}const Ec={decay:1.5,preDelay:.025};class Dc extends Mc{static moduleName="Reverb";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new So,props:{...Ec,...s}})}get decay(){return this._props.decay}set decay(t){this._props={...this.props,decay:t},this.internalModule.decay=this.decay}get preDelay(){return this._props.preDelay}set preDelay(t){this._props={...this.props,preDelay:t},this.internalModule.preDelay=this.preDelay}}const Ic={delayTime:1,feedback:.3};class Rc extends Mc{static moduleName="Delay";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Co,props:{...Ic,...s}})}get delayTime(){return this._props.delayTime}set delayTime(t){this._props={...this.props,delayTime:t},this.internalModule.delayTime.value=this.delayTime}get feedback(){return this._props.feedback}set feedback(t){this._props={...this.props,feedback:t},this.internalModule.feedback.value=this.feedback}}const Nc={drive:.3};class Bc extends Mc{static moduleName="Distortion";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Ao,props:{...Nc,...s}})}get drive(){return this._props.drive}set drive(t){this._props={...this.props,drive:t},this.internalModule.distortion=this.drive}}const Pc={bits:16};class Vc extends Mc{static moduleName="BitCrusher";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new bo,props:{...Pc,...s}})}get bits(){return this._props.bits}set bits(t){this._props={...this.props,bits:t},this.internalModule.bits.value=this.bits}}class qc extends Ju{static moduleName="Sequencer";midiOutput;part;constructor(t){const{id:e,name:n,props:s}=t;super(new Qu,{id:e,name:n,props:{sequences:[],steps:16,bars:1,...s}}),this.initializePart(),this.start(Io()),this.registerOutputs()}get props(){return super.props}set props(t){this.sequences||(this._props.sequences=[]),super.props={...this.props,...t},this.adjust()}get steps(){return this._props.steps}set steps(t){this._props={...this.props,steps:t}}get bars(){return this.props.bars}set bars(t){this._props={...this.props,bars:t}}get sequences(){return this._props.sequences}set sequences(t){const e=t;this._props={...this.props,sequences:e}}start(t){zc.isStarted&&this.part.start(t)}stop(){this.part.stop()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}initializePart(){this.part=new mo(this.onPartEvent,[]),this.part.loop=!0,this.part.loopEnd=this.loopEnd}adjust(){this.part&&(this.adjustNumberOfBars(),this.adjustNumberOfSteps(),this.updateBarParts())}adjustNumberOfBars(){const t=this.sequences.length-this.bars,e=[...this.sequences];0!==t&&(t>0?e.pop():e.push([]),this.sequences=e,this.adjustNumberOfBars())}adjustNumberOfSteps(t=0){if(!this.bars)return;const e=[...this.sequences],n=[...e[t]],s=n.length-this.steps;if(0!==s){if(s>0)n.pop();else{const e=n.length;n.push({active:!1,time:`${t}:0:${e}`,notes:[]})}e[t]=n,this.sequences=e,this.adjustNumberOfSteps(t)}else{if(t===this.bars-1)return;this.adjustNumberOfSteps(t+1)}}updateBarParts(){this.part.clear(),this.sequences.forEach((t=>{t.forEach((t=>this.part.add(t.time,t)))})),this.part.loopEnd=this.loopEnd}get loopEnd(){return`${this.bars}:0:0`}onPartEvent=(t,e)=>{e.active&&qo.fromSequence(e,t).forEach((t=>{this.midiOutput.onMidiEvent(t)}))}}function Fc(t){const{id:e,type:n,name:s,props:i}=t,r=function(t){switch(t=Go.upperFirst(Go.camelCase(t))){case fc.moduleName:return fc;case oc.moduleName:return oc;case uc.moduleName:return uc;case hc.moduleName:return hc;case gc.moduleName:return gc;case kc.moduleName:return kc;case vc.moduleName:return vc;case yc.moduleName:return yc;case xc.moduleName:return xc;case Sc.moduleName:return Sc;case Dc.moduleName:return Dc;case Rc.moduleName:return Rc;case Bc.moduleName:return Bc;case Vc.moduleName:return Vc;case qc.moduleName:return qc;default:throw Error(`Unknown module type ${t}`)}}(n);return new r({id:e,name:s,props:i})}class jc{midiDeviceManager;static instance;context;propsUpdateCallbacks;_isStarted=!1;modules;routes;constructor(){this.modules={},this.routes={},this.propsUpdateCallbacks=[]}static getInstance(){return jc.instance||(jc.instance=new jc),jc.instance}initialize(t){return new Promise((e=>{if(this.context)return e({});this.context=new Ri(t.context),Wi(this.context),this.context.transport.start(),this.midiDeviceManager=new jo,setTimeout((()=>{e({})}),0)}))}addModule(t){const{id:e,name:n,type:s,props:i={}}=t,r=Fc({id:e,name:n,type:s,props:{}});return r.props=i,this.modules[r.id]=r,this.updateRoutes(),r.serialize()}removeModule(t){this.modules[t].dispose();const e=this.moduleRouteIds(t);return e.forEach((t=>delete this.routes[t])),this.updateRoutes(),delete this.modules[t],e}updateNameModule(t,e){const n=this.findById(t);return n.name=e,n.serialize()}onPropsUpdate(t){this.propsUpdateCallbacks.push(t)}_triggerPropsUpdate(t,e){this.propsUpdateCallbacks.forEach((n=>n(t,e)))}updatePropsModule(t,e){const n=this.findById(t),s=this.applyRoutesRequired(n,e);return n.props=e,s&&this.updateRoutes(),n.serialize()}addRoute(t){const e=function(t){const e=t.id||ta();return{...t,id:e}}(t),n={...this.routes,[e.id]:e};return this.routes=n,this.updateRoutes(),e}removeRoute(t){delete this.routes[t],this.updateRoutes()}triggerVirtualMidi(t,e,n){this.findById(t).sendMidi(qo.fromNote(e,"noteOn"===n))}dispose(){Object.values(this.modules).forEach((t=>{t.dispose()})),this.modules={},this.routes={}}findById(t){const e=this.modules[t];if(!e)throw Error(`Audio module with id ${t} not exists`);return e}get isStarted(){return void 0!==this.context&&"started"===this.context.transport.state&&this._isStarted}start(){const t=Io();this._isStarted=!0,this.updateRoutes(),Object.values(this.modules).forEach((e=>{const n=e;n.start&&n.start(t)}))}stop(){const t=Io();Object.values(this.modules).forEach((e=>{const n=e;n.stop&&n.stop(t)})),this._isStarted=!1}get bpm(){return this.context.transport.bpm.value}set bpm(t){this.context.transport.bpm.value=t}updateRoutes(){var t;t=Object.values(this.routes),Object.values(zc.modules).forEach((t=>{t.unPlugAll()})),t.map((t=>{const{sourceId:e,sourceIOId:n,destinationId:s,destinationIOId:i}=t,r=zc.findById(e),o=zc.findById(s),a=r.outputs.find(n),u=o.inputs.find(i);if(!u||!a)throw Error("IO not found");return zu(u,a),!0})).every((t=>t))?console.log("######## Routes succesfully applied"):console.log("######## Routes partialy applied")}applyRoutesRequired(t,e){return!!e.polyNumber&&(t instanceof yc&&e.polyNumber!==t.polyNumber)}moduleRouteIds(t){const e={...this.routes};return Object.keys(e).filter((n=>{const{sourceId:s,destinationId:i}=e[n];return s===t||i===t}))}}var zc=jc.getInstance();export{Fo as MidiDevice,jo as MidiDeviceManager,Po as Note,zc as default};
|
|
32
|
+
return function(e){var n=t,s=n.lib,i=s.WordArray,r=s.Hasher,o=n.algo,a=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),p=i.create([1352829926,1548603684,1836072691,2053994217,0]),d=o.RIPEMD160=r.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var s=e+n,i=t[s];t[s]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,o,d,w,b,x,T,A,k,C,S,O=this._hash.words,M=h.words,E=p.words,D=a.words,I=u.words,R=c.words,N=l.words;for(x=r=O[0],T=o=O[1],A=d=O[2],k=w=O[3],C=b=O[4],n=0;n<80;n+=1)S=r+t[e+D[n]]|0,S+=n<16?f(o,d,w)+M[0]:n<32?_(o,d,w)+M[1]:n<48?m(o,d,w)+M[2]:n<64?g(o,d,w)+M[3]:v(o,d,w)+M[4],S=(S=y(S|=0,R[n]))+b|0,r=b,b=w,w=y(d,10),d=o,o=S,S=x+t[e+I[n]]|0,S+=n<16?v(T,A,k)+E[0]:n<32?g(T,A,k)+E[1]:n<48?m(T,A,k)+E[2]:n<64?_(T,A,k)+E[3]:f(T,A,k)+E[4],S=(S=y(S|=0,N[n]))+C|0,x=C,C=k,k=y(A,10),A=T,T=S;S=O[1]+d+k|0,O[1]=O[2]+w+C|0,O[2]=O[3]+b+x|0,O[3]=O[4]+r+T|0,O[4]=O[0]+o+A|0,O[0]=S},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,s=8*t.sigBytes;e[s>>>5]|=128<<24-s%32,e[14+(s+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var a=r[o];r[o]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return i},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function f(t,e,n){return t^e^n}function _(t,e,n){return t&e|~t&n}function m(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function v(t,e,n){return t^(e|~n)}function y(t,e){return t<<e|t>>>32-e}n.RIPEMD160=r._createHelper(d),n.HmacRIPEMD160=r._createHmacHelper(d)}(),t.RIPEMD160}(aa())),$a(),Ga||(Ga=1,Xa.exports=function(t){return s=(n=(e=t).lib).Base,i=n.WordArray,o=(r=e.algo).SHA256,a=r.HMAC,u=r.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:o,iterations:25e4}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,s=a.create(n.hasher,t),r=i.create(),o=i.create([1]),u=r.words,c=o.words,l=n.keySize,h=n.iterations;u.length<l;){var p=s.update(e).finalize(o);s.reset();for(var d=p.words,f=d.length,_=p,m=1;m<h;m++){_=s.finalize(_),s.reset();for(var g=_.words,v=0;v<f;v++)d[v]^=g[v]}r.concat(p),c[0]++}return r.sigBytes=4*l,r}}),e.PBKDF2=function(t,e,n){return u.create(n).compute(t,e)},t.PBKDF2;var e,n,s,i,r,o,a,u}(aa(),Da(),$a())),Qa(),tu(),su(),ou(),cu(),pu(),du||(du=1,fu.exports=function(t){return t.mode.ECB=((e=t.lib.BlockCipherMode.extend()).Encryptor=e.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),e.Decryptor=e.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),e),t.mode.ECB;var e}(aa(),tu())),_u||(_u=1,mu.exports=function(t){return t.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,s=4*e,i=s-n%s,r=n+i-1;t.clamp(),t.words[r>>>2]|=i<<24-r%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Ansix923}(aa(),tu())),gu||(gu=1,vu.exports=function(t){return t.pad.Iso10126={pad:function(e,n){var s=4*n,i=s-e.sigBytes%s;e.concat(t.lib.WordArray.random(i-1)).concat(t.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},t.pad.Iso10126}(aa(),tu())),yu||(yu=1,wu.exports=function(t){return t.pad.Iso97971={pad:function(e,n){e.concat(t.lib.WordArray.create([2147483648],1)),t.pad.ZeroPadding.pad(e,n)},unpad:function(e){t.pad.ZeroPadding.unpad(e),e.sigBytes--}},t.pad.Iso97971}(aa(),tu())),bu||(bu=1,xu.exports=function(t){return t.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},t.pad.ZeroPadding}(aa(),tu())),Tu||(Tu=1,Au.exports=function(t){return t.pad.NoPadding={pad:function(){},unpad:function(){}},t.pad.NoPadding}(aa(),tu())),ku||(ku=1,Cu.exports=function(t){return n=(e=t).lib.CipherParams,s=e.enc.Hex,e.format.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return n.create({ciphertext:e})}},t.format.Hex;var e,n,s}(aa(),tu())),Su||(Su=1,Ou.exports=function(t){return function(){var e=t,n=e.lib.BlockCipher,s=e.algo,i=[],r=[],o=[],a=[],u=[],c=[],l=[],h=[],p=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,s=0;for(e=0;e<256;e++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,i[n]=f,r[f]=n;var _=t[n],m=t[_],g=t[m],v=257*t[f]^16843008*f;o[n]=v<<24|v>>>8,a[n]=v<<16|v>>>16,u[n]=v<<8|v>>>24,c[n]=v,v=16843009*g^65537*m^257*_^16843008*n,l[f]=v<<24|v>>>8,h[f]=v<<16|v>>>16,p[f]=v<<8|v>>>24,d[f]=v,n?(n=_^t[t[t[g^_]]],s^=t[t[s]]):n=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=s.AES=n.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,s=4*((this._nRounds=n+6)+1),r=this._keySchedule=[],o=0;o<s;o++)o<n?r[o]=e[o]:(c=r[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=f[o/n|0]<<24),r[o]=r[o-n]^c);for(var a=this._invKeySchedule=[],u=0;u<s;u++){if(o=s-u,u%4)var c=r[o];else c=r[o-4];a[u]=u<4||o<=4?c:l[i[c>>>24]]^h[i[c>>>16&255]]^p[i[c>>>8&255]]^d[i[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,o,a,u,c,i)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,l,h,p,d,r),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,s,i,r,o,a){for(var u=this._nRounds,c=t[e]^n[0],l=t[e+1]^n[1],h=t[e+2]^n[2],p=t[e+3]^n[3],d=4,f=1;f<u;f++){var _=s[c>>>24]^i[l>>>16&255]^r[h>>>8&255]^o[255&p]^n[d++],m=s[l>>>24]^i[h>>>16&255]^r[p>>>8&255]^o[255&c]^n[d++],g=s[h>>>24]^i[p>>>16&255]^r[c>>>8&255]^o[255&l]^n[d++],v=s[p>>>24]^i[c>>>16&255]^r[l>>>8&255]^o[255&h]^n[d++];c=_,l=m,h=g,p=v}_=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&p])^n[d++],m=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[p>>>8&255]<<8|a[255&c])^n[d++],g=(a[h>>>24]<<24|a[p>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],v=(a[p>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],t[e]=_,t[e+1]=m,t[e+2]=g,t[e+3]=v},keySize:8});e.AES=n._createHelper(_)}(),t.AES}(aa(),ya(),ka(),Qa(),tu())),Du(),Iu||(Iu=1,Ru.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=s.RC4=n.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,s=this._S=[],i=0;i<256;i++)s[i]=i;i=0;for(var r=0;i<256;i++){var o=i%n,a=e[o>>>2]>>>24-o%4*8&255;r=(r+s[i]+a)%256;var u=s[i];s[i]=s[r],s[r]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var t=this._S,e=this._i,n=this._j,s=0,i=0;i<4;i++){n=(n+t[e=(e+1)%256])%256;var r=t[e];t[e]=t[n],t[n]=r,s|=t[(t[e]+t[n])%256]<<24-8*i}return this._i=e,this._j=n,s}e.RC4=n._createHelper(i);var o=s.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)r.call(this)}});e.RC4Drop=n._createHelper(o)}(),t.RC4}(aa(),ya(),ka(),Qa(),tu())),Nu||(Nu=1,Bu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.Rabbit=n.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var s=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)i[n]^=s[n+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(i[0]^=c,i[1]^=h,i[2]^=l,i[3]^=p,i[4]^=c,i[5]^=h,i[6]^=l,i[7]^=p,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=n._createHelper(a)}(),t.Rabbit}(aa(),ya(),ka(),Qa(),tu())),Pu||(Pu=1,Vu.exports=function(t){return function(){var e=t,n=e.lib.StreamCipher,s=e.algo,i=[],r=[],o=[],a=s.RabbitLegacy=n.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],s=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)u.call(this);for(i=0;i<8;i++)s[i]^=n[i+4&7];if(e){var r=e.words,o=r[0],a=r[1],c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),h=c>>>16|4294901760&l,p=l<<16|65535&c;for(s[0]^=c,s[1]^=h,s[2]^=l,s[3]^=p,s[4]^=c,s[5]^=h,s[6]^=l,s[7]^=p,i=0;i<4;i++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),i[0]=n[0]^n[5]>>>16^n[3]<<16,i[1]=n[2]^n[7]>>>16^n[5]<<16,i[2]=n[4]^n[1]>>>16^n[7]<<16,i[3]=n[6]^n[3]>>>16^n[1]<<16;for(var s=0;s<4;s++)i[s]=16711935&(i[s]<<8|i[s]>>>24)|4278255360&(i[s]<<24|i[s]>>>8),t[e+s]^=i[s]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)r[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<r[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<r[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<r[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<r[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<r[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<r[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<r[6]>>>0?1:0)|0,this._b=e[7]>>>0<r[7]>>>0?1:0,n=0;n<8;n++){var s=t[n]+e[n],i=65535&s,a=s>>>16,u=((i*i>>>17)+i*a>>>15)+a*a,c=((4294901760&s)*s|0)+((65535&s)*s|0);o[n]=u^c}t[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,t[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,t[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,t[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,t[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,t[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,t[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,t[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=n._createHelper(a)}(),t.RabbitLegacy}(aa(),ya(),ka(),Qa(),tu())),ju());var zu,Wu=Ho(ia.exports);function Lu(t,e){const n=`${t}:${e}`,s=Wu.SHA256(n).toString(Wu.enc.Hex);return`${s.substring(0,8)}-${s.substring(8,12)}-4${s.substring(13,16)}-${"89AB"[parseInt(s.substring(17,18),16)%4]}${s.substring(18,21)}-${s.substring(21,33)}`}function Uu(t,e){if(t instanceof Zu&&e instanceof Yu)t.plug(e);else if(t instanceof Qu&&e instanceof Ku)t.plug(e);else if(t instanceof Gu&&e instanceof Xu)t.plug(e);else if(t instanceof Gu&&e instanceof Ku)t.plug(e);else if(t instanceof Gu&&e instanceof Yu)t.plug(e);else if(t instanceof Zu&&e instanceof Xu)t.plug(e);else{if(!(t instanceof Qu&&e instanceof Xu))throw Error("Input and output type is not compatible");t.plug(e)}}function Hu(t,e){if(t instanceof Zu&&e instanceof Yu)t.unPlug(e);else if(t instanceof Qu&&e instanceof Ku)t.unPlug(e);else if(t instanceof Gu&&e instanceof Xu)t.unPlug(e);else if(t instanceof Gu&&e instanceof Ku)t.unPlug(e);else if(t instanceof Gu&&e instanceof Yu)t.unPlug(e);else if(t instanceof Zu&&e instanceof Xu)t.unPlug(e);else{if(!(t instanceof Qu&&e instanceof Xu))throw Error("Input and output type is not compatible");t.unPlug(e)}}!function(t){t.AudioInput="audioInput",t.AudioOutput="audioOutput",t.MidiInput="midiInput",t.MidiOutput="midiOutput",t.ForwardInput="forwardInput",t.ForwardOutput="forwardOutput"}(zu||(zu={}));class $u{id;ioType;name;plugableModule;connections=[];static unPlugAll(t){t.connections.forEach((e=>t.unPlug(e)))}constructor(t,e){this.plugableModule=t,this.id=Lu(t.id,e.name),Object.assign(this,e)}plug(t,e=!0){this.connections.push(t),e&&t.plug(this,!1)}unPlug(t,e=!0){this.connections=this.connections.filter((e=>e.id!==t.id)),e&&t.unPlug(this,!1)}serialize(){return{id:this.id,name:this.name,moduleId:this.plugableModule.id,moduleName:this.plugableModule.name,ioType:this.ioType}}}class Gu extends $u{constructor(t,e){super(t,e),this.checkNameValidity()}get subInputs(){return this.plugableModule.audioModules.map((t=>{const e=t.inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subInput(t){const e=this.subModule(t).inputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Xu||(t instanceof Xu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);Uu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>Uu(e,t))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Xu||(t instanceof Xu?this.subModules.forEach((e=>{const n=e.inputs.findByName(this.name);if(!n)throw Error(`Could not forward input ${this.name}`);Hu(n,t.subOutput(e.voiceNo))})):this.subInputs.forEach((e=>Hu(e,t))))}unPlugAll(){$u.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].inputs.findByName(this.name))throw Error("You should forward to existing input")}}class Xu extends $u{constructor(t,e){super(t,e),this.checkNameValidity()}get subOutputs(){return this.subModules.map((t=>{const e=t.outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}))}get subModules(){return this.plugableModule.audioModules}subModule(t){const e=this.subModules.find((e=>e.voiceNo===t));if(!e)throw Error(`Submodule with voiceNo ${t} not found`);return e}subOutput(t){const e=this.subModule(t).outputs.findByName(this.name);if(!e)throw Error(`Could not forward input ${this.name}`);return e}plug(t,e=!0){super.plug(t,e),!e&&t instanceof Gu||(t instanceof Gu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);Uu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>Uu(t,e))))}unPlug(t,e=!0){super.unPlug(t,e),!e&&t instanceof Gu||(t instanceof Gu?this.subModules.forEach((e=>{const n=e.outputs.findByName(this.name);if(!n)throw Error(`Could not forward output ${this.name}`);Hu(t.subInput(e.voiceNo),n)})):this.subOutputs.forEach((e=>Hu(t,e))))}unPlugAll(){$u.unPlugAll(this)}checkNameValidity(){if(!this.plugableModule.audioModules[0].outputs.findByName(this.name))throw Error("You should forward to existing output")}}class Zu extends $u{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){$u.unPlugAll(this)}}class Yu extends $u{internalModule;constructor(t,e){super(t,e),this.internalModule=e.internalModule}plug(t,e=!0){super.plug(t,e),t instanceof Gu||this.internalModule.connect(t.internalModule)}unPlug(t,e=!0){super.unPlug(t,e),t instanceof Gu||this.internalModule.disconnect(t.internalModule)}unPlugAll(){$u.unPlugAll(this)}}class Qu extends $u{onMidiEvent;constructor(t,e){super(t,e),this.onMidiEvent=e.onMidiEvent}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){$u.unPlugAll(this)}}class Ku extends $u{constructor(t,e){super(t,e)}plug(t,e=!0){super.plug(t,e)}unPlug(t,e=!0){super.unPlug(t,e)}unPlugAll(){$u.unPlugAll(this)}onMidiEvent=t=>{this.midiConnections.forEach((e=>{e.onMidiEvent(t)}))};get midiConnections(){return this.connections.filter((t=>t instanceof Qu))}}class Ju{plugableModule;collection=[];constructor(t){this.plugableModule=t}add(t){let e;switch(t.ioType){case zu.AudioInput:if(this.plugableModule instanceof sc)throw Error("PolyModule is not supported");e=new Zu(this.plugableModule,t);break;case zu.AudioOutput:if(this.plugableModule instanceof sc)throw Error("PolyModule is not supported");e=new Yu(this.plugableModule,t);break;case zu.ForwardInput:if(this.plugableModule instanceof nc)throw Error("MonoModule is not supported");e=new Gu(this.plugableModule,t);break;case zu.ForwardOutput:if(this.plugableModule instanceof nc)throw Error("MonoModule is not supported");e=new Xu(this.plugableModule,t);break;case zu.MidiInput:e=new Qu(this.plugableModule,t);break;case zu.MidiOutput:e=new Ku(this.plugableModule,t);break;default:throw Error("Unknown IOType")}return this.collection.push(e),e}unPlugAll(){this.collection.forEach((t=>t.unPlugAll()))}find(t){return this.collection.find((e=>e.id===t))}findByName(t){return this.collection.find((e=>e.name===t))}serialize(){return this.collection.map((t=>t.serialize()))}}class tc{connect(){throw Error("This module is not connectable")}disconnect(){throw Error("This module is not connectable")}dispose(){}}var ec,nc=class{static moduleName;id;name;internalModule;inputs;outputs;voiceNo;updatedAt;_props={};constructor(t,e){this.internalModule=t,this.id=e.id||sa(),delete e.id,this.inputs=new Ju(this),this.outputs=new Ju(this),Object.assign(this,e)}set props(t){t&&(this.updatedAt=new Date,Object.assign(this,t))}get props(){return this._props}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);Uu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll(),this.internalModule.dispose()}triggerAttack=(t,e)=>{throw Error("triggerAttack not implemented")};triggerRelease=(t,e)=>{throw Error("triggerRelease not implemented")};onMidiEvent=t=>{if(void 0!==t.voiceNo&&t.voiceNo!==this.voiceNo)return;const{note:e,triggeredAt:n}=t;switch(t.type){case"noteOn":{const{duration:t}=e;if(this.triggerer(this.triggerAttack,e,n),t){const r=n+(s=t,new Xi(zi(),s,i)).toSeconds();this.triggerer(this.triggerRelease,e,r)}break}case"noteOff":this.triggerer(this.triggerRelease,e,n);break;default:throw Error("This type is not a note")}var s,i};triggerer(t,e,n){t(e,n)}serialize(){const t=this.constructor;return{id:this.id,name:this.name,type:t.moduleName,props:this.props,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}registerMidiInput(t){return this.inputs.add({...t,ioType:zu.MidiInput})}registerAudioInput(t){return this.inputs.add({...t,ioType:zu.AudioInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:zu.MidiOutput})}registerAudioOutput(t){return this.outputs.add({...t,ioType:zu.AudioOutput})}registerBasicOutputs(){this.registerAudioOutput({name:"output",internalModule:this.internalModule})}registerBasicInputs(){this.registerAudioInput({name:"input",internalModule:this.internalModule}),this.registerDefaultMidiInput()}registerDefaultMidiInput(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}};class sc{static moduleName;id;child;_name;audioModules;inputs;outputs;_numberOfVoices;constructor(t){this.id=t.id||sa(),delete t.id,this.audioModules=[];const{child:e,props:n,...s}=t;this.child=e,Object.assign(this,s),this.numberOfVoices=1,this.inputs=new Ju(this),this.outputs=new Ju(this),Object.assign(this,{props:n})}get name(){return this._name}set name(t){this._name=t,this.audioModules.forEach((e=>e.name=t))}get props(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");return this.audioModules[0].props}set props(t){Object.assign(this,t),this.audioModules.forEach((e=>e.props=t))}get numberOfVoices(){return this._numberOfVoices}set numberOfVoices(t){this._numberOfVoices=t,this.adjustNumberOfModules()}plug(t,e,n){const s=this.outputs.findByName(e);if(!s)throw Error(`Output ${e} not exist`);const i=t.inputs.findByName(n);if(!i)throw Error(`Input ${n} not exist`);Uu(i,s)}unPlugAll(){this.outputs.unPlugAll()}dispose(){this.unPlugAll(),this.audioModules.forEach((t=>t.dispose()))}onMidiEvent=t=>{const e=t.voiceNo||0,n=this.findVoice(e);n?.onMidiEvent(t)};serialize(){if(0===this.audioModules.length)throw Error("There isn't any initialized module");const t=this.constructor;return{...this.audioModules[0].serialize(),id:this.id,type:t.moduleName,inputs:this.inputs.serialize(),outputs:this.outputs.serialize()}}find(t){const e=this.audioModules.find(t);if(!e)throw Error("Audio module not found");return e}findVoice(t){return this.audioModules.find((e=>e.voiceNo===t))}registerInput(t){return this.inputs.add({...t,ioType:zu.ForwardInput})}registerOutput(t){return this.outputs.add({...t,ioType:zu.ForwardOutput})}registerMidiInput(t){return this.inputs.add({...t,ioType:zu.MidiInput})}registerMidiOutput(t){return this.outputs.add({...t,ioType:zu.MidiOutput})}registerBasicOutputs(){this.registerOutput({name:"output"})}registerBasicInputs(){this.registerInput({name:"input"}),this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}adjustNumberOfModules(){if(this.audioModules.length!==this.numberOfVoices){if(this.audioModules.length>this.numberOfVoices){const t=this.audioModules.pop();t?.dispose()}else{const t=this.audioModules.length,e=Lu(this.id,t.toString()),n=0===t?{}:this.props,s=new this.child({id:e,name:this.name,props:{...n,voiceNo:t}});if(s instanceof sc)throw Error("Polymodule not supported");this.audioModules.push(s)}this.adjustNumberOfModules()}}}!function(t){t.Attack="attack",t.Decay="decay",t.Sustain="sustain",t.Release="release"}(ec||(ec={}));const ic=.01,rc={attack:ic,decay:ic,sustain:1,release:ic};class oc extends nc{activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s,internalModule:i}=t;super(i,{id:e,name:n,props:{...rc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get attack(){return this._props.attack}set attack(t){this.setStage(ec.Attack,t)}get decay(){return this._props.decay}set decay(t){this.setStage(ec.Decay,t)}get sustain(){return this._props.sustain}set sustain(t){this.setStage(ec.Sustain,t)}get release(){return this._props.release}set release(t){this.setStage(ec.Release,t)}setStage(t,e){const n=0===e?this.minTime(t):this.maxTime(t)*e;this._props={...this.props,[t]:e},this.internalModule[t]=n}triggerAttack=(t,e)=>{this.activeNote=t.fullName,this.triggeredAt=e,this.internalModule.triggerAttack(e,t.velocity)};triggerRelease=(t,e)=>{this.activeNote&&this.activeNote!==t.fullName||(this.internalModule.triggerRelease(e),this.activeNote=void 0)};maxTime(t){return t===ec.Sustain?1:2}minTime(t){return t===ec.Sustain?0:ic}}class ac extends sc{constructor(t){const{id:e,name:n,child:s,props:i}=t;super({id:e,name:n,child:s,props:{...rc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}}class uc extends oc{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Jr,props:s})}}class cc extends ac{static moduleName="Envelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:uc,props:{...rc,...s}})}}class lc extends oc{constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new so,props:s})}}class hc extends ac{static moduleName="AmpEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:lc,props:s})}}const pc={amount:0};class dc extends oc{_frequency;_amount;filter;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new ao,props:{...pc,...s}})}get frequency(){return this._frequency}set frequency(t){this._frequency=t,this.internalModule.baseFrequency=t}get amount(){return this._amount}set amount(t){this._amount=t,this.internalModule.octaves=t}}class fc extends ac{static moduleName="FreqEnvelope";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:dc,props:s})}}const _c={noteName:"C3",fine:0,coarse:0,wave:"sine",range:0,volume:0};class mc extends nc{_note;constructor(t){const{id:e,name:n,props:s}=t;super(new Nr,{id:e,name:n,props:{..._c,...s}}),this.registerBasicOutputs(),this.registerDefaultMidiInput(),this.start(Io())}get note(){return this._note}setNoteAt(t,e){this._note=this.getNote(t),this.updateFrequency(e)}set note(t){this._note=this.getNote(t),this.updateFrequency()}get noteName(){return this._props.noteName}set noteName(t){this._props={...this.props,noteName:t},this.note=new Po(this.noteName)}get fine(){return this._props.fine}set fine(t){this._props={...this.props,fine:Math.floor(t)},this.internalModule.detune.value=this.fine}get coarse(){return this._props.coarse}set coarse(t){this._props={...this.props,coarse:Math.floor(t)},this.updateFrequency()}get wave(){return this._props.wave}set wave(t){this._props={...this.props,wave:t},this.internalModule.type=this.wave}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}get range(){return this._props.range}set range(t){this._props={...this.props,range:t},this.updateFrequency()}start(t){if(!Uc.isStarted)return;"started"===this.internalModule.state?this.internalModule.restart(t):this.internalModule.start(t)}stop(t){this.internalModule.stop(t)}triggerAttack=(t,e)=>{this.setNoteAt(t,e),this.start(e)};triggerRelease=()=>{};updateFrequency(t){if(!this.note)return;const e=this.note.adjustFrequency(this.range,this.coarse);t?this.internalModule.frequency.linearRampToValueAtTime(e,t):this.internalModule.frequency.value=e}getNote(t){return t instanceof Po?t:new Po(t)}}class gc extends sc{static moduleName="Oscillator";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:mc,props:{..._c,...s}}),this.registerBasicOutputs(),this.registerInput({name:"midi in"})}start(t){this.audioModules.forEach((e=>e.start(t)))}stop(t){this.audioModules.forEach((e=>e.stop(t)))}}const vc={cutoff:2e4,resonance:0,envelopeAmount:0,slope:-24,filterType:"lowpass"};class yc extends nc{_cutoff;_amount;constructor(t){const{id:e,name:n,props:s}=t;super(new oo({type:"lowpass"}),{id:e,name:n,props:{...vc,...s}}),this._cutoff=new $r(this.cutoff),this._cutoff.connect(this.internalModule.frequency),this._amount=new qr,this._amount.connect(this._cutoff),this.updateAmountFactor(),this.registerBasicInputs(),this.registerOutputs()}get cutoff(){return this._props.cutoff}set cutoff(t){this._cutoff&&(this._cutoff.addend.value=t),this._props={...this.props,cutoff:t},this.updateAmountFactor()}get filterType(){return this._props.filterType}set filterType(t){this._props={...this.props,filterType:t},this.internalModule.type=t}get slope(){return this._props.slope}set slope(t){this._props={...this.props,slope:t},this.internalModule.rolloff=t}get frequency(){return this.internalModule.frequency}get resonance(){return this._props.resonance}set resonance(t){this._props={...this.props,resonance:t},this.internalModule.Q.value=t}get envelopeAmount(){return this._props.envelopeAmount}set envelopeAmount(t){this._props={...this.props,envelopeAmount:t},this.updateAmountFactor()}registerOutputs(){this.registerBasicOutputs(),this.registerAudioInput({name:"cutoff",internalModule:this._amount})}updateAmountFactor(){if(!this._amount)return;const t=this.envelopeAmount>0?this.envelopeAmount*Math.abs(2e4-this.cutoff):this.envelopeAmount*Math.abs(1-this.cutoff);this._amount.factor.value=t}}class wc extends sc{static moduleName="Filter";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:yc,props:{...vc,...s}}),this.registerBasicInputs(),this.registerOutputs()}registerOutputs(){this.registerBasicOutputs(),this.registerInput({name:"cutoff"})}}class bc extends nc{static moduleName="Master";constructor({id:t}){super(zi().destination,{id:t,name:"Master"}),this.registerAudioInput({name:"input",internalModule:this.internalModule})}dispose(){this.inputs.unPlugAll(),this.outputs.unPlugAll()}}class xc extends sc{static moduleName="VoiceScheduler";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:Tc,props:s}),this.registerInputs(),this.registerOutputs(),this.polyNumber=this.numberOfVoices}set polyNumber(t){super.numberOfVoices=t}get polyNumber(){return this.numberOfVoices}onMidiEvent=t=>{let e;switch(t.type){case"noteOn":e=this.findFreeVoice();break;case"noteOff":e=this.audioModules.find((e=>e.activeNote===t.note.fullName));break;default:throw Error("This type is not a note")}e&&(e.midiTriggered(t),t.voiceNo=e.voiceNo,this.midiOutput.onMidiEvent(t))};serialize(){const t=super.serialize();return{...t,props:{...t.props,polyNumber:this.polyNumber}}}findFreeVoice(){let t=this.audioModules.find((t=>!t.activeNote));return t||(t=this.audioModules.sort(((t,e)=>t&&e?t.triggeredAt-e.triggeredAt:0))[0]),t}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}class Tc extends nc{midiEvent;activeNote;triggeredAt;constructor(t){const{id:e,name:n,props:s}=t;super(new tc,{id:e,name:n,props:s})}midiTriggered=t=>{if(void 0===this.voiceNo)throw Error("Voice without voiceNo");const{triggeredAt:e,note:n,type:s}=t;if(!n)return;const i=n.fullName;switch(s){case"noteOn":this.activeNote=i,this.triggeredAt=e,this.midiEvent=t;break;case"noteOff":this.activeNote=null,this.midiEvent=null;break;default:throw Error("This type is not a note")}}}const Ac={selectedId:null};class kc extends nc{static moduleName="MidiSelector";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new tc,{id:e,name:n,props:{...Ac,...s}}),this.registerOutputs(),this.addEventListener(this.selectedId)}get selectedId(){return this._props.selectedId}set selectedId(t){this.removeEventListener(),this._props={...this.props,selectedId:t},this.addEventListener(t)}dispose(){this.removeEventListener(),super.dispose()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}addEventListener(t){if(!this.onMidiEvent||!t)return;const e=Uc.midiDeviceManager.find(t);e?.addEventListener(this.forwardMidiEvent)}forwardMidiEvent=t=>{this.midiOutput.onMidiEvent(t)};removeEventListener(){if(!this.selectedId)return;const t=Uc.midiDeviceManager.find(this.selectedId);t?.removeEventListener(this.forwardMidiEvent)}}const Cc={volume:-1/0};class Sc extends nc{constructor(t){const{id:e,name:n,props:s}=t;super(new wr,{id:e,name:n,props:{...Cc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}get volume(){return this._props.volume}set volume(t){this._props={...this.props,volume:t},this.internalModule.volume.value=this.volume}triggerAttack=(t,e)=>{const n=20*Math.log10(t.velocity);this.internalModule.volume.exponentialRampToValueAtTime(n,e)};triggerRelease=()=>{}}class Oc extends sc{static moduleName="Volume";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,child:Sc,props:{...Cc,...s}}),this.registerBasicInputs(),this.registerBasicOutputs()}}const Mc={activeNotes:[]};class Ec extends nc{static moduleName="VirtualMidi";midiOutput;constructor(t){const{id:e,name:n,props:s}=t;super(new tc,{id:e,name:n,props:{...Mc,...s}}),this.registerInputs(),this.registerOutputs()}get activeNotes(){return this._props.activeNotes}set activeNotes(t){this._props={...this.props,activeNotes:t}}sendMidi(t){this.midiOutput.onMidiEvent(t)}triggerAttack=(t,e)=>{this.activeNotes=[...this.activeNotes,t.fullName],Uc._triggerPropsUpdate(this.id,this.props),this.sendMidi(qo.fromNote(t,!0,e))};triggerRelease=(t,e)=>{this.activeNotes=this.activeNotes.filter((e=>e!==t.fullName)),Uc._triggerPropsUpdate(this.id,this.props),this.sendMidi(qo.fromNote(t,!1,e))};serialize(){return{...super.serialize(),activeNotes:this.activeNotes}}registerInputs(){this.registerMidiInput({name:"midi in",onMidiEvent:this.onMidiEvent})}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}}const Dc={wet:1};class Ic extends nc{constructor(t){const{id:e,name:n,internalModule:s,props:i}=t;super(s,{id:e,name:n,props:{...Dc,...i}}),this.registerBasicInputs(),this.registerBasicOutputs()}get wet(){return this._props.wet}set wet(t){this._props={...this.props,wet:t},this.internalModule.wet.value=this.wet}}const Rc={decay:1.5,preDelay:.025};class Nc extends Ic{static moduleName="Reverb";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new So,props:{...Rc,...s}})}get decay(){return this._props.decay}set decay(t){this._props={...this.props,decay:t},this.internalModule.decay=this.decay}get preDelay(){return this._props.preDelay}set preDelay(t){this._props={...this.props,preDelay:t},this.internalModule.preDelay=this.preDelay}}const Bc={delayTime:1,feedback:.3};class Pc extends Ic{static moduleName="Delay";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Co,props:{...Bc,...s}})}get delayTime(){return this._props.delayTime}set delayTime(t){this._props={...this.props,delayTime:t},this.internalModule.delayTime.value=this.delayTime}get feedback(){return this._props.feedback}set feedback(t){this._props={...this.props,feedback:t},this.internalModule.feedback.value=this.feedback}}const Vc={drive:.3};class qc extends Ic{static moduleName="Distortion";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new Ao,props:{...Vc,...s}})}get drive(){return this._props.drive}set drive(t){this._props={...this.props,drive:t},this.internalModule.distortion=this.drive}}const Fc={bits:16};class jc extends Ic{static moduleName="BitCrusher";constructor(t){const{id:e,name:n,props:s}=t;super({id:e,name:n,internalModule:new bo,props:{...Fc,...s}})}get bits(){return this._props.bits}set bits(t){this._props={...this.props,bits:t},this.internalModule.bits.value=this.bits}}class zc extends nc{static moduleName="Sequencer";midiOutput;part;constructor(t){const{id:e,name:n,props:s}=t;super(new tc,{id:e,name:n,props:{sequences:[],steps:16,bars:1,...s}}),this.initializePart(),this.start(Io()),this.registerOutputs()}get props(){return super.props}set props(t){this.sequences||(this._props.sequences=[]),super.props={...this.props,...t},this.adjust()}get steps(){return this._props.steps}set steps(t){this._props={...this.props,steps:t}}get bars(){return this.props.bars}set bars(t){this._props={...this.props,bars:t}}get sequences(){return this._props.sequences}set sequences(t){const e=t;this._props={...this.props,sequences:e}}start(t){Uc.isStarted&&this.part.start(t)}stop(){this.part.stop()}registerOutputs(){this.midiOutput=this.registerMidiOutput({name:"midi out"})}initializePart(){this.part=new mo(this.onPartEvent,[]),this.part.loop=!0,this.part.loopEnd=this.loopEnd}adjust(){this.part&&(this.adjustNumberOfBars(),this.adjustNumberOfSteps(),this.updateBarParts())}adjustNumberOfBars(){const t=this.sequences.length-this.bars,e=[...this.sequences];0!==t&&(t>0?e.pop():e.push([]),this.sequences=e,this.adjustNumberOfBars())}adjustNumberOfSteps(t=0){if(!this.bars)return;const e=[...this.sequences],n=[...e[t]],s=n.length-this.steps;if(0!==s){if(s>0)n.pop();else{const e=n.length;n.push({active:!1,time:`${t}:0:${e}`,notes:[]})}e[t]=n,this.sequences=e,this.adjustNumberOfSteps(t)}else{if(t===this.bars-1)return;this.adjustNumberOfSteps(t+1)}}updateBarParts(){this.part.clear(),this.sequences.forEach((t=>{t.forEach((t=>this.part.add(t.time,t)))})),this.part.loopEnd=this.loopEnd}get loopEnd(){return`${this.bars}:0:0`}onPartEvent=(t,e)=>{e.active&&qo.fromSequence(e,t).forEach((t=>{this.midiOutput.onMidiEvent(t)}))}}function Wc(t){const{id:e,type:n,name:s,props:i}=t,r=function(t){switch(t=Yo.upperFirst(Yo.camelCase(t))){case gc.moduleName:return gc;case cc.moduleName:return cc;case hc.moduleName:return hc;case fc.moduleName:return fc;case wc.moduleName:return wc;case Oc.moduleName:return Oc;case bc.moduleName:return bc;case xc.moduleName:return xc;case kc.moduleName:return kc;case Ec.moduleName:return Ec;case Nc.moduleName:return Nc;case Pc.moduleName:return Pc;case qc.moduleName:return qc;case jc.moduleName:return jc;case zc.moduleName:return zc;default:throw Error(`Unknown module type ${t}`)}}(n);return new r({id:e,name:s,props:i})}class Lc{midiDeviceManager;static instance;context;propsUpdateCallbacks;_isStarted=!1;modules;routes;constructor(){this.modules={},this.routes={},this.propsUpdateCallbacks=[]}static getInstance(){return Lc.instance||(Lc.instance=new Lc),Lc.instance}initialize(t){return new Promise((e=>{if(this.context)return e({});this.context=new Ri(t.context),Wi(this.context),this.context.transport.start(),this.midiDeviceManager=new Lo,setTimeout((()=>{e({})}),0)}))}addModule(t){const{id:e,name:n,type:s,props:i={}}=t,r=Wc({id:e,name:n,type:s,props:{}});return r.props=i,this.modules[r.id]=r,this.updateRoutes(),r.serialize()}removeModule(t){this.modules[t].dispose();const e=this.moduleRouteIds(t);return e.forEach((t=>delete this.routes[t])),this.updateRoutes(),delete this.modules[t],e}updateNameModule(t,e){const n=this.findById(t);return n.name=e,n.serialize()}onPropsUpdate(t){this.propsUpdateCallbacks.push(t)}_triggerPropsUpdate(t,e){this.propsUpdateCallbacks.forEach((n=>n(t,e)))}updatePropsModule(t,e){const n=this.findById(t),s=this.applyRoutesRequired(n,e);return n.props=e,s&&this.updateRoutes(),n.serialize()}addRoute(t){const e=function(t){const e=t.id||sa();return{...t,id:e}}(t),n={...this.routes,[e.id]:e};return this.routes=n,this.updateRoutes(),e}removeRoute(t){delete this.routes[t],this.updateRoutes()}triggerVirtualMidi(t,e,n){this.findById(t).sendMidi(qo.fromNote(e,"noteOn"===n))}dispose(){Object.values(this.modules).forEach((t=>{t.dispose()})),this.modules={},this.routes={}}findById(t){const e=this.modules[t];if(!e)throw Error(`Audio module with id ${t} not exists`);return e}get isStarted(){return void 0!==this.context&&"started"===this.context.transport.state&&this._isStarted}start(){const t=Io();this._isStarted=!0,this.updateRoutes(),Object.values(this.modules).forEach((e=>{const n=e;n.start&&n.start(t)}))}stop(){const t=Io();Object.values(this.modules).forEach((e=>{const n=e;n.stop&&n.stop(t)})),this._isStarted=!1}get bpm(){return this.context.transport.bpm.value}set bpm(t){this.context.transport.bpm.value=t}updateRoutes(){var t;t=Object.values(this.routes),Object.values(Uc.modules).forEach((t=>{t.unPlugAll()})),t.map((t=>{const{sourceId:e,sourceIOId:n,destinationId:s,destinationIOId:i}=t,r=Uc.findById(e),o=Uc.findById(s),a=r.outputs.find(n),u=o.inputs.find(i);if(!u||!a)throw Error("IO not found");return Uu(u,a),!0})).every((t=>t))?console.log("######## Routes succesfully applied"):console.log("######## Routes partialy applied")}applyRoutesRequired(t,e){return!!e.polyNumber&&(t instanceof xc&&e.polyNumber!==t.polyNumber)}moduleRouteIds(t){const e={...this.routes};return Object.keys(e).filter((n=>{const{sourceId:s,destinationId:i}=e[n];return s===t||i===t}))}}var Uc=Lc.getInstance();export{Fo as MidiDevice,Lo as MidiDeviceManager,Po as Note,Uc as default};
|
|
33
33
|
//# sourceMappingURL=main.esm.js.map
|