@meersagor/wavesurfer-vue 2.0.0 → 2.0.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.
@@ -1,102 +1,102 @@
1
- import { ref as I, onMounted as D, onUnmounted as st, defineComponent as zt, getCurrentInstance as Gt, openBlock as Xt, createElementBlock as Nt } from "vue";
2
- import Ot from "wavesurfer.js";
3
- const nt = ({ containerRef: o, options: t }) => {
4
- const e = I(null), i = () => {
5
- o.value && (e.value = Ot.create({
6
- container: o.value,
1
+ import { ref as D, onMounted as R, onUnmounted as rt, defineComponent as Yt, getCurrentInstance as Vt, openBlock as jt, createElementBlock as Kt, computed as et } from "vue";
2
+ import Ft from "wavesurfer.js";
3
+ const ot = ({ containerRef: r, options: t }) => {
4
+ const e = D(null), i = () => {
5
+ r.value && (e.value = Ft.create({
6
+ container: r.value,
7
7
  ...t
8
8
  }));
9
9
  }, s = () => {
10
10
  e.value && (e.value.destroy(), e.value = null);
11
11
  };
12
- return D(() => {
12
+ return R(() => {
13
13
  i();
14
- }), st(() => {
14
+ }), rt(() => {
15
15
  s();
16
16
  }), { waveSurfer: e };
17
- }, Yt = (o) => {
18
- const t = I(!1), e = I(!1), i = I(0), s = I(0), r = () => {
17
+ }, Bt = (r) => {
18
+ const t = D(!1), e = D(!1), i = D(0), s = D(0), o = () => {
19
19
  t.value = !1, e.value = !1, i.value = 0;
20
- }, n = (d) => {
21
- t.value = !0, e.value = !1, i.value = 0, s.value = d;
20
+ }, n = (u) => {
21
+ t.value = !0, e.value = !1, i.value = 0, s.value = u;
22
22
  }, l = () => {
23
23
  e.value = !0;
24
24
  }, h = () => {
25
25
  e.value = !1;
26
26
  }, c = () => {
27
- o.value && (i.value = o.value.getCurrentTime());
27
+ r.value && (i.value = r.value.getCurrentTime());
28
28
  }, a = () => {
29
29
  t.value = !1, e.value = !1;
30
30
  };
31
- return D(() => {
32
- o.value && (o.value.on("load", r), o.value.on("ready", n), o.value.on("play", l), o.value.on("pause", h), o.value.on("timeupdate", c), o.value.on("destroy", a));
33
- }), st(() => {
34
- o.value && o.value.unAll();
31
+ return R(() => {
32
+ r.value && (r.value.on("load", o), r.value.on("ready", n), r.value.on("play", l), r.value.on("pause", h), r.value.on("timeupdate", c), r.value.on("destroy", a));
33
+ }), rt(() => {
34
+ r.value && r.value.unAll();
35
35
  }), {
36
36
  isReady: t,
37
37
  isPlaying: e,
38
38
  currentTime: i,
39
39
  totalDuration: s
40
40
  };
41
- }, Vt = ({ containerRef: o, options: t }) => {
42
- const { waveSurfer: e } = nt({ containerRef: o, options: t }), { isReady: i, totalDuration: s, isPlaying: r, currentTime: n } = Yt(e);
41
+ }, Ut = ({ containerRef: r, options: t }) => {
42
+ const { waveSurfer: e } = ot({ containerRef: r, options: t }), { isReady: i, totalDuration: s, isPlaying: o, currentTime: n } = Bt(e);
43
43
  return {
44
44
  waveSurfer: e,
45
45
  isReady: i,
46
46
  totalDuration: s,
47
- isPlaying: r,
47
+ isPlaying: o,
48
48
  currentTime: n
49
49
  };
50
- }, Kt = ["audioprocess", "click", "dblclick", "decode", "drag", "finish", "init", "interaction", "load", "loading", "pause", "play", "ready", "redraw", "redrawcomplete", "scroll", "seeking", "timeupdate", "zoom"], Se = /* @__PURE__ */ zt({
50
+ }, Ht = ["audioprocess", "click", "dblclick", "decode", "drag", "finish", "init", "interaction", "load", "loading", "pause", "play", "ready", "redraw", "redrawcomplete", "scroll", "seeking", "timeupdate", "zoom"], De = /* @__PURE__ */ Yt({
51
51
  __name: "WaveSurferPlayer",
52
52
  props: {
53
53
  options: {}
54
54
  },
55
- setup(o) {
56
- const t = o, e = I(null), { waveSurfer: i } = Vt({ containerRef: e, options: t.options }), s = Gt();
57
- return D(() => {
58
- Kt.forEach((r) => {
59
- i.value?.on(r, (...n) => {
60
- s?.emit(r, ...n);
55
+ setup(r) {
56
+ const t = r, e = D(null), { waveSurfer: i } = Ut({ containerRef: e, options: t.options }), s = Vt();
57
+ return R(() => {
58
+ Ht.forEach((o) => {
59
+ i.value?.on(o, (...n) => {
60
+ s?.emit(o, ...n);
61
61
  });
62
62
  }), s?.emit("waveSurfer", i.value);
63
- }), (r, n) => (Xt(), Nt("div", {
63
+ }), (o, n) => (jt(), Kt("div", {
64
64
  ref_key: "containerRef",
65
65
  ref: e
66
66
  }, null, 512));
67
67
  }
68
- }), z = (o, t = {}) => {
69
- const e = I(null);
68
+ }), z = (r, t = {}) => {
69
+ const e = D(null);
70
70
  return {
71
71
  pluginInstance: e,
72
72
  createPlugin: (s) => {
73
73
  if (s) {
74
- const r = s.registerPlugin(
75
- o.create({
74
+ const o = s.registerPlugin(
75
+ r.create({
76
76
  ...t
77
77
  })
78
78
  );
79
- r && (e.value = r);
79
+ o && (e.value = o);
80
80
  }
81
81
  }
82
82
  };
83
- }, G = (o, { containerRef: t, options: e, pluginOptions: i = {} }) => {
84
- const { waveSurfer: s } = nt({ containerRef: t, options: e }), r = I(null);
85
- return D(() => {
83
+ }, G = (r, { containerRef: t, options: e, pluginOptions: i = {} }) => {
84
+ const { waveSurfer: s } = ot({ containerRef: t, options: e }), o = D(null);
85
+ return R(() => {
86
86
  if (s.value) {
87
87
  const n = s.value.registerPlugin(
88
- o.create({
88
+ r.create({
89
89
  ...i
90
90
  })
91
91
  );
92
- n && (r.value = n);
92
+ n && (o.value = n);
93
93
  }
94
94
  }), {
95
95
  waveSurfer: s,
96
- pluginInstance: r
96
+ pluginInstance: o
97
97
  };
98
98
  };
99
- let jt = class {
99
+ let $t = class {
100
100
  constructor() {
101
101
  this.listeners = {};
102
102
  }
@@ -122,7 +122,7 @@ let jt = class {
122
122
  emit(t, ...e) {
123
123
  this.listeners[t] && this.listeners[t].forEach((i) => i(...e));
124
124
  }
125
- }, At = class extends jt {
125
+ }, qt = class extends $t {
126
126
  constructor(t) {
127
127
  super(), this.subscriptions = [], this.isDestroyed = !1, this.options = t;
128
128
  }
@@ -135,22 +135,22 @@ let jt = class {
135
135
  this.emit("destroy"), this.subscriptions.forEach((t) => t()), this.subscriptions = [], this.isDestroyed = !0, this.wavesurfer = void 0;
136
136
  }
137
137
  };
138
- function rt(o, t) {
139
- const e = t.xmlns ? document.createElementNS(t.xmlns, o) : document.createElement(o);
140
- for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [r, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(rt(r, n));
138
+ function at(r, t) {
139
+ const e = t.xmlns ? document.createElementNS(t.xmlns, r) : document.createElement(r);
140
+ for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [o, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(at(o, n));
141
141
  else i === "style" ? Object.assign(e.style, s) : i === "textContent" ? e.textContent = s : e.setAttribute(i, s.toString());
142
142
  return e;
143
143
  }
144
- function H(o, t, e) {
145
- return rt(o, t || {});
144
+ function H(r, t, e) {
145
+ return at(r, t || {});
146
146
  }
147
- const Ft = { height: 20, timeOffset: 0, formatTimeCallback: (o) => o / 60 > 1 ? `${Math.floor(o / 60)}:${`${(o = Math.round(o % 60)) < 10 ? "0" : ""}${o}`}` : `${Math.round(1e3 * o) / 1e3}` };
148
- let ot = class at extends At {
147
+ const Qt = { height: 20, timeOffset: 0, formatTimeCallback: (r) => r / 60 > 1 ? `${Math.floor(r / 60)}:${`${(r = Math.round(r % 60)) < 10 ? "0" : ""}${r}`}` : `${Math.round(1e3 * r) / 1e3}` };
148
+ let lt = class ht extends qt {
149
149
  constructor(t) {
150
- super(t || {}), this.unsubscribeNotches = [], this.options = Object.assign({}, Ft, t), this.timelineWrapper = this.initTimelineWrapper();
150
+ super(t || {}), this.unsubscribeNotches = [], this.options = Object.assign({}, Qt, t), this.timelineWrapper = this.initTimelineWrapper();
151
151
  }
152
152
  static create(t) {
153
- return new at(t);
153
+ return new ht(t);
154
154
  }
155
155
  onInit() {
156
156
  var t;
@@ -181,56 +181,56 @@ let ot = class at extends At {
181
181
  }
182
182
  virtualAppend(t, e, i) {
183
183
  let s = !1;
184
- const r = (h, c) => {
184
+ const o = (h, c) => {
185
185
  if (!this.wavesurfer) return;
186
- const a = i.clientWidth, d = t >= h && t + a < c;
187
- d !== s && (s = d, d ? e.appendChild(i) : i.remove());
186
+ const a = i.clientWidth, u = t >= h && t + a < c;
187
+ u !== s && (s = u, u ? e.appendChild(i) : i.remove());
188
188
  };
189
189
  if (!this.wavesurfer) return;
190
190
  const n = this.wavesurfer.getScroll(), l = n + this.wavesurfer.getWidth();
191
- r(n, l), this.unsubscribeNotches.push(this.wavesurfer.on("scroll", (h, c, a, d) => {
192
- r(a, d);
191
+ o(n, l), this.unsubscribeNotches.push(this.wavesurfer.on("scroll", (h, c, a, u) => {
192
+ o(a, u);
193
193
  }));
194
194
  }
195
195
  initTimeline() {
196
- var t, e, i, s, r, n, l, h;
197
- this.unsubscribeNotches.forEach((w) => w()), this.unsubscribeNotches = [];
198
- const c = (i = (e = (t = this.wavesurfer) === null || t === void 0 ? void 0 : t.getDuration()) !== null && e !== void 0 ? e : this.options.duration) !== null && i !== void 0 ? i : 0, a = (((s = this.wavesurfer) === null || s === void 0 ? void 0 : s.getWrapper().scrollWidth) || this.timelineWrapper.scrollWidth) / c, d = (r = this.options.timeInterval) !== null && r !== void 0 ? r : this.defaultTimeInterval(a), u = (n = this.options.primaryLabelInterval) !== null && n !== void 0 ? n : this.defaultPrimaryLabelInterval(a), p = this.options.primaryLabelSpacing, b = (l = this.options.secondaryLabelInterval) !== null && l !== void 0 ? l : this.defaultSecondaryLabelInterval(a), x = this.options.secondaryLabelSpacing, g = this.options.insertPosition === "beforebegin", m = H("div", { style: Object.assign({ height: `${this.options.height}px`, overflow: "hidden", fontSize: this.options.height / 2 + "px", whiteSpace: "nowrap" }, g ? { position: "absolute", top: "0", left: "0", right: "0", zIndex: "2" } : { position: "relative" }) });
196
+ var t, e, i, s, o, n, l, h;
197
+ this.unsubscribeNotches.forEach((W) => W()), this.unsubscribeNotches = [];
198
+ const c = (i = (e = (t = this.wavesurfer) === null || t === void 0 ? void 0 : t.getDuration()) !== null && e !== void 0 ? e : this.options.duration) !== null && i !== void 0 ? i : 0, a = (((s = this.wavesurfer) === null || s === void 0 ? void 0 : s.getWrapper().scrollWidth) || this.timelineWrapper.scrollWidth) / c, u = (o = this.options.timeInterval) !== null && o !== void 0 ? o : this.defaultTimeInterval(a), d = (n = this.options.primaryLabelInterval) !== null && n !== void 0 ? n : this.defaultPrimaryLabelInterval(a), p = this.options.primaryLabelSpacing, g = (l = this.options.secondaryLabelInterval) !== null && l !== void 0 ? l : this.defaultSecondaryLabelInterval(a), y = this.options.secondaryLabelSpacing, f = this.options.insertPosition === "beforebegin", m = H("div", { style: Object.assign({ height: `${this.options.height}px`, overflow: "hidden", fontSize: this.options.height / 2 + "px", whiteSpace: "nowrap" }, f ? { position: "absolute", top: "0", left: "0", right: "0", zIndex: "2" } : { position: "relative" }) });
199
199
  m.setAttribute("part", "timeline"), typeof this.options.style == "string" ? m.setAttribute("style", m.getAttribute("style") + this.options.style) : typeof this.options.style == "object" && Object.assign(m.style, this.options.style);
200
- const y = H("div", { style: { width: "0", height: "50%", display: "flex", flexDirection: "column", justifyContent: g ? "flex-start" : "flex-end", top: g ? "0" : "auto", bottom: g ? "auto" : "0", overflow: "visible", borderLeft: "1px solid currentColor", opacity: `${(h = this.options.secondaryLabelOpacity) !== null && h !== void 0 ? h : 0.25}`, position: "absolute", zIndex: "1" } });
201
- for (let w = 0, v = 0; w < c; w += d, v++) {
202
- const f = y.cloneNode(), C = Math.round(100 * w) % Math.round(100 * u) == 0 || p && v % p == 0, W = Math.round(100 * w) % Math.round(100 * b) == 0 || x && v % x == 0;
203
- (C || W) && (f.style.height = "100%", f.style.textIndent = "3px", f.textContent = this.options.formatTimeCallback(w), C && (f.style.opacity = "1"));
204
- const S = C ? "primary" : W ? "secondary" : "tick";
205
- f.setAttribute("part", `timeline-notch timeline-notch-${S}`);
206
- const M = Math.round(100 * (w + this.options.timeOffset)) / 100 * a;
207
- f.style.left = `${M}px`, this.virtualAppend(M, m, f);
200
+ const w = H("div", { style: { width: "0", height: "50%", display: "flex", flexDirection: "column", justifyContent: f ? "flex-start" : "flex-end", top: f ? "0" : "auto", bottom: f ? "auto" : "0", overflow: "visible", borderLeft: "1px solid currentColor", opacity: `${(h = this.options.secondaryLabelOpacity) !== null && h !== void 0 ? h : 0.25}`, position: "absolute", zIndex: "1" } });
201
+ for (let W = 0, v = 0; W < c; W += u, v++) {
202
+ const b = w.cloneNode(), x = Math.round(100 * W) % Math.round(100 * d) == 0 || p && v % p == 0, C = Math.round(100 * W) % Math.round(100 * g) == 0 || y && v % y == 0;
203
+ (x || C) && (b.style.height = "100%", b.style.textIndent = "3px", b.textContent = this.options.formatTimeCallback(W), x && (b.style.opacity = "1"));
204
+ const M = x ? "primary" : C ? "secondary" : "tick";
205
+ b.setAttribute("part", `timeline-notch timeline-notch-${M}`);
206
+ const S = Math.round(100 * (W + this.options.timeOffset)) / 100 * a;
207
+ b.style.left = `${S}px`, this.virtualAppend(S, m, b);
208
208
  }
209
209
  this.timelineWrapper.innerHTML = "", this.timelineWrapper.appendChild(m), this.emit("ready");
210
210
  }
211
211
  };
212
- const Ee = ({
213
- waveSurfer: o,
212
+ const ze = ({
213
+ waveSurfer: r,
214
214
  timelineOptions: t = {}
215
215
  }) => {
216
216
  const { pluginInstance: e, createPlugin: i } = z(
217
- ot,
217
+ lt,
218
218
  t
219
219
  );
220
- return D(() => {
221
- o.value && i(o.value);
220
+ return R(() => {
221
+ r.value && i(r.value);
222
222
  }), {
223
223
  timelinePlugin: e
224
224
  };
225
- }, Pe = ({
226
- containerRef: o,
225
+ }, Ge = ({
226
+ containerRef: r,
227
227
  options: t,
228
228
  timelineOptions: e = {}
229
229
  }) => G(
230
- ot,
231
- { containerRef: o, options: t, pluginOptions: e }
230
+ lt,
231
+ { containerRef: r, options: t, pluginOptions: e }
232
232
  );
233
- let Ut = class {
233
+ let _t = class {
234
234
  constructor() {
235
235
  this.listeners = {};
236
236
  }
@@ -256,7 +256,7 @@ let Ut = class {
256
256
  emit(t, ...e) {
257
257
  this.listeners[t] && this.listeners[t].forEach((i) => i(...e));
258
258
  }
259
- }, Bt = class extends Ut {
259
+ }, Jt = class extends _t {
260
260
  constructor(t) {
261
261
  super(), this.subscriptions = [], this.isDestroyed = !1, this.options = t;
262
262
  }
@@ -269,27 +269,27 @@ let Ut = class {
269
269
  this.emit("destroy"), this.subscriptions.forEach((t) => t()), this.subscriptions = [], this.isDestroyed = !0, this.wavesurfer = void 0;
270
270
  }
271
271
  };
272
- const Ht = { scale: 0.5, deltaThreshold: 5, exponentialZooming: !1, iterations: 20 };
273
- let lt = class ht extends Bt {
272
+ const te = { scale: 0.5, deltaThreshold: 5, exponentialZooming: !1, iterations: 20 };
273
+ let ct = class ut extends Jt {
274
274
  constructor(t) {
275
275
  super(t || {}), this.wrapper = void 0, this.container = null, this.accumulatedDelta = 0, this.pointerTime = 0, this.oldX = 0, this.endZoom = 0, this.startZoom = 0, this.onWheel = (e) => {
276
276
  if (this.wavesurfer && this.container && !(Math.abs(e.deltaX) >= Math.abs(e.deltaY)) && (e.preventDefault(), this.accumulatedDelta += -e.deltaY, this.startZoom === 0 && this.options.exponentialZooming && (this.startZoom = this.wavesurfer.getWrapper().clientWidth / this.wavesurfer.getDuration()), this.options.deltaThreshold === 0 || Math.abs(this.accumulatedDelta) >= this.options.deltaThreshold)) {
277
- const i = this.wavesurfer.getDuration(), s = this.wavesurfer.options.minPxPerSec === 0 ? this.wavesurfer.getWrapper().scrollWidth / i : this.wavesurfer.options.minPxPerSec, r = e.clientX - this.container.getBoundingClientRect().left, n = this.container.clientWidth, l = this.wavesurfer.getScroll();
278
- r === this.oldX && this.oldX !== 0 || (this.pointerTime = (l + r) / s), this.oldX = r;
279
- const h = this.calculateNewZoom(s, this.accumulatedDelta), c = n / h * (r / n);
277
+ const i = this.wavesurfer.getDuration(), s = this.wavesurfer.options.minPxPerSec === 0 ? this.wavesurfer.getWrapper().scrollWidth / i : this.wavesurfer.options.minPxPerSec, o = e.clientX - this.container.getBoundingClientRect().left, n = this.container.clientWidth, l = this.wavesurfer.getScroll();
278
+ o === this.oldX && this.oldX !== 0 || (this.pointerTime = (l + o) / s), this.oldX = o;
279
+ const h = this.calculateNewZoom(s, this.accumulatedDelta), c = n / h * (o / n);
280
280
  h * i < n ? (this.wavesurfer.zoom(n / i), this.container.scrollLeft = 0) : (this.wavesurfer.zoom(h), this.container.scrollLeft = (this.pointerTime - c) * h), this.accumulatedDelta = 0;
281
281
  }
282
282
  }, this.calculateNewZoom = (e, i) => {
283
283
  let s;
284
284
  if (this.options.exponentialZooming) {
285
- const r = i > 0 ? Math.pow(this.endZoom / this.startZoom, 1 / (this.options.iterations - 1)) : Math.pow(this.startZoom / this.endZoom, 1 / (this.options.iterations - 1));
286
- s = Math.max(0, e * r);
285
+ const o = i > 0 ? Math.pow(this.endZoom / this.startZoom, 1 / (this.options.iterations - 1)) : Math.pow(this.startZoom / this.endZoom, 1 / (this.options.iterations - 1));
286
+ s = Math.max(0, e * o);
287
287
  } else s = Math.max(0, e + i * this.options.scale);
288
288
  return Math.min(s, this.options.maxZoom);
289
- }, this.options = Object.assign({}, Ht, t);
289
+ }, this.options = Object.assign({}, te, t);
290
290
  }
291
291
  static create(t) {
292
- return new ht(t);
292
+ return new ut(t);
293
293
  }
294
294
  onInit() {
295
295
  var t;
@@ -299,36 +299,36 @@ let lt = class ht extends Bt {
299
299
  this.wrapper && this.wrapper.removeEventListener("wheel", this.onWheel), super.destroy();
300
300
  }
301
301
  };
302
- const Te = ({
303
- waveSurfer: o,
302
+ const Xe = ({
303
+ waveSurfer: r,
304
304
  zoomOptions: t = {}
305
305
  }) => {
306
306
  const { pluginInstance: e, createPlugin: i } = z(
307
- lt,
307
+ ct,
308
308
  t
309
309
  ), s = () => {
310
- o.value && o.value.zoom(100);
311
- }, r = () => {
312
- o.value && o.value.zoom(50);
310
+ r.value && r.value.zoom(100);
311
+ }, o = () => {
312
+ r.value && r.value.zoom(50);
313
313
  }, n = (l) => {
314
- o.value && o.value.zoom(l);
314
+ r.value && r.value.zoom(l);
315
315
  };
316
- return D(() => {
317
- o.value && i(o.value);
316
+ return R(() => {
317
+ r.value && i(r.value);
318
318
  }), {
319
319
  zoomPlugin: e,
320
320
  zoomIn: s,
321
- zoomOut: r,
321
+ zoomOut: o,
322
322
  setZoom: n
323
323
  };
324
- }, De = ({
325
- containerRef: o,
324
+ }, Ae = ({
325
+ containerRef: r,
326
326
  options: t,
327
327
  zoomOptions: e = {}
328
328
  }) => {
329
329
  const { waveSurfer: i, pluginInstance: s } = G(
330
- lt,
331
- { containerRef: o, options: t, pluginOptions: e }
330
+ ct,
331
+ { containerRef: r, options: t, pluginOptions: e }
332
332
  );
333
333
  return {
334
334
  waveSurfer: i,
@@ -344,7 +344,7 @@ const Te = ({
344
344
  }
345
345
  };
346
346
  };
347
- let V = class {
347
+ let Y = class {
348
348
  constructor() {
349
349
  this.listeners = {};
350
350
  }
@@ -370,7 +370,7 @@ let V = class {
370
370
  emit(t, ...e) {
371
371
  this.listeners[t] && this.listeners[t].forEach((i) => i(...e));
372
372
  }
373
- }, ct = class extends V {
373
+ }, dt = class extends Y {
374
374
  constructor(t) {
375
375
  super(), this.subscriptions = [], this.isDestroyed = !1, this.options = t;
376
376
  }
@@ -383,89 +383,89 @@ let V = class {
383
383
  this.emit("destroy"), this.subscriptions.forEach((t) => t()), this.subscriptions = [], this.isDestroyed = !0, this.wavesurfer = void 0;
384
384
  }
385
385
  };
386
- function k(o, t, e, i) {
387
- return new (e || (e = Promise))(function(s, r) {
386
+ function k(r, t, e, i) {
387
+ return new (e || (e = Promise))(function(s, o) {
388
388
  function n(c) {
389
389
  try {
390
390
  h(i.next(c));
391
391
  } catch (a) {
392
- r(a);
392
+ o(a);
393
393
  }
394
394
  }
395
395
  function l(c) {
396
396
  try {
397
397
  h(i.throw(c));
398
398
  } catch (a) {
399
- r(a);
399
+ o(a);
400
400
  }
401
401
  }
402
402
  function h(c) {
403
403
  var a;
404
- c.done ? s(c.value) : (a = c.value, a instanceof e ? a : new e(function(d) {
405
- d(a);
404
+ c.done ? s(c.value) : (a = c.value, a instanceof e ? a : new e(function(u) {
405
+ u(a);
406
406
  })).then(n, l);
407
407
  }
408
- h((i = i.apply(o, t || [])).next());
408
+ h((i = i.apply(r, t || [])).next());
409
409
  });
410
410
  }
411
- const K = { decode: function(o, t) {
411
+ const V = { decode: function(r, t) {
412
412
  return k(this, void 0, void 0, function* () {
413
413
  const e = new AudioContext({ sampleRate: t });
414
- return e.decodeAudioData(o).finally(() => e.close());
414
+ return e.decodeAudioData(r).finally(() => e.close());
415
415
  });
416
- }, createBuffer: function(o, t) {
417
- return typeof o[0] == "number" && (o = [o]), function(e) {
416
+ }, createBuffer: function(r, t) {
417
+ return typeof r[0] == "number" && (r = [r]), function(e) {
418
418
  const i = e[0];
419
419
  if (i.some((s) => s > 1 || s < -1)) {
420
420
  const s = i.length;
421
- let r = 0;
421
+ let o = 0;
422
422
  for (let n = 0; n < s; n++) {
423
423
  const l = Math.abs(i[n]);
424
- l > r && (r = l);
424
+ l > o && (o = l);
425
425
  }
426
- for (const n of e) for (let l = 0; l < s; l++) n[l] /= r;
426
+ for (const n of e) for (let l = 0; l < s; l++) n[l] /= o;
427
427
  }
428
- }(o), { duration: t, length: o[0].length, sampleRate: o[0].length / t, numberOfChannels: o.length, getChannelData: (e) => o?.[e], copyFromChannel: AudioBuffer.prototype.copyFromChannel, copyToChannel: AudioBuffer.prototype.copyToChannel };
428
+ }(r), { duration: t, length: r[0].length, sampleRate: r[0].length / t, numberOfChannels: r.length, getChannelData: (e) => r?.[e], copyFromChannel: AudioBuffer.prototype.copyFromChannel, copyToChannel: AudioBuffer.prototype.copyToChannel };
429
429
  } };
430
- function ut(o, t) {
431
- const e = t.xmlns ? document.createElementNS(t.xmlns, o) : document.createElement(o);
432
- for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [r, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(ut(r, n));
430
+ function pt(r, t) {
431
+ const e = t.xmlns ? document.createElementNS(t.xmlns, r) : document.createElement(r);
432
+ for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [o, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(pt(o, n));
433
433
  else i === "style" ? Object.assign(e.style, s) : i === "textContent" ? e.textContent = s : e.setAttribute(i, s.toString());
434
434
  return e;
435
435
  }
436
- function U(o, t, e) {
437
- const i = ut(o, t || {});
436
+ function B(r, t, e) {
437
+ const i = pt(r, t || {});
438
438
  return e?.appendChild(i), i;
439
439
  }
440
- var $t = Object.freeze({ __proto__: null, createElement: U, default: U });
441
- const qt = { fetchBlob: function(o, t, e) {
440
+ var ee = Object.freeze({ __proto__: null, createElement: B, default: B });
441
+ const ie = { fetchBlob: function(r, t, e) {
442
442
  return k(this, void 0, void 0, function* () {
443
- const i = yield fetch(o, e);
444
- if (i.status >= 400) throw new Error(`Failed to fetch ${o}: ${i.status} (${i.statusText})`);
445
- return function(s, r) {
443
+ const i = yield fetch(r, e);
444
+ if (i.status >= 400) throw new Error(`Failed to fetch ${r}: ${i.status} (${i.statusText})`);
445
+ return function(s, o) {
446
446
  k(this, void 0, void 0, function* () {
447
447
  if (!s.body || !s.headers) return;
448
448
  const n = s.body.getReader(), l = Number(s.headers.get("Content-Length")) || 0;
449
449
  let h = 0;
450
- const c = (d) => k(this, void 0, void 0, function* () {
451
- h += d?.length || 0;
452
- const u = Math.round(h / l * 100);
453
- r(u);
450
+ const c = (u) => k(this, void 0, void 0, function* () {
451
+ h += u?.length || 0;
452
+ const d = Math.round(h / l * 100);
453
+ o(d);
454
454
  }), a = () => k(this, void 0, void 0, function* () {
455
- let d;
455
+ let u;
456
456
  try {
457
- d = yield n.read();
457
+ u = yield n.read();
458
458
  } catch {
459
459
  return;
460
460
  }
461
- d.done || (c(d.value), yield a());
461
+ u.done || (c(u.value), yield a());
462
462
  });
463
463
  a();
464
464
  });
465
465
  }(i.clone(), t), i.blob();
466
466
  });
467
467
  } };
468
- let Qt = class extends V {
468
+ let se = class extends Y {
469
469
  constructor(t) {
470
470
  super(), this.isExternalMedia = !1, t.media ? (this.media = t.media, this.isExternalMedia = !0) : this.media = document.createElement("audio"), t.mediaControls && (this.media.controls = !0), t.autoplay && (this.media.autoplay = !0), t.playbackRate != null && this.onMediaEvent("canplay", () => {
471
471
  t.playbackRate != null && (this.media.playbackRate = t.playbackRate);
@@ -553,13 +553,13 @@ let Qt = class extends V {
553
553
  setSinkId(t) {
554
554
  return this.media.setSinkId(t);
555
555
  }
556
- }, Q = class _ extends V {
556
+ }, _ = class J extends Y {
557
557
  constructor(t, e) {
558
558
  super(), this.timeouts = [], this.isScrollable = !1, this.audioData = null, this.resizeObserver = null, this.lastContainerWidth = 0, this.isDragging = !1, this.subscriptions = [], this.unsubscribeOnScroll = [], this.subscriptions = [], this.options = t;
559
559
  const i = this.parentFromOptionsContainer(t.container);
560
560
  this.parent = i;
561
- const [s, r] = this.initHtml();
562
- i.appendChild(s), this.container = s, this.scrollContainer = r.querySelector(".scroll"), this.wrapper = r.querySelector(".wrapper"), this.canvasWrapper = r.querySelector(".canvases"), this.progressWrapper = r.querySelector(".progress"), this.cursor = r.querySelector(".cursor"), e && r.appendChild(e), this.initEvents();
561
+ const [s, o] = this.initHtml();
562
+ i.appendChild(s), this.container = s, this.scrollContainer = o.querySelector(".scroll"), this.wrapper = o.querySelector(".wrapper"), this.canvasWrapper = o.querySelector(".canvases"), this.progressWrapper = o.querySelector(".progress"), this.cursor = o.querySelector(".cursor"), e && o.appendChild(e), this.initEvents();
563
563
  }
564
564
  parentFromOptionsContainer(t) {
565
565
  let e;
@@ -568,8 +568,8 @@ let Qt = class extends V {
568
568
  }
569
569
  initEvents() {
570
570
  const t = (e) => {
571
- const i = this.wrapper.getBoundingClientRect(), s = e.clientX - i.left, r = e.clientY - i.top;
572
- return [s / i.width, r / i.height];
571
+ const i = this.wrapper.getBoundingClientRect(), s = e.clientX - i.left, o = e.clientY - i.top;
572
+ return [s / i.width, o / i.height];
573
573
  };
574
574
  if (this.wrapper.addEventListener("click", (e) => {
575
575
  const [i, s] = t(e);
@@ -578,8 +578,8 @@ let Qt = class extends V {
578
578
  const [i, s] = t(e);
579
579
  this.emit("dblclick", i, s);
580
580
  }), this.options.dragToSeek !== !0 && typeof this.options.dragToSeek != "object" || this.initDrag(), this.scrollContainer.addEventListener("scroll", () => {
581
- const { scrollLeft: e, scrollWidth: i, clientWidth: s } = this.scrollContainer, r = e / i, n = (e + s) / i;
582
- this.emit("scroll", r, n, e, e + s);
581
+ const { scrollLeft: e, scrollWidth: i, clientWidth: s } = this.scrollContainer, o = e / i, n = (e + s) / i;
582
+ this.emit("scroll", o, n, e, e + s);
583
583
  }), typeof ResizeObserver == "function") {
584
584
  const e = this.createDelay(100);
585
585
  this.resizeObserver = new ResizeObserver(() => {
@@ -593,39 +593,39 @@ let Qt = class extends V {
593
593
  t === this.lastContainerWidth && this.options.height !== "auto" || (this.lastContainerWidth = t, this.reRender());
594
594
  }
595
595
  initDrag() {
596
- this.subscriptions.push(function(t, e, i, s, r = 3, n = 0, l = 100) {
596
+ this.subscriptions.push(function(t, e, i, s, o = 3, n = 0, l = 100) {
597
597
  if (!t) return () => {
598
598
  };
599
599
  const h = matchMedia("(pointer: coarse)").matches;
600
600
  let c = () => {
601
601
  };
602
- const a = (d) => {
603
- if (d.button !== n) return;
604
- d.preventDefault(), d.stopPropagation();
605
- let u = d.clientX, p = d.clientY, b = !1;
606
- const x = Date.now(), g = (f) => {
607
- if (f.preventDefault(), f.stopPropagation(), h && Date.now() - x < l) return;
608
- const C = f.clientX, W = f.clientY, S = C - u, M = W - p;
609
- if (b || Math.abs(S) > r || Math.abs(M) > r) {
610
- const E = t.getBoundingClientRect(), { left: L, top: T } = E;
611
- b || (i?.(u - L, p - T), b = !0), e(S, M, C - L, W - T), u = C, p = W;
602
+ const a = (u) => {
603
+ if (u.button !== n) return;
604
+ u.preventDefault(), u.stopPropagation();
605
+ let d = u.clientX, p = u.clientY, g = !1;
606
+ const y = Date.now(), f = (b) => {
607
+ if (b.preventDefault(), b.stopPropagation(), h && Date.now() - y < l) return;
608
+ const x = b.clientX, C = b.clientY, M = x - d, S = C - p;
609
+ if (g || Math.abs(M) > o || Math.abs(S) > o) {
610
+ const P = t.getBoundingClientRect(), { left: T, top: L } = P;
611
+ g || (i?.(d - T, p - L), g = !0), e(M, S, x - T, C - L), d = x, p = C;
612
612
  }
613
- }, m = (f) => {
614
- if (b) {
615
- const C = f.clientX, W = f.clientY, S = t.getBoundingClientRect(), { left: M, top: E } = S;
616
- s?.(C - M, W - E);
613
+ }, m = (b) => {
614
+ if (g) {
615
+ const x = b.clientX, C = b.clientY, M = t.getBoundingClientRect(), { left: S, top: P } = M;
616
+ s?.(x - S, C - P);
617
617
  }
618
618
  c();
619
- }, y = (f) => {
620
- f.relatedTarget && f.relatedTarget !== document.documentElement || m(f);
621
- }, w = (f) => {
622
- b && (f.stopPropagation(), f.preventDefault());
623
- }, v = (f) => {
624
- b && f.preventDefault();
619
+ }, w = (b) => {
620
+ b.relatedTarget && b.relatedTarget !== document.documentElement || m(b);
621
+ }, W = (b) => {
622
+ g && (b.stopPropagation(), b.preventDefault());
623
+ }, v = (b) => {
624
+ g && b.preventDefault();
625
625
  };
626
- document.addEventListener("pointermove", g), document.addEventListener("pointerup", m), document.addEventListener("pointerout", y), document.addEventListener("pointercancel", y), document.addEventListener("touchmove", v, { passive: !1 }), document.addEventListener("click", w, { capture: !0 }), c = () => {
627
- document.removeEventListener("pointermove", g), document.removeEventListener("pointerup", m), document.removeEventListener("pointerout", y), document.removeEventListener("pointercancel", y), document.removeEventListener("touchmove", v), setTimeout(() => {
628
- document.removeEventListener("click", w, { capture: !0 });
626
+ document.addEventListener("pointermove", f), document.addEventListener("pointerup", m), document.addEventListener("pointerout", w), document.addEventListener("pointercancel", w), document.addEventListener("touchmove", v, { passive: !1 }), document.addEventListener("click", W, { capture: !0 }), c = () => {
627
+ document.removeEventListener("pointermove", f), document.removeEventListener("pointerup", m), document.removeEventListener("pointerout", w), document.removeEventListener("pointercancel", w), document.removeEventListener("touchmove", v), setTimeout(() => {
628
+ document.removeEventListener("click", W, { capture: !0 });
629
629
  }, 10);
630
630
  };
631
631
  };
@@ -646,8 +646,8 @@ let Qt = class extends V {
646
646
  if (t == null) return 128;
647
647
  if (!isNaN(Number(t))) return Number(t);
648
648
  if (t === "auto") {
649
- const r = this.parent.clientHeight || 128;
650
- return e?.every((n) => !n.overlay) ? r / s : r;
649
+ const o = this.parent.clientHeight || 128;
650
+ return e?.every((n) => !n.overlay) ? o / s : o;
651
651
  }
652
652
  return 128;
653
653
  }
@@ -759,125 +759,125 @@ let Qt = class extends V {
759
759
  const s = () => {
760
760
  e && clearTimeout(e), i && i();
761
761
  };
762
- return this.timeouts.push(s), () => new Promise((r, n) => {
762
+ return this.timeouts.push(s), () => new Promise((o, n) => {
763
763
  s(), i = n, e = setTimeout(() => {
764
- e = void 0, i = void 0, r();
764
+ e = void 0, i = void 0, o();
765
765
  }, t);
766
766
  });
767
767
  }
768
768
  convertColorValues(t) {
769
769
  if (!Array.isArray(t)) return t || "";
770
770
  if (t.length < 2) return t[0] || "";
771
- const e = document.createElement("canvas"), i = e.getContext("2d"), s = e.height * (window.devicePixelRatio || 1), r = i.createLinearGradient(0, 0, 0, s), n = 1 / (t.length - 1);
771
+ const e = document.createElement("canvas"), i = e.getContext("2d"), s = e.height * (window.devicePixelRatio || 1), o = i.createLinearGradient(0, 0, 0, s), n = 1 / (t.length - 1);
772
772
  return t.forEach((l, h) => {
773
773
  const c = h * n;
774
- r.addColorStop(c, l);
775
- }), r;
774
+ o.addColorStop(c, l);
775
+ }), o;
776
776
  }
777
777
  getPixelRatio() {
778
778
  return Math.max(1, window.devicePixelRatio || 1);
779
779
  }
780
780
  renderBarWaveform(t, e, i, s) {
781
- const r = t[0], n = t[1] || t[0], l = r.length, { width: h, height: c } = i.canvas, a = c / 2, d = this.getPixelRatio(), u = e.barWidth ? e.barWidth * d : 1, p = e.barGap ? e.barGap * d : e.barWidth ? u / 2 : 0, b = e.barRadius || 0, x = h / (u + p) / l, g = b && "roundRect" in i ? "roundRect" : "rect";
781
+ const o = t[0], n = t[1] || t[0], l = o.length, { width: h, height: c } = i.canvas, a = c / 2, u = this.getPixelRatio(), d = e.barWidth ? e.barWidth * u : 1, p = e.barGap ? e.barGap * u : e.barWidth ? d / 2 : 0, g = e.barRadius || 0, y = h / (d + p) / l, f = g && "roundRect" in i ? "roundRect" : "rect";
782
782
  i.beginPath();
783
- let m = 0, y = 0, w = 0;
783
+ let m = 0, w = 0, W = 0;
784
784
  for (let v = 0; v <= l; v++) {
785
- const f = Math.round(v * x);
786
- if (f > m) {
787
- const S = Math.round(y * a * s), M = S + Math.round(w * a * s) || 1;
788
- let E = a - S;
789
- e.barAlign === "top" ? E = 0 : e.barAlign === "bottom" && (E = c - M), i[g](m * (u + p), E, u, M, b), m = f, y = 0, w = 0;
785
+ const b = Math.round(v * y);
786
+ if (b > m) {
787
+ const M = Math.round(w * a * s), S = M + Math.round(W * a * s) || 1;
788
+ let P = a - M;
789
+ e.barAlign === "top" ? P = 0 : e.barAlign === "bottom" && (P = c - S), i[f](m * (d + p), P, d, S, g), m = b, w = 0, W = 0;
790
790
  }
791
- const C = Math.abs(r[v] || 0), W = Math.abs(n[v] || 0);
792
- C > y && (y = C), W > w && (w = W);
791
+ const x = Math.abs(o[v] || 0), C = Math.abs(n[v] || 0);
792
+ x > w && (w = x), C > W && (W = C);
793
793
  }
794
794
  i.fill(), i.closePath();
795
795
  }
796
796
  renderLineWaveform(t, e, i, s) {
797
- const r = (n) => {
798
- const l = t[n] || t[0], h = l.length, { height: c } = i.canvas, a = c / 2, d = i.canvas.width / h;
797
+ const o = (n) => {
798
+ const l = t[n] || t[0], h = l.length, { height: c } = i.canvas, a = c / 2, u = i.canvas.width / h;
799
799
  i.moveTo(0, a);
800
- let u = 0, p = 0;
801
- for (let b = 0; b <= h; b++) {
802
- const x = Math.round(b * d);
803
- if (x > u) {
800
+ let d = 0, p = 0;
801
+ for (let g = 0; g <= h; g++) {
802
+ const y = Math.round(g * u);
803
+ if (y > d) {
804
804
  const m = a + (Math.round(p * a * s) || 1) * (n === 0 ? -1 : 1);
805
- i.lineTo(u, m), u = x, p = 0;
805
+ i.lineTo(d, m), d = y, p = 0;
806
806
  }
807
- const g = Math.abs(l[b] || 0);
808
- g > p && (p = g);
807
+ const f = Math.abs(l[g] || 0);
808
+ f > p && (p = f);
809
809
  }
810
- i.lineTo(u, a);
810
+ i.lineTo(d, a);
811
811
  };
812
- i.beginPath(), r(0), r(1), i.fill(), i.closePath();
812
+ i.beginPath(), o(0), o(1), i.fill(), i.closePath();
813
813
  }
814
814
  renderWaveform(t, e, i) {
815
815
  if (i.fillStyle = this.convertColorValues(e.waveColor), e.renderFunction) return void e.renderFunction(t, i);
816
816
  let s = e.barHeight || 1;
817
817
  if (e.normalize) {
818
- const r = Array.from(t[0]).reduce((n, l) => Math.max(n, Math.abs(l)), 0);
819
- s = r ? 1 / r : 1;
818
+ const o = Array.from(t[0]).reduce((n, l) => Math.max(n, Math.abs(l)), 0);
819
+ s = o ? 1 / o : 1;
820
820
  }
821
821
  e.barWidth || e.barGap || e.barAlign ? this.renderBarWaveform(t, e, i, s) : this.renderLineWaveform(t, e, i, s);
822
822
  }
823
- renderSingleCanvas(t, e, i, s, r, n, l) {
823
+ renderSingleCanvas(t, e, i, s, o, n, l) {
824
824
  const h = this.getPixelRatio(), c = document.createElement("canvas");
825
- c.width = Math.round(i * h), c.height = Math.round(s * h), c.style.width = `${i}px`, c.style.height = `${s}px`, c.style.left = `${Math.round(r)}px`, n.appendChild(c);
825
+ c.width = Math.round(i * h), c.height = Math.round(s * h), c.style.width = `${i}px`, c.style.height = `${s}px`, c.style.left = `${Math.round(o)}px`, n.appendChild(c);
826
826
  const a = c.getContext("2d");
827
827
  if (this.renderWaveform(t, e, a), c.width > 0 && c.height > 0) {
828
- const d = c.cloneNode(), u = d.getContext("2d");
829
- u.drawImage(c, 0, 0), u.globalCompositeOperation = "source-in", u.fillStyle = this.convertColorValues(e.progressColor), u.fillRect(0, 0, c.width, c.height), l.appendChild(d);
828
+ const u = c.cloneNode(), d = u.getContext("2d");
829
+ d.drawImage(c, 0, 0), d.globalCompositeOperation = "source-in", d.fillStyle = this.convertColorValues(e.progressColor), d.fillRect(0, 0, c.width, c.height), l.appendChild(u);
830
830
  }
831
831
  }
832
- renderMultiCanvas(t, e, i, s, r, n) {
832
+ renderMultiCanvas(t, e, i, s, o, n) {
833
833
  const l = this.getPixelRatio(), { clientWidth: h } = this.scrollContainer, c = i / l;
834
- let a = Math.min(_.MAX_CANVAS_WIDTH, h, c), d = {};
834
+ let a = Math.min(J.MAX_CANVAS_WIDTH, h, c), u = {};
835
835
  if (e.barWidth || e.barGap) {
836
- const g = e.barWidth || 0.5, m = g + (e.barGap || g / 2);
836
+ const f = e.barWidth || 0.5, m = f + (e.barGap || f / 2);
837
837
  a % m != 0 && (a = Math.floor(a / m) * m);
838
838
  }
839
839
  if (a === 0) return;
840
- const u = (g) => {
841
- if (g < 0 || g >= p || d[g]) return;
842
- d[g] = !0;
843
- const m = g * a;
844
- let y = Math.min(c - m, a);
840
+ const d = (f) => {
841
+ if (f < 0 || f >= p || u[f]) return;
842
+ u[f] = !0;
843
+ const m = f * a;
844
+ let w = Math.min(c - m, a);
845
845
  if (e.barWidth || e.barGap) {
846
- const v = e.barWidth || 0.5, f = v + (e.barGap || v / 2);
847
- y = Math.floor(y / f) * f;
846
+ const v = e.barWidth || 0.5, b = v + (e.barGap || v / 2);
847
+ w = Math.floor(w / b) * b;
848
848
  }
849
- if (y <= 0) return;
850
- const w = t.map((v) => {
851
- const f = Math.floor(m / c * v.length), C = Math.floor((m + y) / c * v.length);
852
- return v.slice(f, C);
849
+ if (w <= 0) return;
850
+ const W = t.map((v) => {
851
+ const b = Math.floor(m / c * v.length), x = Math.floor((m + w) / c * v.length);
852
+ return v.slice(b, x);
853
853
  });
854
- this.renderSingleCanvas(w, e, y, s, m, r, n);
854
+ this.renderSingleCanvas(W, e, w, s, m, o, n);
855
855
  }, p = Math.ceil(c / a);
856
856
  if (!this.isScrollable) {
857
- for (let g = 0; g < p; g++) u(g);
857
+ for (let f = 0; f < p; f++) d(f);
858
858
  return;
859
859
  }
860
- const b = this.scrollContainer.scrollLeft / c, x = Math.floor(b * p);
861
- if (u(x - 1), u(x), u(x + 1), p > 1) {
862
- const g = this.on("scroll", () => {
863
- const { scrollLeft: m } = this.scrollContainer, y = Math.floor(m / c * p);
864
- Object.keys(d).length > _.MAX_NODES && (r.innerHTML = "", n.innerHTML = "", d = {}), u(y - 1), u(y), u(y + 1);
860
+ const g = this.scrollContainer.scrollLeft / c, y = Math.floor(g * p);
861
+ if (d(y - 1), d(y), d(y + 1), p > 1) {
862
+ const f = this.on("scroll", () => {
863
+ const { scrollLeft: m } = this.scrollContainer, w = Math.floor(m / c * p);
864
+ Object.keys(u).length > J.MAX_NODES && (o.innerHTML = "", n.innerHTML = "", u = {}), d(w - 1), d(w), d(w + 1);
865
865
  });
866
- this.unsubscribeOnScroll.push(g);
866
+ this.unsubscribeOnScroll.push(f);
867
867
  }
868
868
  }
869
869
  renderChannel(t, e, i, s) {
870
- var { overlay: r } = e, n = function(a, d) {
871
- var u = {};
872
- for (var p in a) Object.prototype.hasOwnProperty.call(a, p) && d.indexOf(p) < 0 && (u[p] = a[p]);
870
+ var { overlay: o } = e, n = function(a, u) {
871
+ var d = {};
872
+ for (var p in a) Object.prototype.hasOwnProperty.call(a, p) && u.indexOf(p) < 0 && (d[p] = a[p]);
873
873
  if (a != null && typeof Object.getOwnPropertySymbols == "function") {
874
- var b = 0;
875
- for (p = Object.getOwnPropertySymbols(a); b < p.length; b++) d.indexOf(p[b]) < 0 && Object.prototype.propertyIsEnumerable.call(a, p[b]) && (u[p[b]] = a[p[b]]);
874
+ var g = 0;
875
+ for (p = Object.getOwnPropertySymbols(a); g < p.length; g++) u.indexOf(p[g]) < 0 && Object.prototype.propertyIsEnumerable.call(a, p[g]) && (d[p[g]] = a[p[g]]);
876
876
  }
877
- return u;
877
+ return d;
878
878
  }(e, ["overlay"]);
879
879
  const l = document.createElement("div"), h = this.getHeight(n.height, n.splitChannels);
880
- l.style.height = `${h}px`, r && s > 0 && (l.style.marginTop = `-${h}px`), this.canvasWrapper.style.minHeight = `${h}px`, this.canvasWrapper.appendChild(l);
880
+ l.style.height = `${h}px`, o && s > 0 && (l.style.marginTop = `-${h}px`), this.canvasWrapper.style.minHeight = `${h}px`, this.canvasWrapper.appendChild(l);
881
881
  const c = l.cloneNode();
882
882
  this.progressWrapper.appendChild(c), this.renderMultiCanvas(t, n, i, h, l, c);
883
883
  }
@@ -885,10 +885,10 @@ let Qt = class extends V {
885
885
  return k(this, void 0, void 0, function* () {
886
886
  var e;
887
887
  this.timeouts.forEach((h) => h()), this.timeouts = [], this.canvasWrapper.innerHTML = "", this.progressWrapper.innerHTML = "", this.options.width != null && (this.scrollContainer.style.width = typeof this.options.width == "number" ? `${this.options.width}px` : this.options.width);
888
- const i = this.getPixelRatio(), s = this.scrollContainer.clientWidth, r = Math.ceil(t.duration * (this.options.minPxPerSec || 0));
889
- this.isScrollable = r > s;
890
- const n = this.options.fillParent && !this.isScrollable, l = (n ? s : r) * i;
891
- if (this.wrapper.style.width = n ? "100%" : `${r}px`, this.scrollContainer.style.overflowX = this.isScrollable ? "auto" : "hidden", this.scrollContainer.classList.toggle("noScrollbar", !!this.options.hideScrollbar), this.cursor.style.backgroundColor = `${this.options.cursorColor || this.options.progressColor}`, this.cursor.style.width = `${this.options.cursorWidth}px`, this.audioData = t, this.emit("render"), this.options.splitChannels) for (let h = 0; h < t.numberOfChannels; h++) {
888
+ const i = this.getPixelRatio(), s = this.scrollContainer.clientWidth, o = Math.ceil(t.duration * (this.options.minPxPerSec || 0));
889
+ this.isScrollable = o > s;
890
+ const n = this.options.fillParent && !this.isScrollable, l = (n ? s : o) * i;
891
+ if (this.wrapper.style.width = n ? "100%" : `${o}px`, this.scrollContainer.style.overflowX = this.isScrollable ? "auto" : "hidden", this.scrollContainer.classList.toggle("noScrollbar", !!this.options.hideScrollbar), this.cursor.style.backgroundColor = `${this.options.cursorColor || this.options.progressColor}`, this.cursor.style.width = `${this.options.cursorWidth}px`, this.audioData = t, this.emit("render"), this.options.splitChannels) for (let h = 0; h < t.numberOfChannels; h++) {
892
892
  const c = Object.assign(Object.assign({}, this.options), (e = this.options.splitChannels) === null || e === void 0 ? void 0 : e[h]);
893
893
  this.renderChannel([t.getChannelData(h)], c, l, h);
894
894
  }
@@ -912,7 +912,7 @@ let Qt = class extends V {
912
912
  this.options.minPxPerSec = t, this.reRender();
913
913
  }
914
914
  scrollIntoView(t, e = !1) {
915
- const { scrollLeft: i, scrollWidth: s, clientWidth: r } = this.scrollContainer, n = t * s, l = i, h = i + r, c = r / 2;
915
+ const { scrollLeft: i, scrollWidth: s, clientWidth: o } = this.scrollContainer, n = t * s, l = i, h = i + o, c = o / 2;
916
916
  if (this.isDragging)
917
917
  n + 30 > h ? this.scrollContainer.scrollLeft += 30 : n - 30 < l && (this.scrollContainer.scrollLeft -= 30);
918
918
  else {
@@ -921,8 +921,8 @@ let Qt = class extends V {
921
921
  e && this.options.autoCenter && a > 0 && (this.scrollContainer.scrollLeft += Math.min(a, 10));
922
922
  }
923
923
  {
924
- const a = this.scrollContainer.scrollLeft, d = a / s, u = (a + r) / s;
925
- this.emit("scroll", d, u, a, a + r);
924
+ const a = this.scrollContainer.scrollLeft, u = a / s, d = (a + o) / s;
925
+ this.emit("scroll", u, d, a, a + o);
926
926
  }
927
927
  }
928
928
  renderProgress(t, e) {
@@ -935,19 +935,19 @@ let Qt = class extends V {
935
935
  const s = this.canvasWrapper.querySelectorAll("canvas");
936
936
  if (!s.length) throw new Error("No waveform data");
937
937
  if (i === "dataURL") {
938
- const r = Array.from(s).map((n) => n.toDataURL(t, e));
939
- return Promise.resolve(r);
938
+ const o = Array.from(s).map((n) => n.toDataURL(t, e));
939
+ return Promise.resolve(o);
940
940
  }
941
- return Promise.all(Array.from(s).map((r) => new Promise((n, l) => {
942
- r.toBlob((h) => {
941
+ return Promise.all(Array.from(s).map((o) => new Promise((n, l) => {
942
+ o.toBlob((h) => {
943
943
  h ? n(h) : l(new Error("Could not export image"));
944
944
  }, t, e);
945
945
  })));
946
946
  });
947
947
  }
948
948
  };
949
- Q.MAX_CANVAS_WIDTH = 8e3, Q.MAX_NODES = 10;
950
- let _t = class extends V {
949
+ _.MAX_CANVAS_WIDTH = 8e3, _.MAX_NODES = 10;
950
+ let ne = class extends Y {
951
951
  constructor() {
952
952
  super(...arguments), this.unsubscribe = () => {
953
953
  };
@@ -965,7 +965,7 @@ let _t = class extends V {
965
965
  destroy() {
966
966
  this.unsubscribe();
967
967
  }
968
- }, $ = class extends V {
968
+ }, $ = class extends Y {
969
969
  constructor(t = new AudioContext()) {
970
970
  super(), this.bufferNode = null, this.playStartTime = 0, this.playedDuration = 0, this._muted = !1, this._playbackRate = 1, this._duration = void 0, this.buffer = null, this.currentSrc = "", this.paused = !0, this.crossOrigin = null, this.seeking = !1, this.autoplay = !1, this.addEventListener = this.on, this.removeEventListener = this.un, this.audioContext = t, this.gainNode = this.audioContext.createGain(), this.gainNode.connect(this.audioContext.destination);
971
971
  }
@@ -1084,21 +1084,21 @@ let _t = class extends V {
1084
1084
  }
1085
1085
  }
1086
1086
  };
1087
- const Jt = { waveColor: "#999", progressColor: "#555", cursorWidth: 1, minPxPerSec: 0, fillParent: !0, interact: !0, dragToSeek: !1, autoScroll: !0, autoCenter: !0, sampleRate: 8e3 };
1088
- let J = class dt extends Qt {
1087
+ const re = { waveColor: "#999", progressColor: "#555", cursorWidth: 1, minPxPerSec: 0, fillParent: !0, interact: !0, dragToSeek: !1, autoScroll: !0, autoCenter: !0, sampleRate: 8e3 };
1088
+ let tt = class mt extends se {
1089
1089
  static create(t) {
1090
- return new dt(t);
1090
+ return new mt(t);
1091
1091
  }
1092
1092
  constructor(t) {
1093
1093
  const e = t.media || (t.backend === "WebAudio" ? new $() : void 0);
1094
- super({ media: e, mediaControls: t.mediaControls, autoplay: t.autoplay, playbackRate: t.audioRate }), this.plugins = [], this.decodedData = null, this.stopAtPosition = null, this.subscriptions = [], this.mediaSubscriptions = [], this.abortController = null, this.options = Object.assign({}, Jt, t), this.timer = new _t();
1094
+ super({ media: e, mediaControls: t.mediaControls, autoplay: t.autoplay, playbackRate: t.audioRate }), this.plugins = [], this.decodedData = null, this.stopAtPosition = null, this.subscriptions = [], this.mediaSubscriptions = [], this.abortController = null, this.options = Object.assign({}, re, t), this.timer = new ne();
1095
1095
  const i = e ? void 0 : this.getMediaElement();
1096
- this.renderer = new Q(this.options, i), this.initPlayerEvents(), this.initRendererEvents(), this.initTimerEvents(), this.initPlugins();
1096
+ this.renderer = new _(this.options, i), this.initPlayerEvents(), this.initRendererEvents(), this.initTimerEvents(), this.initPlugins();
1097
1097
  const s = this.options.url || this.getSrc() || "";
1098
1098
  Promise.resolve().then(() => {
1099
1099
  this.emit("init");
1100
- const { peaks: r, duration: n } = this.options;
1101
- (s || r && n) && this.load(s, r, n).catch(() => null);
1100
+ const { peaks: o, duration: n } = this.options;
1101
+ (s || o && n) && this.load(s, o, n).catch(() => null);
1102
1102
  });
1103
1103
  }
1104
1104
  updateProgress(t = this.getCurrentTime()) {
@@ -1137,8 +1137,8 @@ let J = class dt extends Qt {
1137
1137
  }), this.renderer.on("dblclick", (t, e) => {
1138
1138
  this.emit("dblclick", t, e);
1139
1139
  }), this.renderer.on("scroll", (t, e, i, s) => {
1140
- const r = this.getDuration();
1141
- this.emit("scroll", t * r, e * r, i, s);
1140
+ const o = this.getDuration();
1141
+ this.emit("scroll", t * o, e * o, i, s);
1142
1142
  }), this.renderer.on("render", () => {
1143
1143
  this.emit("redraw");
1144
1144
  }), this.renderer.on("rendered", () => {
@@ -1169,7 +1169,7 @@ let J = class dt extends Qt {
1169
1169
  this.mediaSubscriptions.forEach((t) => t()), this.mediaSubscriptions = [];
1170
1170
  }
1171
1171
  setOptions(t) {
1172
- this.options = Object.assign({}, this.options, t), t.duration && !t.peaks && (this.decodedData = K.createBuffer(this.exportPeaks(), t.duration)), t.peaks && t.duration && (this.decodedData = K.createBuffer(t.peaks, t.duration)), this.renderer.setOptions(this.options), t.audioRate && this.setPlaybackRate(t.audioRate), t.mediaControls != null && (this.getMediaElement().controls = t.mediaControls);
1172
+ this.options = Object.assign({}, this.options, t), t.duration && !t.peaks && (this.decodedData = V.createBuffer(this.exportPeaks(), t.duration)), t.peaks && t.duration && (this.decodedData = V.createBuffer(t.peaks, t.duration)), this.renderer.setOptions(this.options), t.audioRate && this.setPlaybackRate(t.audioRate), t.mediaControls != null && (this.getMediaElement().controls = t.mediaControls);
1173
1173
  }
1174
1174
  registerPlugin(t) {
1175
1175
  if (this.plugins.includes(t)) return t;
@@ -1203,12 +1203,12 @@ let J = class dt extends Qt {
1203
1203
  }
1204
1204
  loadAudio(t, e, i, s) {
1205
1205
  return k(this, void 0, void 0, function* () {
1206
- var r;
1206
+ var o;
1207
1207
  if (this.emit("load", t), !this.options.media && this.isPlaying() && this.pause(), this.decodedData = null, this.stopAtPosition = null, !e && !i) {
1208
1208
  const l = this.options.fetchParams || {};
1209
- window.AbortController && !l.signal && (this.abortController = new AbortController(), l.signal = (r = this.abortController) === null || r === void 0 ? void 0 : r.signal);
1209
+ window.AbortController && !l.signal && (this.abortController = new AbortController(), l.signal = (o = this.abortController) === null || o === void 0 ? void 0 : o.signal);
1210
1210
  const h = (a) => this.emit("loading", a);
1211
- e = yield qt.fetchBlob(t, h, l);
1211
+ e = yield ie.fetchBlob(t, h, l);
1212
1212
  const c = this.options.blobMimeType;
1213
1213
  c && (e = new Blob([e], { type: c }));
1214
1214
  }
@@ -1221,10 +1221,10 @@ let J = class dt extends Qt {
1221
1221
  const l = this.getMediaElement();
1222
1222
  l instanceof $ && (l.duration = n);
1223
1223
  }
1224
- if (i) this.decodedData = K.createBuffer(i, n || 0);
1224
+ if (i) this.decodedData = V.createBuffer(i, n || 0);
1225
1225
  else if (e) {
1226
1226
  const l = yield e.arrayBuffer();
1227
- this.decodedData = yield K.decode(l, this.options.sampleRate);
1227
+ this.decodedData = yield V.decode(l, this.options.sampleRate);
1228
1228
  }
1229
1229
  this.decodedData && (this.emit("decode", this.getDuration()), this.renderer.render(this.decodedData)), this.emit("ready", this.getDuration());
1230
1230
  });
@@ -1256,21 +1256,21 @@ let J = class dt extends Qt {
1256
1256
  }
1257
1257
  exportPeaks({ channels: t = 2, maxLength: e = 8e3, precision: i = 1e4 } = {}) {
1258
1258
  if (!this.decodedData) throw new Error("The audio has not been decoded yet");
1259
- const s = Math.min(t, this.decodedData.numberOfChannels), r = [];
1259
+ const s = Math.min(t, this.decodedData.numberOfChannels), o = [];
1260
1260
  for (let n = 0; n < s; n++) {
1261
1261
  const l = this.decodedData.getChannelData(n), h = [], c = l.length / e;
1262
1262
  for (let a = 0; a < e; a++) {
1263
- const d = l.slice(Math.floor(a * c), Math.ceil((a + 1) * c));
1264
- let u = 0;
1265
- for (let p = 0; p < d.length; p++) {
1266
- const b = d[p];
1267
- Math.abs(b) > Math.abs(u) && (u = b);
1263
+ const u = l.slice(Math.floor(a * c), Math.ceil((a + 1) * c));
1264
+ let d = 0;
1265
+ for (let p = 0; p < u.length; p++) {
1266
+ const g = u[p];
1267
+ Math.abs(g) > Math.abs(d) && (d = g);
1268
1268
  }
1269
- h.push(Math.round(u * i) / i);
1269
+ h.push(Math.round(d * i) / i);
1270
1270
  }
1271
- r.push(h);
1271
+ o.push(h);
1272
1272
  }
1273
- return r;
1273
+ return o;
1274
1274
  }
1275
1275
  getDuration() {
1276
1276
  let t = super.getDuration() || 0;
@@ -1321,14 +1321,14 @@ let J = class dt extends Qt {
1321
1321
  this.emit("destroy"), (t = this.abortController) === null || t === void 0 || t.abort(), this.plugins.forEach((e) => e.destroy()), this.subscriptions.forEach((e) => e()), this.unsubscribePlayerEvents(), this.timer.destroy(), this.renderer.destroy(), super.destroy();
1322
1322
  }
1323
1323
  };
1324
- J.BasePlugin = ct, J.dom = $t;
1325
- const te = { height: 50, overlayColor: "rgba(100, 100, 100, 0.1)", insertPosition: "afterend" };
1326
- let pt = class mt extends ct {
1324
+ tt.BasePlugin = dt, tt.dom = ee;
1325
+ const oe = { height: 50, overlayColor: "rgba(100, 100, 100, 0.1)", insertPosition: "afterend" };
1326
+ let vt = class ft extends dt {
1327
1327
  constructor(t) {
1328
- super(t), this.miniWavesurfer = null, this.container = null, this.options = Object.assign({}, te, t), this.minimapWrapper = this.initMinimapWrapper(), this.overlay = this.initOverlay();
1328
+ super(t), this.miniWavesurfer = null, this.container = null, this.options = Object.assign({}, oe, t), this.minimapWrapper = this.initMinimapWrapper(), this.overlay = this.initOverlay();
1329
1329
  }
1330
1330
  static create(t) {
1331
- return new mt(t);
1331
+ return new ft(t);
1332
1332
  }
1333
1333
  onInit() {
1334
1334
  var t, e;
@@ -1338,10 +1338,10 @@ let pt = class mt extends ct {
1338
1338
  });
1339
1339
  }
1340
1340
  initMinimapWrapper() {
1341
- return U("div", { part: "minimap", style: { position: "relative" } });
1341
+ return B("div", { part: "minimap", style: { position: "relative" } });
1342
1342
  }
1343
1343
  initOverlay() {
1344
- return U("div", { part: "minimap-overlay", style: { position: "absolute", zIndex: "2", left: "0", top: "0", bottom: "0", transition: "left 100ms ease-out", pointerEvents: "none", backgroundColor: this.options.overlayColor } }, this.minimapWrapper);
1344
+ return B("div", { part: "minimap-overlay", style: { position: "absolute", zIndex: "2", left: "0", top: "0", bottom: "0", transition: "left 100ms ease-out", pointerEvents: "none", backgroundColor: this.options.overlayColor } }, this.minimapWrapper);
1345
1345
  }
1346
1346
  initMinimap() {
1347
1347
  if (this.miniWavesurfer && (this.miniWavesurfer.destroy(), this.miniWavesurfer = null), !this.wavesurfer) return;
@@ -1349,12 +1349,12 @@ let pt = class mt extends ct {
1349
1349
  if (!t || !e) return;
1350
1350
  const i = [];
1351
1351
  for (let s = 0; s < t.numberOfChannels; s++) i.push(t.getChannelData(s));
1352
- this.miniWavesurfer = J.create(Object.assign(Object.assign({}, this.options), { container: this.minimapWrapper, minPxPerSec: 0, fillParent: !0, media: e, peaks: i, duration: t.duration })), this.subscriptions.push(this.miniWavesurfer.on("audioprocess", (s) => {
1352
+ this.miniWavesurfer = tt.create(Object.assign(Object.assign({}, this.options), { container: this.minimapWrapper, minPxPerSec: 0, fillParent: !0, media: e, peaks: i, duration: t.duration })), this.subscriptions.push(this.miniWavesurfer.on("audioprocess", (s) => {
1353
1353
  this.emit("audioprocess", s);
1354
- }), this.miniWavesurfer.on("click", (s, r) => {
1355
- this.emit("click", s, r);
1356
- }), this.miniWavesurfer.on("dblclick", (s, r) => {
1357
- this.emit("dblclick", s, r);
1354
+ }), this.miniWavesurfer.on("click", (s, o) => {
1355
+ this.emit("click", s, o);
1356
+ }), this.miniWavesurfer.on("dblclick", (s, o) => {
1357
+ this.emit("dblclick", s, o);
1358
1358
  }), this.miniWavesurfer.on("decode", (s) => {
1359
1359
  this.emit("decode", s);
1360
1360
  }), this.miniWavesurfer.on("destroy", () => {
@@ -1409,28 +1409,28 @@ let pt = class mt extends ct {
1409
1409
  (t = this.miniWavesurfer) === null || t === void 0 || t.destroy(), this.minimapWrapper.remove(), super.destroy();
1410
1410
  }
1411
1411
  };
1412
- const Xe = ({
1413
- waveSurfer: o,
1412
+ const Be = ({
1413
+ waveSurfer: r,
1414
1414
  minimapOptions: t = {}
1415
1415
  }) => {
1416
1416
  const { pluginInstance: e, createPlugin: i } = z(
1417
- pt,
1417
+ vt,
1418
1418
  t
1419
1419
  );
1420
- return D(() => {
1421
- o.value && i(o.value);
1420
+ return R(() => {
1421
+ r.value && i(r.value);
1422
1422
  }), {
1423
1423
  minimapPlugin: e
1424
1424
  };
1425
- }, Ne = ({
1426
- containerRef: o,
1425
+ }, Ue = ({
1426
+ containerRef: r,
1427
1427
  options: t,
1428
1428
  minimapOptions: e = {}
1429
1429
  }) => G(
1430
- pt,
1431
- { containerRef: o, options: t, pluginOptions: e }
1430
+ vt,
1431
+ { containerRef: r, options: t, pluginOptions: e }
1432
1432
  );
1433
- let vt = class {
1433
+ let gt = class {
1434
1434
  constructor() {
1435
1435
  this.listeners = {};
1436
1436
  }
@@ -1456,7 +1456,7 @@ let vt = class {
1456
1456
  emit(t, ...e) {
1457
1457
  this.listeners[t] && this.listeners[t].forEach((i) => i(...e));
1458
1458
  }
1459
- }, ee = class extends vt {
1459
+ }, ae = class extends gt {
1460
1460
  constructor(t) {
1461
1461
  super(), this.subscriptions = [], this.isDestroyed = !1, this.options = t;
1462
1462
  }
@@ -1469,92 +1469,92 @@ let vt = class {
1469
1469
  this.emit("destroy"), this.subscriptions.forEach((t) => t()), this.subscriptions = [], this.isDestroyed = !0, this.wavesurfer = void 0;
1470
1470
  }
1471
1471
  };
1472
- function tt(o, t, e, i, s = 3, r = 0, n = 100) {
1473
- if (!o) return () => {
1472
+ function it(r, t, e, i, s = 3, o = 0, n = 100) {
1473
+ if (!r) return () => {
1474
1474
  };
1475
1475
  const l = matchMedia("(pointer: coarse)").matches;
1476
1476
  let h = () => {
1477
1477
  };
1478
1478
  const c = (a) => {
1479
- if (a.button !== r) return;
1479
+ if (a.button !== o) return;
1480
1480
  a.preventDefault(), a.stopPropagation();
1481
- let d = a.clientX, u = a.clientY, p = !1;
1482
- const b = Date.now(), x = (v) => {
1483
- if (v.preventDefault(), v.stopPropagation(), l && Date.now() - b < n) return;
1484
- const f = v.clientX, C = v.clientY, W = f - d, S = C - u;
1485
- if (p || Math.abs(W) > s || Math.abs(S) > s) {
1486
- const M = o.getBoundingClientRect(), { left: E, top: L } = M;
1487
- p || (e?.(d - E, u - L), p = !0), t(W, S, f - E, C - L), d = f, u = C;
1481
+ let u = a.clientX, d = a.clientY, p = !1;
1482
+ const g = Date.now(), y = (v) => {
1483
+ if (v.preventDefault(), v.stopPropagation(), l && Date.now() - g < n) return;
1484
+ const b = v.clientX, x = v.clientY, C = b - u, M = x - d;
1485
+ if (p || Math.abs(C) > s || Math.abs(M) > s) {
1486
+ const S = r.getBoundingClientRect(), { left: P, top: T } = S;
1487
+ p || (e?.(u - P, d - T), p = !0), t(C, M, b - P, x - T), u = b, d = x;
1488
1488
  }
1489
- }, g = (v) => {
1489
+ }, f = (v) => {
1490
1490
  if (p) {
1491
- const f = v.clientX, C = v.clientY, W = o.getBoundingClientRect(), { left: S, top: M } = W;
1492
- i?.(f - S, C - M);
1491
+ const b = v.clientX, x = v.clientY, C = r.getBoundingClientRect(), { left: M, top: S } = C;
1492
+ i?.(b - M, x - S);
1493
1493
  }
1494
1494
  h();
1495
1495
  }, m = (v) => {
1496
- v.relatedTarget && v.relatedTarget !== document.documentElement || g(v);
1497
- }, y = (v) => {
1498
- p && (v.stopPropagation(), v.preventDefault());
1496
+ v.relatedTarget && v.relatedTarget !== document.documentElement || f(v);
1499
1497
  }, w = (v) => {
1498
+ p && (v.stopPropagation(), v.preventDefault());
1499
+ }, W = (v) => {
1500
1500
  p && v.preventDefault();
1501
1501
  };
1502
- document.addEventListener("pointermove", x), document.addEventListener("pointerup", g), document.addEventListener("pointerout", m), document.addEventListener("pointercancel", m), document.addEventListener("touchmove", w, { passive: !1 }), document.addEventListener("click", y, { capture: !0 }), h = () => {
1503
- document.removeEventListener("pointermove", x), document.removeEventListener("pointerup", g), document.removeEventListener("pointerout", m), document.removeEventListener("pointercancel", m), document.removeEventListener("touchmove", w), setTimeout(() => {
1504
- document.removeEventListener("click", y, { capture: !0 });
1502
+ document.addEventListener("pointermove", y), document.addEventListener("pointerup", f), document.addEventListener("pointerout", m), document.addEventListener("pointercancel", m), document.addEventListener("touchmove", W, { passive: !1 }), document.addEventListener("click", w, { capture: !0 }), h = () => {
1503
+ document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", f), document.removeEventListener("pointerout", m), document.removeEventListener("pointercancel", m), document.removeEventListener("touchmove", W), setTimeout(() => {
1504
+ document.removeEventListener("click", w, { capture: !0 });
1505
1505
  }, 10);
1506
1506
  };
1507
1507
  };
1508
- return o.addEventListener("pointerdown", c), () => {
1509
- h(), o.removeEventListener("pointerdown", c);
1508
+ return r.addEventListener("pointerdown", c), () => {
1509
+ h(), r.removeEventListener("pointerdown", c);
1510
1510
  };
1511
1511
  }
1512
- function ft(o, t) {
1513
- const e = t.xmlns ? document.createElementNS(t.xmlns, o) : document.createElement(o);
1514
- for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [r, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(ft(r, n));
1512
+ function bt(r, t) {
1513
+ const e = t.xmlns ? document.createElementNS(t.xmlns, r) : document.createElement(r);
1514
+ for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [o, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(bt(o, n));
1515
1515
  else i === "style" ? Object.assign(e.style, s) : i === "textContent" ? e.textContent = s : e.setAttribute(i, s.toString());
1516
1516
  return e;
1517
1517
  }
1518
- function q(o, t, e) {
1519
- const i = ft(o, t || {});
1518
+ function q(r, t, e) {
1519
+ const i = bt(r, t || {});
1520
1520
  return e?.appendChild(i), i;
1521
1521
  }
1522
1522
  const N = { points: [], lineWidth: 4, lineColor: "rgba(0, 0, 255, 0.5)", dragPointSize: 10, dragPointFill: "rgba(255, 255, 255, 0.8)", dragPointStroke: "rgba(255, 255, 255, 0.8)" };
1523
- let ie = class extends vt {
1523
+ let le = class extends gt {
1524
1524
  constructor(t, e) {
1525
1525
  super(), this.subscriptions = [], this.subscriptions = [], this.options = t, this.polyPoints = /* @__PURE__ */ new Map();
1526
- const i = e.clientWidth, s = e.clientHeight, r = q("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "100%", viewBox: `0 0 ${i} ${s}`, preserveAspectRatio: "none", style: { position: "absolute", left: "0", top: "0", zIndex: "4" }, part: "envelope" }, e);
1527
- this.svg = r;
1528
- const n = q("polyline", { xmlns: "http://www.w3.org/2000/svg", points: `0,${s} ${i},${s}`, stroke: t.lineColor, "stroke-width": t.lineWidth, fill: "none", part: "polyline", style: t.dragLine ? { cursor: "row-resize", pointerEvents: "stroke" } : {} }, r);
1529
- t.dragLine && this.subscriptions.push(tt(n, (l, h) => {
1530
- const { height: c } = r.viewBox.baseVal, { points: a } = n;
1531
- for (let u = 1; u < a.numberOfItems - 1; u++) {
1532
- const p = a.getItem(u);
1526
+ const i = e.clientWidth, s = e.clientHeight, o = q("svg", { xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "100%", viewBox: `0 0 ${i} ${s}`, preserveAspectRatio: "none", style: { position: "absolute", left: "0", top: "0", zIndex: "4" }, part: "envelope" }, e);
1527
+ this.svg = o;
1528
+ const n = q("polyline", { xmlns: "http://www.w3.org/2000/svg", points: `0,${s} ${i},${s}`, stroke: t.lineColor, "stroke-width": t.lineWidth, fill: "none", part: "polyline", style: t.dragLine ? { cursor: "row-resize", pointerEvents: "stroke" } : {} }, o);
1529
+ t.dragLine && this.subscriptions.push(it(n, (l, h) => {
1530
+ const { height: c } = o.viewBox.baseVal, { points: a } = n;
1531
+ for (let d = 1; d < a.numberOfItems - 1; d++) {
1532
+ const p = a.getItem(d);
1533
1533
  p.y = Math.min(c, Math.max(0, p.y + h));
1534
1534
  }
1535
- const d = r.querySelectorAll("ellipse");
1536
- Array.from(d).forEach((u) => {
1537
- const p = Math.min(c, Math.max(0, Number(u.getAttribute("cy")) + h));
1538
- u.setAttribute("cy", p.toString());
1535
+ const u = o.querySelectorAll("ellipse");
1536
+ Array.from(u).forEach((d) => {
1537
+ const p = Math.min(c, Math.max(0, Number(d.getAttribute("cy")) + h));
1538
+ d.setAttribute("cy", p.toString());
1539
1539
  }), this.emit("line-move", h / c);
1540
- })), r.addEventListener("dblclick", (l) => {
1541
- const h = r.getBoundingClientRect(), c = l.clientX - h.left, a = l.clientY - h.top;
1540
+ })), o.addEventListener("dblclick", (l) => {
1541
+ const h = o.getBoundingClientRect(), c = l.clientX - h.left, a = l.clientY - h.top;
1542
1542
  this.emit("point-create", c / h.width, a / h.height);
1543
1543
  });
1544
1544
  {
1545
1545
  let l;
1546
1546
  const h = () => clearTimeout(l);
1547
- r.addEventListener("touchstart", (c) => {
1547
+ o.addEventListener("touchstart", (c) => {
1548
1548
  c.touches.length === 1 ? l = window.setTimeout(() => {
1549
1549
  c.preventDefault();
1550
- const a = r.getBoundingClientRect(), d = c.touches[0].clientX - a.left, u = c.touches[0].clientY - a.top;
1551
- this.emit("point-create", d / a.width, u / a.height);
1550
+ const a = o.getBoundingClientRect(), u = c.touches[0].clientX - a.left, d = c.touches[0].clientY - a.top;
1551
+ this.emit("point-create", u / a.width, d / a.height);
1552
1552
  }, 500) : h();
1553
- }), r.addEventListener("touchmove", h), r.addEventListener("touchend", h);
1553
+ }), o.addEventListener("touchmove", h), o.addEventListener("touchend", h);
1554
1554
  }
1555
1555
  }
1556
1556
  makeDraggable(t, e) {
1557
- this.subscriptions.push(tt(t, e, () => t.style.cursor = "grabbing", () => t.style.cursor = "grab", 1));
1557
+ this.subscriptions.push(it(t, e, () => t.style.cursor = "grabbing", () => t.style.cursor = "grab", 1));
1558
1558
  }
1559
1559
  createCircle(t, e) {
1560
1560
  const i = this.options.dragPointSize / 2;
@@ -1563,43 +1563,43 @@ let ie = class extends vt {
1563
1563
  removePolyPoint(t) {
1564
1564
  const e = this.polyPoints.get(t);
1565
1565
  if (!e) return;
1566
- const { polyPoint: i, circle: s } = e, { points: r } = this.svg.querySelector("polyline"), n = Array.from(r).findIndex((l) => l.x === i.x && l.y === i.y);
1567
- r.removeItem(n), s.remove(), this.polyPoints.delete(t);
1566
+ const { polyPoint: i, circle: s } = e, { points: o } = this.svg.querySelector("polyline"), n = Array.from(o).findIndex((l) => l.x === i.x && l.y === i.y);
1567
+ o.removeItem(n), s.remove(), this.polyPoints.delete(t);
1568
1568
  }
1569
1569
  addPolyPoint(t, e, i) {
1570
- const { svg: s } = this, { width: r, height: n } = s.viewBox.baseVal, l = t * r, h = n - e * n, c = this.options.dragPointSize / 2, a = s.createSVGPoint();
1571
- a.x = t * r, a.y = n - e * n;
1572
- const d = this.createCircle(l, h), { points: u } = s.querySelector("polyline"), p = Array.from(u).findIndex((b) => b.x >= l);
1573
- u.insertItemBefore(a, Math.max(p, 1)), this.polyPoints.set(i, { polyPoint: a, circle: d }), this.makeDraggable(d, (b, x) => {
1574
- const g = a.x + b, m = a.y + x;
1575
- if (g < -c || m < -c || g > r + c || m > n + c) return void this.emit("point-dragout", i);
1576
- const y = Array.from(u).find((v) => v.x > a.x), w = Array.from(u).findLast((v) => v.x < a.x);
1577
- y && g >= y.x || w && g <= w.x || (a.x = g, a.y = m, d.setAttribute("cx", g.toString()), d.setAttribute("cy", m.toString()), this.emit("point-move", i, g / r, m / n));
1570
+ const { svg: s } = this, { width: o, height: n } = s.viewBox.baseVal, l = t * o, h = n - e * n, c = this.options.dragPointSize / 2, a = s.createSVGPoint();
1571
+ a.x = t * o, a.y = n - e * n;
1572
+ const u = this.createCircle(l, h), { points: d } = s.querySelector("polyline"), p = Array.from(d).findIndex((g) => g.x >= l);
1573
+ d.insertItemBefore(a, Math.max(p, 1)), this.polyPoints.set(i, { polyPoint: a, circle: u }), this.makeDraggable(u, (g, y) => {
1574
+ const f = a.x + g, m = a.y + y;
1575
+ if (f < -c || m < -c || f > o + c || m > n + c) return void this.emit("point-dragout", i);
1576
+ const w = Array.from(d).find((v) => v.x > a.x), W = Array.from(d).findLast((v) => v.x < a.x);
1577
+ w && f >= w.x || W && f <= W.x || (a.x = f, a.y = m, u.setAttribute("cx", f.toString()), u.setAttribute("cy", m.toString()), this.emit("point-move", i, f / o, m / n));
1578
1578
  });
1579
1579
  }
1580
1580
  update() {
1581
1581
  const { svg: t } = this, { clientWidth: e, clientHeight: i } = t;
1582
1582
  if (!e || !i) return;
1583
- const s = t.viewBox.baseVal.width / e, r = t.viewBox.baseVal.height / i;
1583
+ const s = t.viewBox.baseVal.width / e, o = t.viewBox.baseVal.height / i;
1584
1584
  t.querySelectorAll("ellipse").forEach((n) => {
1585
- const l = this.options.dragPointSize / 2, h = l * s, c = l * r;
1585
+ const l = this.options.dragPointSize / 2, h = l * s, c = l * o;
1586
1586
  n.setAttribute("rx", h.toString()), n.setAttribute("ry", c.toString());
1587
1587
  });
1588
1588
  }
1589
1589
  destroy() {
1590
1590
  this.subscriptions.forEach((t) => t()), this.polyPoints.clear(), this.svg.remove();
1591
1591
  }
1592
- }, gt = class bt extends ee {
1592
+ }, yt = class wt extends ae {
1593
1593
  constructor(t) {
1594
1594
  super(t), this.polyline = null, this.throttleTimeout = null, this.volume = 1, this.points = t.points || [], this.options = Object.assign({}, N, t), this.options.lineColor = this.options.lineColor || N.lineColor, this.options.dragPointFill = this.options.dragPointFill || N.dragPointFill, this.options.dragPointStroke = this.options.dragPointStroke || N.dragPointStroke, this.options.dragPointSize = this.options.dragPointSize || N.dragPointSize;
1595
1595
  }
1596
1596
  static create(t) {
1597
- return new bt(t);
1597
+ return new wt(t);
1598
1598
  }
1599
1599
  addPoint(t) {
1600
1600
  var e;
1601
1601
  t.id || (t.id = Math.random().toString(36).slice(2));
1602
- const i = this.points.findLastIndex((r) => r.time < t.time);
1602
+ const i = this.points.findLastIndex((o) => o.time < t.time);
1603
1603
  this.points.splice(i + 1, 0, t), this.emitPoints();
1604
1604
  const s = (e = this.wavesurfer) === null || e === void 0 ? void 0 : e.getDuration();
1605
1605
  s && this.addPolyPoint(t, s);
@@ -1649,9 +1649,9 @@ let ie = class extends vt {
1649
1649
  initPolyline() {
1650
1650
  if (this.polyline && this.polyline.destroy(), !this.wavesurfer) return;
1651
1651
  const t = this.wavesurfer.getWrapper();
1652
- this.polyline = new ie(this.options, t), this.subscriptions.push(this.polyline.on("point-move", (e, i, s) => {
1653
- var r;
1654
- const n = ((r = this.wavesurfer) === null || r === void 0 ? void 0 : r.getDuration()) || 0;
1652
+ this.polyline = new le(this.options, t), this.subscriptions.push(this.polyline.on("point-move", (e, i, s) => {
1653
+ var o;
1654
+ const n = ((o = this.wavesurfer) === null || o === void 0 ? void 0 : o.getDuration()) || 0;
1655
1655
  e.time = i * n, e.volume = 1 - s, this.emitPoints();
1656
1656
  }), this.polyline.on("point-dragout", (e) => {
1657
1657
  this.removePoint(e);
@@ -1675,213 +1675,213 @@ let ie = class extends vt {
1675
1675
  e || (e = { time: this.wavesurfer.getDuration() || 0, volume: 0 });
1676
1676
  let i = this.points.findLast((c) => c.time <= t);
1677
1677
  i || (i = { time: 0, volume: 0 });
1678
- const s = e.time - i.time, r = e.volume - i.volume, n = i.volume + (t - i.time) * (r / s), l = Math.min(1, Math.max(0, n)), h = Math.round(100 * l) / 100;
1678
+ const s = e.time - i.time, o = e.volume - i.volume, n = i.volume + (t - i.time) * (o / s), l = Math.min(1, Math.max(0, n)), h = Math.round(100 * l) / 100;
1679
1679
  h !== this.getCurrentVolume() && (this.setVolume(h), this.emit("volume-change", h));
1680
1680
  }
1681
1681
  };
1682
- const Ke = ({
1683
- waveSurfer: o,
1682
+ const Qe = ({
1683
+ waveSurfer: r,
1684
1684
  envelopeOptions: t = {}
1685
1685
  }) => {
1686
1686
  const { pluginInstance: e, createPlugin: i } = z(
1687
- gt,
1687
+ yt,
1688
1688
  t
1689
1689
  );
1690
- return D(() => {
1691
- o.value && i(o.value);
1690
+ return R(() => {
1691
+ r.value && i(r.value);
1692
1692
  }), {
1693
1693
  envelopePlugin: e
1694
1694
  };
1695
- }, je = ({
1696
- containerRef: o,
1695
+ }, _e = ({
1696
+ containerRef: r,
1697
1697
  options: t,
1698
1698
  envelopeOptions: e = {}
1699
1699
  }) => G(
1700
- gt,
1701
- { containerRef: o, options: t, pluginOptions: e }
1700
+ yt,
1701
+ { containerRef: r, options: t, pluginOptions: e }
1702
1702
  );
1703
- function O(o, t, e, i) {
1704
- return new (e || (e = Promise))(function(s, r) {
1703
+ function X(r, t, e, i) {
1704
+ return new (e || (e = Promise))(function(s, o) {
1705
1705
  function n(c) {
1706
1706
  try {
1707
1707
  h(i.next(c));
1708
1708
  } catch (a) {
1709
- r(a);
1709
+ o(a);
1710
1710
  }
1711
1711
  }
1712
1712
  function l(c) {
1713
1713
  try {
1714
1714
  h(i.throw(c));
1715
1715
  } catch (a) {
1716
- r(a);
1716
+ o(a);
1717
1717
  }
1718
1718
  }
1719
1719
  function h(c) {
1720
1720
  var a;
1721
- c.done ? s(c.value) : (a = c.value, a instanceof e ? a : new e(function(d) {
1722
- d(a);
1721
+ c.done ? s(c.value) : (a = c.value, a instanceof e ? a : new e(function(u) {
1722
+ u(a);
1723
1723
  })).then(n, l);
1724
1724
  }
1725
- h((i = i.apply(o, [])).next());
1725
+ h((i = i.apply(r, [])).next());
1726
1726
  });
1727
1727
  }
1728
- const yt = 1e3 * Math.log(10) / 107.939;
1729
- function wt(o) {
1730
- return 2595 * Math.log10(1 + o / 700);
1728
+ const Wt = 1e3 * Math.log(10) / 107.939;
1729
+ function xt(r) {
1730
+ return 2595 * Math.log10(1 + r / 700);
1731
1731
  }
1732
- function Ct(o) {
1733
- return 700 * (Math.pow(10, o / 2595) - 1);
1732
+ function Mt(r) {
1733
+ return 700 * (Math.pow(10, r / 2595) - 1);
1734
1734
  }
1735
- function xt(o) {
1736
- return Math.log10(Math.max(1, o));
1735
+ function Ct(r) {
1736
+ return Math.log10(Math.max(1, r));
1737
1737
  }
1738
- function St(o) {
1739
- return Math.pow(10, o);
1738
+ function St(r) {
1739
+ return Math.pow(10, r);
1740
1740
  }
1741
- function Wt(o) {
1742
- let t = 26.81 * o / (1960 + o) - 0.53;
1741
+ function Pt(r) {
1742
+ let t = 26.81 * r / (1960 + r) - 0.53;
1743
1743
  return t < 2 && (t += 0.15 * (2 - t)), t > 20.1 && (t += 0.22 * (t - 20.1)), t;
1744
1744
  }
1745
- function Mt(o) {
1746
- return o < 2 && (o = (o - 0.3) / 0.85), o > 20.1 && (o = (o + 4.422) / 1.22), (o + 0.53) / (26.28 - o) * 1960;
1745
+ function Et(r) {
1746
+ return r < 2 && (r = (r - 0.3) / 0.85), r > 20.1 && (r = (r + 4.422) / 1.22), (r + 0.53) / (26.28 - r) * 1960;
1747
1747
  }
1748
- function Et(o) {
1749
- return yt * Math.log10(1 + 437e-5 * o);
1748
+ function kt(r) {
1749
+ return Wt * Math.log10(1 + 437e-5 * r);
1750
1750
  }
1751
- function Pt(o) {
1752
- return (Math.pow(10, o / yt) - 1) / 437e-5;
1751
+ function Tt(r) {
1752
+ return (Math.pow(10, r / Wt) - 1) / 437e-5;
1753
1753
  }
1754
- function X(o, t) {
1754
+ function O(r, t) {
1755
1755
  switch (t) {
1756
1756
  case "mel":
1757
- return wt(o);
1757
+ return xt(r);
1758
1758
  case "logarithmic":
1759
- return xt(o);
1759
+ return Ct(r);
1760
1760
  case "bark":
1761
- return Wt(o);
1761
+ return Pt(r);
1762
1762
  case "erb":
1763
- return Et(o);
1763
+ return kt(r);
1764
1764
  default:
1765
- return o;
1765
+ return r;
1766
1766
  }
1767
1767
  }
1768
- function j(o, t, e, i, s) {
1769
- const r = i(0), n = i(e / 2), l = Array.from({ length: o }, () => Array(t / 2 + 1).fill(0)), h = e / t;
1770
- for (let c = 0; c < o; c++) {
1771
- const a = s(r + c / o * (n - r)), d = Math.floor(a / h), u = d * h, p = (a - u) / ((d + 1) * h - u);
1772
- l[c][d] = 1 - p, l[c][d + 1] = p;
1768
+ function j(r, t, e, i, s) {
1769
+ const o = i(0), n = i(e / 2), l = Array.from({ length: r }, () => Array(t / 2 + 1).fill(0)), h = e / t;
1770
+ for (let c = 0; c < r; c++) {
1771
+ const a = s(o + c / r * (n - o)), u = Math.floor(a / h), d = u * h, p = (a - d) / ((u + 1) * h - d);
1772
+ l[c][u] = 1 - p, l[c][u + 1] = p;
1773
1773
  }
1774
1774
  return l;
1775
1775
  }
1776
- function se(o, t) {
1776
+ function he(r, t) {
1777
1777
  const e = t.length, i = Float32Array.from({ length: e }, () => 0);
1778
- for (let s = 0; s < e; s++) for (let r = 0; r < o.length; r++) i[s] += o[r] * t[s][r];
1778
+ for (let s = 0; s < e; s++) for (let o = 0; o < r.length; o++) i[s] += r[o] * t[s][o];
1779
1779
  return i;
1780
1780
  }
1781
- const ne = { gray: () => {
1782
- const o = [];
1781
+ const ce = { gray: () => {
1782
+ const r = [];
1783
1783
  for (let t = 0; t < 256; t++) {
1784
1784
  const e = (255 - t) / 256;
1785
- o.push([e, e, e, 1]);
1785
+ r.push([e, e, e, 1]);
1786
1786
  }
1787
- return o;
1787
+ return r;
1788
1788
  }, igray: () => {
1789
- const o = [];
1789
+ const r = [];
1790
1790
  for (let t = 0; t < 256; t++) {
1791
1791
  const e = t / 256;
1792
- o.push([e, e, e, 1]);
1792
+ r.push([e, e, e, 1]);
1793
1793
  }
1794
- return o;
1794
+ return r;
1795
1795
  }, roseus: () => [[4528e-6, 4341e-6, 4307e-6, 1], [5625e-6, 6156e-6, 601e-5, 1], [6628e-6, 8293e-6, 8161e-6, 1], [7551e-6, 0.010738, 0.01079, 1], [8382e-6, 0.013482, 0.013941, 1], [9111e-6, 0.01652, 0.017662, 1], [9727e-6, 0.019846, 0.022009, 1], [0.010223, 0.023452, 0.027035, 1], [0.010593, 0.027331, 0.032799, 1], [0.010833, 0.031475, 0.039361, 1], [0.010941, 0.035875, 0.046415, 1], [0.010918, 0.04052, 0.053597, 1], [0.010768, 0.045158, 0.060914, 1], [0.010492, 0.049708, 0.068367, 1], [0.010098, 0.054171, 0.075954, 1], [9594e-6, 0.058549, 0.083672, 1], [8989e-6, 0.06284, 0.091521, 1], [8297e-6, 0.067046, 0.099499, 1], [753e-5, 0.071165, 0.107603, 1], [6704e-6, 0.075196, 0.11583, 1], [5838e-6, 0.07914, 0.124178, 1], [4949e-6, 0.082994, 0.132643, 1], [4062e-6, 0.086758, 0.141223, 1], [3198e-6, 0.09043, 0.149913, 1], [2382e-6, 0.09401, 0.158711, 1], [1643e-6, 0.097494, 0.167612, 1], [1009e-6, 0.100883, 0.176612, 1], [514e-6, 0.104174, 0.185704, 1], [187e-6, 0.107366, 0.194886, 1], [66e-6, 0.110457, 0.204151, 1], [186e-6, 0.113445, 0.213496, 1], [587e-6, 0.116329, 0.222914, 1], [1309e-6, 0.119106, 0.232397, 1], [2394e-6, 0.121776, 0.241942, 1], [3886e-6, 0.124336, 0.251542, 1], [5831e-6, 0.126784, 0.261189, 1], [8276e-6, 0.12912, 0.270876, 1], [0.011268, 0.131342, 0.280598, 1], [0.014859, 0.133447, 0.290345, 1], [0.0191, 0.135435, 0.300111, 1], [0.024043, 0.137305, 0.309888, 1], [0.029742, 0.139054, 0.319669, 1], [0.036252, 0.140683, 0.329441, 1], [0.043507, 0.142189, 0.339203, 1], [0.050922, 0.143571, 0.348942, 1], [0.058432, 0.144831, 0.358649, 1], [0.066041, 0.145965, 0.368319, 1], [0.073744, 0.146974, 0.377938, 1], [0.081541, 0.147858, 0.387501, 1], [0.089431, 0.148616, 0.396998, 1], [0.097411, 0.149248, 0.406419, 1], [0.105479, 0.149754, 0.415755, 1], [0.113634, 0.150134, 0.424998, 1], [0.121873, 0.150389, 0.434139, 1], [0.130192, 0.150521, 0.443167, 1], [0.138591, 0.150528, 0.452075, 1], [0.147065, 0.150413, 0.460852, 1], [0.155614, 0.150175, 0.469493, 1], [0.164232, 0.149818, 0.477985, 1], [0.172917, 0.149343, 0.486322, 1], [0.181666, 0.148751, 0.494494, 1], [0.190476, 0.148046, 0.502493, 1], [0.199344, 0.147229, 0.510313, 1], [0.208267, 0.146302, 0.517944, 1], [0.217242, 0.145267, 0.52538, 1], [0.226264, 0.144131, 0.532613, 1], [0.235331, 0.142894, 0.539635, 1], [0.24444, 0.141559, 0.546442, 1], [0.253587, 0.140131, 0.553026, 1], [0.262769, 0.138615, 0.559381, 1], [0.271981, 0.137016, 0.5655, 1], [0.281222, 0.135335, 0.571381, 1], [0.290487, 0.133581, 0.577017, 1], [0.299774, 0.131757, 0.582404, 1], [0.30908, 0.129867, 0.587538, 1], [0.318399, 0.12792, 0.592415, 1], [0.32773, 0.125921, 0.597032, 1], [0.337069, 0.123877, 0.601385, 1], [0.346413, 0.121793, 0.605474, 1], [0.355758, 0.119678, 0.609295, 1], [0.365102, 0.11754, 0.612846, 1], [0.374443, 0.115386, 0.616127, 1], [0.383774, 0.113226, 0.619138, 1], [0.393096, 0.111066, 0.621876, 1], [0.402404, 0.108918, 0.624343, 1], [0.411694, 0.106794, 0.62654, 1], [0.420967, 0.104698, 0.628466, 1], [0.430217, 0.102645, 0.630123, 1], [0.439442, 0.100647, 0.631513, 1], [0.448637, 0.098717, 0.632638, 1], [0.457805, 0.096861, 0.633499, 1], [0.46694, 0.095095, 0.6341, 1], [0.47604, 0.093433, 0.634443, 1], [0.485102, 0.091885, 0.634532, 1], [0.494125, 0.090466, 0.63437, 1], [0.503104, 0.08919, 0.633962, 1], [0.512041, 0.088067, 0.633311, 1], [0.520931, 0.087108, 0.63242, 1], [0.529773, 0.086329, 0.631297, 1], [0.538564, 0.085738, 0.629944, 1], [0.547302, 0.085346, 0.628367, 1], [0.555986, 0.085162, 0.626572, 1], [0.564615, 0.08519, 0.624563, 1], [0.573187, 0.085439, 0.622345, 1], [0.581698, 0.085913, 0.619926, 1], [0.590149, 0.086615, 0.617311, 1], [0.598538, 0.087543, 0.614503, 1], [0.606862, 0.0887, 0.611511, 1], [0.61512, 0.090084, 0.608343, 1], [0.623312, 0.09169, 0.605001, 1], [0.631438, 0.093511, 0.601489, 1], [0.639492, 0.095546, 0.597821, 1], [0.647476, 0.097787, 0.593999, 1], [0.655389, 0.100226, 0.590028, 1], [0.66323, 0.102856, 0.585914, 1], [0.670995, 0.105669, 0.581667, 1], [0.678686, 0.108658, 0.577291, 1], [0.686302, 0.111813, 0.57279, 1], [0.69384, 0.115129, 0.568175, 1], [0.7013, 0.118597, 0.563449, 1], [0.708682, 0.122209, 0.558616, 1], [0.715984, 0.125959, 0.553687, 1], [0.723206, 0.12984, 0.548666, 1], [0.730346, 0.133846, 0.543558, 1], [0.737406, 0.13797, 0.538366, 1], [0.744382, 0.142209, 0.533101, 1], [0.751274, 0.146556, 0.527767, 1], [0.758082, 0.151008, 0.522369, 1], [0.764805, 0.155559, 0.516912, 1], [0.771443, 0.160206, 0.511402, 1], [0.777995, 0.164946, 0.505845, 1], [0.784459, 0.169774, 0.500246, 1], [0.790836, 0.174689, 0.494607, 1], [0.797125, 0.179688, 0.488935, 1], [0.803325, 0.184767, 0.483238, 1], [0.809435, 0.189925, 0.477518, 1], [0.815455, 0.19516, 0.471781, 1], [0.821384, 0.200471, 0.466028, 1], [0.827222, 0.205854, 0.460267, 1], [0.832968, 0.211308, 0.454505, 1], [0.838621, 0.216834, 0.448738, 1], [0.844181, 0.222428, 0.442979, 1], [0.849647, 0.22809, 0.43723, 1], [0.855019, 0.233819, 0.431491, 1], [0.860295, 0.239613, 0.425771, 1], [0.865475, 0.245471, 0.420074, 1], [0.870558, 0.251393, 0.414403, 1], [0.875545, 0.25738, 0.408759, 1], [0.880433, 0.263427, 0.403152, 1], [0.885223, 0.269535, 0.397585, 1], [0.889913, 0.275705, 0.392058, 1], [0.894503, 0.281934, 0.386578, 1], [0.898993, 0.288222, 0.381152, 1], [0.903381, 0.294569, 0.375781, 1], [0.907667, 0.300974, 0.370469, 1], [0.911849, 0.307435, 0.365223, 1], [0.915928, 0.313953, 0.360048, 1], [0.919902, 0.320527, 0.354948, 1], [0.923771, 0.327155, 0.349928, 1], [0.927533, 0.333838, 0.344994, 1], [0.931188, 0.340576, 0.340149, 1], [0.934736, 0.347366, 0.335403, 1], [0.938175, 0.354207, 0.330762, 1], [0.941504, 0.361101, 0.326229, 1], [0.944723, 0.368045, 0.321814, 1], [0.947831, 0.375039, 0.317523, 1], [0.950826, 0.382083, 0.313364, 1], [0.953709, 0.389175, 0.309345, 1], [0.956478, 0.396314, 0.305477, 1], [0.959133, 0.403499, 0.301766, 1], [0.961671, 0.410731, 0.298221, 1], [0.964093, 0.418008, 0.294853, 1], [0.966399, 0.425327, 0.291676, 1], [0.968586, 0.43269, 0.288696, 1], [0.970654, 0.440095, 0.285926, 1], [0.972603, 0.44754, 0.28338, 1], [0.974431, 0.455025, 0.281067, 1], [0.976139, 0.462547, 0.279003, 1], [0.977725, 0.470107, 0.277198, 1], [0.979188, 0.477703, 0.275666, 1], [0.980529, 0.485332, 0.274422, 1], [0.981747, 0.492995, 0.273476, 1], [0.98284, 0.50069, 0.272842, 1], [0.983808, 0.508415, 0.272532, 1], [0.984653, 0.516168, 0.27256, 1], [0.985373, 0.523948, 0.272937, 1], [0.985966, 0.531754, 0.273673, 1], [0.986436, 0.539582, 0.274779, 1], [0.98678, 0.547434, 0.276264, 1], [0.986998, 0.555305, 0.278135, 1], [0.987091, 0.563195, 0.280401, 1], [0.987061, 0.5711, 0.283066, 1], [0.986907, 0.579019, 0.286137, 1], [0.986629, 0.58695, 0.289615, 1], [0.986229, 0.594891, 0.293503, 1], [0.985709, 0.602839, 0.297802, 1], [0.985069, 0.610792, 0.302512, 1], [0.98431, 0.618748, 0.307632, 1], [0.983435, 0.626704, 0.313159, 1], [0.982445, 0.634657, 0.319089, 1], [0.981341, 0.642606, 0.32542, 1], [0.98013, 0.650546, 0.332144, 1], [0.978812, 0.658475, 0.339257, 1], [0.977392, 0.666391, 0.346753, 1], [0.97587, 0.67429, 0.354625, 1], [0.974252, 0.68217, 0.362865, 1], [0.972545, 0.690026, 0.371466, 1], [0.97075, 0.697856, 0.380419, 1], [0.968873, 0.705658, 0.389718, 1], [0.966921, 0.713426, 0.399353, 1], [0.964901, 0.721157, 0.409313, 1], [0.962815, 0.728851, 0.419594, 1], [0.960677, 0.7365, 0.430181, 1], [0.95849, 0.744103, 0.44107, 1], [0.956263, 0.751656, 0.452248, 1], [0.954009, 0.759153, 0.463702, 1], [0.951732, 0.766595, 0.475429, 1], [0.949445, 0.773974, 0.487414, 1], [0.947158, 0.781289, 0.499647, 1], [0.944885, 0.788535, 0.512116, 1], [0.942634, 0.795709, 0.524811, 1], [0.940423, 0.802807, 0.537717, 1], [0.938261, 0.809825, 0.550825, 1], [0.936163, 0.81676, 0.564121, 1], [0.934146, 0.823608, 0.577591, 1], [0.932224, 0.830366, 0.59122, 1], [0.930412, 0.837031, 0.604997, 1], [0.928727, 0.843599, 0.618904, 1], [0.927187, 0.850066, 0.632926, 1], [0.925809, 0.856432, 0.647047, 1], [0.92461, 0.862691, 0.661249, 1], [0.923607, 0.868843, 0.675517, 1], [0.92282, 0.874884, 0.689832, 1], [0.922265, 0.880812, 0.704174, 1], [0.921962, 0.886626, 0.718523, 1], [0.92193, 0.892323, 0.732859, 1], [0.922183, 0.897903, 0.747163, 1], [0.922741, 0.903364, 0.76141, 1], [0.92362, 0.908706, 0.77558, 1], [0.924837, 0.913928, 0.789648, 1], [0.926405, 0.919031, 0.80359, 1], [0.92834, 0.924015, 0.817381, 1], [0.930655, 0.928881, 0.830995, 1], [0.93336, 0.933631, 0.844405, 1], [0.936466, 0.938267, 0.857583, 1], [0.939982, 0.942791, 0.870499, 1], [0.943914, 0.947207, 0.883122, 1], [0.948267, 0.951519, 0.895421, 1], [0.953044, 0.955732, 0.907359, 1], [0.958246, 0.959852, 0.918901, 1], [0.963869, 0.963887, 0.930004, 1], [0.969909, 0.967845, 0.940623, 1], [0.976355, 0.971737, 0.950704, 1], [0.983195, 0.97558, 0.960181, 1], [0.990402, 0.979395, 0.968966, 1], [0.99793, 0.983217, 0.97692, 1]] };
1796
- function re(o) {
1797
- return o >= 1e3 ? (o / 1e3).toFixed(1) : Math.round(o).toString();
1796
+ function ue(r) {
1797
+ return r >= 1e3 ? (r / 1e3).toFixed(1) : Math.round(r).toString();
1798
1798
  }
1799
- function oe(o) {
1800
- return o >= 1e3 ? "kHz" : "Hz";
1799
+ function de(r) {
1800
+ return r >= 1e3 ? "kHz" : "Hz";
1801
1801
  }
1802
- function ae(o, t, e, i, s) {
1803
- const r = X(e, s);
1802
+ function pe(r, t, e, i, s) {
1803
+ const o = O(e, s);
1804
1804
  return function(n, l) {
1805
1805
  switch (l) {
1806
1806
  case "mel":
1807
- return Ct(n);
1807
+ return Mt(n);
1808
1808
  case "logarithmic":
1809
1809
  return St(n);
1810
1810
  case "bark":
1811
- return Mt(n);
1811
+ return Et(n);
1812
1812
  case "erb":
1813
- return Pt(n);
1813
+ return Tt(n);
1814
1814
  default:
1815
1815
  return n;
1816
1816
  }
1817
- }(r + o / t * (X(i, s) - r), s);
1817
+ }(o + r / t * (O(i, s) - o), s);
1818
1818
  }
1819
- function le(o, t, e, i) {
1820
- switch (this.bufferSize = o, this.sampleRate = t, this.bandwidth = 2 / o * (t / 2), this.sinTable = new Float32Array(o), this.cosTable = new Float32Array(o), this.windowValues = new Float32Array(o), this.reverseTable = new Uint32Array(o), this.peakBand = 0, this.peak = 0, e) {
1819
+ function me(r, t, e, i) {
1820
+ switch (this.bufferSize = r, this.sampleRate = t, this.bandwidth = 2 / r * (t / 2), this.sinTable = new Float32Array(r), this.cosTable = new Float32Array(r), this.windowValues = new Float32Array(r), this.reverseTable = new Uint32Array(r), this.peakBand = 0, this.peak = 0, e) {
1821
1821
  case "bartlett":
1822
- for (let n = 0; n < o; n++) this.windowValues[n] = 2 / (o - 1) * ((o - 1) / 2 - Math.abs(n - (o - 1) / 2));
1822
+ for (let n = 0; n < r; n++) this.windowValues[n] = 2 / (r - 1) * ((r - 1) / 2 - Math.abs(n - (r - 1) / 2));
1823
1823
  break;
1824
1824
  case "bartlettHann":
1825
- for (let n = 0; n < o; n++) this.windowValues[n] = 0.62 - 0.48 * Math.abs(n / (o - 1) - 0.5) - 0.38 * Math.cos(2 * Math.PI * n / (o - 1));
1825
+ for (let n = 0; n < r; n++) this.windowValues[n] = 0.62 - 0.48 * Math.abs(n / (r - 1) - 0.5) - 0.38 * Math.cos(2 * Math.PI * n / (r - 1));
1826
1826
  break;
1827
1827
  case "blackman":
1828
1828
  i = i || 0.16;
1829
- for (let n = 0; n < o; n++) this.windowValues[n] = (1 - i) / 2 - 0.5 * Math.cos(2 * Math.PI * n / (o - 1)) + i / 2 * Math.cos(4 * Math.PI * n / (o - 1));
1829
+ for (let n = 0; n < r; n++) this.windowValues[n] = (1 - i) / 2 - 0.5 * Math.cos(2 * Math.PI * n / (r - 1)) + i / 2 * Math.cos(4 * Math.PI * n / (r - 1));
1830
1830
  break;
1831
1831
  case "cosine":
1832
- for (let n = 0; n < o; n++) this.windowValues[n] = Math.cos(Math.PI * n / (o - 1) - Math.PI / 2);
1832
+ for (let n = 0; n < r; n++) this.windowValues[n] = Math.cos(Math.PI * n / (r - 1) - Math.PI / 2);
1833
1833
  break;
1834
1834
  case "gauss":
1835
1835
  i = i || 0.25;
1836
- for (let n = 0; n < o; n++) this.windowValues[n] = Math.pow(Math.E, -0.5 * Math.pow((n - (o - 1) / 2) / (i * (o - 1) / 2), 2));
1836
+ for (let n = 0; n < r; n++) this.windowValues[n] = Math.pow(Math.E, -0.5 * Math.pow((n - (r - 1) / 2) / (i * (r - 1) / 2), 2));
1837
1837
  break;
1838
1838
  case "hamming":
1839
- for (let n = 0; n < o; n++) this.windowValues[n] = 0.54 - 0.46 * Math.cos(2 * Math.PI * n / (o - 1));
1839
+ for (let n = 0; n < r; n++) this.windowValues[n] = 0.54 - 0.46 * Math.cos(2 * Math.PI * n / (r - 1));
1840
1840
  break;
1841
1841
  case "hann":
1842
1842
  case void 0:
1843
- for (let n = 0; n < o; n++) this.windowValues[n] = 0.5 * (1 - Math.cos(2 * Math.PI * n / (o - 1)));
1843
+ for (let n = 0; n < r; n++) this.windowValues[n] = 0.5 * (1 - Math.cos(2 * Math.PI * n / (r - 1)));
1844
1844
  break;
1845
1845
  case "lanczoz":
1846
- for (let n = 0; n < o; n++) this.windowValues[n] = Math.sin(Math.PI * (2 * n / (o - 1) - 1)) / (Math.PI * (2 * n / (o - 1) - 1));
1846
+ for (let n = 0; n < r; n++) this.windowValues[n] = Math.sin(Math.PI * (2 * n / (r - 1) - 1)) / (Math.PI * (2 * n / (r - 1) - 1));
1847
1847
  break;
1848
1848
  case "rectangular":
1849
- for (let n = 0; n < o; n++) this.windowValues[n] = 1;
1849
+ for (let n = 0; n < r; n++) this.windowValues[n] = 1;
1850
1850
  break;
1851
1851
  case "triangular":
1852
- for (let n = 0; n < o; n++) this.windowValues[n] = 2 / o * (o / 2 - Math.abs(n - (o - 1) / 2));
1852
+ for (let n = 0; n < r; n++) this.windowValues[n] = 2 / r * (r / 2 - Math.abs(n - (r - 1) / 2));
1853
1853
  break;
1854
1854
  default:
1855
1855
  throw Error("No such window function '" + e + "'");
1856
1856
  }
1857
- let s = 1, r = o >> 1;
1858
- for (; s < o; ) {
1859
- for (let n = 0; n < s; n++) this.reverseTable[n + s] = this.reverseTable[n] + r;
1860
- s <<= 1, r >>= 1;
1857
+ let s = 1, o = r >> 1;
1858
+ for (; s < r; ) {
1859
+ for (let n = 0; n < s; n++) this.reverseTable[n + s] = this.reverseTable[n] + o;
1860
+ s <<= 1, o >>= 1;
1861
1861
  }
1862
- for (let n = 0; n < o; n++) this.sinTable[n] = Math.sin(-Math.PI / n), this.cosTable[n] = Math.cos(-Math.PI / n);
1862
+ for (let n = 0; n < r; n++) this.sinTable[n] = Math.sin(-Math.PI / n), this.cosTable[n] = Math.cos(-Math.PI / n);
1863
1863
  this.calculateSpectrum = function(n) {
1864
- const l = this.bufferSize, h = this.cosTable, c = this.sinTable, a = this.reverseTable, d = new Float32Array(l), u = new Float32Array(l), p = 2 / this.bufferSize, b = Math.sqrt, x = new Float32Array(l / 2);
1865
- let g, m, y;
1866
- const w = Math.floor(Math.log(l) / Math.LN2);
1867
- if (Math.pow(2, w) !== l) throw "Invalid buffer size, must be a power of 2.";
1864
+ const l = this.bufferSize, h = this.cosTable, c = this.sinTable, a = this.reverseTable, u = new Float32Array(l), d = new Float32Array(l), p = 2 / this.bufferSize, g = Math.sqrt, y = new Float32Array(l / 2);
1865
+ let f, m, w;
1866
+ const W = Math.floor(Math.log(l) / Math.LN2);
1867
+ if (Math.pow(2, W) !== l) throw "Invalid buffer size, must be a power of 2.";
1868
1868
  if (l !== n.length) throw "Supplied buffer is not the same size as defined FFT. FFT Size: " + l + " Buffer Size: " + n.length;
1869
- let v, f, C, W, S, M, E, L, T = 1;
1870
- for (let P = 0; P < l; P++) d[P] = n[a[P]] * this.windowValues[a[P]], u[P] = 0;
1871
- for (; T < l; ) {
1872
- v = h[T], f = c[T], C = 1, W = 0;
1873
- for (let P = 0; P < T; P++) {
1874
- let Z = P;
1875
- for (; Z < l; ) S = Z + T, M = C * d[S] - W * u[S], E = C * u[S] + W * d[S], d[S] = d[Z] - M, u[S] = u[Z] - E, d[Z] += M, u[Z] += E, Z += T << 1;
1876
- L = C, C = L * v - W * f, W = L * f + W * v;
1869
+ let v, b, x, C, M, S, P, T, L = 1;
1870
+ for (let E = 0; E < l; E++) u[E] = n[a[E]] * this.windowValues[a[E]], d[E] = 0;
1871
+ for (; L < l; ) {
1872
+ v = h[L], b = c[L], x = 1, C = 0;
1873
+ for (let E = 0; E < L; E++) {
1874
+ let Z = E;
1875
+ for (; Z < l; ) M = Z + L, S = x * u[M] - C * d[M], P = x * d[M] + C * u[M], u[M] = u[Z] - S, d[M] = d[Z] - P, u[Z] += S, d[Z] += P, Z += L << 1;
1876
+ T = x, x = T * v - C * b, C = T * b + C * v;
1877
1877
  }
1878
- T <<= 1;
1878
+ L <<= 1;
1879
1879
  }
1880
- for (let P = 0, Z = l / 2; P < Z; P++) g = d[P], m = u[P], y = p * b(g * g + m * m), y > this.peak && (this.peakBand = P, this.peak = y), x[P] = y;
1881
- return x;
1880
+ for (let E = 0, Z = l / 2; E < Z; E++) f = u[E], m = d[E], w = p * g(f * f + m * m), w > this.peak && (this.peakBand = E, this.peak = w), y[E] = w;
1881
+ return y;
1882
1882
  };
1883
1883
  }
1884
- class he {
1884
+ class ve {
1885
1885
  constructor() {
1886
1886
  this.listeners = {};
1887
1887
  }
@@ -1908,7 +1908,7 @@ class he {
1908
1908
  this.listeners[t] && this.listeners[t].forEach((i) => i(...e));
1909
1909
  }
1910
1910
  }
1911
- class ce extends he {
1911
+ class fe extends ve {
1912
1912
  constructor(t) {
1913
1913
  super(), this.subscriptions = [], this.isDestroyed = !1, this.options = t;
1914
1914
  }
@@ -1921,51 +1921,51 @@ class ce extends he {
1921
1921
  this.emit("destroy"), this.subscriptions.forEach((t) => t()), this.subscriptions = [], this.isDestroyed = !0, this.wavesurfer = void 0;
1922
1922
  }
1923
1923
  }
1924
- function kt(o, t) {
1925
- const e = t.xmlns ? document.createElementNS(t.xmlns, o) : document.createElement(o);
1926
- for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [r, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(kt(r, n));
1924
+ function Lt(r, t) {
1925
+ const e = t.xmlns ? document.createElementNS(t.xmlns, r) : document.createElement(r);
1926
+ for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [o, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(Lt(o, n));
1927
1927
  else i === "style" ? Object.assign(e.style, s) : i === "textContent" ? e.textContent = s : e.setAttribute(i, s.toString());
1928
1928
  return e;
1929
1929
  }
1930
- function A(o, t, e) {
1931
- const i = kt(o, t || {});
1930
+ function K(r, t, e) {
1931
+ const i = Lt(r, t || {});
1932
1932
  return e?.appendChild(i), i;
1933
1933
  }
1934
- var Lt = null;
1934
+ var Rt = null;
1935
1935
  try {
1936
- var ue = typeof module < "u" && typeof module.require == "function" && module.require("worker_threads") || typeof __non_webpack_require__ == "function" && __non_webpack_require__("worker_threads") || typeof require == "function" && require("worker_threads");
1937
- Lt = ue.Worker;
1936
+ var ge = typeof module < "u" && typeof module.require == "function" && module.require("worker_threads") || typeof __non_webpack_require__ == "function" && __non_webpack_require__("worker_threads") || typeof require == "function" && require("worker_threads");
1937
+ Rt = ge.Worker;
1938
1938
  } catch {
1939
1939
  }
1940
- function de(o, t, e) {
1940
+ function be(r, t, e) {
1941
1941
  var i = function(n) {
1942
1942
  return Buffer.from(n, "base64").toString("utf8");
1943
- }(o), s = i.indexOf(`
1944
- `, 10) + 1, r = i.substring(s) + "";
1943
+ }(r), s = i.indexOf(`
1944
+ `, 10) + 1, o = i.substring(s) + "";
1945
1945
  return function(n) {
1946
- return new Lt(r, Object.assign({}, n, { eval: !0 }));
1946
+ return new Rt(o, Object.assign({}, n, { eval: !0 }));
1947
1947
  };
1948
1948
  }
1949
- function pe(o, t, e) {
1949
+ function ye(r, t, e) {
1950
1950
  var i = function(l) {
1951
1951
  return atob(l);
1952
- }(o), s = i.indexOf(`
1953
- `, 10) + 1, r = i.substring(s) + "", n = new Blob([r], { type: "application/javascript" });
1952
+ }(r), s = i.indexOf(`
1953
+ `, 10) + 1, o = i.substring(s) + "", n = new Blob([o], { type: "application/javascript" });
1954
1954
  return URL.createObjectURL(n);
1955
1955
  }
1956
- var me = Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]";
1957
- function ve(o, t, e) {
1958
- return me ? de(o) : /* @__PURE__ */ function(i) {
1956
+ var we = Object.prototype.toString.call(typeof process < "u" ? process : 0) === "[object process]";
1957
+ function We(r, t, e) {
1958
+ return we ? be(r) : /* @__PURE__ */ function(i) {
1959
1959
  var s;
1960
- return function(r) {
1961
- return s = s || pe(i), new Worker(s, r);
1960
+ return function(o) {
1961
+ return s = s || ye(i), new Worker(s, o);
1962
1962
  };
1963
- }(o);
1963
+ }(r);
1964
1964
  }
1965
- var fe = ve("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y29uc3QgdD0xZTMqTWF0aC5sb2coMTApLzEwNy45Mzk7ZnVuY3Rpb24gZSh0KXtyZXR1c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8wOmE+LVQ/MjU1Ok1hdGgucm91bmQoKGErVCkvRioyNTUpfXIucHVzaChuKX14LnB1c2gocil9cmV0dXJuIHh9KGIsZCksTT17dHlwZToiZnJlcXVlbmNpZXNSZXN1bHQiLGlkOncscmVzdWx0OnR9O3NlbGYucG9zdE1lc3NhZ2UoTSl9Y2F0Y2godCl7Y29uc3QgZT17dHlwZToiZnJlcXVlbmNpZXNSZXN1bHQiLGlkOncsZXJyb3I6dCBpbnN0YW5jZW9mIEVycm9yP3QubWVzc2FnZTpTdHJpbmcodCl9O3NlbGYucG9zdE1lc3NhZ2UoZSl9fX0oKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9c3BlY3Ryb2dyYW0td29ya2VyLmpzLm1hcAoK");
1966
+ class I extends fe {
1967
1967
  static create(t) {
1968
- return new R(t || {});
1968
+ return new I(t || {});
1969
1969
  }
1970
1970
  constructor(t) {
1971
1971
  var e, i;
@@ -1976,18 +1976,18 @@ class R extends ce {
1976
1976
  for (let n = 0; n < s.length; n++) if (s[n].length !== 4) throw new Error("ColorMap entries must contain 4 values");
1977
1977
  return s;
1978
1978
  }
1979
- const r = ne[s];
1980
- if (!r) throw Error("No such colormap '" + s + "'");
1981
- return r();
1982
- }(t.colorMap), this.fftSamples = t.fftSamples || 512, this.height = t.height || 200, this.noverlap = t.noverlap || null, this.windowFunc = t.windowFunc || "hann", this.alpha = t.alpha, this.frequencyMin = t.frequencyMin || 0, this.frequencyMax = t.frequencyMax || 0, this.gainDB = (e = t.gainDB) !== null && e !== void 0 ? e : 20, this.rangeDB = (i = t.rangeDB) !== null && i !== void 0 ? i : 80, this.scale = t.scale || "mel", this.numMelFilters = this.fftSamples / 2, this.numLogFilters = this.fftSamples / 2, this.numBarkFilters = this.fftSamples / 2, this.numErbFilters = this.fftSamples / 2, t.maxCanvasWidth && (R.MAX_CANVAS_WIDTH = t.maxCanvasWidth), this.renderThrottleMs = 50, this.zoomThreshold = 0.05, this.createWrapper(), this.createCanvas(), this.useWebWorker && this.initializeWorker();
1979
+ const o = ce[s];
1980
+ if (!o) throw Error("No such colormap '" + s + "'");
1981
+ return o();
1982
+ }(t.colorMap), this.fftSamples = t.fftSamples || 512, this.height = t.height || 200, this.noverlap = t.noverlap || null, this.windowFunc = t.windowFunc || "hann", this.alpha = t.alpha, this.frequencyMin = t.frequencyMin || 0, this.frequencyMax = t.frequencyMax || 0, this.gainDB = (e = t.gainDB) !== null && e !== void 0 ? e : 20, this.rangeDB = (i = t.rangeDB) !== null && i !== void 0 ? i : 80, this.scale = t.scale || "mel", this.numMelFilters = this.fftSamples / 2, this.numLogFilters = this.fftSamples / 2, this.numBarkFilters = this.fftSamples / 2, this.numErbFilters = this.fftSamples / 2, t.maxCanvasWidth && (I.MAX_CANVAS_WIDTH = t.maxCanvasWidth), this.renderThrottleMs = 50, this.zoomThreshold = 0.05, this.createWrapper(), this.createCanvas(), this.useWebWorker && this.initializeWorker();
1983
1983
  }
1984
1984
  initializeWorker() {
1985
1985
  if (typeof window < "u" && typeof Worker < "u") try {
1986
- this.worker = new fe(), this.worker.onmessage = (t) => {
1987
- const { type: e, id: i, result: s, error: r } = t.data;
1986
+ this.worker = new xe(), this.worker.onmessage = (t) => {
1987
+ const { type: e, id: i, result: s, error: o } = t.data;
1988
1988
  if (e === "frequenciesResult") {
1989
1989
  const n = this.workerPromises.get(i);
1990
- n && (this.workerPromises.delete(i), r ? n.reject(new Error(r)) : n.resolve(s));
1990
+ n && (this.workerPromises.delete(i), o ? n.reject(new Error(o)) : n.resolve(s));
1991
1991
  }
1992
1992
  }, this.worker.onerror = (t) => {
1993
1993
  console.warn("Spectrogram worker error, falling back to main thread:", t), this.worker = null;
@@ -2006,7 +2006,7 @@ class R extends ce {
2006
2006
  this.unAll(), this.wavesurfer && (typeof this._onReady == "function" && this.wavesurfer.un("ready", this._onReady), typeof this._onRender == "function" && this.wavesurfer.un("redraw", this._onRender)), this.renderTimeout && (clearTimeout(this.renderTimeout), this.renderTimeout = null), this.scrollUnsubscribe && (this.scrollUnsubscribe(), this.scrollUnsubscribe = null), this.pendingBitmaps.clear(), this.worker && (this.worker.terminate(), this.worker = null), this.cachedFrequencies = null, this.cachedResampledData = null, this.cachedBuffer = null, this.clearCanvases(), this.canvasContainer && (this.canvasContainer.remove(), this.canvasContainer = null), this.wrapper && (this.wrapper.remove(), this.wrapper = null), this.labelsEl && (this.labelsEl.remove(), this.labelsEl = null), this.container = null, this.isRendering = !1, this.lastZoomLevel = 0, this.wavesurfer = null, this.util = null, this.options = null, super.destroy();
2007
2007
  }
2008
2008
  loadFrequenciesData(t) {
2009
- return O(this, void 0, void 0, function* () {
2009
+ return X(this, void 0, void 0, function* () {
2010
2010
  const e = yield fetch(t);
2011
2011
  if (!e.ok) throw new Error("Unable to fetch frequencies data");
2012
2012
  const i = yield e.json();
@@ -2014,7 +2014,7 @@ class R extends ce {
2014
2014
  });
2015
2015
  }
2016
2016
  getFrequenciesData() {
2017
- return O(this, void 0, void 0, function* () {
2017
+ return X(this, void 0, void 0, function* () {
2018
2018
  var t;
2019
2019
  const e = (t = this.wavesurfer) === null || t === void 0 ? void 0 : t.getDecodedData();
2020
2020
  if (!e) return null;
@@ -2030,23 +2030,23 @@ class R extends ce {
2030
2030
  }
2031
2031
  createWrapper() {
2032
2032
  var t, e;
2033
- this.wrapper = A("div", { style: { display: "block", position: "relative", userSelect: "none" } }), this.options.labels && (this.labelsEl = A("canvas", { part: "spec-labels", style: { position: "absolute", zIndex: 9, width: "55px", height: "100%" } }, this.wrapper)), this._onWrapperClick = (t = this.wrapper, e = this.emit.bind(this), (i) => {
2034
- const s = t.getBoundingClientRect(), r = i.clientX - s.left, n = s.width;
2035
- e("click", r / n);
2033
+ this.wrapper = K("div", { style: { display: "block", position: "relative", userSelect: "none" } }), this.options.labels && (this.labelsEl = K("canvas", { part: "spec-labels", style: { position: "absolute", zIndex: 9, width: "55px", height: "100%" } }, this.wrapper)), this._onWrapperClick = (t = this.wrapper, e = this.emit.bind(this), (i) => {
2034
+ const s = t.getBoundingClientRect(), o = i.clientX - s.left, n = s.width;
2035
+ e("click", o / n);
2036
2036
  }), this.wrapper.addEventListener("click", this._onWrapperClick);
2037
2037
  }
2038
2038
  createCanvas() {
2039
- this.canvasContainer = A("div", { style: { position: "absolute", left: 0, top: 0, width: "100%", height: "100%", zIndex: 4 } }, this.wrapper);
2039
+ this.canvasContainer = K("div", { style: { position: "absolute", left: 0, top: 0, width: "100%", height: "100%", zIndex: 4 } }, this.wrapper);
2040
2040
  }
2041
2041
  createSingleCanvas(t, e, i) {
2042
- const s = A("canvas", { style: { position: "absolute", left: `${Math.round(i)}px`, top: "0", width: `${t}px`, height: `${e}px`, zIndex: 4 } });
2042
+ const s = K("canvas", { style: { position: "absolute", left: `${Math.round(i)}px`, top: "0", width: `${t}px`, height: `${e}px`, zIndex: 4 } });
2043
2043
  return s.width = Math.round(t), s.height = Math.round(e), this.canvasContainer.appendChild(s), s;
2044
2044
  }
2045
2045
  clearCanvases() {
2046
2046
  this.canvases.forEach((t) => t.remove()), this.canvases = [], this.drawnCanvases = {};
2047
2047
  }
2048
2048
  clearExcessCanvases() {
2049
- Object.keys(this.drawnCanvases).length > R.MAX_NODES && this.clearCanvases();
2049
+ Object.keys(this.drawnCanvases).length > I.MAX_NODES && this.clearCanvases();
2050
2050
  }
2051
2051
  throttledRender() {
2052
2052
  var t;
@@ -2059,7 +2059,7 @@ class R extends ce {
2059
2059
  }, this.renderThrottleMs);
2060
2060
  }
2061
2061
  render() {
2062
- return O(this, void 0, void 0, function* () {
2062
+ return X(this, void 0, void 0, function* () {
2063
2063
  var t, e;
2064
2064
  if (!this.isRendering) {
2065
2065
  this.isRendering = !0;
@@ -2085,61 +2085,61 @@ class R extends ce {
2085
2085
  drawSpectrogram(t) {
2086
2086
  var e, i, s;
2087
2087
  isNaN(t[0][0]) || (t = [t]), this.clearCanvases();
2088
- const r = this.height * t.length;
2089
- this.wrapper.style.height = r + "px";
2090
- const n = this.getWidth(), l = Math.min(R.MAX_CANVAS_WIDTH, n);
2091
- if (n === 0 || r === 0) return;
2088
+ const o = this.height * t.length;
2089
+ this.wrapper.style.height = o + "px";
2090
+ const n = this.getWidth(), l = Math.min(I.MAX_CANVAS_WIDTH, n);
2091
+ if (n === 0 || o === 0) return;
2092
2092
  const h = Math.ceil(n / l);
2093
2093
  let c;
2094
2094
  const a = ((e = t[0]) === null || e === void 0 ? void 0 : e.length) || 0;
2095
2095
  n !== a ? this.cachedResampledData && this.cachedWidth === n ? c = this.cachedResampledData : (c = this.efficientResample(t, n), this.cachedResampledData = c, this.cachedWidth = n) : c = t;
2096
- const d = !((i = this.buffer) === null || i === void 0) && i.sampleRate ? this.buffer.sampleRate / 2 : (this.options.sampleRate || 0) / 2, u = this.frequencyMin, p = this.frequencyMax, b = p > d, x = b ? this.colorMap[this.colorMap.length - 1] : null, g = (m) => {
2096
+ const u = !((i = this.buffer) === null || i === void 0) && i.sampleRate ? this.buffer.sampleRate / 2 : (this.options.sampleRate || 0) / 2, d = this.frequencyMin, p = this.frequencyMax, g = p > u, y = g ? this.colorMap[this.colorMap.length - 1] : null, f = (m) => {
2097
2097
  if (m < 0 || m >= h || this.drawnCanvases[m]) return;
2098
2098
  this.drawnCanvases[m] = !0;
2099
- const y = m * l, w = Math.min(l, n - y);
2100
- if (w <= 0) return;
2101
- const v = this.createSingleCanvas(w, r, y);
2099
+ const w = m * l, W = Math.min(l, n - w);
2100
+ if (W <= 0) return;
2101
+ const v = this.createSingleCanvas(W, o, w);
2102
2102
  this.canvases.push(v);
2103
- const f = v.getContext("2d");
2104
- if (f) {
2105
- b && x && (f.fillStyle = `rgba(${255 * x[0]}, ${255 * x[1]}, ${255 * x[2]}, ${x[3]})`, f.fillRect(0, 0, w, r));
2106
- for (let C = 0; C < c.length; C++) this.drawSpectrogramSegment(c[C], f, w, this.height, C * this.height, y, n, d, u, p);
2103
+ const b = v.getContext("2d");
2104
+ if (b) {
2105
+ g && y && (b.fillStyle = `rgba(${255 * y[0]}, ${255 * y[1]}, ${255 * y[2]}, ${y[3]})`, b.fillRect(0, 0, W, o));
2106
+ for (let x = 0; x < c.length; x++) this.drawSpectrogramSegment(c[x], b, W, this.height, x * this.height, w, n, u, d, p);
2107
2107
  }
2108
2108
  };
2109
- if (this.isScrollable = n > this.getWrapperWidth(), this.scrollUnsubscribe && (this.scrollUnsubscribe(), this.scrollUnsubscribe = null), !this.isScrollable || h <= 3) for (let m = 0; m < h; m++) g(m);
2109
+ if (this.isScrollable = n > this.getWrapperWidth(), this.scrollUnsubscribe && (this.scrollUnsubscribe(), this.scrollUnsubscribe = null), !this.isScrollable || h <= 3) for (let m = 0; m < h; m++) f(m);
2110
2110
  else {
2111
2111
  const m = () => {
2112
- var f;
2113
- const C = (f = this.wavesurfer) === null || f === void 0 ? void 0 : f.getWrapper();
2114
- if (!C) return;
2115
- const W = C.scrollLeft || 0, S = C.clientWidth || 0, M = Math.max(0, W - 0.5 * S), E = Math.min(n, W + 1.5 * S), L = Math.floor(M / n * h), T = Math.min(Math.ceil(E / n * h), h - 1);
2116
- Object.keys(this.drawnCanvases).length > R.MAX_NODES && this.clearExcessCanvases();
2117
- for (let P = L; P <= T; P++) g(P);
2112
+ var b;
2113
+ const x = (b = this.wavesurfer) === null || b === void 0 ? void 0 : b.getWrapper();
2114
+ if (!x) return;
2115
+ const C = x.scrollLeft || 0, M = x.clientWidth || 0, S = Math.max(0, C - 0.5 * M), P = Math.min(n, C + 1.5 * M), T = Math.floor(S / n * h), L = Math.min(Math.ceil(P / n * h), h - 1);
2116
+ Object.keys(this.drawnCanvases).length > I.MAX_NODES && this.clearExcessCanvases();
2117
+ for (let E = T; E <= L; E++) f(E);
2118
2118
  };
2119
2119
  m();
2120
- let y = null;
2121
- const w = () => {
2122
- y && clearTimeout(y), y = window.setTimeout(m, 16);
2120
+ let w = null;
2121
+ const W = () => {
2122
+ w && clearTimeout(w), w = window.setTimeout(m, 16);
2123
2123
  }, v = (s = this.wavesurfer) === null || s === void 0 ? void 0 : s.getWrapper();
2124
- v && (v.addEventListener("scroll", w, { passive: !0 }), this.scrollUnsubscribe = () => {
2125
- v.removeEventListener("scroll", w), y && clearTimeout(y);
2124
+ v && (v.addEventListener("scroll", W, { passive: !0 }), this.scrollUnsubscribe = () => {
2125
+ v.removeEventListener("scroll", W), w && clearTimeout(w);
2126
2126
  });
2127
2127
  }
2128
2128
  this.options.labels && this.loadLabels(this.options.labelsBackground, "12px", "12px", "", this.options.labelsColor, this.options.labelsHzColor || this.options.labelsColor, "center", "#specLabels", t.length), this.emit("ready");
2129
2129
  }
2130
- drawSpectrogramSegment(t, e, i, s, r, n, l, h, c, a) {
2131
- const d = t[0].length, u = Math.floor(n / l * t.length), p = Math.min(Math.ceil((n + i) / l * t.length), t.length), b = t.slice(u, p);
2132
- if (b.length === 0) return;
2133
- const x = b.length, g = new ImageData(x, d), m = g.data;
2134
- this.fillImageDataQuality(m, b, x, d);
2135
- const y = X(c, this.scale) / X(h, this.scale), w = X(a, this.scale) / X(h, this.scale), v = Math.min(1, w), f = createImageBitmap(g, 0, Math.round(d * (1 - v)), x, Math.round(d * (v - y)));
2136
- this.pendingBitmaps.add(f), f.then((C) => {
2137
- if (this.pendingBitmaps.delete(f), e.canvas.parentNode) {
2138
- const W = s * v / w, S = r + s * (1 - v / w);
2139
- e.drawImage(C, 0, S, i, W), "close" in C && C.close();
2130
+ drawSpectrogramSegment(t, e, i, s, o, n, l, h, c, a) {
2131
+ const u = t[0].length, d = Math.floor(n / l * t.length), p = Math.min(Math.ceil((n + i) / l * t.length), t.length), g = t.slice(d, p);
2132
+ if (g.length === 0) return;
2133
+ const y = g.length, f = new ImageData(y, u), m = f.data;
2134
+ this.fillImageDataQuality(m, g, y, u);
2135
+ const w = O(c, this.scale) / O(h, this.scale), W = O(a, this.scale) / O(h, this.scale), v = Math.min(1, W), b = createImageBitmap(f, 0, Math.round(u * (1 - v)), y, Math.round(u * (v - w)));
2136
+ this.pendingBitmaps.add(b), b.then((x) => {
2137
+ if (this.pendingBitmaps.delete(b), e.canvas.parentNode) {
2138
+ const C = s * v / W, M = o + s * (1 - v / W);
2139
+ e.drawImage(x, 0, M, i, C), "close" in x && x.close();
2140
2140
  }
2141
- }).catch((C) => {
2142
- this.pendingBitmaps.delete(f);
2141
+ }).catch((x) => {
2142
+ this.pendingBitmaps.delete(b);
2143
2143
  });
2144
2144
  }
2145
2145
  getWidth() {
@@ -2150,87 +2150,87 @@ class R extends ce {
2150
2150
  return ((e = (t = this.wavesurfer) === null || t === void 0 ? void 0 : t.getWrapper()) === null || e === void 0 ? void 0 : e.clientWidth) || 0;
2151
2151
  }
2152
2152
  calculateFrequenciesWithWorker(t) {
2153
- return O(this, void 0, void 0, function* () {
2153
+ return X(this, void 0, void 0, function* () {
2154
2154
  var e, i;
2155
2155
  if (!this.worker) throw new Error("Worker not available");
2156
- const s = this.fftSamples, r = ((e = this.options.splitChannels) !== null && e !== void 0 ? e : !((i = this.wavesurfer) === null || i === void 0) && i.options.splitChannels) ? t.numberOfChannels : 1;
2156
+ const s = this.fftSamples, o = ((e = this.options.splitChannels) !== null && e !== void 0 ? e : !((i = this.wavesurfer) === null || i === void 0) && i.options.splitChannels) ? t.numberOfChannels : 1;
2157
2157
  let n = this.noverlap;
2158
2158
  if (!n) {
2159
- const a = this.getWidth(), d = t.length / a;
2160
- n = Math.max(0, Math.round(s - d));
2159
+ const a = this.getWidth(), u = t.length / a;
2160
+ n = Math.max(0, Math.round(s - u));
2161
2161
  }
2162
2162
  const l = [];
2163
- for (let a = 0; a < r; a++) l.push(t.getChannelData(a));
2164
- const h = `${Date.now()}_${Math.random()}`, c = new Promise((a, d) => {
2165
- this.workerPromises.set(h, { resolve: a, reject: d }), setTimeout(() => {
2166
- this.workerPromises.has(h) && (this.workerPromises.delete(h), d(new Error("Worker timeout")));
2163
+ for (let a = 0; a < o; a++) l.push(t.getChannelData(a));
2164
+ const h = `${Date.now()}_${Math.random()}`, c = new Promise((a, u) => {
2165
+ this.workerPromises.set(h, { resolve: a, reject: u }), setTimeout(() => {
2166
+ this.workerPromises.has(h) && (this.workerPromises.delete(h), u(new Error("Worker timeout")));
2167
2167
  }, 3e4);
2168
2168
  });
2169
2169
  return this.worker.postMessage({ type: "calculateFrequencies", id: h, audioData: l, options: { startTime: 0, endTime: t.duration, sampleRate: t.sampleRate, fftSamples: this.fftSamples, windowFunc: this.windowFunc, alpha: this.alpha, noverlap: n, scale: this.scale, gainDB: this.gainDB, rangeDB: this.rangeDB, splitChannels: this.options.splitChannels || !1 } }), c;
2170
2170
  });
2171
2171
  }
2172
2172
  getFrequencies(t) {
2173
- return O(this, void 0, void 0, function* () {
2173
+ return X(this, void 0, void 0, function* () {
2174
2174
  var e, i;
2175
2175
  if (this.frequencyMax = this.frequencyMax || t.sampleRate / 2, this.buffer = t, !t) return [];
2176
2176
  if (this.useWebWorker && this.worker) try {
2177
2177
  return yield this.calculateFrequenciesWithWorker(t);
2178
- } catch (g) {
2179
- console.warn("Worker calculation failed, falling back to main thread:", g);
2178
+ } catch (f) {
2179
+ console.warn("Worker calculation failed, falling back to main thread:", f);
2180
2180
  }
2181
- const s = this.fftSamples, r = ((e = this.options.splitChannels) !== null && e !== void 0 ? e : !((i = this.wavesurfer) === null || i === void 0) && i.options.splitChannels) ? t.numberOfChannels : 1, n = t.sampleRate, l = [];
2181
+ const s = this.fftSamples, o = ((e = this.options.splitChannels) !== null && e !== void 0 ? e : !((i = this.wavesurfer) === null || i === void 0) && i.options.splitChannels) ? t.numberOfChannels : 1, n = t.sampleRate, l = [];
2182
2182
  let h = this.noverlap;
2183
2183
  if (!h) {
2184
- const g = this.getWidth(), m = t.length / g;
2184
+ const f = this.getWidth(), m = t.length / f;
2185
2185
  h = Math.max(0, Math.round(s - m));
2186
2186
  }
2187
2187
  let c = h || Math.max(0, Math.round(0.5 * s));
2188
2188
  const a = 0.5 * s;
2189
2189
  c = Math.min(c, a);
2190
- const d = Math.max(64, 0.25 * s), u = Math.max(d, s - c), p = new le(s, n, this.windowFunc, this.alpha), b = this.fftSamples / 2, x = function(g, m, y, w) {
2191
- switch (g) {
2190
+ const u = Math.max(64, 0.25 * s), d = Math.max(u, s - c), p = new me(s, n, this.windowFunc, this.alpha), g = this.fftSamples / 2, y = function(f, m, w, W) {
2191
+ switch (f) {
2192
2192
  case "mel":
2193
- return j(m, y, w, wt, Ct);
2193
+ return j(m, w, W, xt, Mt);
2194
2194
  case "logarithmic":
2195
- return j(m, y, w, xt, St);
2195
+ return j(m, w, W, Ct, St);
2196
2196
  case "bark":
2197
- return j(m, y, w, Wt, Mt);
2197
+ return j(m, w, W, Pt, Et);
2198
2198
  case "erb":
2199
- return j(m, y, w, Et, Pt);
2199
+ return j(m, w, W, kt, Tt);
2200
2200
  default:
2201
2201
  return null;
2202
2202
  }
2203
- }(this.scale, b, this.fftSamples, n);
2204
- for (let g = 0; g < r; g++) {
2205
- const m = t.getChannelData(g), y = [];
2206
- for (let w = 0; w + s < m.length; w += u) {
2207
- const v = m.slice(w, w + s);
2208
- let f = p.calculateSpectrum(v);
2209
- x && (f = se(f, x));
2210
- const C = new Uint8Array(f.length), W = this.gainDB + this.rangeDB;
2211
- for (let S = 0; S < f.length; S++) {
2212
- const M = f[S] > 1e-12 ? f[S] : 1e-12, E = 20 * Math.log10(M);
2213
- E < -W ? C[S] = 0 : E > -this.gainDB ? C[S] = 255 : C[S] = Math.round((E + this.gainDB) / this.rangeDB * 255);
2203
+ }(this.scale, g, this.fftSamples, n);
2204
+ for (let f = 0; f < o; f++) {
2205
+ const m = t.getChannelData(f), w = [];
2206
+ for (let W = 0; W + s < m.length; W += d) {
2207
+ const v = m.slice(W, W + s);
2208
+ let b = p.calculateSpectrum(v);
2209
+ y && (b = he(b, y));
2210
+ const x = new Uint8Array(b.length), C = this.gainDB + this.rangeDB;
2211
+ for (let M = 0; M < b.length; M++) {
2212
+ const S = b[M] > 1e-12 ? b[M] : 1e-12, P = 20 * Math.log10(S);
2213
+ P < -C ? x[M] = 0 : P > -this.gainDB ? x[M] = 255 : x[M] = Math.round((P + this.gainDB) / this.rangeDB * 255);
2214
2214
  }
2215
- y.push(C);
2215
+ w.push(x);
2216
2216
  }
2217
- l.push(y);
2217
+ l.push(w);
2218
2218
  }
2219
2219
  return l;
2220
2220
  });
2221
2221
  }
2222
- loadLabels(t, e, i, s, r, n, l, h, c) {
2223
- t = t || "rgba(68,68,68,0)", e = e || "12px", i = i || "12px", s = s || "Helvetica", r = r || "#fff", n = n || "#fff", l = l || "center";
2224
- const a = this.height || 512, d = a / 256 * 5;
2222
+ loadLabels(t, e, i, s, o, n, l, h, c) {
2223
+ t = t || "rgba(68,68,68,0)", e = e || "12px", i = i || "12px", s = s || "Helvetica", o = o || "#fff", n = n || "#fff", l = l || "center";
2224
+ const a = this.height || 512, u = a / 256 * 5;
2225
2225
  this.frequencyMin, this.frequencyMax;
2226
- const u = this.labelsEl.getContext("2d"), p = window.devicePixelRatio;
2227
- if (this.labelsEl.height = this.height * c * p, this.labelsEl.width = 55 * p, u.scale(p, p), u) for (let b = 0; b < c; b++) {
2228
- let x;
2229
- for (u.fillStyle = t, u.fillRect(0, b * a, 55, (1 + b) * a), u.fill(), x = 0; x <= d; x++) {
2230
- u.textAlign = l, u.textBaseline = "middle";
2231
- const g = ae(x, d, this.frequencyMin, this.frequencyMax, this.scale), m = re(g), y = oe(g), w = 16;
2232
- let v = (1 + b) * a - x / d * a;
2233
- v = Math.min(Math.max(v, b * a + 10), (1 + b) * a - 10), u.fillStyle = n, u.font = i + " " + s, u.fillText(y, w + 24, v), u.fillStyle = r, u.font = e + " " + s, u.fillText(m, w, v);
2226
+ const d = this.labelsEl.getContext("2d"), p = window.devicePixelRatio;
2227
+ if (this.labelsEl.height = this.height * c * p, this.labelsEl.width = 55 * p, d.scale(p, p), d) for (let g = 0; g < c; g++) {
2228
+ let y;
2229
+ for (d.fillStyle = t, d.fillRect(0, g * a, 55, (1 + g) * a), d.fill(), y = 0; y <= u; y++) {
2230
+ d.textAlign = l, d.textBaseline = "middle";
2231
+ const f = pe(y, u, this.frequencyMin, this.frequencyMax, this.scale), m = ue(f), w = de(f), W = 16;
2232
+ let v = (1 + g) * a - y / u * a;
2233
+ v = Math.min(Math.max(v, g * a + 10), (1 + g) * a - 10), d.fillStyle = n, d.font = i + " " + s, d.fillText(w, W + 24, v), d.fillStyle = o, d.font = e + " " + s, d.fillText(m, W, v);
2234
2234
  }
2235
2235
  }
2236
2236
  }
@@ -2239,64 +2239,64 @@ class R extends ce {
2239
2239
  }
2240
2240
  resampleChannel(t, e) {
2241
2241
  var i;
2242
- const s = t.length, r = ((i = t[0]) === null || i === void 0 ? void 0 : i.length) || 0;
2242
+ const s = t.length, o = ((i = t[0]) === null || i === void 0 ? void 0 : i.length) || 0;
2243
2243
  if (s === e || e === 0) return t;
2244
2244
  const n = s / e, l = new Array(e);
2245
2245
  if (n >= 1) for (let h = 0; h < e; h++) {
2246
- const c = Math.floor(h * n), a = Math.min(Math.ceil((h + 1) * n), s), d = a - c, u = new Uint8Array(r);
2247
- if (d === 1) u.set(t[c]);
2248
- else for (let p = 0; p < r; p++) {
2249
- let b = 0;
2250
- for (let x = c; x < a; x++) b += t[x][p];
2251
- u[p] = Math.round(b / d);
2246
+ const c = Math.floor(h * n), a = Math.min(Math.ceil((h + 1) * n), s), u = a - c, d = new Uint8Array(o);
2247
+ if (u === 1) d.set(t[c]);
2248
+ else for (let p = 0; p < o; p++) {
2249
+ let g = 0;
2250
+ for (let y = c; y < a; y++) g += t[y][p];
2251
+ d[p] = Math.round(g / u);
2252
2252
  }
2253
- l[h] = u;
2253
+ l[h] = d;
2254
2254
  }
2255
2255
  else for (let h = 0; h < e; h++) {
2256
- const c = h * n, a = Math.floor(c), d = Math.min(a + 1, s - 1), u = c - a, p = new Uint8Array(r);
2257
- if (u === 0 || a === d) p.set(t[a]);
2256
+ const c = h * n, a = Math.floor(c), u = Math.min(a + 1, s - 1), d = c - a, p = new Uint8Array(o);
2257
+ if (d === 0 || a === u) p.set(t[a]);
2258
2258
  else {
2259
- const b = t[a], x = t[d], g = 1 - u;
2260
- for (let m = 0; m < r; m++) p[m] = Math.round(b[m] * g + x[m] * u);
2259
+ const g = t[a], y = t[u], f = 1 - d;
2260
+ for (let m = 0; m < o; m++) p[m] = Math.round(g[m] * f + y[m] * d);
2261
2261
  }
2262
2262
  l[h] = p;
2263
2263
  }
2264
2264
  return l;
2265
2265
  }
2266
2266
  fillImageDataQuality(t, e, i, s) {
2267
- const r = this.colorMap;
2267
+ const o = this.colorMap;
2268
2268
  for (let n = 0; n < i; n++) {
2269
2269
  const l = e[n];
2270
2270
  for (let h = 0; h < s; h++) {
2271
- const c = r[l[h]], a = 4 * ((s - h - 1) * i + n);
2271
+ const c = o[l[h]], a = 4 * ((s - h - 1) * i + n);
2272
2272
  t[a] = 255 * c[0], t[a + 1] = 255 * c[1], t[a + 2] = 255 * c[2], t[a + 3] = 255 * c[3];
2273
2273
  }
2274
2274
  }
2275
2275
  }
2276
2276
  }
2277
- R.MAX_CANVAS_WIDTH = 3e4, R.MAX_NODES = 10;
2278
- const Ae = ({
2279
- waveSurfer: o,
2277
+ I.MAX_CANVAS_WIDTH = 3e4, I.MAX_NODES = 10;
2278
+ const Je = ({
2279
+ waveSurfer: r,
2280
2280
  spectrogramOptions: t = {}
2281
2281
  }) => {
2282
2282
  const { pluginInstance: e, createPlugin: i } = z(
2283
- R,
2283
+ I,
2284
2284
  t
2285
2285
  );
2286
- return D(() => {
2287
- o.value && i(o.value);
2286
+ return R(() => {
2287
+ r.value && i(r.value);
2288
2288
  }), {
2289
2289
  spectrogramPlugin: e
2290
2290
  };
2291
- }, Fe = ({
2292
- containerRef: o,
2291
+ }, ti = ({
2292
+ containerRef: r,
2293
2293
  options: t,
2294
2294
  spectrogramOptions: e = {}
2295
2295
  }) => G(
2296
- R,
2297
- { containerRef: o, options: t, pluginOptions: e }
2296
+ I,
2297
+ { containerRef: r, options: t, pluginOptions: e }
2298
2298
  );
2299
- let ge = class {
2299
+ let Me = class {
2300
2300
  constructor() {
2301
2301
  this.listeners = {};
2302
2302
  }
@@ -2322,7 +2322,7 @@ let ge = class {
2322
2322
  emit(t, ...e) {
2323
2323
  this.listeners[t] && this.listeners[t].forEach((i) => i(...e));
2324
2324
  }
2325
- }, be = class extends ge {
2325
+ }, Ce = class extends Me {
2326
2326
  constructor(t) {
2327
2327
  super(), this.subscriptions = [], this.isDestroyed = !1, this.options = t;
2328
2328
  }
@@ -2335,24 +2335,24 @@ let ge = class {
2335
2335
  this.emit("destroy"), this.subscriptions.forEach((t) => t()), this.subscriptions = [], this.isDestroyed = !0, this.wavesurfer = void 0;
2336
2336
  }
2337
2337
  };
2338
- function Tt(o, t) {
2339
- const e = t.xmlns ? document.createElementNS(t.xmlns, o) : document.createElement(o);
2340
- for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [r, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(Tt(r, n));
2338
+ function Dt(r, t) {
2339
+ const e = t.xmlns ? document.createElementNS(t.xmlns, r) : document.createElement(r);
2340
+ for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [o, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(Dt(o, n));
2341
2341
  else i === "style" ? Object.assign(e.style, s) : i === "textContent" ? e.textContent = s : e.setAttribute(i, s.toString());
2342
2342
  return e;
2343
2343
  }
2344
- function et(o, t, e) {
2345
- const i = Tt(o, t || {});
2344
+ function st(r, t, e) {
2345
+ const i = Dt(r, t || {});
2346
2346
  return e?.appendChild(i), i;
2347
2347
  }
2348
- const ye = { lineWidth: 1, labelSize: 11, labelPreferLeft: !1, formatTimeCallback: (o) => `${Math.floor(o / 60)}:${`0${Math.floor(o) % 60}`.slice(-2)}` };
2349
- let Dt = class Rt extends be {
2348
+ const Se = { lineWidth: 1, labelSize: 11, labelPreferLeft: !1, formatTimeCallback: (r) => `${Math.floor(r / 60)}:${`0${Math.floor(r) % 60}`.slice(-2)}` };
2349
+ let It = class Zt extends Ce {
2350
2350
  constructor(t) {
2351
2351
  super(t || {}), this.lastPointerMove = null, this.unsubscribe = () => {
2352
2352
  }, this.onPointerMove = (e) => {
2353
2353
  if (!this.wavesurfer) return;
2354
2354
  this.lastPointerMove = e;
2355
- const i = this.wavesurfer.getWrapper().getBoundingClientRect(), { width: s } = i, r = e.clientX - i.left, n = Math.min(1, Math.max(0, r / s)), l = Math.min(s - this.options.lineWidth - 1, r);
2355
+ const i = this.wavesurfer.getWrapper().getBoundingClientRect(), { width: s } = i, o = e.clientX - i.left, n = Math.min(1, Math.max(0, o / s)), l = Math.min(s - this.options.lineWidth - 1, o);
2356
2356
  this.wrapper.style.transform = `translateX(${l}px)`, this.wrapper.style.opacity = "1";
2357
2357
  const h = this.wavesurfer.getDuration() || 0;
2358
2358
  this.label.textContent = this.options.formatTimeCallback(h * n);
@@ -2360,10 +2360,10 @@ let Dt = class Rt extends be {
2360
2360
  this.label.style.transform = a ? `translateX(-${c + this.options.lineWidth}px)` : "", this.emit("hover", n);
2361
2361
  }, this.onPointerLeave = () => {
2362
2362
  this.wrapper.style.opacity = "0", this.lastPointerMove = null;
2363
- }, this.options = Object.assign({}, ye, t), this.wrapper = et("div", { part: "hover" }), this.label = et("span", { part: "hover-label" }, this.wrapper);
2363
+ }, this.options = Object.assign({}, Se, t), this.wrapper = st("div", { part: "hover" }), this.label = st("span", { part: "hover-label" }, this.wrapper);
2364
2364
  }
2365
2365
  static create(t) {
2366
- return new Rt(t);
2366
+ return new Zt(t);
2367
2367
  }
2368
2368
  addUnits(t) {
2369
2369
  return `${t}${typeof t == "number" ? "px" : ""}`;
@@ -2378,36 +2378,36 @@ let Dt = class Rt extends be {
2378
2378
  this.lastPointerMove && this.onPointerMove(this.lastPointerMove);
2379
2379
  };
2380
2380
  this.wavesurfer.on("zoom", s), this.wavesurfer.on("scroll", s), this.unsubscribe = () => {
2381
- var r, n;
2382
- i.removeEventListener("pointermove", this.onPointerMove), i.removeEventListener("pointerleave", this.onPointerLeave), (r = this.wavesurfer) === null || r === void 0 || r.un("zoom", s), (n = this.wavesurfer) === null || n === void 0 || n.un("scroll", s);
2381
+ var o, n;
2382
+ i.removeEventListener("pointermove", this.onPointerMove), i.removeEventListener("pointerleave", this.onPointerLeave), (o = this.wavesurfer) === null || o === void 0 || o.un("zoom", s), (n = this.wavesurfer) === null || n === void 0 || n.un("scroll", s);
2383
2383
  };
2384
2384
  }
2385
2385
  destroy() {
2386
2386
  super.destroy(), this.unsubscribe(), this.wrapper.remove();
2387
2387
  }
2388
2388
  };
2389
- const He = ({
2390
- waveSurfer: o,
2389
+ const si = ({
2390
+ waveSurfer: r,
2391
2391
  hoverOptions: t = {}
2392
2392
  }) => {
2393
2393
  const { pluginInstance: e, createPlugin: i } = z(
2394
- Dt,
2394
+ It,
2395
2395
  t
2396
2396
  );
2397
- return D(() => {
2398
- o.value && i(o.value);
2397
+ return R(() => {
2398
+ r.value && i(r.value);
2399
2399
  }), {
2400
2400
  hoverPlugin: e
2401
2401
  };
2402
- }, $e = ({
2403
- containerRef: o,
2402
+ }, ni = ({
2403
+ containerRef: r,
2404
2404
  options: t,
2405
2405
  hoverOptions: e = {}
2406
2406
  }) => G(
2407
- Dt,
2408
- { containerRef: o, options: t, pluginOptions: e }
2407
+ It,
2408
+ { containerRef: r, options: t, pluginOptions: e }
2409
2409
  );
2410
- class Zt {
2410
+ let zt = class {
2411
2411
  constructor() {
2412
2412
  this.listeners = {};
2413
2413
  }
@@ -2433,8 +2433,7 @@ class Zt {
2433
2433
  emit(t, ...e) {
2434
2434
  this.listeners[t] && this.listeners[t].forEach((i) => i(...e));
2435
2435
  }
2436
- }
2437
- class we extends Zt {
2436
+ }, Pe = class extends zt {
2438
2437
  constructor(t) {
2439
2438
  super(), this.subscriptions = [], this.isDestroyed = !1, this.options = t;
2440
2439
  }
@@ -2446,61 +2445,61 @@ class we extends Zt {
2446
2445
  destroy() {
2447
2446
  this.emit("destroy"), this.subscriptions.forEach((t) => t()), this.subscriptions = [], this.isDestroyed = !0, this.wavesurfer = void 0;
2448
2447
  }
2449
- }
2450
- function F(o, t, e, i, s = 3, r = 0, n = 100) {
2451
- if (!o) return () => {
2448
+ };
2449
+ function F(r, t, e, i, s = 3, o = 0, n = 100) {
2450
+ if (!r) return () => {
2452
2451
  };
2453
2452
  const l = matchMedia("(pointer: coarse)").matches;
2454
2453
  let h = () => {
2455
2454
  };
2456
2455
  const c = (a) => {
2457
- if (a.button !== r) return;
2456
+ if (a.button !== o) return;
2458
2457
  a.preventDefault(), a.stopPropagation();
2459
- let d = a.clientX, u = a.clientY, p = !1;
2460
- const b = Date.now(), x = (v) => {
2461
- if (v.preventDefault(), v.stopPropagation(), l && Date.now() - b < n) return;
2462
- const f = v.clientX, C = v.clientY, W = f - d, S = C - u;
2463
- if (p || Math.abs(W) > s || Math.abs(S) > s) {
2464
- const M = o.getBoundingClientRect(), { left: E, top: L } = M;
2465
- p || (e?.(d - E, u - L), p = !0), t(W, S, f - E, C - L), d = f, u = C;
2458
+ let u = a.clientX, d = a.clientY, p = !1;
2459
+ const g = Date.now(), y = (v) => {
2460
+ if (v.preventDefault(), v.stopPropagation(), l && Date.now() - g < n) return;
2461
+ const b = v.clientX, x = v.clientY, C = b - u, M = x - d;
2462
+ if (p || Math.abs(C) > s || Math.abs(M) > s) {
2463
+ const S = r.getBoundingClientRect(), { left: P, top: T } = S;
2464
+ p || (e?.(u - P, d - T), p = !0), t(C, M, b - P, x - T), u = b, d = x;
2466
2465
  }
2467
- }, g = (v) => {
2466
+ }, f = (v) => {
2468
2467
  if (p) {
2469
- const f = v.clientX, C = v.clientY, W = o.getBoundingClientRect(), { left: S, top: M } = W;
2470
- i?.(f - S, C - M);
2468
+ const b = v.clientX, x = v.clientY, C = r.getBoundingClientRect(), { left: M, top: S } = C;
2469
+ i?.(b - M, x - S);
2471
2470
  }
2472
2471
  h();
2473
2472
  }, m = (v) => {
2474
- v.relatedTarget && v.relatedTarget !== document.documentElement || g(v);
2475
- }, y = (v) => {
2476
- p && (v.stopPropagation(), v.preventDefault());
2473
+ v.relatedTarget && v.relatedTarget !== document.documentElement || f(v);
2477
2474
  }, w = (v) => {
2475
+ p && (v.stopPropagation(), v.preventDefault());
2476
+ }, W = (v) => {
2478
2477
  p && v.preventDefault();
2479
2478
  };
2480
- document.addEventListener("pointermove", x), document.addEventListener("pointerup", g), document.addEventListener("pointerout", m), document.addEventListener("pointercancel", m), document.addEventListener("touchmove", w, { passive: !1 }), document.addEventListener("click", y, { capture: !0 }), h = () => {
2481
- document.removeEventListener("pointermove", x), document.removeEventListener("pointerup", g), document.removeEventListener("pointerout", m), document.removeEventListener("pointercancel", m), document.removeEventListener("touchmove", w), setTimeout(() => {
2482
- document.removeEventListener("click", y, { capture: !0 });
2479
+ document.addEventListener("pointermove", y), document.addEventListener("pointerup", f), document.addEventListener("pointerout", m), document.addEventListener("pointercancel", m), document.addEventListener("touchmove", W, { passive: !1 }), document.addEventListener("click", w, { capture: !0 }), h = () => {
2480
+ document.removeEventListener("pointermove", y), document.removeEventListener("pointerup", f), document.removeEventListener("pointerout", m), document.removeEventListener("pointercancel", m), document.removeEventListener("touchmove", W), setTimeout(() => {
2481
+ document.removeEventListener("click", w, { capture: !0 });
2483
2482
  }, 10);
2484
2483
  };
2485
2484
  };
2486
- return o.addEventListener("pointerdown", c), () => {
2487
- h(), o.removeEventListener("pointerdown", c);
2485
+ return r.addEventListener("pointerdown", c), () => {
2486
+ h(), r.removeEventListener("pointerdown", c);
2488
2487
  };
2489
2488
  }
2490
- function It(o, t) {
2491
- const e = t.xmlns ? document.createElementNS(t.xmlns, o) : document.createElement(o);
2492
- for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [r, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(It(r, n));
2489
+ function Gt(r, t) {
2490
+ const e = t.xmlns ? document.createElementNS(t.xmlns, r) : document.createElement(r);
2491
+ for (const [i, s] of Object.entries(t)) if (i === "children" && s) for (const [o, n] of Object.entries(s)) n instanceof Node ? e.appendChild(n) : typeof n == "string" ? e.appendChild(document.createTextNode(n)) : e.appendChild(Gt(o, n));
2493
2492
  else i === "style" ? Object.assign(e.style, s) : i === "textContent" ? e.textContent = s : e.setAttribute(i, s.toString());
2494
2493
  return e;
2495
2494
  }
2496
- function Y(o, t, e) {
2497
- const i = It(o, t || {});
2495
+ function A(r, t, e) {
2496
+ const i = Gt(r, t || {});
2498
2497
  return e?.appendChild(i), i;
2499
2498
  }
2500
- class it extends Zt {
2499
+ let nt = class extends zt {
2501
2500
  constructor(t, e, i = 0) {
2502
- var s, r, n, l, h, c, a, d, u, p;
2503
- super(), this.totalDuration = e, this.numberOfChannels = i, this.element = null, this.minLength = 0, this.maxLength = 1 / 0, this.contentEditable = !1, this.subscriptions = [], this.isRemoved = !1, this.subscriptions = [], this.id = t.id || `region-${Math.random().toString(32).slice(2)}`, this.start = this.clampPosition(t.start), this.end = this.clampPosition((s = t.end) !== null && s !== void 0 ? s : t.start), this.drag = (r = t.drag) === null || r === void 0 || r, this.resize = (n = t.resize) === null || n === void 0 || n, this.resizeStart = (l = t.resizeStart) === null || l === void 0 || l, this.resizeEnd = (h = t.resizeEnd) === null || h === void 0 || h, this.color = (c = t.color) !== null && c !== void 0 ? c : "rgba(0, 0, 0, 0.1)", this.minLength = (a = t.minLength) !== null && a !== void 0 ? a : this.minLength, this.maxLength = (d = t.maxLength) !== null && d !== void 0 ? d : this.maxLength, this.channelIdx = (u = t.channelIdx) !== null && u !== void 0 ? u : -1, this.contentEditable = (p = t.contentEditable) !== null && p !== void 0 ? p : this.contentEditable, this.element = this.initElement(), this.setContent(t.content), this.setPart(), this.renderPosition(), this.initMouseEvents();
2501
+ var s, o, n, l, h, c, a, u, d, p;
2502
+ super(), this.totalDuration = e, this.numberOfChannels = i, this.element = null, this.minLength = 0, this.maxLength = 1 / 0, this.contentEditable = !1, this.subscriptions = [], this.isRemoved = !1, this.subscriptions = [], this.id = t.id || `region-${Math.random().toString(32).slice(2)}`, this.start = this.clampPosition(t.start), this.end = this.clampPosition((s = t.end) !== null && s !== void 0 ? s : t.start), this.drag = (o = t.drag) === null || o === void 0 || o, this.resize = (n = t.resize) === null || n === void 0 || n, this.resizeStart = (l = t.resizeStart) === null || l === void 0 || l, this.resizeEnd = (h = t.resizeEnd) === null || h === void 0 || h, this.color = (c = t.color) !== null && c !== void 0 ? c : "rgba(0, 0, 0, 0.1)", this.minLength = (a = t.minLength) !== null && a !== void 0 ? a : this.minLength, this.maxLength = (u = t.maxLength) !== null && u !== void 0 ? u : this.maxLength, this.channelIdx = (d = t.channelIdx) !== null && d !== void 0 ? d : -1, this.contentEditable = (p = t.contentEditable) !== null && p !== void 0 ? p : this.contentEditable, this.element = this.initElement(), this.setContent(t.content), this.setPart(), this.renderPosition(), this.initMouseEvents();
2504
2503
  }
2505
2504
  clampPosition(t) {
2506
2505
  return Math.max(0, Math.min(this.totalDuration, t));
@@ -2511,8 +2510,8 @@ class it extends Zt {
2511
2510
  (t = this.element) === null || t === void 0 || t.setAttribute("part", `${e ? "marker" : "region"} ${this.id}`);
2512
2511
  }
2513
2512
  addResizeHandles(t) {
2514
- const e = { position: "absolute", zIndex: "2", width: "6px", height: "100%", top: "0", cursor: "ew-resize", wordBreak: "keep-all" }, i = Y("div", { part: "region-handle region-handle-left", style: Object.assign(Object.assign({}, e), { left: "0", borderLeft: "2px solid rgba(0, 0, 0, 0.5)", borderRadius: "2px 0 0 2px" }) }, t), s = Y("div", { part: "region-handle region-handle-right", style: Object.assign(Object.assign({}, e), { right: "0", borderRight: "2px solid rgba(0, 0, 0, 0.5)", borderRadius: "0 2px 2px 0" }) }, t);
2515
- this.subscriptions.push(F(i, (r) => this.onResize(r, "start"), () => null, () => this.onEndResizing(), 1), F(s, (r) => this.onResize(r, "end"), () => null, () => this.onEndResizing(), 1));
2513
+ const e = { position: "absolute", zIndex: "2", width: "6px", height: "100%", top: "0", cursor: "ew-resize", wordBreak: "keep-all" }, i = A("div", { part: "region-handle region-handle-left", style: Object.assign(Object.assign({}, e), { left: "0", borderLeft: "2px solid rgba(0, 0, 0, 0.5)", borderRadius: "2px 0 0 2px" }) }, t), s = A("div", { part: "region-handle region-handle-right", style: Object.assign(Object.assign({}, e), { right: "0", borderRight: "2px solid rgba(0, 0, 0, 0.5)", borderRadius: "0 2px 2px 0" }) }, t);
2514
+ this.subscriptions.push(F(i, (o) => this.onResize(o, "start"), () => null, () => this.onEndResizing(), 1), F(s, (o) => this.onResize(o, "end"), () => null, () => this.onEndResizing(), 1));
2516
2515
  }
2517
2516
  removeResizeHandles(t) {
2518
2517
  const e = t.querySelector('[part*="region-handle-left"]'), i = t.querySelector('[part*="region-handle-right"]');
@@ -2523,7 +2522,7 @@ class it extends Zt {
2523
2522
  const t = this.start === this.end;
2524
2523
  let e = 0, i = 100;
2525
2524
  this.channelIdx >= 0 && this.channelIdx < this.numberOfChannels && (i = 100 / this.numberOfChannels, e = i * this.channelIdx);
2526
- const s = Y("div", { style: { position: "absolute", top: `${e}%`, height: `${i}%`, backgroundColor: t ? "none" : this.color, borderLeft: t ? "2px solid " + this.color : "none", borderRadius: "2px", boxSizing: "border-box", transition: "background-color 0.2s ease", cursor: this.drag ? "grab" : "default", pointerEvents: "all" } });
2525
+ const s = A("div", { style: { position: "absolute", top: `${e}%`, height: `${i}%`, backgroundColor: t ? "none" : this.color, borderLeft: t ? "2px solid " + this.color : "none", borderRadius: "2px", boxSizing: "border-box", transition: "background-color 0.2s ease", cursor: this.drag ? "grab" : "default", pointerEvents: "all" } });
2527
2526
  return !t && this.resize && this.addResizeHandles(s), s;
2528
2527
  }
2529
2528
  renderPosition() {
@@ -2544,7 +2543,7 @@ class it extends Zt {
2544
2543
  _onUpdate(t, e) {
2545
2544
  var i;
2546
2545
  if (!(!((i = this.element) === null || i === void 0) && i.parentElement)) return;
2547
- const { width: s } = this.element.parentElement.getBoundingClientRect(), r = t / s * this.totalDuration, n = e && e !== "start" ? this.start : this.start + r, l = e && e !== "end" ? this.end : this.end + r, h = l - n;
2546
+ const { width: s } = this.element.parentElement.getBoundingClientRect(), o = t / s * this.totalDuration, n = e && e !== "start" ? this.start : this.start + o, l = e && e !== "end" ? this.end : this.end + o, h = l - n;
2548
2547
  n >= 0 && l <= this.totalDuration && n <= l && h >= this.minLength && h <= this.maxLength && (this.start = n, this.end = l, this.renderPosition(), this.emit("update", e));
2549
2548
  }
2550
2549
  onMove(t) {
@@ -2577,7 +2576,7 @@ class it extends Zt {
2577
2576
  if (this.element) if ((e = this.content) === null || e === void 0 || e.remove(), t) {
2578
2577
  if (typeof t == "string") {
2579
2578
  const i = this.start === this.end;
2580
- this.content = Y("div", { style: { padding: `0.2em ${i ? 0.2 : 0.4}em`, display: "inline-block" }, textContent: t });
2579
+ this.content = A("div", { style: { padding: `0.2em ${i ? 0.2 : 0.4}em`, display: "inline-block" }, textContent: t });
2581
2580
  } else this.content = t;
2582
2581
  this.contentEditable && (this.content.contentEditable = "true"), this.content.setAttribute("part", "region-content"), this.element.appendChild(this.content), this.emit("content-changed");
2583
2582
  } else this.content = void 0;
@@ -2599,13 +2598,12 @@ class it extends Zt {
2599
2598
  remove() {
2600
2599
  this.isRemoved = !0, this.emit("remove"), this.subscriptions.forEach((t) => t()), this.element && (this.element.remove(), this.element = null);
2601
2600
  }
2602
- }
2603
- class B extends we {
2601
+ }, Ot = class Nt extends Pe {
2604
2602
  constructor(t) {
2605
2603
  super(t), this.regions = [], this.regionsContainer = this.initRegionsContainer();
2606
2604
  }
2607
2605
  static create(t) {
2608
- return new B(t);
2606
+ return new Nt(t);
2609
2607
  }
2610
2608
  onInit() {
2611
2609
  if (!this.wavesurfer) throw Error("WaveSurfer is not initialized");
@@ -2621,18 +2619,18 @@ class B extends we {
2621
2619
  }));
2622
2620
  }
2623
2621
  initRegionsContainer() {
2624
- return Y("div", { style: { position: "absolute", top: "0", left: "0", width: "100%", height: "100%", zIndex: "5", pointerEvents: "none" } });
2622
+ return A("div", { style: { position: "absolute", top: "0", left: "0", width: "100%", height: "100%", zIndex: "5", pointerEvents: "none" } });
2625
2623
  }
2626
2624
  getRegions() {
2627
2625
  return this.regions;
2628
2626
  }
2629
2627
  avoidOverlapping(t) {
2630
2628
  t.content && setTimeout(() => {
2631
- const e = t.content, i = e.getBoundingClientRect(), s = this.regions.map((r) => {
2632
- if (r === t || !r.content) return 0;
2633
- const n = r.content.getBoundingClientRect();
2629
+ const e = t.content, i = e.getBoundingClientRect(), s = this.regions.map((o) => {
2630
+ if (o === t || !o.content) return 0;
2631
+ const n = o.content.getBoundingClientRect();
2634
2632
  return i.left < n.left + n.width && n.left < i.left + i.width ? n.height : 0;
2635
- }).reduce((r, n) => r + n, 0);
2633
+ }).reduce((o, n) => o + n, 0);
2636
2634
  e.style.marginTop = `${s}px`;
2637
2635
  }, 10);
2638
2636
  }
@@ -2641,22 +2639,22 @@ class B extends we {
2641
2639
  if (!t.element) return;
2642
2640
  const s = (i = (e = this.wavesurfer) === null || e === void 0 ? void 0 : e.getWrapper()) === null || i === void 0 ? void 0 : i.parentElement;
2643
2641
  if (!s) return;
2644
- const { clientWidth: r, scrollWidth: n } = s;
2645
- if (n <= r) return;
2642
+ const { clientWidth: o, scrollWidth: n } = s;
2643
+ if (n <= o) return;
2646
2644
  const l = s.getBoundingClientRect(), h = t.element.getBoundingClientRect(), c = h.left - l.left, a = h.right - l.left;
2647
- c < 0 ? s.scrollLeft += c : a > r && (s.scrollLeft += a - r);
2645
+ c < 0 ? s.scrollLeft += c : a > o && (s.scrollLeft += a - o);
2648
2646
  }
2649
2647
  virtualAppend(t, e, i) {
2650
2648
  const s = () => {
2651
2649
  if (!this.wavesurfer) return;
2652
- const r = this.wavesurfer.getWidth(), n = this.wavesurfer.getScroll(), l = e.clientWidth, h = this.wavesurfer.getDuration(), c = Math.round(t.start / h * l), a = c + (Math.round((t.end - t.start) / h * l) || 1) > n && c < n + r;
2650
+ const o = this.wavesurfer.getWidth(), n = this.wavesurfer.getScroll(), l = e.clientWidth, h = this.wavesurfer.getDuration(), c = Math.round(t.start / h * l), a = c + (Math.round((t.end - t.start) / h * l) || 1) > n && c < n + o;
2653
2651
  a && !i.parentElement ? e.appendChild(i) : !a && i.parentElement && i.remove();
2654
2652
  };
2655
2653
  setTimeout(() => {
2656
2654
  if (!this.wavesurfer || !t.element) return;
2657
2655
  s();
2658
- const r = this.wavesurfer.on("scroll", s), n = this.wavesurfer.on("zoom", s);
2659
- this.subscriptions.push(t.once("remove", r), r), this.subscriptions.push(t.once("remove", n), n);
2656
+ const o = this.wavesurfer.on("scroll", s), n = this.wavesurfer.on("zoom", s);
2657
+ this.subscriptions.push(t.once("remove", o), o), this.subscriptions.push(t.once("remove", n), n);
2660
2658
  }, 0);
2661
2659
  }
2662
2660
  saveRegion(t) {
@@ -2683,7 +2681,7 @@ class B extends we {
2683
2681
  addRegion(t) {
2684
2682
  var e, i;
2685
2683
  if (!this.wavesurfer) throw Error("WaveSurfer is not initialized");
2686
- const s = this.wavesurfer.getDuration(), r = (i = (e = this.wavesurfer) === null || e === void 0 ? void 0 : e.getDecodedData()) === null || i === void 0 ? void 0 : i.numberOfChannels, n = new it(t, s, r);
2684
+ const s = this.wavesurfer.getDuration(), o = (i = (e = this.wavesurfer) === null || e === void 0 ? void 0 : e.getDecodedData()) === null || i === void 0 ? void 0 : i.numberOfChannels, n = new nt(t, s, o);
2687
2685
  return this.emit("region-initialized", n), s ? this.saveRegion(n) : this.subscriptions.push(this.wavesurfer.once("ready", (l) => {
2688
2686
  n._setTotalDuration(l), this.saveRegion(n);
2689
2687
  })), n;
@@ -2693,16 +2691,16 @@ class B extends we {
2693
2691
  const s = (i = this.wavesurfer) === null || i === void 0 ? void 0 : i.getWrapper();
2694
2692
  if (!(s && s instanceof HTMLElement)) return () => {
2695
2693
  };
2696
- let r = null, n = 0;
2694
+ let o = null, n = 0;
2697
2695
  return F(s, (l, h, c) => {
2698
- r && r._onUpdate(l, c > n ? "end" : "start");
2696
+ o && o._onUpdate(l, c > n ? "end" : "start");
2699
2697
  }, (l) => {
2700
2698
  var h, c;
2701
2699
  if (n = l, !this.wavesurfer) return;
2702
- const a = this.wavesurfer.getDuration(), d = (c = (h = this.wavesurfer) === null || h === void 0 ? void 0 : h.getDecodedData()) === null || c === void 0 ? void 0 : c.numberOfChannels, { width: u } = this.wavesurfer.getWrapper().getBoundingClientRect(), p = l / u * a, b = (l + 5) / u * a;
2703
- r = new it(Object.assign(Object.assign({}, t), { start: p, end: b }), a, d), this.emit("region-initialized", r), r.element && this.regionsContainer.appendChild(r.element);
2700
+ const a = this.wavesurfer.getDuration(), u = (c = (h = this.wavesurfer) === null || h === void 0 ? void 0 : h.getDecodedData()) === null || c === void 0 ? void 0 : c.numberOfChannels, { width: d } = this.wavesurfer.getWrapper().getBoundingClientRect(), p = l / d * a, g = (l + 5) / d * a;
2701
+ o = new nt(Object.assign(Object.assign({}, t), { start: p, end: g }), a, u), this.emit("region-initialized", o), o.element && this.regionsContainer.appendChild(o.element);
2704
2702
  }, () => {
2705
- r && (this.saveRegion(r), r = null);
2703
+ o && (this.saveRegion(o), o = null);
2706
2704
  }, e);
2707
2705
  }
2708
2706
  clearRegions() {
@@ -2711,46 +2709,341 @@ class B extends we {
2711
2709
  destroy() {
2712
2710
  this.clearRegions(), super.destroy(), this.regionsContainer.remove();
2713
2711
  }
2714
- }
2715
- const qe = ({
2716
- waveSurfer: o,
2712
+ };
2713
+ const li = ({
2714
+ waveSurfer: r,
2717
2715
  regionsOptions: t = {}
2718
2716
  }) => {
2719
2717
  const { pluginInstance: e, createPlugin: i } = z(
2720
- B,
2718
+ Ot,
2721
2719
  t
2722
2720
  );
2723
- return D(() => {
2724
- o.value && i(o.value);
2721
+ return R(() => {
2722
+ r.value && i(r.value);
2725
2723
  }), {
2726
2724
  regionsPlugin: e
2727
2725
  };
2728
- }, Qe = ({
2729
- containerRef: o,
2726
+ }, hi = ({
2727
+ containerRef: r,
2730
2728
  options: t,
2731
2729
  regionsOptions: e = {}
2732
2730
  }) => G(
2733
- B,
2734
- { containerRef: o, options: t, pluginOptions: e }
2731
+ Ot,
2732
+ { containerRef: r, options: t, pluginOptions: e }
2735
2733
  );
2734
+ function Q(r, t, e, i) {
2735
+ return new (e || (e = Promise))(function(s, o) {
2736
+ function n(c) {
2737
+ try {
2738
+ h(i.next(c));
2739
+ } catch (a) {
2740
+ o(a);
2741
+ }
2742
+ }
2743
+ function l(c) {
2744
+ try {
2745
+ h(i.throw(c));
2746
+ } catch (a) {
2747
+ o(a);
2748
+ }
2749
+ }
2750
+ function h(c) {
2751
+ var a;
2752
+ c.done ? s(c.value) : (a = c.value, a instanceof e ? a : new e(function(u) {
2753
+ u(a);
2754
+ })).then(n, l);
2755
+ }
2756
+ h((i = i.apply(r, [])).next());
2757
+ });
2758
+ }
2759
+ class Xt {
2760
+ constructor() {
2761
+ this.listeners = {};
2762
+ }
2763
+ on(t, e, i) {
2764
+ if (this.listeners[t] || (this.listeners[t] = /* @__PURE__ */ new Set()), this.listeners[t].add(e), i?.once) {
2765
+ const s = () => {
2766
+ this.un(t, s), this.un(t, e);
2767
+ };
2768
+ return this.on(t, s), s;
2769
+ }
2770
+ return () => this.un(t, e);
2771
+ }
2772
+ un(t, e) {
2773
+ var i;
2774
+ (i = this.listeners[t]) === null || i === void 0 || i.delete(e);
2775
+ }
2776
+ once(t, e) {
2777
+ return this.on(t, e, { once: !0 });
2778
+ }
2779
+ unAll() {
2780
+ this.listeners = {};
2781
+ }
2782
+ emit(t, ...e) {
2783
+ this.listeners[t] && this.listeners[t].forEach((i) => i(...e));
2784
+ }
2785
+ }
2786
+ class Ee extends Xt {
2787
+ constructor(t) {
2788
+ super(), this.subscriptions = [], this.isDestroyed = !1, this.options = t;
2789
+ }
2790
+ onInit() {
2791
+ }
2792
+ _init(t) {
2793
+ this.isDestroyed && (this.subscriptions = [], this.isDestroyed = !1), this.wavesurfer = t, this.onInit();
2794
+ }
2795
+ destroy() {
2796
+ this.emit("destroy"), this.subscriptions.forEach((t) => t()), this.subscriptions = [], this.isDestroyed = !0, this.wavesurfer = void 0;
2797
+ }
2798
+ }
2799
+ class ke extends Xt {
2800
+ constructor() {
2801
+ super(...arguments), this.unsubscribe = () => {
2802
+ };
2803
+ }
2804
+ start() {
2805
+ this.unsubscribe = this.on("tick", () => {
2806
+ requestAnimationFrame(() => {
2807
+ this.emit("tick");
2808
+ });
2809
+ }), this.emit("tick");
2810
+ }
2811
+ stop() {
2812
+ this.unsubscribe();
2813
+ }
2814
+ destroy() {
2815
+ this.unsubscribe();
2816
+ }
2817
+ }
2818
+ const Te = ["audio/webm", "audio/wav", "audio/mpeg", "audio/mp4", "audio/mp3"];
2819
+ class U extends Ee {
2820
+ constructor(t) {
2821
+ var e, i, s, o, n, l;
2822
+ super(Object.assign(Object.assign({}, t), { audioBitsPerSecond: (e = t.audioBitsPerSecond) !== null && e !== void 0 ? e : 128e3, scrollingWaveform: (i = t.scrollingWaveform) !== null && i !== void 0 && i, scrollingWaveformWindow: (s = t.scrollingWaveformWindow) !== null && s !== void 0 ? s : 5, continuousWaveform: (o = t.continuousWaveform) !== null && o !== void 0 && o, renderRecordedAudio: (n = t.renderRecordedAudio) === null || n === void 0 || n, mediaRecorderTimeslice: (l = t.mediaRecorderTimeslice) !== null && l !== void 0 ? l : void 0 })), this.stream = null, this.mediaRecorder = null, this.dataWindow = null, this.isWaveformPaused = !1, this.lastStartTime = 0, this.lastDuration = 0, this.duration = 0, this.timer = new ke(), this.subscriptions.push(this.timer.on("tick", () => {
2823
+ const h = performance.now() - this.lastStartTime;
2824
+ this.duration = this.isPaused() ? this.duration : this.lastDuration + h, this.emit("record-progress", this.duration);
2825
+ }));
2826
+ }
2827
+ static create(t) {
2828
+ return new U(t || {});
2829
+ }
2830
+ renderMicStream(t) {
2831
+ var e;
2832
+ const i = new AudioContext(), s = i.createMediaStreamSource(t), o = i.createAnalyser();
2833
+ s.connect(o), this.options.continuousWaveform && (o.fftSize = 32);
2834
+ const n = o.frequencyBinCount, l = new Float32Array(n);
2835
+ let h = 0;
2836
+ this.wavesurfer && ((e = this.originalOptions) !== null && e !== void 0 || (this.originalOptions = Object.assign({}, this.wavesurfer.options)), this.wavesurfer.options.interact = !1, this.options.scrollingWaveform && (this.wavesurfer.options.cursorWidth = 0));
2837
+ const c = setInterval(() => {
2838
+ var a, u, d, p;
2839
+ if (!this.isWaveformPaused) {
2840
+ if (o.getFloatTimeDomainData(l), this.options.scrollingWaveform) {
2841
+ const g = Math.floor((this.options.scrollingWaveformWindow || 0) * i.sampleRate), y = Math.min(g, this.dataWindow ? this.dataWindow.length + n : n), f = new Float32Array(g);
2842
+ if (this.dataWindow) {
2843
+ const m = Math.max(0, g - this.dataWindow.length);
2844
+ f.set(this.dataWindow.slice(-y + n), m);
2845
+ }
2846
+ f.set(l, g - n), this.dataWindow = f;
2847
+ } else if (this.options.continuousWaveform) {
2848
+ if (!this.dataWindow) {
2849
+ const y = this.options.continuousWaveformDuration ? Math.round(100 * this.options.continuousWaveformDuration) : ((u = (a = this.wavesurfer) === null || a === void 0 ? void 0 : a.getWidth()) !== null && u !== void 0 ? u : 0) * window.devicePixelRatio;
2850
+ this.dataWindow = new Float32Array(y);
2851
+ }
2852
+ let g = 0;
2853
+ for (let y = 0; y < n; y++) {
2854
+ const f = Math.abs(l[y]);
2855
+ f > g && (g = f);
2856
+ }
2857
+ if (h + 1 > this.dataWindow.length) {
2858
+ const y = new Float32Array(2 * this.dataWindow.length);
2859
+ y.set(this.dataWindow, 0), this.dataWindow = y;
2860
+ }
2861
+ this.dataWindow[h] = g, h++;
2862
+ } else this.dataWindow = l;
2863
+ if (this.wavesurfer) {
2864
+ const g = ((p = (d = this.dataWindow) === null || d === void 0 ? void 0 : d.length) !== null && p !== void 0 ? p : 0) / 100;
2865
+ this.wavesurfer.load("", [this.dataWindow], this.options.scrollingWaveform ? this.options.scrollingWaveformWindow : g).then(() => {
2866
+ this.wavesurfer && this.options.continuousWaveform && (this.wavesurfer.setTime(this.getDuration() / 1e3), this.wavesurfer.options.minPxPerSec || this.wavesurfer.setOptions({ minPxPerSec: this.wavesurfer.getWidth() / this.wavesurfer.getDuration() }));
2867
+ }).catch((y) => {
2868
+ console.error("Error rendering real-time recording data:", y);
2869
+ });
2870
+ }
2871
+ }
2872
+ }, 10);
2873
+ return { onDestroy: () => {
2874
+ clearInterval(c), s?.disconnect(), i?.close();
2875
+ }, onEnd: () => {
2876
+ this.isWaveformPaused = !0, clearInterval(c), this.stopMic();
2877
+ } };
2878
+ }
2879
+ startMic(t) {
2880
+ return Q(this, void 0, void 0, function* () {
2881
+ let e;
2882
+ try {
2883
+ e = yield navigator.mediaDevices.getUserMedia({ audio: t == null || t });
2884
+ } catch (o) {
2885
+ throw new Error("Error accessing the microphone: " + o.message);
2886
+ }
2887
+ const { onDestroy: i, onEnd: s } = this.renderMicStream(e);
2888
+ return this.subscriptions.push(this.once("destroy", i)), this.subscriptions.push(this.once("record-end", s)), this.stream = e, e;
2889
+ });
2890
+ }
2891
+ stopMic() {
2892
+ this.stream && (this.stream.getTracks().forEach((t) => t.stop()), this.stream = null, this.mediaRecorder = null);
2893
+ }
2894
+ startRecording(t) {
2895
+ return Q(this, void 0, void 0, function* () {
2896
+ const e = this.stream || (yield this.startMic(t));
2897
+ this.dataWindow = null;
2898
+ const i = this.mediaRecorder || new MediaRecorder(e, { mimeType: this.options.mimeType || Te.find((n) => MediaRecorder.isTypeSupported(n)), audioBitsPerSecond: this.options.audioBitsPerSecond });
2899
+ this.mediaRecorder = i, this.stopRecording();
2900
+ const s = [];
2901
+ i.ondataavailable = (n) => {
2902
+ n.data.size > 0 && s.push(n.data), this.emit("record-data-available", n.data);
2903
+ };
2904
+ const o = (n) => {
2905
+ var l;
2906
+ const h = new Blob(s, { type: i.mimeType });
2907
+ this.emit(n, h), this.options.renderRecordedAudio && (this.applyOriginalOptionsIfNeeded(), (l = this.wavesurfer) === null || l === void 0 || l.load(URL.createObjectURL(h)));
2908
+ };
2909
+ i.onpause = () => o("record-pause"), i.onstop = () => o("record-end"), i.start(this.options.mediaRecorderTimeslice), this.lastStartTime = performance.now(), this.lastDuration = 0, this.duration = 0, this.isWaveformPaused = !1, this.timer.start(), this.emit("record-start");
2910
+ });
2911
+ }
2912
+ getDuration() {
2913
+ return this.duration;
2914
+ }
2915
+ isRecording() {
2916
+ var t;
2917
+ return ((t = this.mediaRecorder) === null || t === void 0 ? void 0 : t.state) === "recording";
2918
+ }
2919
+ isPaused() {
2920
+ var t;
2921
+ return ((t = this.mediaRecorder) === null || t === void 0 ? void 0 : t.state) === "paused";
2922
+ }
2923
+ isActive() {
2924
+ var t;
2925
+ return ((t = this.mediaRecorder) === null || t === void 0 ? void 0 : t.state) !== "inactive";
2926
+ }
2927
+ stopRecording() {
2928
+ var t;
2929
+ this.isActive() && ((t = this.mediaRecorder) === null || t === void 0 || t.stop(), this.timer.stop());
2930
+ }
2931
+ pauseRecording() {
2932
+ var t, e;
2933
+ this.isRecording() && (this.isWaveformPaused = !0, (t = this.mediaRecorder) === null || t === void 0 || t.requestData(), (e = this.mediaRecorder) === null || e === void 0 || e.pause(), this.timer.stop(), this.lastDuration = this.duration);
2934
+ }
2935
+ resumeRecording() {
2936
+ var t;
2937
+ this.isPaused() && (this.isWaveformPaused = !1, (t = this.mediaRecorder) === null || t === void 0 || t.resume(), this.timer.start(), this.lastStartTime = performance.now(), this.emit("record-resume"));
2938
+ }
2939
+ static getAvailableAudioDevices() {
2940
+ return Q(this, void 0, void 0, function* () {
2941
+ return navigator.mediaDevices.enumerateDevices().then((t) => t.filter((e) => e.kind === "audioinput"));
2942
+ });
2943
+ }
2944
+ destroy() {
2945
+ this.applyOriginalOptionsIfNeeded(), super.destroy(), this.stopRecording(), this.stopMic();
2946
+ }
2947
+ applyOriginalOptionsIfNeeded() {
2948
+ this.wavesurfer && this.originalOptions && (this.wavesurfer.setOptions(this.originalOptions), delete this.originalOptions);
2949
+ }
2950
+ }
2951
+ const At = (r) => {
2952
+ const t = D(0), e = D(!1), i = D(!1), s = et(() => [
2953
+ Math.floor(t.value % 36e5 / 6e4),
2954
+ // minutes
2955
+ Math.floor(t.value % 6e4 / 1e3)
2956
+ // seconds
2957
+ ].map((a) => a < 10 ? "0" + a : a).join(":")), o = et(() => e.value || !i.value), n = () => {
2958
+ r.value && r.value?.on("record-progress", (a) => {
2959
+ t.value = a;
2960
+ });
2961
+ };
2962
+ return {
2963
+ currentTime: s,
2964
+ startRecording: () => {
2965
+ if (r.value?.isRecording() || r.value?.isPaused()) {
2966
+ r.value?.stopRecording(), e.value = !1, i.value = !0;
2967
+ return;
2968
+ }
2969
+ r.value?.startRecording(), e.value = !0, i.value = !1, n();
2970
+ },
2971
+ stopRecording: () => new Promise((a) => {
2972
+ let u;
2973
+ (r.value?.isRecording() || r.value?.isPaused()) && (r.value?.stopRecording(), e.value = !1, i.value = !1), r.value?.on("record-end", (d) => {
2974
+ u = d, a(u);
2975
+ });
2976
+ }),
2977
+ pauseRecording: () => {
2978
+ if (r.value?.isPaused()) {
2979
+ r.value?.resumeRecording(), e.value = !0, i.value = !1;
2980
+ return;
2981
+ }
2982
+ e.value = !1, i.value = !0, r.value?.pauseRecording();
2983
+ },
2984
+ isRecording: e,
2985
+ isPaused: i,
2986
+ isPauseResume: o
2987
+ };
2988
+ }, ci = ({
2989
+ waveSurfer: r,
2990
+ recordPluginOptions: t = {}
2991
+ }) => {
2992
+ const { pluginInstance: e, createPlugin: i } = z(
2993
+ U,
2994
+ {
2995
+ renderRecordedAudio: !1,
2996
+ ...t
2997
+ }
2998
+ ), s = At(e);
2999
+ return R(() => {
3000
+ r.value && i(r.value);
3001
+ }), {
3002
+ waveSurferRecorder: e,
3003
+ ...s
3004
+ };
3005
+ }, ui = ({
3006
+ containerRef: r,
3007
+ options: t,
3008
+ recordPluginOptions: e = {}
3009
+ }) => {
3010
+ const { waveSurfer: i, pluginInstance: s } = G(
3011
+ U,
3012
+ {
3013
+ containerRef: r,
3014
+ options: t,
3015
+ pluginOptions: {
3016
+ renderRecordedAudio: !1,
3017
+ ...e
3018
+ }
3019
+ }
3020
+ ), o = At(s);
3021
+ return {
3022
+ waveSurfer: i,
3023
+ waveSurferRecorder: s,
3024
+ ...o
3025
+ };
3026
+ };
2736
3027
  export {
2737
- Se as WaveSurferPlayer,
2738
- Vt as useWaveSurfer,
2739
- Ke as useWaveSurferEnvelope,
2740
- je as useWaveSurferEnvelopeStandalone,
2741
- He as useWaveSurferHover,
2742
- $e as useWaveSurferHoverStandalone,
2743
- nt as useWaveSurferInstance,
2744
- Xe as useWaveSurferMinimap,
2745
- Ne as useWaveSurferMinimapStandalone,
3028
+ De as WaveSurferPlayer,
3029
+ Ut as useWaveSurfer,
3030
+ Qe as useWaveSurferEnvelope,
3031
+ _e as useWaveSurferEnvelopeStandalone,
3032
+ si as useWaveSurferHover,
3033
+ ni as useWaveSurferHoverStandalone,
3034
+ ot as useWaveSurferInstance,
3035
+ Be as useWaveSurferMinimap,
3036
+ Ue as useWaveSurferMinimapStandalone,
2746
3037
  z as useWaveSurferPlugin,
2747
3038
  G as useWaveSurferPluginStandalone,
2748
- qe as useWaveSurferRegions,
2749
- Qe as useWaveSurferRegionsStandalone,
2750
- Ae as useWaveSurferSpectrogram,
2751
- Fe as useWaveSurferSpectrogramStandalone,
2752
- Ee as useWaveSurferTimeline,
2753
- Pe as useWaveSurferTimelineStandalone,
2754
- Te as useWaveSurferZoom,
2755
- De as useWaveSurferZoomStandalone
3039
+ ci as useWaveSurferRecorder,
3040
+ ui as useWaveSurferRecorderStandalone,
3041
+ li as useWaveSurferRegions,
3042
+ hi as useWaveSurferRegionsStandalone,
3043
+ Je as useWaveSurferSpectrogram,
3044
+ ti as useWaveSurferSpectrogramStandalone,
3045
+ ze as useWaveSurferTimeline,
3046
+ Ge as useWaveSurferTimelineStandalone,
3047
+ Xe as useWaveSurferZoom,
3048
+ Ae as useWaveSurferZoomStandalone
2756
3049
  };