@lucaismyname/ginger 0.0.57 → 0.0.59

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.
Files changed (38) hide show
  1. package/README.md +26 -0
  2. package/dist/client.cjs +1 -1
  3. package/dist/client.js +2 -2
  4. package/dist/components/tracks/GingerDeclarativeMergeContext.d.ts +12 -0
  5. package/dist/components/tracks/GingerDeclarativeMergeContext.d.ts.map +1 -0
  6. package/dist/components/tracks/GingerTrack.d.ts +17 -0
  7. package/dist/components/tracks/GingerTrack.d.ts.map +1 -0
  8. package/dist/components/tracks/GingerTracks.d.ts +21 -0
  9. package/dist/components/tracks/GingerTracks.d.ts.map +1 -0
  10. package/dist/components/tracks/GingerTracks.test.d.ts +2 -0
  11. package/dist/components/tracks/GingerTracks.test.d.ts.map +1 -0
  12. package/dist/components/tracks/GingerTracksRegistryContext.d.ts +13 -0
  13. package/dist/components/tracks/GingerTracksRegistryContext.d.ts.map +1 -0
  14. package/dist/components/tracks/index.d.ts +5 -0
  15. package/dist/components/tracks/index.d.ts.map +1 -0
  16. package/dist/components/tracks/mergeDeclarativeQueue.d.ts +6 -0
  17. package/dist/components/tracks/mergeDeclarativeQueue.d.ts.map +1 -0
  18. package/dist/context/GingerProvider.d.ts.map +1 -1
  19. package/dist/{ginger-BHu7Ofna.js → ginger-Bc_8qZYi.js} +902 -766
  20. package/dist/ginger-Bc_8qZYi.js.map +1 -0
  21. package/dist/ginger-DJwWdIp0.cjs +2 -0
  22. package/dist/ginger-DJwWdIp0.cjs.map +1 -0
  23. package/dist/ginger.d.ts +5 -0
  24. package/dist/ginger.d.ts.map +1 -1
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +2 -2
  29. package/dist/testing/index.cjs +1 -1
  30. package/dist/testing/index.js +1 -1
  31. package/dist/{useGingerChapterProgress-DAIWjAtG.js → useGingerChapterProgress-CGe9W-te.js} +2 -2
  32. package/dist/{useGingerChapterProgress-DAIWjAtG.js.map → useGingerChapterProgress-CGe9W-te.js.map} +1 -1
  33. package/dist/{useGingerChapterProgress-DLx-LayX.cjs → useGingerChapterProgress-EbJNY5jt.cjs} +2 -2
  34. package/dist/{useGingerChapterProgress-DLx-LayX.cjs.map → useGingerChapterProgress-EbJNY5jt.cjs.map} +1 -1
  35. package/package.json +2 -2
  36. package/dist/ginger-B-W73LQC.cjs +0 -2
  37. package/dist/ginger-B-W73LQC.cjs.map +0 -1
  38. package/dist/ginger-BHu7Ofna.js.map +0 -1
@@ -1,46 +1,46 @@
1
1
  import { jsx as c, jsxs as N, Fragment as yr } from "react/jsx-runtime";
2
- import { useContext as Qe, createContext as je, useRef as S, useState as bn, useEffect as E, useMemo as R, useReducer as kn, useCallback as I, Children as Tn, isValidElement as Mn, cloneElement as xn } from "react";
3
- import { c as V, u as ue, g as hr, d as A, G as In, f as En, h as Pn, i as An } from "./GingerSplitContexts-DQ3rESBu.js";
4
- import { f as pe } from "./formatTime-DUWvzW21.js";
5
- import { b as ze, g as le, r as Rn, a as Sn, p as vr, e as wn, d as br } from "./selectors-BT3WSsKN.js";
6
- import { t as Ye, d as _n, b as Gn, s as kr, f as Oe, e as q, g as Nn, h as lr, m as Ln, i as dr, j as pr, r as Dn, c as gr } from "./transitions-CmNkf3sd.js";
7
- const Tr = je(null);
8
- function Cn() {
9
- const e = Qe(Tr);
2
+ import { useContext as fe, createContext as me, useRef as w, useState as xt, useEffect as E, useMemo as A, useId as It, useLayoutEffect as Et, useReducer as Pt, useCallback as I, Children as St, isValidElement as At, cloneElement as Rt } from "react";
3
+ import { c as C, u as le, g as hr, d as S, G as wt, f as Gt, h as _t, i as Nt } from "./GingerSplitContexts-DQ3rESBu.js";
4
+ import { f as ge } from "./formatTime-DUWvzW21.js";
5
+ import { b as ze, g as de, r as Lt, a as Dt, p as vr, e as Ut, d as kr } from "./selectors-BT3WSsKN.js";
6
+ import { t as Qe, d as Ct, b as Ft, s as br, f as Ye, e as q, g as Vt, h as lr, m as Bt, i as dr, j as pr, r as Ot, c as gr } from "./transitions-CmNkf3sd.js";
7
+ const Tr = me(null);
8
+ function $t() {
9
+ const e = fe(Tr);
10
10
  if (!e) throw new Error("Ginger components must be used within <Ginger.Provider>");
11
11
  return e;
12
12
  }
13
13
  function fr(e) {
14
- const { buffered: r, duration: t } = e;
15
- return !(t > 0) || r.length === 0 ? 0 : Math.min(1, r.end(r.length - 1) / t);
14
+ const { buffered: r, duration: n } = e;
15
+ return !(n > 0) || r.length === 0 ? 0 : Math.min(1, r.end(r.length - 1) / n);
16
16
  }
17
- function Fn({
17
+ function Yt({
18
18
  className: e,
19
19
  style: r,
20
- preload: t = "metadata",
20
+ preload: n = "metadata",
21
21
  crossOrigin: a,
22
- respectReducedMotion: n = !1
22
+ respectReducedMotion: t = !1
23
23
  }) {
24
24
  var x;
25
- const { audioRef: i, dispatch: o, state: u, notifyEnded: d } = Cn(), p = ((x = u.tracks[u.currentIndex]) == null ? void 0 : x.fileUrl) ?? "", f = S({
25
+ const { audioRef: i, dispatch: o, state: u, notifyEnded: p } = $t(), l = ((x = u.tracks[u.currentIndex]) == null ? void 0 : x.fileUrl) ?? "", f = w({
26
26
  currentTime: -1,
27
27
  duration: -1,
28
28
  bufferedFraction: -1
29
- }), m = S(""), [M, g] = bn(!1);
29
+ }), m = w(""), [M, g] = xt(!1);
30
30
  E(() => {
31
- if (!n || typeof window > "u") return;
32
- const y = window.matchMedia("(prefers-reduced-motion: reduce)"), b = () => g(y.matches);
33
- return b(), y.addEventListener("change", b), () => y.removeEventListener("change", b);
34
- }, [n]);
35
- const h = (y, b = !1) => {
36
- const L = {
31
+ if (!t || typeof window > "u") return;
32
+ const y = window.matchMedia("(prefers-reduced-motion: reduce)"), v = () => g(y.matches);
33
+ return v(), y.addEventListener("change", v), () => y.removeEventListener("change", v);
34
+ }, [t]);
35
+ const h = (y, v = !1) => {
36
+ const G = {
37
37
  currentTime: y.currentTime,
38
38
  duration: y.duration,
39
39
  bufferedFraction: fr(y)
40
- }, w = f.current, ge = M ? 0.5 : 0.25, fe = Math.abs(L.currentTime - w.currentTime) >= ge || Math.abs(L.duration - w.duration) >= 0.01 || Math.abs(L.bufferedFraction - w.bufferedFraction) >= 0.01;
41
- !b && !fe || (f.current = L, o({
40
+ }, R = f.current, Z = M ? 0.5 : 0.25, ye = Math.abs(G.currentTime - R.currentTime) >= Z || Math.abs(G.duration - R.duration) >= 0.01 || Math.abs(G.bufferedFraction - R.bufferedFraction) >= 0.01;
41
+ !v && !ye || (f.current = G, o({
42
42
  type: "MEDIA_TIME_UPDATE",
43
- payload: L
43
+ payload: G
44
44
  }));
45
45
  };
46
46
  return E(() => {
@@ -49,20 +49,20 @@ function Fn({
49
49
  }, [i, u.volume, u.muted]), E(() => {
50
50
  const y = i.current;
51
51
  if (y) {
52
- if (!p) {
52
+ if (!l) {
53
53
  y.removeAttribute("src"), f.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, m.current !== "" && o({ type: "MEDIA_SOURCE_CLEARED" }), m.current = "";
54
54
  return;
55
55
  }
56
- y.getAttribute("src") !== p && (y.src = p, y.load(), f.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }), m.current = p, y.playbackRate = u.playbackRate;
56
+ y.getAttribute("src") !== l && (y.src = l, y.load(), f.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }), m.current = l, y.playbackRate = u.playbackRate;
57
57
  }
58
- }, [i, o, p, u.playbackRate]), /* @__PURE__ */ c(
58
+ }, [i, o, l, u.playbackRate]), /* @__PURE__ */ c(
59
59
  "audio",
60
60
  {
61
61
  "data-ginger-component": "Player",
62
62
  ref: i,
63
63
  className: e,
64
64
  style: r,
65
- preload: t,
65
+ preload: n,
66
66
  crossOrigin: a,
67
67
  controls: !1,
68
68
  playsInline: !0,
@@ -70,39 +70,39 @@ function Fn({
70
70
  h(y.currentTarget);
71
71
  },
72
72
  onLoadedMetadata: (y) => {
73
- const b = y.currentTarget;
73
+ const v = y.currentTarget;
74
74
  f.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, o({
75
75
  type: "MEDIA_LOADED_METADATA",
76
76
  payload: {
77
- duration: b.duration,
78
- bufferedFraction: fr(b)
77
+ duration: v.duration,
78
+ bufferedFraction: fr(v)
79
79
  }
80
80
  });
81
81
  },
82
82
  onSeeking: (y) => h(y.currentTarget, !0),
83
83
  onSeeked: (y) => h(y.currentTarget, !0),
84
- onEnded: () => d(),
84
+ onEnded: () => p(),
85
85
  onPlay: () => o({ type: "MEDIA_PLAY" }),
86
86
  onPause: () => o({ type: "MEDIA_PAUSE" }),
87
87
  onWaiting: () => o({ type: "MEDIA_WAITING" }),
88
88
  onCanPlay: () => o({ type: "MEDIA_CANPLAY" }),
89
89
  onProgress: (y) => h(y.currentTarget, !0),
90
90
  onVolumeChange: (y) => {
91
- const b = y.currentTarget;
91
+ const v = y.currentTarget;
92
92
  o({
93
93
  type: "MEDIA_VOLUME_SYNC",
94
- payload: { volume: b.volume, muted: b.muted }
94
+ payload: { volume: v.volume, muted: v.muted }
95
95
  });
96
96
  },
97
97
  onError: () => {
98
- var w;
99
- const y = i.current, b = (w = y == null ? void 0 : y.error) == null ? void 0 : w.code;
100
- o({ type: "MEDIA_ERROR", payload: { message: b === 1 ? "MEDIA_ERR_ABORTED" : b === 2 ? "MEDIA_ERR_NETWORK" : b === 3 ? "MEDIA_ERR_DECODE" : b === 4 ? "MEDIA_ERR_SRC_NOT_SUPPORTED" : "MEDIA_ERR_UNKNOWN" } });
98
+ var R;
99
+ const y = i.current, v = (R = y == null ? void 0 : y.error) == null ? void 0 : R.code;
100
+ o({ type: "MEDIA_ERROR", payload: { message: v === 1 ? "MEDIA_ERR_ABORTED" : v === 2 ? "MEDIA_ERR_NETWORK" : v === 3 ? "MEDIA_ERR_DECODE" : v === 4 ? "MEDIA_ERR_SRC_NOT_SUPPORTED" : "MEDIA_ERR_UNKNOWN" } });
101
101
  }
102
102
  }
103
103
  );
104
104
  }
105
- const Ce = {
105
+ const Ve = {
106
106
  seek: "Seek",
107
107
  volume: "Volume",
108
108
  playbackSpeed: "Playback speed",
@@ -123,42 +123,42 @@ const Ce = {
123
123
  playbackRateNormal: "1× normal",
124
124
  playbackRateTimes: (e) => `${e}×`
125
125
  };
126
- function Un(e) {
126
+ function Ht(e) {
127
127
  return e ? {
128
- ...Ce,
128
+ ...Ve,
129
129
  ...e,
130
- repeat: { ...Ce.repeat, ...e.repeat }
131
- } : Ce;
130
+ repeat: { ...Ve.repeat, ...e.repeat }
131
+ } : Ve;
132
132
  }
133
- const Mr = je(Ce);
134
- function Vn({
133
+ const Mr = me(Ve);
134
+ function Qt({
135
135
  locale: e,
136
136
  children: r
137
137
  }) {
138
- const t = Un(e);
139
- return /* @__PURE__ */ c(Mr.Provider, { value: t, children: r });
138
+ const n = Ht(e);
139
+ return /* @__PURE__ */ c(Mr.Provider, { value: n, children: r });
140
140
  }
141
141
  function F() {
142
- return Qe(Mr);
142
+ return fe(Mr);
143
143
  }
144
- function Bn() {
145
- const e = V(), r = ue(), t = F(), a = R(() => hr(e, r), [e, r]), n = ze(a), i = n > 0 ? a.currentTime : 0, o = Number.isFinite(i) ? i : 0, u = n > 0 ? `${pe(o)} of ${pe(n)}` : pe(o), d = (p) => {
146
- r.seek(Number(p.currentTarget.value));
144
+ function jt() {
145
+ const e = C(), r = le(), n = F(), a = A(() => hr(e, r), [e, r]), t = ze(a), i = t > 0 ? a.currentTime : 0, o = Number.isFinite(i) ? i : 0, u = t > 0 ? `${ge(o)} of ${ge(t)}` : ge(o), p = (l) => {
146
+ r.seek(Number(l.currentTarget.value));
147
147
  };
148
148
  return {
149
149
  state: a,
150
150
  value: o,
151
151
  min: 0,
152
- max: n > 0 ? n : 1,
152
+ max: t > 0 ? t : 1,
153
153
  step: "any",
154
154
  ariaValueText: u,
155
- ariaLabel: t.seek,
156
- onSeekInput: d,
157
- onSeekChange: d
155
+ ariaLabel: n.seek,
156
+ onSeekInput: p,
157
+ onSeekChange: p
158
158
  };
159
159
  }
160
- function On() {
161
- const e = V(), r = ue(), t = F(), a = R(() => hr(e, r), [e, r]), n = (i) => {
160
+ function zt() {
161
+ const e = C(), r = le(), n = F(), a = A(() => hr(e, r), [e, r]), t = (i) => {
162
162
  r.setVolume(Number(i.currentTarget.value));
163
163
  };
164
164
  return {
@@ -168,30 +168,30 @@ function On() {
168
168
  max: 1,
169
169
  step: "any",
170
170
  ariaValueText: `${Math.round(a.volume * 100)}%`,
171
- ariaLabel: t.volume,
172
- onVolumeInput: n,
173
- onVolumeChange: n
171
+ ariaLabel: n.volume,
172
+ onVolumeInput: t,
173
+ onVolumeChange: t
174
174
  };
175
175
  }
176
- function $n(e) {
177
- const r = V(), t = F(), a = (e == null ? void 0 : e.playAriaLabel) ?? t.play, n = (e == null ? void 0 : e.pauseAriaLabel) ?? t.pause;
176
+ function Wt(e) {
177
+ const r = C(), n = F(), a = (e == null ? void 0 : e.playAriaLabel) ?? n.play, t = (e == null ? void 0 : e.pauseAriaLabel) ?? n.pause;
178
178
  return {
179
179
  isPaused: r.isPaused,
180
180
  toggle: r.togglePlayPause,
181
- ariaLabel: r.isPaused ? a : n
181
+ ariaLabel: r.isPaused ? a : t
182
182
  };
183
183
  }
184
- function U(e) {
184
+ function V(e) {
185
185
  const {
186
186
  className: r,
187
- width: t,
187
+ width: n,
188
188
  height: a,
189
- viewBox: n,
189
+ viewBox: t,
190
190
  fill: i,
191
191
  stroke: o,
192
192
  strokeWidth: u,
193
- strokeLinecap: d,
194
- strokeLinejoin: p,
193
+ strokeLinecap: p,
194
+ strokeLinejoin: l,
195
195
  children: f,
196
196
  ...m
197
197
  } = e;
@@ -200,14 +200,14 @@ function U(e) {
200
200
  {
201
201
  "data-ginger-component": "Wrapper",
202
202
  xmlns: "http://www.w3.org/2000/svg",
203
- width: t ?? 24,
203
+ width: n ?? 24,
204
204
  height: a ?? 24,
205
- viewBox: n ?? "0 0 24 24",
205
+ viewBox: t ?? "0 0 24 24",
206
206
  fill: "none",
207
207
  stroke: o ?? "currentColor",
208
208
  strokeWidth: u ?? 2,
209
- strokeLinecap: d ?? "round",
210
- strokeLinejoin: p ?? "round",
209
+ strokeLinecap: p ?? "round",
210
+ strokeLinejoin: l ?? "round",
211
211
  className: r,
212
212
  "aria-hidden": !0,
213
213
  role: "presentation",
@@ -217,12 +217,12 @@ function U(e) {
217
217
  );
218
218
  }
219
219
  function xr() {
220
- return /* @__PURE__ */ c(U, { children: /* @__PURE__ */ c("path", { "data-ginger-component": "Pause", d: "M6 4h4v16H6zM14 4h4v16h-4z" }) });
220
+ return /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c("path", { "data-ginger-component": "Pause", d: "M6 4h4v16H6zM14 4h4v16h-4z" }) });
221
221
  }
222
222
  function Ir() {
223
- return /* @__PURE__ */ c(U, { children: /* @__PURE__ */ c("path", { "data-ginger-component": "Play", d: "M5 3L19 12 5 21 5 3z" }) });
223
+ return /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c("path", { "data-ginger-component": "Play", d: "M5 3L19 12 5 21 5 3z" }) });
224
224
  }
225
- function $e() {
225
+ function He() {
226
226
  return /* @__PURE__ */ N(yr, { children: [
227
227
  /* @__PURE__ */ c("path", { d: "m17 2 4 4-4 4" }),
228
228
  /* @__PURE__ */ c("path", { d: "M3 11v-1a4 4 0 0 1 4-4h14" }),
@@ -231,16 +231,16 @@ function $e() {
231
231
  ] });
232
232
  }
233
233
  function Er({ mode: e }) {
234
- return e === "one" ? /* @__PURE__ */ N(U, { children: [
235
- /* @__PURE__ */ c($e, {}),
234
+ return e === "one" ? /* @__PURE__ */ N(V, { children: [
235
+ /* @__PURE__ */ c(He, {}),
236
236
  /* @__PURE__ */ c("path", { "data-ginger-component": "RepeatGlyph", d: "M11 10h1v4" })
237
- ] }) : e === "all" ? /* @__PURE__ */ c(U, { children: /* @__PURE__ */ c($e, {}) }) : /* @__PURE__ */ N(U, { children: [
238
- /* @__PURE__ */ c($e, {}),
237
+ ] }) : e === "all" ? /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(He, {}) }) : /* @__PURE__ */ N(V, { children: [
238
+ /* @__PURE__ */ c(He, {}),
239
239
  /* @__PURE__ */ c("line", { "data-ginger-component": "RepeatGlyph", x1: "3", x2: "21", y1: "3", y2: "21" })
240
240
  ] });
241
241
  }
242
242
  function Pr() {
243
- return /* @__PURE__ */ N(U, { children: [
243
+ return /* @__PURE__ */ N(V, { children: [
244
244
  /* @__PURE__ */ c("path", { d: "m18 14 4 4-4 4" }),
245
245
  /* @__PURE__ */ c("path", { d: "m18 2 4 4-4 4" }),
246
246
  /* @__PURE__ */ c(
@@ -254,8 +254,8 @@ function Pr() {
254
254
  /* @__PURE__ */ c("path", { d: "M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45" })
255
255
  ] });
256
256
  }
257
- function Ar() {
258
- return /* @__PURE__ */ N(U, { children: [
257
+ function Sr() {
258
+ return /* @__PURE__ */ N(V, { children: [
259
259
  /* @__PURE__ */ c(
260
260
  "path",
261
261
  {
@@ -266,8 +266,8 @@ function Ar() {
266
266
  /* @__PURE__ */ c("path", { d: "M3 20V4" })
267
267
  ] });
268
268
  }
269
- function Rr() {
270
- return /* @__PURE__ */ N(U, { children: [
269
+ function Ar() {
270
+ return /* @__PURE__ */ N(V, { children: [
271
271
  /* @__PURE__ */ c("path", { d: "M21 4v16" }),
272
272
  /* @__PURE__ */ c(
273
273
  "path",
@@ -278,8 +278,8 @@ function Rr() {
278
278
  )
279
279
  ] });
280
280
  }
281
- function Sr() {
282
- return /* @__PURE__ */ N(U, { children: [
281
+ function Rr() {
282
+ return /* @__PURE__ */ N(V, { children: [
283
283
  /* @__PURE__ */ c(
284
284
  "path",
285
285
  {
@@ -292,7 +292,7 @@ function Sr() {
292
292
  ] });
293
293
  }
294
294
  function wr() {
295
- return /* @__PURE__ */ N(U, { children: [
295
+ return /* @__PURE__ */ N(V, { children: [
296
296
  /* @__PURE__ */ c(
297
297
  "path",
298
298
  {
@@ -304,18 +304,18 @@ function wr() {
304
304
  /* @__PURE__ */ c("line", { x1: "16", x2: "22", y1: "9", y2: "15" })
305
305
  ] });
306
306
  }
307
- function _r({
307
+ function Gr({
308
308
  playLabel: e = "Play",
309
309
  pauseLabel: r = "Pause",
310
- playAriaLabel: t,
310
+ playAriaLabel: n,
311
311
  pauseAriaLabel: a,
312
- children: n,
312
+ children: t,
313
313
  type: i = "button",
314
314
  onClick: o,
315
315
  ...u
316
316
  }) {
317
- const d = F(), p = typeof e == "string" ? e : d.play, f = typeof r == "string" ? r : d.pause, m = $n({
318
- playAriaLabel: t ?? p,
317
+ const p = F(), l = typeof e == "string" ? e : p.play, f = typeof r == "string" ? r : p.pause, m = Wt({
318
+ playAriaLabel: n ?? l,
319
319
  pauseAriaLabel: a ?? f
320
320
  });
321
321
  return /* @__PURE__ */ c(
@@ -328,41 +328,41 @@ function _r({
328
328
  onClick: (M) => {
329
329
  m.toggle(), o == null || o(M);
330
330
  },
331
- children: n ?? (m.isPaused ? /* @__PURE__ */ c(Ir, {}) : /* @__PURE__ */ c(xr, {}))
331
+ children: t ?? (m.isPaused ? /* @__PURE__ */ c(Ir, {}) : /* @__PURE__ */ c(xr, {}))
332
332
  }
333
333
  );
334
334
  }
335
- _r.displayName = "Ginger.Control.PlayPause";
336
- function Gr({ type: e = "button", ariaLabel: r, onClick: t, children: a, ...n }) {
337
- const { repeatMode: i, cycleRepeat: o } = V(), d = F().repeat[i];
335
+ Gr.displayName = "Ginger.Control.PlayPause";
336
+ function _r({ type: e = "button", ariaLabel: r, onClick: n, children: a, ...t }) {
337
+ const { repeatMode: i, cycleRepeat: o } = C(), p = F().repeat[i];
338
338
  return /* @__PURE__ */ c(
339
339
  "button",
340
340
  {
341
341
  "data-ginger-component": "Repeat",
342
- ...n,
342
+ ...t,
343
343
  type: e,
344
- "aria-label": r ?? d,
345
- onClick: (p) => {
346
- o(), t == null || t(p);
344
+ "aria-label": r ?? p,
345
+ onClick: (l) => {
346
+ o(), n == null || n(l);
347
347
  },
348
348
  children: a ?? /* @__PURE__ */ c(Er, { mode: i })
349
349
  }
350
350
  );
351
351
  }
352
- Gr.displayName = "Ginger.Control.Repeat";
353
- function Nr({ type: e = "button", children: r, ariaLabel: t, onClick: a, ...n }) {
354
- const { next: i } = V(), o = F();
352
+ _r.displayName = "Ginger.Control.Repeat";
353
+ function Nr({ type: e = "button", children: r, ariaLabel: n, onClick: a, ...t }) {
354
+ const { next: i } = C(), o = F();
355
355
  return /* @__PURE__ */ c(
356
356
  "button",
357
357
  {
358
358
  "data-ginger-component": "Next",
359
- ...n,
359
+ ...t,
360
360
  type: e,
361
- "aria-label": t ?? o.nextTrack,
361
+ "aria-label": n ?? o.nextTrack,
362
362
  onClick: (u) => {
363
363
  i(), a == null || a(u);
364
364
  },
365
- children: r ?? /* @__PURE__ */ c(Rr, {})
365
+ children: r ?? /* @__PURE__ */ c(Ar, {})
366
366
  }
367
367
  );
368
368
  }
@@ -370,51 +370,51 @@ Nr.displayName = "Ginger.Control.Next";
370
370
  function Lr({
371
371
  type: e = "button",
372
372
  children: r,
373
- ariaLabel: t,
373
+ ariaLabel: n,
374
374
  onClick: a,
375
- ...n
375
+ ...t
376
376
  }) {
377
- const { prev: i } = V(), o = F();
377
+ const { prev: i } = C(), o = F();
378
378
  return /* @__PURE__ */ c(
379
379
  "button",
380
380
  {
381
381
  "data-ginger-component": "Previous",
382
- ...n,
382
+ ...t,
383
383
  type: e,
384
- "aria-label": t ?? o.previousTrack,
384
+ "aria-label": n ?? o.previousTrack,
385
385
  onClick: (u) => {
386
386
  i(), a == null || a(u);
387
387
  },
388
- children: r ?? /* @__PURE__ */ c(Ar, {})
388
+ children: r ?? /* @__PURE__ */ c(Sr, {})
389
389
  }
390
390
  );
391
391
  }
392
392
  Lr.displayName = "Ginger.Control.Previous";
393
- function Dr({ type: e = "button", children: r, ariaLabel: t, onClick: a, ...n }) {
394
- const { isShuffled: i, toggleShuffle: o } = V(), u = F();
393
+ function Dr({ type: e = "button", children: r, ariaLabel: n, onClick: a, ...t }) {
394
+ const { isShuffled: i, toggleShuffle: o } = C(), u = F();
395
395
  return /* @__PURE__ */ c(
396
396
  "button",
397
397
  {
398
398
  "data-ginger-component": "Shuffle",
399
- ...n,
399
+ ...t,
400
400
  type: e,
401
401
  "aria-pressed": i,
402
- "aria-label": t ?? u.shuffle,
403
- onClick: (d) => {
404
- o(), a == null || a(d);
402
+ "aria-label": n ?? u.shuffle,
403
+ onClick: (p) => {
404
+ o(), a == null || a(p);
405
405
  },
406
406
  children: r ?? /* @__PURE__ */ c(Pr, {})
407
407
  }
408
408
  );
409
409
  }
410
410
  Dr.displayName = "Ginger.Control.Shuffle";
411
- function Cr({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: a, ...n }) {
412
- const i = Bn(), o = t ? { ...r, ...e } : { width: "100%", ...r, ...e };
411
+ function Ur({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: a, ...t }) {
412
+ const i = jt(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
413
413
  return /* @__PURE__ */ c(
414
414
  "input",
415
415
  {
416
416
  "data-ginger-component": "SeekBar",
417
- ...n,
417
+ ...t,
418
418
  type: "range",
419
419
  min: i.min,
420
420
  max: i.max,
@@ -428,14 +428,14 @@ function Cr({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: a, ...n }) {
428
428
  }
429
429
  );
430
430
  }
431
- Cr.displayName = "Ginger.Control.SeekBar";
432
- function Fr({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: a, ...n }) {
433
- const i = On(), o = t ? { ...r, ...e } : { width: "100%", ...r, ...e };
431
+ Ur.displayName = "Ginger.Control.SeekBar";
432
+ function Cr({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: a, ...t }) {
433
+ const i = zt(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
434
434
  return /* @__PURE__ */ c(
435
435
  "input",
436
436
  {
437
437
  "data-ginger-component": "Volume",
438
- ...n,
438
+ ...t,
439
439
  type: "range",
440
440
  min: i.min,
441
441
  max: i.max,
@@ -449,17 +449,17 @@ function Fr({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: a, ...n }) {
449
449
  }
450
450
  );
451
451
  }
452
- Fr.displayName = "Ginger.Control.Volume";
453
- function Ur({
452
+ Cr.displayName = "Ginger.Control.Volume";
453
+ function Fr({
454
454
  ariaLabel: e,
455
455
  muteLabel: r,
456
- unmuteLabel: t,
456
+ unmuteLabel: n,
457
457
  type: a = "button",
458
- onClick: n,
458
+ onClick: t,
459
459
  children: i,
460
460
  ...o
461
461
  }) {
462
- const { muted: u, toggleMute: d } = ue(), p = F();
462
+ const { muted: u, toggleMute: p } = le(), l = F();
463
463
  return /* @__PURE__ */ c(
464
464
  "button",
465
465
  {
@@ -467,142 +467,142 @@ function Ur({
467
467
  ...o,
468
468
  type: a,
469
469
  "aria-pressed": u,
470
- "aria-label": e ?? (u ? p.unmute : p.mute),
470
+ "aria-label": e ?? (u ? l.unmute : l.mute),
471
471
  onClick: (f) => {
472
- d(), n == null || n(f);
472
+ p(), t == null || t(f);
473
473
  },
474
- children: i ?? (u ? t ?? /* @__PURE__ */ c(wr, {}) : r ?? /* @__PURE__ */ c(Sr, {}))
474
+ children: i ?? (u ? n ?? /* @__PURE__ */ c(wr, {}) : r ?? /* @__PURE__ */ c(Rr, {}))
475
475
  }
476
476
  );
477
477
  }
478
- Ur.displayName = "Ginger.Control.Mute";
479
- const Yn = [0.5, 0.75, 1, 1.25, 1.5, 2];
478
+ Fr.displayName = "Ginger.Control.Mute";
479
+ const Xt = [0.5, 0.75, 1, 1.25, 1.5, 2];
480
480
  function Vr({
481
- rates: e = Yn,
481
+ rates: e = Xt,
482
482
  style: r,
483
- ariaLabel: t,
483
+ ariaLabel: n,
484
484
  children: a,
485
- ...n
485
+ ...t
486
486
  }) {
487
- const { playbackRate: i, setPlaybackRate: o } = ue(), u = F(), d = R(
488
- () => Array.from(/* @__PURE__ */ new Set([...e, i])).sort((p, f) => p - f),
487
+ const { playbackRate: i, setPlaybackRate: o } = le(), u = F(), p = A(
488
+ () => Array.from(/* @__PURE__ */ new Set([...e, i])).sort((l, f) => l - f),
489
489
  [e, i]
490
490
  );
491
491
  return /* @__PURE__ */ c(
492
492
  "select",
493
493
  {
494
494
  "data-ginger-component": "PlaybackRate",
495
- ...n,
496
- "aria-label": t ?? u.playbackSpeed,
495
+ ...t,
496
+ "aria-label": n ?? u.playbackSpeed,
497
497
  value: String(i),
498
498
  style: r,
499
- onChange: (p) => o(Number(p.currentTarget.value)),
500
- children: a ?? d.map((p) => /* @__PURE__ */ c("option", { value: String(p), children: p === 1 ? u.playbackRateNormal : u.playbackRateTimes(p) }, p))
499
+ onChange: (l) => o(Number(l.currentTarget.value)),
500
+ children: a ?? p.map((l) => /* @__PURE__ */ c("option", { value: String(l), children: l === 1 ? u.playbackRateNormal : u.playbackRateTimes(l) }, l))
501
501
  }
502
502
  );
503
503
  }
504
504
  Vr.displayName = "Ginger.Control.PlaybackRate";
505
- function ee(e, r) {
506
- function t(a) {
507
- const n = A(), o = (r(n) ?? "").trim(), { className: u, style: d, fallback: p, empty: f, children: m } = a;
505
+ function re(e, r) {
506
+ function n(a) {
507
+ const t = S(), o = (r(t) ?? "").trim(), { className: u, style: p, fallback: l, empty: f, children: m } = a;
508
508
  if (!o) {
509
- const M = f ?? p ?? null;
510
- return M ? /* @__PURE__ */ c("span", { className: u, style: d, children: M }) : null;
509
+ const M = f ?? l ?? null;
510
+ return M ? /* @__PURE__ */ c("span", { className: u, style: p, children: M }) : null;
511
511
  }
512
- return m ? /* @__PURE__ */ c("span", { className: u, style: d, children: m(o, n) }) : /* @__PURE__ */ c("span", { className: u, style: d, children: o });
512
+ return m ? /* @__PURE__ */ c("span", { className: u, style: p, children: m(o, t) }) : /* @__PURE__ */ c("span", { className: u, style: p, children: o });
513
513
  }
514
- return t.displayName = e, t;
514
+ return n.displayName = e, n;
515
515
  }
516
- function re(e, r) {
517
- return ee(e, (t) => r(le(t)));
516
+ function te(e, r) {
517
+ return re(e, (n) => r(de(n)));
518
518
  }
519
- const Hn = re("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), Qn = re("Ginger.Current.Artist", (e) => e == null ? void 0 : e.artist), jn = ee("Ginger.Current.Album", (e) => Rn(e)), zn = re(
519
+ const Kt = te("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), qt = te("Ginger.Current.Artist", (e) => e == null ? void 0 : e.artist), Jt = re("Ginger.Current.Album", (e) => Lt(e)), Zt = te(
520
520
  "Ginger.Current.Description",
521
521
  (e) => e == null ? void 0 : e.description
522
- ), Wn = ee("Ginger.Current.Copyright", (e) => {
523
- var t;
524
- const r = le(e);
525
- return (r == null ? void 0 : r.copyright) ?? ((t = e.playlistMeta) == null ? void 0 : t.copyright);
526
- }), Xn = re("Ginger.Current.Genre", (e) => e == null ? void 0 : e.genre), Kn = re("Ginger.Current.Label", (e) => e == null ? void 0 : e.label), qn = re("Ginger.Current.Isrc", (e) => e == null ? void 0 : e.isrc), Jn = re(
522
+ ), en = re("Ginger.Current.Copyright", (e) => {
523
+ var n;
524
+ const r = de(e);
525
+ return (r == null ? void 0 : r.copyright) ?? ((n = e.playlistMeta) == null ? void 0 : n.copyright);
526
+ }), rn = te("Ginger.Current.Genre", (e) => e == null ? void 0 : e.genre), tn = te("Ginger.Current.Label", (e) => e == null ? void 0 : e.label), nn = te("Ginger.Current.Isrc", (e) => e == null ? void 0 : e.isrc), an = te(
527
527
  "Ginger.Current.TrackNumber",
528
528
  (e) => (e == null ? void 0 : e.trackNumber) != null ? String(e.trackNumber) : void 0
529
529
  );
530
- function Br({ className: e, style: r, fallback: t, empty: a, children: n, format: i }) {
531
- var p;
532
- const o = A(), u = (p = le(o)) == null ? void 0 : p.year;
530
+ function Br({ className: e, style: r, fallback: n, empty: a, children: t, format: i }) {
531
+ var l;
532
+ const o = S(), u = (l = de(o)) == null ? void 0 : l.year;
533
533
  if (typeof u != "number" || !Number.isFinite(u)) {
534
- const f = a ?? t ?? null;
534
+ const f = a ?? n ?? null;
535
535
  return f ? /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: f }) : null;
536
536
  }
537
- const d = i ? i(u) : String(u);
538
- return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: n(d, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: d });
537
+ const p = i ? i(u) : String(u);
538
+ return t ? /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: t(p, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: p });
539
539
  }
540
540
  Br.displayName = "Ginger.Current.Year";
541
541
  function Or({
542
542
  className: e,
543
543
  style: r,
544
- fallback: t,
544
+ fallback: n,
545
545
  empty: a,
546
- children: n,
546
+ children: t,
547
547
  preserveWhitespace: i = !0,
548
548
  unstyled: o = !1
549
549
  }) {
550
550
  var m;
551
- const u = A(), d = ((m = le(u)) == null ? void 0 : m.lyrics) ?? "", p = i ? d.replace(/^\s+|\s+$/g, "") : d.trim();
552
- if (!p) {
553
- const M = a ?? t ?? null;
551
+ const u = S(), p = ((m = de(u)) == null ? void 0 : m.lyrics) ?? "", l = i ? p.replace(/^\s+|\s+$/g, "") : p.trim();
552
+ if (!l) {
553
+ const M = a ?? n ?? null;
554
554
  return M ? /* @__PURE__ */ c("span", { "data-ginger-component": "Lyrics", className: e, style: r, children: M }) : null;
555
555
  }
556
556
  const f = !o && i ? { whiteSpace: "pre-wrap" } : void 0;
557
- return n ? /* @__PURE__ */ c("span", { className: e, style: { ...f, ...r }, children: n(p, u) }) : /* @__PURE__ */ c("span", { className: e, style: { ...f, ...r }, children: p });
557
+ return t ? /* @__PURE__ */ c("span", { className: e, style: { ...f, ...r }, children: t(l, u) }) : /* @__PURE__ */ c("span", { className: e, style: { ...f, ...r }, children: l });
558
558
  }
559
559
  Or.displayName = "Ginger.Current.Lyrics";
560
560
  const mr = /\[(\d{1,2}):(\d{2})(?:\.(\d{1,3}))?\]/g;
561
- function Zn(e) {
561
+ function on(e) {
562
562
  const r = [];
563
- for (const t of e.split(/\r?\n/)) {
564
- const a = [...t.matchAll(mr)];
563
+ for (const n of e.split(/\r?\n/)) {
564
+ const a = [...n.matchAll(mr)];
565
565
  if (a.length === 0) continue;
566
- const n = t.replace(mr, "").trim();
566
+ const t = n.replace(mr, "").trim();
567
567
  for (const i of a) {
568
- const o = Number(i[1] ?? 0), u = Number(i[2] ?? 0), d = Number((i[3] ?? "0").padEnd(3, "0")), p = o * 60 + u + d / 1e3;
569
- Number.isFinite(p) && p >= 0 && r.push({ time: p, text: n });
568
+ const o = Number(i[1] ?? 0), u = Number(i[2] ?? 0), p = Number((i[3] ?? "0").padEnd(3, "0")), l = o * 60 + u + p / 1e3;
569
+ Number.isFinite(l) && l >= 0 && r.push({ time: l, text: t });
570
570
  }
571
571
  }
572
- return r.sort((t, a) => t.time - a.time);
572
+ return r.sort((n, a) => n.time - a.time);
573
573
  }
574
- function et() {
575
- const { tracks: e, currentIndex: r } = V(), { currentTime: t } = ue(), a = e[r], n = R(() => a ? Array.isArray(a.lyricsTimed) && a.lyricsTimed.length > 0 ? [...a.lyricsTimed].filter((o) => Number.isFinite(o.time) && o.time >= 0).sort((o, u) => o.time - u.time) : typeof a.lyrics == "string" ? Zn(a.lyrics) : [] : [], [a]), i = R(() => {
576
- for (let o = n.length - 1; o >= 0; o -= 1)
577
- if (t >= n[o].time) return o;
574
+ function cn() {
575
+ const { tracks: e, currentIndex: r } = C(), { currentTime: n } = le(), a = e[r], t = A(() => a ? Array.isArray(a.lyricsTimed) && a.lyricsTimed.length > 0 ? [...a.lyricsTimed].filter((o) => Number.isFinite(o.time) && o.time >= 0).sort((o, u) => o.time - u.time) : typeof a.lyrics == "string" ? on(a.lyrics) : [] : [], [a]), i = A(() => {
576
+ for (let o = t.length - 1; o >= 0; o -= 1)
577
+ if (n >= t[o].time) return o;
578
578
  return -1;
579
- }, [t, n]);
579
+ }, [n, t]);
580
580
  return {
581
- lines: n,
581
+ lines: t,
582
582
  activeIndex: i,
583
- activeLine: i >= 0 ? n[i] ?? null : null
583
+ activeLine: i >= 0 ? t[i] ?? null : null
584
584
  };
585
585
  }
586
586
  function $r({
587
587
  className: e,
588
588
  style: r,
589
- fallback: t,
589
+ fallback: n,
590
590
  empty: a,
591
- unstyled: n = !1,
591
+ unstyled: t = !1,
592
592
  activeClassName: i,
593
593
  lineClassName: o,
594
594
  children: u
595
595
  }) {
596
- const d = A(), p = F(), { lines: f, activeIndex: m } = et();
596
+ const p = S(), l = F(), { lines: f, activeIndex: m } = cn();
597
597
  if (f.length === 0) {
598
- const g = a ?? t ?? null;
598
+ const g = a ?? n ?? null;
599
599
  return g ? /* @__PURE__ */ c("span", { "data-ginger-component": "LyricsSynced", className: e, style: r, children: g }) : null;
600
600
  }
601
601
  return /* @__PURE__ */ c(
602
602
  "ul",
603
603
  {
604
604
  className: e,
605
- style: { ...n ? {} : {
605
+ style: { ...t ? {} : {
606
606
  listStyle: "none",
607
607
  margin: 0,
608
608
  padding: 0,
@@ -610,7 +610,7 @@ function $r({
610
610
  fontSize: "var(--ginger-font-size, 14px)",
611
611
  color: "var(--ginger-primary-color, #111827)"
612
612
  }, ...r },
613
- "aria-label": p.syncedLyricsList,
613
+ "aria-label": l.syncedLyricsList,
614
614
  children: f.map((g, h) => {
615
615
  const x = h === m;
616
616
  return /* @__PURE__ */ c(
@@ -619,12 +619,12 @@ function $r({
619
619
  "aria-current": x ? "true" : void 0,
620
620
  "data-ginger-active": x || void 0,
621
621
  className: [o, x ? i : void 0].filter(Boolean).join(" ") || void 0,
622
- style: n ? void 0 : {
622
+ style: t ? void 0 : {
623
623
  padding: "var(--ginger-playlist-row-padding, 4px 8px)",
624
624
  fontWeight: x ? 600 : 400,
625
625
  opacity: x ? 1 : 0.75
626
626
  },
627
- children: u ? u(g, h, x, d) : g.text
627
+ children: u ? u(g, h, x, p) : g.text
628
628
  },
629
629
  `${g.time}-${h}`
630
630
  );
@@ -633,22 +633,22 @@ function $r({
633
633
  );
634
634
  }
635
635
  $r.displayName = "Ginger.Current.LyricsSynced";
636
- function rt() {
637
- const { tracks: e, currentIndex: r } = V(), { currentTime: t, seek: a } = ue(), n = R(() => {
636
+ function sn() {
637
+ const { tracks: e, currentIndex: r } = C(), { currentTime: n, seek: a } = le(), t = A(() => {
638
638
  var u;
639
- return [...((u = e[r]) == null ? void 0 : u.chapters) ?? []].filter((d) => d && Number.isFinite(d.startSeconds) && d.startSeconds >= 0).sort((d, p) => d.startSeconds - p.startSeconds);
640
- }, [r, e]), i = R(() => {
641
- if (n.length === 0) return -1;
642
- for (let o = n.length - 1; o >= 0; o -= 1)
643
- if (t >= n[o].startSeconds) return o;
639
+ return [...((u = e[r]) == null ? void 0 : u.chapters) ?? []].filter((p) => p && Number.isFinite(p.startSeconds) && p.startSeconds >= 0).sort((p, l) => p.startSeconds - l.startSeconds);
640
+ }, [r, e]), i = A(() => {
641
+ if (t.length === 0) return -1;
642
+ for (let o = t.length - 1; o >= 0; o -= 1)
643
+ if (n >= t[o].startSeconds) return o;
644
644
  return -1;
645
- }, [t, n]);
645
+ }, [n, t]);
646
646
  return {
647
- list: n,
647
+ list: t,
648
648
  activeIndex: i,
649
- active: i >= 0 ? n[i] ?? null : null,
649
+ active: i >= 0 ? t[i] ?? null : null,
650
650
  seekTo: (o) => {
651
- const u = n[o];
651
+ const u = t[o];
652
652
  u && a(u.startSeconds);
653
653
  }
654
654
  };
@@ -656,25 +656,25 @@ function rt() {
656
656
  function Yr({
657
657
  className: e,
658
658
  style: r,
659
- fallback: t,
659
+ fallback: n,
660
660
  empty: a,
661
- unstyled: n = !1,
662
- formatStart: i = pe,
661
+ unstyled: t = !1,
662
+ formatStart: i = ge,
663
663
  children: o
664
664
  }) {
665
- const u = A(), d = F(), { list: p, activeIndex: f, seekTo: m } = rt();
666
- if (p.length === 0) {
667
- const g = a ?? t ?? null;
665
+ const u = S(), p = F(), { list: l, activeIndex: f, seekTo: m } = sn();
666
+ if (l.length === 0) {
667
+ const g = a ?? n ?? null;
668
668
  return g ? /* @__PURE__ */ c("span", { "data-ginger-component": "Chapters", className: e, style: r, children: g }) : null;
669
669
  }
670
- return /* @__PURE__ */ c("ul", { className: e, style: { ...n ? {} : {
670
+ return /* @__PURE__ */ c("ul", { className: e, style: { ...t ? {} : {
671
671
  listStyle: "none",
672
672
  margin: 0,
673
673
  padding: 0,
674
674
  fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
675
675
  fontSize: "var(--ginger-font-size, 14px)",
676
676
  color: "var(--ginger-primary-color, #111827)"
677
- }, ...r }, "aria-label": d.chaptersList, children: p.map((g, h) => {
677
+ }, ...r }, "aria-label": p.chaptersList, children: l.map((g, h) => {
678
678
  const x = h === f;
679
679
  return /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(
680
680
  "button",
@@ -684,16 +684,16 @@ function Yr({
684
684
  "data-ginger-active": x || void 0,
685
685
  onClick: () => m(h),
686
686
  style: {
687
- width: n ? void 0 : "100%",
688
- textAlign: n ? void 0 : "left",
689
- border: n ? void 0 : "none",
690
- background: n ? void 0 : x ? "var(--ginger-playlist-active-bg, rgba(17, 24, 39, 0.06))" : "transparent",
691
- color: n ? void 0 : "inherit",
692
- font: n ? void 0 : "inherit",
693
- cursor: n ? void 0 : "pointer",
694
- padding: n ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)"
687
+ width: t ? void 0 : "100%",
688
+ textAlign: t ? void 0 : "left",
689
+ border: t ? void 0 : "none",
690
+ background: t ? void 0 : x ? "var(--ginger-playlist-active-bg, rgba(17, 24, 39, 0.06))" : "transparent",
691
+ color: t ? void 0 : "inherit",
692
+ font: t ? void 0 : "inherit",
693
+ cursor: t ? void 0 : "pointer",
694
+ padding: t ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)"
695
695
  },
696
- children: o ? o(g, h, x, u) : n ? /* @__PURE__ */ N(yr, { children: [
696
+ children: o ? o(g, h, x, u) : t ? /* @__PURE__ */ N(yr, { children: [
697
697
  i(g.startSeconds),
698
698
  " ",
699
699
  g.title
@@ -709,37 +709,37 @@ Yr.displayName = "Ginger.Current.Chapters";
709
709
  function Hr({
710
710
  visible: e = !1,
711
711
  className: r,
712
- style: t,
712
+ style: n,
713
713
  fallback: a,
714
- empty: n,
714
+ empty: t,
715
715
  children: i
716
716
  }) {
717
- var d;
718
- const o = A();
717
+ var p;
718
+ const o = S();
719
719
  if (!e) return null;
720
- const u = ((d = le(o)) == null ? void 0 : d.fileUrl) ?? "";
720
+ const u = ((p = de(o)) == null ? void 0 : p.fileUrl) ?? "";
721
721
  if (!u) {
722
- const p = n ?? a ?? null;
723
- return p ? /* @__PURE__ */ c("span", { className: r, style: t, children: p }) : null;
722
+ const l = t ?? a ?? null;
723
+ return l ? /* @__PURE__ */ c("span", { className: r, style: n, children: l }) : null;
724
724
  }
725
- return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "FileUrl", className: r, style: t, children: i(u, o) }) : /* @__PURE__ */ c("span", { className: r, style: t, children: u });
725
+ return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "FileUrl", className: r, style: n, children: i(u, o) }) : /* @__PURE__ */ c("span", { className: r, style: n, children: u });
726
726
  }
727
727
  Hr.displayName = "Ginger.Current.FileUrl";
728
728
  function Qr({
729
729
  className: e,
730
730
  style: r,
731
- fallback: t,
731
+ fallback: n,
732
732
  empty: a,
733
- sizes: n,
733
+ sizes: t,
734
734
  loading: i,
735
735
  onError: o,
736
736
  decoding: u,
737
- unstyled: d = !1,
738
- imgStyle: p
737
+ unstyled: p = !1,
738
+ imgStyle: l
739
739
  }) {
740
- const f = A(), m = le(f), M = Sn(f);
740
+ const f = S(), m = de(f), M = Dt(f);
741
741
  if (!M) {
742
- const h = a ?? t ?? null;
742
+ const h = a ?? n ?? null;
743
743
  return h ? /* @__PURE__ */ c("span", { className: e, style: r, children: h }) : null;
744
744
  }
745
745
  const g = [m == null ? void 0 : m.title, m == null ? void 0 : m.artist].filter(Boolean).join(" — ") || "Artwork";
@@ -748,7 +748,7 @@ function Qr({
748
748
  {
749
749
  "data-ginger-component": "Artwork",
750
750
  className: e,
751
- style: d ? { ...r } : {
751
+ style: p ? { ...r } : {
752
752
  background: "var(--ginger-artwork-bg, transparent)",
753
753
  borderRadius: "var(--ginger-artwork-radius, 0)",
754
754
  overflow: "hidden",
@@ -759,16 +759,16 @@ function Qr({
759
759
  {
760
760
  src: M,
761
761
  alt: g,
762
- sizes: n,
762
+ sizes: t,
763
763
  loading: i,
764
764
  decoding: u,
765
765
  onError: o,
766
766
  style: {
767
- display: d ? void 0 : "block",
768
- width: d ? void 0 : "100%",
769
- height: d ? void 0 : "100%",
770
- objectFit: d ? void 0 : "cover",
771
- ...p
767
+ display: p ? void 0 : "block",
768
+ width: p ? void 0 : "100%",
769
+ height: p ? void 0 : "100%",
770
+ objectFit: p ? void 0 : "cover",
771
+ ...l
772
772
  }
773
773
  }
774
774
  )
@@ -779,96 +779,96 @@ Qr.displayName = "Ginger.Current.Artwork";
779
779
  function jr({
780
780
  base: e = 0,
781
781
  className: r,
782
- style: t,
782
+ style: n,
783
783
  fallback: a,
784
- empty: n,
784
+ empty: t,
785
785
  children: i
786
786
  }) {
787
- const o = A();
787
+ const o = S();
788
788
  if (o.tracks.length === 0) {
789
- const p = n ?? a ?? null;
790
- return p ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: t, children: p }) : null;
789
+ const l = t ?? a ?? null;
790
+ return l ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: n, children: l }) : null;
791
791
  }
792
- const d = String(o.currentIndex + e);
793
- return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: t, children: i(d, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: t, children: d });
792
+ const p = String(o.currentIndex + e);
793
+ return i ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: n, children: i(p, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: n, children: p });
794
794
  }
795
795
  jr.displayName = "Ginger.Current.QueueIndex";
796
- function zr({ className: e, style: r, fallback: t, empty: a, children: n }) {
797
- const i = A(), o = String(i.tracks.length);
796
+ function zr({ className: e, style: r, fallback: n, empty: a, children: t }) {
797
+ const i = S(), o = String(i.tracks.length);
798
798
  if (i.tracks.length === 0) {
799
- const u = a ?? t ?? null;
799
+ const u = a ?? n ?? null;
800
800
  return u ? /* @__PURE__ */ c("span", { className: e, style: r, children: u }) : null;
801
801
  }
802
- return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: n(o, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: o });
802
+ return t ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: t(o, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: o });
803
803
  }
804
804
  zr.displayName = "Ginger.Current.QueueLength";
805
805
  function Wr({
806
806
  base: e = 0,
807
807
  separator: r = " / ",
808
- className: t,
808
+ className: n,
809
809
  style: a,
810
- fallback: n,
810
+ fallback: t,
811
811
  empty: i,
812
812
  children: o
813
813
  }) {
814
- const u = A(), d = u.tracks.length;
815
- if (d === 0) {
816
- const M = i ?? n ?? null;
817
- return M ? /* @__PURE__ */ c("span", { className: t, style: a, children: M }) : null;
814
+ const u = S(), p = u.tracks.length;
815
+ if (p === 0) {
816
+ const M = i ?? t ?? null;
817
+ return M ? /* @__PURE__ */ c("span", { className: n, style: a, children: M }) : null;
818
818
  }
819
- const p = String(u.currentIndex + e), f = String(d), m = `${p}${r}${f}`;
820
- return o ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: t, style: a, children: o({ index: p, length: f, label: m }, u) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: t, style: a, children: m });
819
+ const l = String(u.currentIndex + e), f = String(p), m = `${l}${r}${f}`;
820
+ return o ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: n, style: a, children: o({ index: l, length: f, label: m }, u) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: n, style: a, children: m });
821
821
  }
822
822
  Wr.displayName = "Ginger.Current.QueuePosition";
823
- function We(e, r, t) {
824
- const { className: a, style: n, fallback: i, empty: o, children: u, format: d = pe } = t;
823
+ function We(e, r, n) {
824
+ const { className: a, style: t, fallback: i, empty: o, children: u, format: p = ge } = n;
825
825
  if (!(e >= 0) || !Number.isFinite(e)) {
826
826
  const f = o ?? i ?? null;
827
- return f ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: n, children: f }) : null;
827
+ return f ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: t, children: f }) : null;
828
828
  }
829
- const p = d(e);
830
- return u ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: n, children: u(p, r) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: n, children: p });
829
+ const l = p(e);
830
+ return u ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: t, children: u(l, r) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: a, style: t, children: l });
831
831
  }
832
832
  function Xr(e) {
833
- const r = A();
833
+ const r = S();
834
834
  return We(r.currentTime, r, e);
835
835
  }
836
836
  Xr.displayName = "Ginger.Current.Elapsed";
837
837
  function Kr(e) {
838
- const r = A();
838
+ const r = S();
839
839
  return We(ze(r), r, e);
840
840
  }
841
841
  Kr.displayName = "Ginger.Current.Duration";
842
842
  function qr(e) {
843
- const r = A();
844
- return We(wn(r), r, e);
843
+ const r = S();
844
+ return We(Ut(r), r, e);
845
845
  }
846
846
  qr.displayName = "Ginger.Current.Remaining";
847
- function Jr({ className: e, style: r, fallback: t, empty: a, children: n }) {
848
- const i = A(), o = ze(i), u = vr(i);
847
+ function Jr({ className: e, style: r, fallback: n, empty: a, children: t }) {
848
+ const i = S(), o = ze(i), u = vr(i);
849
849
  if (!(o > 0)) {
850
- const d = a ?? t ?? null;
851
- return d ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: d }) : null;
850
+ const p = a ?? n ?? null;
851
+ return p ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: p }) : null;
852
852
  }
853
- return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: n({ fraction: u, currentTime: i.currentTime, duration: o }, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: `${Math.round(u * 100)}%` });
853
+ return t ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: t({ fraction: u, currentTime: i.currentTime, duration: o }, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: `${Math.round(u * 100)}%` });
854
854
  }
855
855
  Jr.displayName = "Ginger.Current.Progress";
856
856
  function Zr({
857
857
  className: e,
858
858
  style: r,
859
- height: t = 4,
859
+ height: n = 4,
860
860
  showBuffered: a = !1,
861
- unstyled: n = !1
861
+ unstyled: t = !1
862
862
  }) {
863
- const i = A(), o = `${Math.round(vr(i) * 100)}%`, u = `${Math.round(Math.min(1, Math.max(0, i.bufferedFraction)) * 100)}%`;
863
+ const i = S(), o = `${Math.round(vr(i) * 100)}%`, u = `${Math.round(Math.min(1, Math.max(0, i.bufferedFraction)) * 100)}%`;
864
864
  return /* @__PURE__ */ N(
865
865
  "div",
866
866
  {
867
867
  "data-ginger-component": "TimeRail",
868
868
  className: e,
869
- style: n ? { ...r } : {
869
+ style: t ? { ...r } : {
870
870
  width: "100%",
871
- height: t,
871
+ height: n,
872
872
  background: "var(--ginger-muted-color, #e5e7eb)",
873
873
  borderRadius: 999,
874
874
  overflow: "hidden",
@@ -882,12 +882,12 @@ function Zr({
882
882
  {
883
883
  "data-ginger-component": "TimeRail",
884
884
  style: {
885
- position: n ? void 0 : "absolute",
886
- left: n ? void 0 : 0,
887
- top: n ? void 0 : 0,
888
- height: n ? void 0 : "100%",
885
+ position: t ? void 0 : "absolute",
886
+ left: t ? void 0 : 0,
887
+ top: t ? void 0 : 0,
888
+ height: t ? void 0 : "100%",
889
889
  width: u,
890
- background: n ? void 0 : "var(--ginger-buffer-color, rgba(107, 114, 128, 0.35))"
890
+ background: t ? void 0 : "var(--ginger-buffer-color, rgba(107, 114, 128, 0.35))"
891
891
  }
892
892
  }
893
893
  ) : null,
@@ -896,10 +896,10 @@ function Zr({
896
896
  {
897
897
  "data-ginger-component": "TimeRail",
898
898
  style: {
899
- position: n ? void 0 : "relative",
899
+ position: t ? void 0 : "relative",
900
900
  width: o,
901
- height: n ? void 0 : "100%",
902
- background: n ? void 0 : "var(--ginger-primary-color, #111827)"
901
+ height: t ? void 0 : "100%",
902
+ background: t ? void 0 : "var(--ginger-primary-color, #111827)"
903
903
  }
904
904
  }
905
905
  )
@@ -908,8 +908,8 @@ function Zr({
908
908
  );
909
909
  }
910
910
  Zr.displayName = "Ginger.Current.TimeRail";
911
- function en({ className: e, style: r, height: t = 4, unstyled: a = !1 }) {
912
- const n = A(), i = `${Math.round(Math.min(1, Math.max(0, n.bufferedFraction)) * 100)}%`;
911
+ function et({ className: e, style: r, height: n = 4, unstyled: a = !1 }) {
912
+ const t = S(), i = `${Math.round(Math.min(1, Math.max(0, t.bufferedFraction)) * 100)}%`;
913
913
  return /* @__PURE__ */ c(
914
914
  "div",
915
915
  {
@@ -917,7 +917,7 @@ function en({ className: e, style: r, height: t = 4, unstyled: a = !1 }) {
917
917
  className: e,
918
918
  style: a ? { ...r } : {
919
919
  width: "100%",
920
- height: t,
920
+ height: n,
921
921
  background: "var(--ginger-muted-color, #e5e7eb)",
922
922
  borderRadius: 999,
923
923
  overflow: "hidden",
@@ -938,24 +938,24 @@ function en({ className: e, style: r, height: t = 4, unstyled: a = !1 }) {
938
938
  }
939
939
  );
940
940
  }
941
- en.displayName = "Ginger.Current.BufferRail";
942
- function rn({ className: e, style: r, fallback: t, empty: a, children: n }) {
943
- const i = A(), o = br(i);
944
- return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: n(o, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: o });
941
+ et.displayName = "Ginger.Current.BufferRail";
942
+ function rt({ className: e, style: r, fallback: n, empty: a, children: t }) {
943
+ const i = S(), o = kr(i);
944
+ return t ? /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: t(o, i) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: o });
945
945
  }
946
- rn.displayName = "Ginger.Current.PlaybackState";
947
- function nn({
946
+ rt.displayName = "Ginger.Current.PlaybackState";
947
+ function tt({
948
948
  className: e,
949
949
  style: r,
950
- fallback: t,
950
+ fallback: n,
951
951
  empty: a,
952
- live: n = "polite",
952
+ live: t = "polite",
953
953
  children: i
954
954
  }) {
955
- const o = A(), u = o.errorMessage ?? "";
955
+ const o = S(), u = o.errorMessage ?? "";
956
956
  if (!u) {
957
- const d = a ?? t ?? null;
958
- return d ? /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, children: d }) : null;
957
+ const p = a ?? n ?? null;
958
+ return p ? /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, children: p }) : null;
959
959
  }
960
960
  return i ? /* @__PURE__ */ c(
961
961
  "span",
@@ -963,29 +963,29 @@ function nn({
963
963
  "data-ginger-component": "ErrorMessage",
964
964
  className: e,
965
965
  style: r,
966
- "aria-live": n,
966
+ "aria-live": t,
967
967
  children: i(u, o)
968
968
  }
969
- ) : /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, "aria-live": n, children: u });
969
+ ) : /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, "aria-live": t, children: u });
970
970
  }
971
- nn.displayName = "Ginger.Current.ErrorMessage";
972
- const He = je(null);
973
- function nt() {
974
- const e = Qe(He);
971
+ tt.displayName = "Ginger.Current.ErrorMessage";
972
+ const je = me(null);
973
+ function un() {
974
+ const e = fe(je);
975
975
  if (!e)
976
976
  throw new Error("Ginger.Playlist.Track must be used inside <Ginger.Playlist>");
977
977
  return e;
978
978
  }
979
- function tn({
979
+ function nt({
980
980
  children: e,
981
981
  unstyled: r = !1,
982
- rowStyle: t,
982
+ rowStyle: n,
983
983
  renderTrack: a,
984
- playOnSelect: n = !0,
984
+ playOnSelect: t = !0,
985
985
  style: i,
986
986
  ...o
987
987
  }) {
988
- const { tracks: u, currentIndex: d, playTrackAt: p, selectTrackAt: f } = V(), m = r ? { ...i } : {
988
+ const { tracks: u, currentIndex: p, playTrackAt: l, selectTrackAt: f } = C(), m = r ? { ...i } : {
989
989
  listStyle: "none",
990
990
  margin: 0,
991
991
  padding: 0,
@@ -994,14 +994,14 @@ function tn({
994
994
  color: "var(--ginger-primary-color, #111827)",
995
995
  ...i
996
996
  };
997
- return e !== void 0 ? /* @__PURE__ */ c(He.Provider, { value: { playOnSelect: n }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: m, ...o, children: e }) }) : /* @__PURE__ */ c(He.Provider, { value: { playOnSelect: n }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: m, ...o, children: u.map((g, h) => {
998
- const x = h === d;
997
+ return e !== void 0 ? /* @__PURE__ */ c(je.Provider, { value: { playOnSelect: t }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: m, ...o, children: e }) }) : /* @__PURE__ */ c(je.Provider, { value: { playOnSelect: t }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: m, ...o, children: u.map((g, h) => {
998
+ const x = h === p;
999
999
  return /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(
1000
1000
  "button",
1001
1001
  {
1002
1002
  type: "button",
1003
1003
  onClick: () => {
1004
- n ? p(h) : f(h);
1004
+ t ? l(h) : f(h);
1005
1005
  },
1006
1006
  style: {
1007
1007
  width: r ? void 0 : "100%",
@@ -1012,28 +1012,28 @@ function tn({
1012
1012
  font: r ? void 0 : "inherit",
1013
1013
  cursor: r ? void 0 : "pointer",
1014
1014
  padding: r ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)",
1015
- ...t
1015
+ ...n
1016
1016
  },
1017
1017
  children: a ? a(g, h, x) : /* @__PURE__ */ N("span", { children: [
1018
1018
  g.title,
1019
1019
  g.artist ? ` — ${g.artist}` : ""
1020
1020
  ] })
1021
1021
  }
1022
- ) }, `${h}-${Ye(g)}`);
1022
+ ) }, `${h}-${Qe(g)}`);
1023
1023
  }) }) });
1024
1024
  }
1025
- tn.displayName = "Ginger.Playlist";
1026
- function an({
1025
+ nt.displayName = "Ginger.Playlist";
1026
+ function at({
1027
1027
  index: e,
1028
1028
  unstyled: r = !1,
1029
- className: t,
1029
+ className: n,
1030
1030
  style: a,
1031
- children: n,
1031
+ children: t,
1032
1032
  liProps: i,
1033
1033
  onClick: o,
1034
1034
  ...u
1035
1035
  }) {
1036
- const { playOnSelect: d } = nt(), { tracks: p, currentIndex: f, playTrackAt: m, selectTrackAt: M } = V(), g = e === f, h = p[e], x = h != null ? /* @__PURE__ */ N("span", { "data-ginger-component": "PlaylistTrack", children: [
1036
+ const { playOnSelect: p } = un(), { tracks: l, currentIndex: f, playTrackAt: m, selectTrackAt: M } = C(), g = e === f, h = l[e], x = h != null ? /* @__PURE__ */ N("span", { "data-ginger-component": "PlaylistTrack", children: [
1037
1037
  h.title,
1038
1038
  h.artist ? ` — ${h.artist}` : ""
1039
1039
  ] }) : null;
@@ -1044,7 +1044,7 @@ function an({
1044
1044
  "data-ginger-component": "PlaylistTrackButton",
1045
1045
  "aria-current": g ? "true" : void 0,
1046
1046
  "data-ginger-active": g || void 0,
1047
- className: t,
1047
+ className: n,
1048
1048
  style: {
1049
1049
  width: r ? void 0 : "100%",
1050
1050
  textAlign: r ? void 0 : "left",
@@ -1058,55 +1058,55 @@ function an({
1058
1058
  },
1059
1059
  ...u,
1060
1060
  onClick: (y) => {
1061
- o == null || o(y), !y.defaultPrevented && (d ? m(e) : M(e));
1061
+ o == null || o(y), !y.defaultPrevented && (p ? m(e) : M(e));
1062
1062
  },
1063
- children: n ?? x
1063
+ children: t ?? x
1064
1064
  }
1065
1065
  ) });
1066
1066
  }
1067
- an.displayName = "Ginger.Playlist.Track";
1068
- const tt = Object.assign(tn, {
1069
- Track: an
1070
- }), at = ee("Ginger.Queue.Title", (e) => {
1067
+ at.displayName = "Ginger.Playlist.Track";
1068
+ const ln = Object.assign(nt, {
1069
+ Track: at
1070
+ }), dn = re("Ginger.Queue.Title", (e) => {
1071
1071
  var r;
1072
1072
  return (r = e.playlistMeta) == null ? void 0 : r.title;
1073
- }), it = ee("Ginger.Queue.Subtitle", (e) => {
1073
+ }), pn = re("Ginger.Queue.Subtitle", (e) => {
1074
1074
  var r;
1075
1075
  return (r = e.playlistMeta) == null ? void 0 : r.subtitle;
1076
- }), ot = ee(
1076
+ }), gn = re(
1077
1077
  "Ginger.Queue.Description",
1078
1078
  (e) => {
1079
1079
  var r;
1080
1080
  return (r = e.playlistMeta) == null ? void 0 : r.description;
1081
1081
  }
1082
- ), ct = ee(
1082
+ ), fn = re(
1083
1083
  "Ginger.Queue.Copyright",
1084
1084
  (e) => {
1085
1085
  var r;
1086
1086
  return (r = e.playlistMeta) == null ? void 0 : r.copyright;
1087
1087
  }
1088
1088
  );
1089
- function on({
1089
+ function it({
1090
1090
  className: e,
1091
1091
  style: r,
1092
- fallback: t,
1092
+ fallback: n,
1093
1093
  empty: a,
1094
- unstyled: n = !1,
1094
+ unstyled: t = !1,
1095
1095
  imgStyle: i
1096
1096
  }) {
1097
- var p, f;
1098
- const o = A(), u = (p = o.playlistMeta) == null ? void 0 : p.artworkUrl;
1097
+ var l, f;
1098
+ const o = S(), u = (l = o.playlistMeta) == null ? void 0 : l.artworkUrl;
1099
1099
  if (!u) {
1100
- const m = a ?? t ?? null;
1100
+ const m = a ?? n ?? null;
1101
1101
  return m ? /* @__PURE__ */ c("span", { "data-ginger-component": "Artwork", className: e, style: r, children: m }) : null;
1102
1102
  }
1103
- const d = ((f = o.playlistMeta) == null ? void 0 : f.title) ?? "Playlist artwork";
1103
+ const p = ((f = o.playlistMeta) == null ? void 0 : f.title) ?? "Playlist artwork";
1104
1104
  return /* @__PURE__ */ c(
1105
1105
  "span",
1106
1106
  {
1107
1107
  "data-ginger-component": "Artwork",
1108
1108
  className: e,
1109
- style: n ? { ...r } : {
1109
+ style: t ? { ...r } : {
1110
1110
  display: "inline-block",
1111
1111
  background: "var(--ginger-artwork-bg, #f3f4f6)",
1112
1112
  borderRadius: "var(--ginger-artwork-radius, 6px)",
@@ -1117,12 +1117,12 @@ function on({
1117
1117
  "img",
1118
1118
  {
1119
1119
  src: u,
1120
- alt: d,
1120
+ alt: p,
1121
1121
  style: {
1122
- display: n ? void 0 : "block",
1123
- width: n ? void 0 : "100%",
1124
- height: n ? void 0 : "100%",
1125
- objectFit: n ? void 0 : "cover",
1122
+ display: t ? void 0 : "block",
1123
+ width: t ? void 0 : "100%",
1124
+ height: t ? void 0 : "100%",
1125
+ objectFit: t ? void 0 : "cover",
1126
1126
  ...i
1127
1127
  }
1128
1128
  }
@@ -1130,8 +1130,136 @@ function on({
1130
1130
  }
1131
1131
  );
1132
1132
  }
1133
- on.displayName = "Ginger.Queue.Artwork";
1134
- function Fe(e) {
1133
+ it.displayName = "Ginger.Queue.Artwork";
1134
+ const ot = me(null);
1135
+ function mn({
1136
+ children: e,
1137
+ value: r
1138
+ }) {
1139
+ return /* @__PURE__ */ c(ot.Provider, { value: r, children: e });
1140
+ }
1141
+ function yn() {
1142
+ const e = fe(ot);
1143
+ if (!e)
1144
+ throw new Error("Ginger.Track must be used inside <Ginger.Tracks>");
1145
+ return e;
1146
+ }
1147
+ function hn(e) {
1148
+ const r = e.fileUrl ?? e.src;
1149
+ if (!r || r === "")
1150
+ throw new Error("Ginger.Track requires a non-empty fileUrl or src.");
1151
+ const {
1152
+ src: n,
1153
+ fileUrl: a,
1154
+ title: t,
1155
+ id: i,
1156
+ artist: o,
1157
+ copyright: u,
1158
+ description: p,
1159
+ album: l,
1160
+ artworkUrl: f,
1161
+ genre: m,
1162
+ year: M,
1163
+ label: g,
1164
+ isrc: h,
1165
+ trackNumber: x,
1166
+ lyrics: y,
1167
+ lyricsTimed: v,
1168
+ chapters: G,
1169
+ durationSeconds: R,
1170
+ metadata: Z
1171
+ } = e;
1172
+ return {
1173
+ ...i !== void 0 ? { id: i } : {},
1174
+ title: t,
1175
+ fileUrl: r,
1176
+ ...o !== void 0 ? { artist: o } : {},
1177
+ ...u !== void 0 ? { copyright: u } : {},
1178
+ ...p !== void 0 ? { description: p } : {},
1179
+ ...l !== void 0 ? { album: l } : {},
1180
+ ...f !== void 0 ? { artworkUrl: f } : {},
1181
+ ...m !== void 0 ? { genre: m } : {},
1182
+ ...M !== void 0 ? { year: M } : {},
1183
+ ...g !== void 0 ? { label: g } : {},
1184
+ ...h !== void 0 ? { isrc: h } : {},
1185
+ ...x !== void 0 ? { trackNumber: x } : {},
1186
+ ...y !== void 0 ? { lyrics: y } : {},
1187
+ ...v !== void 0 ? { lyricsTimed: v } : {},
1188
+ ...G !== void 0 ? { chapters: G } : {},
1189
+ ...R !== void 0 ? { durationSeconds: R } : {},
1190
+ ...Z !== void 0 ? { metadata: Z } : {}
1191
+ };
1192
+ }
1193
+ function ct(e) {
1194
+ const r = yn(), n = It().replace(/:/g, ""), a = e.id ?? `ginger-decl:${n}`, t = hn({ ...e, id: a });
1195
+ return r.slots.set(a, t), r.order.push(a), null;
1196
+ }
1197
+ ct.displayName = "Ginger.Track";
1198
+ const st = me(
1199
+ null
1200
+ );
1201
+ function vn({
1202
+ children: e,
1203
+ value: r
1204
+ }) {
1205
+ return /* @__PURE__ */ c(st.Provider, { value: r, children: e });
1206
+ }
1207
+ function kn() {
1208
+ return fe(st);
1209
+ }
1210
+ function bn(e, r, n) {
1211
+ switch (e) {
1212
+ case "append":
1213
+ return [...r, ...n];
1214
+ case "prepend":
1215
+ return [...n, ...r];
1216
+ case "replace":
1217
+ return [...n];
1218
+ default:
1219
+ return [...r, ...n];
1220
+ }
1221
+ }
1222
+ function Tn(e, r) {
1223
+ if (e.length !== r.length) return !1;
1224
+ for (let n = 0; n < e.length; n++) {
1225
+ const a = e[n], t = r[n];
1226
+ if (a !== t && (a.title !== t.title || a.fileUrl !== t.fileUrl || (a.id ?? "") !== (t.id ?? "") || (a.artist ?? "") !== (t.artist ?? "")))
1227
+ return !1;
1228
+ }
1229
+ return !0;
1230
+ }
1231
+ function Mn({
1232
+ merge: e,
1233
+ registry: r
1234
+ }) {
1235
+ const { dispatch: n, tracks: a, currentIndex: t } = C(), i = kn(), o = r.order.map((l) => {
1236
+ const f = r.slots.get(l);
1237
+ return f ? `${l}:${f.fileUrl}:${f.title}` : "";
1238
+ }).join("|"), p = ((i == null ? void 0 : i.getInitialTracksSnapshot()) ?? []).map((l) => `${l.id ?? ""}:${l.fileUrl}:${l.title}`).join("|");
1239
+ return Et(() => {
1240
+ const l = (i == null ? void 0 : i.getInitialTracksSnapshot()) ?? [], f = r.order.map((g) => r.slots.get(g)).filter((g) => g != null), m = bn(e, l, f);
1241
+ if (Tn(m, a)) return;
1242
+ const M = Math.min(t, Math.max(0, m.length - 1));
1243
+ n({ type: "SET_QUEUE", payload: { tracks: m, currentIndex: M } });
1244
+ }, [e, o, p, i, n, r, a, t]), null;
1245
+ }
1246
+ function ut({
1247
+ children: e,
1248
+ merge: r = "append",
1249
+ style: n,
1250
+ hidden: a,
1251
+ ...t
1252
+ }) {
1253
+ const i = w(null);
1254
+ i.current || (i.current = { slots: /* @__PURE__ */ new Map(), order: [] });
1255
+ const o = i.current;
1256
+ return o.slots.clear(), o.order.length = 0, /* @__PURE__ */ N(mn, { value: o, children: [
1257
+ /* @__PURE__ */ c("div", { "data-ginger-component": "Tracks", style: { display: "contents", ...n }, ...t, children: e }),
1258
+ /* @__PURE__ */ c(Mn, { merge: r, registry: o })
1259
+ ] });
1260
+ }
1261
+ ut.displayName = "Ginger.Tracks";
1262
+ function Be(e) {
1135
1263
  return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 1;
1136
1264
  }
1137
1265
  function Xe(e) {
@@ -1143,63 +1271,63 @@ const J = {
1143
1271
  bufferedFraction: 0,
1144
1272
  isBuffering: !1,
1145
1273
  errorMessage: null
1146
- }, st = {
1274
+ }, xn = {
1147
1275
  ...J,
1148
1276
  volume: 1,
1149
1277
  muted: !1,
1150
1278
  playbackRate: 1
1151
1279
  };
1152
- function cn(e) {
1280
+ function lt(e) {
1153
1281
  const r = [...e.tracks];
1154
- let t = q(e.currentIndex ?? 0, r.length), a = null, n = r;
1155
- return e.isShuffled && r.length > 1 && (a = [...r], n = kr(r, t), t = 0), {
1156
- tracks: n,
1157
- currentIndex: t,
1282
+ let n = q(e.currentIndex ?? 0, r.length), a = null, t = r;
1283
+ return e.isShuffled && r.length > 1 && (a = [...r], t = br(r, n), n = 0), {
1284
+ tracks: t,
1285
+ currentIndex: n,
1158
1286
  playbackMode: e.playbackMode ?? "playlist",
1159
1287
  isPaused: e.isPaused ?? !0,
1160
- isShuffled: !!(e.isShuffled && n.length > 1),
1288
+ isShuffled: !!(e.isShuffled && t.length > 1),
1161
1289
  repeatMode: e.repeatMode ?? "off",
1162
1290
  originalTracks: a,
1163
1291
  playlistMeta: e.playlistMeta ?? null,
1164
- ...st,
1165
- volume: Fe(e.volume ?? 1),
1292
+ ...xn,
1293
+ volume: Be(e.volume ?? 1),
1166
1294
  muted: e.muted ?? !1,
1167
1295
  playbackRate: Xe(e.playbackRate ?? 1)
1168
1296
  };
1169
1297
  }
1170
- function ut(e, r) {
1298
+ function In(e, r) {
1171
1299
  switch (r.type) {
1172
1300
  case "INIT": {
1173
1301
  const {
1174
- tracks: t,
1302
+ tracks: n,
1175
1303
  currentIndex: a,
1176
- playlistMeta: n,
1304
+ playlistMeta: t,
1177
1305
  isPaused: i,
1178
1306
  isShuffled: o,
1179
1307
  repeatMode: u,
1180
- playbackMode: d,
1181
- volume: p,
1308
+ playbackMode: p,
1309
+ volume: l,
1182
1310
  muted: f,
1183
1311
  playbackRate: m
1184
1312
  } = r.payload;
1185
- return cn({
1186
- tracks: t,
1313
+ return lt({
1314
+ tracks: n,
1187
1315
  currentIndex: a,
1188
- playlistMeta: n ?? null,
1316
+ playlistMeta: t ?? null,
1189
1317
  isPaused: i ?? !0,
1190
1318
  isShuffled: o ?? !1,
1191
1319
  repeatMode: u ?? "off",
1192
- playbackMode: d ?? "playlist",
1193
- volume: p,
1320
+ playbackMode: p ?? "playlist",
1321
+ volume: l,
1194
1322
  muted: f,
1195
1323
  playbackRate: m
1196
1324
  });
1197
1325
  }
1198
1326
  case "SET_QUEUE": {
1199
- const { tracks: t, currentIndex: a } = r.payload, n = [...t], i = q(a ?? e.currentIndex, n.length);
1327
+ const { tracks: n, currentIndex: a } = r.payload, t = [...n], i = q(a ?? e.currentIndex, t.length);
1200
1328
  return {
1201
1329
  ...e,
1202
- tracks: n,
1330
+ tracks: t,
1203
1331
  currentIndex: i,
1204
1332
  isShuffled: !1,
1205
1333
  originalTracks: null,
@@ -1207,9 +1335,9 @@ function ut(e, r) {
1207
1335
  };
1208
1336
  }
1209
1337
  case "INSERT_TRACK": {
1210
- const t = r.payload.index ?? e.tracks.length, a = pr(e.tracks, r.payload.track, t);
1338
+ const n = r.payload.index ?? e.tracks.length, a = pr(e.tracks, r.payload.track, n);
1211
1339
  if (r.payload.autoPlay) {
1212
- const o = q(t, a.length);
1340
+ const o = q(n, a.length);
1213
1341
  return {
1214
1342
  ...e,
1215
1343
  tracks: a,
@@ -1220,57 +1348,57 @@ function ut(e, r) {
1220
1348
  ...J
1221
1349
  };
1222
1350
  }
1223
- const n = t <= e.currentIndex ? e.currentIndex + 1 : e.currentIndex, i = e.isShuffled && e.originalTracks ? pr(e.originalTracks, r.payload.track, e.originalTracks.length) : e.originalTracks;
1351
+ const t = n <= e.currentIndex ? e.currentIndex + 1 : e.currentIndex, i = e.isShuffled && e.originalTracks ? pr(e.originalTracks, r.payload.track, e.originalTracks.length) : e.originalTracks;
1224
1352
  return {
1225
1353
  ...e,
1226
1354
  tracks: a,
1227
1355
  originalTracks: i,
1228
- currentIndex: q(n, a.length)
1356
+ currentIndex: q(t, a.length)
1229
1357
  };
1230
1358
  }
1231
1359
  case "REMOVE_TRACK": {
1232
- const t = r.payload.index, a = dr(e.tracks, t), n = t < e.currentIndex ? e.currentIndex - 1 : t === e.currentIndex ? Math.min(e.currentIndex, Math.max(0, a.length - 1)) : e.currentIndex, i = e.isShuffled && e.originalTracks ? (() => {
1233
- const u = e.tracks[t], d = Oe(e.originalTracks, u);
1234
- return dr(e.originalTracks, d);
1360
+ const n = r.payload.index, a = dr(e.tracks, n), t = n < e.currentIndex ? e.currentIndex - 1 : n === e.currentIndex ? Math.min(e.currentIndex, Math.max(0, a.length - 1)) : e.currentIndex, i = e.isShuffled && e.originalTracks ? (() => {
1361
+ const u = e.tracks[n], p = Ye(e.originalTracks, u);
1362
+ return dr(e.originalTracks, p);
1235
1363
  })() : e.originalTracks, o = e.isShuffled && a.length > 1;
1236
1364
  return {
1237
1365
  ...e,
1238
1366
  tracks: a,
1239
1367
  isShuffled: o,
1240
1368
  originalTracks: o ? i : null,
1241
- currentIndex: q(n, a.length),
1242
- ...t === e.currentIndex ? J : {}
1369
+ currentIndex: q(t, a.length),
1370
+ ...n === e.currentIndex ? J : {}
1243
1371
  };
1244
1372
  }
1245
1373
  case "MOVE_TRACK": {
1246
- const { fromIndex: t, toIndex: a } = r.payload, n = Ln(e.tracks, t, a);
1374
+ const { fromIndex: n, toIndex: a } = r.payload, t = Bt(e.tracks, n, a);
1247
1375
  let i = e.currentIndex;
1248
- return e.currentIndex === t ? i = a : t < e.currentIndex && a >= e.currentIndex ? i -= 1 : t > e.currentIndex && a <= e.currentIndex && (i += 1), {
1376
+ return e.currentIndex === n ? i = a : n < e.currentIndex && a >= e.currentIndex ? i -= 1 : n > e.currentIndex && a <= e.currentIndex && (i += 1), {
1249
1377
  ...e,
1250
- tracks: n,
1378
+ tracks: t,
1251
1379
  isShuffled: !1,
1252
1380
  originalTracks: null,
1253
- currentIndex: q(i, n.length)
1381
+ currentIndex: q(i, t.length)
1254
1382
  };
1255
1383
  }
1256
1384
  case "ADD_NEXT": {
1257
- const t = lr(e.tracks, e.currentIndex, r.payload.track), a = e.isShuffled && e.originalTracks ? (() => {
1258
- const n = e.tracks[e.currentIndex], i = Oe(e.originalTracks, n);
1385
+ const n = lr(e.tracks, e.currentIndex, r.payload.track), a = e.isShuffled && e.originalTracks ? (() => {
1386
+ const t = e.tracks[e.currentIndex], i = Ye(e.originalTracks, t);
1259
1387
  return lr(e.originalTracks, i, r.payload.track);
1260
1388
  })() : e.originalTracks;
1261
1389
  return {
1262
1390
  ...e,
1263
- tracks: t,
1391
+ tracks: n,
1264
1392
  originalTracks: a
1265
1393
  };
1266
1394
  }
1267
1395
  case "SET_INDEX": {
1268
- const t = q(r.payload.index, e.tracks.length), a = r.payload.autoPlay, n = a === !0 ? !1 : a === !1 ? !0 : e.isPaused;
1396
+ const n = q(r.payload.index, e.tracks.length), a = r.payload.autoPlay, t = a === !0 ? !1 : a === !1 ? !0 : e.isPaused;
1269
1397
  return {
1270
1398
  ...e,
1271
- currentIndex: t,
1399
+ currentIndex: n,
1272
1400
  ...J,
1273
- isPaused: n
1401
+ isPaused: t
1274
1402
  };
1275
1403
  }
1276
1404
  case "PLAY":
@@ -1282,11 +1410,11 @@ function ut(e, r) {
1282
1410
  case "SET_REPEAT":
1283
1411
  return { ...e, repeatMode: r.payload };
1284
1412
  case "CYCLE_REPEAT":
1285
- return { ...e, repeatMode: Nn(e.repeatMode) };
1413
+ return { ...e, repeatMode: Vt(e.repeatMode) };
1286
1414
  case "TOGGLE_SHUFFLE": {
1287
1415
  if (e.tracks.length <= 1) return { ...e, isShuffled: !1, originalTracks: null };
1288
1416
  if (!e.isShuffled) {
1289
- const i = [...e.tracks], o = kr(i, e.currentIndex);
1417
+ const i = [...e.tracks], o = br(i, e.currentIndex);
1290
1418
  return {
1291
1419
  ...e,
1292
1420
  isShuffled: !0,
@@ -1295,29 +1423,29 @@ function ut(e, r) {
1295
1423
  currentIndex: 0
1296
1424
  };
1297
1425
  }
1298
- const t = e.originalTracks ? [...e.originalTracks] : [...e.tracks], a = e.tracks[e.currentIndex], n = Oe(t, a);
1426
+ const n = e.originalTracks ? [...e.originalTracks] : [...e.tracks], a = e.tracks[e.currentIndex], t = Ye(n, a);
1299
1427
  return {
1300
1428
  ...e,
1301
1429
  isShuffled: !1,
1302
1430
  originalTracks: null,
1303
- tracks: t,
1304
- currentIndex: q(n, t.length)
1431
+ tracks: n,
1432
+ currentIndex: q(t, n.length)
1305
1433
  };
1306
1434
  }
1307
1435
  case "NEXT": {
1308
- const t = Gn(e), a = t === e.currentIndex;
1436
+ const n = Ft(e), a = n === e.currentIndex;
1309
1437
  return {
1310
1438
  ...e,
1311
- currentIndex: t,
1439
+ currentIndex: n,
1312
1440
  ...a ? {} : J,
1313
1441
  isPaused: a ? e.isPaused : !1
1314
1442
  };
1315
1443
  }
1316
1444
  case "PREV": {
1317
- const t = _n(e), a = t === e.currentIndex;
1445
+ const n = Ct(e), a = n === e.currentIndex;
1318
1446
  return {
1319
1447
  ...e,
1320
- currentIndex: t,
1448
+ currentIndex: n,
1321
1449
  ...a ? {} : J,
1322
1450
  isPaused: a ? e.isPaused : !1
1323
1451
  };
@@ -1361,7 +1489,7 @@ function ut(e, r) {
1361
1489
  case "MEDIA_SOURCE_CLEARED":
1362
1490
  return { ...e, ...J };
1363
1491
  case "SET_VOLUME":
1364
- return { ...e, volume: Fe(r.payload) };
1492
+ return { ...e, volume: Be(r.payload) };
1365
1493
  case "SET_MUTED":
1366
1494
  return { ...e, muted: r.payload };
1367
1495
  case "TOGGLE_MUTE":
@@ -1369,46 +1497,46 @@ function ut(e, r) {
1369
1497
  case "SET_PLAYBACK_RATE":
1370
1498
  return { ...e, playbackRate: Xe(r.payload) };
1371
1499
  case "MEDIA_VOLUME_SYNC": {
1372
- const { volume: t, muted: a } = r.payload, n = Fe(t);
1373
- return n === e.volume && a === e.muted ? e : { ...e, volume: n, muted: a };
1500
+ const { volume: n, muted: a } = r.payload, t = Be(n);
1501
+ return t === e.volume && a === e.muted ? e : { ...e, volume: t, muted: a };
1374
1502
  }
1375
1503
  default:
1376
1504
  return e;
1377
1505
  }
1378
1506
  }
1379
- function De() {
1507
+ function Fe() {
1380
1508
  return typeof navigator > "u" || !("mediaSession" in navigator) ? null : navigator.mediaSession;
1381
1509
  }
1382
- function lt(e, r, t, a = {}) {
1510
+ function En(e, r, n, a = {}) {
1383
1511
  var M;
1384
- const n = S(r);
1385
- n.current = r;
1386
- const i = r.tracks[r.currentIndex], o = i == null ? void 0 : i.title, u = i == null ? void 0 : i.artist, d = i == null ? void 0 : i.album, p = Dn(i, (M = r.playlistMeta) == null ? void 0 : M.artworkUrl);
1512
+ const t = w(r);
1513
+ t.current = r;
1514
+ const i = r.tracks[r.currentIndex], o = i == null ? void 0 : i.title, u = i == null ? void 0 : i.artist, p = i == null ? void 0 : i.album, l = Ot(i, (M = r.playlistMeta) == null ? void 0 : M.artworkUrl);
1387
1515
  E(() => {
1388
- const g = De();
1516
+ const g = Fe();
1389
1517
  !e || !g || (g.metadata = new MediaMetadata({
1390
1518
  title: o ?? "Unknown track",
1391
1519
  artist: u,
1392
- album: d,
1393
- artwork: p ? [{ src: p }] : void 0
1520
+ album: p,
1521
+ artwork: l ? [{ src: l }] : void 0
1394
1522
  }));
1395
- }, [e, o, u, d, p]), E(() => {
1396
- const g = De();
1523
+ }, [e, o, u, p, l]), E(() => {
1524
+ const g = Fe();
1397
1525
  !e || !g || (g.playbackState = r.isPaused ? "paused" : "playing");
1398
1526
  }, [e, r.isPaused]);
1399
1527
  const f = a.seekForwardSeconds, m = a.seekBackwardSeconds;
1400
1528
  E(() => {
1401
- const g = De();
1529
+ const g = Fe();
1402
1530
  if (!(!e || !g)) {
1403
1531
  try {
1404
- g.setActionHandler("play", t.play), g.setActionHandler("pause", t.pause), g.setActionHandler("nexttrack", t.next), g.setActionHandler("previoustrack", t.prev), g.setActionHandler("seekto", (h) => {
1405
- typeof h.seekTime == "number" && Number.isFinite(h.seekTime) && t.seek(h.seekTime);
1532
+ g.setActionHandler("play", n.play), g.setActionHandler("pause", n.pause), g.setActionHandler("nexttrack", n.next), g.setActionHandler("previoustrack", n.prev), g.setActionHandler("seekto", (h) => {
1533
+ typeof h.seekTime == "number" && Number.isFinite(h.seekTime) && n.seek(h.seekTime);
1406
1534
  }), typeof f == "number" && f > 0 ? g.setActionHandler("seekforward", () => {
1407
- const h = n.current, x = h.currentTime + f, y = h.duration, b = Number.isFinite(y) && y > 0 ? y : x;
1408
- t.seek(Math.min(x, b));
1535
+ const h = t.current, x = h.currentTime + f, y = h.duration, v = Number.isFinite(y) && y > 0 ? y : x;
1536
+ n.seek(Math.min(x, v));
1409
1537
  }) : g.setActionHandler("seekforward", null), typeof m == "number" && m > 0 ? g.setActionHandler("seekbackward", () => {
1410
- const h = n.current;
1411
- t.seek(Math.max(0, h.currentTime - m));
1538
+ const h = t.current;
1539
+ n.seek(Math.max(0, h.currentTime - m));
1412
1540
  }) : g.setActionHandler("seekbackward", null);
1413
1541
  } catch {
1414
1542
  }
@@ -1419,17 +1547,17 @@ function lt(e, r, t, a = {}) {
1419
1547
  }
1420
1548
  };
1421
1549
  }
1422
- }, [e, t, f, m]), E(() => {
1423
- var b, L;
1424
- const g = De();
1550
+ }, [e, n, f, m]), E(() => {
1551
+ var v, G;
1552
+ const g = Fe();
1425
1553
  if (!e || !g || !a.positionState) return;
1426
1554
  const h = r.duration, x = r.currentTime, y = r.playbackRate;
1427
1555
  try {
1428
1556
  if (!Number.isFinite(h) || h <= 0) {
1429
- (b = g.setPositionState) == null || b.call(g);
1557
+ (v = g.setPositionState) == null || v.call(g);
1430
1558
  return;
1431
1559
  }
1432
- (L = g.setPositionState) == null || L.call(g, {
1560
+ (G = g.setPositionState) == null || G.call(g, {
1433
1561
  duration: h,
1434
1562
  playbackRate: Number.isFinite(y) && y > 0 ? y : 1,
1435
1563
  position: Math.min(Math.max(0, x), h)
@@ -1437,15 +1565,15 @@ function lt(e, r, t, a = {}) {
1437
1565
  } catch {
1438
1566
  }
1439
1567
  return () => {
1440
- var w;
1568
+ var R;
1441
1569
  try {
1442
- (w = g.setPositionState) == null || w.call(g);
1570
+ (R = g.setPositionState) == null || R.call(g);
1443
1571
  } catch {
1444
1572
  }
1445
1573
  };
1446
1574
  }, [e, a.positionState, r.currentTime, r.duration, r.playbackRate]);
1447
1575
  }
1448
- const dt = {
1576
+ const Pn = {
1449
1577
  "--ginger-primary-color": "#111827",
1450
1578
  "--ginger-muted-color": "#6b7280",
1451
1579
  "--ginger-font-size": "14px",
@@ -1457,17 +1585,17 @@ const dt = {
1457
1585
  "--ginger-buffer-color": "rgba(107, 114, 128, 0.35)",
1458
1586
  "--ginger-focus-ring": "0 0 0 2px rgba(59, 130, 246, 0.45)"
1459
1587
  };
1460
- function pt({
1588
+ function Sn({
1461
1589
  children: e,
1462
1590
  initialTracks: r = [],
1463
- initialIndex: t = 0,
1591
+ initialIndex: n = 0,
1464
1592
  initialPlaylistMeta: a = null,
1465
- initialShuffle: n = !1,
1593
+ initialShuffle: t = !1,
1466
1594
  initialRepeatMode: i = "off",
1467
1595
  initialPlaybackMode: o = "playlist",
1468
1596
  initialPaused: u = !0,
1469
- initialVolume: d = 1,
1470
- initialMuted: p = !1,
1597
+ initialVolume: p = 1,
1598
+ initialMuted: l = !1,
1471
1599
  initialPlaybackRate: f = 1,
1472
1600
  initialStateKey: m,
1473
1601
  locale: M,
@@ -1475,214 +1603,214 @@ function pt({
1475
1603
  beforePlay: h,
1476
1604
  onPlayBlocked: x,
1477
1605
  retryOnError: y,
1478
- persistence: b,
1479
- hydrateOnMount: L = !1,
1480
- resumeOnTrackChange: w = !1,
1481
- unstyled: ge = !1,
1482
- asChild: fe = !1,
1606
+ persistence: v,
1607
+ hydrateOnMount: G = !1,
1608
+ resumeOnTrackChange: R = !1,
1609
+ unstyled: Z = !1,
1610
+ asChild: ye = !1,
1483
1611
  className: Ke,
1484
- style: Ue,
1485
- dir: sn,
1612
+ style: Oe,
1613
+ dir: dt,
1486
1614
  prevRestartThresholdSeconds: qe = 3,
1487
- onTrackChange: me,
1488
- onPlay: ye,
1489
- onPause: he,
1490
- onQueueEnd: ve,
1491
- onError: be,
1492
- onVolumeChange: ke,
1493
- onPlaybackRateChange: Te,
1615
+ onTrackChange: he,
1616
+ onPlay: ve,
1617
+ onPause: ke,
1618
+ onQueueEnd: be,
1619
+ onError: Te,
1620
+ onVolumeChange: Me,
1621
+ onPlaybackRateChange: xe,
1494
1622
  onSeek: H,
1495
1623
  debugLabel: Je
1496
1624
  }) {
1497
1625
  var ur;
1498
- const D = S(null), [s, k] = kn(
1499
- ut,
1626
+ const D = w(null), [s, b] = Pt(
1627
+ In,
1500
1628
  void 0,
1501
- () => cn({
1629
+ () => lt({
1502
1630
  tracks: r,
1503
- currentIndex: t,
1631
+ currentIndex: n,
1504
1632
  playlistMeta: a,
1505
1633
  isPaused: u,
1506
- isShuffled: n,
1634
+ isShuffled: t,
1507
1635
  repeatMode: i,
1508
1636
  playbackMode: o,
1509
- volume: d,
1510
- muted: p,
1637
+ volume: p,
1638
+ muted: l,
1511
1639
  playbackRate: f
1512
1640
  })
1513
- ), Z = S(s), Ve = S({
1641
+ ), ee = w(s), Ie = w({
1514
1642
  tracks: r,
1515
- currentIndex: t,
1643
+ currentIndex: n,
1516
1644
  playlistMeta: a,
1517
1645
  isPaused: u,
1518
- isShuffled: n,
1646
+ isShuffled: t,
1519
1647
  repeatMode: i,
1520
1648
  playbackMode: o,
1521
- volume: d,
1522
- muted: p,
1649
+ volume: p,
1650
+ muted: l,
1523
1651
  playbackRate: f
1524
1652
  });
1525
- Ve.current = {
1653
+ Ie.current = {
1526
1654
  tracks: r,
1527
- currentIndex: t,
1655
+ currentIndex: n,
1528
1656
  playlistMeta: a,
1529
1657
  isPaused: u,
1530
- isShuffled: n,
1658
+ isShuffled: t,
1531
1659
  repeatMode: i,
1532
1660
  playbackMode: o,
1533
- volume: d,
1534
- muted: p,
1661
+ volume: p,
1662
+ muted: l,
1535
1663
  playbackRate: f
1536
1664
  };
1537
- const de = S(void 0);
1665
+ const pe = w(void 0);
1538
1666
  E(() => {
1539
1667
  if (m === void 0) {
1540
- de.current = void 0;
1668
+ pe.current = void 0;
1541
1669
  return;
1542
1670
  }
1543
- if (de.current === void 0) {
1544
- de.current = m;
1671
+ if (pe.current === void 0) {
1672
+ pe.current = m;
1545
1673
  return;
1546
1674
  }
1547
- if (de.current === m) return;
1548
- de.current = m;
1549
- const l = Ve.current;
1550
- k({
1675
+ if (pe.current === m) return;
1676
+ pe.current = m;
1677
+ const d = Ie.current;
1678
+ b({
1551
1679
  type: "INIT",
1552
1680
  payload: {
1553
- tracks: l.tracks,
1554
- currentIndex: l.currentIndex,
1555
- playlistMeta: l.playlistMeta,
1556
- isPaused: l.isPaused,
1557
- isShuffled: l.isShuffled,
1558
- repeatMode: l.repeatMode,
1559
- playbackMode: l.playbackMode,
1560
- volume: l.volume,
1561
- muted: l.muted,
1562
- playbackRate: l.playbackRate
1681
+ tracks: d.tracks,
1682
+ currentIndex: d.currentIndex,
1683
+ playlistMeta: d.playlistMeta,
1684
+ isPaused: d.isPaused,
1685
+ isShuffled: d.isShuffled,
1686
+ repeatMode: d.repeatMode,
1687
+ playbackMode: d.playbackMode,
1688
+ volume: d.volume,
1689
+ muted: d.muted,
1690
+ playbackRate: d.playbackRate
1563
1691
  }
1564
1692
  });
1565
1693
  }, [m]), E(() => {
1566
- Z.current = s;
1694
+ ee.current = s;
1567
1695
  }, [s]);
1568
1696
  const Ze = s.tracks[s.currentIndex] ?? null;
1569
1697
  E(() => {
1570
- me == null || me(Ze, s.currentIndex);
1571
- }, [Ze, s.currentIndex, me]), E(() => {
1572
- s.errorMessage && (be == null || be(s.errorMessage));
1573
- }, [s.errorMessage, be]);
1574
- const Me = S(0), er = S(void 0), _ = y ? typeof y == "object" ? y : {} : null, rr = (_ == null ? void 0 : _.maxRetries) ?? 3, nr = (_ == null ? void 0 : _.delayMs) ?? 1500, tr = (_ == null ? void 0 : _.retryableErrors) ?? ["MEDIA_ERR_NETWORK"], ar = (_ == null ? void 0 : _.skipOnUnrecoverable) ?? !1;
1698
+ he == null || he(Ze, s.currentIndex);
1699
+ }, [Ze, s.currentIndex, he]), E(() => {
1700
+ s.errorMessage && (Te == null || Te(s.errorMessage));
1701
+ }, [s.errorMessage, Te]);
1702
+ const Ee = w(0), er = w(void 0), _ = y ? typeof y == "object" ? y : {} : null, rr = (_ == null ? void 0 : _.maxRetries) ?? 3, tr = (_ == null ? void 0 : _.delayMs) ?? 1500, nr = (_ == null ? void 0 : _.retryableErrors) ?? ["MEDIA_ERR_NETWORK"], ar = (_ == null ? void 0 : _.skipOnUnrecoverable) ?? !1;
1575
1703
  E(() => {
1576
- var v;
1577
- const l = (v = s.tracks[s.currentIndex]) == null ? void 0 : v.fileUrl;
1578
- er.current !== l && (Me.current = 0, er.current = l);
1704
+ var k;
1705
+ const d = (k = s.tracks[s.currentIndex]) == null ? void 0 : k.fileUrl;
1706
+ er.current !== d && (Ee.current = 0, er.current = d);
1579
1707
  }, [s.currentIndex, s.tracks]), E(() => {
1580
1708
  if (!_ || !s.errorMessage) return;
1581
- if (!tr.some((G) => s.errorMessage.includes(G))) {
1709
+ if (!nr.some((L) => s.errorMessage.includes(L))) {
1582
1710
  if (ar && s.tracks.length > 1) {
1583
- const G = setTimeout(() => k({ type: "NEXT" }), 500);
1584
- return () => clearTimeout(G);
1711
+ const L = setTimeout(() => b({ type: "NEXT" }), 500);
1712
+ return () => clearTimeout(L);
1585
1713
  }
1586
1714
  return;
1587
1715
  }
1588
- if (Me.current >= rr) return;
1589
- const v = Me.current, T = nr * 2 ** v, P = setTimeout(() => {
1590
- Me.current = v + 1, k({ type: "MEDIA_CANPLAY" });
1591
- const G = D.current;
1592
- G && (G.load(), k({ type: "PLAY" }));
1716
+ if (Ee.current >= rr) return;
1717
+ const k = Ee.current, T = tr * 2 ** k, P = setTimeout(() => {
1718
+ Ee.current = k + 1, b({ type: "MEDIA_CANPLAY" });
1719
+ const L = D.current;
1720
+ L && (L.load(), b({ type: "PLAY" }));
1593
1721
  }, T);
1594
1722
  return () => clearTimeout(P);
1595
1723
  }, [
1596
1724
  _,
1597
1725
  rr,
1598
- nr,
1599
1726
  tr,
1727
+ nr,
1600
1728
  ar,
1601
1729
  s.errorMessage,
1602
1730
  s.tracks.length
1603
1731
  ]);
1604
- const xe = S(void 0);
1732
+ const Pe = w(void 0);
1605
1733
  E(() => {
1606
- if (xe.current === void 0) {
1607
- xe.current = s.isPaused;
1734
+ if (Pe.current === void 0) {
1735
+ Pe.current = s.isPaused;
1608
1736
  return;
1609
1737
  }
1610
- xe.current !== s.isPaused && (s.isPaused ? he == null || he() : ye == null || ye()), xe.current = s.isPaused;
1611
- }, [s.isPaused, he, ye]);
1612
- const Ie = S(void 0), Ee = S(void 0);
1738
+ Pe.current !== s.isPaused && (s.isPaused ? ke == null || ke() : ve == null || ve()), Pe.current = s.isPaused;
1739
+ }, [s.isPaused, ke, ve]);
1740
+ const Se = w(void 0), Ae = w(void 0);
1613
1741
  E(() => {
1614
- if (Ie.current === void 0 || Ee.current === void 0) {
1615
- Ie.current = s.volume, Ee.current = s.muted;
1742
+ if (Se.current === void 0 || Ae.current === void 0) {
1743
+ Se.current = s.volume, Ae.current = s.muted;
1616
1744
  return;
1617
1745
  }
1618
- (Ie.current !== s.volume || Ee.current !== s.muted) && (ke == null || ke(s.volume, s.muted)), Ie.current = s.volume, Ee.current = s.muted;
1619
- }, [s.volume, s.muted, ke]);
1620
- const Pe = S(void 0);
1746
+ (Se.current !== s.volume || Ae.current !== s.muted) && (Me == null || Me(s.volume, s.muted)), Se.current = s.volume, Ae.current = s.muted;
1747
+ }, [s.volume, s.muted, Me]);
1748
+ const Re = w(void 0);
1621
1749
  E(() => {
1622
- if (Pe.current === void 0) {
1623
- Pe.current = s.playbackRate;
1750
+ if (Re.current === void 0) {
1751
+ Re.current = s.playbackRate;
1624
1752
  return;
1625
1753
  }
1626
- Pe.current !== s.playbackRate && (Te == null || Te(s.playbackRate)), Pe.current = s.playbackRate;
1627
- }, [s.playbackRate, Te]);
1754
+ Re.current !== s.playbackRate && (xe == null || xe(s.playbackRate)), Re.current = s.playbackRate;
1755
+ }, [s.playbackRate, xe]);
1628
1756
  const B = I(() => {
1629
- k({ type: "PLAY" });
1757
+ b({ type: "PLAY" });
1630
1758
  }, []), O = I(() => {
1631
- var l;
1632
- k({ type: "PAUSE" }), (l = D.current) == null || l.pause();
1759
+ var d;
1760
+ b({ type: "PAUSE" }), (d = D.current) == null || d.pause();
1633
1761
  }, []), ne = I(() => {
1634
- Z.current.isPaused ? B() : O();
1635
- }, [O, B]), C = I(
1636
- (l) => {
1637
- const v = D.current;
1638
- v && Number.isFinite(l) && (v.currentTime = Math.max(0, l), H == null || H(Math.max(0, l)));
1762
+ ee.current.isPaused ? B() : O();
1763
+ }, [O, B]), U = I(
1764
+ (d) => {
1765
+ const k = D.current;
1766
+ k && Number.isFinite(d) && (k.currentTime = Math.max(0, d), H == null || H(Math.max(0, d)));
1639
1767
  },
1640
1768
  [H]
1641
- ), Q = I((l) => {
1642
- k({ type: "SET_VOLUME", payload: Fe(l) });
1643
- }, []), j = I((l) => {
1644
- k({ type: "SET_MUTED", payload: l });
1769
+ ), Q = I((d) => {
1770
+ b({ type: "SET_VOLUME", payload: Be(d) });
1771
+ }, []), j = I((d) => {
1772
+ b({ type: "SET_MUTED", payload: d });
1645
1773
  }, []), z = I(() => {
1646
- k({ type: "TOGGLE_MUTE" });
1647
- }, []), W = I((l) => {
1648
- k({ type: "SET_PLAYBACK_RATE", payload: Xe(l) });
1774
+ b({ type: "TOGGLE_MUTE" });
1775
+ }, []), W = I((d) => {
1776
+ b({ type: "SET_PLAYBACK_RATE", payload: Xe(d) });
1649
1777
  }, []), X = I(() => {
1650
- k({ type: "NEXT" });
1778
+ b({ type: "NEXT" });
1651
1779
  }, []), K = I(() => {
1652
- const l = D.current, v = qe ?? 3;
1653
- l && v > 0 && l.currentTime > v ? (l.currentTime = 0, H == null || H(0)) : k({ type: "PREV" });
1654
- }, [qe, H]), te = I((l) => {
1655
- k({ type: "SET_REPEAT", payload: l });
1656
- }, []), ae = I(() => {
1657
- k({ type: "CYCLE_REPEAT" });
1780
+ const d = D.current, k = qe ?? 3;
1781
+ d && k > 0 && d.currentTime > k ? (d.currentTime = 0, H == null || H(0)) : b({ type: "PREV" });
1782
+ }, [qe, H]), ae = I((d) => {
1783
+ b({ type: "SET_REPEAT", payload: d });
1658
1784
  }, []), ie = I(() => {
1659
- k({ type: "TOGGLE_SHUFFLE" });
1660
- }, []), Ae = I((l, v) => {
1661
- k({ type: "SET_QUEUE", payload: { tracks: l, currentIndex: v } });
1662
- }, []), Re = I((l, v, T) => {
1663
- k({ type: "INSERT_TRACK", payload: { track: l, index: v, autoPlay: T } });
1664
- }, []), Se = I((l) => {
1665
- k({ type: "REMOVE_TRACK", payload: { index: l } });
1666
- }, []), we = I((l, v) => {
1667
- k({ type: "MOVE_TRACK", payload: { fromIndex: l, toIndex: v } });
1668
- }, []), _e = I((l) => {
1669
- k({ type: "ADD_NEXT", payload: { track: l } });
1670
- }, []), oe = I((l) => {
1671
- k({ type: "SET_INDEX", payload: { index: l, autoPlay: !0 } });
1672
- }, []), Ge = I((l) => {
1673
- k({ type: "SET_INDEX", payload: { index: l, autoPlay: !1 } });
1674
- }, []), Ne = I((l) => {
1675
- k({ type: "SET_PLAYLIST_META", payload: l });
1676
- }, []), ce = I((l) => {
1677
- k({ type: "SET_PLAYBACK_MODE", payload: l });
1678
- }, []), Le = I((l) => {
1679
- k({ type: "INIT", payload: l });
1785
+ b({ type: "CYCLE_REPEAT" });
1786
+ }, []), oe = I(() => {
1787
+ b({ type: "TOGGLE_SHUFFLE" });
1788
+ }, []), we = I((d, k) => {
1789
+ b({ type: "SET_QUEUE", payload: { tracks: d, currentIndex: k } });
1790
+ }, []), Ge = I((d, k, T) => {
1791
+ b({ type: "INSERT_TRACK", payload: { track: d, index: k, autoPlay: T } });
1792
+ }, []), _e = I((d) => {
1793
+ b({ type: "REMOVE_TRACK", payload: { index: d } });
1794
+ }, []), Ne = I((d, k) => {
1795
+ b({ type: "MOVE_TRACK", payload: { fromIndex: d, toIndex: k } });
1796
+ }, []), Le = I((d) => {
1797
+ b({ type: "ADD_NEXT", payload: { track: d } });
1798
+ }, []), ce = I((d) => {
1799
+ b({ type: "SET_INDEX", payload: { index: d, autoPlay: !0 } });
1800
+ }, []), De = I((d) => {
1801
+ b({ type: "SET_INDEX", payload: { index: d, autoPlay: !1 } });
1802
+ }, []), Ue = I((d) => {
1803
+ b({ type: "SET_PLAYLIST_META", payload: d });
1804
+ }, []), se = I((d) => {
1805
+ b({ type: "SET_PLAYBACK_MODE", payload: d });
1806
+ }, []), Ce = I((d) => {
1807
+ b({ type: "INIT", payload: d });
1680
1808
  }, []);
1681
1809
  E(() => {
1682
- if (!(!b || !L))
1810
+ if (!(!v || !G))
1683
1811
  try {
1684
- const l = b.get("ginger:volume"), v = b.get("ginger:muted"), T = b.get("ginger:playbackRate"), P = b.get("ginger:repeatMode"), G = b.get("ginger:currentIndex"), Y = Ve.current;
1685
- k({
1812
+ const d = v.get("ginger:volume"), k = v.get("ginger:muted"), T = v.get("ginger:playbackRate"), P = v.get("ginger:repeatMode"), L = v.get("ginger:currentIndex"), Y = Ie.current;
1813
+ b({
1686
1814
  type: "INIT",
1687
1815
  payload: {
1688
1816
  tracks: Y.tracks,
@@ -1690,171 +1818,171 @@ function pt({
1690
1818
  isPaused: Y.isPaused,
1691
1819
  isShuffled: Y.isShuffled,
1692
1820
  playbackMode: Y.playbackMode,
1693
- currentIndex: typeof G == "number" ? G : Y.currentIndex,
1821
+ currentIndex: typeof L == "number" ? L : Y.currentIndex,
1694
1822
  repeatMode: P === "off" || P === "all" || P === "one" ? P : Y.repeatMode,
1695
- volume: typeof l == "number" ? l : Y.volume,
1696
- muted: typeof v == "boolean" ? v : Y.muted,
1823
+ volume: typeof d == "number" ? d : Y.volume,
1824
+ muted: typeof k == "boolean" ? k : Y.muted,
1697
1825
  playbackRate: typeof T == "number" ? T : Y.playbackRate
1698
1826
  }
1699
1827
  });
1700
- } catch (l) {
1701
- process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.get() threw during hydration:", l);
1828
+ } catch (d) {
1829
+ process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.get() threw during hydration:", d);
1702
1830
  }
1703
- }, [L, b]), E(() => {
1704
- if (b)
1831
+ }, [G, v]), E(() => {
1832
+ if (v)
1705
1833
  try {
1706
- b.set("ginger:volume", s.volume), b.set("ginger:muted", s.muted), b.set("ginger:playbackRate", s.playbackRate), b.set("ginger:repeatMode", s.repeatMode), b.set("ginger:currentIndex", s.currentIndex);
1707
- } catch (l) {
1708
- process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw:", l);
1834
+ v.set("ginger:volume", s.volume), v.set("ginger:muted", s.muted), v.set("ginger:playbackRate", s.playbackRate), v.set("ginger:repeatMode", s.repeatMode), v.set("ginger:currentIndex", s.currentIndex);
1835
+ } catch (d) {
1836
+ process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw:", d);
1709
1837
  }
1710
1838
  }, [
1711
- b,
1839
+ v,
1712
1840
  s.volume,
1713
1841
  s.muted,
1714
1842
  s.playbackRate,
1715
1843
  s.repeatMode,
1716
1844
  s.currentIndex
1717
1845
  ]), E(() => {
1718
- if (!b || !w) return;
1719
- const l = s.tracks[s.currentIndex];
1720
- if (!l) return;
1721
- const v = `ginger:resume:${Ye(l)}`;
1846
+ if (!v || !R) return;
1847
+ const d = s.tracks[s.currentIndex];
1848
+ if (!d) return;
1849
+ const k = `ginger:resume:${Qe(d)}`;
1722
1850
  try {
1723
- const T = b.get(v);
1724
- typeof T == "number" && Number.isFinite(T) && C(T);
1851
+ const T = v.get(k);
1852
+ typeof T == "number" && Number.isFinite(T) && U(T);
1725
1853
  } catch (T) {
1726
1854
  process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.get() threw during resume:", T);
1727
1855
  }
1728
- }, [b, w, s.currentIndex, s.tracks, C]), E(() => {
1729
- if (!b || !w) return;
1730
- const l = setInterval(() => {
1731
- const v = Z.current, T = v.tracks[v.currentIndex];
1732
- if (!T || !(v.currentTime >= 0)) return;
1733
- const P = `ginger:resume:${Ye(T)}`;
1856
+ }, [v, R, s.currentIndex, s.tracks, U]), E(() => {
1857
+ if (!v || !R) return;
1858
+ const d = setInterval(() => {
1859
+ const k = ee.current, T = k.tracks[k.currentIndex];
1860
+ if (!T || !(k.currentTime >= 0)) return;
1861
+ const P = `ginger:resume:${Qe(T)}`;
1734
1862
  try {
1735
- b.set(P, v.currentTime);
1736
- } catch (G) {
1737
- process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw during resume save:", G);
1863
+ v.set(P, k.currentTime);
1864
+ } catch (L) {
1865
+ process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw during resume save:", L);
1738
1866
  }
1739
1867
  }, 5e3);
1740
- return () => clearInterval(l);
1741
- }, [b, w]);
1742
- const un = (ur = s.tracks[s.currentIndex]) == null ? void 0 : ur.fileUrl;
1868
+ return () => clearInterval(d);
1869
+ }, [v, R]);
1870
+ const pt = (ur = s.tracks[s.currentIndex]) == null ? void 0 : ur.fileUrl;
1743
1871
  E(() => {
1744
- const l = D.current;
1745
- if (!l) return;
1872
+ const d = D.current;
1873
+ if (!d) return;
1746
1874
  if (s.isPaused) {
1747
- l.pause();
1875
+ d.pause();
1748
1876
  return;
1749
1877
  }
1750
- if (l.ended && gr(Z.current).kind === "stop") {
1751
- k({ type: "PAUSE" });
1878
+ if (d.ended && gr(ee.current).kind === "stop") {
1879
+ b({ type: "PAUSE" });
1752
1880
  return;
1753
1881
  }
1754
- let v = !1;
1882
+ let k = !1;
1755
1883
  return (async () => {
1756
1884
  if (h) {
1757
1885
  let T = !1;
1758
1886
  try {
1759
1887
  T = await h();
1760
1888
  } catch (P) {
1761
- const G = P instanceof Error ? P.message : "beforePlay rejected";
1762
- k({ type: "MEDIA_ERROR", payload: { message: G } });
1889
+ const L = P instanceof Error ? P.message : "beforePlay rejected";
1890
+ b({ type: "MEDIA_ERROR", payload: { message: L } });
1763
1891
  return;
1764
1892
  }
1765
1893
  if (!T) {
1766
- v || (k({ type: "PAUSE" }), x == null || x());
1894
+ k || (b({ type: "PAUSE" }), x == null || x());
1767
1895
  return;
1768
1896
  }
1769
1897
  }
1770
- v || l.play().catch((T) => {
1898
+ k || d.play().catch((T) => {
1771
1899
  const P = T instanceof Error ? T.message : typeof T == "string" ? T : "Playback failed (e.g. autoplay blocked or unavailable source)";
1772
- k({ type: "MEDIA_ERROR", payload: { message: P } });
1900
+ b({ type: "MEDIA_ERROR", payload: { message: P } });
1773
1901
  });
1774
1902
  })(), () => {
1775
- v = !0;
1903
+ k = !0;
1776
1904
  };
1777
- }, [h, un, x, s.isPaused]);
1778
- const se = I(() => {
1905
+ }, [h, pt, x, s.isPaused]);
1906
+ const ue = I(() => {
1779
1907
  var T;
1780
- const l = gr(Z.current);
1781
- if (l.kind === "replay_same") {
1908
+ const d = gr(ee.current);
1909
+ if (d.kind === "replay_same") {
1782
1910
  const P = D.current;
1783
- P && (P.currentTime = 0), k({ type: "PLAY" });
1911
+ P && (P.currentTime = 0), b({ type: "PLAY" });
1784
1912
  return;
1785
1913
  }
1786
- if (l.kind === "stop") {
1787
- (T = D.current) == null || T.pause(), k({ type: "PAUSE" }), ve == null || ve();
1914
+ if (d.kind === "stop") {
1915
+ (T = D.current) == null || T.pause(), b({ type: "PAUSE" }), be == null || be();
1788
1916
  return;
1789
1917
  }
1790
- const v = l.nextIndex;
1791
- k({ type: "SET_INDEX", payload: { index: v, autoPlay: !0 } });
1792
- }, [ve]), ln = R(
1793
- () => ({ play: B, pause: O, next: X, prev: K, seek: C }),
1794
- [B, O, X, K, C]
1795
- ), dn = typeof g == "object" ? !0 : !!g, pn = R(
1918
+ const k = d.nextIndex;
1919
+ b({ type: "SET_INDEX", payload: { index: k, autoPlay: !0 } });
1920
+ }, [be]), gt = A(
1921
+ () => ({ play: B, pause: O, next: X, prev: K, seek: U }),
1922
+ [B, O, X, K, U]
1923
+ ), ft = typeof g == "object" ? !0 : !!g, mt = A(
1796
1924
  () => typeof g == "object" ? g : {},
1797
1925
  [g]
1798
1926
  );
1799
- lt(dn, s, ln, pn);
1800
- const ir = sn ?? (M != null && M.seek && /[\u0590-\u08FF]/.test(M.seek) ? "rtl" : "ltr"), gn = R(
1927
+ En(ft, s, gt, mt);
1928
+ const ir = dt ?? (M != null && M.seek && /[\u0590-\u08FF]/.test(M.seek) ? "rtl" : "ltr"), yt = A(
1801
1929
  () => ({
1802
1930
  state: s,
1803
- dispatch: k,
1931
+ dispatch: b,
1804
1932
  audioRef: D,
1805
- notifyEnded: se,
1806
- init: Le,
1933
+ notifyEnded: ue,
1934
+ init: Ce,
1807
1935
  play: B,
1808
1936
  pause: O,
1809
1937
  togglePlayPause: ne,
1810
- seek: C,
1938
+ seek: U,
1811
1939
  setVolume: Q,
1812
1940
  setMuted: j,
1813
1941
  toggleMute: z,
1814
1942
  setPlaybackRate: W,
1815
1943
  next: X,
1816
1944
  prev: K,
1817
- setRepeatMode: te,
1818
- cycleRepeat: ae,
1819
- toggleShuffle: ie,
1820
- setQueue: Ae,
1821
- insertTrackAt: Re,
1822
- removeTrackAt: Se,
1823
- moveTrack: we,
1824
- enqueueNext: _e,
1825
- playTrackAt: oe,
1826
- selectTrackAt: Ge,
1827
- setPlaylistMeta: Ne,
1828
- setPlaybackMode: ce
1945
+ setRepeatMode: ae,
1946
+ cycleRepeat: ie,
1947
+ toggleShuffle: oe,
1948
+ setQueue: we,
1949
+ insertTrackAt: Ge,
1950
+ removeTrackAt: _e,
1951
+ moveTrack: Ne,
1952
+ enqueueNext: Le,
1953
+ playTrackAt: ce,
1954
+ selectTrackAt: De,
1955
+ setPlaylistMeta: Ue,
1956
+ setPlaybackMode: se
1829
1957
  }),
1830
1958
  [
1831
- ae,
1832
- Le,
1959
+ ie,
1960
+ Ce,
1833
1961
  X,
1834
- se,
1962
+ ue,
1835
1963
  O,
1836
1964
  B,
1837
- oe,
1838
- Re,
1839
- Se,
1840
- we,
1841
- _e,
1965
+ ce,
1842
1966
  Ge,
1967
+ _e,
1968
+ Ne,
1969
+ Le,
1970
+ De,
1843
1971
  K,
1844
- C,
1972
+ U,
1845
1973
  j,
1846
1974
  W,
1847
- Ae,
1848
- te,
1849
- Ne,
1850
- ce,
1975
+ we,
1976
+ ae,
1977
+ Ue,
1978
+ se,
1851
1979
  Q,
1852
1980
  s,
1853
1981
  z,
1854
1982
  ne,
1855
- ie
1983
+ oe
1856
1984
  ]
1857
- ), fn = R(
1985
+ ), ht = A(
1858
1986
  () => ({
1859
1987
  tracks: s.tracks,
1860
1988
  currentIndex: s.currentIndex,
@@ -1863,26 +1991,26 @@ function pt({
1863
1991
  repeatMode: s.repeatMode,
1864
1992
  originalTracks: s.originalTracks,
1865
1993
  playlistMeta: s.playlistMeta,
1866
- init: Le,
1994
+ init: Ce,
1867
1995
  play: B,
1868
1996
  pause: O,
1869
1997
  togglePlayPause: ne,
1870
1998
  next: X,
1871
1999
  prev: K,
1872
- setRepeatMode: te,
1873
- cycleRepeat: ae,
1874
- toggleShuffle: ie,
2000
+ setRepeatMode: ae,
2001
+ cycleRepeat: ie,
2002
+ toggleShuffle: oe,
1875
2003
  playbackMode: s.playbackMode,
1876
- setQueue: Ae,
1877
- insertTrackAt: Re,
1878
- removeTrackAt: Se,
1879
- moveTrack: we,
1880
- enqueueNext: _e,
1881
- playTrackAt: oe,
1882
- selectTrackAt: Ge,
1883
- setPlaylistMeta: Ne,
1884
- setPlaybackMode: ce,
1885
- dispatch: k
2004
+ setQueue: we,
2005
+ insertTrackAt: Ge,
2006
+ removeTrackAt: _e,
2007
+ moveTrack: Ne,
2008
+ enqueueNext: Le,
2009
+ playTrackAt: ce,
2010
+ selectTrackAt: De,
2011
+ setPlaylistMeta: Ue,
2012
+ setPlaybackMode: se,
2013
+ dispatch: b
1886
2014
  }),
1887
2015
  [
1888
2016
  s.tracks,
@@ -1893,26 +2021,26 @@ function pt({
1893
2021
  s.playbackMode,
1894
2022
  s.originalTracks,
1895
2023
  s.playlistMeta,
1896
- Le,
2024
+ Ce,
1897
2025
  B,
1898
2026
  O,
1899
2027
  ne,
1900
2028
  X,
1901
2029
  K,
1902
- te,
1903
2030
  ae,
1904
2031
  ie,
1905
- Ae,
1906
- Re,
1907
- Se,
1908
- we,
1909
- _e,
1910
2032
  oe,
2033
+ we,
1911
2034
  Ge,
2035
+ _e,
1912
2036
  Ne,
1913
- ce
2037
+ Le,
2038
+ ce,
2039
+ De,
2040
+ Ue,
2041
+ se
1914
2042
  ]
1915
- ), mn = R(
2043
+ ), vt = A(
1916
2044
  () => ({
1917
2045
  currentTime: s.currentTime,
1918
2046
  duration: s.duration,
@@ -1922,14 +2050,14 @@ function pt({
1922
2050
  volume: s.volume,
1923
2051
  muted: s.muted,
1924
2052
  playbackRate: s.playbackRate,
1925
- seek: C,
2053
+ seek: U,
1926
2054
  setVolume: Q,
1927
2055
  setMuted: j,
1928
2056
  toggleMute: z,
1929
2057
  setPlaybackRate: W,
1930
2058
  audioRef: D,
1931
- notifyEnded: se,
1932
- dispatch: k
2059
+ notifyEnded: ue,
2060
+ dispatch: b
1933
2061
  }),
1934
2062
  [
1935
2063
  s.currentTime,
@@ -1940,14 +2068,14 @@ function pt({
1940
2068
  s.volume,
1941
2069
  s.muted,
1942
2070
  s.playbackRate,
1943
- C,
2071
+ U,
1944
2072
  Q,
1945
2073
  j,
1946
2074
  z,
1947
2075
  W,
1948
- se
2076
+ ue
1949
2077
  ]
1950
- ), yn = R(
2078
+ ), kt = A(
1951
2079
  () => ({
1952
2080
  currentTime: s.currentTime,
1953
2081
  duration: s.duration,
@@ -1962,35 +2090,35 @@ function pt({
1962
2090
  s.isBuffering,
1963
2091
  s.errorMessage
1964
2092
  ]
1965
- ), hn = R(
2093
+ ), bt = A(
1966
2094
  () => ({
1967
2095
  volume: s.volume,
1968
2096
  muted: s.muted,
1969
2097
  playbackRate: s.playbackRate,
1970
- seek: C,
2098
+ seek: U,
1971
2099
  setVolume: Q,
1972
2100
  setMuted: j,
1973
2101
  toggleMute: z,
1974
2102
  setPlaybackRate: W,
1975
2103
  audioRef: D,
1976
- notifyEnded: se,
1977
- dispatch: k
2104
+ notifyEnded: ue,
2105
+ dispatch: b
1978
2106
  }),
1979
2107
  [
1980
2108
  s.volume,
1981
2109
  s.muted,
1982
2110
  s.playbackRate,
1983
- C,
2111
+ U,
1984
2112
  Q,
1985
2113
  j,
1986
2114
  z,
1987
2115
  W,
1988
- se
2116
+ ue
1989
2117
  ]
1990
- ), or = br(s), cr = R(
1991
- () => ge ? Ue : { ...dt, ...Ue },
1992
- [Ue, ge]
1993
- ), $ = R(
2118
+ ), or = kr(s), cr = A(
2119
+ () => Z ? Oe : { ...Pn, ...Oe },
2120
+ [Oe, Z]
2121
+ ), $ = A(
1994
2122
  () => ({
1995
2123
  className: Ke,
1996
2124
  style: cr,
@@ -1998,22 +2126,22 @@ function pt({
1998
2126
  dir: ir
1999
2127
  }),
2000
2128
  [Ke, cr, or, ir]
2001
- ), Be = S(null), sr = S({
2129
+ ), $e = w(null), sr = w({
2002
2130
  play: B,
2003
2131
  pause: O,
2004
2132
  togglePlayPause: ne,
2005
2133
  next: X,
2006
2134
  prev: K,
2007
- seek: C,
2135
+ seek: U,
2008
2136
  setVolume: Q,
2009
2137
  setMuted: j,
2010
2138
  toggleMute: z,
2011
2139
  setPlaybackRate: W,
2012
- setRepeatMode: te,
2013
- cycleRepeat: ae,
2014
- toggleShuffle: ie,
2015
- playTrackAt: oe,
2016
- setPlaybackMode: ce
2140
+ setRepeatMode: ae,
2141
+ cycleRepeat: ie,
2142
+ toggleShuffle: oe,
2143
+ playTrackAt: ce,
2144
+ setPlaybackMode: se
2017
2145
  });
2018
2146
  sr.current = {
2019
2147
  play: B,
@@ -2021,44 +2149,44 @@ function pt({
2021
2149
  togglePlayPause: ne,
2022
2150
  next: X,
2023
2151
  prev: K,
2024
- seek: C,
2152
+ seek: U,
2025
2153
  setVolume: Q,
2026
2154
  setMuted: j,
2027
2155
  toggleMute: z,
2028
2156
  setPlaybackRate: W,
2029
- setRepeatMode: te,
2030
- cycleRepeat: ae,
2031
- toggleShuffle: ie,
2032
- playTrackAt: oe,
2033
- setPlaybackMode: ce
2157
+ setRepeatMode: ae,
2158
+ cycleRepeat: ie,
2159
+ toggleShuffle: oe,
2160
+ playTrackAt: ce,
2161
+ setPlaybackMode: se
2034
2162
  }, E(() => {
2035
2163
  var T;
2036
- const l = typeof window < "u" ? window.__GINGER_DEVTOOLS__ : null;
2037
- if (!l || typeof l.register != "function") return;
2038
- const v = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `ginger-${Date.now()}-${Math.random().toString(36).slice(2)}`;
2039
- return Be.current = v, l.register(v, {
2164
+ const d = typeof window < "u" ? window.__GINGER_DEVTOOLS__ : null;
2165
+ if (!d || typeof d.register != "function") return;
2166
+ const k = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `ginger-${Date.now()}-${Math.random().toString(36).slice(2)}`;
2167
+ return $e.current = k, d.register(k, {
2040
2168
  label: Je,
2041
- state: Z.current,
2169
+ state: ee.current,
2042
2170
  actions: sr.current,
2043
2171
  audioSrc: ((T = D.current) == null ? void 0 : T.src) ?? null
2044
2172
  }), () => {
2045
- l.unregister(v), Be.current = null;
2173
+ d.unregister(k), $e.current = null;
2046
2174
  };
2047
2175
  }, [Je]), E(() => {
2048
- const l = typeof window < "u" ? window.__GINGER_DEVTOOLS__ : null;
2049
- if (!l || typeof l.update != "function") return;
2050
- const v = setInterval(() => {
2176
+ const d = typeof window < "u" ? window.__GINGER_DEVTOOLS__ : null;
2177
+ if (!d || typeof d.update != "function") return;
2178
+ const k = setInterval(() => {
2051
2179
  var P;
2052
- const T = Be.current;
2053
- T && l.update(T, {
2054
- state: Z.current,
2180
+ const T = $e.current;
2181
+ T && d.update(T, {
2182
+ state: ee.current,
2055
2183
  audioSrc: ((P = D.current) == null ? void 0 : P.src) ?? null
2056
2184
  });
2057
2185
  }, 250);
2058
- return () => clearInterval(v);
2186
+ return () => clearInterval(k);
2059
2187
  }, []);
2060
- const vn = R(() => {
2061
- if (!fe)
2188
+ const Tt = A(() => {
2189
+ if (!ye)
2062
2190
  return /* @__PURE__ */ c(
2063
2191
  "div",
2064
2192
  {
@@ -2069,36 +2197,44 @@ function pt({
2069
2197
  children: e
2070
2198
  }
2071
2199
  );
2072
- const l = Tn.only(e);
2073
- if (!Mn(l))
2200
+ const d = St.only(e);
2201
+ if (!At(d))
2074
2202
  throw new Error("Ginger.Provider asChild expects a single React element child.");
2075
- const v = l, T = v.props.style;
2076
- return xn(v, {
2077
- className: gt(v.props.className, $.className),
2203
+ const k = d, T = k.props.style;
2204
+ return Rt(k, {
2205
+ className: An(k.props.className, $.className),
2078
2206
  style: T && typeof T == "object" ? { ...T, ...$.style } : $.style,
2079
2207
  "data-ginger-playback": $["data-ginger-playback"],
2080
2208
  dir: $.dir
2081
2209
  });
2082
- }, [fe, e, $]);
2083
- return /* @__PURE__ */ c(Vn, { locale: M, children: /* @__PURE__ */ c(In.Provider, { value: fn, children: /* @__PURE__ */ c(En.Provider, { value: yn, children: /* @__PURE__ */ c(Pn.Provider, { value: hn, children: /* @__PURE__ */ c(An.Provider, { value: mn, children: /* @__PURE__ */ c(Tr.Provider, { value: gn, children: vn }) }) }) }) }) });
2210
+ }, [ye, e, $]), Mt = A(
2211
+ () => ({
2212
+ getInitialTracksSnapshot: () => Ie.current.tracks
2213
+ }),
2214
+ []
2215
+ );
2216
+ return /* @__PURE__ */ c(Qt, { locale: M, children: /* @__PURE__ */ c(vn, { value: Mt, children: /* @__PURE__ */ c(wt.Provider, { value: ht, children: /* @__PURE__ */ c(Gt.Provider, { value: kt, children: /* @__PURE__ */ c(_t.Provider, { value: bt, children: /* @__PURE__ */ c(Nt.Provider, { value: vt, children: /* @__PURE__ */ c(Tr.Provider, { value: yt, children: Tt }) }) }) }) }) }) });
2084
2217
  }
2085
- function gt(e, r) {
2086
- const t = [e, r].filter(Boolean).join(" ");
2087
- return t === "" ? void 0 : t;
2218
+ function An(e, r) {
2219
+ const n = [e, r].filter(Boolean).join(" ");
2220
+ return n === "" ? void 0 : n;
2088
2221
  }
2089
- const kt = {
2090
- Provider: pt,
2091
- Player: Fn,
2222
+ const Rn = Object.assign(ut, {
2223
+ Track: ct
2224
+ }), Un = {
2225
+ Provider: Sn,
2226
+ Player: Yt,
2227
+ Tracks: Rn,
2092
2228
  Current: {
2093
- Title: Hn,
2094
- Artist: Qn,
2095
- Album: jn,
2096
- Description: zn,
2097
- Copyright: Wn,
2098
- Genre: Xn,
2099
- Label: Kn,
2100
- Isrc: qn,
2101
- TrackNumber: Jn,
2229
+ Title: Kt,
2230
+ Artist: qt,
2231
+ Album: Jt,
2232
+ Description: Zt,
2233
+ Copyright: en,
2234
+ Genre: rn,
2235
+ Label: tn,
2236
+ Isrc: nn,
2237
+ TrackNumber: an,
2102
2238
  Year: Br,
2103
2239
  Lyrics: Or,
2104
2240
  LyricsSynced: $r,
@@ -2113,65 +2249,65 @@ const kt = {
2113
2249
  Remaining: qr,
2114
2250
  Progress: Jr,
2115
2251
  TimeRail: Zr,
2116
- BufferRail: en,
2117
- PlaybackState: rn,
2118
- ErrorMessage: nn
2252
+ BufferRail: et,
2253
+ PlaybackState: rt,
2254
+ ErrorMessage: tt
2119
2255
  },
2120
2256
  Queue: {
2121
- Title: at,
2122
- Subtitle: it,
2123
- Description: ot,
2124
- Copyright: ct,
2125
- Artwork: on
2257
+ Title: dn,
2258
+ Subtitle: pn,
2259
+ Description: gn,
2260
+ Copyright: fn,
2261
+ Artwork: it
2126
2262
  },
2127
2263
  Control: {
2128
- PlayPause: _r,
2129
- Repeat: Gr,
2264
+ PlayPause: Gr,
2265
+ Repeat: _r,
2130
2266
  Next: Nr,
2131
2267
  Previous: Lr,
2132
2268
  Shuffle: Dr,
2133
- SeekBar: Cr,
2134
- Volume: Fr,
2135
- Mute: Ur,
2269
+ SeekBar: Ur,
2270
+ Volume: Cr,
2271
+ Mute: Fr,
2136
2272
  PlaybackRate: Vr
2137
2273
  },
2138
2274
  Icon: {
2139
2275
  Play: Ir,
2140
2276
  Pause: xr,
2141
- SkipForward: Rr,
2142
- SkipBack: Ar,
2277
+ SkipForward: Ar,
2278
+ SkipBack: Sr,
2143
2279
  Shuffle: Pr,
2144
- Volume2: Sr,
2280
+ Volume2: Rr,
2145
2281
  VolumeX: wr,
2146
2282
  RepeatGlyph: Er,
2147
- Wrapper: U
2283
+ Wrapper: V
2148
2284
  },
2149
- Playlist: tt
2285
+ Playlist: ln
2150
2286
  };
2151
2287
  export {
2152
2288
  Yr as C,
2153
- kt as G,
2289
+ Un as G,
2154
2290
  $r as L,
2155
2291
  xr as P,
2156
2292
  Er as R,
2157
2293
  Pr as S,
2158
- Sr as V,
2159
- U as W,
2294
+ Rr as V,
2295
+ V as W,
2160
2296
  Ir as a,
2161
- Ar as b,
2162
- Rr as c,
2297
+ Sr as b,
2298
+ Ar as c,
2163
2299
  wr as d,
2164
2300
  Xe as e,
2165
- Fe as f,
2166
- Ce as g,
2301
+ Be as f,
2302
+ Ve as g,
2167
2303
  F as h,
2168
- et as i,
2169
- $n as j,
2170
- Bn as k,
2171
- On as l,
2172
- cn as m,
2173
- ut as n,
2174
- Zn as p,
2175
- rt as u
2304
+ cn as i,
2305
+ Wt as j,
2306
+ jt as k,
2307
+ zt as l,
2308
+ lt as m,
2309
+ In as n,
2310
+ on as p,
2311
+ sn as u
2176
2312
  };
2177
- //# sourceMappingURL=ginger-BHu7Ofna.js.map
2313
+ //# sourceMappingURL=ginger-Bc_8qZYi.js.map