react-modern-audio-player 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import './index.css';
3
- import { jsx as c, Fragment as G, jsxs as w } from "react/jsx-runtime";
4
- import te, { createContext as K, useContext as he, useReducer as xt, useMemo as x, forwardRef as Pe, useCallback as E, useRef as S, useEffect as P, memo as z, useState as N, useId as $e, useLayoutEffect as Mt, cloneElement as _t, isValidElement as Dt } from "react";
3
+ import { jsx as c, Fragment as G, jsxs as b } from "react/jsx-runtime";
4
+ import te, { createContext as K, useContext as he, useReducer as xt, useMemo as C, forwardRef as Pe, useCallback as g, useRef as P, useEffect as A, memo as z, useState as N, useId as $e, useLayoutEffect as Mt, cloneElement as _t, isValidElement as Dt } from "react";
5
5
  import Rt, { flushSync as Fe } from "react-dom";
6
6
  const O = {
7
7
  isPlaying: !1,
@@ -11,7 +11,7 @@ const O = {
11
11
  currentTime: 0,
12
12
  duration: 0,
13
13
  playbackRate: 1
14
- }, Or = 11, de = {
14
+ }, Kr = 11, pe = {
15
15
  templateArea: {
16
16
  artwork: "row1-1",
17
17
  trackInfo: "row1-2",
@@ -24,8 +24,8 @@ const O = {
24
24
  playList: "row1-9",
25
25
  playbackRate: "row1-10"
26
26
  }
27
- }, b = K(null);
28
- b.displayName = "AudioPlayerDispatchContext";
27
+ }, w = K(null);
28
+ w.displayName = "AudioPlayerDispatchContext";
29
29
  const He = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Ke = (e, t) => Math.round(Math.random() * (t - e) + e), Ut = 1, Ve = (e, t, n) => {
30
30
  if (n - t < 1) return e;
31
31
  let a = Ke(t, n);
@@ -88,7 +88,7 @@ const He = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Ke = (e, t) =>
88
88
  curAudioState: { ...e.curAudioState, currentTime: 0 }
89
89
  };
90
90
  if (e.curAudioState.repeatType === "SHUFFLE") {
91
- const s = Ve(
91
+ const i = Ve(
92
92
  e.curIdx,
93
93
  0,
94
94
  e.playList.length - 1
@@ -96,17 +96,17 @@ const He = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Ke = (e, t) =>
96
96
  return {
97
97
  ...e,
98
98
  audioResetKey: e.audioResetKey + 1,
99
- curPlayId: e.playList[s].id,
100
- curIdx: s,
99
+ curPlayId: e.playList[i].id,
100
+ curIdx: i,
101
101
  curAudioState: { ...e.curAudioState, currentTime: 0 }
102
102
  };
103
103
  }
104
- const i = (e.curIdx - 1 + e.playList.length) % e.playList.length;
104
+ const s = (e.curIdx - 1 + e.playList.length) % e.playList.length;
105
105
  return {
106
106
  ...e,
107
107
  audioResetKey: e.audioResetKey + 1,
108
- curPlayId: e.playList[i].id,
109
- curIdx: i,
108
+ curPlayId: e.playList[s].id,
109
+ curIdx: s,
110
110
  curAudioState: {
111
111
  ...e.curAudioState,
112
112
  isLoadedMetaData: !1,
@@ -263,30 +263,30 @@ const He = (e) => isFinite(e) ? Math.min(Math.max(e, 0), 1) : 1, Ke = (e, t) =>
263
263
  Se.displayName = "PlaybackContext";
264
264
  const Ie = K(null);
265
265
  Ie.displayName = "AudioAttrsContext";
266
- const we = K(null);
267
- we.displayName = "TrackContext";
268
266
  const be = K(null);
269
- be.displayName = "UIContext";
267
+ be.displayName = "TrackContext";
268
+ const we = K(null);
269
+ we.displayName = "UIContext";
270
270
  const Le = K(null);
271
271
  Le.displayName = "ResourceContext";
272
272
  const Ne = K(null);
273
273
  Ne.displayName = "TimeContext";
274
- const A = (e) => {
274
+ const E = (e) => {
275
275
  const t = he(e);
276
276
  if (!t) {
277
277
  const n = e.displayName || "Context";
278
278
  throw new Error(`${n} is not provided`);
279
279
  }
280
280
  return t;
281
- }, k = () => A(Se), re = () => A(Ne), $ = () => A(we), M = () => A(be), L = () => A(Le), Kt = () => A(Ie);
281
+ }, k = () => E(Se), re = () => E(Ne), $ = () => E(be), x = () => E(we), L = () => E(Le), Kt = () => E(Ie);
282
282
  function Vt(e) {
283
283
  const {
284
284
  playList: t,
285
285
  audioInitialState: n,
286
286
  activeUI: a,
287
287
  placement: r,
288
- customIcons: i,
289
- coverImgsCss: s
288
+ customIcons: s,
289
+ coverImgsCss: i
290
290
  } = e, o = {
291
291
  isPlaying: (n == null ? void 0 : n.isPlaying) ?? O.isPlaying,
292
292
  repeatType: (n == null ? void 0 : n.repeatType) ?? O.repeatType,
@@ -298,7 +298,7 @@ function Vt(e) {
298
298
  playListPlacement: (r == null ? void 0 : r.playList) || "bottom",
299
299
  interfacePlacement: (r == null ? void 0 : r.interface) || {
300
300
  templateArea: {
301
- playButton: de.templateArea.playButton
301
+ playButton: pe.templateArea.playButton
302
302
  }
303
303
  },
304
304
  volumeSliderPlacement: r == null ? void 0 : r.volumeSlider,
@@ -313,8 +313,8 @@ function Vt(e) {
313
313
  audioResetKey: 0,
314
314
  seekRequestKey: 0,
315
315
  ...d,
316
- customIcons: i,
317
- coverImgsCss: s
316
+ customIcons: s,
317
+ coverImgsCss: i
318
318
  };
319
319
  }
320
320
  const Bt = ({
@@ -327,7 +327,7 @@ const Bt = ({
327
327
  Ot,
328
328
  n,
329
329
  Vt
330
- ), i = x(
330
+ ), s = C(
331
331
  () => ({
332
332
  currentTime: a.curAudioState.currentTime ?? O.currentTime,
333
333
  duration: a.curAudioState.duration ?? O.duration,
@@ -338,7 +338,7 @@ const Bt = ({
338
338
  a.curAudioState.duration,
339
339
  a.seekRequestKey
340
340
  ]
341
- ), s = x(
341
+ ), i = C(
342
342
  () => ({
343
343
  isPlaying: a.curAudioState.isPlaying ?? O.isPlaying,
344
344
  volume: a.curAudioState.volume ?? O.volume,
@@ -357,14 +357,14 @@ const Bt = ({
357
357
  a.curAudioState.playbackRate,
358
358
  a.audioResetKey
359
359
  ]
360
- ), o = x(
360
+ ), o = C(
361
361
  () => ({
362
362
  playList: a.playList,
363
363
  curPlayId: a.curPlayId,
364
364
  curIdx: a.curIdx
365
365
  }),
366
366
  [a.playList, a.curPlayId, a.curIdx]
367
- ), { audioInitialState: u } = n, d = u == null ? void 0 : u.playListExpanded, l = x(
367
+ ), { audioInitialState: u } = n, d = u == null ? void 0 : u.playListExpanded, l = C(
368
368
  () => ({
369
369
  activeUI: a.activeUI,
370
370
  playListPlacement: a.playListPlacement,
@@ -385,23 +385,23 @@ const Bt = ({
385
385
  t,
386
386
  d
387
387
  ]
388
- ), m = x(() => {
388
+ ), m = C(() => {
389
389
  if (!u) return {};
390
390
  const {
391
391
  isPlaying: y,
392
392
  repeatType: T,
393
393
  isLoadedMetaData: h,
394
- currentTime: g,
395
- duration: C,
396
- volume: W,
397
- muted: se,
394
+ currentTime: S,
395
+ duration: D,
396
+ volume: j,
397
+ muted: ce,
398
398
  playbackRate: R,
399
- curPlayId: ce,
399
+ curPlayId: le,
400
400
  playListExpanded: ae,
401
401
  ...ye
402
402
  } = u;
403
403
  return ye;
404
- }, [u]), p = x(
404
+ }, [u]), p = C(
405
405
  () => ({
406
406
  elementRefs: a.elementRefs,
407
407
  customIcons: a.customIcons,
@@ -414,7 +414,7 @@ const Bt = ({
414
414
  a.coverImgsCss
415
415
  ]
416
416
  );
417
- return /* @__PURE__ */ c(Ne.Provider, { value: i, children: /* @__PURE__ */ c(Se.Provider, { value: s, children: /* @__PURE__ */ c(we.Provider, { value: o, children: /* @__PURE__ */ c(be.Provider, { value: l, children: /* @__PURE__ */ c(Le.Provider, { value: p, children: /* @__PURE__ */ c(Ie.Provider, { value: m, children: /* @__PURE__ */ c(b.Provider, { value: r, children: e }) }) }) }) }) }) });
417
+ return /* @__PURE__ */ c(Ne.Provider, { value: s, children: /* @__PURE__ */ c(Se.Provider, { value: i, children: /* @__PURE__ */ c(be.Provider, { value: o, children: /* @__PURE__ */ c(we.Provider, { value: l, children: /* @__PURE__ */ c(Le.Provider, { value: p, children: /* @__PURE__ */ c(Ie.Provider, { value: m, children: /* @__PURE__ */ c(w.Provider, { value: r, children: e }) }) }) }) }) }) });
418
418
  }, J = {
419
419
  top: "auto",
420
420
  right: "auto",
@@ -428,10 +428,10 @@ const Bt = ({
428
428
  "top-left": { ...J, top: 0, left: 0 },
429
429
  "top-right": { ...J, top: 0, right: 0 }
430
430
  }, Ge = te.memo(({ children: e, rootContainerProps: t }) => {
431
- const { playerPlacement: n, colorScheme: a } = M(), r = x(
431
+ const { playerPlacement: n, colorScheme: a } = x(), r = C(
432
432
  () => n ? $t[n] : void 0,
433
433
  [n]
434
- ), s = {
434
+ ), i = {
435
435
  width: "100%",
436
436
  position: n !== "static" && !!n ? "fixed" : "static",
437
437
  ...r,
@@ -440,10 +440,11 @@ const Bt = ({
440
440
  return /* @__PURE__ */ c(
441
441
  "div",
442
442
  {
443
+ "data-testid": "player-provider",
443
444
  ...t,
444
445
  className: `rmap-player-provider${t != null && t.className ? ` ${t.className}` : ""}`,
445
446
  "data-theme": a ?? void 0,
446
- style: s,
447
+ style: i,
447
448
  children: e
448
449
  }
449
450
  );
@@ -455,18 +456,19 @@ const Ft = ({
455
456
  alignItems: n,
456
457
  justifyContent: a,
457
458
  minHeight: r,
458
- UNSAFE_className: i,
459
- children: s
459
+ UNSAFE_className: s,
460
+ "data-testid": i,
461
+ children: o
460
462
  }) => {
461
- const o = {
463
+ const u = {
462
464
  display: "grid",
463
- gridTemplateAreas: e == null ? void 0 : e.map((u) => `"${u}"`).join(" "),
465
+ gridTemplateAreas: e == null ? void 0 : e.map((d) => `"${d}"`).join(" "),
464
466
  gridTemplateColumns: t == null ? void 0 : t.join(" "),
465
467
  alignItems: n,
466
468
  justifyContent: a,
467
469
  minHeight: r
468
470
  };
469
- return /* @__PURE__ */ c("div", { className: i, style: o, children: s });
471
+ return /* @__PURE__ */ c("div", { className: s, style: u, "data-testid": i, children: o });
470
472
  }, Ht = Ft, ze = Pe(
471
473
  ({
472
474
  children: e,
@@ -474,8 +476,8 @@ const Ft = ({
474
476
  gridArea: n,
475
477
  width: a,
476
478
  justifySelf: r = "center",
477
- padding: i,
478
- UNSAFE_className: s,
479
+ padding: s,
480
+ UNSAFE_className: i,
479
481
  style: o,
480
482
  ...u
481
483
  }, d) => {
@@ -484,22 +486,22 @@ const Ft = ({
484
486
  gridArea: n,
485
487
  width: a,
486
488
  justifySelf: r,
487
- padding: i ?? "0 5px",
489
+ padding: s ?? "0 5px",
488
490
  ...o
489
491
  };
490
- return /* @__PURE__ */ c("div", { ref: d, className: s, style: l, ...u, children: e });
492
+ return /* @__PURE__ */ c("div", { ref: d, className: i, style: l, ...u, children: e });
491
493
  }
492
494
  );
493
495
  ze.displayName = "GridItem";
494
- const _ = Ht;
495
- _.Item = ze;
496
+ const M = Ht;
497
+ M.Item = ze;
496
498
  const Gt = ({
497
499
  children: e,
498
500
  id: t,
499
501
  ...n
500
502
  }) => {
501
503
  var l, m;
502
- const a = k(), r = re(), i = $(), s = M(), o = L(), u = {
504
+ const a = k(), r = re(), s = $(), i = x(), o = L(), u = {
503
505
  curAudioState: {
504
506
  isPlaying: a.isPlaying,
505
507
  volume: a.volume,
@@ -511,12 +513,12 @@ const Gt = ({
511
513
  },
512
514
  audioResetKey: a.audioResetKey,
513
515
  ...r,
514
- ...i,
515
516
  ...s,
517
+ ...i,
516
518
  ...o
517
- }, d = (m = (l = s.interfacePlacement) == null ? void 0 : l.customComponentsArea) == null ? void 0 : m[t];
519
+ }, d = (m = (l = i.interfacePlacement) == null ? void 0 : l.customComponentsArea) == null ? void 0 : m[t];
518
520
  return /* @__PURE__ */ c(
519
- _.Item,
521
+ M.Item,
520
522
  {
521
523
  UNSAFE_className: "rmap-custom-component",
522
524
  gridArea: d,
@@ -533,7 +535,7 @@ const zt = () => {
533
535
  repeatType: n,
534
536
  audioResetKey: a,
535
537
  playbackRate: r
536
- } = k(), { currentTime: i, seekRequestKey: s } = re(), { elementRefs: o } = L(), u = A(b), d = E(
538
+ } = k(), { currentTime: s, seekRequestKey: i } = re(), { elementRefs: o } = L(), u = E(w), d = g(
537
539
  (y) => {
538
540
  if (y.currentTarget.readyState === 0) return;
539
541
  const T = y.currentTarget.currentTime;
@@ -543,7 +545,7 @@ const zt = () => {
543
545
  });
544
546
  },
545
547
  [u]
546
- ), l = E(() => {
548
+ ), l = g(() => {
547
549
  if (o != null && o.audioEl) {
548
550
  if (n === "ONE") {
549
551
  Fe(() => {
@@ -553,12 +555,12 @@ const zt = () => {
553
555
  }
554
556
  u({ type: "NEXT_AUDIO" });
555
557
  }
556
- }, [u, n, o == null ? void 0 : o.audioEl]), m = E(
558
+ }, [u, n, o == null ? void 0 : o.audioEl]), m = g(
557
559
  (y) => {
558
560
  t != null && (y.volume = t), r != null && (y.playbackRate = r);
559
561
  },
560
562
  [t, r]
561
- ), p = E(
563
+ ), p = g(
562
564
  (y) => {
563
565
  const { duration: T } = y.currentTarget;
564
566
  m(y.currentTarget), u({
@@ -567,8 +569,8 @@ const zt = () => {
567
569
  });
568
570
  },
569
571
  [u, m]
570
- ), v = S(!1);
571
- P(() => {
572
+ ), v = P(!1);
573
+ A(() => {
572
574
  if (o != null && o.audioEl) {
573
575
  if (!v.current) {
574
576
  v.current = !0;
@@ -576,32 +578,32 @@ const zt = () => {
576
578
  }
577
579
  o.audioEl.currentTime = 0;
578
580
  }
579
- }, [a, o == null ? void 0 : o.audioEl]), P(() => {
581
+ }, [a, o == null ? void 0 : o.audioEl]), A(() => {
580
582
  o != null && o.audioEl && (e ? o.audioEl.play().catch((y) => {
581
583
  (y == null ? void 0 : y.name) !== "AbortError" && u({
582
584
  type: "SET_AUDIO_STATE",
583
585
  audioState: { isPlaying: !1 }
584
586
  });
585
587
  }) : o.audioEl.pause());
586
- }, [o == null ? void 0 : o.audioEl, e, u, a]), P(() => {
588
+ }, [o == null ? void 0 : o.audioEl, e, u, a]), A(() => {
587
589
  !(o != null && o.audioEl) || t == null || (o.audioEl.volume = t);
588
- }, [o == null ? void 0 : o.audioEl, t]), P(() => {
590
+ }, [o == null ? void 0 : o.audioEl, t]), A(() => {
589
591
  !(o != null && o.audioEl) || r == null || (o.audioEl.playbackRate = r);
590
592
  }, [o == null ? void 0 : o.audioEl, r]);
591
- const f = S(0);
592
- return P(() => {
593
- if (s === f.current) return;
594
- f.current = s;
593
+ const f = P(0);
594
+ return A(() => {
595
+ if (i === f.current) return;
596
+ f.current = i;
595
597
  const y = o == null ? void 0 : o.audioEl;
596
- if (!y || i == null) return;
597
- y.currentTime = i;
598
- const T = o == null ? void 0 : o.waveformInst, h = y.duration, g = Number.isFinite(h) && h > 0;
599
- if (!T || !g) return;
600
- const C = i / h, W = Math.min(1, Math.max(0, C));
601
- T.seekTo(W);
598
+ if (!y || s == null) return;
599
+ y.currentTime = s;
600
+ const T = o == null ? void 0 : o.waveformInst, h = y.duration, S = Number.isFinite(h) && h > 0;
601
+ if (!T || !S) return;
602
+ const D = s / h, j = Math.min(1, Math.max(0, D));
603
+ T.seekTo(j);
602
604
  }, [
603
- s,
604
605
  i,
606
+ s,
605
607
  o == null ? void 0 : o.audioEl,
606
608
  o == null ? void 0 : o.waveformInst
607
609
  ]), {
@@ -610,19 +612,19 @@ const zt = () => {
610
612
  onLoadedMetadata: p
611
613
  };
612
614
  }, Ye = te.memo(({ audioRef: e }) => {
613
- const t = S(null), { muted: n } = k(), { curPlayId: a, playList: r } = $(), i = Kt(), s = A(b), o = r.find(
615
+ const t = P(null), { muted: n } = k(), { curPlayId: a, playList: r } = $(), s = Kt(), i = E(w), o = r.find(
614
616
  (d) => d.id === a
615
617
  ), u = zt();
616
- return P(() => {
617
- t.current && (s({
618
+ return A(() => {
619
+ t.current && (i({
618
620
  type: "SET_ELEMENT_REFS",
619
621
  elementRefs: { audioEl: t.current }
620
622
  }), e && (e.current = t.current));
621
- }, [s, e]), /* @__PURE__ */ c(
623
+ }, [i, e]), /* @__PURE__ */ c(
622
624
  "audio",
623
625
  {
624
626
  id: "rm-audio-player-audio",
625
- ...i,
627
+ ...s,
626
628
  muted: n,
627
629
  ref: t,
628
630
  src: o == null ? void 0 : o.src,
@@ -633,8 +635,8 @@ const zt = () => {
633
635
  Ye.displayName = "Audio";
634
636
  function B(e, t) {
635
637
  var a, r;
636
- const { interfacePlacement: n } = M();
637
- return t ?? ((a = n == null ? void 0 : n.itemCustomArea) == null ? void 0 : a[e]) ?? ((r = n == null ? void 0 : n.templateArea) == null ? void 0 : r[e]) ?? de.templateArea[e];
638
+ const { interfacePlacement: n } = x();
639
+ return t ?? ((a = n == null ? void 0 : n.itemCustomArea) == null ? void 0 : a[e]) ?? ((r = n == null ? void 0 : n.templateArea) == null ? void 0 : r[e]) ?? pe.templateArea[e];
638
640
  }
639
641
  const q = Pe(({ className: e, type: t = "button", ...n }, a) => /* @__PURE__ */ c(
640
642
  "button",
@@ -690,7 +692,7 @@ const ke = (e) => (
690
692
  )
691
693
  ), qe = (e, t = "0 0 16 16") => (
692
694
  // eslint-disable-next-line react/display-name
693
- ({ size: n = "1em", color: a, style: r, ...i }) => /* @__PURE__ */ c(
695
+ ({ size: n = "1em", color: a, style: r, ...s }) => /* @__PURE__ */ c(
694
696
  "svg",
695
697
  {
696
698
  "aria-hidden": "true",
@@ -704,7 +706,7 @@ const ke = (e) => (
704
706
  color: a,
705
707
  style: a ? { color: a, ...r } : r,
706
708
  xmlns: "http://www.w3.org/2000/svg",
707
- ...i,
709
+ ...s,
708
710
  dangerouslySetInnerHTML: { __html: e }
709
711
  }
710
712
  )
@@ -748,16 +750,16 @@ const ot = X(
748
750
  '<path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a0.8 .8 0 0 1 1.5 .5v14a0.8 .8 0 0 1 -1.5 .5l-3.5 -4.5"/><path d="M16 10l4 4m0 -4l-4 4"/>'
749
751
  );
750
752
  ot.displayName = "TbVolume3";
751
- const it = qe(
753
+ const st = qe(
752
754
  '<path d="M8 0c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zM8 14.5c-3.59 0-6.5-2.91-6.5-6.5s2.91-6.5 6.5-6.5 6.5 2.91 6.5 6.5-2.91 6.5-6.5 6.5z"/><path d="M7 8l4-3v6z"/><path d="M5 5h2v6h-2v-6z"/>'
753
755
  );
754
- it.displayName = "ImPrevious";
755
- const st = qe(
756
+ st.displayName = "ImPrevious";
757
+ const it = qe(
756
758
  '<path d="M8 0c4.418 0 8 3.582 8 8s-3.582 8-8 8-8-3.582-8-8 3.582-8 8-8zM8 14.5c3.59 0 6.5-2.91 6.5-6.5s-2.91-6.5-6.5-6.5-6.5 2.91-6.5 6.5 2.91 6.5 6.5 6.5z"/><path d="M9 8l-4-3v6z"/><path d="M11 5h-2v6h2v-6z"/>'
757
759
  );
758
- st.displayName = "ImNext";
759
- const D = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?? e }), Wt = z(function() {
760
- const { isPlaying: t } = k(), { customIcons: n } = L(), a = A(b);
760
+ it.displayName = "ImNext";
761
+ const _ = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?? e }), Wt = z(function() {
762
+ const { isPlaying: t } = k(), { customIcons: n } = L(), a = E(w);
761
763
  return /* @__PURE__ */ c(
762
764
  q,
763
765
  {
@@ -767,16 +769,16 @@ const D = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?
767
769
  className: "rmap-play-btn",
768
770
  "data-testid": "play-btn",
769
771
  children: t ? /* @__PURE__ */ c(
770
- D,
772
+ _,
771
773
  {
772
774
  render: /* @__PURE__ */ c(Qe, {}),
773
775
  customIcon: n == null ? void 0 : n.pause
774
776
  }
775
- ) : /* @__PURE__ */ c(D, { render: /* @__PURE__ */ c(Xe, {}), customIcon: n == null ? void 0 : n.play })
777
+ ) : /* @__PURE__ */ c(_, { render: /* @__PURE__ */ c(Xe, {}), customIcon: n == null ? void 0 : n.play })
776
778
  }
777
779
  );
778
780
  }), jt = z(function({ isVisible: t }) {
779
- const { customIcons: n, elementRefs: a } = L(), r = A(b);
781
+ const { customIcons: n, elementRefs: a } = L(), r = E(w);
780
782
  return t ? /* @__PURE__ */ c(
781
783
  q,
782
784
  {
@@ -784,16 +786,16 @@ const D = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?
784
786
  "aria-label": "Previous track",
785
787
  onClick: () => {
786
788
  var o;
787
- const s = ((o = a == null ? void 0 : a.audioEl) == null ? void 0 : o.currentTime) ?? 0;
788
- r({ type: "PREV_AUDIO", currentTime: s });
789
+ const i = ((o = a == null ? void 0 : a.audioEl) == null ? void 0 : o.currentTime) ?? 0;
790
+ r({ type: "PREV_AUDIO", currentTime: i });
789
791
  },
790
792
  className: "rmap-prev-btn",
791
793
  "data-testid": "prev-btn",
792
- children: /* @__PURE__ */ c(D, { render: /* @__PURE__ */ c(it, {}), customIcon: n == null ? void 0 : n.prev })
794
+ children: /* @__PURE__ */ c(_, { render: /* @__PURE__ */ c(st, {}), customIcon: n == null ? void 0 : n.prev })
793
795
  }
794
796
  ) : null;
795
797
  }), Yt = z(function({ isVisible: t }) {
796
- const { customIcons: n } = L(), a = A(b);
798
+ const { customIcons: n } = L(), a = E(w);
797
799
  return t ? /* @__PURE__ */ c(
798
800
  q,
799
801
  {
@@ -804,7 +806,7 @@ const D = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?
804
806
  },
805
807
  className: "rmap-next-btn",
806
808
  "data-testid": "next-btn",
807
- children: /* @__PURE__ */ c(D, { render: /* @__PURE__ */ c(st, {}), customIcon: n == null ? void 0 : n.next })
809
+ children: /* @__PURE__ */ c(_, { render: /* @__PURE__ */ c(it, {}), customIcon: n == null ? void 0 : n.next })
808
810
  }
809
811
  ) : null;
810
812
  }), ct = ({
@@ -812,8 +814,8 @@ const D = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?
812
814
  visible: t,
813
815
  ...n
814
816
  }) => {
815
- const { activeUI: a } = M(), r = !!(a.prevNnext ?? a.all), i = B("playButton", e);
816
- return /* @__PURE__ */ c(_.Item, { gridArea: i, visible: t ?? !0, ...n, children: /* @__PURE__ */ w(
817
+ const { activeUI: a } = x(), r = !!(a.prevNnext ?? a.all), s = B("playButton", e);
818
+ return /* @__PURE__ */ c(M.Item, { gridArea: s, visible: t ?? !0, ...n, children: /* @__PURE__ */ b(
817
819
  "div",
818
820
  {
819
821
  className: "rmap-ctrl-btn-wrapper",
@@ -838,21 +840,21 @@ const D = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?
838
840
  SHUFFLE: "ALL"
839
841
  }, lt = z(
840
842
  function({ gridArea: t, visible: n, ...a }) {
841
- const { repeatType: r } = k(), { customIcons: i } = L(), s = A(
842
- b
843
+ const { repeatType: r } = k(), { customIcons: s } = L(), i = E(
844
+ w
843
845
  ), o = () => {
844
- s({
846
+ i({
845
847
  type: "SET_REPEAT_TYPE",
846
848
  repeatType: Xt[r]
847
849
  });
848
850
  }, u = B("repeatType", t);
849
851
  return /* @__PURE__ */ c(
850
- _.Item,
852
+ M.Item,
851
853
  {
852
854
  gridArea: u,
853
855
  visible: n ?? !0,
854
856
  ...a,
855
- children: /* @__PURE__ */ w(
857
+ children: /* @__PURE__ */ b(
856
858
  q,
857
859
  {
858
860
  type: "button",
@@ -862,26 +864,26 @@ const D = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?
862
864
  "data-testid": "repeat-btn",
863
865
  "data-repeattype": r,
864
866
  children: [
865
- r === "ALL" && /* @__PURE__ */ c(D, { render: /* @__PURE__ */ c(Ze, {}), customIcon: i == null ? void 0 : i.repeatAll }),
867
+ r === "ALL" && /* @__PURE__ */ c(_, { render: /* @__PURE__ */ c(Ze, {}), customIcon: s == null ? void 0 : s.repeatAll }),
866
868
  r === "ONE" && /* @__PURE__ */ c(
867
- D,
869
+ _,
868
870
  {
869
871
  render: /* @__PURE__ */ c(et, {}),
870
- customIcon: i == null ? void 0 : i.repeatOne
872
+ customIcon: s == null ? void 0 : s.repeatOne
871
873
  }
872
874
  ),
873
875
  r === "NONE" && /* @__PURE__ */ c(
874
- D,
876
+ _,
875
877
  {
876
878
  render: /* @__PURE__ */ c(tt, {}),
877
- customIcon: i == null ? void 0 : i.repeatNone
879
+ customIcon: s == null ? void 0 : s.repeatNone
878
880
  }
879
881
  ),
880
882
  r === "SHUFFLE" && /* @__PURE__ */ c(
881
- D,
883
+ _,
882
884
  {
883
885
  render: /* @__PURE__ */ c(rt, {}),
884
- customIcon: i == null ? void 0 : i.repeatShuffle
886
+ customIcon: s == null ? void 0 : s.repeatShuffle
885
887
  }
886
888
  )
887
889
  ]
@@ -891,22 +893,22 @@ const D = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?
891
893
  );
892
894
  }
893
895
  ), Te = { size: "100%" }, ut = z(() => {
894
- var s;
895
- const { volume: e, muted: t } = k(), { customIcons: n, elementRefs: a } = L(), r = e ?? ((s = a == null ? void 0 : a.audioEl) == null ? void 0 : s.volume) ?? 0, i = r > 0 && r <= 0.5;
896
+ var i;
897
+ const { volume: e, muted: t } = k(), { customIcons: n, elementRefs: a } = L(), r = e ?? ((i = a == null ? void 0 : a.audioEl) == null ? void 0 : i.volume) ?? 0, s = r > 0 && r <= 0.5;
896
898
  return t || r === 0 ? /* @__PURE__ */ c(
897
- D,
899
+ _,
898
900
  {
899
901
  render: /* @__PURE__ */ c(ot, { ...Te }),
900
902
  customIcon: n == null ? void 0 : n.volumeMuted
901
903
  }
902
- ) : i ? /* @__PURE__ */ c(
903
- D,
904
+ ) : s ? /* @__PURE__ */ c(
905
+ _,
904
906
  {
905
907
  render: /* @__PURE__ */ c(nt, { ...Te }),
906
908
  customIcon: n == null ? void 0 : n.volumeHalf
907
909
  }
908
910
  ) : /* @__PURE__ */ c(
909
- D,
911
+ _,
910
912
  {
911
913
  render: /* @__PURE__ */ c(at, { ...Te }),
912
914
  customIcon: n == null ? void 0 : n.volumeFull
@@ -914,13 +916,13 @@ const D = ({ render: e, customIcon: t }) => /* @__PURE__ */ c(G, { children: t ?
914
916
  );
915
917
  });
916
918
  ut.displayName = "VolumeIcon";
917
- const ie = K(null);
918
- ie.displayName = "DrawerContext";
919
+ const se = K(null);
920
+ se.displayName = "DrawerContext";
919
921
  const dt = (e, t) => {
920
- P(() => {
922
+ A(() => {
921
923
  const n = (a) => {
922
- const r = e.current, { target: i } = a;
923
- !a || !r || r.contains(i) || t(a);
924
+ const r = e.current, { target: s } = a;
925
+ !a || !r || r.contains(s) || t(a);
924
926
  };
925
927
  return document.addEventListener("click", n), () => document.removeEventListener("click", n);
926
928
  }, [e, t]);
@@ -930,51 +932,51 @@ const dt = (e, t) => {
930
932
  children: n,
931
933
  isOpen: a,
932
934
  onOpenChange: r,
933
- initialOpen: i
935
+ initialOpen: s
934
936
  }) => {
935
- const s = S(null), [o, u] = te.Children.toArray(n), [d, l] = N(
936
- a !== void 0 ? a : i ?? !1
937
+ const i = P(null), [o, u] = te.Children.toArray(n), [d, l] = N(
938
+ a !== void 0 ? a : s ?? !1
937
939
  ), m = $e();
938
- dt(s, () => {
940
+ dt(i, () => {
939
941
  e && (l(!1), r && r(!1));
940
- }), P(() => {
942
+ }), A(() => {
941
943
  a !== void 0 && l(a);
942
944
  }, [a]);
943
- const p = x(
945
+ const p = C(
944
946
  () => ({ isOpen: d, setIsOpen: l, onOpenChange: r, drawerId: m }),
945
947
  [d, l, r, m]
946
948
  );
947
- return /* @__PURE__ */ c("div", { className: "rmap-drawer-container", ref: s, children: /* @__PURE__ */ c(ie.Provider, { value: p, children: /* @__PURE__ */ w(G, { children: [
949
+ return /* @__PURE__ */ c("div", { className: "rmap-drawer-container", ref: i, children: /* @__PURE__ */ c(se.Provider, { value: p, children: /* @__PURE__ */ b(G, { children: [
948
950
  t === "top" && u,
949
951
  o,
950
952
  t === "bottom" && u
951
953
  ] }) }) });
952
- }, pt = typeof window < "u", ge = pt ? Mt : P, Ce = ({
954
+ }, pt = typeof window < "u", ge = pt ? Mt : A, Ce = ({
953
955
  visible: e,
954
956
  name: t,
955
957
  leaveTime: n,
956
958
  enterTime: a,
957
959
  clearTime: r,
958
- onExited: i,
959
- onEntered: s,
960
+ onExited: s,
961
+ onEntered: i,
960
962
  children: o
961
963
  }) => {
962
- const [u, d] = N(""), [l, m] = N(!1), p = S(s), v = S(i), f = S(t), y = S(a), T = S(n), h = S(r);
964
+ const [u, d] = N(""), [l, m] = N(!1), p = P(i), v = P(s), f = P(t), y = P(a), T = P(n), h = P(r);
963
965
  return ge(() => {
964
- p.current = s, v.current = i, f.current = t, y.current = a, T.current = n, h.current = r;
966
+ p.current = i, v.current = s, f.current = t, y.current = a, T.current = n, h.current = r;
965
967
  }), ge(() => {
966
- const g = e ? "enter" : "leave", C = f.current, W = e ? y.current : T.current;
967
- e && !l && m(!0), d(`${C}-${g}`);
968
- const se = setTimeout(() => {
969
- var ce, ae;
968
+ const S = e ? "enter" : "leave", D = f.current, j = e ? y.current : T.current;
969
+ e && !l && m(!0), d(`${D}-${S}`);
970
+ const ce = setTimeout(() => {
971
+ var le, ae;
970
972
  d(
971
- `${C}-${g} ${C}-${g}-active`
972
- ), g === "leave" ? (ce = v.current) == null || ce.call(v) : (ae = p.current) == null || ae.call(p);
973
- }, W), R = setTimeout(() => {
974
- e || (d(C), m(!1));
975
- }, W + h.current);
973
+ `${D}-${S} ${D}-${S}-active`
974
+ ), S === "leave" ? (le = v.current) == null || le.call(v) : (ae = p.current) == null || ae.call(p);
975
+ }, j), R = setTimeout(() => {
976
+ e || (d(D), m(!1));
977
+ }, j + h.current);
976
978
  return () => {
977
- clearTimeout(se), clearTimeout(R);
979
+ clearTimeout(ce), clearTimeout(R);
978
980
  };
979
981
  }, [e, l]), l ? _t(o, {
980
982
  className: `${o.props.className} ${u}`
@@ -984,39 +986,39 @@ const dt = (e, t) => {
984
986
  isWithAnimation: t = !0,
985
987
  "aria-label": n = "Dialog"
986
988
  }) => {
987
- const { isOpen: a, setIsOpen: r, onOpenChange: i, drawerId: s } = A(ie), o = S(null), u = S(null), d = E(
989
+ const { isOpen: a, setIsOpen: r, onOpenChange: s, drawerId: i } = E(se), o = P(null), u = P(null), d = g(
988
990
  () => {
989
991
  var y;
990
992
  return (y = o.current) == null ? void 0 : y.querySelectorAll(Qt);
991
993
  },
992
994
  []
993
- ), l = E(() => {
995
+ ), l = g(() => {
994
996
  var y, T;
995
997
  (T = (y = d()) == null ? void 0 : y[0]) == null || T.focus();
996
- }, [d]), m = E(() => {
998
+ }, [d]), m = g(() => {
997
999
  u.current = document.activeElement, l();
998
- }, [l]), p = E(() => {
1000
+ }, [l]), p = g(() => {
999
1001
  var y;
1000
1002
  (y = u.current) == null || y.focus();
1001
1003
  }, []);
1002
- P(() => {
1004
+ A(() => {
1003
1005
  var y;
1004
1006
  a && !t ? (u.current = document.activeElement, l()) : !a && !t && ((y = u.current) == null || y.focus());
1005
1007
  }, [a, t, l]);
1006
- const v = E(
1008
+ const v = g(
1007
1009
  (y) => {
1008
1010
  if (y.key === "Escape") {
1009
- r(!1), i && i(!1);
1011
+ r(!1), s && s(!1);
1010
1012
  return;
1011
1013
  }
1012
1014
  if (y.key === "Tab") {
1013
1015
  const T = d();
1014
1016
  if (!T || T.length === 0) return;
1015
- const h = T[0], g = T[T.length - 1];
1016
- y.shiftKey ? document.activeElement === h && (y.preventDefault(), g.focus()) : document.activeElement === g && (y.preventDefault(), h.focus());
1017
+ const h = T[0], S = T[T.length - 1];
1018
+ y.shiftKey ? document.activeElement === h && (y.preventDefault(), S.focus()) : document.activeElement === S && (y.preventDefault(), h.focus());
1017
1019
  }
1018
1020
  },
1019
- [r, i, d]
1021
+ [r, s, d]
1020
1022
  ), f = /* @__PURE__ */ c(
1021
1023
  "div",
1022
1024
  {
@@ -1025,7 +1027,7 @@ const dt = (e, t) => {
1025
1027
  role: "dialog",
1026
1028
  "aria-modal": "true",
1027
1029
  "aria-label": n,
1028
- id: s,
1030
+ id: i,
1029
1031
  onKeyDown: v,
1030
1032
  children: e
1031
1033
  }
@@ -1048,17 +1050,17 @@ const dt = (e, t) => {
1048
1050
  "aria-label": t,
1049
1051
  "data-testid": n
1050
1052
  }) => {
1051
- const { isOpen: a, setIsOpen: r, onOpenChange: i, drawerId: s } = A(ie), o = E(() => {
1053
+ const { isOpen: a, setIsOpen: r, onOpenChange: s, drawerId: i } = E(se), o = g(() => {
1052
1054
  const u = !a;
1053
- r(u), i == null || i(u);
1054
- }, [a, r, i]);
1055
+ r(u), s == null || s(u);
1056
+ }, [a, r, s]);
1055
1057
  return /* @__PURE__ */ c(
1056
1058
  q,
1057
1059
  {
1058
1060
  className: "rmap-drawer-trigger",
1059
1061
  type: "button",
1060
1062
  "aria-expanded": a,
1061
- "aria-controls": s,
1063
+ "aria-controls": i,
1062
1064
  "aria-label": t,
1063
1065
  "data-testid": n,
1064
1066
  onClick: o,
@@ -1074,8 +1076,8 @@ const Ee = ({ children: e }) => /* @__PURE__ */ c("ul", { className: "rmap-sorta
1074
1076
  listData: n,
1075
1077
  draggable: a = !0,
1076
1078
  onDragStart: r,
1077
- onDragOver: i,
1078
- onDrop: s,
1079
+ onDragOver: s,
1080
+ onDrop: i,
1079
1081
  onReorder: o,
1080
1082
  onClick: u
1081
1083
  }) => {
@@ -1134,7 +1136,7 @@ const Ee = ({ children: e }) => /* @__PURE__ */ c("ul", { className: "rmap-sorta
1134
1136
  l.stopPropagation(), l.currentTarget.classList.remove("rmap-drag-over");
1135
1137
  },
1136
1138
  onDragOver: (l) => {
1137
- l.preventDefault(), l.stopPropagation(), i == null || i(l);
1139
+ l.preventDefault(), l.stopPropagation(), s == null || s(l);
1138
1140
  },
1139
1141
  onDrop: (l) => {
1140
1142
  l.stopPropagation(), l.currentTarget.classList.remove("rmap-drag-over");
@@ -1145,7 +1147,7 @@ const Ee = ({ children: e }) => /* @__PURE__ */ c("ul", { className: "rmap-sorta
1145
1147
  p,
1146
1148
  ...m.slice(e, m.length)
1147
1149
  ].map((f, y) => ({ ...f, index: y }));
1148
- s == null || s(l, v);
1150
+ i == null || i(l, v);
1149
1151
  },
1150
1152
  onClick: (l) => {
1151
1153
  l.stopPropagation(), u == null || u(l);
@@ -1170,7 +1172,7 @@ const rr = z(function({
1170
1172
  className: `rmap-playlist-item${r ? " rmap-cur-played" : ""}`,
1171
1173
  "data-testid": "playlist-item",
1172
1174
  "aria-current": r ? "true" : void 0,
1173
- children: /* @__PURE__ */ w("div", { className: "rmap-playlist-item-contents", children: [
1175
+ children: /* @__PURE__ */ b("div", { className: "rmap-playlist-item-contents", children: [
1174
1176
  /* @__PURE__ */ c("div", { className: "rmap-playlist-album-cover", children: t.img && /* @__PURE__ */ c(
1175
1177
  "img",
1176
1178
  {
@@ -1179,7 +1181,7 @@ const rr = z(function({
1179
1181
  style: a == null ? void 0 : a.listThumbnail
1180
1182
  }
1181
1183
  ) }),
1182
- /* @__PURE__ */ w("div", { className: "rmap-playlist-album-info", children: [
1184
+ /* @__PURE__ */ b("div", { className: "rmap-playlist-album-info", children: [
1183
1185
  t.writer && /* @__PURE__ */ c("span", { className: "rmap-playlist-writer", children: t.writer }),
1184
1186
  t.name && /* @__PURE__ */ c("span", { className: "rmap-playlist-title", children: t.name }),
1185
1187
  t.description && /* @__PURE__ */ c("div", { className: "rmap-playlist-description", children: t.description })
@@ -1190,7 +1192,7 @@ const rr = z(function({
1190
1192
  }), ar = ({
1191
1193
  setIsOpen: e
1192
1194
  }) => {
1193
- const { playList: t } = $(), { activeUI: n } = M(), a = A(b), [r, i] = N(0), s = E(
1195
+ const { playList: t } = $(), { activeUI: n } = x(), a = E(w), [r, s] = N(0), i = g(
1194
1196
  (o) => {
1195
1197
  a({
1196
1198
  type: "SET_CURRENT_AUDIO",
@@ -1208,7 +1210,7 @@ const rr = z(function({
1208
1210
  sortableItemEventProps: {
1209
1211
  draggable: n.playList !== "unSortable",
1210
1212
  dragStartIdx: r,
1211
- onDragStart: (o) => i(o),
1213
+ onDragStart: (o) => s(o),
1212
1214
  onDrop: (o, u) => a({
1213
1215
  type: "UPDATE_PLAY_LIST",
1214
1216
  playList: u
@@ -1217,17 +1219,17 @@ const rr = z(function({
1217
1219
  type: "UPDATE_PLAY_LIST",
1218
1220
  playList: o
1219
1221
  }),
1220
- onClick: (o) => s(o)
1222
+ onClick: (o) => i(o)
1221
1223
  }
1222
1224
  };
1223
1225
  }, nr = () => {
1224
- const { playList: e } = $(), { isOpen: t, setIsOpen: n } = A(ie), a = he(xe), r = he(Me), { cssTransitionEventProps: i, sortableItemEventProps: s } = ar({
1226
+ const { playList: e } = $(), { isOpen: t, setIsOpen: n } = E(se), a = he(xe), r = he(Me), { cssTransitionEventProps: s, sortableItemEventProps: i } = ar({
1225
1227
  setIsOpen: n
1226
1228
  }), {
1227
1229
  onClick: o,
1228
1230
  onDragStart: u,
1229
1231
  ...d
1230
- } = s;
1232
+ } = i;
1231
1233
  if (!a) return /* @__PURE__ */ c(G, {});
1232
1234
  const l = e.length === 0;
1233
1235
  return l && !r ? /* @__PURE__ */ c(G, {}) : Rt.createPortal(
@@ -1239,7 +1241,7 @@ const rr = z(function({
1239
1241
  enterTime: 20,
1240
1242
  leaveTime: 20,
1241
1243
  clearTime: 300,
1242
- ...i,
1244
+ ...s,
1243
1245
  children: /* @__PURE__ */ c("div", { className: "rmap-playlist-container", children: l ? r : /* @__PURE__ */ c(Ee, { children: e.map((m, p) => /* @__PURE__ */ c(
1244
1246
  Ee.Item,
1245
1247
  {
@@ -1259,7 +1261,7 @@ const rr = z(function({
1259
1261
  }, or = () => {
1260
1262
  const { customIcons: e } = L();
1261
1263
  return /* @__PURE__ */ c(
1262
- D,
1264
+ _,
1263
1265
  {
1264
1266
  render: /* @__PURE__ */ c(Je, { size: "100%" }),
1265
1267
  customIcon: e == null ? void 0 : e.playList
@@ -1271,8 +1273,8 @@ const rr = z(function({
1271
1273
  visible: n,
1272
1274
  ...a
1273
1275
  }) => {
1274
- const { playListExpanded: r } = M(), i = e ?? r, s = B("playList", t);
1275
- return /* @__PURE__ */ c(_.Item, { gridArea: s, visible: n ?? !0, ...a, children: /* @__PURE__ */ w(oe, { initialOpen: i, children: [
1276
+ const { playListExpanded: r } = x(), s = e ?? r, i = B("playList", t);
1277
+ return /* @__PURE__ */ c(M.Item, { gridArea: i, visible: n ?? !0, ...a, children: /* @__PURE__ */ b(oe, { initialOpen: s, children: [
1276
1278
  /* @__PURE__ */ c(
1277
1279
  oe.Trigger,
1278
1280
  {
@@ -1286,24 +1288,24 @@ const rr = z(function({
1286
1288
  }, ee = (e) => {
1287
1289
  const t = `${Math.floor(e / 60)}`.padStart(2, "0"), n = `${Math.floor(e % 60)}`.padStart(2, "0");
1288
1290
  return `${t}:${n}`;
1289
- }, pe = (e, t, n = 0) => {
1291
+ }, me = (e, t, n = 0) => {
1290
1292
  if (!t) return n;
1291
1293
  const a = e / t;
1292
1294
  return isFinite(a) ? a : n;
1293
1295
  }, yt = () => {
1294
- const { isLoadedMetaData: e } = k(), { elementRefs: t } = L(), [n, a] = N(!1), r = E(
1295
- (i) => {
1296
+ const { isLoadedMetaData: e } = k(), { elementRefs: t } = L(), [n, a] = N(!1), r = g(
1297
+ (s) => {
1296
1298
  if (!(t != null && t.audioEl) || !e) return;
1297
- const { clientX: s } = i, { clientWidth: o } = i.currentTarget, u = i.currentTarget.getBoundingClientRect(), d = s - u.x, l = pe(d, o) * t.audioEl.duration;
1299
+ const { clientX: i } = s, { clientWidth: o } = s.currentTarget, u = s.currentTarget.getBoundingClientRect(), d = i - u.x, l = me(d, o) * t.audioEl.duration;
1298
1300
  t.audioEl.currentTime = l;
1299
1301
  },
1300
1302
  [e, t == null ? void 0 : t.audioEl]
1301
1303
  );
1302
- return P(() => {
1304
+ return A(() => {
1303
1305
  if (!n) return;
1304
- const i = (s) => s.preventDefault();
1305
- return document.addEventListener("selectstart", i), () => {
1306
- document.removeEventListener("selectstart", i);
1306
+ const s = (i) => i.preventDefault();
1307
+ return document.addEventListener("selectstart", s), () => {
1308
+ document.removeEventListener("selectstart", s);
1307
1309
  };
1308
1310
  }, [n]), {
1309
1311
  onMouseDown: () => a(!0),
@@ -1314,34 +1316,34 @@ const rr = z(function({
1314
1316
  };
1315
1317
  }, vt = (e) => {
1316
1318
  const { isLoadedMetaData: t } = k(), { elementRefs: n } = L();
1317
- return E(
1319
+ return g(
1318
1320
  (a) => {
1319
1321
  if (!(n != null && n.audioEl) || !t) return;
1320
1322
  const r = n.audioEl;
1321
- let i = null;
1323
+ let s = null;
1322
1324
  switch (a.key) {
1323
1325
  case "ArrowRight":
1324
1326
  case "ArrowUp":
1325
- a.preventDefault(), i = Math.min(r.currentTime + 5, r.duration);
1327
+ a.preventDefault(), s = Math.min(r.currentTime + 5, r.duration);
1326
1328
  break;
1327
1329
  case "ArrowLeft":
1328
1330
  case "ArrowDown":
1329
- a.preventDefault(), i = Math.max(r.currentTime - 5, 0);
1331
+ a.preventDefault(), s = Math.max(r.currentTime - 5, 0);
1330
1332
  break;
1331
1333
  case "Home":
1332
- a.preventDefault(), i = 0;
1334
+ a.preventDefault(), s = 0;
1333
1335
  break;
1334
1336
  case "End":
1335
- a.preventDefault(), i = r.duration;
1337
+ a.preventDefault(), s = r.duration;
1336
1338
  break;
1337
1339
  }
1338
- i !== null && isFinite(r.duration) && (r.currentTime = i, e == null || e(i, r.duration));
1340
+ s !== null && isFinite(r.duration) && (r.currentTime = s, e == null || e(s, r.duration));
1339
1341
  },
1340
1342
  [n == null ? void 0 : n.audioEl, t, e]
1341
1343
  );
1342
- }, ir = () => {
1343
- const { currentTime: e, duration: t } = re(), n = S(null), [a, r] = N(0);
1344
- P(() => {
1344
+ }, sr = () => {
1345
+ const { currentTime: e, duration: t } = re(), n = P(null), [a, r] = N(0);
1346
+ A(() => {
1345
1347
  const d = n.current;
1346
1348
  if (!d) return;
1347
1349
  r(d.offsetWidth);
@@ -1350,8 +1352,8 @@ const rr = z(function({
1350
1352
  });
1351
1353
  return l.observe(d), () => l.disconnect();
1352
1354
  }, []);
1353
- const i = pe(e, t), s = yt(), o = vt(), u = i * a;
1354
- return /* @__PURE__ */ w(
1355
+ const s = me(e, t), i = yt(), o = vt(), u = s * a;
1356
+ return /* @__PURE__ */ b(
1355
1357
  "div",
1356
1358
  {
1357
1359
  ref: n,
@@ -1362,18 +1364,18 @@ const rr = z(function({
1362
1364
  "aria-label": "Seek",
1363
1365
  "aria-valuemin": 0,
1364
1366
  "aria-valuemax": 100,
1365
- "aria-valuenow": Math.round(i * 100),
1367
+ "aria-valuenow": Math.round(s * 100),
1366
1368
  "aria-valuetext": `${ee(
1367
1369
  e
1368
1370
  )} of ${ee(t)}`,
1369
1371
  onKeyDown: o,
1370
- ...s,
1372
+ ...i,
1371
1373
  children: [
1372
1374
  /* @__PURE__ */ c("div", { className: "rmap-progress-bar", children: /* @__PURE__ */ c(
1373
1375
  "div",
1374
1376
  {
1375
1377
  className: "rmap-progress-fill",
1376
- style: { transform: `scaleX(${i})` }
1378
+ style: { transform: `scaleX(${s})` }
1377
1379
  }
1378
1380
  ) }),
1379
1381
  /* @__PURE__ */ c(
@@ -1388,20 +1390,20 @@ const rr = z(function({
1388
1390
  ]
1389
1391
  }
1390
1392
  );
1391
- }, sr = (e, t) => {
1392
- const n = S(), a = E(() => {
1393
+ }, ir = (e, t) => {
1394
+ const n = P(), a = g(() => {
1393
1395
  const r = document.getElementsByClassName("rmap-player-provider")[0];
1394
1396
  if (!r) return;
1395
- const i = Object.entries(
1397
+ const s = Object.entries(
1396
1398
  e
1397
1399
  ).reduce(
1398
- (s, [o, u]) => ({
1399
- ...s,
1400
+ (i, [o, u]) => ({
1401
+ ...i,
1400
1402
  [o]: window.getComputedStyle(r).getPropertyValue(`${u}`)
1401
1403
  }),
1402
1404
  {}
1403
1405
  );
1404
- n.current = i;
1406
+ n.current = s;
1405
1407
  }, [e]);
1406
1408
  return ge(() => {
1407
1409
  a();
@@ -1417,15 +1419,15 @@ const rr = z(function({
1417
1419
  for (const [n, a] of Object.entries(t.mediaListeners))
1418
1420
  t.media.removeEventListener(n, a);
1419
1421
  }, ur = (e) => {
1420
- const t = A(b), { isPlaying: n } = k(), { curPlayId: a } = $(), { elementRefs: r } = L(), { colorScheme: i } = M(), s = sr(cr, i), o = S(r == null ? void 0 : r.waveformInst);
1421
- o.current = r == null ? void 0 : r.waveformInst, P(() => {
1422
+ const t = E(w), { isPlaying: n } = k(), { curPlayId: a } = $(), { elementRefs: r } = L(), { colorScheme: s } = x(), i = ir(cr, s), o = P(r == null ? void 0 : r.waveformInst);
1423
+ o.current = r == null ? void 0 : r.waveformInst, A(() => {
1422
1424
  var v, f;
1423
- if (r != null && r.waveformInst || !((v = s.current) != null && v.progressColor) || !((f = s.current) != null && f.waveColor))
1425
+ if (r != null && r.waveformInst || !((v = i.current) != null && v.progressColor) || !((f = i.current) != null && f.waveColor))
1424
1426
  return;
1425
1427
  let p = !1;
1426
1428
  return import("./wavesurfer-_j5aw4gZ.mjs").then((y) => y.w).then(({ default: y }) => {
1427
- var h, g;
1428
- if (p || !e.current || !((h = s.current) != null && h.progressColor) || !((g = s.current) != null && g.waveColor)) {
1429
+ var h, S;
1430
+ if (p || !e.current || !((h = i.current) != null && h.progressColor) || !((S = i.current) != null && S.waveColor)) {
1429
1431
  console.error("[useWaveSurfer] missing required dependencies");
1430
1432
  return;
1431
1433
  }
@@ -1436,17 +1438,17 @@ const rr = z(function({
1436
1438
  cursorWidth: 2,
1437
1439
  container: e.current,
1438
1440
  height: 80,
1439
- progressColor: s.current.progressColor,
1441
+ progressColor: i.current.progressColor,
1440
1442
  responsive: !0,
1441
- waveColor: s.current.waveColor,
1443
+ waveColor: i.current.waveColor,
1442
1444
  cursorColor: "var(--rm-audio-player-waveform-cursor)",
1443
1445
  backend: "MediaElement",
1444
1446
  removeMediaElementOnDestroy: !1
1445
1447
  });
1446
- } catch (C) {
1448
+ } catch (D) {
1447
1449
  console.error(
1448
1450
  "[useWaveSurfer] failed to create WaveSurfer instance",
1449
- C
1451
+ D
1450
1452
  );
1451
1453
  return;
1452
1454
  }
@@ -1459,9 +1461,9 @@ const rr = z(function({
1459
1461
  }), () => {
1460
1462
  p = !0;
1461
1463
  };
1462
- }, [r == null ? void 0 : r.waveformInst, t, s]);
1463
- const u = S(a);
1464
- P(() => {
1464
+ }, [r == null ? void 0 : r.waveformInst, t, i]);
1465
+ const u = P(a);
1466
+ A(() => {
1465
1467
  if (!(r != null && r.audioEl) || !(r != null && r.waveformInst)) return;
1466
1468
  const p = r.audioEl;
1467
1469
  if (!p.getAttribute("src")) return;
@@ -1475,7 +1477,7 @@ const rr = z(function({
1475
1477
  return v.on("ready", h), () => {
1476
1478
  v.un("ready", h);
1477
1479
  };
1478
- }, [a, r == null ? void 0 : r.audioEl, r == null ? void 0 : r.waveformInst]), P(() => {
1480
+ }, [a, r == null ? void 0 : r.audioEl, r == null ? void 0 : r.waveformInst]), A(() => {
1479
1481
  if (!e.current || !(r != null && r.waveformInst)) return;
1480
1482
  const p = () => {
1481
1483
  var f, y;
@@ -1484,7 +1486,7 @@ const rr = z(function({
1484
1486
  return v.observe(e.current), () => {
1485
1487
  v.disconnect();
1486
1488
  };
1487
- }, [r == null ? void 0 : r.waveformInst, e]), P(
1489
+ }, [r == null ? void 0 : r.waveformInst, e]), A(
1488
1490
  () => () => {
1489
1491
  var v, f;
1490
1492
  const p = (v = e.current) == null ? void 0 : v.querySelector("wave");
@@ -1500,24 +1502,24 @@ const rr = z(function({
1500
1502
  var y, T;
1501
1503
  const p = o.current;
1502
1504
  if (!(p != null && p.isReady)) return;
1503
- const v = (y = s.current) == null ? void 0 : y.waveColor, f = (T = s.current) == null ? void 0 : T.progressColor;
1505
+ const v = (y = i.current) == null ? void 0 : y.waveColor, f = (T = i.current) == null ? void 0 : T.progressColor;
1504
1506
  v && p.setWaveColor(v), f && p.setProgressColor(f);
1505
- }, l = S(d);
1507
+ }, l = P(d);
1506
1508
  l.current = d;
1507
- const m = S(i);
1508
- P(() => {
1509
- m.current !== i && (m.current = i, l.current());
1510
- }, [i, r == null ? void 0 : r.waveformInst]), P(() => {
1509
+ const m = P(s);
1510
+ A(() => {
1511
+ m.current !== s && (m.current = s, l.current());
1512
+ }, [s, r == null ? void 0 : r.waveformInst]), A(() => {
1511
1513
  const p = () => l.current(), v = window.matchMedia("(prefers-color-scheme: dark)");
1512
1514
  return v.addEventListener("change", p), () => v.removeEventListener("change", p);
1513
1515
  }, []);
1514
1516
  }, dr = ({ isActive: e }) => {
1515
1517
  var u, d, l, m;
1516
- const t = S(null), { isLoadedMetaData: n, isPlaying: a } = k(), { elementRefs: r } = L();
1517
- ur(t), P(() => {
1518
+ const t = P(null), { isLoadedMetaData: n, isPlaying: a } = k(), { elementRefs: r } = L();
1519
+ ur(t), A(() => {
1518
1520
  if (!e || !(r != null && r.waveformInst) || !(r != null && r.audioEl) || !n || a)
1519
1521
  return;
1520
- const p = pe(
1522
+ const p = me(
1521
1523
  r.audioEl.currentTime,
1522
1524
  r.audioEl.duration
1523
1525
  );
@@ -1529,13 +1531,13 @@ const rr = z(function({
1529
1531
  r == null ? void 0 : r.audioEl,
1530
1532
  a
1531
1533
  ]);
1532
- const i = yt(), s = E(
1534
+ const s = yt(), i = g(
1533
1535
  (p, v) => {
1534
1536
  var f;
1535
- v && ((f = r == null ? void 0 : r.waveformInst) == null || f.seekTo(pe(p, v)));
1537
+ v && ((f = r == null ? void 0 : r.waveformInst) == null || f.seekTo(me(p, v)));
1536
1538
  },
1537
1539
  [r == null ? void 0 : r.waveformInst]
1538
- ), o = vt(s);
1540
+ ), o = vt(i);
1539
1541
  return /* @__PURE__ */ c("div", { className: "rmap-waveform-wrapper", "data-active": e, children: /* @__PURE__ */ c(
1540
1542
  "div",
1541
1543
  {
@@ -1553,7 +1555,7 @@ const rr = z(function({
1553
1555
  ((l = r == null ? void 0 : r.audioEl) == null ? void 0 : l.currentTime) ?? 0
1554
1556
  )} of ${ee(((m = r == null ? void 0 : r.audioEl) == null ? void 0 : m.duration) ?? 0)}`,
1555
1557
  onKeyDown: o,
1556
- ...i
1558
+ ...s
1557
1559
  }
1558
1560
  ) });
1559
1561
  }, ft = ({
@@ -1563,26 +1565,26 @@ const rr = z(function({
1563
1565
  width: a,
1564
1566
  ...r
1565
1567
  }) => {
1566
- const { activeUI: i } = M(), s = n ?? (i.progress === "waveform" ? "waveform" : "bar"), o = s === "waveform", u = s === "bar", [d, l] = N(o);
1567
- P(() => {
1568
+ const { activeUI: s } = x(), i = n ?? (s.progress === "waveform" ? "waveform" : "bar"), o = i === "waveform", u = i === "bar", [d, l] = N(o);
1569
+ A(() => {
1568
1570
  o && !d && l(!0);
1569
1571
  }, [o, d]);
1570
1572
  const m = B("progress", e);
1571
1573
  return /* @__PURE__ */ c(
1572
- _.Item,
1574
+ M.Item,
1573
1575
  {
1574
1576
  gridArea: m,
1575
1577
  width: a ?? "100%",
1576
1578
  visible: t ?? !0,
1577
1579
  ...r,
1578
- children: /* @__PURE__ */ w("div", { className: "rmap-progress-container", children: [
1580
+ children: /* @__PURE__ */ b("div", { className: "rmap-progress-container", children: [
1579
1581
  d && /* @__PURE__ */ c(dr, { isActive: o }),
1580
- u && /* @__PURE__ */ c(ir, {})
1582
+ u && /* @__PURE__ */ c(sr, {})
1581
1583
  ] })
1582
1584
  }
1583
1585
  );
1584
- }, me = K(null);
1585
- me.displayName = "DropdownContext";
1586
+ }, ie = K(null);
1587
+ ie.displayName = "DropdownContext";
1586
1588
  const Tt = ({
1587
1589
  clickArea: e,
1588
1590
  triggerType: t,
@@ -1590,19 +1592,19 @@ const Tt = ({
1590
1592
  setIsOpen: a,
1591
1593
  onOpenChange: r
1592
1594
  }) => {
1593
- const i = S(), s = (l) => {
1595
+ const s = P(), i = (l) => {
1594
1596
  const m = () => {
1595
- clearTimeout(i.current), i.current = void 0;
1597
+ clearTimeout(s.current), s.current = void 0;
1596
1598
  }, p = (v) => {
1597
1599
  a(v), r && r(v), m();
1598
1600
  };
1599
1601
  if (m(), l) {
1600
- i.current = window.setTimeout(() => p(!0), 100);
1602
+ s.current = window.setTimeout(() => p(!0), 100);
1601
1603
  return;
1602
1604
  }
1603
- i.current = window.setTimeout(() => p(!1), 100);
1605
+ s.current = window.setTimeout(() => p(!1), 100);
1604
1606
  }, o = (l) => {
1605
- t === "hover" && s(l);
1607
+ t === "hover" && i(l);
1606
1608
  };
1607
1609
  return {
1608
1610
  onClick: e === "content" ? (l) => {
@@ -1616,50 +1618,50 @@ const Tt = ({
1616
1618
  onFocus: () => o(!0),
1617
1619
  onBlur: () => o(!1)
1618
1620
  };
1619
- }, j = ({
1621
+ }, W = ({
1620
1622
  triggerType: e = "click",
1621
1623
  outboundClickActive: t = !0,
1622
1624
  children: n,
1623
1625
  isOpen: a,
1624
1626
  placement: r = "bottom",
1625
- disabled: i = !1,
1626
- onOpenChange: s,
1627
+ disabled: s = !1,
1628
+ onOpenChange: i,
1627
1629
  "data-testid": o
1628
1630
  }) => {
1629
- const u = S(null), [d, l] = te.Children.toArray(n), [m, p] = N(!1), v = Tt({
1631
+ const u = P(null), [d, l] = te.Children.toArray(n), [m, p] = N(!1), v = Tt({
1630
1632
  setIsOpen: p,
1631
1633
  isOpen: m,
1632
1634
  triggerType: e,
1633
1635
  clickArea: "root"
1634
1636
  }), f = $e();
1635
- dt(u, () => t && p(!1)), P(() => {
1637
+ dt(u, () => t && p(!1)), A(() => {
1636
1638
  a !== void 0 && p(a);
1637
1639
  }, [a]);
1638
- const y = x(
1640
+ const y = C(
1639
1641
  () => ({
1640
1642
  dropdownRef: u,
1641
1643
  placement: r,
1642
1644
  isOpen: m,
1643
1645
  setIsOpen: p,
1644
- onOpenChange: s,
1646
+ onOpenChange: i,
1645
1647
  dropdownId: f
1646
1648
  }),
1647
- [r, m, s, f]
1649
+ [r, m, i, f]
1648
1650
  );
1649
- return /* @__PURE__ */ c(me.Provider, { value: y, children: /* @__PURE__ */ c(
1651
+ return /* @__PURE__ */ c(ie.Provider, { value: y, children: /* @__PURE__ */ c(
1650
1652
  "div",
1651
1653
  {
1652
1654
  className: "rmap-dropdown-container",
1653
1655
  ref: u,
1654
1656
  "data-testid": o,
1655
1657
  ...v,
1656
- children: /* @__PURE__ */ w(G, { children: [
1658
+ children: /* @__PURE__ */ b(G, { children: [
1657
1659
  d,
1658
- !i && l
1660
+ !s && l
1659
1661
  ] })
1660
1662
  }
1661
1663
  ) });
1662
- }, pr = (e, t) => x(() => {
1664
+ }, pr = (e, t) => C(() => {
1663
1665
  if (t)
1664
1666
  return {
1665
1667
  position: "absolute",
@@ -1675,12 +1677,12 @@ const Tt = ({
1675
1677
  isWithAnimation: t = !0,
1676
1678
  ...n
1677
1679
  }) => {
1678
- const { dropdownRef: a, placement: r, isOpen: i, setIsOpen: s, dropdownId: o } = A(me), [u, d] = N(), { onClick: l } = Tt({
1679
- setIsOpen: s,
1680
- isOpen: i,
1680
+ const { dropdownRef: a, placement: r, isOpen: s, setIsOpen: i, dropdownId: o } = E(ie), [u, d] = N(), { onClick: l } = Tt({
1681
+ setIsOpen: i,
1682
+ isOpen: s,
1681
1683
  clickArea: "content"
1682
- }), m = () => s(!1), p = () => s(!0);
1683
- P(() => {
1684
+ }), m = () => i(!1), p = () => i(!0);
1685
+ A(() => {
1684
1686
  a.current && d({
1685
1687
  width: a.current.offsetWidth,
1686
1688
  height: a.current.offsetHeight
@@ -1699,7 +1701,7 @@ const Tt = ({
1699
1701
  return t ? /* @__PURE__ */ c(
1700
1702
  Ce,
1701
1703
  {
1702
- visible: i,
1704
+ visible: s,
1703
1705
  name: "rmap-dropdown-content",
1704
1706
  enterTime: 20,
1705
1707
  leaveTime: 60,
@@ -1708,38 +1710,38 @@ const Tt = ({
1708
1710
  onEntered: p,
1709
1711
  children: f
1710
1712
  }
1711
- ) : i ? f : null;
1713
+ ) : s ? f : null;
1712
1714
  }, ht = Pe(({ children: e, className: t, ...n }, a) => {
1713
- const { isOpen: r, dropdownId: i } = A(me), s = t ? `rmap-dropdown-trigger ${t}` : "rmap-dropdown-trigger";
1715
+ const { isOpen: r, dropdownId: s } = E(ie), i = t ? `rmap-dropdown-trigger ${t}` : "rmap-dropdown-trigger";
1714
1716
  return /* @__PURE__ */ c(
1715
1717
  q,
1716
1718
  {
1717
- className: s,
1719
+ className: i,
1718
1720
  type: "button",
1719
1721
  ...n,
1720
1722
  "aria-haspopup": "true",
1721
1723
  "aria-expanded": r,
1722
- "aria-controls": i,
1724
+ "aria-controls": s,
1723
1725
  ref: a,
1724
1726
  children: e
1725
1727
  }
1726
1728
  );
1727
1729
  });
1728
1730
  ht.displayName = "DropdownTrigger";
1729
- j.Content = mr;
1730
- j.Trigger = ht;
1731
+ W.Content = mr;
1732
+ W.Trigger = ht;
1731
1733
  const yr = ({
1732
1734
  triggerRef: e,
1733
1735
  initialState: t
1734
1736
  }) => {
1735
- const { playerPlacement: n } = M(), [a, r] = N(t);
1736
- return P(() => {
1737
+ const { playerPlacement: n } = x(), [a, r] = N(t);
1738
+ return A(() => {
1737
1739
  if (e.current) {
1738
- const i = () => e.current.getBoundingClientRect().top < window.innerHeight / 2 ? "bottom" : "top", s = setTimeout(() => {
1739
- r(i());
1740
+ const s = () => e.current.getBoundingClientRect().top < window.innerHeight / 2 ? "bottom" : "top", i = setTimeout(() => {
1741
+ r(s());
1740
1742
  }, 0);
1741
1743
  return () => {
1742
- clearTimeout(s);
1744
+ clearTimeout(i);
1743
1745
  };
1744
1746
  }
1745
1747
  }, [n, e]), a;
@@ -1750,14 +1752,14 @@ const yr = ({
1750
1752
  triggerRef: a,
1751
1753
  defaults: r
1752
1754
  }) => {
1753
- const i = yr({
1755
+ const s = yr({
1754
1756
  triggerRef: a,
1755
1757
  initialState: r.placement
1756
- }), s = e ?? r.triggerType;
1758
+ }), i = e ?? r.triggerType;
1757
1759
  return {
1758
- triggerType: s,
1759
- placement: t ?? n ?? i,
1760
- contentRole: s === "hover" ? "tooltip" : "dialog"
1760
+ triggerType: i,
1761
+ placement: t ?? n ?? s,
1762
+ contentRole: i === "hover" ? "tooltip" : "dialog"
1761
1763
  };
1762
1764
  }, vr = [
1763
1765
  0.5,
@@ -1767,77 +1769,91 @@ const yr = ({
1767
1769
  1.5,
1768
1770
  1.75,
1769
1771
  2
1770
- ], fr = (e) => `${e}×`, _e = z(
1772
+ ], fr = (e) => `${e}×`, Tr = ({
1773
+ rateOptions: e,
1774
+ playbackRate: t,
1775
+ formatRateLabel: n
1776
+ }) => {
1777
+ const a = E(w), { setIsOpen: r } = E(ie), s = g(
1778
+ (i) => {
1779
+ const o = Number(i.currentTarget.dataset.rate);
1780
+ a({ type: "SET_PLAYBACK_RATE", playbackRate: o }), r(!1);
1781
+ },
1782
+ [a, r]
1783
+ );
1784
+ return /* @__PURE__ */ c(
1785
+ "div",
1786
+ {
1787
+ role: "group",
1788
+ "aria-label": "Playback speed",
1789
+ className: "rmap-speed-selector-menu",
1790
+ children: e.map((i) => {
1791
+ const o = i === t;
1792
+ return /* @__PURE__ */ c(
1793
+ "button",
1794
+ {
1795
+ type: "button",
1796
+ "aria-pressed": o,
1797
+ className: o ? "rmap-speed-selector-option rmap-speed-selector-option--active" : "rmap-speed-selector-option",
1798
+ "data-testid": "speed-selector-option",
1799
+ "data-rate": i,
1800
+ onClick: s,
1801
+ children: n(i)
1802
+ },
1803
+ i
1804
+ );
1805
+ })
1806
+ }
1807
+ );
1808
+ }, _e = z(
1771
1809
  function({
1772
1810
  gridArea: t,
1773
1811
  visible: n,
1774
1812
  options: a,
1775
1813
  formatRate: r,
1776
- triggerType: i,
1777
- placement: s,
1814
+ triggerType: s,
1815
+ placement: i,
1778
1816
  ...o
1779
1817
  }) {
1780
- const u = S(null), { playbackRate: d } = k(), l = A(
1781
- b
1782
- ), { speedSelectorPlacement: m } = M(), p = B("playbackRate", t), v = a ?? vr, f = r ?? fr, { triggerType: y, placement: T } = gt({
1783
- triggerType: i,
1784
- placement: s,
1785
- contextPlacement: m,
1818
+ const u = P(null), { playbackRate: d } = k(), { speedSelectorPlacement: l } = x(), m = B("playbackRate", t), p = a ?? vr, v = r ?? fr, { triggerType: f, placement: y } = gt({
1819
+ triggerType: s,
1820
+ placement: i,
1821
+ contextPlacement: l,
1786
1822
  triggerRef: u,
1787
1823
  defaults: { triggerType: "click", placement: "top" }
1788
- }), h = E(
1789
- (g) => {
1790
- l({ type: "SET_PLAYBACK_RATE", playbackRate: g });
1791
- },
1792
- [l]
1793
- );
1824
+ });
1794
1825
  return /* @__PURE__ */ c(
1795
- _.Item,
1826
+ M.Item,
1796
1827
  {
1797
- gridArea: p,
1828
+ gridArea: m,
1798
1829
  visible: n ?? !0,
1830
+ padding: "0",
1799
1831
  ...o,
1800
- children: /* @__PURE__ */ w(
1801
- j,
1832
+ children: /* @__PURE__ */ b(
1833
+ W,
1802
1834
  {
1803
- triggerType: y,
1804
- placement: T,
1835
+ triggerType: f,
1836
+ placement: y,
1805
1837
  "data-testid": "speed-selector-dropdown",
1806
1838
  children: [
1807
1839
  /* @__PURE__ */ c(
1808
- j.Trigger,
1840
+ W.Trigger,
1809
1841
  {
1810
1842
  ref: u,
1811
- "aria-label": `Playback speed, currently ${f(
1843
+ "aria-label": `Playback speed, currently ${v(
1812
1844
  d
1813
1845
  )}`,
1814
1846
  className: "rmap-speed-selector-trigger",
1815
1847
  "data-testid": "speed-selector-trigger",
1816
- children: f(d)
1848
+ children: v(d)
1817
1849
  }
1818
1850
  ),
1819
- /* @__PURE__ */ c(j.Content, { children: /* @__PURE__ */ c(
1820
- "ul",
1851
+ /* @__PURE__ */ c(W.Content, { children: /* @__PURE__ */ c(
1852
+ Tr,
1821
1853
  {
1822
- role: "menu",
1823
- "aria-label": "Playback speed",
1824
- className: "rmap-speed-selector-menu",
1825
- children: v.map((g) => {
1826
- const C = g === d;
1827
- return /* @__PURE__ */ c("li", { role: "none", children: /* @__PURE__ */ c(
1828
- "button",
1829
- {
1830
- type: "button",
1831
- role: "menuitemradio",
1832
- "aria-checked": C,
1833
- className: C ? "rmap-speed-selector-option rmap-speed-selector-option--active" : "rmap-speed-selector-option",
1834
- "data-testid": "speed-selector-option",
1835
- "data-rate": g,
1836
- onClick: () => h(g),
1837
- children: f(g)
1838
- }
1839
- ) }, g);
1840
- })
1854
+ rateOptions: p,
1855
+ playbackRate: d,
1856
+ formatRateLabel: v
1841
1857
  }
1842
1858
  ) })
1843
1859
  ]
@@ -1848,21 +1864,21 @@ const yr = ({
1848
1864
  }
1849
1865
  );
1850
1866
  _e.displayName = "SpeedSelector";
1851
- const Tr = ({
1867
+ const hr = ({
1852
1868
  placement: e
1853
1869
  }) => {
1854
1870
  var m;
1855
- const t = S(null), { volume: n, muted: a } = k(), { elementRefs: r } = L(), i = A(b), s = E(
1871
+ const t = P(null), { volume: n, muted: a } = k(), { elementRefs: r } = L(), s = E(w), i = g(
1856
1872
  (p) => {
1857
- p.stopPropagation(), p.preventDefault(), a && i({ type: "SET_MUTED", muted: !1 });
1873
+ p.stopPropagation(), p.preventDefault(), a && s({ type: "SET_MUTED", muted: !1 });
1858
1874
  const { value: v } = p.target, f = parseFloat(v);
1859
- i({
1875
+ s({
1860
1876
  type: "SET_VOLUME",
1861
1877
  volume: f
1862
1878
  });
1863
1879
  },
1864
- [a, i]
1865
- ), o = n ?? ((m = r == null ? void 0 : r.audioEl) == null ? void 0 : m.volume) ?? 0, u = o * 100, d = Math.round(u), l = x(
1880
+ [a, s]
1881
+ ), o = n ?? ((m = r == null ? void 0 : r.audioEl) == null ? void 0 : m.volume) ?? 0, u = o * 100, d = Math.round(u), l = C(
1866
1882
  () => ({
1867
1883
  "--rm-audio-player-volume-value": `${u}%`
1868
1884
  }),
@@ -1883,7 +1899,7 @@ const Tr = ({
1883
1899
  type: "range",
1884
1900
  style: { cursor: "pointer" },
1885
1901
  value: o,
1886
- onChange: s,
1902
+ onChange: i,
1887
1903
  min: "0",
1888
1904
  max: "1",
1889
1905
  step: "0.01",
@@ -1900,13 +1916,13 @@ const Tr = ({
1900
1916
  placement: a,
1901
1917
  ...r
1902
1918
  }) => {
1903
- const i = S(null), { muted: s } = k(), o = A(b), u = E(
1904
- () => o({ type: "SET_MUTED", muted: !s }),
1905
- [o, s]
1919
+ const s = P(null), { muted: i } = k(), o = E(w), u = g(
1920
+ () => o({ type: "SET_MUTED", muted: !i }),
1921
+ [o, i]
1906
1922
  ), {
1907
1923
  activeUI: { volumeSlider: d },
1908
1924
  volumeSliderPlacement: l
1909
- } = M(), m = B("volume", e), {
1925
+ } = x(), m = B("volume", e), {
1910
1926
  triggerType: p,
1911
1927
  placement: v,
1912
1928
  contentRole: f
@@ -1914,11 +1930,11 @@ const Tr = ({
1914
1930
  triggerType: n,
1915
1931
  placement: a,
1916
1932
  contextPlacement: l,
1917
- triggerRef: i,
1933
+ triggerRef: s,
1918
1934
  defaults: { triggerType: "hover", placement: "bottom" }
1919
1935
  });
1920
- return /* @__PURE__ */ c(_.Item, { gridArea: m, visible: t ?? !0, ...r, children: /* @__PURE__ */ w(
1921
- j,
1936
+ return /* @__PURE__ */ c(M.Item, { gridArea: m, visible: t ?? !0, ...r, children: /* @__PURE__ */ b(
1937
+ W,
1922
1938
  {
1923
1939
  placement: v,
1924
1940
  triggerType: p,
@@ -1926,25 +1942,25 @@ const Tr = ({
1926
1942
  "data-testid": "volume-dropdown",
1927
1943
  children: [
1928
1944
  /* @__PURE__ */ c(
1929
- j.Trigger,
1945
+ W.Trigger,
1930
1946
  {
1931
- ref: i,
1932
- "aria-label": s ? "Unmute" : "Mute",
1933
- "aria-pressed": s,
1947
+ ref: s,
1948
+ "aria-label": i ? "Unmute" : "Mute",
1949
+ "aria-pressed": i,
1934
1950
  onClick: u,
1935
1951
  className: "rmap-volume-trigger",
1936
1952
  "data-testid": "volume-trigger-btn",
1937
- "data-muted": String(s),
1953
+ "data-muted": String(i),
1938
1954
  children: /* @__PURE__ */ c(ut, {})
1939
1955
  }
1940
1956
  ),
1941
- /* @__PURE__ */ c(j.Content, { role: f, children: /* @__PURE__ */ c(Tr, { placement: v }) })
1957
+ /* @__PURE__ */ c(W.Content, { role: f, children: /* @__PURE__ */ c(hr, { placement: v }) })
1942
1958
  ]
1943
1959
  }
1944
1960
  ) });
1945
- }, hr = () => {
1946
- const { activeUI: e } = M(), t = (n) => !!(e[n] ?? e.all);
1947
- return /* @__PURE__ */ w(G, { children: [
1961
+ }, gr = () => {
1962
+ const { activeUI: e } = x(), t = (n) => !!(e[n] ?? e.all);
1963
+ return /* @__PURE__ */ b(G, { children: [
1948
1964
  /* @__PURE__ */ c(ft, { visible: t("progress") }),
1949
1965
  /* @__PURE__ */ c(lt, { visible: t("repeatType") }),
1950
1966
  /* @__PURE__ */ c(ct, { visible: t("playButton") }),
@@ -1957,14 +1973,14 @@ const Tr = ({
1957
1973
  visible: n,
1958
1974
  ...a
1959
1975
  }) {
1960
- const { playList: r, curIdx: i } = $(), { coverImgsCss: s } = L(), o = r[i], u = [o == null ? void 0 : o.writer, o == null ? void 0 : o.name].filter(Boolean).join(" - ") || "Album artwork", d = B("artwork", t);
1961
- return /* @__PURE__ */ c(_.Item, { gridArea: d, visible: n ?? !0, ...a, children: /* @__PURE__ */ c("div", { className: "rmap-artwork-container", children: o != null && o.img ? /* @__PURE__ */ c("img", { src: o.img, alt: u, style: s == null ? void 0 : s.artwork }) : /* @__PURE__ */ c(
1976
+ const { playList: r, curIdx: s } = $(), { coverImgsCss: i } = L(), o = r[s], u = [o == null ? void 0 : o.writer, o == null ? void 0 : o.name].filter(Boolean).join(" - ") || "Album artwork", d = B("artwork", t);
1977
+ return /* @__PURE__ */ c(M.Item, { gridArea: d, visible: n ?? !0, ...a, children: /* @__PURE__ */ c("div", { className: "rmap-artwork-container", children: o != null && o.img ? /* @__PURE__ */ c("img", { src: o.img, alt: u, style: i == null ? void 0 : i.artwork }) : /* @__PURE__ */ c(
1962
1978
  "div",
1963
1979
  {
1964
1980
  className: "rmap-artwork-fallback",
1965
1981
  role: "img",
1966
1982
  "aria-label": u,
1967
- style: s == null ? void 0 : s.artwork,
1983
+ style: i == null ? void 0 : i.artwork,
1968
1984
  children: (o == null ? void 0 : o.name) || "♪"
1969
1985
  }
1970
1986
  ) }) });
@@ -1973,10 +1989,10 @@ const Tr = ({
1973
1989
  visible: n,
1974
1990
  ...a
1975
1991
  }) {
1976
- const { playList: r, curIdx: i } = $(), s = r[i], o = B("trackInfo", t);
1977
- return /* @__PURE__ */ c(_.Item, { gridArea: o, visible: n ?? !0, ...a, children: /* @__PURE__ */ c("div", { className: "rmap-track-info-container", children: s != null && s.customTrackInfo ? s.customTrackInfo : /* @__PURE__ */ w(G, { children: [
1978
- (s == null ? void 0 : s.name) && /* @__PURE__ */ c("span", { className: "title", "data-testid": "track-title", children: s.name }),
1979
- (s == null ? void 0 : s.writer) && /* @__PURE__ */ c("span", { className: "writer", children: s.writer })
1992
+ const { playList: r, curIdx: s } = $(), i = r[s], o = B("trackInfo", t);
1993
+ return /* @__PURE__ */ c(M.Item, { gridArea: o, visible: n ?? !0, ...a, children: /* @__PURE__ */ c("div", { className: "rmap-track-info-container", children: i != null && i.customTrackInfo ? i.customTrackInfo : /* @__PURE__ */ b(G, { children: [
1994
+ (i == null ? void 0 : i.name) && /* @__PURE__ */ c("span", { className: "title", "data-testid": "track-title", children: i.name }),
1995
+ (i == null ? void 0 : i.writer) && /* @__PURE__ */ c("span", { className: "writer", children: i.writer })
1980
1996
  ] }) }) });
1981
1997
  });
1982
1998
  De.displayName = "TrackInfo";
@@ -1988,7 +2004,7 @@ const Pt = ({ position: e, className: t, children: n, ...a }) => /* @__PURE__ */
1988
2004
  ...a,
1989
2005
  children: n
1990
2006
  }
1991
- ), gr = ({ position: e }) => {
2007
+ ), Er = ({ position: e }) => {
1992
2008
  const { currentTime: t } = re();
1993
2009
  return /* @__PURE__ */ c(Pt, { position: e, className: "rmap-track-time-current", children: /* @__PURE__ */ c(
1994
2010
  "span",
@@ -1998,7 +2014,7 @@ const Pt = ({ position: e, className: t, children: n, ...a }) => /* @__PURE__ */
1998
2014
  children: ee(t)
1999
2015
  }
2000
2016
  ) });
2001
- }, Er = ({ position: e }) => {
2017
+ }, Ar = ({ position: e }) => {
2002
2018
  const { duration: t } = re();
2003
2019
  return /* @__PURE__ */ c(
2004
2020
  Pt,
@@ -2009,10 +2025,10 @@ const Pt = ({ position: e, className: t, children: n, ...a }) => /* @__PURE__ */
2009
2025
  }
2010
2026
  );
2011
2027
  }, St = ({ visible: e }) => {
2012
- const t = B("trackTimeCurrent"), n = B("trackTimeDuration"), a = E(
2028
+ const t = B("trackTimeCurrent"), n = B("trackTimeDuration"), a = g(
2013
2029
  (d) => +d.split(/[^\d]/).join(""),
2014
2030
  []
2015
- ), r = a(t), i = a(n), s = E(
2031
+ ), r = a(t), s = a(n), i = g(
2016
2032
  (d) => {
2017
2033
  switch (d) {
2018
2034
  case 1:
@@ -2025,17 +2041,17 @@ const Pt = ({ position: e, className: t, children: n, ...a }) => /* @__PURE__ */
2025
2041
  },
2026
2042
  []
2027
2043
  ), o = {
2028
- current: s(r - i),
2029
- duration: s(i - r)
2044
+ current: i(r - s),
2045
+ duration: i(s - r)
2030
2046
  }, u = e ?? !0;
2031
- return /* @__PURE__ */ w(G, { children: [
2032
- /* @__PURE__ */ c(_.Item, { gridArea: t, visible: u, children: /* @__PURE__ */ c(gr, { position: o.current }) }),
2033
- /* @__PURE__ */ c(_.Item, { gridArea: n, visible: u, children: /* @__PURE__ */ c(Er, { position: o.duration }) })
2047
+ return /* @__PURE__ */ b(G, { children: [
2048
+ /* @__PURE__ */ c(M.Item, { gridArea: t, visible: u, children: /* @__PURE__ */ c(Er, { position: o.current }) }),
2049
+ /* @__PURE__ */ c(M.Item, { gridArea: n, visible: u, children: /* @__PURE__ */ c(Ar, { position: o.duration }) })
2034
2050
  ] });
2035
- }, Ar = () => {
2036
- var r, i, s, o;
2037
- const { playList: e, curIdx: t } = $(), { activeUI: n } = M(), a = !!(((r = e[t]) == null ? void 0 : r.customTrackInfo) ?? ((i = e[t]) == null ? void 0 : i.writer) ?? ((s = e[t]) == null ? void 0 : s.name)) && !!(n.trackInfo ?? n.all);
2038
- return /* @__PURE__ */ w(G, { children: [
2051
+ }, Pr = () => {
2052
+ var r, s, i, o;
2053
+ const { playList: e, curIdx: t } = $(), { activeUI: n } = x(), a = !!(((r = e[t]) == null ? void 0 : r.customTrackInfo) ?? ((s = e[t]) == null ? void 0 : s.writer) ?? ((i = e[t]) == null ? void 0 : i.name)) && !!(n.trackInfo ?? n.all);
2054
+ return /* @__PURE__ */ b(G, { children: [
2039
2055
  /* @__PURE__ */ c(
2040
2056
  At,
2041
2057
  {
@@ -2056,7 +2072,7 @@ const Pt = ({ position: e, className: t, children: n, ...a }) => /* @__PURE__ */
2056
2072
  TrackTime: { displayName: "TrackTime", activeUIKey: "trackTime" },
2057
2073
  SpeedSelector: { displayName: "SpeedSelector", activeUIKey: "playbackRate" }
2058
2074
  };
2059
- function Pr(e, t) {
2075
+ function Sr(e, t) {
2060
2076
  const n = e[t];
2061
2077
  return n === !1 ? !1 : n !== void 0 ? !0 : !!e.all;
2062
2078
  }
@@ -2066,53 +2082,53 @@ function Re(e) {
2066
2082
  const n = t.type ?? t;
2067
2083
  return n.displayName || n.name || void 0;
2068
2084
  }
2069
- const Sr = (e, t, n, a) => {
2070
- const r = x(
2085
+ const Ir = (e, t, n, a) => {
2086
+ const r = C(
2071
2087
  () => (a ?? []).map(Re).map(
2072
2088
  (h) => {
2073
- var g;
2074
- return h ? (g = Ae[h]) == null ? void 0 : g.activeUIKey : void 0;
2089
+ var S;
2090
+ return h ? (S = Ae[h]) == null ? void 0 : S.activeUIKey : void 0;
2075
2091
  }
2076
2092
  ).filter((h) => h !== void 0),
2077
2093
  [a]
2078
- ), i = x(
2094
+ ), s = C(
2079
2095
  () => [...r].sort().join(","),
2080
2096
  [r]
2081
- ), s = E(
2082
- (h, g, C, W) => {
2083
- const se = Object.keys(
2084
- de.templateArea
2085
- ).filter((I) => (I === "trackTimeCurrent" || I === "trackTimeDuration") && h.trackTime === !1 ? !1 : h[I] !== void 0 ? h[I] : !0), R = h.all ? se : Object.entries(h).filter(([, I]) => I).map(([I]) => I);
2086
- for (const I of W)
2097
+ ), i = g(
2098
+ (h, S, D, j) => {
2099
+ const ce = Object.keys(
2100
+ pe.templateArea
2101
+ ).filter((I) => (I === "trackTimeCurrent" || I === "trackTimeDuration") && h.trackTime === !1 ? !1 : h[I] !== void 0 ? h[I] : !0), R = h.all ? ce : Object.entries(h).filter(([, I]) => I).map(([I]) => I);
2102
+ for (const I of j)
2087
2103
  R.includes(I) || R.push(I);
2088
2104
  (() => {
2089
2105
  R.find((I) => I === "trackTime") && (R.splice(R.indexOf("trackTime"), 1), R.push("trackTimeCurrent"), R.push("trackTimeDuration"));
2090
2106
  })();
2091
2107
  const ae = {
2092
- ...de.templateArea,
2093
- ...g
2108
+ ...pe.templateArea,
2109
+ ...S
2094
2110
  }, ye = Object.entries(
2095
2111
  ae
2096
2112
  ).filter(([I]) => R.includes(I));
2097
- let le = 1;
2098
- const ue = {}, wt = [
2113
+ let ue = 1;
2114
+ const de = {}, bt = [
2099
2115
  ...ye,
2100
- ...Object.entries(C || {})
2116
+ ...Object.entries(D || {})
2101
2117
  ].flatMap(([I, U]) => {
2102
2118
  if (U == null) return [];
2103
2119
  const [F, H] = U.split("-"), Y = +F.split("row")[1];
2104
- return le = Math.max(le, Y), ue[Y] = ue[Y] ? ue[Y] + 1 : 1, [
2120
+ return ue = Math.max(ue, Y), de[Y] = de[Y] ? de[Y] + 1 : 1, [
2105
2121
  {
2106
2122
  key: I,
2107
2123
  row: Y,
2108
2124
  col: +H
2109
2125
  }
2110
2126
  ];
2111
- }).sort((I, U) => I.col - U.col), ve = Math.max(...Object.values(ue));
2127
+ }).sort((I, U) => I.col - U.col), ve = Math.max(...Object.values(de));
2112
2128
  let Ue;
2113
- const bt = new Array(le).fill("").map((I, U) => {
2129
+ const wt = new Array(ue).fill("").map((I, U) => {
2114
2130
  let F = "", H;
2115
- const Y = wt.filter((V) => V.row !== U + 1 ? !1 : (V.key === "progress" && (H = V), !0));
2131
+ const Y = bt.filter((V) => V.row !== U + 1 ? !1 : (V.key === "progress" && (H = V), !0));
2116
2132
  if (H) {
2117
2133
  const V = /* @__PURE__ */ new Map();
2118
2134
  Y.forEach((Q) => V.set(Q.col, Q));
@@ -2127,7 +2143,7 @@ const Sr = (e, t, n, a) => {
2127
2143
  for (let V = 0; V < ve; V++)
2128
2144
  F += ` row${U + 1}-${V + 1}`;
2129
2145
  return F.trimStart();
2130
- }), Lt = pt ? window.innerWidth - 100 : 1500, Nt = new Array(le).fill("").map((I, U) => {
2146
+ }), Lt = pt ? window.innerWidth - 100 : 1500, Nt = new Array(ue).fill("").map((I, U) => {
2131
2147
  let F = "";
2132
2148
  for (let H = 0; H < ve; H++) {
2133
2149
  if (Ue === H && U === 0) {
@@ -2138,37 +2154,37 @@ const Sr = (e, t, n, a) => {
2138
2154
  }
2139
2155
  return F.trimStart();
2140
2156
  });
2141
- return { gridAreas: bt, gridColumns: Nt };
2157
+ return { gridAreas: wt, gridColumns: Nt };
2142
2158
  },
2143
2159
  []
2144
- ), [o, u] = N(e), [d, l] = N(i), [m, p] = N({
2160
+ ), [o, u] = N(e), [d, l] = N(s), [m, p] = N({
2145
2161
  templateArea: t,
2146
2162
  customComponentsArea: n
2147
2163
  }), [v, f] = N();
2148
2164
  if (!v) {
2149
- const { gridAreas: h, gridColumns: g } = s(
2165
+ const { gridAreas: h, gridColumns: S } = i(
2150
2166
  o,
2151
2167
  m.templateArea,
2152
2168
  m.customComponentsArea,
2153
2169
  r
2154
2170
  );
2155
- return f({ gridAreas: h, gridColumns: g }), [h, g];
2171
+ return f({ gridAreas: h, gridColumns: S }), [h, S];
2156
2172
  }
2157
- if (o !== e || d !== i || m.templateArea !== t || m.customComponentsArea !== n) {
2158
- u(e), l(i), p({ templateArea: t, customComponentsArea: n });
2159
- const { gridAreas: h, gridColumns: g } = s(
2173
+ if (o !== e || d !== s || m.templateArea !== t || m.customComponentsArea !== n) {
2174
+ u(e), l(s), p({ templateArea: t, customComponentsArea: n });
2175
+ const { gridAreas: h, gridColumns: S } = i(
2160
2176
  e,
2161
2177
  t,
2162
2178
  n,
2163
2179
  r
2164
2180
  );
2165
- f({ gridAreas: h, gridColumns: g });
2181
+ f({ gridAreas: h, gridColumns: S });
2166
2182
  }
2167
2183
  const { gridAreas: y, gridColumns: T } = v;
2168
2184
  return [y, T];
2169
2185
  };
2170
- function Ir(e) {
2171
- return x(() => {
2186
+ function br(e) {
2187
+ return C(() => {
2172
2188
  const t = te.Children.toArray(e).filter(Dt), n = t.find(Be);
2173
2189
  return {
2174
2190
  compoundChildren: t.filter(
@@ -2186,26 +2202,26 @@ function wr(e) {
2186
2202
  const t = e.props;
2187
2203
  return (t == null ? void 0 : t.children) ?? null;
2188
2204
  }
2189
- function br({
2205
+ function Lr({
2190
2206
  compoundChildren: e,
2191
2207
  activeUI: t
2192
2208
  }) {
2193
2209
  const n = e.map(Re).filter((a) => !!(a && Ae[a])).sort().join(",");
2194
- P(() => {
2210
+ A(() => {
2195
2211
  if (process.env.NODE_ENV === "production" || !n) return;
2196
2212
  const a = /* @__PURE__ */ new Set();
2197
2213
  for (const r of n.split(",")) {
2198
- const i = Ae[r];
2199
- i && (a.has(i.displayName) || Pr(t, i.activeUIKey) && (a.add(i.displayName), console.warn(
2200
- `[react-modern-audio-player] Both preset and compound '${i.displayName}' are rendered. Set \`activeUI.${i.activeUIKey}=false\` to replace the preset control.`
2214
+ const s = Ae[r];
2215
+ s && (a.has(s.displayName) || Sr(t, s.activeUIKey) && (a.add(s.displayName), console.warn(
2216
+ `[react-modern-audio-player] Both preset and compound '${s.displayName}' are rendered. Set \`activeUI.${s.activeUIKey}=false\` to replace the preset control.`
2201
2217
  )));
2202
2218
  }
2203
2219
  }, [n, t]);
2204
2220
  }
2205
- const Lr = ({ children: e }) => {
2206
- const { interfacePlacement: t, activeUI: n, playListPlacement: a } = M(), { compoundChildren: r, playListEmptyNode: i } = Ir(e);
2207
- br({ compoundChildren: r, activeUI: n });
2208
- const [s, o] = Sr(
2221
+ const Nr = ({ children: e }) => {
2222
+ const { interfacePlacement: t, activeUI: n, playListPlacement: a } = x(), { compoundChildren: r, playListEmptyNode: s } = br(e);
2223
+ Lr({ compoundChildren: r, activeUI: n });
2224
+ const [i, o] = Ir(
2209
2225
  n,
2210
2226
  t == null ? void 0 : t.templateArea,
2211
2227
  t == null ? void 0 : t.customComponentsArea,
@@ -2218,45 +2234,60 @@ const Lr = ({ children: e }) => {
2218
2234
  "data-testid": "audio-player",
2219
2235
  role: "region",
2220
2236
  "aria-label": "Audio player",
2221
- children: /* @__PURE__ */ c(xe.Provider, { value: u, children: /* @__PURE__ */ w(Me.Provider, { value: i, children: [
2222
- a === "top" && /* @__PURE__ */ c("div", { ref: d, className: "rmap-sortable-playlist" }),
2223
- /* @__PURE__ */ w(
2224
- _,
2237
+ children: /* @__PURE__ */ c(xe.Provider, { value: u, children: /* @__PURE__ */ b(Me.Provider, { value: s, children: [
2238
+ a === "top" && /* @__PURE__ */ c(
2239
+ "div",
2240
+ {
2241
+ ref: d,
2242
+ className: "rmap-sortable-playlist",
2243
+ "data-testid": "sortable-playlist"
2244
+ }
2245
+ ),
2246
+ /* @__PURE__ */ b(
2247
+ M,
2225
2248
  {
2226
2249
  alignItems: "center",
2227
2250
  justifyContent: "center",
2228
- areas: s,
2251
+ areas: i,
2229
2252
  minHeight: "30px",
2230
2253
  columns: o,
2231
2254
  UNSAFE_className: "rmap-interface-grid",
2255
+ "data-testid": "interface-grid",
2232
2256
  children: [
2233
- /* @__PURE__ */ c(Ar, {}),
2234
- /* @__PURE__ */ c(hr, {}),
2257
+ /* @__PURE__ */ c(Pr, {}),
2258
+ /* @__PURE__ */ c(gr, {}),
2235
2259
  r
2236
2260
  ]
2237
2261
  }
2238
2262
  ),
2239
- a === "bottom" && /* @__PURE__ */ c("div", { ref: d, className: "rmap-sortable-playlist" })
2263
+ a === "bottom" && /* @__PURE__ */ c(
2264
+ "div",
2265
+ {
2266
+ ref: d,
2267
+ className: "rmap-sortable-playlist",
2268
+ "data-testid": "sortable-playlist"
2269
+ }
2270
+ )
2240
2271
  ] }) })
2241
2272
  }
2242
2273
  );
2243
2274
  }, Z = (e, t) => {
2244
- const n = S(!1);
2245
- P(() => {
2275
+ const n = P(!1);
2276
+ A(() => {
2246
2277
  if (n.current)
2247
2278
  return e();
2248
- }, t), P(() => (n.current = !0, () => {
2279
+ }, t), A(() => (n.current = !0, () => {
2249
2280
  n.current = !1;
2250
2281
  }), []);
2251
- }, Nr = ({
2282
+ }, kr = ({
2252
2283
  placement: e = {},
2253
2284
  activeUI: t,
2254
2285
  coverImgsCss: n,
2255
2286
  audioInitialState: a,
2256
2287
  playList: r,
2257
- customIcons: i
2288
+ customIcons: s
2258
2289
  }) => {
2259
- const s = A(b);
2290
+ const i = E(w);
2260
2291
  Z(() => {
2261
2292
  const {
2262
2293
  player: o,
@@ -2264,44 +2295,44 @@ const Lr = ({ children: e }) => {
2264
2295
  interface: d,
2265
2296
  volumeSlider: l
2266
2297
  } = e;
2267
- s({
2298
+ i({
2268
2299
  type: "SET_PLACEMENTS",
2269
2300
  playerPlacement: o,
2270
2301
  playListPlacement: u,
2271
2302
  interfacePlacement: d,
2272
2303
  volumeSliderPlacement: l
2273
2304
  });
2274
- }, [s, e]), Z(() => {
2275
- t && s({ type: "SET_ACTIVE_UI", activeUI: t });
2276
- }, [t, s]), Z(() => {
2277
- n && s({ type: "SET_COVER_IMGS_CSS", coverImgsCss: n });
2278
- }, [s, n]), Z(() => {
2279
- a && s({
2305
+ }, [i, e]), Z(() => {
2306
+ t && i({ type: "SET_ACTIVE_UI", activeUI: t });
2307
+ }, [t, i]), Z(() => {
2308
+ n && i({ type: "SET_COVER_IMGS_CSS", coverImgsCss: n });
2309
+ }, [i, n]), Z(() => {
2310
+ a && i({
2280
2311
  type: "SET_INITIAL_STATES",
2281
2312
  audioState: a,
2282
2313
  curPlayId: a.curPlayId
2283
2314
  });
2284
- }, [a, s]), Z(() => {
2285
- s({ type: "UPDATE_PLAY_LIST", playList: r });
2286
- }, [s, r]), Z(() => {
2287
- i && s({ type: "SET_CUSTOM_ICONS", customIcons: i });
2288
- }, [i, s]);
2289
- }, kr = ({
2315
+ }, [a, i]), Z(() => {
2316
+ i({ type: "UPDATE_PLAY_LIST", playList: r });
2317
+ }, [i, r]), Z(() => {
2318
+ s && i({ type: "SET_CUSTOM_ICONS", customIcons: s });
2319
+ }, [s, i]);
2320
+ }, Cr = ({
2290
2321
  audioRef: e,
2291
2322
  children: t,
2292
2323
  ...n
2293
- }) => (Nr(n), /* @__PURE__ */ w("div", { id: "rm-audio-player", className: "rmap-player-container", children: [
2324
+ }) => (kr(n), /* @__PURE__ */ b("div", { id: "rm-audio-player", className: "rmap-player-container", children: [
2294
2325
  /* @__PURE__ */ c(Ye, { audioRef: e }),
2295
- /* @__PURE__ */ c(Lr, { children: t })
2326
+ /* @__PURE__ */ c(Nr, { children: t })
2296
2327
  ] }));
2297
2328
  function It({
2298
2329
  rootContainerProps: e,
2299
2330
  ...t
2300
2331
  }) {
2301
- return /* @__PURE__ */ c(Bt, { ...t, children: /* @__PURE__ */ c(Ge, { rootContainerProps: e, children: /* @__PURE__ */ c(kr, { ...t }) }) });
2332
+ return /* @__PURE__ */ c(Bt, { ...t, children: /* @__PURE__ */ c(Ge, { rootContainerProps: e, children: /* @__PURE__ */ c(Cr, { ...t }) }) });
2302
2333
  }
2303
2334
  It.displayName = "AudioPlayerWithProviders";
2304
- const Kr = Object.assign(It, {
2335
+ const Vr = Object.assign(It, {
2305
2336
  Progress: ft,
2306
2337
  Volume: Et,
2307
2338
  PlayList: mt,
@@ -2313,14 +2344,14 @@ const Kr = Object.assign(It, {
2313
2344
  TrackInfo: De,
2314
2345
  TrackTime: St,
2315
2346
  CustomComponent: Gt
2316
- }), Cr = () => {
2317
- const e = A(b), { isPlaying: t, repeatType: n, playbackRate: a } = k(), r = E(() => {
2347
+ }), xr = () => {
2348
+ const e = E(w), { isPlaying: t, repeatType: n, playbackRate: a } = k(), r = g(() => {
2318
2349
  e({ type: "CHANGE_PLAYING_STATE", state: !0 });
2319
- }, [e]), i = E(() => {
2350
+ }, [e]), s = g(() => {
2320
2351
  e({ type: "CHANGE_PLAYING_STATE", state: !1 });
2321
- }, [e]), s = E(() => {
2352
+ }, [e]), i = g(() => {
2322
2353
  e({ type: "CHANGE_PLAYING_STATE" });
2323
- }, [e]), o = E(
2354
+ }, [e]), o = g(
2324
2355
  (u) => {
2325
2356
  e({ type: "SET_PLAYBACK_RATE", playbackRate: u });
2326
2357
  },
@@ -2331,12 +2362,12 @@ const Kr = Object.assign(It, {
2331
2362
  repeatType: n,
2332
2363
  playbackRate: a,
2333
2364
  play: r,
2334
- pause: i,
2335
- togglePlay: s,
2365
+ pause: s,
2366
+ togglePlay: i,
2336
2367
  setPlaybackRate: o
2337
2368
  };
2338
- }, xr = () => {
2339
- const e = A(b), { playList: t, curIdx: n, curPlayId: a } = $(), { elementRefs: r } = L(), i = E(
2369
+ }, Mr = () => {
2370
+ const e = E(w), { playList: t, curIdx: n, curPlayId: a } = $(), { elementRefs: r } = L(), s = g(
2340
2371
  (u) => {
2341
2372
  const d = t[u];
2342
2373
  d && e({
@@ -2346,9 +2377,9 @@ const Kr = Object.assign(It, {
2346
2377
  });
2347
2378
  },
2348
2379
  [e, t]
2349
- ), s = E(() => {
2380
+ ), i = g(() => {
2350
2381
  t.length !== 0 && e({ type: "NEXT_AUDIO" });
2351
- }, [e, t.length]), o = E(() => {
2382
+ }, [e, t.length]), o = g(() => {
2352
2383
  var d;
2353
2384
  if (t.length === 0) return;
2354
2385
  const u = ((d = r == null ? void 0 : r.audioEl) == null ? void 0 : d.currentTime) ?? 0;
@@ -2359,30 +2390,30 @@ const Kr = Object.assign(It, {
2359
2390
  currentIndex: n,
2360
2391
  playList: t,
2361
2392
  currentTrack: t[n] ?? null,
2362
- setTrack: i,
2363
- next: s,
2393
+ setTrack: s,
2394
+ next: i,
2364
2395
  prev: o
2365
2396
  };
2366
- }, Mr = () => {
2367
- const e = A(b), { volume: t, muted: n } = k(), a = E(
2368
- (i) => {
2369
- e({ type: "SET_VOLUME", volume: i });
2397
+ }, _r = () => {
2398
+ const e = E(w), { volume: t, muted: n } = k(), a = g(
2399
+ (s) => {
2400
+ e({ type: "SET_VOLUME", volume: s });
2370
2401
  },
2371
2402
  [e]
2372
- ), r = E(() => {
2403
+ ), r = g(() => {
2373
2404
  e({ type: "SET_MUTED", muted: !n });
2374
2405
  }, [e, n]);
2375
2406
  return { volume: t, muted: n, setVolume: a, toggleMute: r };
2376
- }, _r = () => {
2377
- const e = A(b), { currentTime: t, duration: n } = re(), a = E(
2407
+ }, Dr = () => {
2408
+ const e = E(w), { currentTime: t, duration: n } = re(), a = g(
2378
2409
  (r) => {
2379
2410
  e({ type: "SEEK", time: r });
2380
2411
  },
2381
2412
  [e]
2382
2413
  );
2383
2414
  return { currentTime: t, duration: n, seek: a };
2384
- }, Vr = () => {
2385
- const e = Cr(), t = xr(), n = Mr(), a = _r();
2415
+ }, Br = () => {
2416
+ const e = xr(), t = Mr(), n = _r(), a = Dr();
2386
2417
  return {
2387
2418
  isPlaying: e.isPlaying,
2388
2419
  volume: n.volume,
@@ -2405,7 +2436,7 @@ const Kr = Object.assign(It, {
2405
2436
  setTrack: t.setTrack,
2406
2437
  setPlaybackRate: e.setPlaybackRate
2407
2438
  };
2408
- }, Br = () => {
2439
+ }, $r = () => {
2409
2440
  const { elementRefs: e } = L();
2410
2441
  return {
2411
2442
  audioEl: e == null ? void 0 : e.audioEl,
@@ -2413,31 +2444,31 @@ const Kr = Object.assign(It, {
2413
2444
  };
2414
2445
  };
2415
2446
  export {
2416
- kr as AudioPlayer,
2447
+ Cr as AudioPlayer,
2417
2448
  Ge as AudioPlayerContainer,
2418
2449
  Bt as AudioPlayerStateProvider,
2419
2450
  O as DEFAULT_AUDIO_STATE,
2420
- Or as DEFAULT_INTERFACE_GRID_BOUND,
2451
+ Kr as DEFAULT_INTERFACE_GRID_BOUND,
2421
2452
  Ie as audioAttrsContext,
2422
- b as audioPlayerDispatchContext,
2453
+ w as audioPlayerDispatchContext,
2423
2454
  Ot as audioPlayerReducer,
2424
- Kr as default,
2425
- de as defaultInterfacePlacement,
2455
+ Vr as default,
2456
+ pe as defaultInterfacePlacement,
2426
2457
  Se as playbackContext,
2427
2458
  Le as resourceContext,
2428
2459
  Ne as timeContext,
2429
- we as trackContext,
2430
- be as uiContext,
2460
+ be as trackContext,
2461
+ we as uiContext,
2431
2462
  Kt as useAudioAttrsContext,
2432
- Vr as useAudioPlayer,
2433
- Br as useAudioPlayerElement,
2434
- Cr as useAudioPlayerPlayback,
2435
- _r as useAudioPlayerTime,
2436
- xr as useAudioPlayerTrack,
2437
- Mr as useAudioPlayerVolume,
2463
+ Br as useAudioPlayer,
2464
+ $r as useAudioPlayerElement,
2465
+ xr as useAudioPlayerPlayback,
2466
+ Dr as useAudioPlayerTime,
2467
+ Mr as useAudioPlayerTrack,
2468
+ _r as useAudioPlayerVolume,
2438
2469
  k as usePlaybackContext,
2439
2470
  L as useResourceContext,
2440
2471
  re as useTimeContext,
2441
2472
  $ as useTrackContext,
2442
- M as useUIContext
2473
+ x as useUIContext
2443
2474
  };