@gui-chat-plugin/music 1.2.0 → 1.3.1

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/vue.js CHANGED
@@ -1,51 +1,4413 @@
1
- import { n as e, r as t, t as n } from "./samples-C8a37dDP.js";
1
+ import { n as e, r as t, t as n } from "./samples-CxTlaIMB.js";
2
2
  import { createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, normalizeClass as c, onMounted as l, onUnmounted as u, openBlock as d, ref as f, toDisplayString as p, vModelText as m, watch as h, withDirectives as g } from "vue";
3
3
  import { OpenSheetMusicDisplay as _ } from "opensheetmusicdisplay";
4
- import v from "@isamu/osmd-audio-player";
5
- import { jsPDF as y } from "jspdf";
6
- import { svg2pdf as b } from "svg2pdf.js";
7
- //#region src/vue/View.vue?vue&type=script&setup=true&lang.ts
8
- var x = { class: "w-full h-full overflow-y-auto" }, S = { class: "min-h-full flex flex-col p-4" }, C = {
4
+ import { jsPDF as v } from "jspdf";
5
+ import { svg2pdf as y } from "svg2pdf.js";
6
+ //#region \0rolldown/runtime.js
7
+ var b = Object.create, x = Object.defineProperty, S = Object.getOwnPropertyDescriptor, C = Object.getOwnPropertyNames, w = Object.getPrototypeOf, T = Object.prototype.hasOwnProperty, E = (e, t, n) => () => {
8
+ if (n) throw n[0];
9
+ try {
10
+ return e && (t = e(e = 0)), t;
11
+ } catch (e) {
12
+ throw n = [e], e;
13
+ }
14
+ }, D = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), O = (e, t) => {
15
+ let n = {};
16
+ for (var r in e) x(n, r, {
17
+ get: e[r],
18
+ enumerable: !0
19
+ });
20
+ return t || x(n, Symbol.toStringTag, { value: "Module" }), n;
21
+ }, k = (e, t, n, r) => {
22
+ if (t && typeof t == "object" || typeof t == "function") for (var i = C(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !T.call(e, s) && s !== n && x(e, s, {
23
+ get: ((e) => t[e]).bind(null, s),
24
+ enumerable: !(r = S(t, s)) || r.enumerable
25
+ });
26
+ return e;
27
+ }, A = (e, t, n) => (n = e == null ? {} : b(w(e)), k(t || !e || !e.__esModule ? x(n, "default", {
28
+ value: e,
29
+ enumerable: !0
30
+ }) : n, e)), j = (e) => T.call(e, "module.exports") ? e["module.exports"] : k(x({}, "__esModule", { value: !0 }), e), M = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
31
+ if (typeof require < "u") return require.apply(this, arguments);
32
+ throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
33
+ }), ee = class {
34
+ constructor() {
35
+ this.steps = [];
36
+ }
37
+ [Symbol.iterator]() {
38
+ return this.steps.values();
39
+ }
40
+ createStep(e) {
41
+ let t = this.steps.find((t) => t.tick === e);
42
+ return t || (t = {
43
+ tick: e,
44
+ notes: []
45
+ }, this.steps.push(t)), t;
46
+ }
47
+ addNote(e, t) {
48
+ (this.steps.find((t) => t.tick === e) ?? this.createStep(e)).notes.push(t);
49
+ }
50
+ delete(e) {
51
+ let t = this.steps.findIndex((t) => t.tick === e.tick);
52
+ t != null && this.steps.splice(t, 1);
53
+ }
54
+ sort() {
55
+ return this.steps.sort((e, t) => e.tick - t.tick), this;
56
+ }
57
+ getFirstEmptyTick() {
58
+ return this.sort().steps.filter((e) => !e.notes.length)[0].tick;
59
+ }
60
+ }, te = class {
61
+ constructor(e, t, n) {
62
+ this.stepQueue = new ee(), this.stepQueueIndex = 0, this.scheduledTicks = /* @__PURE__ */ new Set(), this.currentTick = 0, this.currentTickTimestamp = 0, this.audioContextStartTime = 0, this.schedulerIntervalHandle = null, this.scheduleInterval = 200, this.schedulePeriod = 500, this.tickDenominator = 1024, this.lastTickOffset = 300, this.playing = !1, this.noteSchedulingCallback = n, this.wholeNoteLength = e, this.audioContext = t;
63
+ }
64
+ get schedulePeriodTicks() {
65
+ return this.schedulePeriod / this.tickDuration;
66
+ }
67
+ get audioContextTime() {
68
+ return this.audioContext ? (this.audioContext.currentTime - this.audioContextStartTime) * 1e3 : 0;
69
+ }
70
+ get tickDuration() {
71
+ return this.wholeNoteLength / this.tickDenominator;
72
+ }
73
+ get calculatedTick() {
74
+ return this.currentTick + Math.round((this.audioContextTime - this.currentTickTimestamp) / this.tickDuration);
75
+ }
76
+ start() {
77
+ this.playing = !0, this.stepQueue.sort(), this.audioContextStartTime = this.audioContext.currentTime, this.currentTickTimestamp = this.audioContextTime, this.schedulerIntervalHandle ||= window.setInterval(() => this.scheduleIterationStep(), this.scheduleInterval);
78
+ }
79
+ setIterationStep(e) {
80
+ e = Math.min(this.stepQueue.steps.length - 1, e), this.stepQueueIndex = e, this.currentTick = this.stepQueue.steps[this.stepQueueIndex].tick;
81
+ }
82
+ pause() {
83
+ this.playing = !1;
84
+ }
85
+ resume() {
86
+ this.playing = !0, this.currentTickTimestamp = this.audioContextTime;
87
+ }
88
+ reset() {
89
+ this.playing = !1, this.currentTick = 0, this.currentTickTimestamp = 0, this.stepQueueIndex = 0, clearInterval(this.scheduleInterval), this.schedulerIntervalHandle = null;
90
+ }
91
+ loadNotes(e) {
92
+ let t = this.lastTickOffset;
93
+ this.stepQueue.steps.length > 0 && (t = this.stepQueue.getFirstEmptyTick());
94
+ for (let n of e) if (!n.IsGrace) for (let e of n.Notes) this.stepQueue.addNote(t, e), this.stepQueue.createStep(t + e.Length.RealValue * this.tickDenominator);
95
+ }
96
+ scheduleIterationStep() {
97
+ if (!this.playing) return;
98
+ this.currentTick = this.calculatedTick, this.currentTickTimestamp = this.audioContextTime;
99
+ let e = this.stepQueue.steps[this.stepQueueIndex]?.tick;
100
+ for (; this.nextTickAvailableAndWithinSchedulePeriod(e);) {
101
+ let t = this.stepQueue.steps[this.stepQueueIndex], n = (t.tick - this.currentTick) * this.tickDuration;
102
+ n < 0 && (n = 0), this.scheduledTicks.add(t.tick), this.noteSchedulingCallback(n / 1e3, t.notes), this.stepQueueIndex++, e = this.stepQueue.steps[this.stepQueueIndex]?.tick;
103
+ }
104
+ for (let e of this.scheduledTicks) e <= this.currentTick && this.scheduledTicks.delete(e);
105
+ }
106
+ nextTickAvailableAndWithinSchedulePeriod(e) {
107
+ return e && this.currentTickTimestamp + (e - this.currentTick) * this.tickDuration <= this.currentTickTimestamp + this.schedulePeriod;
108
+ }
109
+ }, ne;
110
+ (function(e) {
111
+ e[e.None = 0] = "None", e[e.Staccato = 1] = "Staccato", e[e.Legato = 2] = "Legato";
112
+ })(ne ||= {});
113
+ //#endregion
114
+ //#region node_modules/@modernized/osmd-audio-player/dist/midi/midiInstruments.js
115
+ var re = [
116
+ [0, "Acoustic Grand Piano"],
117
+ [1, "Bright Acoustic Piano"],
118
+ [2, "Electric Grand Piano"],
119
+ [3, "Honky-tonk Piano"],
120
+ [4, "Electric Piano 1"],
121
+ [5, "Electric Piano 2"],
122
+ [6, "Harpsichord"],
123
+ [7, "Clavi"],
124
+ [8, "Celesta"],
125
+ [9, "Glockenspiel"],
126
+ [10, "Music Box"],
127
+ [11, "Vibraphone"],
128
+ [12, "Marimba"],
129
+ [13, "Xylophone"],
130
+ [14, "Tubular Bells"],
131
+ [15, "Dulcimer"],
132
+ [16, "Drawbar Organ"],
133
+ [17, "Percussive Organ"],
134
+ [18, "Rock Organ"],
135
+ [19, "Church Organ"],
136
+ [20, "Reed Organ"],
137
+ [21, "Accordion"],
138
+ [22, "Harmonica"],
139
+ [23, "Tango Accordion"],
140
+ [24, "Acoustic Guitar (nylon)"],
141
+ [25, "Acoustic Guitar (steel)"],
142
+ [26, "Electric Guitar (jazz)"],
143
+ [27, "Electric Guitar (clean)"],
144
+ [28, "Electric Guitar (muted)"],
145
+ [29, "Overdriven Guitar"],
146
+ [30, "Distortion Guitar"],
147
+ [31, "Guitar harmonics"],
148
+ [32, "Acoustic Bass"],
149
+ [33, "Electric Bass (finger)"],
150
+ [34, "Electric Bass (pick)"],
151
+ [35, "Fretless Bass"],
152
+ [36, "Slap Bass 1"],
153
+ [37, "Slap Bass 2"],
154
+ [38, "Synth Bass 1"],
155
+ [39, "Synth Bass 2"],
156
+ [40, "Violin"],
157
+ [41, "Viola"],
158
+ [42, "Cello"],
159
+ [43, "Contrabass"],
160
+ [44, "Tremolo Strings"],
161
+ [45, "Pizzicato Strings"],
162
+ [46, "Orchestral Harp"],
163
+ [47, "Timpani"],
164
+ [48, "String Ensemble 1"],
165
+ [49, "String Ensemble 2"],
166
+ [50, "SynthStrings 1"],
167
+ [51, "SynthStrings 2"],
168
+ [52, "Choir Aahs"],
169
+ [53, "Voice Oohs"],
170
+ [54, "Synth Choir"],
171
+ [55, "Orchestra Hit"],
172
+ [56, "Trumpet"],
173
+ [57, "Trombone"],
174
+ [58, "Tuba"],
175
+ [59, "Muted Trumpet"],
176
+ [60, "French Horn"],
177
+ [61, "Brass Section"],
178
+ [62, "SynthBrass 1"],
179
+ [63, "SynthBrass 2"],
180
+ [64, "Soprano Sax"],
181
+ [65, "Alto Sax"],
182
+ [66, "Tenor Sax"],
183
+ [67, "Baritone Sax"],
184
+ [68, "Oboe"],
185
+ [69, "English Horn"],
186
+ [70, "Bassoon"],
187
+ [71, "Clarinet"],
188
+ [72, "Piccolo"],
189
+ [73, "Flute"],
190
+ [74, "Recorder"],
191
+ [75, "Pan Flute"],
192
+ [76, "Blown Bottle"],
193
+ [77, "Shakuhachi"],
194
+ [78, "Whistle"],
195
+ [79, "Ocarina"],
196
+ [80, "Lead 1 (square)"],
197
+ [81, "Lead 2 (sawtooth)"],
198
+ [82, "Lead 3 (calliope)"],
199
+ [83, "Lead 4 (chiff)"],
200
+ [84, "Lead 5 (charang)"],
201
+ [85, "Lead 6 (voice)"],
202
+ [86, "Lead 7 (fifths)"],
203
+ [87, "Lead 8 (bass + lead)"],
204
+ [88, "Pad 1 (new age)"],
205
+ [89, "Pad 2 (warm)"],
206
+ [90, "Pad 3 (polysynth)"],
207
+ [91, "Pad 4 (choir)"],
208
+ [92, "Pad 5 (bowed)"],
209
+ [93, "Pad 6 (metallic)"],
210
+ [94, "Pad 7 (halo)"],
211
+ [95, "Pad 8 (sweep)"],
212
+ [96, "FX 1 (rain)"],
213
+ [97, "FX 2 (soundtrack)"],
214
+ [98, "FX 3 (crystal)"],
215
+ [99, "FX 4 (atmosphere)"],
216
+ [100, "FX 5 (brightness)"],
217
+ [101, "FX 6 (goblins)"],
218
+ [102, "FX 7 (echoes)"],
219
+ [103, "FX 8 (sci-fi)"],
220
+ [104, "Sitar"],
221
+ [105, "Banjo"],
222
+ [106, "Shamisen"],
223
+ [107, "Koto"],
224
+ [108, "Kalimba"],
225
+ [109, "Bag pipe"],
226
+ [110, "Fiddle"],
227
+ [111, "Shanai"],
228
+ [112, "Tinkle Bell"],
229
+ [113, "Agogo"],
230
+ [114, "Steel Drums"],
231
+ [115, "Woodblock"],
232
+ [116, "Taiko Drum"],
233
+ [117, "Melodic Tom"],
234
+ [118, "Synth Drum"],
235
+ [119, "Reverse Cymbal"],
236
+ [120, "Guitar Fret Noise"],
237
+ [121, "Breath Noise"],
238
+ [122, "Seashore"],
239
+ [123, "Bird Tweet"],
240
+ [124, "Telephone Ring"],
241
+ [125, "Helicopter"],
242
+ [126, "Applause"],
243
+ [127, "Gunshot"]
244
+ ], N = /* @__PURE__ */ "accordion.acoustic_bass.acoustic_grand_piano.acoustic_guitar_nylon.acoustic_guitar_steel.agogo.alto_sax.applause.bagpipe.banjo.baritone_sax.bassoon.bird_tweet.blown_bottle.brass_section.breath_noise.bright_acoustic_piano.celesta.cello.choir_aahs.church_organ.clarinet.clavinet.contrabass.distortion_guitar.drawbar_organ.dulcimer.electric_bass_finger.electric_bass_pick.electric_grand_piano.electric_guitar_clean.electric_guitar_jazz.electric_guitar_muted.electric_piano_1.electric_piano_2.english_horn.fiddle.flute.french_horn.fretless_bass.fx_1_rain.fx_2_soundtrack.fx_3_crystal.fx_4_atmosphere.fx_5_brightness.fx_6_goblins.fx_7_echoes.fx_8_scifi.glockenspiel.guitar_fret_noise.guitar_harmonics.gunshot.harmonica.harpsichord.helicopter.honkytonk_piano.kalimba.koto.lead_1_square.lead_2_sawtooth.lead_3_calliope.lead_4_chiff.lead_5_charang.lead_6_voice.lead_7_fifths.lead_8_bass__lead.marimba.melodic_tom.music_box.muted_trumpet.oboe.ocarina.orchestra_hit.orchestral_harp.overdriven_guitar.pad_1_new_age.pad_2_warm.pad_3_polysynth.pad_4_choir.pad_5_bowed.pad_6_metallic.pad_7_halo.pad_8_sweep.pan_flute.percussive_organ.piccolo.pizzicato_strings.recorder.reed_organ.reverse_cymbal.rock_organ.seashore.shakuhachi.shamisen.shanai.sitar.slap_bass_1.slap_bass_2.soprano_sax.steel_drums.string_ensemble_1.string_ensemble_2.synth_bass_1.synth_bass_2.synth_brass_1.synth_brass_2.synth_choir.synth_drum.synth_strings_1.synth_strings_2.taiko_drum.tango_accordion.telephone_ring.tenor_sax.timpani.tinkle_bell.tremolo_strings.trombone.trumpet.tuba.tubular_bells.vibraphone.viola.violin.voice_oohs.whistle.woodblock.xylophone".split("."), ie = /* @__PURE__ */ D(((e, t) => {
245
+ function n(e) {
246
+ return e > 64 && e < 91 ? e - 65 : e > 96 && e < 123 ? e - 71 : e > 47 && e < 58 ? e + 4 : e === 43 ? 62 : e === 47 ? 63 : 0;
247
+ }
248
+ function r(e, t) {
249
+ for (var r = e.replace(/[^A-Za-z0-9\+\/]/g, ""), i = r.length, a = t ? Math.ceil((i * 3 + 1 >> 2) / t) * t : i * 3 + 1 >> 2, o = new Uint8Array(a), s, c, l = 0, u = 0, d = 0; d < i; d++) if (c = d & 3, l |= n(r.charCodeAt(d)) << 18 - 6 * c, c === 3 || i - d === 1) {
250
+ for (s = 0; s < 3 && u < a; s++, u++) o[u] = l >>> (16 >>> s & 24) & 255;
251
+ l = 0;
252
+ }
253
+ return o;
254
+ }
255
+ t.exports = { decode: r };
256
+ })), ae = /* @__PURE__ */ D(((e, t) => {
257
+ t.exports = function(e, t) {
258
+ return new Promise(function(n, r) {
259
+ var i = new XMLHttpRequest();
260
+ t && (i.responseType = t), i.open("GET", e), i.onload = function() {
261
+ i.status === 200 ? n(i.response) : r(Error(i.statusText));
262
+ }, i.onerror = function() {
263
+ r(Error("Network Error"));
264
+ }, i.send();
265
+ });
266
+ };
267
+ })), oe = /* @__PURE__ */ D(((e, t) => {
268
+ var n = ie(), r = ae();
269
+ function i(e) {
270
+ return function(t) {
271
+ return typeof t == "string" && e.test(t);
272
+ };
273
+ }
274
+ function a(e, t) {
275
+ return typeof e == "string" ? e + t : typeof e == "function" ? e(t) : t;
276
+ }
277
+ function o(e, t, n, r) {
278
+ var i = s(t) ? c : l(t) ? u : d(t) ? f : p(t) ? m : h(t) ? g : _(t) ? v : y(t) ? b : x(t) ? S : null;
279
+ return i ? i(e, t, n || {}) : r ? Promise.resolve(r) : Promise.reject("Source not valid (" + t + ")");
280
+ }
281
+ o.fetch = r;
282
+ function s(e) {
283
+ return e instanceof ArrayBuffer;
284
+ }
285
+ function c(e, t, n) {
286
+ return new Promise(function(n, r) {
287
+ e.decodeAudioData(t, function(e) {
288
+ n(e);
289
+ }, function() {
290
+ r("Can't decode audio data (" + t.slice(0, 30) + "...)");
291
+ });
292
+ });
293
+ }
294
+ var l = i(/\.(mp3|wav|ogg)(\?.*)?$/i);
295
+ function u(e, t, n) {
296
+ var r = a(n.from, t);
297
+ return o(e, o.fetch(r, "arraybuffer"), n);
298
+ }
299
+ function d(e) {
300
+ return e && typeof e.then == "function";
301
+ }
302
+ function f(e, t, n) {
303
+ return t.then(function(t) {
304
+ return o(e, t, n);
305
+ });
306
+ }
307
+ var p = Array.isArray;
308
+ function m(e, t, n) {
309
+ return Promise.all(t.map(function(t) {
310
+ return o(e, t, n, t);
311
+ }));
312
+ }
313
+ function h(e) {
314
+ return e && typeof e == "object";
315
+ }
316
+ function g(e, t, n) {
317
+ var r = {}, i = Object.keys(t).map(function(i) {
318
+ if (n.only && n.only.indexOf(i) === -1) return null;
319
+ var a = t[i];
320
+ return o(e, a, n, a).then(function(e) {
321
+ r[i] = e;
322
+ });
323
+ });
324
+ return Promise.all(i).then(function() {
325
+ return r;
326
+ });
327
+ }
328
+ var _ = i(/\.json(\?.*)?$/i);
329
+ function v(e, t, n) {
330
+ var r = a(n.from, t);
331
+ return o(e, o.fetch(r, "text").then(JSON.parse), n);
332
+ }
333
+ var y = i(/^data:audio/);
334
+ function b(e, t, r) {
335
+ var i = t.indexOf(",");
336
+ return o(e, n.decode(t.slice(i + 1)).buffer, r);
337
+ }
338
+ var x = i(/\.js(\?.*)?$/i);
339
+ function S(e, t, n) {
340
+ var r = a(n.from, t);
341
+ return o(e, o.fetch(r, "text").then(C), n);
342
+ }
343
+ function C(e) {
344
+ var t = e.indexOf("MIDI.Soundfont.");
345
+ if (t < 0) throw Error("Invalid MIDI.js Soundfont format");
346
+ t = e.indexOf("=", t) + 2;
347
+ var n = e.lastIndexOf(",");
348
+ return JSON.parse(e.slice(t, n) + "}");
349
+ }
350
+ typeof t == "object" && t.exports && (t.exports = o), typeof window < "u" && (window.loadAudio = o);
351
+ })), P = /* @__PURE__ */ D(((e, t) => {
352
+ t.exports = n;
353
+ function n(e) {
354
+ var t = e.createGain(), n = t._voltage = a(e), i = o(n), s = o(n), c = o(n);
355
+ return t._startAmount = o(s), t._endAmount = o(c), t._multiplier = o(i), t._multiplier.connect(t), t._startAmount.connect(t), t._endAmount.connect(t), t.value = i.gain, t.startValue = s.gain, t.endValue = c.gain, t.startValue.value = 0, t.endValue.value = 0, Object.defineProperties(t, r), t;
356
+ }
357
+ var r = {
358
+ attack: {
359
+ value: 0,
360
+ writable: !0
361
+ },
362
+ decay: {
363
+ value: 0,
364
+ writable: !0
365
+ },
366
+ sustain: {
367
+ value: 1,
368
+ writable: !0
369
+ },
370
+ release: {
371
+ value: 0,
372
+ writable: !0
373
+ },
374
+ getReleaseDuration: { value: function() {
375
+ return this.release;
376
+ } },
377
+ start: { value: function(e) {
378
+ var t = this._multiplier.gain, n = this._startAmount.gain, r = this._endAmount.gain;
379
+ this._voltage.start(e), this._decayFrom = this._decayFrom = e + this.attack, this._startedAt = e;
380
+ var i = this.sustain;
381
+ t.cancelScheduledValues(e), n.cancelScheduledValues(e), r.cancelScheduledValues(e), r.setValueAtTime(0, e), this.attack ? (t.setValueAtTime(0, e), t.linearRampToValueAtTime(1, e + this.attack), n.setValueAtTime(1, e), n.linearRampToValueAtTime(0, e + this.attack)) : (t.setValueAtTime(1, e), n.setValueAtTime(0, e)), this.decay && t.setTargetAtTime(i, this._decayFrom, s(this.decay));
382
+ } },
383
+ stop: { value: function(e, t) {
384
+ t && (e -= this.release);
385
+ var n = e + this.release;
386
+ if (this.release) {
387
+ var r = this._multiplier.gain, i = this._startAmount.gain, a = this._endAmount.gain;
388
+ r.cancelScheduledValues(e), i.cancelScheduledValues(e), a.cancelScheduledValues(e);
389
+ var o = s(this.release);
390
+ if (this.attack && e < this._decayFrom) {
391
+ var l = c(0, 1, this._startedAt, this._decayFrom, e);
392
+ r.linearRampToValueAtTime(l, e), i.linearRampToValueAtTime(1 - l, e), i.setTargetAtTime(0, e, o);
393
+ }
394
+ a.setTargetAtTime(1, e, o), r.setTargetAtTime(0, e, o);
395
+ }
396
+ return this._voltage.stop(n), n;
397
+ } },
398
+ onended: {
399
+ get: function() {
400
+ return this._voltage.onended;
401
+ },
402
+ set: function(e) {
403
+ this._voltage.onended = e;
404
+ }
405
+ }
406
+ }, i = new Float32Array([1, 1]);
407
+ function a(e) {
408
+ var t = e.createBufferSource(), n = e.createBuffer(1, 2, e.sampleRate);
409
+ return n.getChannelData(0).set(i), t.buffer = n, t.loop = !0, t;
410
+ }
411
+ function o(e) {
412
+ var t = e.context.createGain();
413
+ return e.connect(t), t;
414
+ }
415
+ function s(e) {
416
+ return Math.log(e + 1) / Math.log(100);
417
+ }
418
+ function c(e, t, n, r, i) {
419
+ var a = t - e, o = r - n, s = e + (i - n) / o * a;
420
+ return s <= e && (s = e), s >= t && (s = t), s;
421
+ }
422
+ })), se = /* @__PURE__ */ D(((e, t) => {
423
+ var n = P(), r = {}, i = {
424
+ gain: 1,
425
+ attack: .01,
426
+ decay: .1,
427
+ sustain: .9,
428
+ release: .3,
429
+ loop: !1,
430
+ cents: 0,
431
+ loopStart: 0,
432
+ loopEnd: 0
433
+ };
434
+ function a(e, t, n) {
435
+ var a = !1, o = 0, s = {}, u = e.createGain();
436
+ u.gain.value = 1;
437
+ var d = Object.assign({}, i, n), f = {
438
+ context: e,
439
+ out: u,
440
+ opts: d
441
+ };
442
+ return t instanceof AudioBuffer ? f.buffer = t : f.buffers = t, f.start = function(t, n, i) {
443
+ if (f.buffer && t !== null) return f.start(null, t, n);
444
+ var o = t ? f.buffers[t] : f.buffer;
445
+ if (!o) {
446
+ console.warn("Buffer " + t + " not found.");
447
+ return;
448
+ } else if (!a) {
449
+ console.warn("SamplePlayer not connected to any node.");
450
+ return;
451
+ }
452
+ var s = i || r;
453
+ n = Math.max(e.currentTime, n || 0), f.emit("start", n, t, s);
454
+ var c = m(t, o, s);
455
+ return c.id = p(t, c), c.env.start(n), c.source.start(n), f.emit("started", n, c.id, c), s.duration && c.stop(n + s.duration), c;
456
+ }, f.play = function(e, t, n) {
457
+ return f.start(e, t, n);
458
+ }, f.stop = function(e, t) {
459
+ var n;
460
+ return t ||= Object.keys(s), t.map(function(t) {
461
+ return n = s[t], n ? (n.stop(e), n.id) : null;
462
+ });
463
+ }, f.connect = function(e) {
464
+ return a = !0, u.connect(e), f;
465
+ }, f.emit = function(e, t, n, r) {
466
+ f.onevent && f.onevent(e, t, n, r);
467
+ var i = f["on" + e];
468
+ i && i(t, n, r);
469
+ }, f;
470
+ function p(t, n) {
471
+ return n.id = o++, s[n.id] = n, n.source.onended = function() {
472
+ var t = e.currentTime;
473
+ n.source.disconnect(), n.env.disconnect(), n.disconnect(), f.emit("ended", t, n.id, n);
474
+ }, n.id;
475
+ }
476
+ function m(t, n, r) {
477
+ var i = e.createGain();
478
+ return i.gain.value = 0, i.connect(u), i.env = c(e, r, d), i.env.connect(i.gain), i.source = e.createBufferSource(), i.source.buffer = n, i.source.connect(i), i.source.loop = r.loop || d.loop, i.source.playbackRate.value = l(r.cents || d.cents), i.source.loopStart = r.loopStart || d.loopStart, i.source.loopEnd = r.loopEnd || d.loopEnd, i.stop = function(n) {
479
+ var r = n || e.currentTime;
480
+ f.emit("stop", r, t);
481
+ var a = i.env.stop(r);
482
+ i.source.stop(a);
483
+ }, i;
484
+ }
485
+ }
486
+ function o(e) {
487
+ return typeof e == "number";
488
+ }
489
+ var s = [
490
+ "attack",
491
+ "decay",
492
+ "sustain",
493
+ "release"
494
+ ];
495
+ function c(e, t, r) {
496
+ var i = n(e), a = t.adsr || r.adsr;
497
+ return s.forEach(function(e, n) {
498
+ a ? i[e] = a[n] : i[e] = t[e] || r[e];
499
+ }), i.value.value = o(t.gain) ? t.gain : o(r.gain) ? r.gain : 1, i;
500
+ }
501
+ function l(e) {
502
+ return e ? 2 ** (e / 1200) : 1;
503
+ }
504
+ t.exports = a;
505
+ })), ce = /* @__PURE__ */ D(((e, t) => {
506
+ t.exports = function(e) {
507
+ return e.on = function(t, r) {
508
+ if (arguments.length === 1 && typeof t == "function") return e.on("event", t);
509
+ var i = "on" + t, a = e[i];
510
+ return e[i] = a ? n(a, r) : r, e;
511
+ }, e;
512
+ };
513
+ function n(e, t) {
514
+ return function(n, r, i, a) {
515
+ e(n, r, i, a), t(n, r, i, a);
516
+ };
517
+ }
518
+ })), le = /* @__PURE__ */ D(((e, t) => {
519
+ var n = /^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;
520
+ function r() {
521
+ return n;
522
+ }
523
+ var i = [
524
+ 0,
525
+ 2,
526
+ 4,
527
+ 5,
528
+ 7,
529
+ 9,
530
+ 11
531
+ ];
532
+ function a(e, t, r) {
533
+ if (typeof e != "string") return null;
534
+ var a = n.exec(e);
535
+ if (!a || !t && a[4]) return null;
536
+ var s = {
537
+ letter: a[1].toUpperCase(),
538
+ acc: a[2].replace(/x/g, "##")
539
+ };
540
+ return s.pc = s.letter + s.acc, s.step = (s.letter.charCodeAt(0) + 3) % 7, s.alt = s.acc[0] === "b" ? -s.acc.length : s.acc.length, s.chroma = i[s.step] + s.alt, a[3] && (s.oct = +a[3], s.midi = s.chroma + 12 * (s.oct + 1), s.freq = o(s.midi, r)), t && (s.tonicOf = a[4]), s;
541
+ }
542
+ function o(e, t) {
543
+ return 2 ** ((e - 69) / 12) * (t || 440);
544
+ }
545
+ var s = {
546
+ parse: a,
547
+ regex: r,
548
+ midiToFreq: o
549
+ };
550
+ [
551
+ "letter",
552
+ "acc",
553
+ "pc",
554
+ "step",
555
+ "alt",
556
+ "chroma",
557
+ "oct",
558
+ "midi",
559
+ "freq"
560
+ ].forEach(function(e) {
561
+ s[e] = function(t) {
562
+ var n = a(t);
563
+ return n && n[e] !== void 0 ? n[e] : null;
564
+ };
565
+ }), t.exports = s;
566
+ })), ue = /* @__PURE__ */ D(((e, t) => {
567
+ var n = le(), r = function(e) {
568
+ return e !== null && e !== [] && e >= 0 && e < 129;
569
+ }, i = function(e) {
570
+ return r(e) ? +e : n.midi(e);
571
+ };
572
+ t.exports = function(e) {
573
+ if (e.buffers) {
574
+ var t = e.opts.map, n = typeof t == "function" ? t : i, r = function(e) {
575
+ return e ? n(e) || e : null;
576
+ };
577
+ e.buffers = a(e.buffers, r);
578
+ var o = e.start;
579
+ e.start = function(e, t, n) {
580
+ var i = r(e), a = i % 1;
581
+ return a && (i = Math.floor(i), n = Object.assign(n || {}, { cents: Math.floor(a * 100) })), o(i, t, n);
582
+ };
583
+ }
584
+ return e;
585
+ };
586
+ function a(e, t) {
587
+ return Object.keys(e).reduce(function(n, r) {
588
+ return n[t(r)] = e[r], n;
589
+ }, {});
590
+ }
591
+ })), de = /* @__PURE__ */ D(((e, t) => {
592
+ var n = Array.isArray, r = function(e) {
593
+ return e && typeof e == "object";
594
+ }, i = {};
595
+ t.exports = function(e) {
596
+ return e.schedule = function(t, a) {
597
+ var o = e.context.currentTime, s = t < o ? o : t;
598
+ e.emit("schedule", s, a);
599
+ var c, l, u, d;
600
+ return a.map(function(t) {
601
+ if (t) n(t) ? (c = t[0], l = t[1]) : (c = t.time, l = t);
602
+ else return null;
603
+ return r(l) ? (u = l.name || l.key || l.note || l.midi || null, d = l) : (u = l, d = i), e.start(u, s + (c || 0), d);
604
+ });
605
+ }, e;
606
+ };
607
+ })), fe = /* @__PURE__ */ D(((e, t) => {
608
+ (function(n) {
609
+ if (typeof e == "object" && t !== void 0) t.exports = n();
610
+ else if (typeof define == "function" && define.amd) define([], n);
611
+ else {
612
+ var r = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : this;
613
+ r.midimessage = n();
614
+ }
615
+ })(function() {
616
+ return function e(t, n, r) {
617
+ function i(o, s) {
618
+ if (!n[o]) {
619
+ if (!t[o]) {
620
+ var c = typeof M == "function" && M;
621
+ if (!s && c) return c(o, !0);
622
+ if (a) return a(o, !0);
623
+ var l = /* @__PURE__ */ Error("Cannot find module '" + o + "'");
624
+ throw l.code = "MODULE_NOT_FOUND", l;
625
+ }
626
+ var u = n[o] = { exports: {} };
627
+ t[o][0].call(u.exports, function(e) {
628
+ var n = t[o][1][e];
629
+ return i(n || e);
630
+ }, u, u.exports, e, t, n, r);
631
+ }
632
+ return n[o].exports;
633
+ }
634
+ for (var a = typeof M == "function" && M, o = 0; o < r.length; o++) i(r[o]);
635
+ return i;
636
+ }({ 1: [function(e, t, n) {
637
+ Object.defineProperty(n, "__esModule", { value: !0 }), n.default = function(e) {
638
+ function t(e) {
639
+ if (this._event = e, this._data = e.data, this.receivedTime = e.receivedTime, this._data && this._data.length < 2) {
640
+ console.warn("Illegal MIDI message of length", this._data.length);
641
+ return;
642
+ }
643
+ switch (this._messageCode = e.data[0] & 240, this.channel = e.data[0] & 15, this._messageCode) {
644
+ case 128:
645
+ this.messageType = "noteoff", this.key = e.data[1] & 127, this.velocity = e.data[2] & 127;
646
+ break;
647
+ case 144:
648
+ this.messageType = "noteon", this.key = e.data[1] & 127, this.velocity = e.data[2] & 127;
649
+ break;
650
+ case 160:
651
+ this.messageType = "keypressure", this.key = e.data[1] & 127, this.pressure = e.data[2] & 127;
652
+ break;
653
+ case 176:
654
+ this.messageType = "controlchange", this.controllerNumber = e.data[1] & 127, this.controllerValue = e.data[2] & 127, this.controllerNumber === 120 && this.controllerValue === 0 ? this.channelModeMessage = "allsoundoff" : this.controllerNumber === 121 ? this.channelModeMessage = "resetallcontrollers" : this.controllerNumber === 122 ? this.controllerValue === 0 ? this.channelModeMessage = "localcontroloff" : this.channelModeMessage = "localcontrolon" : this.controllerNumber === 123 && this.controllerValue === 0 ? this.channelModeMessage = "allnotesoff" : this.controllerNumber === 124 && this.controllerValue === 0 ? this.channelModeMessage = "omnimodeoff" : this.controllerNumber === 125 && this.controllerValue === 0 ? this.channelModeMessage = "omnimodeon" : this.controllerNumber === 126 ? this.channelModeMessage = "monomodeon" : this.controllerNumber === 127 && (this.channelModeMessage = "polymodeon");
655
+ break;
656
+ case 192:
657
+ this.messageType = "programchange", this.program = e.data[1];
658
+ break;
659
+ case 208:
660
+ this.messageType = "channelpressure", this.pressure = e.data[1] & 127;
661
+ break;
662
+ case 224:
663
+ this.messageType = "pitchbendchange";
664
+ var t = e.data[2] & 127, n = e.data[1] & 127;
665
+ this.pitchBend = (t << 8) + n;
666
+ break;
667
+ }
668
+ }
669
+ return new t(e);
670
+ }, t.exports = n.default;
671
+ }, {}] }, {}, [1])(1);
672
+ });
673
+ })), pe = /* @__PURE__ */ D(((e, t) => {
674
+ var n = fe();
675
+ t.exports = function(e) {
676
+ return e.listenToMidi = function(t, r) {
677
+ var i = {}, a = r || {}, o = a.gain || function(e) {
678
+ return e / 127;
679
+ };
680
+ return t.onmidimessage = function(t) {
681
+ var r = t.messageType ? t : n(t);
682
+ if (r.messageType === "noteon" && r.velocity === 0 && (r.messageType = "noteoff"), !(a.channel && r.channel !== a.channel)) switch (r.messageType) {
683
+ case "noteon":
684
+ i[r.key] = e.play(r.key, 0, { gain: o(r.velocity) });
685
+ break;
686
+ case "noteoff":
687
+ i[r.key] && (i[r.key].stop(), delete i[r.key]);
688
+ break;
689
+ }
690
+ }, e;
691
+ }, e;
692
+ };
693
+ })), me = /* @__PURE__ */ D(((e, t) => {
694
+ var n = se(), r = ce(), i = ue(), a = de(), o = pe();
695
+ function s(e, t, s) {
696
+ return o(a(i(r(n(e, t, s)))));
697
+ }
698
+ typeof t == "object" && t.exports && (t.exports = s), typeof window < "u" && (window.SamplePlayer = s);
699
+ })), he = /* @__PURE__ */ O({
700
+ acc: () => ke,
701
+ alt: () => Me,
702
+ build: () => Te,
703
+ chroma: () => Ne,
704
+ freq: () => De,
705
+ letter: () => Oe,
706
+ midi: () => Ee,
707
+ oct: () => Pe,
708
+ parse: () => Se,
709
+ pc: () => Ae,
710
+ regex: () => xe,
711
+ step: () => je
712
+ });
713
+ function ge(e, t) {
714
+ return Array(t + 1).join(e);
715
+ }
716
+ function _e(e) {
717
+ return typeof e == "number";
718
+ }
719
+ function ve(e) {
720
+ return typeof e == "string";
721
+ }
722
+ function ye(e) {
723
+ return e !== void 0;
724
+ }
725
+ function be(e, t) {
726
+ return 2 ** ((e - 69) / 12) * (t || 440);
727
+ }
728
+ function xe() {
729
+ return Fe;
730
+ }
731
+ function Se(e, t, n) {
732
+ if (typeof e != "string") return null;
733
+ var r = Fe.exec(e);
734
+ if (!r || !t && r[4]) return null;
735
+ var i = {
736
+ letter: r[1].toUpperCase(),
737
+ acc: r[2].replace(/x/g, "##")
738
+ };
739
+ i.pc = i.letter + i.acc, i.step = (i.letter.charCodeAt(0) + 3) % 7, i.alt = i.acc[0] === "b" ? -i.acc.length : i.acc.length;
740
+ var a = Ie[i.step] + i.alt;
741
+ return i.chroma = a < 0 ? 12 + a : a % 12, r[3] && (i.oct = +r[3], i.midi = a + 12 * (i.oct + 1), i.freq = be(i.midi, n)), t && (i.tonicOf = r[4]), i;
742
+ }
743
+ function Ce(e) {
744
+ return _e(e) ? e < 0 ? ge("b", -e) : ge("#", e) : "";
745
+ }
746
+ function we(e) {
747
+ return _e(e) ? "" + e : "";
748
+ }
749
+ function Te(e, t, n) {
750
+ return e == null ? null : e.step ? Te(e.step, e.alt, e.oct) : e < 0 || e > 6 ? null : Le.charAt(e) + Ce(t) + we(n);
751
+ }
752
+ function Ee(e) {
753
+ if ((_e(e) || ve(e)) && e >= 0 && e < 128) return +e;
754
+ var t = Se(e);
755
+ return t && ye(t.midi) ? t.midi : null;
756
+ }
757
+ function De(e, t) {
758
+ var n = Ee(e);
759
+ return n === null ? null : be(n, t);
760
+ }
761
+ function Oe(e) {
762
+ return (Se(e) || {}).letter;
763
+ }
764
+ function ke(e) {
765
+ return (Se(e) || {}).acc;
766
+ }
767
+ function Ae(e) {
768
+ return (Se(e) || {}).pc;
769
+ }
770
+ function je(e) {
771
+ return (Se(e) || {}).step;
772
+ }
773
+ function Me(e) {
774
+ return (Se(e) || {}).alt;
775
+ }
776
+ function Ne(e) {
777
+ return (Se(e) || {}).chroma;
778
+ }
779
+ function Pe(e) {
780
+ return (Se(e) || {}).oct;
781
+ }
782
+ var Fe, Ie, Le, Re = E((() => {
783
+ Fe = /^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/, Ie = [
784
+ 0,
785
+ 2,
786
+ 4,
787
+ 5,
788
+ 7,
789
+ 9,
790
+ 11
791
+ ], Le = "CDEFGAB";
792
+ })), ze = /* @__PURE__ */ D(((e, t) => {
793
+ var n = (Re(), j(he));
794
+ function r(e, t) {
795
+ if (console.warn("new Soundfont() is deprected"), console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"), !(this instanceof r)) return new r(e);
796
+ this.nameToUrl = t || r.nameToUrl, this.ctx = e, this.instruments = {}, this.promises = [];
797
+ }
798
+ r.prototype.onready = function(e) {
799
+ console.warn("deprecated API"), console.log("Please use Promise.all(Soundfont.instrument(), Soundfont.instrument()).then() instead of new Soundfont().onready()"), Promise.all(this.promises).then(e);
800
+ }, r.prototype.instrument = function(e, t) {
801
+ console.warn("new Soundfont().instrument() is deprecated."), console.log("Please use Soundfont.instrument() instead.");
802
+ var n = this.ctx;
803
+ if (e ||= "default", e in this.instruments) return this.instruments[e];
804
+ var i = {
805
+ name: e,
806
+ play: a(n, t)
807
+ };
808
+ if (this.instruments[e] = i, e !== "default") {
809
+ var o = r.instrument(n, e, t).then(function(e) {
810
+ return i.play = e.play, i;
811
+ });
812
+ this.promises.push(o), i.onready = function(e) {
813
+ console.warn("onready is deprecated. Use Soundfont.instrument().then()"), o.then(e);
814
+ };
815
+ } else i.onready = function(e) {
816
+ console.warn("onready is deprecated. Use Soundfont.instrument().then()"), e();
817
+ };
818
+ return i;
819
+ };
820
+ function i(e, t, n) {
821
+ return console.warn("Soundfont.loadBuffers is deprecate."), console.log("Use Soundfont.instrument(..) and get buffers properties from the result."), r.instrument(e, t, n).then(function(e) {
822
+ return e.buffers;
823
+ });
824
+ }
825
+ r.loadBuffers = i;
826
+ function a(e, t) {
827
+ return t ||= {}, function(r, i, a, o) {
828
+ console.warn("The oscillator player is deprecated."), console.log("Starting with version 0.9.0 you will have to wait until the soundfont is loaded to play sounds.");
829
+ var s = r > 0 && r < 129 ? +r : n.midi(r), c = s ? n.midiToFreq(s, 440) : null;
830
+ if (c) {
831
+ a ||= .2, o ||= {};
832
+ var l = o.destination || t.destination || e.destination, u = o.vcoType || t.vcoType || "sine", d = o.gain || t.gain || .4, f = e.createOscillator();
833
+ f.type = u, f.frequency.value = c;
834
+ var p = e.createGain();
835
+ return p.gain.value = d, f.connect(p), p.connect(l), f.start(i), a > 0 && f.stop(i + a), f;
836
+ }
837
+ };
838
+ }
839
+ r.noteToMidi = n.midi, t.exports = r;
840
+ })), Be = /* @__PURE__ */ A((/* @__PURE__ */ D(((e, t) => {
841
+ var n = oe(), r = me();
842
+ function i(e, t, s) {
843
+ if (arguments.length === 1) return function(t, n) {
844
+ return i(e, t, n);
845
+ };
846
+ var c = s || {}, l = c.isSoundfontURL || a, u = c.nameToUrl || o, d = l(t) ? t : u(t, c.soundfont, c.format);
847
+ return n(e, d, { only: c.only || c.notes }).then(function(n) {
848
+ var i = r(e, n, c).connect(c.destination ? c.destination : e.destination);
849
+ return i.url = d, i.name = t, i;
850
+ });
851
+ }
852
+ function a(e) {
853
+ return /\.js(\?.*)?$/i.test(e);
854
+ }
855
+ function o(e, t, n) {
856
+ return n = n === "ogg" ? n : "mp3", t = t === "FluidR3_GM" ? t : "MusyngKite", "https://gleitz.github.io/midi-js-soundfonts/" + t + "/" + e + "-" + n + ".js";
857
+ }
858
+ var s = ze();
859
+ s.instrument = i, s.nameToUrl = o, typeof t == "object" && t.exports && (t.exports = s), typeof window < "u" && (window.Soundfont = s);
860
+ })))(), 1), Ve = class {
861
+ constructor() {
862
+ this.players = /* @__PURE__ */ new Map(), this.instruments = re.filter((e) => N.includes(this.getSoundfontInstrumentName(e[1]))).map((e) => ({
863
+ midiId: e[0],
864
+ name: e[1],
865
+ loaded: !1
866
+ }));
867
+ }
868
+ init(e) {
869
+ this.audioContext = e;
870
+ }
871
+ async load(e) {
872
+ let t = this.instruments.find((t) => t.midiId === e);
873
+ if (!t) throw Error("SoundfontPlayer does not support midi instrument ID " + e);
874
+ if (this.players.has(e)) return;
875
+ let n = await Be.instrument(this.audioContext, this.getSoundfontInstrumentName(t.name));
876
+ this.players.set(e, n);
877
+ }
878
+ stop(e) {
879
+ this.players.has(e) && this.players.get(e).stop();
880
+ }
881
+ schedule(e, t, n) {
882
+ this.verifyPlayerLoaded(e), this.applyDynamics(n), this.players.get(e).schedule(t, n);
883
+ }
884
+ applyDynamics(e) {
885
+ for (let t of e) t.articulation === ne.Staccato && (t.gain = Math.max(t.gain + .3, t.gain * 1.3), t.duration = Math.min(t.duration * .4, .4));
886
+ }
887
+ verifyPlayerLoaded(e) {
888
+ if (!this.players.has(e)) throw Error("No soundfont player loaded for midi instrument " + e);
889
+ }
890
+ getSoundfontInstrumentName(e) {
891
+ return e.toLowerCase().replace(/\s+/g, "_");
892
+ }
893
+ };
894
+ //#endregion
895
+ //#region node_modules/@modernized/osmd-audio-player/dist/internals/noteHelpers.js
896
+ function He(e) {
897
+ return e.ParentVoiceEntry.isStaccato() ? ne.Staccato : ne.None;
898
+ }
899
+ function Ue(e, t) {
900
+ let n = e.Length.RealValue * t;
901
+ return e.NoteTie && (Object.is(e.NoteTie.StartNote, e) && e.NoteTie.Notes[1] ? n += e.NoteTie.Notes[1].Length.RealValue * t : n = 0), n;
902
+ }
903
+ function We(e) {
904
+ return e.ParentVoiceEntry.ParentVoice.Volume;
905
+ }
906
+ //#endregion
907
+ //#region node_modules/@modernized/osmd-audio-player/dist/internals/EventEmitter.js
908
+ var Ge = class {
909
+ constructor() {
910
+ this.subscribers = /* @__PURE__ */ new Map();
911
+ }
912
+ on(e, t) {
913
+ this.subscribers.get(e) || this.subscribers.set(e, []), this.subscribers.get(e).push(t);
914
+ }
915
+ emit(e, ...t) {
916
+ let n = this.subscribers.get(e) || [];
917
+ for (let e of n) e(...t);
918
+ }
919
+ }, Ke = /* @__PURE__ */ D(((e, t) => {
920
+ function n(e) {
921
+ if (Array.isArray(e)) return e;
922
+ }
923
+ t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
924
+ })), qe = /* @__PURE__ */ D(((e, t) => {
925
+ function n(e, t) {
926
+ var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
927
+ if (n != null) {
928
+ var r, i, a, o, s = [], c = !0, l = !1;
929
+ try {
930
+ if (a = (n = n.call(e)).next, t === 0) {
931
+ if (Object(n) !== n) return;
932
+ c = !1;
933
+ } else for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
934
+ } catch (e) {
935
+ l = !0, i = e;
936
+ } finally {
937
+ try {
938
+ if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
939
+ } finally {
940
+ if (l) throw i;
941
+ }
942
+ }
943
+ return s;
944
+ }
945
+ }
946
+ t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
947
+ })), Je = /* @__PURE__ */ D(((e, t) => {
948
+ function n(e, t) {
949
+ (t == null || t > e.length) && (t = e.length);
950
+ for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
951
+ return r;
952
+ }
953
+ t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
954
+ })), Ye = /* @__PURE__ */ D(((e, t) => {
955
+ var n = Je();
956
+ function r(e, t) {
957
+ if (e) {
958
+ if (typeof e == "string") return n(e, t);
959
+ var r = {}.toString.call(e).slice(8, -1);
960
+ return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? n(e, t) : void 0;
961
+ }
962
+ }
963
+ t.exports = r, t.exports.__esModule = !0, t.exports.default = t.exports;
964
+ })), Xe = /* @__PURE__ */ D(((e, t) => {
965
+ function n() {
966
+ throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
967
+ }
968
+ t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
969
+ })), Ze = /* @__PURE__ */ D(((e, t) => {
970
+ var n = Ke(), r = qe(), i = Ye(), a = Xe();
971
+ function o(e, t) {
972
+ return n(e) || r(e, t) || i(e, t) || a();
973
+ }
974
+ t.exports = o, t.exports.__esModule = !0, t.exports.default = t.exports;
975
+ })), Qe = /* @__PURE__ */ D(((e, t) => {
976
+ function n(e, t) {
977
+ if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
978
+ }
979
+ t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
980
+ })), $e = /* @__PURE__ */ D(((e, t) => {
981
+ function n(e) {
982
+ "@babel/helpers - typeof";
983
+ return t.exports = n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
984
+ return typeof e;
985
+ } : function(e) {
986
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
987
+ }, t.exports.__esModule = !0, t.exports.default = t.exports, n(e);
988
+ }
989
+ t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
990
+ })), et = /* @__PURE__ */ D(((e, t) => {
991
+ var n = $e().default;
992
+ function r(e, t) {
993
+ if (n(e) != "object" || !e) return e;
994
+ var r = e[Symbol.toPrimitive];
995
+ if (r !== void 0) {
996
+ var i = r.call(e, t || "default");
997
+ if (n(i) != "object") return i;
998
+ throw TypeError("@@toPrimitive must return a primitive value.");
999
+ }
1000
+ return (t === "string" ? String : Number)(e);
1001
+ }
1002
+ t.exports = r, t.exports.__esModule = !0, t.exports.default = t.exports;
1003
+ })), tt = /* @__PURE__ */ D(((e, t) => {
1004
+ var n = $e().default, r = et();
1005
+ function i(e) {
1006
+ var t = r(e, "string");
1007
+ return n(t) == "symbol" ? t : t + "";
1008
+ }
1009
+ t.exports = i, t.exports.__esModule = !0, t.exports.default = t.exports;
1010
+ })), nt = /* @__PURE__ */ D(((e, t) => {
1011
+ var n = tt();
1012
+ function r(e, t) {
1013
+ for (var r = 0; r < t.length; r++) {
1014
+ var i = t[r];
1015
+ i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(e, n(i.key), i);
1016
+ }
1017
+ }
1018
+ function i(e, t, n) {
1019
+ return t && r(e.prototype, t), n && r(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
1020
+ }
1021
+ t.exports = i, t.exports.__esModule = !0, t.exports.default = t.exports;
1022
+ })), rt = (/* @__PURE__ */ D(((e, t) => {
1023
+ (function(n, r) {
1024
+ typeof e == "object" && t !== void 0 ? r(e, Ze(), Qe(), nt()) : typeof define == "function" && define.amd ? define([
1025
+ "exports",
1026
+ "@babel/runtime/helpers/slicedToArray",
1027
+ "@babel/runtime/helpers/classCallCheck",
1028
+ "@babel/runtime/helpers/createClass"
1029
+ ], r) : (n = typeof globalThis < "u" ? globalThis : n || self, r(n.automationEvents = {}, n._slicedToArray, n._classCallCheck, n._createClass));
1030
+ })(e, (function(e, t, n, r) {
1031
+ var i = function(e, t, n) {
1032
+ return {
1033
+ endTime: t,
1034
+ insertTime: n,
1035
+ type: "exponentialRampToValue",
1036
+ value: e
1037
+ };
1038
+ }, a = function(e, t, n) {
1039
+ return {
1040
+ endTime: t,
1041
+ insertTime: n,
1042
+ type: "linearRampToValue",
1043
+ value: e
1044
+ };
1045
+ }, o = function(e, t) {
1046
+ return {
1047
+ startTime: t,
1048
+ type: "setValue",
1049
+ value: e
1050
+ };
1051
+ }, s = function(e, t, n) {
1052
+ return {
1053
+ duration: n,
1054
+ startTime: t,
1055
+ type: "setValueCurve",
1056
+ values: e
1057
+ };
1058
+ }, c = function(e, t, n) {
1059
+ var r = n.startTime, i = n.target, a = n.timeConstant;
1060
+ return i + (t - i) * Math.exp((r - e) / a);
1061
+ }, l = function(e) {
1062
+ return e.type === "exponentialRampToValue";
1063
+ }, u = function(e) {
1064
+ return e.type === "linearRampToValue";
1065
+ }, d = function(e) {
1066
+ return l(e) || u(e);
1067
+ }, f = function(e) {
1068
+ return e.type === "setValue";
1069
+ }, p = function(e) {
1070
+ return e.type === "setValueCurve";
1071
+ }, m = function(e, t, n, r) {
1072
+ var i = e[t];
1073
+ return i === void 0 ? r : d(i) || f(i) ? i.value : p(i) ? i.values[i.values.length - 1] : c(n, m(e, t - 1, i.startTime, r), i);
1074
+ }, h = function(e, t, n, r, i) {
1075
+ return n === void 0 ? [r.insertTime, i] : d(n) ? [n.endTime, n.value] : f(n) ? [n.startTime, n.value] : p(n) ? [n.startTime + n.duration, n.values[n.values.length - 1]] : [n.startTime, m(e, t - 1, n.startTime, i)];
1076
+ }, g = function(e) {
1077
+ return e.type === "cancelAndHold";
1078
+ }, _ = function(e) {
1079
+ return e.type === "cancelScheduledValues";
1080
+ }, v = function(e) {
1081
+ return g(e) || _(e) ? e.cancelTime : l(e) || u(e) ? e.endTime : e.startTime;
1082
+ }, y = function(e, t, n, r) {
1083
+ var i = r.endTime, a = r.value;
1084
+ return n === a ? a : 0 < n && 0 < a || n < 0 && a < 0 ? n * (a / n) ** +((e - t) / (i - t)) : e < i ? n : a;
1085
+ }, b = function(e, t, n, r) {
1086
+ var i = r.endTime, a = r.value;
1087
+ return n + (e - t) / (i - t) * (a - n);
1088
+ }, x = function(e, t) {
1089
+ var n = Math.floor(t), r = Math.ceil(t);
1090
+ return n === r ? e[n] : (1 - (t - n)) * e[n] + (1 - (r - t)) * e[r];
1091
+ }, S = function(e, t) {
1092
+ var n = t.duration, r = t.startTime, i = t.values;
1093
+ return x(i, (e - r) / n * (i.length - 1));
1094
+ }, C = function(e) {
1095
+ return e.type === "setTarget";
1096
+ };
1097
+ e.AutomationEventList = /* @__PURE__ */ function() {
1098
+ function e(t) {
1099
+ n(this, e), this._automationEvents = [], this._currenTime = 0, this._defaultValue = t;
1100
+ }
1101
+ return r(e, [
1102
+ {
1103
+ key: Symbol.iterator,
1104
+ value: function() {
1105
+ return this._automationEvents[Symbol.iterator]();
1106
+ }
1107
+ },
1108
+ {
1109
+ key: "add",
1110
+ value: function(e) {
1111
+ var t = v(e);
1112
+ if (g(e) || _(e)) {
1113
+ var n = this._automationEvents.findIndex(function(n) {
1114
+ return _(e) && p(n) ? n.startTime + n.duration >= t : v(n) >= t;
1115
+ }), r = this._automationEvents[n];
1116
+ if (n !== -1 && (this._automationEvents = this._automationEvents.slice(0, n)), g(e)) {
1117
+ var c = this._automationEvents[this._automationEvents.length - 1];
1118
+ if (r !== void 0 && d(r)) {
1119
+ if (c !== void 0 && C(c)) throw Error("The internal list is malformed.");
1120
+ var f = c === void 0 ? r.insertTime : p(c) ? c.startTime + c.duration : v(c), m = c === void 0 ? this._defaultValue : p(c) ? c.values[c.values.length - 1] : c.value, h = l(r) ? y(t, f, m, r) : b(t, f, m, r), x = l(r) ? i(h, t, this._currenTime) : a(h, t, this._currenTime);
1121
+ this._automationEvents.push(x);
1122
+ }
1123
+ if (c !== void 0 && C(c) && this._automationEvents.push(o(this.getValue(t), t)), c !== void 0 && p(c) && c.startTime + c.duration > t) {
1124
+ var S = t - c.startTime, w = (c.values.length - 1) / c.duration, T = Math.max(2, 1 + Math.ceil(S * w)), E = S / (T - 1) * w, D = c.values.slice(0, T);
1125
+ if (E < 1) for (var O = 1; O < T; O += 1) {
1126
+ var k = E * O % 1;
1127
+ D[O] = c.values[O - 1] * (1 - k) + c.values[O] * k;
1128
+ }
1129
+ this._automationEvents[this._automationEvents.length - 1] = s(D, c.startTime, S);
1130
+ }
1131
+ }
1132
+ } else {
1133
+ var A = this._automationEvents.findIndex(function(e) {
1134
+ return v(e) > t;
1135
+ }), j = A === -1 ? this._automationEvents[this._automationEvents.length - 1] : this._automationEvents[A - 1];
1136
+ if (j !== void 0 && p(j) && v(j) + j.duration > t) return !1;
1137
+ var M = l(e) ? i(e.value, e.endTime, this._currenTime) : u(e) ? a(e.value, t, this._currenTime) : e;
1138
+ if (A === -1) this._automationEvents.push(M);
1139
+ else {
1140
+ if (p(e) && t + e.duration > v(this._automationEvents[A])) return !1;
1141
+ this._automationEvents.splice(A, 0, M);
1142
+ }
1143
+ }
1144
+ return !0;
1145
+ }
1146
+ },
1147
+ {
1148
+ key: "flush",
1149
+ value: function(e) {
1150
+ var t = this._automationEvents.findIndex(function(t) {
1151
+ return v(t) > e;
1152
+ });
1153
+ if (t > 1) {
1154
+ var n = this._automationEvents.slice(t - 1), r = n[0];
1155
+ C(r) && n.unshift(o(m(this._automationEvents, t - 2, r.startTime, this._defaultValue), r.startTime)), this._automationEvents = n;
1156
+ }
1157
+ }
1158
+ },
1159
+ {
1160
+ key: "getValue",
1161
+ value: function(e) {
1162
+ if (this._automationEvents.length === 0) return this._defaultValue;
1163
+ var n = this._automationEvents.findIndex(function(t) {
1164
+ return v(t) > e;
1165
+ }), r = this._automationEvents[n], i = (n === -1 ? this._automationEvents.length : n) - 1, a = this._automationEvents[i];
1166
+ if (a !== void 0 && C(a) && (r === void 0 || !d(r) || r.insertTime > e)) return c(e, m(this._automationEvents, i - 1, a.startTime, this._defaultValue), a);
1167
+ if (a !== void 0 && f(a) && (r === void 0 || !d(r))) return a.value;
1168
+ if (a !== void 0 && p(a) && (r === void 0 || !d(r) || a.startTime + a.duration > e)) return e < a.startTime + a.duration ? S(e, a) : a.values[a.values.length - 1];
1169
+ if (a !== void 0 && d(a) && (r === void 0 || !d(r))) return a.value;
1170
+ if (r !== void 0 && l(r)) {
1171
+ var o = t(h(this._automationEvents, i, a, r, this._defaultValue), 2), s = o[0], g = o[1];
1172
+ return y(e, s, g, r);
1173
+ }
1174
+ if (r !== void 0 && u(r)) {
1175
+ var _ = t(h(this._automationEvents, i, a, r, this._defaultValue), 2), x = _[0], w = _[1];
1176
+ return b(e, x, w, r);
1177
+ }
1178
+ return this._defaultValue;
1179
+ }
1180
+ }
1181
+ ]);
1182
+ }(), e.createCancelAndHoldAutomationEvent = function(e) {
1183
+ return {
1184
+ cancelTime: e,
1185
+ type: "cancelAndHold"
1186
+ };
1187
+ }, e.createCancelScheduledValuesAutomationEvent = function(e) {
1188
+ return {
1189
+ cancelTime: e,
1190
+ type: "cancelScheduledValues"
1191
+ };
1192
+ }, e.createExponentialRampToValueAutomationEvent = function(e, t) {
1193
+ return {
1194
+ endTime: t,
1195
+ type: "exponentialRampToValue",
1196
+ value: e
1197
+ };
1198
+ }, e.createLinearRampToValueAutomationEvent = function(e, t) {
1199
+ return {
1200
+ endTime: t,
1201
+ type: "linearRampToValue",
1202
+ value: e
1203
+ };
1204
+ }, e.createSetTargetAutomationEvent = function(e, t, n) {
1205
+ return {
1206
+ startTime: t,
1207
+ target: e,
1208
+ timeConstant: n,
1209
+ type: "setTarget"
1210
+ };
1211
+ }, e.createSetValueAutomationEvent = o, e.createSetValueCurveAutomationEvent = s;
1212
+ }));
1213
+ })))(), it = () => new DOMException("", "AbortError"), at = (e) => (t, n, [r, i, a], o) => {
1214
+ e(t[i], [
1215
+ n,
1216
+ r,
1217
+ a
1218
+ ], (e) => e[0] === n && e[1] === r, o);
1219
+ }, ot = (e) => (t, n, r) => {
1220
+ let i = [];
1221
+ for (let e = 0; e < r.numberOfInputs; e += 1) i.push(/* @__PURE__ */ new Set());
1222
+ e.set(t, {
1223
+ activeInputs: i,
1224
+ outputs: /* @__PURE__ */ new Set(),
1225
+ passiveInputs: /* @__PURE__ */ new WeakMap(),
1226
+ renderer: n
1227
+ });
1228
+ }, st = (e) => (t, n) => {
1229
+ e.set(t, {
1230
+ activeInputs: /* @__PURE__ */ new Set(),
1231
+ passiveInputs: /* @__PURE__ */ new WeakMap(),
1232
+ renderer: n
1233
+ });
1234
+ }, ct = /* @__PURE__ */ new WeakSet(), lt = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), _t = { construct() {
1235
+ return _t;
1236
+ } }, vt = (e) => {
1237
+ try {
1238
+ new new Proxy(e, _t)();
1239
+ } catch {
1240
+ return !1;
1241
+ }
1242
+ return !0;
1243
+ }, yt = /^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/, bt = (e, t) => {
1244
+ let n = [], r = e.replace(/^[\s]+/, ""), i = r.match(yt);
1245
+ for (; i !== null;) {
1246
+ let e = i[1].slice(1, -1), a = i[0].replace(/([\s]+)?;?$/, "").replace(e, new URL(e, t).toString());
1247
+ n.push(a), r = r.slice(i[0].length).replace(/^[\s]+/, ""), i = r.match(yt);
1248
+ }
1249
+ return [n.join(";"), r];
1250
+ }, xt = (e) => {
1251
+ if (e !== void 0 && !Array.isArray(e)) throw TypeError("The parameterDescriptors property of given value for processorCtor is not an array.");
1252
+ }, St = (e) => {
1253
+ if (!vt(e)) throw TypeError("The given value for processorCtor should be a constructor.");
1254
+ if (e.prototype === null || typeof e.prototype != "object") throw TypeError("The given value for processorCtor should have a prototype.");
1255
+ }, Ct = (e, t, n, r, i, a, o, s, c, l, u, d, f) => {
1256
+ let p = 0;
1257
+ return (m, h, g = { credentials: "omit" }) => {
1258
+ let _ = u.get(m);
1259
+ if (_ !== void 0 && _.has(h)) return Promise.resolve();
1260
+ let v = l.get(m);
1261
+ if (v !== void 0) {
1262
+ let e = v.get(h);
1263
+ if (e !== void 0) return e;
1264
+ }
1265
+ let y = a(m), b = y.audioWorklet === void 0 ? i(h).then(([e, t]) => {
1266
+ let [r, i] = bt(e, t);
1267
+ return n(`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${i}
1268
+ })})(window,'_AWGS')`);
1269
+ }).then(() => {
1270
+ let e = f._AWGS.pop();
1271
+ if (e === void 0) throw SyntaxError();
1272
+ r(y.currentTime, y.sampleRate, () => e(class {}, void 0, (e, n) => {
1273
+ if (e.trim() === "") throw t();
1274
+ let r = gt.get(y);
1275
+ if (r !== void 0) {
1276
+ if (r.has(e)) throw t();
1277
+ St(n), xt(n.parameterDescriptors), r.set(e, n);
1278
+ } else St(n), xt(n.parameterDescriptors), gt.set(y, /* @__PURE__ */ new Map([[e, n]]));
1279
+ }, y.sampleRate, void 0, void 0));
1280
+ }) : Promise.all([i(h), Promise.resolve(e(d, d))]).then(([[e, t], n]) => {
1281
+ let r = p + 1;
1282
+ p = r;
1283
+ let [i, a] = bt(e, t), l = `${i};((AudioWorkletProcessor,registerProcessor)=>{${a}
1284
+ })(${n ? "AudioWorkletProcessor" : "class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n ? "" : "__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n ? "" : "i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${r}',class extends AudioWorkletProcessor{process(){return !1}})`, u = new Blob([l], { type: "application/javascript; charset=utf-8" }), d = URL.createObjectURL(u);
1285
+ return y.audioWorklet.addModule(d, g).then(() => {
1286
+ if (s(y)) return y;
1287
+ let e = o(y);
1288
+ return e.audioWorklet.addModule(d, g).then(() => e);
1289
+ }).then((e) => {
1290
+ if (c === null) throw SyntaxError();
1291
+ try {
1292
+ new c(e, `__sac${r}`);
1293
+ } catch {
1294
+ throw SyntaxError();
1295
+ }
1296
+ }).finally(() => URL.revokeObjectURL(d));
1297
+ });
1298
+ return v === void 0 ? l.set(m, /* @__PURE__ */ new Map([[h, b]])) : v.set(h, b), b.then(() => {
1299
+ let e = u.get(m);
1300
+ e === void 0 ? u.set(m, /* @__PURE__ */ new Set([h])) : e.add(h);
1301
+ }).finally(() => {
1302
+ let e = l.get(m);
1303
+ e !== void 0 && e.delete(h);
1304
+ }), b;
1305
+ };
1306
+ }, wt = (e, t) => {
1307
+ let n = e.get(t);
1308
+ if (n === void 0) throw Error("A value with the given key could not be found.");
1309
+ return n;
1310
+ }, Tt = (e, t) => {
1311
+ let n = Array.from(e).filter(t);
1312
+ if (n.length > 1) throw Error("More than one element was found.");
1313
+ if (n.length === 0) throw Error("No element was found.");
1314
+ let [r] = n;
1315
+ return e.delete(r), r;
1316
+ }, Et = (e, t, n, r) => {
1317
+ let i = wt(e, t), a = Tt(i, (e) => e[0] === n && e[1] === r);
1318
+ return i.size === 0 && e.delete(t), a;
1319
+ }, Dt = (e) => wt(mt, e), Ot = (e) => {
1320
+ if (ct.has(e)) throw Error("The AudioNode is already stored.");
1321
+ ct.add(e), Dt(e).forEach((e) => e(!0));
1322
+ }, kt = (e) => "port" in e, At = (e) => {
1323
+ if (!ct.has(e)) throw Error("The AudioNode is not stored.");
1324
+ ct.delete(e), Dt(e).forEach((e) => e(!1));
1325
+ }, jt = (e, t) => {
1326
+ !kt(e) && t.every((e) => e.size === 0) && At(e);
1327
+ }, Mt = (e, t, n, r, i, a, o, s, c, l, u, d, f) => {
1328
+ let p = /* @__PURE__ */ new WeakMap();
1329
+ return (m, h, g, _, v) => {
1330
+ let { activeInputs: y, passiveInputs: b } = a(h), { outputs: x } = a(m), S = s(m), C = (a) => {
1331
+ let s = c(h), l = c(m);
1332
+ if (a) {
1333
+ let t = Et(b, m, g, _);
1334
+ e(y, m, t, !1), !v && !d(m) && n(l, s, g, _), f(h) && Ot(h);
1335
+ } else {
1336
+ let e = r(y, m, g, _);
1337
+ t(b, _, e, !1), !v && !d(m) && i(l, s, g, _);
1338
+ let n = o(h);
1339
+ if (n === 0) u(h) && jt(h, y);
1340
+ else {
1341
+ let e = p.get(h);
1342
+ e !== void 0 && clearTimeout(e), p.set(h, setTimeout(() => {
1343
+ u(h) && jt(h, y);
1344
+ }, n * 1e3));
1345
+ }
1346
+ }
1347
+ };
1348
+ return l(x, [
1349
+ h,
1350
+ g,
1351
+ _
1352
+ ], (e) => e[0] === h && e[1] === g && e[2] === _, !0) ? (S.add(C), u(m) ? e(y, m, [
1353
+ g,
1354
+ _,
1355
+ C
1356
+ ], !0) : t(b, _, [
1357
+ m,
1358
+ g,
1359
+ C
1360
+ ], !0), !0) : !1;
1361
+ };
1362
+ }, Nt = (e) => (t, n, [r, i, a], o) => {
1363
+ let s = t.get(r);
1364
+ s === void 0 ? t.set(r, /* @__PURE__ */ new Set([[
1365
+ i,
1366
+ n,
1367
+ a
1368
+ ]])) : e(s, [
1369
+ i,
1370
+ n,
1371
+ a
1372
+ ], (e) => e[0] === i && e[1] === n, o);
1373
+ }, Pt = (e) => (t, n) => {
1374
+ let r = e(t, {
1375
+ channelCount: 1,
1376
+ channelCountMode: "explicit",
1377
+ channelInterpretation: "discrete",
1378
+ gain: 0
1379
+ });
1380
+ n.connect(r).connect(t.destination);
1381
+ let i = () => {
1382
+ n.removeEventListener("ended", i), n.disconnect(r), r.disconnect();
1383
+ };
1384
+ n.addEventListener("ended", i);
1385
+ }, Ft = {
1386
+ channelCount: 2,
1387
+ channelCountMode: "max",
1388
+ channelInterpretation: "speakers",
1389
+ fftSize: 2048,
1390
+ maxDecibels: -30,
1391
+ minDecibels: -100,
1392
+ smoothingTimeConstant: .8
1393
+ }, It = (e, t, n, r, i, a) => class extends e {
1394
+ constructor(e, n) {
1395
+ let o = i(e), s = r(o, {
1396
+ ...Ft,
1397
+ ...n
1398
+ }), c = a(o) ? t() : null;
1399
+ super(e, !1, s, c), this._nativeAnalyserNode = s;
1400
+ }
1401
+ get fftSize() {
1402
+ return this._nativeAnalyserNode.fftSize;
1403
+ }
1404
+ set fftSize(e) {
1405
+ this._nativeAnalyserNode.fftSize = e;
1406
+ }
1407
+ get frequencyBinCount() {
1408
+ return this._nativeAnalyserNode.frequencyBinCount;
1409
+ }
1410
+ get maxDecibels() {
1411
+ return this._nativeAnalyserNode.maxDecibels;
1412
+ }
1413
+ set maxDecibels(e) {
1414
+ let t = this._nativeAnalyserNode.maxDecibels;
1415
+ if (this._nativeAnalyserNode.maxDecibels = e, !(e > this._nativeAnalyserNode.minDecibels)) throw this._nativeAnalyserNode.maxDecibels = t, n();
1416
+ }
1417
+ get minDecibels() {
1418
+ return this._nativeAnalyserNode.minDecibels;
1419
+ }
1420
+ set minDecibels(e) {
1421
+ let t = this._nativeAnalyserNode.minDecibels;
1422
+ if (this._nativeAnalyserNode.minDecibels = e, !(this._nativeAnalyserNode.maxDecibels > e)) throw this._nativeAnalyserNode.minDecibels = t, n();
1423
+ }
1424
+ get smoothingTimeConstant() {
1425
+ return this._nativeAnalyserNode.smoothingTimeConstant;
1426
+ }
1427
+ set smoothingTimeConstant(e) {
1428
+ this._nativeAnalyserNode.smoothingTimeConstant = e;
1429
+ }
1430
+ getByteFrequencyData(e) {
1431
+ this._nativeAnalyserNode.getByteFrequencyData(e);
1432
+ }
1433
+ getByteTimeDomainData(e) {
1434
+ this._nativeAnalyserNode.getByteTimeDomainData(e);
1435
+ }
1436
+ getFloatFrequencyData(e) {
1437
+ this._nativeAnalyserNode.getFloatFrequencyData(e);
1438
+ }
1439
+ getFloatTimeDomainData(e) {
1440
+ this._nativeAnalyserNode.getFloatTimeDomainData(e);
1441
+ }
1442
+ }, F = (e, t) => e.context === t, Lt = (e, t, n) => () => {
1443
+ let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
1444
+ let o = t(i);
1445
+ return F(o, a) || (o = e(a, {
1446
+ channelCount: o.channelCount,
1447
+ channelCountMode: o.channelCountMode,
1448
+ channelInterpretation: o.channelInterpretation,
1449
+ fftSize: o.fftSize,
1450
+ maxDecibels: o.maxDecibels,
1451
+ minDecibels: o.minDecibels,
1452
+ smoothingTimeConstant: o.smoothingTimeConstant
1453
+ })), r.set(a, o), await n(i, a, o), o;
1454
+ };
1455
+ return { render(e, t) {
1456
+ let n = r.get(t);
1457
+ return n === void 0 ? i(e, t) : Promise.resolve(n);
1458
+ } };
1459
+ }, Rt = (e) => {
1460
+ try {
1461
+ e.copyToChannel(/* @__PURE__ */ new Float32Array(1), 0, -1);
1462
+ } catch {
1463
+ return !1;
1464
+ }
1465
+ return !0;
1466
+ }, zt = () => new DOMException("", "IndexSizeError"), Bt = (e) => {
1467
+ e.getChannelData = ((t) => (n) => {
1468
+ try {
1469
+ return t.call(e, n);
1470
+ } catch (e) {
1471
+ throw e.code === 12 ? zt() : e;
1472
+ }
1473
+ })(e.getChannelData);
1474
+ }, Vt = { numberOfChannels: 1 }, Ht = (e, t, n, r, i, a, o, s) => {
1475
+ let c = null;
1476
+ return class l {
1477
+ constructor(l) {
1478
+ if (i === null) throw Error("Missing the native OfflineAudioContext constructor.");
1479
+ let { length: u, numberOfChannels: d, sampleRate: f } = {
1480
+ ...Vt,
1481
+ ...l
1482
+ };
1483
+ c === null && (c = new i(1, 1, 44100));
1484
+ let p = r !== null && t(a, a) ? new r({
1485
+ length: u,
1486
+ numberOfChannels: d,
1487
+ sampleRate: f
1488
+ }) : c.createBuffer(d, u, f);
1489
+ if (p.numberOfChannels === 0) throw n();
1490
+ return typeof p.copyFromChannel == "function" ? t(Rt, () => Rt(p)) || s(p) : (o(p), Bt(p)), e.add(p), p;
1491
+ }
1492
+ static [Symbol.hasInstance](t) {
1493
+ return typeof t == "object" && !!t && Object.getPrototypeOf(t) === l.prototype || e.has(t);
1494
+ }
1495
+ };
1496
+ }, I = -34028234663852886e22, L = 34028234663852886e22, Ut = (e) => ct.has(e), Wt = {
1497
+ buffer: null,
1498
+ channelCount: 2,
1499
+ channelCountMode: "max",
1500
+ channelInterpretation: "speakers",
1501
+ loop: !1,
1502
+ loopEnd: 0,
1503
+ loopStart: 0,
1504
+ playbackRate: 1
1505
+ }, Gt = (e, t, n, r, i, a, o, s) => class extends e {
1506
+ constructor(e, r) {
1507
+ let s = a(e), c = {
1508
+ ...Wt,
1509
+ ...r
1510
+ }, l = i(s, c), u = o(s), d = u ? t() : null;
1511
+ super(e, !1, l, d), this._audioBufferSourceNodeRenderer = d, this._isBufferNullified = !1, this._isBufferSet = c.buffer !== null, this._nativeAudioBufferSourceNode = l, this._onended = null, this._playbackRate = n(this, u, l.playbackRate, L, I);
1512
+ }
1513
+ get buffer() {
1514
+ return this._isBufferNullified ? null : this._nativeAudioBufferSourceNode.buffer;
1515
+ }
1516
+ set buffer(e) {
1517
+ if (this._nativeAudioBufferSourceNode.buffer = e, e !== null) {
1518
+ if (this._isBufferSet) throw r();
1519
+ this._isBufferSet = !0;
1520
+ }
1521
+ }
1522
+ get loop() {
1523
+ return this._nativeAudioBufferSourceNode.loop;
1524
+ }
1525
+ set loop(e) {
1526
+ this._nativeAudioBufferSourceNode.loop = e;
1527
+ }
1528
+ get loopEnd() {
1529
+ return this._nativeAudioBufferSourceNode.loopEnd;
1530
+ }
1531
+ set loopEnd(e) {
1532
+ this._nativeAudioBufferSourceNode.loopEnd = e;
1533
+ }
1534
+ get loopStart() {
1535
+ return this._nativeAudioBufferSourceNode.loopStart;
1536
+ }
1537
+ set loopStart(e) {
1538
+ this._nativeAudioBufferSourceNode.loopStart = e;
1539
+ }
1540
+ get onended() {
1541
+ return this._onended;
1542
+ }
1543
+ set onended(e) {
1544
+ let t = typeof e == "function" ? s(this, e) : null;
1545
+ this._nativeAudioBufferSourceNode.onended = t;
1546
+ let n = this._nativeAudioBufferSourceNode.onended;
1547
+ this._onended = n !== null && n === t ? e : n;
1548
+ }
1549
+ get playbackRate() {
1550
+ return this._playbackRate;
1551
+ }
1552
+ start(e = 0, t = 0, n) {
1553
+ if (this._nativeAudioBufferSourceNode.start(e, t, n), this._audioBufferSourceNodeRenderer !== null && (this._audioBufferSourceNodeRenderer.start = n === void 0 ? [e, t] : [
1554
+ e,
1555
+ t,
1556
+ n
1557
+ ]), this.context.state !== "closed") {
1558
+ Ot(this);
1559
+ let e = () => {
1560
+ this._nativeAudioBufferSourceNode.removeEventListener("ended", e), Ut(this) && At(this);
1561
+ };
1562
+ this._nativeAudioBufferSourceNode.addEventListener("ended", e);
1563
+ }
1564
+ }
1565
+ stop(e = 0) {
1566
+ this._nativeAudioBufferSourceNode.stop(e), this._audioBufferSourceNodeRenderer !== null && (this._audioBufferSourceNodeRenderer.stop = e);
1567
+ }
1568
+ }, Kt = (e, t, n, r, i) => () => {
1569
+ let a = /* @__PURE__ */ new WeakMap(), o = null, s = null, c = async (c, l) => {
1570
+ let u = n(c), d = F(u, l);
1571
+ return d || (u = t(l, {
1572
+ buffer: u.buffer,
1573
+ channelCount: u.channelCount,
1574
+ channelCountMode: u.channelCountMode,
1575
+ channelInterpretation: u.channelInterpretation,
1576
+ loop: u.loop,
1577
+ loopEnd: u.loopEnd,
1578
+ loopStart: u.loopStart,
1579
+ playbackRate: u.playbackRate.value
1580
+ }), o !== null && u.start(...o), s !== null && u.stop(s)), a.set(l, u), d ? await e(l, c.playbackRate, u.playbackRate) : await r(l, c.playbackRate, u.playbackRate), await i(c, l, u), u;
1581
+ };
1582
+ return {
1583
+ set start(e) {
1584
+ o = e;
1585
+ },
1586
+ set stop(e) {
1587
+ s = e;
1588
+ },
1589
+ render(e, t) {
1590
+ let n = a.get(t);
1591
+ return n === void 0 ? c(e, t) : Promise.resolve(n);
1592
+ }
1593
+ };
1594
+ }, qt = (e) => "playbackRate" in e, Jt = (e) => "frequency" in e && "gain" in e, Yt = (e) => "offset" in e, Xt = (e) => !("frequency" in e) && "gain" in e, Zt = (e) => "detune" in e && "frequency" in e && !("gain" in e), Qt = (e) => "pan" in e, R = (e) => wt(lt, e), $t = (e) => wt(dt, e), en = (e, t) => {
1595
+ let { activeInputs: n } = R(e);
1596
+ n.forEach((n) => n.forEach(([n]) => {
1597
+ t.includes(e) || en(n, [...t, e]);
1598
+ }));
1599
+ let r = qt(e) ? [e.playbackRate] : kt(e) ? Array.from(e.parameters.values()) : Jt(e) ? [
1600
+ e.Q,
1601
+ e.detune,
1602
+ e.frequency,
1603
+ e.gain
1604
+ ] : Yt(e) ? [e.offset] : Xt(e) ? [e.gain] : Zt(e) ? [e.detune, e.frequency] : Qt(e) ? [e.pan] : [];
1605
+ for (let e of r) {
1606
+ let n = $t(e);
1607
+ n !== void 0 && n.activeInputs.forEach(([e]) => en(e, t));
1608
+ }
1609
+ Ut(e) && At(e);
1610
+ }, tn = (e) => {
1611
+ en(e.destination, []);
1612
+ }, nn = (e) => e === void 0 || typeof e == "number" || typeof e == "string" && (e === "balanced" || e === "interactive" || e === "playback"), rn = (e, t, n, r, i, a, o, s, c) => class extends e {
1613
+ constructor(e = {}) {
1614
+ if (c === null) throw Error("Missing the native AudioContext constructor.");
1615
+ let t;
1616
+ try {
1617
+ t = new c(e);
1618
+ } catch (e) {
1619
+ throw e.code === 12 && e.message === "sampleRate is not in range" ? n() : e;
1620
+ }
1621
+ if (t === null) throw r();
1622
+ if (!nn(e.latencyHint)) throw TypeError(`The provided value '${e.latencyHint}' is not a valid enum value of type AudioContextLatencyCategory.`);
1623
+ if (e.sampleRate !== void 0 && t.sampleRate !== e.sampleRate) throw n();
1624
+ super(t, 2);
1625
+ let { latencyHint: i } = e, { sampleRate: a } = t;
1626
+ if (this._baseLatency = typeof t.baseLatency == "number" ? t.baseLatency : i === "balanced" ? 512 / a : i === "interactive" || i === void 0 ? 256 / a : i === "playback" ? 1024 / a : Math.max(2, Math.min(128, Math.round(i * a / 128))) * 128 / a, this._nativeAudioContext = t, c.name === "webkitAudioContext" ? (this._nativeGainNode = t.createGain(), this._nativeOscillatorNode = t.createOscillator(), this._nativeGainNode.gain.value = 1e-37, this._nativeOscillatorNode.connect(this._nativeGainNode).connect(t.destination), this._nativeOscillatorNode.start()) : (this._nativeGainNode = null, this._nativeOscillatorNode = null), this._state = null, t.state === "running") {
1627
+ this._state = "suspended";
1628
+ let e = () => {
1629
+ this._state === "suspended" && (this._state = null), t.removeEventListener("statechange", e);
1630
+ };
1631
+ t.addEventListener("statechange", e);
1632
+ }
1633
+ }
1634
+ get baseLatency() {
1635
+ return this._baseLatency;
1636
+ }
1637
+ get state() {
1638
+ return this._state === null ? this._nativeAudioContext.state : this._state;
1639
+ }
1640
+ close() {
1641
+ return this.state === "closed" ? this._nativeAudioContext.close().then(() => {
1642
+ throw t();
1643
+ }) : (this._state === "suspended" && (this._state = null), this._nativeAudioContext.close().then(() => {
1644
+ this._nativeGainNode !== null && this._nativeOscillatorNode !== null && (this._nativeOscillatorNode.stop(), this._nativeGainNode.disconnect(), this._nativeOscillatorNode.disconnect()), tn(this);
1645
+ }));
1646
+ }
1647
+ createMediaElementSource(e) {
1648
+ return new i(this, { mediaElement: e });
1649
+ }
1650
+ createMediaStreamDestination() {
1651
+ return new a(this);
1652
+ }
1653
+ createMediaStreamSource(e) {
1654
+ return new o(this, { mediaStream: e });
1655
+ }
1656
+ createMediaStreamTrackSource(e) {
1657
+ return new s(this, { mediaStreamTrack: e });
1658
+ }
1659
+ resume() {
1660
+ return this._state === "suspended" ? new Promise((e, t) => {
1661
+ let n = () => {
1662
+ this._nativeAudioContext.removeEventListener("statechange", n), this._nativeAudioContext.state === "running" ? e() : this.resume().then(e, t);
1663
+ };
1664
+ this._nativeAudioContext.addEventListener("statechange", n);
1665
+ }) : this._nativeAudioContext.resume().catch((e) => {
1666
+ throw e === void 0 || e.code === 15 ? t() : e;
1667
+ });
1668
+ }
1669
+ suspend() {
1670
+ return this._nativeAudioContext.suspend().catch((e) => {
1671
+ throw e === void 0 ? t() : e;
1672
+ });
1673
+ }
1674
+ }, an = (e, t, n, r, i, a, o, s) => class extends e {
1675
+ constructor(e, n) {
1676
+ let r = a(e), c = o(r), l = i(r, n, c), u = c ? t(s) : null;
1677
+ super(e, !1, l, u), this._isNodeOfNativeOfflineAudioContext = c, this._nativeAudioDestinationNode = l;
1678
+ }
1679
+ get channelCount() {
1680
+ return this._nativeAudioDestinationNode.channelCount;
1681
+ }
1682
+ set channelCount(e) {
1683
+ if (this._isNodeOfNativeOfflineAudioContext) throw r();
1684
+ if (e > this._nativeAudioDestinationNode.maxChannelCount) throw n();
1685
+ this._nativeAudioDestinationNode.channelCount = e;
1686
+ }
1687
+ get channelCountMode() {
1688
+ return this._nativeAudioDestinationNode.channelCountMode;
1689
+ }
1690
+ set channelCountMode(e) {
1691
+ if (this._isNodeOfNativeOfflineAudioContext) throw r();
1692
+ this._nativeAudioDestinationNode.channelCountMode = e;
1693
+ }
1694
+ get maxChannelCount() {
1695
+ return this._nativeAudioDestinationNode.maxChannelCount;
1696
+ }
1697
+ }, on = (e) => {
1698
+ let t = /* @__PURE__ */ new WeakMap(), n = async (n, r) => {
1699
+ let i = r.destination;
1700
+ return t.set(r, i), await e(n, r, i), i;
1701
+ };
1702
+ return { render(e, r) {
1703
+ let i = t.get(r);
1704
+ return i === void 0 ? n(e, r) : Promise.resolve(i);
1705
+ } };
1706
+ }, sn = (e, t, n, r, i, a, o, s) => (c, l) => {
1707
+ let u = l.listener, { forwardX: d, forwardY: f, forwardZ: p, positionX: m, positionY: h, positionZ: g, upX: _, upY: v, upZ: y } = u.forwardX === void 0 ? (() => {
1708
+ let d = /* @__PURE__ */ new Float32Array(1), f = t(l, {
1709
+ channelCount: 1,
1710
+ channelCountMode: "explicit",
1711
+ channelInterpretation: "speakers",
1712
+ numberOfInputs: 9
1713
+ }), p = o(l), m = !1, h = [
1714
+ 0,
1715
+ 0,
1716
+ -1,
1717
+ 0,
1718
+ 1,
1719
+ 0
1720
+ ], g = [
1721
+ 0,
1722
+ 0,
1723
+ 0
1724
+ ], _ = () => {
1725
+ if (m) return;
1726
+ m = !0;
1727
+ let e = r(l, 256, 9, 0);
1728
+ e.onaudioprocess = ({ inputBuffer: e }) => {
1729
+ let t = [
1730
+ a(e, d, 0),
1731
+ a(e, d, 1),
1732
+ a(e, d, 2),
1733
+ a(e, d, 3),
1734
+ a(e, d, 4),
1735
+ a(e, d, 5)
1736
+ ];
1737
+ t.some((e, t) => e !== h[t]) && (u.setOrientation(...t), h = t);
1738
+ let n = [
1739
+ a(e, d, 6),
1740
+ a(e, d, 7),
1741
+ a(e, d, 8)
1742
+ ];
1743
+ n.some((e, t) => e !== g[t]) && (u.setPosition(...n), g = n);
1744
+ }, f.connect(e);
1745
+ }, v = (e) => (t) => {
1746
+ t !== h[e] && (h[e] = t, u.setOrientation(...h));
1747
+ }, y = (e) => (t) => {
1748
+ t !== g[e] && (g[e] = t, u.setPosition(...g));
1749
+ }, b = (t, r, a) => {
1750
+ let o = n(l, {
1751
+ channelCount: 1,
1752
+ channelCountMode: "explicit",
1753
+ channelInterpretation: "discrete",
1754
+ offset: r
1755
+ });
1756
+ o.connect(f, 0, t), o.start(), Object.defineProperty(o.offset, "defaultValue", { get() {
1757
+ return r;
1758
+ } });
1759
+ let u = e({ context: c }, p, o.offset, L, I);
1760
+ return s(u, "value", (e) => () => e.call(u), (e) => (t) => {
1761
+ try {
1762
+ e.call(u, t);
1763
+ } catch (e) {
1764
+ if (e.code !== 9) throw e;
1765
+ }
1766
+ _(), p && a(t);
1767
+ }), u.cancelAndHoldAtTime = ((e) => p ? () => {
1768
+ throw i();
1769
+ } : (...t) => {
1770
+ let n = e.apply(u, t);
1771
+ return _(), n;
1772
+ })(u.cancelAndHoldAtTime), u.cancelScheduledValues = ((e) => p ? () => {
1773
+ throw i();
1774
+ } : (...t) => {
1775
+ let n = e.apply(u, t);
1776
+ return _(), n;
1777
+ })(u.cancelScheduledValues), u.exponentialRampToValueAtTime = ((e) => p ? () => {
1778
+ throw i();
1779
+ } : (...t) => {
1780
+ let n = e.apply(u, t);
1781
+ return _(), n;
1782
+ })(u.exponentialRampToValueAtTime), u.linearRampToValueAtTime = ((e) => p ? () => {
1783
+ throw i();
1784
+ } : (...t) => {
1785
+ let n = e.apply(u, t);
1786
+ return _(), n;
1787
+ })(u.linearRampToValueAtTime), u.setTargetAtTime = ((e) => p ? () => {
1788
+ throw i();
1789
+ } : (...t) => {
1790
+ let n = e.apply(u, t);
1791
+ return _(), n;
1792
+ })(u.setTargetAtTime), u.setValueAtTime = ((e) => p ? () => {
1793
+ throw i();
1794
+ } : (...t) => {
1795
+ let n = e.apply(u, t);
1796
+ return _(), n;
1797
+ })(u.setValueAtTime), u.setValueCurveAtTime = ((e) => p ? () => {
1798
+ throw i();
1799
+ } : (...t) => {
1800
+ let n = e.apply(u, t);
1801
+ return _(), n;
1802
+ })(u.setValueCurveAtTime), u;
1803
+ };
1804
+ return {
1805
+ forwardX: b(0, 0, v(0)),
1806
+ forwardY: b(1, 0, v(1)),
1807
+ forwardZ: b(2, -1, v(2)),
1808
+ positionX: b(6, 0, y(0)),
1809
+ positionY: b(7, 0, y(1)),
1810
+ positionZ: b(8, 0, y(2)),
1811
+ upX: b(3, 0, v(3)),
1812
+ upY: b(4, 1, v(4)),
1813
+ upZ: b(5, 0, v(5))
1814
+ };
1815
+ })() : u;
1816
+ return {
1817
+ get forwardX() {
1818
+ return d;
1819
+ },
1820
+ get forwardY() {
1821
+ return f;
1822
+ },
1823
+ get forwardZ() {
1824
+ return p;
1825
+ },
1826
+ get positionX() {
1827
+ return m;
1828
+ },
1829
+ get positionY() {
1830
+ return h;
1831
+ },
1832
+ get positionZ() {
1833
+ return g;
1834
+ },
1835
+ get upX() {
1836
+ return _;
1837
+ },
1838
+ get upY() {
1839
+ return v;
1840
+ },
1841
+ get upZ() {
1842
+ return y;
1843
+ }
1844
+ };
1845
+ }, cn = (e) => "context" in e, ln = (e) => cn(e[0]), un = (e, t, n, r) => {
1846
+ for (let t of e) if (n(t)) {
1847
+ if (r) return !1;
1848
+ throw Error("The set contains at least one similar element.");
1849
+ }
1850
+ return e.add(t), !0;
1851
+ }, dn = (e, t, [n, r], i) => {
1852
+ un(e, [
1853
+ t,
1854
+ n,
1855
+ r
1856
+ ], (e) => e[0] === t && e[1] === n, i);
1857
+ }, fn = (e, [t, n, r], i) => {
1858
+ let a = e.get(t);
1859
+ a === void 0 ? e.set(t, /* @__PURE__ */ new Set([[n, r]])) : un(a, [n, r], (e) => e[0] === n, i);
1860
+ }, pn = (e) => "inputs" in e, mn = (e, t, n, r) => {
1861
+ if (pn(t)) {
1862
+ let i = t.inputs[r];
1863
+ return e.connect(i, n, 0), [
1864
+ i,
1865
+ n,
1866
+ 0
1867
+ ];
1868
+ }
1869
+ return e.connect(t, n, r), [
1870
+ t,
1871
+ n,
1872
+ r
1873
+ ];
1874
+ }, hn = (e, t, n) => {
1875
+ for (let r of e) if (r[0] === t && r[1] === n) return e.delete(r), r;
1876
+ return null;
1877
+ }, gn = (e, t, n) => Tt(e, (e) => e[0] === t && e[1] === n), _n = (e, t) => {
1878
+ if (!Dt(e).delete(t)) throw Error("Missing the expected event listener.");
1879
+ }, vn = (e, t, n) => {
1880
+ let r = wt(e, t), i = Tt(r, (e) => e[0] === n);
1881
+ return r.size === 0 && e.delete(t), i;
1882
+ }, yn = (e, t, n, r) => {
1883
+ pn(t) ? e.disconnect(t.inputs[r], n, 0) : e.disconnect(t, n, r);
1884
+ }, z = (e) => wt(ut, e), bn = (e) => wt(ft, e), xn = (e) => ht.has(e), Sn = (e) => !ct.has(e), Cn = (e, t) => new Promise((n) => {
1885
+ if (t !== null) n(!0);
1886
+ else {
1887
+ let t = e.createScriptProcessor(256, 1, 1), r = e.createGain(), i = e.createBuffer(1, 2, 44100), a = i.getChannelData(0);
1888
+ a[0] = 1, a[1] = 1;
1889
+ let o = e.createBufferSource();
1890
+ o.buffer = i, o.loop = !0, o.connect(t).connect(e.destination), o.connect(r), o.disconnect(r), t.onaudioprocess = (r) => {
1891
+ let i = r.inputBuffer.getChannelData(0);
1892
+ Array.prototype.some.call(i, (e) => e === 1) ? n(!0) : n(!1), o.stop(), t.onaudioprocess = null, o.disconnect(t), t.disconnect(e.destination);
1893
+ }, o.start();
1894
+ }
1895
+ }), wn = (e, t) => {
1896
+ let n = /* @__PURE__ */ new Map();
1897
+ for (let t of e) for (let e of t) {
1898
+ let t = n.get(e);
1899
+ n.set(e, t === void 0 ? 1 : t + 1);
1900
+ }
1901
+ n.forEach((e, n) => t(n, e));
1902
+ }, Tn = (e) => "context" in e, En = (e) => {
1903
+ let t = /* @__PURE__ */ new Map();
1904
+ e.connect = ((e) => (n, r = 0, i = 0) => {
1905
+ let a = Tn(n) ? e(n, r, i) : e(n, r), o = t.get(n);
1906
+ return o === void 0 ? t.set(n, [{
1907
+ input: i,
1908
+ output: r
1909
+ }]) : o.every((e) => e.input !== i || e.output !== r) && o.push({
1910
+ input: i,
1911
+ output: r
1912
+ }), a;
1913
+ })(e.connect.bind(e)), e.disconnect = ((n) => (r, i, a) => {
1914
+ if (n.apply(e), r === void 0) t.clear();
1915
+ else if (typeof r == "number") for (let [e, n] of t) {
1916
+ let i = n.filter((e) => e.output !== r);
1917
+ i.length === 0 ? t.delete(e) : t.set(e, i);
1918
+ }
1919
+ else if (t.has(r)) if (i === void 0) t.delete(r);
1920
+ else {
1921
+ let e = t.get(r);
1922
+ if (e !== void 0) {
1923
+ let n = e.filter((e) => e.output !== i && (e.input !== a || a === void 0));
1924
+ n.length === 0 ? t.delete(r) : t.set(r, n);
1925
+ }
1926
+ }
1927
+ for (let [n, r] of t) r.forEach((t) => {
1928
+ Tn(n) ? e.connect(n, t.output, t.input) : e.connect(n, t.output);
1929
+ });
1930
+ })(e.disconnect);
1931
+ }, Dn = (e, t, n, r) => {
1932
+ let { activeInputs: i, passiveInputs: a } = $t(t), { outputs: o } = R(e), s = Dt(e), c = (o) => {
1933
+ let s = z(e), c = bn(t);
1934
+ if (o) {
1935
+ let t = vn(a, e, n);
1936
+ dn(i, e, t, !1), !r && !xn(e) && s.connect(c, n);
1937
+ } else {
1938
+ let t = gn(i, e, n);
1939
+ fn(a, t, !1), !r && !xn(e) && s.disconnect(c, n);
1940
+ }
1941
+ };
1942
+ return un(o, [t, n], (e) => e[0] === t && e[1] === n, !0) ? (s.add(c), Ut(e) ? dn(i, e, [n, c], !0) : fn(a, [
1943
+ e,
1944
+ n,
1945
+ c
1946
+ ], !0), !0) : !1;
1947
+ }, On = (e, t, n, r) => {
1948
+ let { activeInputs: i, passiveInputs: a } = R(t), o = hn(i[r], e, n);
1949
+ return o === null ? [Et(a, e, n, r)[2], !1] : [o[2], !0];
1950
+ }, kn = (e, t, n) => {
1951
+ let { activeInputs: r, passiveInputs: i } = $t(t), a = hn(r, e, n);
1952
+ return a === null ? [vn(i, e, n)[1], !1] : [a[2], !0];
1953
+ }, An = (e, t, n, r, i) => {
1954
+ let [a, o] = On(e, n, r, i);
1955
+ if (a !== null && (_n(e, a), o && !t && !xn(e) && yn(z(e), z(n), r, i)), Ut(n)) {
1956
+ let { activeInputs: e } = R(n);
1957
+ jt(n, e);
1958
+ }
1959
+ }, jn = (e, t, n, r) => {
1960
+ let [i, a] = kn(e, n, r);
1961
+ i !== null && (_n(e, i), a && !t && !xn(e) && z(e).disconnect(bn(n), r));
1962
+ }, Mn = (e, t) => {
1963
+ let n = R(e), r = [];
1964
+ for (let i of n.outputs) ln(i) ? An(e, t, ...i) : jn(e, t, ...i), r.push(i[0]);
1965
+ return n.outputs.clear(), r;
1966
+ }, Nn = (e, t, n) => {
1967
+ let r = R(e), i = [];
1968
+ for (let a of r.outputs) a[1] === n && (ln(a) ? An(e, t, ...a) : jn(e, t, ...a), i.push(a[0]), r.outputs.delete(a));
1969
+ return i;
1970
+ }, Pn = (e, t, n, r, i) => {
1971
+ let a = R(e);
1972
+ return Array.from(a.outputs).filter((e) => e[0] === n && (r === void 0 || e[1] === r) && (i === void 0 || e[2] === i)).map((n) => (ln(n) ? An(e, t, ...n) : jn(e, t, ...n), a.outputs.delete(n), n[0]));
1973
+ }, Fn = (e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) => class extends l {
1974
+ constructor(t, r, i, a) {
1975
+ super(i), this._context = t, this._nativeAudioNode = i;
1976
+ let o = u(t);
1977
+ d(o) && !0 !== n(Cn, () => Cn(o, h)) && En(i), ut.set(this, i), mt.set(this, /* @__PURE__ */ new Set()), t.state !== "closed" && r && Ot(this), e(this, a, i);
1978
+ }
1979
+ get channelCount() {
1980
+ return this._nativeAudioNode.channelCount;
1981
+ }
1982
+ set channelCount(e) {
1983
+ this._nativeAudioNode.channelCount = e;
1984
+ }
1985
+ get channelCountMode() {
1986
+ return this._nativeAudioNode.channelCountMode;
1987
+ }
1988
+ set channelCountMode(e) {
1989
+ this._nativeAudioNode.channelCountMode = e;
1990
+ }
1991
+ get channelInterpretation() {
1992
+ return this._nativeAudioNode.channelInterpretation;
1993
+ }
1994
+ set channelInterpretation(e) {
1995
+ this._nativeAudioNode.channelInterpretation = e;
1996
+ }
1997
+ get context() {
1998
+ return this._context;
1999
+ }
2000
+ get numberOfInputs() {
2001
+ return this._nativeAudioNode.numberOfInputs;
2002
+ }
2003
+ get numberOfOutputs() {
2004
+ return this._nativeAudioNode.numberOfOutputs;
2005
+ }
2006
+ connect(e, n = 0, s = 0) {
2007
+ if (n < 0 || n >= this._nativeAudioNode.numberOfOutputs) throw i();
2008
+ let l = m(u(this._context));
2009
+ if (f(e) || p(e)) throw a();
2010
+ if (cn(e)) {
2011
+ let i = z(e);
2012
+ try {
2013
+ let t = mn(this._nativeAudioNode, i, n, s), r = Sn(this);
2014
+ (l || r) && this._nativeAudioNode.disconnect(...t), this.context.state !== "closed" && !r && Sn(e) && Ot(e);
2015
+ } catch (e) {
2016
+ throw e.code === 12 ? a() : e;
2017
+ }
2018
+ return t(this, e, n, s, l) && wn(c([this], e), r(l)), e;
2019
+ }
2020
+ let d = bn(e);
2021
+ if (d.name === "playbackRate" && d.maxValue === 1024) throw o();
2022
+ try {
2023
+ this._nativeAudioNode.connect(d, n), (l || Sn(this)) && this._nativeAudioNode.disconnect(d, n);
2024
+ } catch (e) {
2025
+ throw e.code === 12 ? a() : e;
2026
+ }
2027
+ Dn(this, e, n, l) && wn(c([this], e), r(l));
2028
+ }
2029
+ disconnect(e, t, n) {
2030
+ let r, o = m(u(this._context));
2031
+ if (e === void 0) r = Mn(this, o);
2032
+ else if (typeof e == "number") {
2033
+ if (e < 0 || e >= this.numberOfOutputs) throw i();
2034
+ r = Nn(this, o, e);
2035
+ } else {
2036
+ if (t !== void 0 && (t < 0 || t >= this.numberOfOutputs) || cn(e) && n !== void 0 && (n < 0 || n >= e.numberOfInputs)) throw i();
2037
+ if (r = Pn(this, o, e, t, n), r.length === 0) throw a();
2038
+ }
2039
+ for (let e of r) wn(c([this], e), s);
2040
+ }
2041
+ }, In = (e, t, n, r, i, a, o, s, c, l, u, d, f) => (p, m, h, g = null, _ = null) => {
2042
+ let v = h.value, y = new rt.AutomationEventList(v), b = m ? r(y) : null, x = {
2043
+ get defaultValue() {
2044
+ return v;
2045
+ },
2046
+ get maxValue() {
2047
+ return g === null ? h.maxValue : g;
2048
+ },
2049
+ get minValue() {
2050
+ return _ === null ? h.minValue : _;
2051
+ },
2052
+ get value() {
2053
+ return h.value;
2054
+ },
2055
+ set value(e) {
2056
+ h.value = e, x.setValueAtTime(e, p.context.currentTime);
2057
+ },
2058
+ cancelAndHoldAtTime(e) {
2059
+ if (typeof h.cancelAndHoldAtTime == "function") b === null && y.flush(p.context.currentTime), y.add(i(e)), h.cancelAndHoldAtTime(e);
2060
+ else {
2061
+ let t = Array.from(y).pop();
2062
+ b === null && y.flush(p.context.currentTime), y.add(i(e));
2063
+ let n = Array.from(y).pop();
2064
+ h.cancelScheduledValues(e), t !== n && n !== void 0 && (n.type === "exponentialRampToValue" ? h.exponentialRampToValueAtTime(n.value, n.endTime) : n.type === "linearRampToValue" ? h.linearRampToValueAtTime(n.value, n.endTime) : n.type === "setValue" ? h.setValueAtTime(n.value, n.startTime) : n.type === "setValueCurve" && h.setValueCurveAtTime(n.values, n.startTime, n.duration));
2065
+ }
2066
+ return x;
2067
+ },
2068
+ cancelScheduledValues(e) {
2069
+ return b === null && y.flush(p.context.currentTime), y.add(a(e)), h.cancelScheduledValues(e), x;
2070
+ },
2071
+ exponentialRampToValueAtTime(e, t) {
2072
+ if (e === 0 || !Number.isFinite(t) || t < 0) throw RangeError();
2073
+ let n = p.context.currentTime;
2074
+ return b === null && y.flush(n), Array.from(y).length === 0 && (y.add(l(v, n)), h.setValueAtTime(v, n)), y.add(o(e, t)), h.exponentialRampToValueAtTime(e, t), x;
2075
+ },
2076
+ linearRampToValueAtTime(e, t) {
2077
+ let n = p.context.currentTime;
2078
+ return b === null && y.flush(n), Array.from(y).length === 0 && (y.add(l(v, n)), h.setValueAtTime(v, n)), y.add(s(e, t)), h.linearRampToValueAtTime(e, t), x;
2079
+ },
2080
+ setTargetAtTime(e, t, n) {
2081
+ return b === null && y.flush(p.context.currentTime), y.add(c(e, t, n)), h.setTargetAtTime(e, t, n), x;
2082
+ },
2083
+ setValueAtTime(e, t) {
2084
+ return b === null && y.flush(p.context.currentTime), y.add(l(e, t)), h.setValueAtTime(e, t), x;
2085
+ },
2086
+ setValueCurveAtTime(e, t, n) {
2087
+ let r = e instanceof Float32Array ? e : new Float32Array(e);
2088
+ if (d !== null && d.name === "webkitAudioContext") {
2089
+ let e = t + n, i = p.context.sampleRate, a = Math.ceil(t * i), o = Math.floor(e * i), s = o - a, c = new Float32Array(s);
2090
+ for (let e = 0; e < s; e += 1) {
2091
+ let o = (r.length - 1) / n * ((a + e) / i - t), s = Math.floor(o), l = Math.ceil(o);
2092
+ c[e] = s === l ? r[s] : (1 - (o - s)) * r[s] + (1 - (l - o)) * r[l];
2093
+ }
2094
+ b === null && y.flush(p.context.currentTime), y.add(u(c, t, n)), h.setValueCurveAtTime(c, t, n);
2095
+ let l = o / i;
2096
+ l < e && f(x, c[c.length - 1], l), f(x, r[r.length - 1], e);
2097
+ } else b === null && y.flush(p.context.currentTime), y.add(u(r, t, n)), h.setValueCurveAtTime(r, t, n);
2098
+ return x;
2099
+ }
2100
+ };
2101
+ return n.set(x, h), t.set(x, p), e(x, b), x;
2102
+ }, Ln = (e) => ({ replay(t) {
2103
+ for (let n of e) if (n.type === "exponentialRampToValue") {
2104
+ let { endTime: e, value: r } = n;
2105
+ t.exponentialRampToValueAtTime(r, e);
2106
+ } else if (n.type === "linearRampToValue") {
2107
+ let { endTime: e, value: r } = n;
2108
+ t.linearRampToValueAtTime(r, e);
2109
+ } else if (n.type === "setTarget") {
2110
+ let { startTime: e, target: r, timeConstant: i } = n;
2111
+ t.setTargetAtTime(r, e, i);
2112
+ } else if (n.type === "setValue") {
2113
+ let { startTime: e, value: r } = n;
2114
+ t.setValueAtTime(r, e);
2115
+ } else if (n.type === "setValueCurve") {
2116
+ let { duration: e, startTime: r, values: i } = n;
2117
+ t.setValueCurveAtTime(i, r, e);
2118
+ } else throw Error("Can't apply an unknown automation.");
2119
+ } }), Rn = (e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y) => class extends m {
2120
+ constructor(t, n) {
2121
+ super(t, n), this._nativeContext = t, this._audioWorklet = e === void 0 ? void 0 : { addModule: (t, n) => e(this, t, n) };
2122
+ }
2123
+ get audioWorklet() {
2124
+ return this._audioWorklet;
2125
+ }
2126
+ createAnalyser() {
2127
+ return new t(this);
2128
+ }
2129
+ createBiquadFilter() {
2130
+ return new i(this);
2131
+ }
2132
+ createBuffer(e, t, r) {
2133
+ return new n({
2134
+ length: t,
2135
+ numberOfChannels: e,
2136
+ sampleRate: r
2137
+ });
2138
+ }
2139
+ createBufferSource() {
2140
+ return new r(this);
2141
+ }
2142
+ createChannelMerger(e = 6) {
2143
+ return new a(this, { numberOfInputs: e });
2144
+ }
2145
+ createChannelSplitter(e = 6) {
2146
+ return new o(this, { numberOfOutputs: e });
2147
+ }
2148
+ createConstantSource() {
2149
+ return new s(this);
2150
+ }
2151
+ createConvolver() {
2152
+ return new c(this);
2153
+ }
2154
+ createDelay(e = 1) {
2155
+ return new u(this, { maxDelayTime: e });
2156
+ }
2157
+ createDynamicsCompressor() {
2158
+ return new d(this);
2159
+ }
2160
+ createGain() {
2161
+ return new f(this);
2162
+ }
2163
+ createIIRFilter(e, t) {
2164
+ return new p(this, {
2165
+ feedback: t,
2166
+ feedforward: e
2167
+ });
2168
+ }
2169
+ createOscillator() {
2170
+ return new h(this);
2171
+ }
2172
+ createPanner() {
2173
+ return new g(this);
2174
+ }
2175
+ createPeriodicWave(e, t, n = { disableNormalization: !1 }) {
2176
+ return new _(this, {
2177
+ ...n,
2178
+ imag: t,
2179
+ real: e
2180
+ });
2181
+ }
2182
+ createStereoPanner() {
2183
+ return new v(this);
2184
+ }
2185
+ createWaveShaper() {
2186
+ return new y(this);
2187
+ }
2188
+ decodeAudioData(e, t, n) {
2189
+ return l(this._nativeContext, e).then((e) => (typeof t == "function" && t(e), e), (e) => {
2190
+ throw typeof n == "function" && n(e), e;
2191
+ });
2192
+ }
2193
+ }, zn = {
2194
+ Q: 1,
2195
+ channelCount: 2,
2196
+ channelCountMode: "max",
2197
+ channelInterpretation: "speakers",
2198
+ detune: 0,
2199
+ frequency: 350,
2200
+ gain: 0,
2201
+ type: "lowpass"
2202
+ }, Bn = (e, t, n, r, i, a, o, s) => class extends e {
2203
+ constructor(e, r) {
2204
+ let c = a(e), l = i(c, {
2205
+ ...zn,
2206
+ ...r
2207
+ }), u = o(c), d = u ? n() : null;
2208
+ super(e, !1, l, d), this._Q = t(this, u, l.Q, L, I), this._detune = t(this, u, l.detune, 1200 * Math.log2(L), -1200 * Math.log2(L)), this._frequency = t(this, u, l.frequency, e.sampleRate / 2, 0), this._gain = t(this, u, l.gain, 40 * Math.log10(L), I), this._nativeBiquadFilterNode = l, s(this, 1);
2209
+ }
2210
+ get detune() {
2211
+ return this._detune;
2212
+ }
2213
+ get frequency() {
2214
+ return this._frequency;
2215
+ }
2216
+ get gain() {
2217
+ return this._gain;
2218
+ }
2219
+ get Q() {
2220
+ return this._Q;
2221
+ }
2222
+ get type() {
2223
+ return this._nativeBiquadFilterNode.type;
2224
+ }
2225
+ set type(e) {
2226
+ this._nativeBiquadFilterNode.type = e;
2227
+ }
2228
+ getFrequencyResponse(e, t, n) {
2229
+ try {
2230
+ this._nativeBiquadFilterNode.getFrequencyResponse(e, t, n);
2231
+ } catch (e) {
2232
+ throw e.code === 11 ? r() : e;
2233
+ }
2234
+ if (e.length !== t.length || t.length !== n.length) throw r();
2235
+ }
2236
+ }, Vn = (e, t, n, r, i) => () => {
2237
+ let a = /* @__PURE__ */ new WeakMap(), o = async (o, s) => {
2238
+ let c = n(o), l = F(c, s);
2239
+ return l || (c = t(s, {
2240
+ Q: c.Q.value,
2241
+ channelCount: c.channelCount,
2242
+ channelCountMode: c.channelCountMode,
2243
+ channelInterpretation: c.channelInterpretation,
2244
+ detune: c.detune.value,
2245
+ frequency: c.frequency.value,
2246
+ gain: c.gain.value,
2247
+ type: c.type
2248
+ })), a.set(s, c), l ? (await e(s, o.Q, c.Q), await e(s, o.detune, c.detune), await e(s, o.frequency, c.frequency), await e(s, o.gain, c.gain)) : (await r(s, o.Q, c.Q), await r(s, o.detune, c.detune), await r(s, o.frequency, c.frequency), await r(s, o.gain, c.gain)), await i(o, s, c), c;
2249
+ };
2250
+ return { render(e, t) {
2251
+ let n = a.get(t);
2252
+ return n === void 0 ? o(e, t) : Promise.resolve(n);
2253
+ } };
2254
+ }, Hn = (e, t) => (n, r) => {
2255
+ let i = t.get(n);
2256
+ if (i !== void 0) return i;
2257
+ let a = e.get(n);
2258
+ if (a !== void 0) return a;
2259
+ try {
2260
+ let i = r();
2261
+ return i instanceof Promise ? (e.set(n, i), i.catch(() => !1).then((r) => (e.delete(n), t.set(n, r), r))) : (t.set(n, i), i);
2262
+ } catch {
2263
+ return t.set(n, !1), !1;
2264
+ }
2265
+ }, Un = {
2266
+ channelCount: 1,
2267
+ channelCountMode: "explicit",
2268
+ channelInterpretation: "speakers",
2269
+ numberOfInputs: 6
2270
+ }, Wn = (e, t, n, r, i) => class extends e {
2271
+ constructor(e, a) {
2272
+ let o = r(e), s = n(o, {
2273
+ ...Un,
2274
+ ...a
2275
+ }), c = i(o) ? t() : null;
2276
+ super(e, !1, s, c);
2277
+ }
2278
+ }, Gn = (e, t, n) => () => {
2279
+ let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
2280
+ let o = t(i);
2281
+ return F(o, a) || (o = e(a, {
2282
+ channelCount: o.channelCount,
2283
+ channelCountMode: o.channelCountMode,
2284
+ channelInterpretation: o.channelInterpretation,
2285
+ numberOfInputs: o.numberOfInputs
2286
+ })), r.set(a, o), await n(i, a, o), o;
2287
+ };
2288
+ return { render(e, t) {
2289
+ let n = r.get(t);
2290
+ return n === void 0 ? i(e, t) : Promise.resolve(n);
2291
+ } };
2292
+ }, Kn = {
2293
+ channelCount: 6,
2294
+ channelCountMode: "explicit",
2295
+ channelInterpretation: "discrete",
2296
+ numberOfOutputs: 6
2297
+ }, qn = (e, t, n, r, i, a) => class extends e {
2298
+ constructor(e, o) {
2299
+ let s = r(e), c = n(s, a({
2300
+ ...Kn,
2301
+ ...o
2302
+ })), l = i(s) ? t() : null;
2303
+ super(e, !1, c, l);
2304
+ }
2305
+ }, Jn = (e, t, n) => () => {
2306
+ let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
2307
+ let o = t(i);
2308
+ return F(o, a) || (o = e(a, {
2309
+ channelCount: o.channelCount,
2310
+ channelCountMode: o.channelCountMode,
2311
+ channelInterpretation: o.channelInterpretation,
2312
+ numberOfOutputs: o.numberOfOutputs
2313
+ })), r.set(a, o), await n(i, a, o), o;
2314
+ };
2315
+ return { render(e, t) {
2316
+ let n = r.get(t);
2317
+ return n === void 0 ? i(e, t) : Promise.resolve(n);
2318
+ } };
2319
+ }, Yn = (e) => (t, n, r) => e(n, t, r), Xn = (e) => (t, n) => {
2320
+ let r = e(t, {
2321
+ buffer: null,
2322
+ channelCount: 2,
2323
+ channelCountMode: "max",
2324
+ channelInterpretation: "speakers",
2325
+ loop: !1,
2326
+ loopEnd: 0,
2327
+ loopStart: 0,
2328
+ playbackRate: 1
2329
+ });
2330
+ return r.buffer = t.createBuffer(1, 2, 44100), r.loop = !0, r.connect(n), r.start(), () => {
2331
+ r.stop(), r.disconnect(n);
2332
+ };
2333
+ }, Zn = {
2334
+ channelCount: 2,
2335
+ channelCountMode: "max",
2336
+ channelInterpretation: "speakers",
2337
+ offset: 1
2338
+ }, Qn = (e, t, n, r, i, a, o) => class extends e {
2339
+ constructor(e, o) {
2340
+ let s = i(e), c = r(s, {
2341
+ ...Zn,
2342
+ ...o
2343
+ }), l = a(s), u = l ? n() : null;
2344
+ super(e, !1, c, u), this._constantSourceNodeRenderer = u, this._nativeConstantSourceNode = c, this._offset = t(this, l, c.offset, L, I), this._onended = null;
2345
+ }
2346
+ get offset() {
2347
+ return this._offset;
2348
+ }
2349
+ get onended() {
2350
+ return this._onended;
2351
+ }
2352
+ set onended(e) {
2353
+ let t = typeof e == "function" ? o(this, e) : null;
2354
+ this._nativeConstantSourceNode.onended = t;
2355
+ let n = this._nativeConstantSourceNode.onended;
2356
+ this._onended = n !== null && n === t ? e : n;
2357
+ }
2358
+ start(e = 0) {
2359
+ if (this._nativeConstantSourceNode.start(e), this._constantSourceNodeRenderer !== null && (this._constantSourceNodeRenderer.start = e), this.context.state !== "closed") {
2360
+ Ot(this);
2361
+ let e = () => {
2362
+ this._nativeConstantSourceNode.removeEventListener("ended", e), Ut(this) && At(this);
2363
+ };
2364
+ this._nativeConstantSourceNode.addEventListener("ended", e);
2365
+ }
2366
+ }
2367
+ stop(e = 0) {
2368
+ this._nativeConstantSourceNode.stop(e), this._constantSourceNodeRenderer !== null && (this._constantSourceNodeRenderer.stop = e);
2369
+ }
2370
+ }, $n = (e, t, n, r, i) => () => {
2371
+ let a = /* @__PURE__ */ new WeakMap(), o = null, s = null, c = async (c, l) => {
2372
+ let u = n(c), d = F(u, l);
2373
+ return d || (u = t(l, {
2374
+ channelCount: u.channelCount,
2375
+ channelCountMode: u.channelCountMode,
2376
+ channelInterpretation: u.channelInterpretation,
2377
+ offset: u.offset.value
2378
+ }), o !== null && u.start(o), s !== null && u.stop(s)), a.set(l, u), d ? await e(l, c.offset, u.offset) : await r(l, c.offset, u.offset), await i(c, l, u), u;
2379
+ };
2380
+ return {
2381
+ set start(e) {
2382
+ o = e;
2383
+ },
2384
+ set stop(e) {
2385
+ s = e;
2386
+ },
2387
+ render(e, t) {
2388
+ let n = a.get(t);
2389
+ return n === void 0 ? c(e, t) : Promise.resolve(n);
2390
+ }
2391
+ };
2392
+ }, er = (e) => (t) => (e[0] = t, e[0]), tr = {
2393
+ buffer: null,
2394
+ channelCount: 2,
2395
+ channelCountMode: "clamped-max",
2396
+ channelInterpretation: "speakers",
2397
+ disableNormalization: !1
2398
+ }, nr = (e, t, n, r, i, a) => class extends e {
2399
+ constructor(e, o) {
2400
+ let s = r(e), c = {
2401
+ ...tr,
2402
+ ...o
2403
+ }, l = n(s, c), u = i(s) ? t() : null;
2404
+ super(e, !1, l, u), this._isBufferNullified = !1, this._nativeConvolverNode = l, c.buffer !== null && a(this, c.buffer.duration);
2405
+ }
2406
+ get buffer() {
2407
+ return this._isBufferNullified ? null : this._nativeConvolverNode.buffer;
2408
+ }
2409
+ set buffer(e) {
2410
+ if (this._nativeConvolverNode.buffer = e, e === null && this._nativeConvolverNode.buffer !== null) {
2411
+ let e = this._nativeConvolverNode.context;
2412
+ this._nativeConvolverNode.buffer = e.createBuffer(1, 1, e.sampleRate), this._isBufferNullified = !0, a(this, 0);
2413
+ } else this._isBufferNullified = !1, a(this, this._nativeConvolverNode.buffer === null ? 0 : this._nativeConvolverNode.buffer.duration);
2414
+ }
2415
+ get normalize() {
2416
+ return this._nativeConvolverNode.normalize;
2417
+ }
2418
+ set normalize(e) {
2419
+ this._nativeConvolverNode.normalize = e;
2420
+ }
2421
+ }, rr = (e, t, n) => () => {
2422
+ let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
2423
+ let o = t(i);
2424
+ return F(o, a) || (o = e(a, {
2425
+ buffer: o.buffer,
2426
+ channelCount: o.channelCount,
2427
+ channelCountMode: o.channelCountMode,
2428
+ channelInterpretation: o.channelInterpretation,
2429
+ disableNormalization: !o.normalize
2430
+ })), r.set(a, o), pn(o) ? await n(i, a, o.inputs[0]) : await n(i, a, o), o;
2431
+ };
2432
+ return { render(e, t) {
2433
+ let n = r.get(t);
2434
+ return n === void 0 ? i(e, t) : Promise.resolve(n);
2435
+ } };
2436
+ }, ir = () => new DOMException("", "DataCloneError"), ar = (e) => {
2437
+ let { port1: t, port2: n } = new MessageChannel();
2438
+ return new Promise((r) => {
2439
+ let i = () => {
2440
+ n.onmessage = null, t.close(), n.close(), r();
2441
+ };
2442
+ n.onmessage = () => i();
2443
+ try {
2444
+ t.postMessage(e, [e]);
2445
+ } catch {} finally {
2446
+ i();
2447
+ }
2448
+ });
2449
+ }, or = (e, t, n, r, i, a, o, s, c, l, u) => (d, f) => {
2450
+ let p = o(d) ? d : a(d);
2451
+ if (i.has(f)) {
2452
+ let e = n();
2453
+ return Promise.reject(e);
2454
+ }
2455
+ try {
2456
+ i.add(f);
2457
+ } catch {}
2458
+ return t(c, () => c(p)) ? p.decodeAudioData(f).then((n) => (ar(f).catch(() => {}), t(s, () => s(n)) || u(n), e.add(n), n)) : new Promise((t, n) => {
2459
+ let i = async () => {
2460
+ try {
2461
+ await ar(f);
2462
+ } catch {}
2463
+ }, a = (e) => {
2464
+ n(e), i();
2465
+ };
2466
+ try {
2467
+ p.decodeAudioData(f, (n) => {
2468
+ typeof n.copyFromChannel != "function" && (l(n), Bt(n)), e.add(n), i().then(() => t(n));
2469
+ }, (e) => {
2470
+ a(e === null ? r() : e);
2471
+ });
2472
+ } catch (e) {
2473
+ a(e);
2474
+ }
2475
+ });
2476
+ }, sr = (e, t, n, r, i, a, o, s) => (c, l) => {
2477
+ let u = t.get(c);
2478
+ if (u === void 0) throw Error("Missing the expected cycle count.");
2479
+ let d = s(a(c.context));
2480
+ if (u === l) {
2481
+ if (t.delete(c), !d && o(c)) {
2482
+ let t = r(c), { outputs: a } = n(c);
2483
+ for (let n of a) if (ln(n)) e(t, r(n[0]), n[1], n[2]);
2484
+ else {
2485
+ let e = i(n[0]);
2486
+ t.connect(e, n[1]);
2487
+ }
2488
+ }
2489
+ } else t.set(c, u - l);
2490
+ }, cr = {
2491
+ channelCount: 2,
2492
+ channelCountMode: "max",
2493
+ channelInterpretation: "speakers",
2494
+ delayTime: 0,
2495
+ maxDelayTime: 1
2496
+ }, lr = (e, t, n, r, i, a, o) => class extends e {
2497
+ constructor(e, s) {
2498
+ let c = i(e), l = {
2499
+ ...cr,
2500
+ ...s
2501
+ }, u = r(c, l), d = a(c), f = d ? n(l.maxDelayTime) : null;
2502
+ super(e, !1, u, f), this._delayTime = t(this, d, u.delayTime), o(this, l.maxDelayTime);
2503
+ }
2504
+ get delayTime() {
2505
+ return this._delayTime;
2506
+ }
2507
+ }, ur = (e, t, n, r, i) => (a) => {
2508
+ let o = /* @__PURE__ */ new WeakMap(), s = async (s, c) => {
2509
+ let l = n(s), u = F(l, c);
2510
+ return u || (l = t(c, {
2511
+ channelCount: l.channelCount,
2512
+ channelCountMode: l.channelCountMode,
2513
+ channelInterpretation: l.channelInterpretation,
2514
+ delayTime: l.delayTime.value,
2515
+ maxDelayTime: a
2516
+ })), o.set(c, l), u ? await e(c, s.delayTime, l.delayTime) : await r(c, s.delayTime, l.delayTime), await i(s, c, l), l;
2517
+ };
2518
+ return { render(e, t) {
2519
+ let n = o.get(t);
2520
+ return n === void 0 ? s(e, t) : Promise.resolve(n);
2521
+ } };
2522
+ }, dr = (e) => (t, n, r, i) => e(t[i], (e) => e[0] === n && e[1] === r), fr = (e) => "delayTime" in e, pr = (e, t, n) => function r(i, a) {
2523
+ let o = cn(a) ? a : n(e, a);
2524
+ if (fr(o)) return [];
2525
+ if (i[0] === o) return [i];
2526
+ if (i.includes(o)) return [];
2527
+ let { outputs: s } = t(o);
2528
+ return Array.from(s).map((e) => r([...i, o], e[0])).reduce((e, t) => e.concat(t), []);
2529
+ }, mr = {
2530
+ attack: .003,
2531
+ channelCount: 2,
2532
+ channelCountMode: "clamped-max",
2533
+ channelInterpretation: "speakers",
2534
+ knee: 30,
2535
+ ratio: 12,
2536
+ release: .25,
2537
+ threshold: -24
2538
+ }, hr = (e, t, n, r, i, a, o, s) => class extends e {
2539
+ constructor(e, i) {
2540
+ let c = a(e), l = r(c, {
2541
+ ...mr,
2542
+ ...i
2543
+ }), u = o(c), d = u ? n() : null;
2544
+ super(e, !1, l, d), this._attack = t(this, u, l.attack), this._knee = t(this, u, l.knee), this._nativeDynamicsCompressorNode = l, this._ratio = t(this, u, l.ratio), this._release = t(this, u, l.release), this._threshold = t(this, u, l.threshold), s(this, .006);
2545
+ }
2546
+ get attack() {
2547
+ return this._attack;
2548
+ }
2549
+ get channelCount() {
2550
+ return this._nativeDynamicsCompressorNode.channelCount;
2551
+ }
2552
+ set channelCount(e) {
2553
+ let t = this._nativeDynamicsCompressorNode.channelCount;
2554
+ if (this._nativeDynamicsCompressorNode.channelCount = e, e > 2) throw this._nativeDynamicsCompressorNode.channelCount = t, i();
2555
+ }
2556
+ get channelCountMode() {
2557
+ return this._nativeDynamicsCompressorNode.channelCountMode;
2558
+ }
2559
+ set channelCountMode(e) {
2560
+ let t = this._nativeDynamicsCompressorNode.channelCountMode;
2561
+ if (this._nativeDynamicsCompressorNode.channelCountMode = e, e === "max") throw this._nativeDynamicsCompressorNode.channelCountMode = t, i();
2562
+ }
2563
+ get knee() {
2564
+ return this._knee;
2565
+ }
2566
+ get ratio() {
2567
+ return this._ratio;
2568
+ }
2569
+ get reduction() {
2570
+ return typeof this._nativeDynamicsCompressorNode.reduction.value == "number" ? this._nativeDynamicsCompressorNode.reduction.value : this._nativeDynamicsCompressorNode.reduction;
2571
+ }
2572
+ get release() {
2573
+ return this._release;
2574
+ }
2575
+ get threshold() {
2576
+ return this._threshold;
2577
+ }
2578
+ }, gr = (e, t, n, r, i) => () => {
2579
+ let a = /* @__PURE__ */ new WeakMap(), o = async (o, s) => {
2580
+ let c = n(o), l = F(c, s);
2581
+ return l || (c = t(s, {
2582
+ attack: c.attack.value,
2583
+ channelCount: c.channelCount,
2584
+ channelCountMode: c.channelCountMode,
2585
+ channelInterpretation: c.channelInterpretation,
2586
+ knee: c.knee.value,
2587
+ ratio: c.ratio.value,
2588
+ release: c.release.value,
2589
+ threshold: c.threshold.value
2590
+ })), a.set(s, c), l ? (await e(s, o.attack, c.attack), await e(s, o.knee, c.knee), await e(s, o.ratio, c.ratio), await e(s, o.release, c.release), await e(s, o.threshold, c.threshold)) : (await r(s, o.attack, c.attack), await r(s, o.knee, c.knee), await r(s, o.ratio, c.ratio), await r(s, o.release, c.release), await r(s, o.threshold, c.threshold)), await i(o, s, c), c;
2591
+ };
2592
+ return { render(e, t) {
2593
+ let n = a.get(t);
2594
+ return n === void 0 ? o(e, t) : Promise.resolve(n);
2595
+ } };
2596
+ }, _r = () => new DOMException("", "EncodingError"), vr = (e) => (t) => new Promise((n, r) => {
2597
+ if (e === null) {
2598
+ r(/* @__PURE__ */ SyntaxError());
2599
+ return;
2600
+ }
2601
+ let i = e.document.head;
2602
+ if (i === null) r(/* @__PURE__ */ SyntaxError());
2603
+ else {
2604
+ let a = e.document.createElement("script"), o = new Blob([t], { type: "application/javascript" }), s = URL.createObjectURL(o), c = e.onerror, l = () => {
2605
+ e.onerror = c, URL.revokeObjectURL(s);
2606
+ };
2607
+ e.onerror = (t, n, i, a, o) => {
2608
+ if (n === s || n === e.location.href && i === 1 && a === 1) return l(), r(o), !1;
2609
+ if (c !== null) return c(t, n, i, a, o);
2610
+ }, a.onerror = () => {
2611
+ l(), r(/* @__PURE__ */ SyntaxError());
2612
+ }, a.onload = () => {
2613
+ l(), n();
2614
+ }, a.src = s, a.type = "module", i.appendChild(a);
2615
+ }
2616
+ }), yr = (e) => class {
2617
+ constructor(e) {
2618
+ this._nativeEventTarget = e, this._listeners = /* @__PURE__ */ new WeakMap();
2619
+ }
2620
+ addEventListener(t, n, r) {
2621
+ if (n !== null) {
2622
+ let i = this._listeners.get(n);
2623
+ i === void 0 && (i = e(this, n), typeof n == "function" && this._listeners.set(n, i)), this._nativeEventTarget.addEventListener(t, i, r);
2624
+ }
2625
+ }
2626
+ dispatchEvent(e) {
2627
+ return this._nativeEventTarget.dispatchEvent(e);
2628
+ }
2629
+ removeEventListener(e, t, n) {
2630
+ let r = t === null ? void 0 : this._listeners.get(t);
2631
+ this._nativeEventTarget.removeEventListener(e, r === void 0 ? null : r, n);
2632
+ }
2633
+ }, br = (e) => (t, n, r) => {
2634
+ Object.defineProperties(e, {
2635
+ currentFrame: {
2636
+ configurable: !0,
2637
+ get() {
2638
+ return Math.round(t * n);
2639
+ }
2640
+ },
2641
+ currentTime: {
2642
+ configurable: !0,
2643
+ get() {
2644
+ return t;
2645
+ }
2646
+ }
2647
+ });
2648
+ try {
2649
+ return r();
2650
+ } finally {
2651
+ e !== null && (delete e.currentFrame, delete e.currentTime);
2652
+ }
2653
+ }, xr = (e) => async (t) => {
2654
+ try {
2655
+ let e = await fetch(t);
2656
+ if (e.ok) return [await e.text(), e.url];
2657
+ } catch {}
2658
+ throw e();
2659
+ }, Sr = {
2660
+ channelCount: 2,
2661
+ channelCountMode: "max",
2662
+ channelInterpretation: "speakers",
2663
+ gain: 1
2664
+ }, Cr = (e, t, n, r, i, a) => class extends e {
2665
+ constructor(e, o) {
2666
+ let s = i(e), c = r(s, {
2667
+ ...Sr,
2668
+ ...o
2669
+ }), l = a(s), u = l ? n() : null;
2670
+ super(e, !1, c, u), this._gain = t(this, l, c.gain, L, I);
2671
+ }
2672
+ get gain() {
2673
+ return this._gain;
2674
+ }
2675
+ }, wr = (e, t, n, r, i) => () => {
2676
+ let a = /* @__PURE__ */ new WeakMap(), o = async (o, s) => {
2677
+ let c = n(o), l = F(c, s);
2678
+ return l || (c = t(s, {
2679
+ channelCount: c.channelCount,
2680
+ channelCountMode: c.channelCountMode,
2681
+ channelInterpretation: c.channelInterpretation,
2682
+ gain: c.gain.value
2683
+ })), a.set(s, c), l ? await e(s, o.gain, c.gain) : await r(s, o.gain, c.gain), await i(o, s, c), c;
2684
+ };
2685
+ return { render(e, t) {
2686
+ let n = a.get(t);
2687
+ return n === void 0 ? o(e, t) : Promise.resolve(n);
2688
+ } };
2689
+ }, Tr = (e) => (t) => {
2690
+ let n = e(t);
2691
+ if (n.renderer === null) throw Error("Missing the renderer of the given AudioNode in the audio graph.");
2692
+ return n.renderer;
2693
+ }, Er = (e) => (t) => e.get(t) ?? 0, Dr = (e) => (t) => {
2694
+ let n = e(t);
2695
+ if (n.renderer === null) throw Error("Missing the renderer of the given AudioParam in the audio graph.");
2696
+ return n.renderer;
2697
+ }, B = () => new DOMException("", "InvalidStateError"), Or = (e) => (t) => {
2698
+ let n = e.get(t);
2699
+ if (n === void 0) throw B();
2700
+ return n;
2701
+ }, kr = (e, t) => (n) => {
2702
+ let r = e.get(n);
2703
+ if (r !== void 0) return r;
2704
+ if (t === null) throw Error("Missing the native OfflineAudioContext constructor.");
2705
+ return r = new t(1, 1, 44100), e.set(n, r), r;
2706
+ }, Ar = () => new DOMException("", "InvalidAccessError"), jr = (e) => {
2707
+ e.getFrequencyResponse = ((t) => (n, r, i) => {
2708
+ if (n.length !== r.length || r.length !== i.length) throw Ar();
2709
+ return t.call(e, n, r, i);
2710
+ })(e.getFrequencyResponse);
2711
+ }, Mr = {
2712
+ channelCount: 2,
2713
+ channelCountMode: "max",
2714
+ channelInterpretation: "speakers"
2715
+ }, Nr = (e, t, n, r, i, a) => class extends e {
2716
+ constructor(e, o) {
2717
+ let s = r(e), c = i(s), l = {
2718
+ ...Mr,
2719
+ ...o
2720
+ }, u = t(s, c ? null : e.baseLatency, l), d = c ? n(l.feedback, l.feedforward) : null;
2721
+ super(e, !1, u, d), jr(u), this._nativeIIRFilterNode = u, a(this, 1);
2722
+ }
2723
+ getFrequencyResponse(e, t, n) {
2724
+ return this._nativeIIRFilterNode.getFrequencyResponse(e, t, n);
2725
+ }
2726
+ }, Pr = (e, t, n, r, i, a, o, s, c, l, u) => {
2727
+ let d = l.length, f = s;
2728
+ for (let s = 0; s < d; s += 1) {
2729
+ let d = n[0] * l[s];
2730
+ for (let t = 1; t < i; t += 1) {
2731
+ let r = f - t & c - 1;
2732
+ d += n[t] * a[r], d -= e[t] * o[r];
2733
+ }
2734
+ for (let e = i; e < r; e += 1) d += n[e] * a[f - e & c - 1];
2735
+ for (let n = i; n < t; n += 1) d -= e[n] * o[f - n & c - 1];
2736
+ a[f] = l[s], o[f] = d, f = f + 1 & c - 1, u[s] = d;
2737
+ }
2738
+ return f;
2739
+ }, Fr = (e, t, n, r) => {
2740
+ let i = n instanceof Float64Array ? n : new Float64Array(n), a = r instanceof Float64Array ? r : new Float64Array(r), o = i.length, s = a.length, c = Math.min(o, s);
2741
+ if (i[0] !== 1) {
2742
+ for (let e = 0; e < o; e += 1) a[e] /= i[0];
2743
+ for (let e = 1; e < s; e += 1) i[e] /= i[0];
2744
+ }
2745
+ let l = /* @__PURE__ */ new Float32Array(32), u = /* @__PURE__ */ new Float32Array(32), d = t.createBuffer(e.numberOfChannels, e.length, e.sampleRate), f = e.numberOfChannels;
2746
+ for (let t = 0; t < f; t += 1) {
2747
+ let n = e.getChannelData(t), r = d.getChannelData(t);
2748
+ l.fill(0), u.fill(0), Pr(i, o, a, s, c, l, u, 0, 32, n, r);
2749
+ }
2750
+ return d;
2751
+ }, Ir = (e, t, n, r, i) => (a, o) => {
2752
+ let s = /* @__PURE__ */ new WeakMap(), c = null, l = async (l, u) => {
2753
+ let d = null, f = t(l), p = F(f, u);
2754
+ if (u.createIIRFilter === void 0 ? d = e(u, {
2755
+ buffer: null,
2756
+ channelCount: 2,
2757
+ channelCountMode: "max",
2758
+ channelInterpretation: "speakers",
2759
+ loop: !1,
2760
+ loopEnd: 0,
2761
+ loopStart: 0,
2762
+ playbackRate: 1
2763
+ }) : p || (f = u.createIIRFilter(o, a)), s.set(u, d === null ? f : d), d !== null) {
2764
+ if (c === null) {
2765
+ if (n === null) throw Error("Missing the native OfflineAudioContext constructor.");
2766
+ let e = new n(l.context.destination.channelCount, l.context.length, u.sampleRate);
2767
+ c = (async () => (await r(l, e, e.destination), Fr(await i(e), u, a, o)))();
2768
+ }
2769
+ let e = await c;
2770
+ return d.buffer = e, d.start(0), d;
2771
+ }
2772
+ return await r(l, u, f), f;
2773
+ };
2774
+ return { render(e, t) {
2775
+ let n = s.get(t);
2776
+ return n === void 0 ? l(e, t) : Promise.resolve(n);
2777
+ } };
2778
+ }, Lr = (e, t, n, r, i, a) => (o) => (s, c) => {
2779
+ let l = e.get(s);
2780
+ if (l === void 0) {
2781
+ if (!o && a(s)) {
2782
+ let e = r(s), { outputs: a } = n(s);
2783
+ for (let n of a) if (ln(n)) t(e, r(n[0]), n[1], n[2]);
2784
+ else {
2785
+ let t = i(n[0]);
2786
+ e.disconnect(t, n[1]);
2787
+ }
2788
+ }
2789
+ e.set(s, c);
2790
+ } else e.set(s, l + c);
2791
+ }, Rr = (e) => (t) => e !== null && t instanceof e, zr = (e) => (t) => e !== null && typeof e.AudioNode == "function" && t instanceof e.AudioNode, Br = (e) => (t) => e !== null && typeof e.AudioParam == "function" && t instanceof e.AudioParam, Vr = (e, t) => (n) => e(n) || t(n), Hr = (e) => (t) => e !== null && t instanceof e, Ur = (e) => e !== null && e.isSecureContext, Wr = (e, t, n, r) => class extends e {
2792
+ constructor(e, i) {
2793
+ let a = n(e), o = t(a, i);
2794
+ if (r(a)) throw TypeError();
2795
+ super(e, !0, o, null), this._nativeMediaElementAudioSourceNode = o;
2796
+ }
2797
+ get mediaElement() {
2798
+ return this._nativeMediaElementAudioSourceNode.mediaElement;
2799
+ }
2800
+ }, Gr = {
2801
+ channelCount: 2,
2802
+ channelCountMode: "explicit",
2803
+ channelInterpretation: "speakers"
2804
+ }, Kr = (e, t, n, r) => class extends e {
2805
+ constructor(e, i) {
2806
+ let a = n(e);
2807
+ if (r(a)) throw TypeError();
2808
+ let o = t(a, {
2809
+ ...Gr,
2810
+ ...i
2811
+ });
2812
+ super(e, !1, o, null), this._nativeMediaStreamAudioDestinationNode = o;
2813
+ }
2814
+ get stream() {
2815
+ return this._nativeMediaStreamAudioDestinationNode.stream;
2816
+ }
2817
+ }, qr = (e, t, n, r) => class extends e {
2818
+ constructor(e, i) {
2819
+ let a = n(e), o = t(a, i);
2820
+ if (r(a)) throw TypeError();
2821
+ super(e, !0, o, null), this._nativeMediaStreamAudioSourceNode = o;
2822
+ }
2823
+ get mediaStream() {
2824
+ return this._nativeMediaStreamAudioSourceNode.mediaStream;
2825
+ }
2826
+ }, Jr = (e, t, n) => class extends e {
2827
+ constructor(e, r) {
2828
+ let i = t(n(e), r);
2829
+ super(e, !0, i, null);
2830
+ }
2831
+ }, Yr = (e, t, n, r, i, a) => class extends n {
2832
+ constructor(n, a) {
2833
+ super(n), this._nativeContext = n, pt.set(this, n), r(n) && i.set(n, /* @__PURE__ */ new Set()), this._destination = new e(this, a), this._listener = t(this, n), this._onstatechange = null;
2834
+ }
2835
+ get currentTime() {
2836
+ return this._nativeContext.currentTime;
2837
+ }
2838
+ get destination() {
2839
+ return this._destination;
2840
+ }
2841
+ get listener() {
2842
+ return this._listener;
2843
+ }
2844
+ get onstatechange() {
2845
+ return this._onstatechange;
2846
+ }
2847
+ set onstatechange(e) {
2848
+ let t = typeof e == "function" ? a(this, e) : null;
2849
+ this._nativeContext.onstatechange = t;
2850
+ let n = this._nativeContext.onstatechange;
2851
+ this._onstatechange = n !== null && n === t ? e : n;
2852
+ }
2853
+ get sampleRate() {
2854
+ return this._nativeContext.sampleRate;
2855
+ }
2856
+ get state() {
2857
+ return this._nativeContext.state;
2858
+ }
2859
+ }, Xr = (e) => {
2860
+ let t = new Uint32Array([
2861
+ 1179011410,
2862
+ 40,
2863
+ 1163280727,
2864
+ 544501094,
2865
+ 16,
2866
+ 131073,
2867
+ 44100,
2868
+ 176400,
2869
+ 1048580,
2870
+ 1635017060,
2871
+ 4,
2872
+ 0
2873
+ ]);
2874
+ try {
2875
+ let n = e.decodeAudioData(t.buffer, () => {});
2876
+ return n === void 0 ? !1 : (n.catch(() => {}), !0);
2877
+ } catch {}
2878
+ return !1;
2879
+ }, Zr = (e, t) => (n, r, i) => {
2880
+ let a = /* @__PURE__ */ new Set();
2881
+ return n.connect = ((i) => (o, s = 0, c = 0) => {
2882
+ let l = a.size === 0;
2883
+ if (t(o)) return i.call(n, o, s, c), e(a, [
2884
+ o,
2885
+ s,
2886
+ c
2887
+ ], (e) => e[0] === o && e[1] === s && e[2] === c, !0), l && r(), o;
2888
+ i.call(n, o, s), e(a, [o, s], (e) => e[0] === o && e[1] === s, !0), l && r();
2889
+ })(n.connect), n.disconnect = ((e) => (r, o, s) => {
2890
+ let c = a.size > 0;
2891
+ if (r === void 0) e.apply(n), a.clear();
2892
+ else if (typeof r == "number") {
2893
+ e.call(n, r);
2894
+ for (let e of a) e[1] === r && a.delete(e);
2895
+ } else {
2896
+ t(r) ? e.call(n, r, o, s) : e.call(n, r, o);
2897
+ for (let e of a) e[0] === r && (o === void 0 || e[1] === o) && (s === void 0 || e[2] === s) && a.delete(e);
2898
+ }
2899
+ let l = a.size === 0;
2900
+ c && l && i();
2901
+ })(n.disconnect), n;
2902
+ }, V = (e, t, n) => {
2903
+ let r = t[n];
2904
+ r !== void 0 && r !== e[n] && (e[n] = r);
2905
+ }, H = (e, t) => {
2906
+ V(e, t, "channelCount"), V(e, t, "channelCountMode"), V(e, t, "channelInterpretation");
2907
+ }, Qr = (e) => typeof e.getFloatTimeDomainData == "function", $r = (e) => {
2908
+ e.getFloatTimeDomainData = (t) => {
2909
+ let n = new Uint8Array(t.length);
2910
+ e.getByteTimeDomainData(n);
2911
+ let r = Math.max(n.length, e.fftSize);
2912
+ for (let e = 0; e < r; e += 1) t[e] = (n[e] - 128) * .0078125;
2913
+ return t;
2914
+ };
2915
+ }, ei = (e, t) => (n, r) => {
2916
+ let i = n.createAnalyser();
2917
+ if (H(i, r), !(r.maxDecibels > r.minDecibels)) throw t();
2918
+ return V(i, r, "fftSize"), V(i, r, "maxDecibels"), V(i, r, "minDecibels"), V(i, r, "smoothingTimeConstant"), e(Qr, () => Qr(i)) || $r(i), i;
2919
+ }, ti = (e) => e === null ? null : e.hasOwnProperty("AudioBuffer") ? e.AudioBuffer : null, U = (e, t, n) => {
2920
+ let r = t[n];
2921
+ r !== void 0 && r !== e[n].value && (e[n].value = r);
2922
+ }, ni = (e) => {
2923
+ e.start = ((t) => {
2924
+ let n = !1;
2925
+ return (r = 0, i = 0, a) => {
2926
+ if (n) throw B();
2927
+ t.call(e, r, i, a), n = !0;
2928
+ };
2929
+ })(e.start);
2930
+ }, ri = (e) => {
2931
+ e.start = ((t) => (n = 0, r = 0, i) => {
2932
+ if (typeof i == "number" && i < 0 || r < 0 || n < 0) throw RangeError("The parameters can't be negative.");
2933
+ t.call(e, n, r, i);
2934
+ })(e.start);
2935
+ }, ii = (e) => {
2936
+ e.stop = ((t) => (n = 0) => {
2937
+ if (n < 0) throw RangeError("The parameter can't be negative.");
2938
+ t.call(e, n);
2939
+ })(e.stop);
2940
+ }, ai = (e, t, n, r, i, a, o, s, c, l, u) => (d, f) => {
2941
+ let p = d.createBufferSource();
2942
+ return H(p, f), U(p, f, "playbackRate"), V(p, f, "buffer"), V(p, f, "loop"), V(p, f, "loopEnd"), V(p, f, "loopStart"), t(n, () => n(d)) || ni(p), t(r, () => r(d)) || c(p), t(i, () => i(d)) || l(p, d), t(a, () => a(d)) || ri(p), t(o, () => o(d)) || u(p, d), t(s, () => s(d)) || ii(p), e(d, p), p;
2943
+ }, oi = (e) => e === null ? null : e.hasOwnProperty("AudioContext") ? e.AudioContext : e.hasOwnProperty("webkitAudioContext") ? e.webkitAudioContext : null, si = (e, t) => (n, r, i) => {
2944
+ let a = n.destination;
2945
+ if (a.channelCount !== r) try {
2946
+ a.channelCount = r;
2947
+ } catch {}
2948
+ i && a.channelCountMode !== "explicit" && (a.channelCountMode = "explicit"), a.maxChannelCount === 0 && Object.defineProperty(a, "maxChannelCount", { value: r });
2949
+ let o = e(n, {
2950
+ channelCount: r,
2951
+ channelCountMode: a.channelCountMode,
2952
+ channelInterpretation: a.channelInterpretation,
2953
+ gain: 1
2954
+ });
2955
+ return t(o, "channelCount", (e) => () => e.call(o), (e) => (t) => {
2956
+ e.call(o, t);
2957
+ try {
2958
+ a.channelCount = t;
2959
+ } catch (e) {
2960
+ if (t > a.maxChannelCount) throw e;
2961
+ }
2962
+ }), t(o, "channelCountMode", (e) => () => e.call(o), (e) => (t) => {
2963
+ e.call(o, t), a.channelCountMode = t;
2964
+ }), t(o, "channelInterpretation", (e) => () => e.call(o), (e) => (t) => {
2965
+ e.call(o, t), a.channelInterpretation = t;
2966
+ }), Object.defineProperty(o, "maxChannelCount", { get: () => a.maxChannelCount }), o.connect(a), o;
2967
+ }, ci = (e) => e === null ? null : e.hasOwnProperty("AudioWorkletNode") ? e.AudioWorkletNode : null, li = (e, t) => e === null ? 512 : Math.max(512, Math.min(16384, 2 ** Math.round(Math.log2(e * t)))), ui = (e, t) => {
2968
+ let n = e.createBiquadFilter();
2969
+ return H(n, t), U(n, t, "Q"), U(n, t, "detune"), U(n, t, "frequency"), U(n, t, "gain"), V(n, t, "type"), n;
2970
+ }, di = (e, t) => (n, r) => {
2971
+ let i = n.createChannelMerger(r.numberOfInputs);
2972
+ return e !== null && e.name === "webkitAudioContext" && t(n, i), H(i, r), i;
2973
+ }, fi = (e) => {
2974
+ let t = e.numberOfOutputs;
2975
+ Object.defineProperty(e, "channelCount", {
2976
+ get: () => t,
2977
+ set: (e) => {
2978
+ if (e !== t) throw B();
2979
+ }
2980
+ }), Object.defineProperty(e, "channelCountMode", {
2981
+ get: () => "explicit",
2982
+ set: (e) => {
2983
+ if (e !== "explicit") throw B();
2984
+ }
2985
+ }), Object.defineProperty(e, "channelInterpretation", {
2986
+ get: () => "discrete",
2987
+ set: (e) => {
2988
+ if (e !== "discrete") throw B();
2989
+ }
2990
+ });
2991
+ }, pi = (e, t) => {
2992
+ let n = e.createChannelSplitter(t.numberOfOutputs);
2993
+ return H(n, t), fi(n), n;
2994
+ }, mi = (e, t, n, r, i) => (a, o) => {
2995
+ if (a.createConstantSource === void 0) return n(a, o);
2996
+ let s = a.createConstantSource();
2997
+ return H(s, o), U(s, o, "offset"), t(r, () => r(a)) || ri(s), t(i, () => i(a)) || ii(s), e(a, s), s;
2998
+ }, hi = (e, t) => (e.connect = t.connect.bind(t), e.disconnect = t.disconnect.bind(t), e), gi = (e, t, n, r) => (i, { offset: a, ...o }) => {
2999
+ let s = i.createBuffer(1, 2, 44100), c = t(i, {
3000
+ buffer: null,
3001
+ channelCount: 2,
3002
+ channelCountMode: "max",
3003
+ channelInterpretation: "speakers",
3004
+ loop: !1,
3005
+ loopEnd: 0,
3006
+ loopStart: 0,
3007
+ playbackRate: 1
3008
+ }), l = n(i, {
3009
+ ...o,
3010
+ gain: a
3011
+ }), u = s.getChannelData(0);
3012
+ return u[0] = 1, u[1] = 1, c.buffer = s, c.loop = !0, e(i, c), r(hi({
3013
+ get bufferSize() {},
3014
+ get channelCount() {
3015
+ return l.channelCount;
3016
+ },
3017
+ set channelCount(e) {
3018
+ l.channelCount = e;
3019
+ },
3020
+ get channelCountMode() {
3021
+ return l.channelCountMode;
3022
+ },
3023
+ set channelCountMode(e) {
3024
+ l.channelCountMode = e;
3025
+ },
3026
+ get channelInterpretation() {
3027
+ return l.channelInterpretation;
3028
+ },
3029
+ set channelInterpretation(e) {
3030
+ l.channelInterpretation = e;
3031
+ },
3032
+ get context() {
3033
+ return l.context;
3034
+ },
3035
+ get inputs() {
3036
+ return [];
3037
+ },
3038
+ get numberOfInputs() {
3039
+ return c.numberOfInputs;
3040
+ },
3041
+ get numberOfOutputs() {
3042
+ return l.numberOfOutputs;
3043
+ },
3044
+ get offset() {
3045
+ return l.gain;
3046
+ },
3047
+ get onended() {
3048
+ return c.onended;
3049
+ },
3050
+ set onended(e) {
3051
+ c.onended = e;
3052
+ },
3053
+ addEventListener(...e) {
3054
+ return c.addEventListener(e[0], e[1], e[2]);
3055
+ },
3056
+ dispatchEvent(...e) {
3057
+ return c.dispatchEvent(e[0]);
3058
+ },
3059
+ removeEventListener(...e) {
3060
+ return c.removeEventListener(e[0], e[1], e[2]);
3061
+ },
3062
+ start(e = 0) {
3063
+ c.start.call(c, e);
3064
+ },
3065
+ stop(e = 0) {
3066
+ c.stop.call(c, e);
3067
+ }
3068
+ }, l), () => c.connect(l), () => c.disconnect(l));
3069
+ }, _i = (e, t) => (n, r) => {
3070
+ let i = n.createConvolver();
3071
+ if (H(i, r), r.disableNormalization === i.normalize && (i.normalize = !r.disableNormalization), V(i, r, "buffer"), r.channelCount > 2 || (t(i, "channelCount", (e) => () => e.call(i), (t) => (n) => {
3072
+ if (n > 2) throw e();
3073
+ return t.call(i, n);
3074
+ }), r.channelCountMode === "max")) throw e();
3075
+ return t(i, "channelCountMode", (e) => () => e.call(i), (t) => (n) => {
3076
+ if (n === "max") throw e();
3077
+ return t.call(i, n);
3078
+ }), i;
3079
+ }, vi = (e, t) => {
3080
+ let n = e.createDelay(t.maxDelayTime);
3081
+ return H(n, t), U(n, t, "delayTime"), n;
3082
+ }, yi = (e) => (t, n) => {
3083
+ let r = t.createDynamicsCompressor();
3084
+ if (H(r, n), n.channelCount > 2 || n.channelCountMode === "max") throw e();
3085
+ return U(r, n, "attack"), U(r, n, "knee"), U(r, n, "ratio"), U(r, n, "release"), U(r, n, "threshold"), r;
3086
+ }, W = (e, t) => {
3087
+ let n = e.createGain();
3088
+ return H(n, t), U(n, t, "gain"), n;
3089
+ }, bi = (e) => (t, n, r) => {
3090
+ if (t.createIIRFilter === void 0) return e(t, n, r);
3091
+ let i = t.createIIRFilter(r.feedforward, r.feedback);
3092
+ return H(i, r), i;
3093
+ };
3094
+ //#endregion
3095
+ //#region node_modules/standardized-audio-context/build/es2019/factories/native-iir-filter-node-faker-factory.js
3096
+ function xi(e, t) {
3097
+ let n = t[0] * t[0] + t[1] * t[1];
3098
+ return [(e[0] * t[0] + e[1] * t[1]) / n, (e[1] * t[0] - e[0] * t[1]) / n];
3099
+ }
3100
+ function Si(e, t) {
3101
+ return [e[0] * t[0] - e[1] * t[1], e[0] * t[1] + e[1] * t[0]];
3102
+ }
3103
+ function Ci(e, t) {
3104
+ let n = [0, 0];
3105
+ for (let r = e.length - 1; r >= 0; --r) n = Si(n, t), n[0] += e[r];
3106
+ return n;
3107
+ }
3108
+ var wi = (e, t, n, r) => (i, a, { channelCount: o, channelCountMode: s, channelInterpretation: c, feedback: l, feedforward: u }) => {
3109
+ let d = li(a, i.sampleRate), f = l instanceof Float64Array ? l : new Float64Array(l), p = u instanceof Float64Array ? u : new Float64Array(u), m = f.length, h = p.length, g = Math.min(m, h);
3110
+ if (m === 0 || m > 20) throw r();
3111
+ if (f[0] === 0) throw t();
3112
+ if (h === 0 || h > 20) throw r();
3113
+ if (p[0] === 0) throw t();
3114
+ if (f[0] !== 1) {
3115
+ for (let e = 0; e < h; e += 1) p[e] /= f[0];
3116
+ for (let e = 1; e < m; e += 1) f[e] /= f[0];
3117
+ }
3118
+ let _ = n(i, d, o, o);
3119
+ _.channelCount = o, _.channelCountMode = s, _.channelInterpretation = c;
3120
+ let v = [], y = [], b = [];
3121
+ for (let e = 0; e < o; e += 1) {
3122
+ v.push(0);
3123
+ let e = /* @__PURE__ */ new Float32Array(32), t = /* @__PURE__ */ new Float32Array(32);
3124
+ e.fill(0), t.fill(0), y.push(e), b.push(t);
3125
+ }
3126
+ _.onaudioprocess = (e) => {
3127
+ let t = e.inputBuffer, n = e.outputBuffer, r = t.numberOfChannels;
3128
+ for (let e = 0; e < r; e += 1) {
3129
+ let r = t.getChannelData(e), i = n.getChannelData(e);
3130
+ v[e] = Pr(f, m, p, h, g, y[e], b[e], v[e], 32, r, i);
3131
+ }
3132
+ };
3133
+ let x = i.sampleRate / 2;
3134
+ return hi({
3135
+ get bufferSize() {
3136
+ return d;
3137
+ },
3138
+ get channelCount() {
3139
+ return _.channelCount;
3140
+ },
3141
+ set channelCount(e) {
3142
+ _.channelCount = e;
3143
+ },
3144
+ get channelCountMode() {
3145
+ return _.channelCountMode;
3146
+ },
3147
+ set channelCountMode(e) {
3148
+ _.channelCountMode = e;
3149
+ },
3150
+ get channelInterpretation() {
3151
+ return _.channelInterpretation;
3152
+ },
3153
+ set channelInterpretation(e) {
3154
+ _.channelInterpretation = e;
3155
+ },
3156
+ get context() {
3157
+ return _.context;
3158
+ },
3159
+ get inputs() {
3160
+ return [_];
3161
+ },
3162
+ get numberOfInputs() {
3163
+ return _.numberOfInputs;
3164
+ },
3165
+ get numberOfOutputs() {
3166
+ return _.numberOfOutputs;
3167
+ },
3168
+ addEventListener(...e) {
3169
+ return _.addEventListener(e[0], e[1], e[2]);
3170
+ },
3171
+ dispatchEvent(...e) {
3172
+ return _.dispatchEvent(e[0]);
3173
+ },
3174
+ getFrequencyResponse(t, n, r) {
3175
+ if (t.length !== n.length || n.length !== r.length) throw e();
3176
+ let i = t.length;
3177
+ for (let e = 0; e < i; e += 1) {
3178
+ let i = -Math.PI * (t[e] / x), a = [Math.cos(i), Math.sin(i)], o = xi(Ci(p, a), Ci(f, a));
3179
+ n[e] = Math.sqrt(o[0] * o[0] + o[1] * o[1]), r[e] = Math.atan2(o[1], o[0]);
3180
+ }
3181
+ },
3182
+ removeEventListener(...e) {
3183
+ return _.removeEventListener(e[0], e[1], e[2]);
3184
+ }
3185
+ }, _);
3186
+ }, Ti = (e, t) => e.createMediaElementSource(t.mediaElement), Ei = (e, t) => {
3187
+ let n = e.createMediaStreamDestination();
3188
+ return H(n, t), n.numberOfOutputs === 1 && Object.defineProperty(n, "numberOfOutputs", { get: () => 0 }), n;
3189
+ }, Di = (e, { mediaStream: t }) => {
3190
+ let n = t.getAudioTracks();
3191
+ n.sort((e, t) => e.id < t.id ? -1 : +(e.id > t.id));
3192
+ let r = n.slice(0, 1), i = e.createMediaStreamSource(new MediaStream(r));
3193
+ return Object.defineProperty(i, "mediaStream", { value: t }), i;
3194
+ }, Oi = (e, t) => (n, { mediaStreamTrack: r }) => {
3195
+ if (typeof n.createMediaStreamTrackSource == "function") return n.createMediaStreamTrackSource(r);
3196
+ let i = new MediaStream([r]), a = n.createMediaStreamSource(i);
3197
+ if (r.kind !== "audio") throw e();
3198
+ if (t(n)) throw TypeError();
3199
+ return a;
3200
+ }, ki = (e) => e === null ? null : e.hasOwnProperty("OfflineAudioContext") ? e.OfflineAudioContext : e.hasOwnProperty("webkitOfflineAudioContext") ? e.webkitOfflineAudioContext : null, Ai = (e, t, n, r, i, a) => (o, s) => {
3201
+ let c = o.createOscillator();
3202
+ return H(c, s), U(c, s, "detune"), U(c, s, "frequency"), s.periodicWave === void 0 ? V(c, s, "type") : c.setPeriodicWave(s.periodicWave), t(n, () => n(o)) || ri(c), t(r, () => r(o)) || a(c, o), t(i, () => i(o)) || ii(c), e(o, c), c;
3203
+ }, ji = (e) => (t, n) => {
3204
+ let r = t.createPanner();
3205
+ return r.orientationX === void 0 ? e(t, n) : (H(r, n), U(r, n, "orientationX"), U(r, n, "orientationY"), U(r, n, "orientationZ"), U(r, n, "positionX"), U(r, n, "positionY"), U(r, n, "positionZ"), V(r, n, "coneInnerAngle"), V(r, n, "coneOuterAngle"), V(r, n, "coneOuterGain"), V(r, n, "distanceModel"), V(r, n, "maxDistance"), V(r, n, "panningModel"), V(r, n, "refDistance"), V(r, n, "rolloffFactor"), r);
3206
+ }, Mi = (e, t, n, r, i, a, o, s, c, l) => (u, { coneInnerAngle: d, coneOuterAngle: f, coneOuterGain: p, distanceModel: m, maxDistance: h, orientationX: g, orientationY: _, orientationZ: v, panningModel: y, positionX: b, positionY: x, positionZ: S, refDistance: C, rolloffFactor: w, ...T }) => {
3207
+ let E = u.createPanner();
3208
+ if (T.channelCount > 2 || T.channelCountMode === "max") throw o();
3209
+ H(E, T);
3210
+ let D = {
3211
+ channelCount: 1,
3212
+ channelCountMode: "explicit",
3213
+ channelInterpretation: "discrete"
3214
+ }, O = n(u, {
3215
+ ...D,
3216
+ channelInterpretation: "speakers",
3217
+ numberOfInputs: 6
3218
+ }), k = r(u, {
3219
+ ...T,
3220
+ gain: 1
3221
+ }), A = r(u, {
3222
+ ...D,
3223
+ gain: 1
3224
+ }), j = r(u, {
3225
+ ...D,
3226
+ gain: 0
3227
+ }), M = r(u, {
3228
+ ...D,
3229
+ gain: 0
3230
+ }), ee = r(u, {
3231
+ ...D,
3232
+ gain: 0
3233
+ }), te = r(u, {
3234
+ ...D,
3235
+ gain: 0
3236
+ }), ne = r(u, {
3237
+ ...D,
3238
+ gain: 0
3239
+ }), re = i(u, 256, 6, 1), N = a(u, {
3240
+ ...D,
3241
+ curve: new Float32Array([1, 1]),
3242
+ oversample: "none"
3243
+ }), ie = [
3244
+ g,
3245
+ _,
3246
+ v
3247
+ ], ae = [
3248
+ b,
3249
+ x,
3250
+ S
3251
+ ], oe = /* @__PURE__ */ new Float32Array(1);
3252
+ re.onaudioprocess = ({ inputBuffer: e }) => {
3253
+ let t = [
3254
+ c(e, oe, 0),
3255
+ c(e, oe, 1),
3256
+ c(e, oe, 2)
3257
+ ];
3258
+ t.some((e, t) => e !== ie[t]) && (E.setOrientation(...t), ie = t);
3259
+ let n = [
3260
+ c(e, oe, 3),
3261
+ c(e, oe, 4),
3262
+ c(e, oe, 5)
3263
+ ];
3264
+ n.some((e, t) => e !== ae[t]) && (E.setPosition(...n), ae = n);
3265
+ }, Object.defineProperty(j.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(M.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(ee.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(te.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(ne.gain, "defaultValue", { get: () => 0 });
3266
+ let P = {
3267
+ get bufferSize() {},
3268
+ get channelCount() {
3269
+ return E.channelCount;
3270
+ },
3271
+ set channelCount(e) {
3272
+ if (e > 2) throw o();
3273
+ k.channelCount = e, E.channelCount = e;
3274
+ },
3275
+ get channelCountMode() {
3276
+ return E.channelCountMode;
3277
+ },
3278
+ set channelCountMode(e) {
3279
+ if (e === "max") throw o();
3280
+ k.channelCountMode = e, E.channelCountMode = e;
3281
+ },
3282
+ get channelInterpretation() {
3283
+ return E.channelInterpretation;
3284
+ },
3285
+ set channelInterpretation(e) {
3286
+ k.channelInterpretation = e, E.channelInterpretation = e;
3287
+ },
3288
+ get coneInnerAngle() {
3289
+ return E.coneInnerAngle;
3290
+ },
3291
+ set coneInnerAngle(e) {
3292
+ E.coneInnerAngle = e;
3293
+ },
3294
+ get coneOuterAngle() {
3295
+ return E.coneOuterAngle;
3296
+ },
3297
+ set coneOuterAngle(e) {
3298
+ E.coneOuterAngle = e;
3299
+ },
3300
+ get coneOuterGain() {
3301
+ return E.coneOuterGain;
3302
+ },
3303
+ set coneOuterGain(e) {
3304
+ if (e < 0 || e > 1) throw t();
3305
+ E.coneOuterGain = e;
3306
+ },
3307
+ get context() {
3308
+ return E.context;
3309
+ },
3310
+ get distanceModel() {
3311
+ return E.distanceModel;
3312
+ },
3313
+ set distanceModel(e) {
3314
+ E.distanceModel = e;
3315
+ },
3316
+ get inputs() {
3317
+ return [k];
3318
+ },
3319
+ get maxDistance() {
3320
+ return E.maxDistance;
3321
+ },
3322
+ set maxDistance(e) {
3323
+ if (e < 0) throw RangeError();
3324
+ E.maxDistance = e;
3325
+ },
3326
+ get numberOfInputs() {
3327
+ return E.numberOfInputs;
3328
+ },
3329
+ get numberOfOutputs() {
3330
+ return E.numberOfOutputs;
3331
+ },
3332
+ get orientationX() {
3333
+ return A.gain;
3334
+ },
3335
+ get orientationY() {
3336
+ return j.gain;
3337
+ },
3338
+ get orientationZ() {
3339
+ return M.gain;
3340
+ },
3341
+ get panningModel() {
3342
+ return E.panningModel;
3343
+ },
3344
+ set panningModel(e) {
3345
+ E.panningModel = e;
3346
+ },
3347
+ get positionX() {
3348
+ return ee.gain;
3349
+ },
3350
+ get positionY() {
3351
+ return te.gain;
3352
+ },
3353
+ get positionZ() {
3354
+ return ne.gain;
3355
+ },
3356
+ get refDistance() {
3357
+ return E.refDistance;
3358
+ },
3359
+ set refDistance(e) {
3360
+ if (e < 0) throw RangeError();
3361
+ E.refDistance = e;
3362
+ },
3363
+ get rolloffFactor() {
3364
+ return E.rolloffFactor;
3365
+ },
3366
+ set rolloffFactor(e) {
3367
+ if (e < 0) throw RangeError();
3368
+ E.rolloffFactor = e;
3369
+ },
3370
+ addEventListener(...e) {
3371
+ return k.addEventListener(e[0], e[1], e[2]);
3372
+ },
3373
+ dispatchEvent(...e) {
3374
+ return k.dispatchEvent(e[0]);
3375
+ },
3376
+ removeEventListener(...e) {
3377
+ return k.removeEventListener(e[0], e[1], e[2]);
3378
+ }
3379
+ };
3380
+ return d !== P.coneInnerAngle && (P.coneInnerAngle = d), f !== P.coneOuterAngle && (P.coneOuterAngle = f), p !== P.coneOuterGain && (P.coneOuterGain = p), m !== P.distanceModel && (P.distanceModel = m), h !== P.maxDistance && (P.maxDistance = h), g !== P.orientationX.value && (P.orientationX.value = g), _ !== P.orientationY.value && (P.orientationY.value = _), v !== P.orientationZ.value && (P.orientationZ.value = v), y !== P.panningModel && (P.panningModel = y), b !== P.positionX.value && (P.positionX.value = b), x !== P.positionY.value && (P.positionY.value = x), S !== P.positionZ.value && (P.positionZ.value = S), C !== P.refDistance && (P.refDistance = C), w !== P.rolloffFactor && (P.rolloffFactor = w), (ie[0] !== 1 || ie[1] !== 0 || ie[2] !== 0) && E.setOrientation(...ie), (ae[0] !== 0 || ae[1] !== 0 || ae[2] !== 0) && E.setPosition(...ae), l(hi(P, E), () => {
3381
+ k.connect(E), e(k, N, 0, 0), N.connect(A).connect(O, 0, 0), N.connect(j).connect(O, 0, 1), N.connect(M).connect(O, 0, 2), N.connect(ee).connect(O, 0, 3), N.connect(te).connect(O, 0, 4), N.connect(ne).connect(O, 0, 5), O.connect(re).connect(u.destination);
3382
+ }, () => {
3383
+ k.disconnect(E), s(k, N, 0, 0), N.disconnect(A), A.disconnect(O), N.disconnect(j), j.disconnect(O), N.disconnect(M), M.disconnect(O), N.disconnect(ee), ee.disconnect(O), N.disconnect(te), te.disconnect(O), N.disconnect(ne), ne.disconnect(O), O.disconnect(re), re.disconnect(u.destination);
3384
+ });
3385
+ }, Ni = (e) => (t, { disableNormalization: n, imag: r, real: i }) => {
3386
+ let a = r instanceof Float32Array ? r : new Float32Array(r), o = i instanceof Float32Array ? i : new Float32Array(i), s = t.createPeriodicWave(o, a, { disableNormalization: n });
3387
+ if (Array.from(r).length < 2) throw e();
3388
+ return s;
3389
+ }, Pi = (e, t, n, r) => e.createScriptProcessor(t, n, r), Fi = (e, t) => (n, r) => {
3390
+ let i = r.channelCountMode;
3391
+ if (i === "clamped-max") throw t();
3392
+ if (n.createStereoPanner === void 0) return e(n, r);
3393
+ let a = n.createStereoPanner();
3394
+ return H(a, r), U(a, r, "pan"), Object.defineProperty(a, "channelCountMode", {
3395
+ get: () => i,
3396
+ set: (e) => {
3397
+ if (e !== i) throw t();
3398
+ }
3399
+ }), a;
3400
+ }, Ii = (e, t, n, r, i, a) => {
3401
+ let o = 16385, s = new Float32Array([1, 1]), c = Math.PI / 2, l = {
3402
+ channelCount: 1,
3403
+ channelCountMode: "explicit",
3404
+ channelInterpretation: "discrete"
3405
+ }, u = {
3406
+ ...l,
3407
+ oversample: "none"
3408
+ }, d = (e, t, i, a) => {
3409
+ let d = new Float32Array(o), f = new Float32Array(o);
3410
+ for (let e = 0; e < o; e += 1) {
3411
+ let t = e / (o - 1) * c;
3412
+ d[e] = Math.cos(t), f[e] = Math.sin(t);
3413
+ }
3414
+ let p = n(e, {
3415
+ ...l,
3416
+ gain: 0
3417
+ }), m = r(e, {
3418
+ ...u,
3419
+ curve: d
3420
+ }), h = r(e, {
3421
+ ...u,
3422
+ curve: s
3423
+ }), g = n(e, {
3424
+ ...l,
3425
+ gain: 0
3426
+ }), _ = r(e, {
3427
+ ...u,
3428
+ curve: f
3429
+ });
3430
+ return {
3431
+ connectGraph() {
3432
+ t.connect(p), t.connect(h.inputs === void 0 ? h : h.inputs[0]), t.connect(g), h.connect(i), i.connect(m.inputs === void 0 ? m : m.inputs[0]), i.connect(_.inputs === void 0 ? _ : _.inputs[0]), m.connect(p.gain), _.connect(g.gain), p.connect(a, 0, 0), g.connect(a, 0, 1);
3433
+ },
3434
+ disconnectGraph() {
3435
+ t.disconnect(p), t.disconnect(h.inputs === void 0 ? h : h.inputs[0]), t.disconnect(g), h.disconnect(i), i.disconnect(m.inputs === void 0 ? m : m.inputs[0]), i.disconnect(_.inputs === void 0 ? _ : _.inputs[0]), m.disconnect(p.gain), _.disconnect(g.gain), p.disconnect(a, 0, 0), g.disconnect(a, 0, 1);
3436
+ }
3437
+ };
3438
+ }, f = (e, i, a, d) => {
3439
+ let f = new Float32Array(o), p = new Float32Array(o), m = new Float32Array(o), h = new Float32Array(o), g = 8192;
3440
+ for (let e = 0; e < o; e += 1) if (e > g) {
3441
+ let t = (e - g) / (o - 1 - g) * c;
3442
+ f[e] = Math.cos(t), p[e] = Math.sin(t), m[e] = 0, h[e] = 1;
3443
+ } else {
3444
+ let t = e / (o - 1 - g) * c;
3445
+ f[e] = 1, p[e] = 0, m[e] = Math.cos(t), h[e] = Math.sin(t);
3446
+ }
3447
+ let _ = t(e, {
3448
+ channelCount: 2,
3449
+ channelCountMode: "explicit",
3450
+ channelInterpretation: "discrete",
3451
+ numberOfOutputs: 2
3452
+ }), v = n(e, {
3453
+ ...l,
3454
+ gain: 0
3455
+ }), y = r(e, {
3456
+ ...u,
3457
+ curve: f
3458
+ }), b = n(e, {
3459
+ ...l,
3460
+ gain: 0
3461
+ }), x = r(e, {
3462
+ ...u,
3463
+ curve: p
3464
+ }), S = r(e, {
3465
+ ...u,
3466
+ curve: s
3467
+ }), C = n(e, {
3468
+ ...l,
3469
+ gain: 0
3470
+ }), w = r(e, {
3471
+ ...u,
3472
+ curve: m
3473
+ }), T = n(e, {
3474
+ ...l,
3475
+ gain: 0
3476
+ }), E = r(e, {
3477
+ ...u,
3478
+ curve: h
3479
+ });
3480
+ return {
3481
+ connectGraph() {
3482
+ i.connect(_), i.connect(S.inputs === void 0 ? S : S.inputs[0]), _.connect(v, 0), _.connect(b, 0), _.connect(C, 1), _.connect(T, 1), S.connect(a), a.connect(y.inputs === void 0 ? y : y.inputs[0]), a.connect(x.inputs === void 0 ? x : x.inputs[0]), a.connect(w.inputs === void 0 ? w : w.inputs[0]), a.connect(E.inputs === void 0 ? E : E.inputs[0]), y.connect(v.gain), x.connect(b.gain), w.connect(C.gain), E.connect(T.gain), v.connect(d, 0, 0), C.connect(d, 0, 0), b.connect(d, 0, 1), T.connect(d, 0, 1);
3483
+ },
3484
+ disconnectGraph() {
3485
+ i.disconnect(_), i.disconnect(S.inputs === void 0 ? S : S.inputs[0]), _.disconnect(v, 0), _.disconnect(b, 0), _.disconnect(C, 1), _.disconnect(T, 1), S.disconnect(a), a.disconnect(y.inputs === void 0 ? y : y.inputs[0]), a.disconnect(x.inputs === void 0 ? x : x.inputs[0]), a.disconnect(w.inputs === void 0 ? w : w.inputs[0]), a.disconnect(E.inputs === void 0 ? E : E.inputs[0]), y.disconnect(v.gain), x.disconnect(b.gain), w.disconnect(C.gain), E.disconnect(T.gain), v.disconnect(d, 0, 0), C.disconnect(d, 0, 0), b.disconnect(d, 0, 1), T.disconnect(d, 0, 1);
3486
+ }
3487
+ };
3488
+ }, p = (e, t, n, r, a) => {
3489
+ if (t === 1) return d(e, n, r, a);
3490
+ if (t === 2) return f(e, n, r, a);
3491
+ throw i();
3492
+ };
3493
+ return (t, { channelCount: r, channelCountMode: o, pan: s, ...c }) => {
3494
+ if (o === "max") throw i();
3495
+ let l = e(t, {
3496
+ ...c,
3497
+ channelCount: 1,
3498
+ channelCountMode: o,
3499
+ numberOfInputs: 2
3500
+ }), u = n(t, {
3501
+ ...c,
3502
+ channelCount: r,
3503
+ channelCountMode: o,
3504
+ gain: 1
3505
+ }), d = n(t, {
3506
+ channelCount: 1,
3507
+ channelCountMode: "explicit",
3508
+ channelInterpretation: "discrete",
3509
+ gain: s
3510
+ }), { connectGraph: f, disconnectGraph: m } = p(t, r, u, d, l);
3511
+ Object.defineProperty(d.gain, "defaultValue", { get: () => 0 }), Object.defineProperty(d.gain, "maxValue", { get: () => 1 }), Object.defineProperty(d.gain, "minValue", { get: () => -1 });
3512
+ let h = {
3513
+ get bufferSize() {},
3514
+ get channelCount() {
3515
+ return u.channelCount;
3516
+ },
3517
+ set channelCount(e) {
3518
+ u.channelCount !== e && (g && m(), {connectGraph: f, disconnectGraph: m} = p(t, e, u, d, l), g && f()), u.channelCount = e;
3519
+ },
3520
+ get channelCountMode() {
3521
+ return u.channelCountMode;
3522
+ },
3523
+ set channelCountMode(e) {
3524
+ if (e === "clamped-max" || e === "max") throw i();
3525
+ u.channelCountMode = e;
3526
+ },
3527
+ get channelInterpretation() {
3528
+ return u.channelInterpretation;
3529
+ },
3530
+ set channelInterpretation(e) {
3531
+ u.channelInterpretation = e;
3532
+ },
3533
+ get context() {
3534
+ return u.context;
3535
+ },
3536
+ get inputs() {
3537
+ return [u];
3538
+ },
3539
+ get numberOfInputs() {
3540
+ return u.numberOfInputs;
3541
+ },
3542
+ get numberOfOutputs() {
3543
+ return u.numberOfOutputs;
3544
+ },
3545
+ get pan() {
3546
+ return d.gain;
3547
+ },
3548
+ addEventListener(...e) {
3549
+ return u.addEventListener(e[0], e[1], e[2]);
3550
+ },
3551
+ dispatchEvent(...e) {
3552
+ return u.dispatchEvent(e[0]);
3553
+ },
3554
+ removeEventListener(...e) {
3555
+ return u.removeEventListener(e[0], e[1], e[2]);
3556
+ }
3557
+ }, g = !1;
3558
+ return a(hi(h, l), () => {
3559
+ f(), g = !0;
3560
+ }, () => {
3561
+ m(), g = !1;
3562
+ });
3563
+ };
3564
+ }, Li = (e, t, n, r, i, a, o) => (s, c) => {
3565
+ let l = s.createWaveShaper();
3566
+ if (a !== null && a.name === "webkitAudioContext" && s.createGain().gain.automationRate === void 0) return n(s, c);
3567
+ H(l, c);
3568
+ let u = c.curve === null || c.curve instanceof Float32Array ? c.curve : new Float32Array(c.curve);
3569
+ if (u !== null && u.length < 2) throw t();
3570
+ V(l, { curve: u }, "curve"), V(l, c, "oversample");
3571
+ let d = null, f = !1;
3572
+ return o(l, "curve", (e) => () => e.call(l), (t) => (n) => (t.call(l, n), f && (r(n) && d === null ? d = e(s, l) : !r(n) && d !== null && (d(), d = null)), n)), i(l, () => {
3573
+ f = !0, r(l.curve) && (d = e(s, l));
3574
+ }, () => {
3575
+ f = !1, d !== null && (d(), d = null);
3576
+ });
3577
+ }, Ri = (e, t, n, r, i) => (a, { curve: o, oversample: s, ...c }) => {
3578
+ let l = a.createWaveShaper(), u = a.createWaveShaper();
3579
+ H(l, c), H(u, c);
3580
+ let d = n(a, {
3581
+ ...c,
3582
+ gain: 1
3583
+ }), f = n(a, {
3584
+ ...c,
3585
+ gain: -1
3586
+ }), p = n(a, {
3587
+ ...c,
3588
+ gain: 1
3589
+ }), m = n(a, {
3590
+ ...c,
3591
+ gain: -1
3592
+ }), h = null, g = !1, _ = null, v = {
3593
+ get bufferSize() {},
3594
+ get channelCount() {
3595
+ return l.channelCount;
3596
+ },
3597
+ set channelCount(e) {
3598
+ d.channelCount = e, f.channelCount = e, l.channelCount = e, p.channelCount = e, u.channelCount = e, m.channelCount = e;
3599
+ },
3600
+ get channelCountMode() {
3601
+ return l.channelCountMode;
3602
+ },
3603
+ set channelCountMode(e) {
3604
+ d.channelCountMode = e, f.channelCountMode = e, l.channelCountMode = e, p.channelCountMode = e, u.channelCountMode = e, m.channelCountMode = e;
3605
+ },
3606
+ get channelInterpretation() {
3607
+ return l.channelInterpretation;
3608
+ },
3609
+ set channelInterpretation(e) {
3610
+ d.channelInterpretation = e, f.channelInterpretation = e, l.channelInterpretation = e, p.channelInterpretation = e, u.channelInterpretation = e, m.channelInterpretation = e;
3611
+ },
3612
+ get context() {
3613
+ return l.context;
3614
+ },
3615
+ get curve() {
3616
+ return _;
3617
+ },
3618
+ set curve(n) {
3619
+ if (n !== null && n.length < 2) throw t();
3620
+ if (n === null) l.curve = n, u.curve = n;
3621
+ else {
3622
+ let e = n.length, t = new Float32Array(e + 2 - e % 2), r = new Float32Array(e + 2 - e % 2);
3623
+ t[0] = n[0], r[0] = -n[e - 1];
3624
+ let i = Math.ceil((e + 1) / 2), a = (e + 1) / 2 - 1;
3625
+ for (let o = 1; o < i; o += 1) {
3626
+ let s = o / i * a, c = Math.floor(s), l = Math.ceil(s);
3627
+ t[o] = c === l ? n[c] : (1 - (s - c)) * n[c] + (1 - (l - s)) * n[l], r[o] = c === l ? -n[e - 1 - c] : -((1 - (s - c)) * n[e - 1 - c]) - (1 - (l - s)) * n[e - 1 - l];
3628
+ }
3629
+ t[i] = e % 2 == 1 ? n[i - 1] : (n[i - 2] + n[i - 1]) / 2, l.curve = t, u.curve = r;
3630
+ }
3631
+ _ = n, g && (r(_) && h === null ? h = e(a, d) : h !== null && (h(), h = null));
3632
+ },
3633
+ get inputs() {
3634
+ return [d];
3635
+ },
3636
+ get numberOfInputs() {
3637
+ return l.numberOfInputs;
3638
+ },
3639
+ get numberOfOutputs() {
3640
+ return l.numberOfOutputs;
3641
+ },
3642
+ get oversample() {
3643
+ return l.oversample;
3644
+ },
3645
+ set oversample(e) {
3646
+ l.oversample = e, u.oversample = e;
3647
+ },
3648
+ addEventListener(...e) {
3649
+ return d.addEventListener(e[0], e[1], e[2]);
3650
+ },
3651
+ dispatchEvent(...e) {
3652
+ return d.dispatchEvent(e[0]);
3653
+ },
3654
+ removeEventListener(...e) {
3655
+ return d.removeEventListener(e[0], e[1], e[2]);
3656
+ }
3657
+ };
3658
+ return o !== null && (v.curve = o instanceof Float32Array ? o : new Float32Array(o)), s !== v.oversample && (v.oversample = s), i(hi(v, p), () => {
3659
+ d.connect(l).connect(p), d.connect(f).connect(u).connect(m).connect(p), g = !0, r(_) && (h = e(a, d));
3660
+ }, () => {
3661
+ d.disconnect(l), l.disconnect(p), d.disconnect(f), f.disconnect(u), u.disconnect(m), m.disconnect(p), g = !1, h !== null && (h(), h = null);
3662
+ });
3663
+ }, G = () => new DOMException("", "NotSupportedError"), zi = {
3664
+ channelCount: 2,
3665
+ channelCountMode: "max",
3666
+ channelInterpretation: "speakers",
3667
+ detune: 0,
3668
+ frequency: 440,
3669
+ periodicWave: void 0,
3670
+ type: "sine"
3671
+ }, Bi = (e, t, n, r, i, a, o) => class extends e {
3672
+ constructor(e, o) {
3673
+ let s = i(e), c = {
3674
+ ...zi,
3675
+ ...o
3676
+ }, l = n(s, c), u = a(s), d = u ? r() : null, f = e.sampleRate / 2;
3677
+ super(e, !1, l, d), this._detune = t(this, u, l.detune, 153600, -153600), this._frequency = t(this, u, l.frequency, f, -f), this._nativeOscillatorNode = l, this._onended = null, this._oscillatorNodeRenderer = d, this._oscillatorNodeRenderer !== null && c.periodicWave !== void 0 && (this._oscillatorNodeRenderer.periodicWave = c.periodicWave);
3678
+ }
3679
+ get detune() {
3680
+ return this._detune;
3681
+ }
3682
+ get frequency() {
3683
+ return this._frequency;
3684
+ }
3685
+ get onended() {
3686
+ return this._onended;
3687
+ }
3688
+ set onended(e) {
3689
+ let t = typeof e == "function" ? o(this, e) : null;
3690
+ this._nativeOscillatorNode.onended = t;
3691
+ let n = this._nativeOscillatorNode.onended;
3692
+ this._onended = n !== null && n === t ? e : n;
3693
+ }
3694
+ get type() {
3695
+ return this._nativeOscillatorNode.type;
3696
+ }
3697
+ set type(e) {
3698
+ this._nativeOscillatorNode.type = e, this._oscillatorNodeRenderer !== null && (this._oscillatorNodeRenderer.periodicWave = null);
3699
+ }
3700
+ setPeriodicWave(e) {
3701
+ this._nativeOscillatorNode.setPeriodicWave(e), this._oscillatorNodeRenderer !== null && (this._oscillatorNodeRenderer.periodicWave = e);
3702
+ }
3703
+ start(e = 0) {
3704
+ if (this._nativeOscillatorNode.start(e), this._oscillatorNodeRenderer !== null && (this._oscillatorNodeRenderer.start = e), this.context.state !== "closed") {
3705
+ Ot(this);
3706
+ let e = () => {
3707
+ this._nativeOscillatorNode.removeEventListener("ended", e), Ut(this) && At(this);
3708
+ };
3709
+ this._nativeOscillatorNode.addEventListener("ended", e);
3710
+ }
3711
+ }
3712
+ stop(e = 0) {
3713
+ this._nativeOscillatorNode.stop(e), this._oscillatorNodeRenderer !== null && (this._oscillatorNodeRenderer.stop = e);
3714
+ }
3715
+ }, Vi = (e, t, n, r, i) => () => {
3716
+ let a = /* @__PURE__ */ new WeakMap(), o = null, s = null, c = null, l = async (l, u) => {
3717
+ let d = n(l), f = F(d, u);
3718
+ return f || (d = t(u, {
3719
+ channelCount: d.channelCount,
3720
+ channelCountMode: d.channelCountMode,
3721
+ channelInterpretation: d.channelInterpretation,
3722
+ detune: d.detune.value,
3723
+ frequency: d.frequency.value,
3724
+ periodicWave: o === null ? void 0 : o,
3725
+ type: d.type
3726
+ }), s !== null && d.start(s), c !== null && d.stop(c)), a.set(u, d), f ? (await e(u, l.detune, d.detune), await e(u, l.frequency, d.frequency)) : (await r(u, l.detune, d.detune), await r(u, l.frequency, d.frequency)), await i(l, u, d), d;
3727
+ };
3728
+ return {
3729
+ set periodicWave(e) {
3730
+ o = e;
3731
+ },
3732
+ set start(e) {
3733
+ s = e;
3734
+ },
3735
+ set stop(e) {
3736
+ c = e;
3737
+ },
3738
+ render(e, t) {
3739
+ let n = a.get(t);
3740
+ return n === void 0 ? l(e, t) : Promise.resolve(n);
3741
+ }
3742
+ };
3743
+ }, Hi = {
3744
+ channelCount: 2,
3745
+ channelCountMode: "clamped-max",
3746
+ channelInterpretation: "speakers",
3747
+ coneInnerAngle: 360,
3748
+ coneOuterAngle: 360,
3749
+ coneOuterGain: 0,
3750
+ distanceModel: "inverse",
3751
+ maxDistance: 1e4,
3752
+ orientationX: 1,
3753
+ orientationY: 0,
3754
+ orientationZ: 0,
3755
+ panningModel: "equalpower",
3756
+ positionX: 0,
3757
+ positionY: 0,
3758
+ positionZ: 0,
3759
+ refDistance: 1,
3760
+ rolloffFactor: 1
3761
+ }, Ui = (e, t, n, r, i, a, o) => class extends e {
3762
+ constructor(e, s) {
3763
+ let c = i(e), l = n(c, {
3764
+ ...Hi,
3765
+ ...s
3766
+ }), u = a(c), d = u ? r() : null;
3767
+ super(e, !1, l, d), this._nativePannerNode = l, this._orientationX = t(this, u, l.orientationX, L, I), this._orientationY = t(this, u, l.orientationY, L, I), this._orientationZ = t(this, u, l.orientationZ, L, I), this._positionX = t(this, u, l.positionX, L, I), this._positionY = t(this, u, l.positionY, L, I), this._positionZ = t(this, u, l.positionZ, L, I), o(this, 1);
3768
+ }
3769
+ get coneInnerAngle() {
3770
+ return this._nativePannerNode.coneInnerAngle;
3771
+ }
3772
+ set coneInnerAngle(e) {
3773
+ this._nativePannerNode.coneInnerAngle = e;
3774
+ }
3775
+ get coneOuterAngle() {
3776
+ return this._nativePannerNode.coneOuterAngle;
3777
+ }
3778
+ set coneOuterAngle(e) {
3779
+ this._nativePannerNode.coneOuterAngle = e;
3780
+ }
3781
+ get coneOuterGain() {
3782
+ return this._nativePannerNode.coneOuterGain;
3783
+ }
3784
+ set coneOuterGain(e) {
3785
+ this._nativePannerNode.coneOuterGain = e;
3786
+ }
3787
+ get distanceModel() {
3788
+ return this._nativePannerNode.distanceModel;
3789
+ }
3790
+ set distanceModel(e) {
3791
+ this._nativePannerNode.distanceModel = e;
3792
+ }
3793
+ get maxDistance() {
3794
+ return this._nativePannerNode.maxDistance;
3795
+ }
3796
+ set maxDistance(e) {
3797
+ this._nativePannerNode.maxDistance = e;
3798
+ }
3799
+ get orientationX() {
3800
+ return this._orientationX;
3801
+ }
3802
+ get orientationY() {
3803
+ return this._orientationY;
3804
+ }
3805
+ get orientationZ() {
3806
+ return this._orientationZ;
3807
+ }
3808
+ get panningModel() {
3809
+ return this._nativePannerNode.panningModel;
3810
+ }
3811
+ set panningModel(e) {
3812
+ this._nativePannerNode.panningModel = e;
3813
+ }
3814
+ get positionX() {
3815
+ return this._positionX;
3816
+ }
3817
+ get positionY() {
3818
+ return this._positionY;
3819
+ }
3820
+ get positionZ() {
3821
+ return this._positionZ;
3822
+ }
3823
+ get refDistance() {
3824
+ return this._nativePannerNode.refDistance;
3825
+ }
3826
+ set refDistance(e) {
3827
+ this._nativePannerNode.refDistance = e;
3828
+ }
3829
+ get rolloffFactor() {
3830
+ return this._nativePannerNode.rolloffFactor;
3831
+ }
3832
+ set rolloffFactor(e) {
3833
+ this._nativePannerNode.rolloffFactor = e;
3834
+ }
3835
+ }, Wi = (e, t, n, r, i, a, o, s, c, l) => () => {
3836
+ let u = /* @__PURE__ */ new WeakMap(), d = null, f = async (f, p) => {
3837
+ let m = null, h = a(f), g = {
3838
+ channelCount: h.channelCount,
3839
+ channelCountMode: h.channelCountMode,
3840
+ channelInterpretation: h.channelInterpretation
3841
+ }, _ = {
3842
+ ...g,
3843
+ coneInnerAngle: h.coneInnerAngle,
3844
+ coneOuterAngle: h.coneOuterAngle,
3845
+ coneOuterGain: h.coneOuterGain,
3846
+ distanceModel: h.distanceModel,
3847
+ maxDistance: h.maxDistance,
3848
+ panningModel: h.panningModel,
3849
+ refDistance: h.refDistance,
3850
+ rolloffFactor: h.rolloffFactor
3851
+ }, v = F(h, p);
3852
+ if ("bufferSize" in h ? m = r(p, {
3853
+ ...g,
3854
+ gain: 1
3855
+ }) : v || (h = i(p, {
3856
+ ..._,
3857
+ orientationX: h.orientationX.value,
3858
+ orientationY: h.orientationY.value,
3859
+ orientationZ: h.orientationZ.value,
3860
+ positionX: h.positionX.value,
3861
+ positionY: h.positionY.value,
3862
+ positionZ: h.positionZ.value
3863
+ })), u.set(p, m === null ? h : m), m !== null) {
3864
+ if (d === null) {
3865
+ if (o === null) throw Error("Missing the native OfflineAudioContext constructor.");
3866
+ let e = new o(6, f.context.length, p.sampleRate), r = t(e, {
3867
+ channelCount: 1,
3868
+ channelCountMode: "explicit",
3869
+ channelInterpretation: "speakers",
3870
+ numberOfInputs: 6
3871
+ });
3872
+ r.connect(e.destination), d = (async () => {
3873
+ let t = await Promise.all([
3874
+ f.orientationX,
3875
+ f.orientationY,
3876
+ f.orientationZ,
3877
+ f.positionX,
3878
+ f.positionY,
3879
+ f.positionZ
3880
+ ].map(async (t, r) => {
3881
+ let i = n(e, {
3882
+ channelCount: 1,
3883
+ channelCountMode: "explicit",
3884
+ channelInterpretation: "discrete",
3885
+ offset: +(r === 0)
3886
+ });
3887
+ return await s(e, t, i.offset), i;
3888
+ }));
3889
+ for (let e = 0; e < 6; e += 1) t[e].connect(r, 0, e), t[e].start(0);
3890
+ return l(e);
3891
+ })();
3892
+ }
3893
+ let e = await d, a = r(p, {
3894
+ ...g,
3895
+ gain: 1
3896
+ });
3897
+ await c(f, p, a);
3898
+ let u = [];
3899
+ for (let t = 0; t < e.numberOfChannels; t += 1) u.push(e.getChannelData(t));
3900
+ let h = [
3901
+ u[0][0],
3902
+ u[1][0],
3903
+ u[2][0]
3904
+ ], v = [
3905
+ u[3][0],
3906
+ u[4][0],
3907
+ u[5][0]
3908
+ ], y = r(p, {
3909
+ ...g,
3910
+ gain: 1
3911
+ }), b = i(p, {
3912
+ ..._,
3913
+ orientationX: h[0],
3914
+ orientationY: h[1],
3915
+ orientationZ: h[2],
3916
+ positionX: v[0],
3917
+ positionY: v[1],
3918
+ positionZ: v[2]
3919
+ });
3920
+ a.connect(y).connect(b.inputs[0]), b.connect(m);
3921
+ for (let t = 128; t < e.length; t += 128) {
3922
+ let e = [
3923
+ u[0][t],
3924
+ u[1][t],
3925
+ u[2][t]
3926
+ ], n = [
3927
+ u[3][t],
3928
+ u[4][t],
3929
+ u[5][t]
3930
+ ];
3931
+ if (e.some((e, t) => e !== h[t]) || n.some((e, t) => e !== v[t])) {
3932
+ h = e, v = n;
3933
+ let o = t / p.sampleRate;
3934
+ y.gain.setValueAtTime(0, o), y = r(p, {
3935
+ ...g,
3936
+ gain: 0
3937
+ }), b = i(p, {
3938
+ ..._,
3939
+ orientationX: h[0],
3940
+ orientationY: h[1],
3941
+ orientationZ: h[2],
3942
+ positionX: v[0],
3943
+ positionY: v[1],
3944
+ positionZ: v[2]
3945
+ }), y.gain.setValueAtTime(1, o), a.connect(y).connect(b.inputs[0]), b.connect(m);
3946
+ }
3947
+ }
3948
+ return m;
3949
+ }
3950
+ return v ? (await e(p, f.orientationX, h.orientationX), await e(p, f.orientationY, h.orientationY), await e(p, f.orientationZ, h.orientationZ), await e(p, f.positionX, h.positionX), await e(p, f.positionY, h.positionY), await e(p, f.positionZ, h.positionZ)) : (await s(p, f.orientationX, h.orientationX), await s(p, f.orientationY, h.orientationY), await s(p, f.orientationZ, h.orientationZ), await s(p, f.positionX, h.positionX), await s(p, f.positionY, h.positionY), await s(p, f.positionZ, h.positionZ)), pn(h) ? await c(f, p, h.inputs[0]) : await c(f, p, h), h;
3951
+ };
3952
+ return { render(e, t) {
3953
+ let n = u.get(t);
3954
+ return n === void 0 ? f(e, t) : Promise.resolve(n);
3955
+ } };
3956
+ }, Gi = { disableNormalization: !1 }, Ki = (e, t, n, r) => class i {
3957
+ constructor(i, a) {
3958
+ let o = e(t(i), r({
3959
+ ...Gi,
3960
+ ...a
3961
+ }));
3962
+ return n.add(o), o;
3963
+ }
3964
+ static [Symbol.hasInstance](e) {
3965
+ return typeof e == "object" && !!e && Object.getPrototypeOf(e) === i.prototype || n.has(e);
3966
+ }
3967
+ }, qi = (e, t) => (n, r, i) => (e(r).replay(i), t(r, n, i)), Ji = (e, t, n) => async (r, i, a) => {
3968
+ let o = e(r);
3969
+ await Promise.all(o.activeInputs.map((e, o) => Array.from(e).map(async ([e, s]) => {
3970
+ let c = await t(e).render(e, i), l = r.context.destination;
3971
+ !n(e) && (r !== l || !n(r)) && c.connect(a, s, o);
3972
+ })).reduce((e, t) => [...e, ...t], []));
3973
+ }, Yi = (e, t, n) => async (r, i, a) => {
3974
+ let o = t(r);
3975
+ await Promise.all(Array.from(o.activeInputs).map(async ([t, r]) => {
3976
+ let o = await e(t).render(t, i);
3977
+ n(t) || o.connect(a, r);
3978
+ }));
3979
+ }, Xi = (e, t, n, r) => (i) => e(Xr, () => Xr(i)) ? Promise.resolve(e(r, r)).then((e) => {
3980
+ if (!e) {
3981
+ let e = n(i, 512, 0, 1);
3982
+ i.oncomplete = () => {
3983
+ e.onaudioprocess = null, e.disconnect();
3984
+ }, e.onaudioprocess = () => i.currentTime, e.connect(i.destination);
3985
+ }
3986
+ return i.startRendering();
3987
+ }) : new Promise((e) => {
3988
+ let n = t(i, {
3989
+ channelCount: 1,
3990
+ channelCountMode: "explicit",
3991
+ channelInterpretation: "discrete",
3992
+ gain: 0
3993
+ });
3994
+ i.oncomplete = (t) => {
3995
+ n.disconnect(), e(t.renderedBuffer);
3996
+ }, n.connect(i.destination), i.startRendering();
3997
+ }), Zi = (e) => (t, n) => e.set(t, n), Qi = {
3998
+ channelCount: 2,
3999
+ channelCountMode: "explicit",
4000
+ channelInterpretation: "speakers",
4001
+ pan: 0
4002
+ }, $i = (e, t, n, r, i, a) => class extends e {
4003
+ constructor(e, o) {
4004
+ let s = i(e), c = n(s, {
4005
+ ...Qi,
4006
+ ...o
4007
+ }), l = a(s), u = l ? r() : null;
4008
+ super(e, !1, c, u), this._pan = t(this, l, c.pan);
4009
+ }
4010
+ get pan() {
4011
+ return this._pan;
4012
+ }
4013
+ }, ea = (e, t, n, r, i) => () => {
4014
+ let a = /* @__PURE__ */ new WeakMap(), o = async (o, s) => {
4015
+ let c = n(o), l = F(c, s);
4016
+ return l || (c = t(s, {
4017
+ channelCount: c.channelCount,
4018
+ channelCountMode: c.channelCountMode,
4019
+ channelInterpretation: c.channelInterpretation,
4020
+ pan: c.pan.value
4021
+ })), a.set(s, c), l ? await e(s, o.pan, c.pan) : await r(s, o.pan, c.pan), pn(c) ? await i(o, s, c.inputs[0]) : await i(o, s, c), c;
4022
+ };
4023
+ return { render(e, t) {
4024
+ let n = a.get(t);
4025
+ return n === void 0 ? o(e, t) : Promise.resolve(n);
4026
+ } };
4027
+ }, ta = (e) => () => {
4028
+ if (e === null) return !1;
4029
+ try {
4030
+ new e({
4031
+ length: 1,
4032
+ sampleRate: 44100
4033
+ });
4034
+ } catch {
4035
+ return !1;
4036
+ }
4037
+ return !0;
4038
+ }, na = (e, t) => async () => {
4039
+ if (e === null) return !0;
4040
+ if (t === null) return !1;
4041
+ let n = new Blob(["class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor(\"a\",A)"], { type: "application/javascript; charset=utf-8" }), r = new t(1, 128, 44100), i = URL.createObjectURL(n), a = !1, o = !1;
4042
+ try {
4043
+ await r.audioWorklet.addModule(i);
4044
+ let t = new e(r, "a", { numberOfOutputs: 0 }), n = r.createOscillator();
4045
+ t.port.onmessage = () => a = !0, t.onprocessorerror = () => o = !0, n.connect(t), n.start(0), await r.startRendering(), await new Promise((e) => setTimeout(e));
4046
+ } catch {} finally {
4047
+ URL.revokeObjectURL(i);
4048
+ }
4049
+ return a && !o;
4050
+ }, ra = (e, t) => () => {
4051
+ if (t === null) return Promise.resolve(!1);
4052
+ let n = new t(1, 1, 44100), r = e(n, {
4053
+ channelCount: 1,
4054
+ channelCountMode: "explicit",
4055
+ channelInterpretation: "discrete",
4056
+ gain: 0
4057
+ });
4058
+ return new Promise((e) => {
4059
+ n.oncomplete = () => {
4060
+ r.disconnect(), e(n.currentTime !== 0);
4061
+ }, n.startRendering();
4062
+ });
4063
+ }, ia = () => new DOMException("", "UnknownError"), aa = {
4064
+ channelCount: 2,
4065
+ channelCountMode: "max",
4066
+ channelInterpretation: "speakers",
4067
+ curve: null,
4068
+ oversample: "none"
4069
+ }, oa = (e, t, n, r, i, a, o) => class extends e {
4070
+ constructor(e, t) {
4071
+ let s = i(e), c = n(s, {
4072
+ ...aa,
4073
+ ...t
4074
+ }), l = a(s) ? r() : null;
4075
+ super(e, !0, c, l), this._isCurveNullified = !1, this._nativeWaveShaperNode = c, o(this, 1);
4076
+ }
4077
+ get curve() {
4078
+ return this._isCurveNullified ? null : this._nativeWaveShaperNode.curve;
4079
+ }
4080
+ set curve(e) {
4081
+ if (e === null) this._isCurveNullified = !0, this._nativeWaveShaperNode.curve = new Float32Array([0, 0]);
4082
+ else {
4083
+ if (e.length < 2) throw t();
4084
+ this._isCurveNullified = !1, this._nativeWaveShaperNode.curve = e;
4085
+ }
4086
+ }
4087
+ get oversample() {
4088
+ return this._nativeWaveShaperNode.oversample;
4089
+ }
4090
+ set oversample(e) {
4091
+ this._nativeWaveShaperNode.oversample = e;
4092
+ }
4093
+ }, sa = (e, t, n) => () => {
4094
+ let r = /* @__PURE__ */ new WeakMap(), i = async (i, a) => {
4095
+ let o = t(i);
4096
+ return F(o, a) || (o = e(a, {
4097
+ channelCount: o.channelCount,
4098
+ channelCountMode: o.channelCountMode,
4099
+ channelInterpretation: o.channelInterpretation,
4100
+ curve: o.curve,
4101
+ oversample: o.oversample
4102
+ })), r.set(a, o), pn(o) ? await n(i, a, o.inputs[0]) : await n(i, a, o), o;
4103
+ };
4104
+ return { render(e, t) {
4105
+ let n = r.get(t);
4106
+ return n === void 0 ? i(e, t) : Promise.resolve(n);
4107
+ } };
4108
+ }, ca = () => typeof window > "u" ? null : window, la = (e, t) => (n) => {
4109
+ n.copyFromChannel = (r, i, a = 0) => {
4110
+ let o = e(a), s = e(i);
4111
+ if (s >= n.numberOfChannels) throw t();
4112
+ let c = n.length, l = n.getChannelData(s), u = r.length;
4113
+ for (let e = o < 0 ? -o : 0; e + o < c && e < u; e += 1) r[e] = l[e + o];
4114
+ }, n.copyToChannel = (r, i, a = 0) => {
4115
+ let o = e(a), s = e(i);
4116
+ if (s >= n.numberOfChannels) throw t();
4117
+ let c = n.length, l = n.getChannelData(s), u = r.length;
4118
+ for (let e = o < 0 ? -o : 0; e + o < c && e < u; e += 1) l[e + o] = r[e];
4119
+ };
4120
+ }, ua = (e) => (t) => {
4121
+ t.copyFromChannel = ((n) => (r, i, a = 0) => {
4122
+ let o = e(a), s = e(i);
4123
+ if (o < t.length) return n.call(t, r, s, o);
4124
+ })(t.copyFromChannel), t.copyToChannel = ((n) => (r, i, a = 0) => {
4125
+ let o = e(a), s = e(i);
4126
+ if (o < t.length) return n.call(t, r, s, o);
4127
+ })(t.copyToChannel);
4128
+ }, da = (e) => (t, n) => {
4129
+ let r = n.createBuffer(1, 1, 44100);
4130
+ t.buffer === null && (t.buffer = r), e(t, "buffer", (e) => () => {
4131
+ let n = e.call(t);
4132
+ return n === r ? null : n;
4133
+ }, (e) => (n) => e.call(t, n === null ? r : n));
4134
+ }, fa = (e, t) => (n, r) => {
4135
+ r.channelCount = 1, r.channelCountMode = "explicit", Object.defineProperty(r, "channelCount", {
4136
+ get: () => 1,
4137
+ set: () => {
4138
+ throw e();
4139
+ }
4140
+ }), Object.defineProperty(r, "channelCountMode", {
4141
+ get: () => "explicit",
4142
+ set: () => {
4143
+ throw e();
4144
+ }
4145
+ });
4146
+ let i = n.createBufferSource();
4147
+ t(r, () => {
4148
+ let e = r.numberOfInputs;
4149
+ for (let t = 0; t < e; t += 1) i.connect(r, 0, t);
4150
+ }, () => i.disconnect(r));
4151
+ }, pa = (e, t, n) => e.copyFromChannel === void 0 ? e.getChannelData(n)[0] : (e.copyFromChannel(t, n), t[0]), ma = (e) => {
4152
+ if (e === null) return !1;
4153
+ let t = e.length;
4154
+ return t % 2 == 0 ? e[t / 2 - 1] + e[t / 2] !== 0 : e[Math.floor(t / 2)] !== 0;
4155
+ }, ha = (e, t, n, r) => {
4156
+ let i = e;
4157
+ for (; !i.hasOwnProperty(t);) i = Object.getPrototypeOf(i);
4158
+ let { get: a, set: o } = Object.getOwnPropertyDescriptor(i, t);
4159
+ Object.defineProperty(e, t, {
4160
+ get: n(a),
4161
+ set: r(o)
4162
+ });
4163
+ }, ga = (e) => ({
4164
+ ...e,
4165
+ channelCount: e.numberOfOutputs
4166
+ }), _a = (e) => {
4167
+ let { imag: t, real: n } = e;
4168
+ return t === void 0 ? n === void 0 ? {
4169
+ ...e,
4170
+ imag: [0, 0],
4171
+ real: [0, 0]
4172
+ } : {
4173
+ ...e,
4174
+ imag: Array.from(n, () => 0),
4175
+ real: n
4176
+ } : n === void 0 ? {
4177
+ ...e,
4178
+ imag: t,
4179
+ real: Array.from(t, () => 0)
4180
+ } : {
4181
+ ...e,
4182
+ imag: t,
4183
+ real: n
4184
+ };
4185
+ }, va = (e, t, n) => {
4186
+ try {
4187
+ e.setValueAtTime(t, n);
4188
+ } catch (r) {
4189
+ if (r.code !== 9) throw r;
4190
+ va(e, t, n + 1e-7);
4191
+ }
4192
+ }, ya = (e) => {
4193
+ let t = e.createBufferSource();
4194
+ t.start();
4195
+ try {
4196
+ t.start();
4197
+ } catch {
4198
+ return !0;
4199
+ }
4200
+ return !1;
4201
+ }, ba = (e) => {
4202
+ let t = e.createBufferSource();
4203
+ t.buffer = e.createBuffer(1, 1, 44100);
4204
+ try {
4205
+ t.start(0, 1);
4206
+ } catch {
4207
+ return !1;
4208
+ }
4209
+ return !0;
4210
+ }, xa = (e) => {
4211
+ let t = e.createBufferSource();
4212
+ t.start();
4213
+ try {
4214
+ t.stop();
4215
+ } catch {
4216
+ return !1;
4217
+ }
4218
+ return !0;
4219
+ }, Sa = (e) => {
4220
+ let t = e.createOscillator();
4221
+ try {
4222
+ t.start(-1);
4223
+ } catch (e) {
4224
+ return e instanceof RangeError;
4225
+ }
4226
+ return !1;
4227
+ }, Ca = (e) => {
4228
+ let t = e.createBuffer(1, 1, 44100), n = e.createBufferSource();
4229
+ n.buffer = t, n.start(), n.stop();
4230
+ try {
4231
+ return n.stop(), !0;
4232
+ } catch {
4233
+ return !1;
4234
+ }
4235
+ }, wa = (e) => {
4236
+ let t = e.createOscillator();
4237
+ try {
4238
+ t.stop(-1);
4239
+ } catch (e) {
4240
+ return e instanceof RangeError;
4241
+ }
4242
+ return !1;
4243
+ }, Ta = (e) => {
4244
+ e.start = ((t) => (n = 0, r = 0, i) => {
4245
+ let a = e.buffer, o = a === null ? r : Math.min(a.duration, r);
4246
+ a !== null && o > a.duration - .5 / e.context.sampleRate ? t.call(e, n, 0, 0) : t.call(e, n, o, i);
4247
+ })(e.start);
4248
+ }, Ea = (e, t) => {
4249
+ let n = t.createGain();
4250
+ e.connect(n);
4251
+ let r = ((t) => () => {
4252
+ t.call(e, n), e.removeEventListener("ended", r);
4253
+ })(e.disconnect);
4254
+ e.addEventListener("ended", r), hi(e, n), e.stop = ((t) => {
4255
+ let r = !1;
4256
+ return (i = 0) => {
4257
+ if (r) try {
4258
+ t.call(e, i);
4259
+ } catch {
4260
+ n.gain.setValueAtTime(0, i);
4261
+ }
4262
+ else t.call(e, i), r = !0;
4263
+ };
4264
+ })(e.stop);
4265
+ }, Da = (e, t) => (n) => {
4266
+ let r = { value: e };
4267
+ return Object.defineProperties(n, {
4268
+ currentTarget: r,
4269
+ target: r
4270
+ }), typeof t == "function" ? t.call(e, n) : t.handleEvent.call(e, n);
4271
+ }, Oa = at(un), ka = Nt(un), Aa = dr(Tt), ja = /* @__PURE__ */ new WeakMap(), Ma = Er(ja), Na = Hn(/* @__PURE__ */ new Map(), /* @__PURE__ */ new WeakMap()), K = ca(), Pa = ei(Na, zt), Fa = Tr(R), q = Ji(R, Fa, xn), Ia = Lt(Pa, z, q), J = Or(pt), La = ki(K), Y = Hr(La), Ra = /* @__PURE__ */ new WeakMap(), za = yr(Da), Ba = oi(K), Va = Rr(Ba), Ha = zr(K), Ua = Br(K), Wa = ci(K), X = Fn(ot(lt), Mt(Oa, ka, mn, Aa, yn, R, Ma, Dt, z, un, Ut, xn, Sn), Na, Lr(ht, yn, R, z, bn, Ut), zt, Ar, G, sr(mn, ht, R, z, bn, J, Ut, Y), pr(Ra, R, wt), za, J, Va, Ha, Ua, Y, Wa), Ga = It(X, Ia, zt, Pa, J, Y), Ka = /* @__PURE__ */ new WeakSet(), qa = ti(K), Ja = er(/* @__PURE__ */ new Uint32Array(1)), Ya = la(Ja, zt), Xa = ua(Ja), Za = Ht(Ka, Na, G, qa, La, ta(qa), Ya, Xa), Qa = Pt(W), $a = Yi(Fa, $t, xn), Z = Yn($a), eo = ai(Qa, Na, ya, ba, xa, Sa, Ca, wa, Ta, da(ha), Ea), to = qi(Dr($t), $a), no = Kt(Z, eo, z, to, q), Q = In(st(dt), Ra, ft, Ln, rt.createCancelAndHoldAutomationEvent, rt.createCancelScheduledValuesAutomationEvent, rt.createExponentialRampToValueAutomationEvent, rt.createLinearRampToValueAutomationEvent, rt.createSetTargetAutomationEvent, rt.createSetValueAutomationEvent, rt.createSetValueCurveAutomationEvent, Ba, va), ro = Gt(X, no, Q, B, eo, J, Y, Da), io = an(X, on, zt, B, si(W, ha), J, Y, q), ao = Vn(Z, ui, z, to, q), oo = Zi(ja), so = Bn(X, Q, ao, Ar, ui, J, Y, oo), co = Zr(un, Ha), lo = di(Ba, fa(B, co)), uo = Wn(X, Gn(lo, z, q), lo, J, Y), fo = qn(X, Jn(pi, z, q), pi, J, Y, ga), po = mi(Qa, Na, gi(Qa, eo, W, co), Sa, wa), mo = Qn(X, Q, $n(Z, po, z, to, q), po, J, Y, Da), ho = _i(G, ha), go = nr(X, rr(ho, z, q), ho, J, Y, oo), _o = lr(X, Q, ur(Z, vi, z, to, q), vi, J, Y, oo), vo = yi(G), yo = hr(X, Q, gr(Z, vo, z, to, q), vo, G, J, Y, oo), bo = Cr(X, Q, wr(Z, W, z, to, q), W, J, Y), xo = wi(Ar, B, Pi, G), So = Xi(Na, W, Pi, ra(W, La)), Co = Ir(eo, z, La, q, So), wo = Nr(X, bi(xo), Co, J, Y, oo), To = Yr(io, sn(Q, lo, po, Pi, G, pa, Y, ha), za, Y, /* @__PURE__ */ new WeakMap(), Da), Eo = Ai(Qa, Na, Sa, Ca, wa, Ea), Do = Bi(X, Q, Eo, Vi(Z, Eo, z, to, q), J, Y, Da), Oo = Xn(eo), ko = Li(Oo, B, Ri(Oo, B, W, ma, co), ma, co, Ba, ha), Ao = ji(Mi(mn, B, lo, W, Pi, ko, G, yn, pa, co)), jo = Ui(X, Q, Ao, Wi(Z, lo, po, W, Ao, z, La, to, q, So), J, Y, oo), Mo = Ki(Ni(zt), J, /* @__PURE__ */ new WeakSet(), _a), No = Fi(Ii(lo, pi, W, ko, G, co), G), Po = $i(X, Q, No, ea(Z, No, z, to, q), J, Y), Fo = oa(X, B, ko, sa(ko, z, q), J, Y, oo), Io = Ur(K), Lo = br(K), Ro = kr(/* @__PURE__ */ new WeakMap(), La), zo = Io ? Ct(Na, G, vr(K), Lo, xr(it), J, Ro, Y, Wa, /* @__PURE__ */ new WeakMap(), /* @__PURE__ */ new WeakMap(), na(Wa, La), K) : void 0, Bo = Vr(Va, Y), Vo = rn(Rn(zo, Ga, Za, ro, so, uo, fo, mo, go, or(Ka, Na, ir, _r, /* @__PURE__ */ new WeakSet(), J, Bo, Rt, Xr, Ya, Xa), _o, yo, bo, wo, To, Do, jo, Mo, Po, Fo), B, G, ia, Wr(X, Ti, J, Y), Kr(X, Ei, J, Y), qr(X, Di, J, Y), Jr(X, Oi(B, Y), J), Ba), $;
4272
+ (function(e) {
4273
+ e.INIT = "INIT", e.PLAYING = "PLAYING", e.STOPPED = "STOPPED", e.PAUSED = "PAUSED";
4274
+ })($ ||= {});
4275
+ var Ho;
4276
+ (function(e) {
4277
+ e.STATE_CHANGE = "state-change", e.ITERATION = "iteration";
4278
+ })(Ho ||= {});
4279
+ //#endregion
4280
+ //#region node_modules/@modernized/osmd-audio-player/dist/index.js
4281
+ var Uo = class {
4282
+ constructor(e = new Vo(), t = new Ve()) {
4283
+ this.defaultBpm = 100, this.scoreInstruments = [], this.ready = !1, this.ac = e, this.ac.suspend(), this.instrumentPlayer = t, this.instrumentPlayer.init(this.ac), this.availableInstruments = this.instrumentPlayer.instruments, this.events = new Ge(), this.cursor = null, this.sheet = null, this.scheduler = null, this.iterationSteps = 0, this.currentIterationStep = 0, this.timeoutHandles = [], this.playbackSettings = {
4284
+ bpm: this.defaultBpm,
4285
+ masterVolume: 1
4286
+ }, this.setState($.INIT);
4287
+ }
4288
+ get wholeNoteLength() {
4289
+ return Math.round(60 / this.playbackSettings.bpm * 4e3);
4290
+ }
4291
+ getPlaybackInstrument(e) {
4292
+ if (!this.sheet) return null;
4293
+ let t = this.sheet.Instruments.flatMap((e) => e.Voices).find((t) => t.VoiceId === e);
4294
+ return this.availableInstruments.find((e) => e.midiId === t.midiInstrumentId);
4295
+ }
4296
+ async setInstrument(e, t) {
4297
+ await this.instrumentPlayer.load(t), e.midiInstrumentId = t;
4298
+ }
4299
+ async loadScore(e) {
4300
+ this.ready = !1, this.sheet = e.Sheet, this.scoreInstruments = this.sheet.Instruments, this.cursor = e.cursor, this.sheet.HasBPMInfo && this.setBpm(this.sheet.DefaultStartTempoInBpm), await this.loadInstruments(), this.initInstruments(), this.scheduler = new te(this.wholeNoteLength, this.ac, (e, t) => this.notePlaybackCallback(e, t)), this.countAndSetIterationSteps(), this.ready = !0, this.setState($.STOPPED);
4301
+ }
4302
+ initInstruments() {
4303
+ for (let e of this.sheet.Instruments) for (let t of e.Voices) t.midiInstrumentId = e.MidiInstrumentId;
4304
+ }
4305
+ async loadInstruments() {
4306
+ let e = [];
4307
+ for (let t of this.sheet.Instruments) this.availableInstruments.find((e) => e.midiId === t.MidiInstrumentId) ?? this.fallbackToPiano(t), e.push(this.instrumentPlayer.load(t.MidiInstrumentId));
4308
+ await Promise.all(e);
4309
+ }
4310
+ fallbackToPiano(e) {
4311
+ if (console.warn(`Can't find playback instrument for midiInstrumentId ${e.MidiInstrumentId}. Falling back to piano`), e.MidiInstrumentId = 0, this.availableInstruments.find((e) => e.midiId === 0) == null) throw Error("Piano fallback failed, grand piano not supported");
4312
+ }
4313
+ async play() {
4314
+ await this.ac.resume(), (this.state === $.INIT || this.state === $.STOPPED) && this.cursor.show(), this.setState($.PLAYING), this.scheduler.start();
4315
+ }
4316
+ async stop() {
4317
+ this.setState($.STOPPED), this.stopPlayers(), this.clearTimeouts(), this.scheduler.reset(), this.cursor.reset(), this.currentIterationStep = 0, this.cursor.hide();
4318
+ }
4319
+ pause() {
4320
+ this.setState($.PAUSED), this.ac.suspend(), this.stopPlayers(), this.scheduler.setIterationStep(this.currentIterationStep), this.scheduler.pause(), this.clearTimeouts();
4321
+ }
4322
+ jumpToStep(e) {
4323
+ for (this.pause(), this.currentIterationStep > e && (this.cursor.reset(), this.currentIterationStep = 0); this.currentIterationStep < e;) this.cursor.next(), ++this.currentIterationStep;
4324
+ let t = this.currentIterationStep;
4325
+ this.currentIterationStep > 0 && this.currentIterationStep < this.iterationSteps && ++t, this.scheduler.setIterationStep(t);
4326
+ }
4327
+ setBpm(e) {
4328
+ this.playbackSettings.bpm = e, this.scheduler && (this.scheduler.wholeNoteLength = this.wholeNoteLength);
4329
+ }
4330
+ on(e, t) {
4331
+ this.events.on(e, t);
4332
+ }
4333
+ countAndSetIterationSteps() {
4334
+ this.cursor.reset();
4335
+ let e = 0;
4336
+ for (; !this.cursor.Iterator.EndReached;) this.cursor.Iterator.CurrentVoiceEntries && this.scheduler.loadNotes(this.cursor.Iterator.CurrentVoiceEntries), this.cursor.next(), ++e;
4337
+ this.iterationSteps = e, this.cursor.reset();
4338
+ }
4339
+ notePlaybackCallback(e, t) {
4340
+ if (this.state !== $.PLAYING) return;
4341
+ let n = /* @__PURE__ */ new Map();
4342
+ for (let e of t) {
4343
+ if (e.isRest()) continue;
4344
+ let t = Ue(e, this.wholeNoteLength);
4345
+ if (t === 0) continue;
4346
+ let r = We(e), i = He(e), a = e.ParentVoiceEntry.ParentVoice.midiInstrumentId, o = e.ParentVoiceEntry.ParentVoice.Parent.SubInstruments[0].fixedKey || 0;
4347
+ n.has(a) || n.set(a, []), n.get(a).push({
4348
+ note: e.halfTone - o * 12,
4349
+ duration: t / 1e3,
4350
+ gain: r,
4351
+ articulation: i
4352
+ });
4353
+ }
4354
+ for (let [t, r] of n) this.instrumentPlayer.schedule(t, this.ac.currentTime + e, r);
4355
+ this.timeoutHandles.push(window.setTimeout(() => this.iterationCallback(), Math.max(0, e * 1e3 - 35)), window.setTimeout(() => this.events.emit(Ho.ITERATION, t), e * 1e3));
4356
+ }
4357
+ setState(e) {
4358
+ this.state = e, this.events.emit(Ho.STATE_CHANGE, e);
4359
+ }
4360
+ stopPlayers() {
4361
+ for (let e of this.sheet.Instruments) for (let t of e.Voices) this.instrumentPlayer.stop(t.midiInstrumentId);
4362
+ }
4363
+ clearTimeouts() {
4364
+ for (let e of this.timeoutHandles) clearTimeout(e);
4365
+ this.timeoutHandles = [];
4366
+ }
4367
+ iterationCallback() {
4368
+ this.state === $.PLAYING && (this.currentIterationStep > 0 && this.cursor.next(), ++this.currentIterationStep);
4369
+ }
4370
+ }, Wo = { class: "w-full h-full overflow-y-auto" }, Go = { class: "min-h-full flex flex-col p-4" }, Ko = {
9
4371
  key: 0,
10
4372
  class: "mb-4 text-center"
11
- }, w = { class: "text-2xl font-bold text-gray-900" }, T = { class: "mb-4 flex gap-2 items-center justify-center" }, E = ["disabled"], D = { class: "text-xl" }, O = ["disabled"], k = { class: "flex items-center gap-2" }, A = /* @__PURE__ */ s({
4373
+ }, qo = { class: "text-2xl font-bold text-gray-900" }, Jo = { class: "mb-4 flex gap-2 items-center justify-center" }, Yo = ["disabled"], Xo = { class: "text-xl" }, Zo = ["disabled"], Qo = { class: "flex items-center gap-2" }, $o = /* @__PURE__ */ s({
12
4374
  __name: "View",
13
4375
  props: {
14
4376
  selectedResult: {},
15
4377
  sendTextMessage: { type: Function }
16
4378
  },
17
4379
  setup(e) {
18
- let t = e, n = f(null), s = null, A = null, j = f(!1), M = f(!1), N = f(!1), P = f(200), F = f(!1), I = f(!1), L = async () => {
4380
+ let t = e, n = f(null), s = null, b = null, x = f(!1), S = f(!1), C = f(!1), w = f(200), T = f(!1), E = f(!1), D = async () => {
19
4381
  if (!(!n.value || !t.selectedResult.data?.musicXML)) try {
20
- n.value.innerHTML = "", j.value = !1, M.value = !1, s = new _(n.value, {
4382
+ n.value.innerHTML = "", x.value = !1, S.value = !1, s = new _(n.value, {
21
4383
  autoResize: !0,
22
4384
  backend: "svg",
23
4385
  drawTitle: !1,
24
4386
  followCursor: !0
25
- }), await s.load(t.selectedResult.data.musicXML), await s.render(), A ||= new v(), await A.loadScore(s);
4387
+ }), await s.load(t.selectedResult.data.musicXML), await s.render(), b ||= new Uo(), await b.loadScore(s);
26
4388
  let e = s.Sheet?.SourceMeasures?.[0]?.TempoExpressions;
27
4389
  if (e && e.length > 0) {
28
4390
  let t = e[0], n = t.TempoInBpm || t.tempoInBpm;
29
- n && (P.value = n);
4391
+ n && (w.value = n);
30
4392
  }
31
- A.on("iteration", (e) => {
32
- !F.value && e && e.length === 0 && (A.stop(), M.value = !1);
33
- }), j.value = !0;
4393
+ b.on("iteration", (e) => {
4394
+ !T.value && e && e.length === 0 && (b.stop(), S.value = !1);
4395
+ }), x.value = !0;
34
4396
  } catch (e) {
35
4397
  console.error("Error rendering music:", e), n.value && (n.value.innerHTML = `<div class="text-red-500">Error rendering sheet music: ${e instanceof Error ? e.message : "Unknown error"}</div>`);
36
4398
  }
37
- }, R = async () => {
38
- if (!n.value || !j.value) return;
4399
+ }, O = async () => {
4400
+ if (!n.value || !x.value) return;
39
4401
  let e = n.value.querySelector("svg");
40
4402
  if (e) {
41
- N.value = !0;
4403
+ C.value = !0;
42
4404
  try {
43
- let n = e.viewBox.baseVal.width || e.clientWidth, r = e.viewBox.baseVal.height || e.clientHeight, i = new y({
4405
+ let n = e.viewBox.baseVal.width || e.clientWidth, r = e.viewBox.baseVal.height || e.clientHeight, i = new v({
44
4406
  orientation: n > r ? "landscape" : "portrait",
45
4407
  unit: "pt",
46
4408
  format: "a4"
47
4409
  }), a = i.internal.pageSize.getWidth(), o = i.internal.pageSize.getHeight(), s = Math.min(a / n, o / r), c = n * s, l = r * s;
48
- await b(e, i, {
4410
+ await y(e, i, {
49
4411
  x: (a - c) / 2,
50
4412
  y: (o - l) / 2,
51
4413
  width: c,
@@ -56,50 +4418,50 @@ var x = { class: "w-full h-full overflow-y-auto" }, S = { class: "min-h-full fle
56
4418
  } catch (e) {
57
4419
  console.error("Error exporting PDF:", e);
58
4420
  } finally {
59
- N.value = !1;
4421
+ C.value = !1;
60
4422
  }
61
4423
  }
62
- }, z = async () => {
63
- !A || !j.value || (A.setBpm(Math.max(30, Math.min(300, P.value))), A.metronomeVolume = I.value ? .7 : 0, A.isLooping = F.value, await A.play(), M.value = !0);
64
- }, B = () => {
65
- A && (A.stop(), M.value = !1);
66
- };
67
- return h(P, () => {
68
- A && A.setBpm(Math.max(30, Math.min(300, P.value)));
69
- }), h(F, () => {
70
- A && (A.isLooping = F.value);
71
- }), h(I, () => {
72
- A && (A.metronomeVolume = I.value ? .7 : 0);
4424
+ }, k = async () => {
4425
+ !b || !x.value || (b.setBpm(Math.max(30, Math.min(300, w.value))), b.metronomeVolume = E.value ? .7 : 0, b.isLooping = T.value, await b.play(), S.value = !0);
4426
+ }, A = () => {
4427
+ b && (b.stop(), S.value = !1);
4428
+ };
4429
+ return h(w, () => {
4430
+ b && b.setBpm(Math.max(30, Math.min(300, w.value)));
4431
+ }), h(T, () => {
4432
+ b && (b.isLooping = T.value);
4433
+ }), h(E, () => {
4434
+ b && (b.metronomeVolume = E.value ? .7 : 0);
73
4435
  }), l(() => {
74
- L();
4436
+ D();
75
4437
  }), h(() => t.selectedResult.data?.musicXML, () => {
76
- L();
4438
+ D();
77
4439
  }), u(() => {
78
- A && A.stop();
79
- }), (t, s) => (d(), i("div", x, [a("div", S, [
80
- e.selectedResult.title ? (d(), i("div", C, [a("h2", w, p(e.selectedResult.title), 1)])) : r("", !0),
81
- a("div", T, [
4440
+ b && b.stop();
4441
+ }), (t, s) => (d(), i("div", Wo, [a("div", Go, [
4442
+ e.selectedResult.title ? (d(), i("div", Ko, [a("h2", qo, p(e.selectedResult.title), 1)])) : r("", !0),
4443
+ a("div", Jo, [
82
4444
  a("button", {
83
- onClick: s[0] ||= (e) => M.value ? B() : z(),
84
- disabled: !j.value,
85
- class: c(["px-4 py-2 text-white rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1", M.value ? "bg-red-500" : "bg-blue-500"])
86
- }, [a("span", D, p(M.value ? "⏹" : "▶"), 1), o(" " + p(M.value ? "Stop" : "Play"), 1)], 10, E),
4445
+ onClick: s[0] ||= (e) => S.value ? A() : k(),
4446
+ disabled: !x.value,
4447
+ class: c(["px-4 py-2 text-white rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1", S.value ? "bg-red-500" : "bg-blue-500"])
4448
+ }, [a("span", Xo, p(S.value ? "⏹" : "▶"), 1), o(" " + p(S.value ? "Stop" : "Play"), 1)], 10, Yo),
87
4449
  a("button", {
88
- onClick: R,
89
- disabled: !j.value || N.value,
4450
+ onClick: O,
4451
+ disabled: !x.value || C.value,
90
4452
  class: "px-4 py-2 text-white bg-green-600 rounded disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-1"
91
- }, [s[2] ||= a("span", { class: "text-xl" }, "⬇", -1), o(" " + p(N.value ? "Exporting..." : "PDF"), 1)], 8, O),
92
- a("label", k, [
4453
+ }, [s[2] ||= a("span", { class: "text-xl" }, "⬇", -1), o(" " + p(C.value ? "Exporting..." : "PDF"), 1)], 8, Zo),
4454
+ a("label", Qo, [
93
4455
  s[3] ||= o(" Tempo ", -1),
94
4456
  g(a("input", {
95
- "onUpdate:modelValue": s[1] ||= (e) => P.value = e,
4457
+ "onUpdate:modelValue": s[1] ||= (e) => w.value = e,
96
4458
  type: "number",
97
4459
  min: "30",
98
4460
  max: "300",
99
4461
  class: "w-20 px-2 py-1 border border-gray-300 rounded"
100
4462
  }, null, 512), [[
101
4463
  m,
102
- P.value,
4464
+ w.value,
103
4465
  void 0,
104
4466
  { number: !0 }
105
4467
  ]]),
@@ -113,23 +4475,23 @@ var x = { class: "w-full h-full overflow-y-auto" }, S = { class: "min-h-full fle
113
4475
  }, null, 512)
114
4476
  ])]));
115
4477
  }
116
- }), j = { class: "text-center p-4 bg-purple-50 rounded" }, M = {
4478
+ }), es = { class: "text-center p-4 bg-purple-50 rounded" }, ts = {
117
4479
  key: 0,
118
4480
  class: "text-xs text-gray-600 mt-1 truncate"
119
- }, N = {
4481
+ }, ns = {
120
4482
  toolDefinition: t,
121
4483
  execute: e,
122
4484
  generatingMessage: "Rendering sheet music...",
123
4485
  isEnabled: () => !0,
124
- viewComponent: A,
4486
+ viewComponent: $o,
125
4487
  previewComponent: /* @__PURE__ */ s({
126
4488
  __name: "Preview",
127
4489
  props: { result: {} },
128
4490
  setup(e) {
129
- return (t, n) => (d(), i("div", j, [n[0] ||= a("div", { class: "text-purple-600 font-medium" }, "🎵 Sheet Music", -1), e.result.title ? (d(), i("div", M, p(e.result.title), 1)) : r("", !0)]));
4491
+ return (t, n) => (d(), i("div", es, [n[0] ||= a("div", { class: "text-purple-600 font-medium" }, "🎵 Sheet Music", -1), e.result.title ? (d(), i("div", ts, p(e.result.title), 1)) : r("", !0)]));
130
4492
  }
131
4493
  }),
132
4494
  samples: n
133
- }, P = { plugin: N };
4495
+ }, rs = { plugin: ns };
134
4496
  //#endregion
135
- export { t as TOOL_DEFINITION, P as default, e as executeMusic, N as plugin };
4497
+ export { t as TOOL_DEFINITION, rs as default, e as executeMusic, ns as plugin };