@lucaismyname/ginger 0.0.26 → 0.0.29

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 (76) hide show
  1. package/README.md +40 -68
  2. package/dist/analyzer/liveAudioGraph.test.d.ts +2 -0
  3. package/dist/analyzer/liveAudioGraph.test.d.ts.map +1 -0
  4. package/dist/analyzer/useGingerLiveAnalyzer.test.d.ts +2 -0
  5. package/dist/analyzer/useGingerLiveAnalyzer.test.d.ts.map +1 -0
  6. package/dist/audio/GingerPlayer.d.ts.map +1 -1
  7. package/dist/client.cjs +1 -1
  8. package/dist/client.js +37 -28
  9. package/dist/components/controls/Controls.d.ts +1 -1
  10. package/dist/components/controls/Controls.d.ts.map +1 -1
  11. package/dist/components/current/Artwork.d.ts.map +1 -1
  12. package/dist/components/current/Chapters.d.ts.map +1 -1
  13. package/dist/components/current/Lyrics.d.ts +3 -1
  14. package/dist/components/current/Lyrics.d.ts.map +1 -1
  15. package/dist/components/current/LyricsSynced.d.ts.map +1 -1
  16. package/dist/components/current/Playback.d.ts +1 -1
  17. package/dist/components/current/Playback.d.ts.map +1 -1
  18. package/dist/components/current/QueueMeta.d.ts +1 -1
  19. package/dist/components/current/QueueMeta.d.ts.map +1 -1
  20. package/dist/components/current/Time.d.ts +2 -2
  21. package/dist/components/current/Time.d.ts.map +1 -1
  22. package/dist/components/current/Year.d.ts +1 -1
  23. package/dist/components/current/Year.d.ts.map +1 -1
  24. package/dist/components/icons/Pause.d.ts +2 -0
  25. package/dist/components/icons/Pause.d.ts.map +1 -0
  26. package/dist/components/icons/Play.d.ts +2 -0
  27. package/dist/components/icons/Play.d.ts.map +1 -0
  28. package/dist/components/icons/RepeatGlyph.d.ts +5 -0
  29. package/dist/components/icons/RepeatGlyph.d.ts.map +1 -0
  30. package/dist/components/icons/ShuffleIcon.d.ts +2 -0
  31. package/dist/components/icons/ShuffleIcon.d.ts.map +1 -0
  32. package/dist/components/icons/SkipBack.d.ts +2 -0
  33. package/dist/components/icons/SkipBack.d.ts.map +1 -0
  34. package/dist/components/icons/SkipForward.d.ts +2 -0
  35. package/dist/components/icons/SkipForward.d.ts.map +1 -0
  36. package/dist/components/icons/Volume2.d.ts +2 -0
  37. package/dist/components/icons/Volume2.d.ts.map +1 -0
  38. package/dist/components/icons/VolumeX.d.ts +2 -0
  39. package/dist/components/icons/VolumeX.d.ts.map +1 -0
  40. package/dist/components/icons/Wrapper.d.ts +14 -0
  41. package/dist/components/icons/Wrapper.d.ts.map +1 -0
  42. package/dist/components/icons/index.d.ts +11 -0
  43. package/dist/components/icons/index.d.ts.map +1 -0
  44. package/dist/components/queue/QueueDisplay.d.ts.map +1 -1
  45. package/dist/context/GingerLocaleContext.d.ts.map +1 -1
  46. package/dist/context/GingerProvider.d.ts +1 -1
  47. package/dist/context/GingerProvider.d.ts.map +1 -1
  48. package/dist/ginger-B26HM2Ja.cjs +2 -0
  49. package/dist/ginger-B26HM2Ja.cjs.map +1 -0
  50. package/dist/ginger-DlNYfHbV.js +2278 -0
  51. package/dist/ginger-DlNYfHbV.js.map +1 -0
  52. package/dist/ginger.d.ts +12 -0
  53. package/dist/ginger.d.ts.map +1 -1
  54. package/dist/index.cjs +1 -1
  55. package/dist/index.d.ts +2 -0
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +37 -28
  58. package/dist/testing/helpers.d.ts +1 -1
  59. package/dist/testing/helpers.d.ts.map +1 -1
  60. package/dist/testing/index.cjs +1 -1
  61. package/dist/testing/index.cjs.map +1 -1
  62. package/dist/testing/index.js +1 -1
  63. package/dist/testing/index.js.map +1 -1
  64. package/dist/testing/mockWebAudio.d.ts +47 -0
  65. package/dist/testing/mockWebAudio.d.ts.map +1 -0
  66. package/dist/types.d.ts +9 -0
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/{useNextTrackPrefetch-eR_p__O2.js → useNextTrackPrefetch-Y_fs2JEx.js} +51 -51
  69. package/dist/{useNextTrackPrefetch-eR_p__O2.js.map → useNextTrackPrefetch-Y_fs2JEx.js.map} +1 -1
  70. package/dist/{useNextTrackPrefetch-Cs4A1oFv.cjs → useNextTrackPrefetch-wSILz6TL.cjs} +2 -2
  71. package/dist/{useNextTrackPrefetch-Cs4A1oFv.cjs.map → useNextTrackPrefetch-wSILz6TL.cjs.map} +1 -1
  72. package/package.json +2 -2
  73. package/dist/ginger-DE4TKdCR.js +0 -1877
  74. package/dist/ginger-DE4TKdCR.js.map +0 -1
  75. package/dist/ginger-yY4Y5liv.cjs +0 -2
  76. package/dist/ginger-yY4Y5liv.cjs.map +0 -1
@@ -1,1877 +0,0 @@
1
- import { jsx as d, jsxs as q } from "react/jsx-runtime";
2
- import { useContext as Ge, createContext as Ne, useRef as O, useState as Nr, useEffect as E, useMemo as P, useReducer as wr, useCallback as v } from "react";
3
- import { b as _, u as j, g as $e, c as I, G as Cr, d as Lr } from "./GingerSplitContexts-BzBExb95.js";
4
- const Oe = Ne(null);
5
- function Dr() {
6
- const e = Ge(Oe);
7
- if (!e) throw new Error("Ginger components must be used within <Ginger.Provider>");
8
- return e;
9
- }
10
- function Ue(e) {
11
- const { buffered: r, duration: n } = e;
12
- return !(n > 0) || r.length === 0 ? 0 : Math.min(1, r.end(r.length - 1) / n);
13
- }
14
- function Fr({
15
- className: e,
16
- style: r,
17
- preload: n = "metadata",
18
- crossOrigin: t,
19
- respectReducedMotion: a = !1
20
- }) {
21
- var S;
22
- const { audioRef: i, dispatch: o, state: u, notifyEnded: l } = Dr(), s = ((S = u.tracks[u.currentIndex]) == null ? void 0 : S.fileUrl) ?? "", g = O({
23
- currentTime: -1,
24
- duration: -1,
25
- bufferedFraction: -1
26
- }), m = O(""), [y, k] = Nr(!1);
27
- E(() => {
28
- if (!a || typeof window > "u") return;
29
- const p = window.matchMedia("(prefers-reduced-motion: reduce)"), T = () => k(p.matches);
30
- return T(), p.addEventListener("change", T), () => p.removeEventListener("change", T);
31
- }, [a]);
32
- const b = (p, T = !1) => {
33
- const R = {
34
- currentTime: p.currentTime,
35
- duration: p.duration,
36
- bufferedFraction: Ue(p)
37
- }, w = g.current, Se = y ? 0.5 : 0.25, K = Math.abs(R.currentTime - w.currentTime) >= Se || Math.abs(R.duration - w.duration) >= 0.01 || Math.abs(R.bufferedFraction - w.bufferedFraction) >= 0.01;
38
- !T && !K || (g.current = R, o({
39
- type: "MEDIA_TIME_UPDATE",
40
- payload: R
41
- }));
42
- };
43
- return E(() => {
44
- const p = i.current;
45
- p && (p.volume = u.volume, p.muted = u.muted);
46
- }, [i, u.volume, u.muted]), E(() => {
47
- const p = i.current;
48
- if (p) {
49
- if (!s) {
50
- p.removeAttribute("src"), g.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, m.current !== "" && o({ type: "MEDIA_SOURCE_CLEARED" }), m.current = "";
51
- return;
52
- }
53
- p.getAttribute("src") !== s && (p.src = s, p.load(), g.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }), m.current = s;
54
- }
55
- }, [i, o, u.currentIndex, u.tracks, s]), E(() => {
56
- const p = i.current;
57
- p && (p.playbackRate = u.playbackRate);
58
- }, [i, u.playbackRate, s]), /* @__PURE__ */ d(
59
- "audio",
60
- {
61
- ref: i,
62
- className: e,
63
- style: r,
64
- preload: n,
65
- crossOrigin: t,
66
- controls: !1,
67
- playsInline: !0,
68
- onTimeUpdate: (p) => {
69
- b(p.currentTarget);
70
- },
71
- onLoadedMetadata: (p) => {
72
- const T = p.currentTarget;
73
- g.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, o({
74
- type: "MEDIA_LOADED_METADATA",
75
- payload: {
76
- duration: T.duration,
77
- bufferedFraction: Ue(T)
78
- }
79
- });
80
- },
81
- onSeeking: (p) => b(p.currentTarget, !0),
82
- onSeeked: (p) => b(p.currentTarget, !0),
83
- onEnded: () => l(),
84
- onPlay: () => o({ type: "MEDIA_PLAY" }),
85
- onPause: () => o({ type: "MEDIA_PAUSE" }),
86
- onWaiting: () => o({ type: "MEDIA_WAITING" }),
87
- onCanPlay: () => o({ type: "MEDIA_CANPLAY" }),
88
- onProgress: (p) => b(p.currentTarget, !0),
89
- onVolumeChange: (p) => {
90
- const T = p.currentTarget;
91
- o({
92
- type: "MEDIA_VOLUME_SYNC",
93
- payload: { volume: T.volume, muted: T.muted }
94
- });
95
- },
96
- onError: () => {
97
- var w;
98
- const p = i.current, T = (w = p == null ? void 0 : p.error) == null ? void 0 : w.code;
99
- o({ type: "MEDIA_ERROR", payload: { message: T === 1 ? "MEDIA_ERR_ABORTED" : T === 2 ? "MEDIA_ERR_NETWORK" : T === 3 ? "MEDIA_ERR_DECODE" : T === 4 ? "MEDIA_ERR_SRC_NOT_SUPPORTED" : "MEDIA_ERR_UNKNOWN" } });
100
- }
101
- }
102
- );
103
- }
104
- const Ee = {
105
- seek: "Seek",
106
- volume: "Volume",
107
- playbackSpeed: "Playback speed",
108
- nextTrack: "Next track",
109
- previousTrack: "Previous track",
110
- shuffle: "Shuffle",
111
- mute: "Mute",
112
- unmute: "Unmute",
113
- play: "Play",
114
- pause: "Pause",
115
- repeat: {
116
- off: "Repeat off",
117
- all: "Repeat all",
118
- one: "Repeat one"
119
- },
120
- playbackRateNormal: "1× normal",
121
- playbackRateTimes: (e) => `${e}×`
122
- };
123
- function Ur(e) {
124
- return e ? {
125
- ...Ee,
126
- ...e,
127
- repeat: { ...Ee.repeat, ...e.repeat }
128
- } : Ee;
129
- }
130
- const Be = Ne(Ee);
131
- function Vr({
132
- locale: e,
133
- children: r
134
- }) {
135
- const n = Ur(e);
136
- return /* @__PURE__ */ d(Be.Provider, { value: n, children: r });
137
- }
138
- function N() {
139
- return Ge(Be);
140
- }
141
- function z(e) {
142
- if (!Number.isFinite(e) || e < 0) return "0:00";
143
- const r = Math.floor(e % 60);
144
- return `${Math.floor(e / 60)}:${r.toString().padStart(2, "0")}`;
145
- }
146
- function A(e, r) {
147
- return r <= 0 ? 0 : Math.max(0, Math.min(r - 1, e));
148
- }
149
- function Ye(e, r) {
150
- if (e.length <= 1) return [...e];
151
- const n = e[r];
152
- if (!n) return [...e];
153
- const t = e.filter((a, i) => i !== r);
154
- for (let a = t.length - 1; a > 0; a--) {
155
- const i = Math.floor(Math.random() * (a + 1));
156
- [t[a], t[i]] = [t[i], t[a]];
157
- }
158
- return [n, ...t];
159
- }
160
- function W(e) {
161
- return e ? e.id != null && e.id !== "" ? `id:${e.id}` : `file:${e.fileUrl}` : "";
162
- }
163
- function $r(e, r) {
164
- var o, u;
165
- if (!r) return 0;
166
- const n = e.findIndex((l) => l === r);
167
- if (n !== -1) return n;
168
- const t = W(r);
169
- if (!t) return 0;
170
- const a = [];
171
- for (let l = 0; l < e.length; l += 1)
172
- W(e[l]) === t && a.push(l);
173
- if (a.length === 0) return 0;
174
- if (a.length === 1) return a[0];
175
- const i = typeof globalThis < "u" && "process" in globalThis ? (u = (o = globalThis.process) == null ? void 0 : o.env) == null ? void 0 : u.NODE_ENV : void 0;
176
- return i != null && i !== "production" && console.warn(
177
- "[@lucaismyname/ginger] Ambiguous track identity: multiple queue rows share the same fileUrl without a unique `id`. Resolving to the first match."
178
- ), a[0];
179
- }
180
- function Qe(e, r, n) {
181
- const t = [...e], a = Math.max(0, Math.min(t.length, n ?? t.length));
182
- return t.splice(a, 0, r), t;
183
- }
184
- function Or(e, r) {
185
- if (r < 0 || r >= e.length) return [...e];
186
- const n = [...e];
187
- return n.splice(r, 1), n;
188
- }
189
- function Br(e, r, n) {
190
- if (r === n || r < 0 || r >= e.length || n < 0 || n >= e.length)
191
- return [...e];
192
- const t = [...e], [a] = t.splice(r, 1);
193
- return a ? (t.splice(n, 0, a), t) : [...e];
194
- }
195
- function Yr(e, r, n) {
196
- return Qe(e, n, Math.max(0, Math.min(e.length, r + 1)));
197
- }
198
- function Qr(e) {
199
- const { tracks: r, currentIndex: n, repeatMode: t, playbackMode: a } = e, i = r.length;
200
- return i === 0 ? { kind: "stop", nextIndex: 0 } : t === "one" ? { kind: "replay_same" } : a === "single" ? { kind: "stop", nextIndex: A(n, i) } : n < i - 1 ? { kind: "advance", nextIndex: n + 1 } : t === "all" ? { kind: "wrap", nextIndex: 0 } : { kind: "stop", nextIndex: A(n, i) };
201
- }
202
- function Hr(e) {
203
- const { tracks: r, currentIndex: n, repeatMode: t, playbackMode: a } = e, i = r.length;
204
- return i === 0 ? 0 : a === "single" ? A(n, i) : n < i - 1 ? n + 1 : t === "all" ? 0 : A(n, i);
205
- }
206
- function jr(e) {
207
- const { tracks: r, currentIndex: n, repeatMode: t, playbackMode: a } = e, i = r.length;
208
- return i === 0 ? 0 : a === "single" ? A(n, i) : n > 0 ? n - 1 : t === "all" ? i - 1 : 0;
209
- }
210
- function Kr(e) {
211
- return e === "off" ? "all" : e === "all" ? "one" : "off";
212
- }
213
- function He(e, r) {
214
- return (e == null ? void 0 : e.artworkUrl) ?? r ?? void 0;
215
- }
216
- function Xr(e, r) {
217
- return (e == null ? void 0 : e.album) ?? r ?? void 0;
218
- }
219
- function V(e) {
220
- return e.tracks[e.currentIndex] ?? null;
221
- }
222
- function je(e) {
223
- return e.errorMessage ? "error" : e.tracks.length === 0 ? "idle" : e.isBuffering ? "loading" : e.isPaused ? Number.isFinite(e.duration) && e.duration > 0 && e.currentTime >= e.duration - 0.05 ? "ended" : "paused" : "playing";
224
- }
225
- function J(e) {
226
- var t;
227
- const r = e.duration;
228
- if (Number.isFinite(r) && r > 0) return r;
229
- const n = (t = e.tracks[e.currentIndex]) == null ? void 0 : t.durationSeconds;
230
- return typeof n == "number" && Number.isFinite(n) && n > 0 ? n : 0;
231
- }
232
- function zr(e) {
233
- const n = J(e) - e.currentTime;
234
- return Number.isFinite(n) ? Math.max(0, n) : 0;
235
- }
236
- function Ke(e) {
237
- const r = J(e);
238
- return r > 0 ? Math.min(1, Math.max(0, e.currentTime / r)) : 0;
239
- }
240
- function Wr(e) {
241
- var n;
242
- const r = V(e);
243
- return He(r, (n = e.playlistMeta) == null ? void 0 : n.artworkUrl);
244
- }
245
- function qr(e) {
246
- var n;
247
- const r = V(e);
248
- return Xr(r, (n = e.playlistMeta) == null ? void 0 : n.subtitle);
249
- }
250
- function Jr() {
251
- const e = _(), r = j(), n = N(), t = P(() => $e(e, r), [e, r]), a = J(t), i = a > 0 ? t.currentTime : 0, o = Number.isFinite(i) ? i : 0, u = a > 0 ? `${z(o)} of ${z(a)}` : z(o), l = (s) => {
252
- r.seek(Number(s.currentTarget.value));
253
- };
254
- return {
255
- state: t,
256
- value: o,
257
- min: 0,
258
- max: a > 0 ? a : 1,
259
- step: "any",
260
- ariaValueText: u,
261
- ariaLabel: n.seek,
262
- onSeekInput: l,
263
- onSeekChange: l
264
- };
265
- }
266
- function Zr() {
267
- const e = _(), r = j(), n = N(), t = P(() => $e(e, r), [e, r]), a = (i) => {
268
- r.setVolume(Number(i.currentTarget.value));
269
- };
270
- return {
271
- state: t,
272
- value: t.volume,
273
- min: 0,
274
- max: 1,
275
- step: "any",
276
- ariaValueText: `${Math.round(t.volume * 100)}%`,
277
- ariaLabel: n.volume,
278
- onVolumeInput: a,
279
- onVolumeChange: a
280
- };
281
- }
282
- function en(e) {
283
- const r = _(), n = N(), t = (e == null ? void 0 : e.playAriaLabel) ?? n.play, a = (e == null ? void 0 : e.pauseAriaLabel) ?? n.pause;
284
- return {
285
- isPaused: r.isPaused,
286
- toggle: r.togglePlayPause,
287
- ariaLabel: r.isPaused ? t : a
288
- };
289
- }
290
- function Xe({
291
- playLabel: e = "Play",
292
- pauseLabel: r = "Pause",
293
- playAriaLabel: n,
294
- pauseAriaLabel: t,
295
- children: a,
296
- type: i = "button",
297
- onClick: o,
298
- ...u
299
- }) {
300
- const l = N(), s = typeof e == "string" ? e : l.play, g = typeof r == "string" ? r : l.pause, m = en({
301
- playAriaLabel: n ?? s,
302
- pauseAriaLabel: t ?? g
303
- });
304
- return /* @__PURE__ */ d(
305
- "button",
306
- {
307
- ...u,
308
- type: i,
309
- "aria-label": m.ariaLabel,
310
- onClick: (y) => {
311
- m.toggle(), o == null || o(y);
312
- },
313
- children: a ?? (m.isPaused ? e : r)
314
- }
315
- );
316
- }
317
- Xe.displayName = "Ginger.Control.PlayPause";
318
- function ze({ type: e = "button", ariaLabel: r, onClick: n, children: t, ...a }) {
319
- const { repeatMode: i, cycleRepeat: o } = _(), l = N().repeat[i];
320
- return /* @__PURE__ */ d(
321
- "button",
322
- {
323
- ...a,
324
- type: e,
325
- "aria-label": r ?? l,
326
- onClick: (s) => {
327
- o(), n == null || n(s);
328
- },
329
- children: t ?? l
330
- }
331
- );
332
- }
333
- ze.displayName = "Ginger.Control.Repeat";
334
- function We({
335
- type: e = "button",
336
- children: r = "Next",
337
- ariaLabel: n,
338
- onClick: t,
339
- ...a
340
- }) {
341
- const { next: i } = _(), o = N();
342
- return /* @__PURE__ */ d(
343
- "button",
344
- {
345
- ...a,
346
- type: e,
347
- "aria-label": n ?? o.nextTrack,
348
- onClick: (u) => {
349
- i(), t == null || t(u);
350
- },
351
- children: r ?? o.nextTrack
352
- }
353
- );
354
- }
355
- We.displayName = "Ginger.Control.Next";
356
- function qe({
357
- type: e = "button",
358
- children: r = "Previous",
359
- ariaLabel: n,
360
- onClick: t,
361
- ...a
362
- }) {
363
- const { prev: i } = _(), o = N();
364
- return /* @__PURE__ */ d(
365
- "button",
366
- {
367
- ...a,
368
- type: e,
369
- "aria-label": n ?? o.previousTrack,
370
- onClick: (u) => {
371
- i(), t == null || t(u);
372
- },
373
- children: r
374
- }
375
- );
376
- }
377
- qe.displayName = "Ginger.Control.Previous";
378
- function Je({
379
- type: e = "button",
380
- children: r = "Shuffle",
381
- ariaLabel: n,
382
- onClick: t,
383
- ...a
384
- }) {
385
- const { isShuffled: i, toggleShuffle: o } = _(), u = N();
386
- return /* @__PURE__ */ d(
387
- "button",
388
- {
389
- ...a,
390
- type: e,
391
- "aria-pressed": i,
392
- "aria-label": n ?? u.shuffle,
393
- onClick: (l) => {
394
- o(), t == null || t(l);
395
- },
396
- children: r ?? u.shuffle
397
- }
398
- );
399
- }
400
- Je.displayName = "Ginger.Control.Shuffle";
401
- function Ze({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: t, ...a }) {
402
- const i = Jr(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
403
- return /* @__PURE__ */ d(
404
- "input",
405
- {
406
- ...a,
407
- type: "range",
408
- min: i.min,
409
- max: i.max,
410
- step: i.step,
411
- value: i.value,
412
- "aria-label": t ?? i.ariaLabel,
413
- "aria-valuetext": i.ariaValueText,
414
- onInput: i.onSeekInput,
415
- onChange: i.onSeekChange,
416
- style: o
417
- }
418
- );
419
- }
420
- Ze.displayName = "Ginger.Control.SeekBar";
421
- function er({ inputStyle: e, style: r, unstyled: n = !1, ariaLabel: t, ...a }) {
422
- const i = Zr(), o = n ? { ...r, ...e } : { width: "100%", ...r, ...e };
423
- return /* @__PURE__ */ d(
424
- "input",
425
- {
426
- ...a,
427
- type: "range",
428
- min: i.min,
429
- max: i.max,
430
- step: i.step,
431
- value: i.value,
432
- "aria-label": t ?? i.ariaLabel,
433
- "aria-valuetext": i.ariaValueText,
434
- onInput: i.onVolumeInput,
435
- onChange: i.onVolumeChange,
436
- style: o
437
- }
438
- );
439
- }
440
- er.displayName = "Ginger.Control.Volume";
441
- function rr({
442
- ariaLabel: e,
443
- muteLabel: r,
444
- unmuteLabel: n,
445
- type: t = "button",
446
- onClick: a,
447
- children: i,
448
- ...o
449
- }) {
450
- const { muted: u, toggleMute: l } = j(), s = N(), g = r ?? s.mute, m = n ?? s.unmute;
451
- return /* @__PURE__ */ d(
452
- "button",
453
- {
454
- ...o,
455
- type: t,
456
- "aria-pressed": u,
457
- "aria-label": e ?? (u ? s.unmute : s.mute),
458
- onClick: (y) => {
459
- l(), a == null || a(y);
460
- },
461
- children: i ?? (u ? m : g)
462
- }
463
- );
464
- }
465
- rr.displayName = "Ginger.Control.Mute";
466
- const rn = [0.5, 0.75, 1, 1.25, 1.5, 2];
467
- function nr({
468
- rates: e = rn,
469
- style: r,
470
- ariaLabel: n,
471
- children: t,
472
- ...a
473
- }) {
474
- const { playbackRate: i, setPlaybackRate: o } = j(), u = N(), l = P(
475
- () => Array.from(/* @__PURE__ */ new Set([...e, i])).sort((s, g) => s - g),
476
- [e, i]
477
- );
478
- return /* @__PURE__ */ q(
479
- "select",
480
- {
481
- ...a,
482
- "aria-label": n ?? u.playbackSpeed,
483
- value: String(i),
484
- style: r,
485
- onChange: (s) => o(Number(s.currentTarget.value)),
486
- children: [
487
- t ?? u.playbackSpeed,
488
- l.map((s) => /* @__PURE__ */ d("option", { value: String(s), children: s === 1 ? u.playbackRateNormal : u.playbackRateTimes(s) }, s))
489
- ]
490
- }
491
- );
492
- }
493
- nr.displayName = "Ginger.Control.PlaybackRate";
494
- function B(e, r) {
495
- function n(t) {
496
- const a = I(), o = (r(a) ?? "").trim(), { className: u, style: l, fallback: s, empty: g, children: m } = t;
497
- if (!o) {
498
- const y = g ?? s ?? null;
499
- return y ? /* @__PURE__ */ d("span", { className: u, style: l, children: y }) : null;
500
- }
501
- return m ? /* @__PURE__ */ d("span", { className: u, style: l, children: m(o, a) }) : /* @__PURE__ */ d("span", { className: u, style: l, children: o });
502
- }
503
- return n.displayName = e, n;
504
- }
505
- function Y(e, r) {
506
- return B(e, (n) => r(V(n)));
507
- }
508
- const nn = Y("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), tn = Y("Ginger.Current.Artist", (e) => e == null ? void 0 : e.artist), an = B("Ginger.Current.Album", (e) => qr(e)), on = Y(
509
- "Ginger.Current.Description",
510
- (e) => e == null ? void 0 : e.description
511
- ), un = B("Ginger.Current.Copyright", (e) => {
512
- var n;
513
- const r = V(e);
514
- return (r == null ? void 0 : r.copyright) ?? ((n = e.playlistMeta) == null ? void 0 : n.copyright);
515
- }), sn = Y("Ginger.Current.Genre", (e) => e == null ? void 0 : e.genre), ln = Y("Ginger.Current.Label", (e) => e == null ? void 0 : e.label), cn = Y("Ginger.Current.Isrc", (e) => e == null ? void 0 : e.isrc), dn = Y(
516
- "Ginger.Current.TrackNumber",
517
- (e) => (e == null ? void 0 : e.trackNumber) != null ? String(e.trackNumber) : void 0
518
- );
519
- function tr({ className: e, style: r, fallback: n, empty: t, children: a, format: i }) {
520
- var s;
521
- const o = I(), u = (s = V(o)) == null ? void 0 : s.year;
522
- if (typeof u != "number" || !Number.isFinite(u)) {
523
- const g = t ?? n ?? null;
524
- return g ? /* @__PURE__ */ d("span", { className: e, style: r, children: g }) : null;
525
- }
526
- const l = i ? i(u) : String(u);
527
- return a ? /* @__PURE__ */ d("span", { className: e, style: r, children: a(l, o) }) : /* @__PURE__ */ d("span", { className: e, style: r, children: l });
528
- }
529
- tr.displayName = "Ginger.Current.Year";
530
- function ar({
531
- className: e,
532
- style: r,
533
- fallback: n,
534
- empty: t,
535
- children: a,
536
- preserveWhitespace: i = !0
537
- }) {
538
- var g;
539
- const o = I(), u = ((g = V(o)) == null ? void 0 : g.lyrics) ?? "", l = i ? u.replace(/^\s+|\s+$/g, "") : u.trim();
540
- if (!l) {
541
- const m = t ?? n ?? null;
542
- return m ? /* @__PURE__ */ d("span", { className: e, style: r, children: m }) : null;
543
- }
544
- const s = i ? { whiteSpace: "pre-wrap" } : void 0;
545
- return a ? /* @__PURE__ */ d("span", { className: e, style: { ...s, ...r }, children: a(l, o) }) : /* @__PURE__ */ d("span", { className: e, style: { ...s, ...r }, children: l });
546
- }
547
- ar.displayName = "Ginger.Current.Lyrics";
548
- const Ve = /\[(\d{1,2}):(\d{2})(?:\.(\d{1,3}))?\]/g;
549
- function fn(e) {
550
- const r = [];
551
- for (const n of e.split(/\r?\n/)) {
552
- const t = [...n.matchAll(Ve)];
553
- if (t.length === 0) continue;
554
- const a = n.replace(Ve, "").trim();
555
- for (const i of t) {
556
- const o = Number(i[1] ?? 0), u = Number(i[2] ?? 0), l = Number((i[3] ?? "0").padEnd(3, "0")), s = o * 60 + u + l / 1e3;
557
- Number.isFinite(s) && s >= 0 && r.push({ time: s, text: a });
558
- }
559
- }
560
- return r.sort((n, t) => n.time - t.time);
561
- }
562
- function pn() {
563
- const { tracks: e, currentIndex: r } = _(), { currentTime: n } = j(), t = e[r], a = P(() => t ? Array.isArray(t.lyricsTimed) && t.lyricsTimed.length > 0 ? [...t.lyricsTimed].filter((o) => Number.isFinite(o.time) && o.time >= 0).sort((o, u) => o.time - u.time) : typeof t.lyrics == "string" ? fn(t.lyrics) : [] : [], [t]), i = P(() => {
564
- for (let o = a.length - 1; o >= 0; o -= 1)
565
- if (n >= a[o].time) return o;
566
- return -1;
567
- }, [n, a]);
568
- return {
569
- lines: a,
570
- activeIndex: i,
571
- activeLine: i >= 0 ? a[i] ?? null : null
572
- };
573
- }
574
- function ir({
575
- className: e,
576
- style: r,
577
- fallback: n,
578
- empty: t,
579
- unstyled: a = !1,
580
- activeClassName: i,
581
- lineClassName: o,
582
- children: u
583
- }) {
584
- const l = I(), { lines: s, activeIndex: g } = pn();
585
- if (s.length === 0) {
586
- const y = t ?? n ?? null;
587
- return y ? /* @__PURE__ */ d("span", { className: e, style: r, children: y }) : null;
588
- }
589
- return /* @__PURE__ */ d("ul", { className: e, style: { ...a ? {} : {
590
- listStyle: "none",
591
- margin: 0,
592
- padding: 0,
593
- fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
594
- fontSize: "var(--ginger-font-size, 14px)",
595
- color: "var(--ginger-primary-color, #111827)"
596
- }, ...r }, "aria-label": "Synced lyrics", children: s.map((y, k) => {
597
- const b = k === g;
598
- return /* @__PURE__ */ d(
599
- "li",
600
- {
601
- "aria-current": b ? "true" : void 0,
602
- "data-ginger-active": b || void 0,
603
- className: [o, b ? i : void 0].filter(Boolean).join(" ") || void 0,
604
- style: a ? void 0 : {
605
- padding: "var(--ginger-playlist-row-padding, 4px 8px)",
606
- fontWeight: b ? 600 : 400,
607
- opacity: b ? 1 : 0.75
608
- },
609
- children: u ? u(y, k, b, l) : y.text
610
- },
611
- `${y.time}-${k}`
612
- );
613
- }) });
614
- }
615
- ir.displayName = "Ginger.Current.LyricsSynced";
616
- function gn() {
617
- const { tracks: e, currentIndex: r } = _(), { currentTime: n, seek: t } = j(), a = P(() => {
618
- var u;
619
- return [...((u = e[r]) == null ? void 0 : u.chapters) ?? []].filter((l) => l && Number.isFinite(l.startSeconds) && l.startSeconds >= 0).sort((l, s) => l.startSeconds - s.startSeconds);
620
- }, [r, e]), i = P(() => {
621
- if (a.length === 0) return -1;
622
- for (let o = a.length - 1; o >= 0; o -= 1)
623
- if (n >= a[o].startSeconds) return o;
624
- return -1;
625
- }, [n, a]);
626
- return {
627
- list: a,
628
- activeIndex: i,
629
- active: i >= 0 ? a[i] ?? null : null,
630
- seekTo: (o) => {
631
- const u = a[o];
632
- u && t(u.startSeconds);
633
- }
634
- };
635
- }
636
- function or({
637
- className: e,
638
- style: r,
639
- fallback: n,
640
- empty: t,
641
- unstyled: a = !1,
642
- formatStart: i = z,
643
- children: o
644
- }) {
645
- const u = I(), { list: l, activeIndex: s, seekTo: g } = gn();
646
- if (l.length === 0) {
647
- const y = t ?? n ?? null;
648
- return y ? /* @__PURE__ */ d("span", { className: e, style: r, children: y }) : null;
649
- }
650
- return /* @__PURE__ */ d("ul", { className: e, style: { ...a ? {} : {
651
- listStyle: "none",
652
- margin: 0,
653
- padding: 0,
654
- fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
655
- fontSize: "var(--ginger-font-size, 14px)",
656
- color: "var(--ginger-primary-color, #111827)"
657
- }, ...r }, "aria-label": "Chapters", children: l.map((y, k) => {
658
- const b = k === s;
659
- return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d(
660
- "button",
661
- {
662
- type: "button",
663
- "aria-current": b ? "true" : void 0,
664
- "data-ginger-active": b || void 0,
665
- onClick: () => g(k),
666
- style: {
667
- width: a ? void 0 : "100%",
668
- textAlign: a ? void 0 : "left",
669
- border: a ? void 0 : "none",
670
- background: a ? void 0 : b ? "var(--ginger-playlist-active-bg, rgba(17, 24, 39, 0.06))" : "transparent",
671
- color: a ? void 0 : "inherit",
672
- font: a ? void 0 : "inherit",
673
- cursor: a ? void 0 : "pointer",
674
- padding: a ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)"
675
- },
676
- children: o ? o(y, k, b, u) : /* @__PURE__ */ q("span", { children: [
677
- /* @__PURE__ */ d("span", { style: { opacity: 0.75, marginRight: "0.35em" }, children: i(y.startSeconds) }),
678
- y.title
679
- ] })
680
- }
681
- ) }, `${y.startSeconds}-${y.title}`);
682
- }) });
683
- }
684
- or.displayName = "Ginger.Current.Chapters";
685
- function ur({
686
- visible: e = !1,
687
- className: r,
688
- style: n,
689
- fallback: t,
690
- empty: a,
691
- children: i
692
- }) {
693
- var l;
694
- const o = I();
695
- if (!e) return null;
696
- const u = ((l = V(o)) == null ? void 0 : l.fileUrl) ?? "";
697
- if (!u) {
698
- const s = a ?? t ?? null;
699
- return s ? /* @__PURE__ */ d("span", { className: r, style: n, children: s }) : null;
700
- }
701
- return i ? /* @__PURE__ */ d("span", { className: r, style: n, children: i(u, o) }) : /* @__PURE__ */ d("span", { className: r, style: n, children: u });
702
- }
703
- ur.displayName = "Ginger.Current.FileUrl";
704
- function sr({
705
- className: e,
706
- style: r,
707
- fallback: n,
708
- empty: t,
709
- sizes: a,
710
- loading: i,
711
- onError: o,
712
- decoding: u,
713
- unstyled: l = !1,
714
- imgStyle: s
715
- }) {
716
- const g = I(), m = V(g), y = Wr(g);
717
- if (!y) {
718
- const b = t ?? n ?? null;
719
- return b ? /* @__PURE__ */ d("span", { className: e, style: r, children: b }) : null;
720
- }
721
- const k = [m == null ? void 0 : m.title, m == null ? void 0 : m.artist].filter(Boolean).join(" — ") || "Artwork";
722
- return /* @__PURE__ */ d(
723
- "div",
724
- {
725
- className: e,
726
- style: l ? { ...r } : {
727
- background: "var(--ginger-artwork-bg, transparent)",
728
- borderRadius: "var(--ginger-artwork-radius, 0)",
729
- overflow: "hidden",
730
- ...r
731
- },
732
- children: /* @__PURE__ */ d(
733
- "img",
734
- {
735
- src: y,
736
- alt: k,
737
- sizes: a,
738
- loading: i,
739
- decoding: u,
740
- onError: o,
741
- style: {
742
- display: l ? void 0 : "block",
743
- width: l ? void 0 : "100%",
744
- height: l ? void 0 : "100%",
745
- objectFit: l ? void 0 : "cover",
746
- ...s
747
- }
748
- }
749
- )
750
- }
751
- );
752
- }
753
- sr.displayName = "Ginger.Current.Artwork";
754
- function lr({
755
- base: e = 0,
756
- className: r,
757
- style: n,
758
- fallback: t,
759
- empty: a,
760
- children: i
761
- }) {
762
- const o = I();
763
- if (o.tracks.length === 0) {
764
- const s = a ?? t ?? null;
765
- return s ? /* @__PURE__ */ d("span", { className: r, style: n, children: s }) : null;
766
- }
767
- const l = String(o.currentIndex + e);
768
- return i ? /* @__PURE__ */ d("span", { className: r, style: n, children: i(l, o) }) : /* @__PURE__ */ d("span", { className: r, style: n, children: l });
769
- }
770
- lr.displayName = "Ginger.Current.QueueIndex";
771
- function cr({ className: e, style: r, fallback: n, empty: t, children: a }) {
772
- const i = I(), o = String(i.tracks.length);
773
- if (i.tracks.length === 0) {
774
- const u = t ?? n ?? null;
775
- return u ? /* @__PURE__ */ d("span", { className: e, style: r, children: u }) : null;
776
- }
777
- return a ? /* @__PURE__ */ d("span", { className: e, style: r, children: a(o, i) }) : /* @__PURE__ */ d("span", { className: e, style: r, children: o });
778
- }
779
- cr.displayName = "Ginger.Current.QueueLength";
780
- function dr({
781
- base: e = 0,
782
- separator: r = " / ",
783
- className: n,
784
- style: t,
785
- fallback: a,
786
- empty: i,
787
- children: o
788
- }) {
789
- const u = I(), l = u.tracks.length;
790
- if (l === 0) {
791
- const y = i ?? a ?? null;
792
- return y ? /* @__PURE__ */ d("span", { className: n, style: t, children: y }) : null;
793
- }
794
- const s = String(u.currentIndex + e), g = String(l), m = `${s}${r}${g}`;
795
- return o ? /* @__PURE__ */ d("span", { className: n, style: t, children: o({ index: s, length: g, label: m }, u) }) : /* @__PURE__ */ d("span", { className: n, style: t, children: m });
796
- }
797
- dr.displayName = "Ginger.Current.QueuePosition";
798
- function we(e, r, n) {
799
- const { className: t, style: a, fallback: i, empty: o, children: u, format: l = z } = n;
800
- if (!(e >= 0) || !Number.isFinite(e)) {
801
- const g = o ?? i ?? null;
802
- return g ? /* @__PURE__ */ d("span", { className: t, style: a, children: g }) : null;
803
- }
804
- const s = l(e);
805
- return u ? /* @__PURE__ */ d("span", { className: t, style: a, children: u(s, r) }) : /* @__PURE__ */ d("span", { className: t, style: a, children: s });
806
- }
807
- function fr(e) {
808
- const r = I();
809
- return we(r.currentTime, r, e);
810
- }
811
- fr.displayName = "Ginger.Current.Elapsed";
812
- function pr(e) {
813
- const r = I();
814
- return we(J(r), r, e);
815
- }
816
- pr.displayName = "Ginger.Current.Duration";
817
- function gr(e) {
818
- const r = I();
819
- return we(zr(r), r, e);
820
- }
821
- gr.displayName = "Ginger.Current.Remaining";
822
- function mr({ className: e, style: r, fallback: n, empty: t, children: a }) {
823
- const i = I(), o = J(i), u = Ke(i);
824
- if (!(o > 0)) {
825
- const l = t ?? n ?? null;
826
- return l ? /* @__PURE__ */ d("span", { className: e, style: r, children: l }) : null;
827
- }
828
- return a ? /* @__PURE__ */ d("span", { className: e, style: r, children: a({ fraction: u, currentTime: i.currentTime, duration: o }, i) }) : /* @__PURE__ */ d("span", { className: e, style: r, children: `${Math.round(u * 100)}%` });
829
- }
830
- mr.displayName = "Ginger.Current.Progress";
831
- function yr({
832
- className: e,
833
- style: r,
834
- height: n = 4,
835
- showBuffered: t = !1,
836
- unstyled: a = !1
837
- }) {
838
- const i = I(), o = `${Math.round(Ke(i) * 100)}%`, u = `${Math.round(Math.min(1, Math.max(0, i.bufferedFraction)) * 100)}%`;
839
- return /* @__PURE__ */ q(
840
- "div",
841
- {
842
- className: e,
843
- style: a ? { ...r } : {
844
- width: "100%",
845
- height: n,
846
- background: "var(--ginger-muted-color, #e5e7eb)",
847
- borderRadius: 999,
848
- overflow: "hidden",
849
- position: "relative",
850
- ...r
851
- },
852
- "aria-hidden": !0,
853
- children: [
854
- t ? /* @__PURE__ */ d(
855
- "div",
856
- {
857
- style: {
858
- position: a ? void 0 : "absolute",
859
- left: a ? void 0 : 0,
860
- top: a ? void 0 : 0,
861
- height: a ? void 0 : "100%",
862
- width: u,
863
- background: a ? void 0 : "var(--ginger-buffer-color, rgba(107, 114, 128, 0.35))"
864
- }
865
- }
866
- ) : null,
867
- /* @__PURE__ */ d(
868
- "div",
869
- {
870
- style: {
871
- position: a ? void 0 : "relative",
872
- width: o,
873
- height: a ? void 0 : "100%",
874
- background: a ? void 0 : "var(--ginger-primary-color, #111827)"
875
- }
876
- }
877
- )
878
- ]
879
- }
880
- );
881
- }
882
- yr.displayName = "Ginger.Current.TimeRail";
883
- function hr({ className: e, style: r, height: n = 4, unstyled: t = !1 }) {
884
- const a = I(), i = `${Math.round(Math.min(1, Math.max(0, a.bufferedFraction)) * 100)}%`;
885
- return /* @__PURE__ */ d(
886
- "div",
887
- {
888
- className: e,
889
- style: t ? { ...r } : {
890
- width: "100%",
891
- height: n,
892
- background: "var(--ginger-muted-color, #e5e7eb)",
893
- borderRadius: 999,
894
- overflow: "hidden",
895
- ...r
896
- },
897
- "aria-hidden": !0,
898
- children: /* @__PURE__ */ d(
899
- "div",
900
- {
901
- style: {
902
- width: i,
903
- height: t ? void 0 : "100%",
904
- background: t ? void 0 : "var(--ginger-buffer-color, rgba(107, 114, 128, 0.35))"
905
- }
906
- }
907
- )
908
- }
909
- );
910
- }
911
- hr.displayName = "Ginger.Current.BufferRail";
912
- function br({ className: e, style: r, fallback: n, empty: t, children: a }) {
913
- const i = I(), o = je(i);
914
- return a ? /* @__PURE__ */ d("span", { className: e, style: r, children: a(o, i) }) : /* @__PURE__ */ d("span", { className: e, style: r, children: o });
915
- }
916
- br.displayName = "Ginger.Current.PlaybackState";
917
- function vr({
918
- className: e,
919
- style: r,
920
- fallback: n,
921
- empty: t,
922
- live: a = "polite",
923
- children: i
924
- }) {
925
- const o = I(), u = o.errorMessage ?? "";
926
- if (!u) {
927
- const l = t ?? n ?? null;
928
- return l ? /* @__PURE__ */ d("span", { className: e, style: r, children: l }) : null;
929
- }
930
- return i ? /* @__PURE__ */ d("span", { className: e, style: r, "aria-live": a, children: i(u, o) }) : /* @__PURE__ */ d("span", { className: e, style: r, "aria-live": a, children: u });
931
- }
932
- vr.displayName = "Ginger.Current.ErrorMessage";
933
- const _e = Ne(null);
934
- function mn() {
935
- const e = Ge(_e);
936
- if (!e)
937
- throw new Error("Ginger.Playlist.Track must be used inside <Ginger.Playlist>");
938
- return e;
939
- }
940
- function kr({
941
- children: e,
942
- unstyled: r = !1,
943
- rowStyle: n,
944
- renderTrack: t,
945
- playOnSelect: a = !0,
946
- style: i,
947
- ...o
948
- }) {
949
- const { tracks: u, currentIndex: l, playTrackAt: s, selectTrackAt: g } = _(), m = r ? { ...i } : {
950
- listStyle: "none",
951
- margin: 0,
952
- padding: 0,
953
- fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
954
- fontSize: "var(--ginger-font-size, 14px)",
955
- color: "var(--ginger-primary-color, #111827)",
956
- ...i
957
- };
958
- return e !== void 0 ? /* @__PURE__ */ d(_e.Provider, { value: { playOnSelect: a }, children: /* @__PURE__ */ d("ul", { style: m, ...o, children: e }) }) : /* @__PURE__ */ d(_e.Provider, { value: { playOnSelect: a }, children: /* @__PURE__ */ d("ul", { style: m, ...o, children: u.map((k, b) => {
959
- const S = b === l;
960
- return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d(
961
- "button",
962
- {
963
- type: "button",
964
- onClick: () => {
965
- a ? s(b) : g(b);
966
- },
967
- style: {
968
- width: r ? void 0 : "100%",
969
- textAlign: r ? void 0 : "left",
970
- border: r ? void 0 : "none",
971
- background: r ? void 0 : S ? "var(--ginger-playlist-active-bg, rgba(17, 24, 39, 0.06))" : "transparent",
972
- color: r ? void 0 : "inherit",
973
- font: r ? void 0 : "inherit",
974
- cursor: r ? void 0 : "pointer",
975
- padding: r ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)",
976
- ...n
977
- },
978
- children: t ? t(k, b, S) : /* @__PURE__ */ q("span", { children: [
979
- k.title,
980
- k.artist ? ` — ${k.artist}` : ""
981
- ] })
982
- }
983
- ) }, `${b}-${W(k)}`);
984
- }) }) });
985
- }
986
- kr.displayName = "Ginger.Playlist";
987
- function xr({
988
- index: e,
989
- unstyled: r = !1,
990
- className: n,
991
- style: t,
992
- children: a,
993
- liProps: i,
994
- onClick: o,
995
- ...u
996
- }) {
997
- const { playOnSelect: l } = mn(), { tracks: s, currentIndex: g, playTrackAt: m, selectTrackAt: y } = _(), k = e === g, b = s[e], S = b != null ? /* @__PURE__ */ q("span", { children: [
998
- b.title,
999
- b.artist ? ` — ${b.artist}` : ""
1000
- ] }) : null;
1001
- return /* @__PURE__ */ d("li", { ...i, children: /* @__PURE__ */ d(
1002
- "button",
1003
- {
1004
- type: "button",
1005
- "aria-current": k ? "true" : void 0,
1006
- "data-ginger-active": k || void 0,
1007
- className: n,
1008
- style: {
1009
- width: r ? void 0 : "100%",
1010
- textAlign: r ? void 0 : "left",
1011
- border: r ? void 0 : "none",
1012
- background: r ? void 0 : k ? "var(--ginger-playlist-active-bg, rgba(17, 24, 39, 0.06))" : "transparent",
1013
- color: r ? void 0 : "inherit",
1014
- font: r ? void 0 : "inherit",
1015
- cursor: r ? void 0 : "pointer",
1016
- padding: r ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)",
1017
- ...t
1018
- },
1019
- ...u,
1020
- onClick: (p) => {
1021
- o == null || o(p), !p.defaultPrevented && (l ? m(e) : y(e));
1022
- },
1023
- children: a ?? S
1024
- }
1025
- ) });
1026
- }
1027
- xr.displayName = "Ginger.Playlist.Track";
1028
- const yn = Object.assign(kr, {
1029
- Track: xr
1030
- }), hn = B("Ginger.Queue.Title", (e) => {
1031
- var r;
1032
- return (r = e.playlistMeta) == null ? void 0 : r.title;
1033
- }), bn = B("Ginger.Queue.Subtitle", (e) => {
1034
- var r;
1035
- return (r = e.playlistMeta) == null ? void 0 : r.subtitle;
1036
- }), vn = B(
1037
- "Ginger.Queue.Description",
1038
- (e) => {
1039
- var r;
1040
- return (r = e.playlistMeta) == null ? void 0 : r.description;
1041
- }
1042
- ), kn = B(
1043
- "Ginger.Queue.Copyright",
1044
- (e) => {
1045
- var r;
1046
- return (r = e.playlistMeta) == null ? void 0 : r.copyright;
1047
- }
1048
- );
1049
- function Mr({
1050
- className: e,
1051
- style: r,
1052
- fallback: n,
1053
- empty: t,
1054
- unstyled: a = !1,
1055
- imgStyle: i
1056
- }) {
1057
- var s, g;
1058
- const o = I(), u = (s = o.playlistMeta) == null ? void 0 : s.artworkUrl;
1059
- if (!u) {
1060
- const m = t ?? n ?? null;
1061
- return m ? /* @__PURE__ */ d("span", { className: e, style: r, children: m }) : null;
1062
- }
1063
- const l = ((g = o.playlistMeta) == null ? void 0 : g.title) ?? "Playlist artwork";
1064
- return /* @__PURE__ */ d(
1065
- "span",
1066
- {
1067
- className: e,
1068
- style: a ? { ...r } : {
1069
- display: "inline-block",
1070
- background: "var(--ginger-artwork-bg, #f3f4f6)",
1071
- borderRadius: "var(--ginger-artwork-radius, 6px)",
1072
- overflow: "hidden",
1073
- ...r
1074
- },
1075
- children: /* @__PURE__ */ d(
1076
- "img",
1077
- {
1078
- src: u,
1079
- alt: l,
1080
- style: {
1081
- display: a ? void 0 : "block",
1082
- width: a ? void 0 : "100%",
1083
- height: a ? void 0 : "100%",
1084
- objectFit: a ? void 0 : "cover",
1085
- ...i
1086
- }
1087
- }
1088
- )
1089
- }
1090
- );
1091
- }
1092
- Mr.displayName = "Ginger.Queue.Artwork";
1093
- function Ae(e) {
1094
- return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 1;
1095
- }
1096
- function Ce(e) {
1097
- return Number.isFinite(e) ? Math.min(4, Math.max(0.25, e)) : 1;
1098
- }
1099
- const U = {
1100
- currentTime: 0,
1101
- duration: 0,
1102
- bufferedFraction: 0,
1103
- isBuffering: !1,
1104
- errorMessage: null
1105
- }, xn = {
1106
- ...U,
1107
- volume: 1,
1108
- muted: !1,
1109
- playbackRate: 1
1110
- };
1111
- function Tr(e) {
1112
- const r = [...e.tracks];
1113
- let n = A(e.currentIndex ?? 0, r.length), t = null, a = r;
1114
- return e.isShuffled && r.length > 1 && (t = [...r], a = Ye(r, n), n = 0), {
1115
- tracks: a,
1116
- currentIndex: n,
1117
- playbackMode: e.playbackMode ?? "playlist",
1118
- isPaused: e.isPaused ?? !0,
1119
- isShuffled: !!(e.isShuffled && a.length > 1),
1120
- repeatMode: e.repeatMode ?? "off",
1121
- originalTracks: t,
1122
- playlistMeta: e.playlistMeta ?? null,
1123
- ...xn,
1124
- volume: Ae(e.volume ?? 1),
1125
- muted: e.muted ?? !1,
1126
- playbackRate: Ce(e.playbackRate ?? 1)
1127
- };
1128
- }
1129
- function Mn(e, r) {
1130
- switch (r.type) {
1131
- case "INIT": {
1132
- const {
1133
- tracks: n,
1134
- currentIndex: t,
1135
- playlistMeta: a,
1136
- isPaused: i,
1137
- isShuffled: o,
1138
- repeatMode: u,
1139
- playbackMode: l,
1140
- volume: s,
1141
- muted: g,
1142
- playbackRate: m
1143
- } = r.payload;
1144
- return Tr({
1145
- tracks: n,
1146
- currentIndex: t,
1147
- playlistMeta: a ?? null,
1148
- isPaused: i ?? !0,
1149
- isShuffled: o ?? !1,
1150
- repeatMode: u ?? "off",
1151
- playbackMode: l ?? "playlist",
1152
- volume: s,
1153
- muted: g,
1154
- playbackRate: m
1155
- });
1156
- }
1157
- case "SET_QUEUE": {
1158
- const { tracks: n, currentIndex: t } = r.payload, a = [...n], i = A(t ?? e.currentIndex, a.length);
1159
- return {
1160
- ...e,
1161
- tracks: a,
1162
- currentIndex: i,
1163
- isShuffled: !1,
1164
- originalTracks: null,
1165
- ...U
1166
- };
1167
- }
1168
- case "INSERT_TRACK": {
1169
- const n = r.payload.index ?? e.tracks.length, t = Qe(e.tracks, r.payload.track, n);
1170
- if (r.payload.autoPlay) {
1171
- const i = A(n, t.length);
1172
- return {
1173
- ...e,
1174
- tracks: t,
1175
- currentIndex: i,
1176
- isShuffled: !1,
1177
- originalTracks: null,
1178
- isPaused: !1,
1179
- ...U
1180
- };
1181
- }
1182
- const a = n <= e.currentIndex ? e.currentIndex + 1 : e.currentIndex;
1183
- return {
1184
- ...e,
1185
- tracks: t,
1186
- isShuffled: !1,
1187
- originalTracks: null,
1188
- currentIndex: A(a, t.length)
1189
- };
1190
- }
1191
- case "REMOVE_TRACK": {
1192
- const n = r.payload.index, t = Or(e.tracks, n), a = n < e.currentIndex ? e.currentIndex - 1 : n === e.currentIndex ? Math.min(e.currentIndex, Math.max(0, t.length - 1)) : e.currentIndex;
1193
- return {
1194
- ...e,
1195
- tracks: t,
1196
- isShuffled: !1,
1197
- originalTracks: null,
1198
- currentIndex: A(a, t.length),
1199
- ...n === e.currentIndex ? U : {}
1200
- };
1201
- }
1202
- case "MOVE_TRACK": {
1203
- const { fromIndex: n, toIndex: t } = r.payload, a = Br(e.tracks, n, t);
1204
- let i = e.currentIndex;
1205
- return e.currentIndex === n ? i = t : n < e.currentIndex && t >= e.currentIndex ? i -= 1 : n > e.currentIndex && t <= e.currentIndex && (i += 1), {
1206
- ...e,
1207
- tracks: a,
1208
- isShuffled: !1,
1209
- originalTracks: null,
1210
- currentIndex: A(i, a.length)
1211
- };
1212
- }
1213
- case "ADD_NEXT": {
1214
- const n = Yr(e.tracks, e.currentIndex, r.payload.track);
1215
- return {
1216
- ...e,
1217
- tracks: n,
1218
- isShuffled: !1,
1219
- originalTracks: null
1220
- };
1221
- }
1222
- case "SET_INDEX": {
1223
- const n = A(r.payload.index, e.tracks.length), t = r.payload.autoPlay, a = t === !0 ? !1 : t === !1 ? !0 : e.isPaused;
1224
- return {
1225
- ...e,
1226
- currentIndex: n,
1227
- ...U,
1228
- isPaused: a
1229
- };
1230
- }
1231
- case "PLAY":
1232
- return { ...e, isPaused: !1 };
1233
- case "PAUSE":
1234
- return { ...e, isPaused: !0 };
1235
- case "TOGGLE_PAUSE":
1236
- return { ...e, isPaused: !e.isPaused };
1237
- case "SET_REPEAT":
1238
- return { ...e, repeatMode: r.payload };
1239
- case "CYCLE_REPEAT":
1240
- return { ...e, repeatMode: Kr(e.repeatMode) };
1241
- case "TOGGLE_SHUFFLE": {
1242
- if (e.tracks.length <= 1) return { ...e, isShuffled: !1, originalTracks: null };
1243
- if (!e.isShuffled) {
1244
- const i = [...e.tracks], o = Ye(i, e.currentIndex);
1245
- return {
1246
- ...e,
1247
- isShuffled: !0,
1248
- originalTracks: i,
1249
- tracks: o,
1250
- currentIndex: 0
1251
- };
1252
- }
1253
- const n = e.originalTracks ? [...e.originalTracks] : [...e.tracks], t = e.tracks[e.currentIndex], a = $r(n, t);
1254
- return {
1255
- ...e,
1256
- isShuffled: !1,
1257
- originalTracks: null,
1258
- tracks: n,
1259
- currentIndex: A(a, n.length)
1260
- };
1261
- }
1262
- case "NEXT": {
1263
- const n = Hr(e), t = n === e.currentIndex;
1264
- return {
1265
- ...e,
1266
- currentIndex: n,
1267
- ...t ? {} : U,
1268
- isPaused: t ? e.isPaused : !1
1269
- };
1270
- }
1271
- case "PREV": {
1272
- const n = jr(e), t = n === e.currentIndex;
1273
- return {
1274
- ...e,
1275
- currentIndex: n,
1276
- ...t ? {} : U,
1277
- isPaused: t ? e.isPaused : !1
1278
- };
1279
- }
1280
- case "MEDIA_TIME_UPDATE":
1281
- return {
1282
- ...e,
1283
- currentTime: r.payload.currentTime,
1284
- duration: Number.isFinite(r.payload.duration) ? r.payload.duration : e.duration,
1285
- bufferedFraction: r.payload.bufferedFraction,
1286
- isBuffering: !1
1287
- };
1288
- case "MEDIA_LOADED_METADATA":
1289
- return {
1290
- ...e,
1291
- duration: Number.isFinite(r.payload.duration) ? r.payload.duration : e.duration,
1292
- bufferedFraction: r.payload.bufferedFraction,
1293
- errorMessage: null
1294
- };
1295
- case "SET_PLAYLIST_META":
1296
- return { ...e, playlistMeta: r.payload };
1297
- case "SET_PLAYBACK_MODE":
1298
- return { ...e, playbackMode: r.payload };
1299
- case "MEDIA_ERROR":
1300
- return {
1301
- ...e,
1302
- errorMessage: r.payload.message,
1303
- isPaused: !0,
1304
- isBuffering: !1
1305
- };
1306
- case "MEDIA_WAITING":
1307
- return { ...e, isBuffering: !0 };
1308
- case "MEDIA_CANPLAY":
1309
- return { ...e, isBuffering: !1, errorMessage: null };
1310
- case "MEDIA_PLAY":
1311
- return { ...e, isPaused: !1, isBuffering: !1 };
1312
- case "MEDIA_PAUSE":
1313
- return { ...e, isPaused: !0 };
1314
- case "RESET_MEDIA_TIMES":
1315
- return { ...e, currentTime: 0, duration: 0, bufferedFraction: 0 };
1316
- case "MEDIA_SOURCE_CLEARED":
1317
- return { ...e, ...U };
1318
- case "SET_VOLUME":
1319
- return { ...e, volume: Ae(r.payload) };
1320
- case "SET_MUTED":
1321
- return { ...e, muted: r.payload };
1322
- case "TOGGLE_MUTE":
1323
- return { ...e, muted: !e.muted };
1324
- case "SET_PLAYBACK_RATE":
1325
- return { ...e, playbackRate: Ce(r.payload) };
1326
- case "MEDIA_VOLUME_SYNC": {
1327
- const { volume: n, muted: t } = r.payload, a = Ae(n);
1328
- return a === e.volume && t === e.muted ? e : { ...e, volume: a, muted: t };
1329
- }
1330
- default:
1331
- return e;
1332
- }
1333
- }
1334
- function Re() {
1335
- return typeof navigator > "u" || !("mediaSession" in navigator) ? null : navigator.mediaSession;
1336
- }
1337
- function Tn(e, r, n) {
1338
- var l;
1339
- const t = r.tracks[r.currentIndex], a = t == null ? void 0 : t.title, i = t == null ? void 0 : t.artist, o = t == null ? void 0 : t.album, u = He(t, (l = r.playlistMeta) == null ? void 0 : l.artworkUrl);
1340
- E(() => {
1341
- const s = Re();
1342
- !e || !s || (s.metadata = new MediaMetadata({
1343
- title: a ?? "Unknown track",
1344
- artist: i,
1345
- album: o,
1346
- artwork: u ? [{ src: u }] : void 0
1347
- }));
1348
- }, [e, a, i, o, u]), E(() => {
1349
- const s = Re();
1350
- !e || !s || (s.playbackState = r.isPaused ? "paused" : "playing");
1351
- }, [e, r.isPaused]), E(() => {
1352
- const s = Re();
1353
- if (!(!e || !s)) {
1354
- try {
1355
- s.setActionHandler("play", n.play), s.setActionHandler("pause", n.pause), s.setActionHandler("nexttrack", n.next), s.setActionHandler("previoustrack", n.prev), s.setActionHandler("seekto", (g) => {
1356
- typeof g.seekTime == "number" && Number.isFinite(g.seekTime) && n.seek(g.seekTime);
1357
- });
1358
- } catch {
1359
- }
1360
- return () => {
1361
- try {
1362
- s.setActionHandler("play", null), s.setActionHandler("pause", null), s.setActionHandler("nexttrack", null), s.setActionHandler("previoustrack", null), s.setActionHandler("seekto", null);
1363
- } catch {
1364
- }
1365
- };
1366
- }
1367
- }, [e, n]);
1368
- }
1369
- const In = {
1370
- "--ginger-primary-color": "#111827",
1371
- "--ginger-muted-color": "#6b7280",
1372
- "--ginger-font-size": "14px",
1373
- "--ginger-font-family": "system-ui, sans-serif",
1374
- "--ginger-playlist-row-padding": "6px 8px",
1375
- "--ginger-artwork-radius": "6px",
1376
- "--ginger-artwork-bg": "#f3f4f6",
1377
- "--ginger-playlist-active-bg": "rgba(17, 24, 39, 0.06)",
1378
- "--ginger-buffer-color": "rgba(107, 114, 128, 0.35)",
1379
- "--ginger-focus-ring": "0 0 0 2px rgba(59, 130, 246, 0.45)"
1380
- };
1381
- function En({
1382
- children: e,
1383
- initialTracks: r = [],
1384
- initialIndex: n = 0,
1385
- initialPlaylistMeta: t = null,
1386
- initialShuffle: a = !1,
1387
- initialRepeatMode: i = "off",
1388
- initialPlaybackMode: o = "playlist",
1389
- initialPaused: u = !0,
1390
- initialVolume: l = 1,
1391
- initialMuted: s = !1,
1392
- initialPlaybackRate: g = 1,
1393
- initialStateKey: m,
1394
- locale: y,
1395
- mediaSession: k = !1,
1396
- beforePlay: b,
1397
- onPlayBlocked: S,
1398
- persistence: p,
1399
- hydrateOnMount: T = !1,
1400
- resumeOnTrackChange: R = !1,
1401
- unstyled: w = !1,
1402
- className: Se,
1403
- style: K,
1404
- onTrackChange: Z,
1405
- onPlay: ee,
1406
- onPause: re,
1407
- onQueueEnd: ne,
1408
- onError: te
1409
- }) {
1410
- var Fe;
1411
- const $ = O(null), [c, h] = wr(
1412
- Mn,
1413
- void 0,
1414
- () => Tr({
1415
- tracks: r,
1416
- currentIndex: n,
1417
- playlistMeta: t,
1418
- isPaused: u,
1419
- isShuffled: a,
1420
- repeatMode: i,
1421
- playbackMode: o,
1422
- volume: l,
1423
- muted: s,
1424
- playbackRate: g
1425
- })
1426
- ), Le = O(c), Pe = O({
1427
- tracks: r,
1428
- currentIndex: n,
1429
- playlistMeta: t,
1430
- isPaused: u,
1431
- isShuffled: a,
1432
- repeatMode: i,
1433
- playbackMode: o,
1434
- volume: l,
1435
- muted: s,
1436
- playbackRate: g
1437
- });
1438
- Pe.current = {
1439
- tracks: r,
1440
- currentIndex: n,
1441
- playlistMeta: t,
1442
- isPaused: u,
1443
- isShuffled: a,
1444
- repeatMode: i,
1445
- playbackMode: o,
1446
- volume: l,
1447
- muted: s,
1448
- playbackRate: g
1449
- };
1450
- const X = O(void 0);
1451
- E(() => {
1452
- if (m === void 0) {
1453
- X.current = void 0;
1454
- return;
1455
- }
1456
- if (X.current === void 0) {
1457
- X.current = m;
1458
- return;
1459
- }
1460
- if (X.current === m) return;
1461
- X.current = m;
1462
- const f = Pe.current;
1463
- h({
1464
- type: "INIT",
1465
- payload: {
1466
- tracks: f.tracks,
1467
- currentIndex: f.currentIndex,
1468
- playlistMeta: f.playlistMeta,
1469
- isPaused: f.isPaused,
1470
- isShuffled: f.isShuffled,
1471
- repeatMode: f.repeatMode,
1472
- playbackMode: f.playbackMode,
1473
- volume: f.volume,
1474
- muted: f.muted,
1475
- playbackRate: f.playbackRate
1476
- }
1477
- });
1478
- }, [m, h]), E(() => {
1479
- Le.current = c;
1480
- }, [c]);
1481
- const De = c.tracks[c.currentIndex] ?? null;
1482
- E(() => {
1483
- Z == null || Z(De, c.currentIndex);
1484
- }, [De, c.currentIndex, Z]), E(() => {
1485
- c.errorMessage && (te == null || te(c.errorMessage));
1486
- }, [c.errorMessage, te]);
1487
- const ae = O(void 0);
1488
- E(() => {
1489
- if (ae.current === void 0) {
1490
- ae.current = c.isPaused;
1491
- return;
1492
- }
1493
- ae.current !== c.isPaused && (c.isPaused ? re == null || re() : ee == null || ee()), ae.current = c.isPaused;
1494
- }, [c.isPaused, re, ee]);
1495
- const L = v(() => {
1496
- h({ type: "PLAY" });
1497
- }, []), D = v(() => {
1498
- var f;
1499
- h({ type: "PAUSE" }), (f = $.current) == null || f.pause();
1500
- }, []), ie = v(() => {
1501
- c.isPaused ? L() : D();
1502
- }, [D, L, c.isPaused]), F = v((f) => {
1503
- const x = $.current;
1504
- x && Number.isFinite(f) && (x.currentTime = Math.max(0, f));
1505
- }, []), oe = v((f) => {
1506
- h({ type: "SET_VOLUME", payload: Ae(f) });
1507
- }, []), ue = v((f) => {
1508
- h({ type: "SET_MUTED", payload: f });
1509
- }, []), se = v(() => {
1510
- h({ type: "TOGGLE_MUTE" });
1511
- }, []), le = v((f) => {
1512
- h({ type: "SET_PLAYBACK_RATE", payload: Ce(f) });
1513
- }, []), Q = v(() => {
1514
- h({ type: "NEXT" });
1515
- }, []), H = v(() => {
1516
- h({ type: "PREV" });
1517
- }, []), ce = v((f) => {
1518
- h({ type: "SET_REPEAT", payload: f });
1519
- }, []), de = v(() => {
1520
- h({ type: "CYCLE_REPEAT" });
1521
- }, []), fe = v(() => {
1522
- h({ type: "TOGGLE_SHUFFLE" });
1523
- }, []), pe = v((f, x) => {
1524
- h({ type: "SET_QUEUE", payload: { tracks: f, currentIndex: x } });
1525
- }, []), ge = v((f, x, M) => {
1526
- h({ type: "INSERT_TRACK", payload: { track: f, index: x, autoPlay: M } });
1527
- }, []), me = v((f) => {
1528
- h({ type: "REMOVE_TRACK", payload: { index: f } });
1529
- }, []), ye = v((f, x) => {
1530
- h({ type: "MOVE_TRACK", payload: { fromIndex: f, toIndex: x } });
1531
- }, []), he = v((f) => {
1532
- h({ type: "ADD_NEXT", payload: { track: f } });
1533
- }, []), be = v((f) => {
1534
- h({ type: "SET_INDEX", payload: { index: f, autoPlay: !0 } });
1535
- }, []), ve = v((f) => {
1536
- h({ type: "SET_INDEX", payload: { index: f, autoPlay: !1 } });
1537
- }, []), ke = v((f) => {
1538
- h({ type: "SET_PLAYLIST_META", payload: f });
1539
- }, []), xe = v((f) => {
1540
- h({ type: "SET_PLAYBACK_MODE", payload: f });
1541
- }, []), Me = v((f) => {
1542
- h({ type: "INIT", payload: f });
1543
- }, []);
1544
- E(() => {
1545
- if (!p || !T) return;
1546
- const f = p.get("ginger:volume"), x = p.get("ginger:muted"), M = p.get("ginger:playbackRate"), C = p.get("ginger:repeatMode"), Ie = p.get("ginger:currentIndex"), G = Pe.current;
1547
- h({
1548
- type: "INIT",
1549
- payload: {
1550
- tracks: G.tracks,
1551
- playlistMeta: G.playlistMeta,
1552
- isPaused: G.isPaused,
1553
- isShuffled: G.isShuffled,
1554
- playbackMode: G.playbackMode,
1555
- currentIndex: typeof Ie == "number" ? Ie : G.currentIndex,
1556
- repeatMode: C === "off" || C === "all" || C === "one" ? C : G.repeatMode,
1557
- volume: typeof f == "number" ? f : G.volume,
1558
- muted: typeof x == "boolean" ? x : G.muted,
1559
- playbackRate: typeof M == "number" ? M : G.playbackRate
1560
- }
1561
- });
1562
- }, [T, p]), E(() => {
1563
- p && (p.set("ginger:volume", c.volume), p.set("ginger:muted", c.muted), p.set("ginger:playbackRate", c.playbackRate), p.set("ginger:repeatMode", c.repeatMode), p.set("ginger:currentIndex", c.currentIndex));
1564
- }, [
1565
- p,
1566
- c.volume,
1567
- c.muted,
1568
- c.playbackRate,
1569
- c.repeatMode,
1570
- c.currentIndex
1571
- ]), E(() => {
1572
- if (!p || !R) return;
1573
- const f = c.tracks[c.currentIndex];
1574
- if (!f) return;
1575
- const x = `ginger:resume:${W(f)}`, M = p.get(x);
1576
- typeof M == "number" && Number.isFinite(M) && F(M);
1577
- }, [p, R, c.currentIndex, c.tracks, F]), E(() => {
1578
- if (!p || !R) return;
1579
- const f = c.tracks[c.currentIndex];
1580
- if (!f || !(c.currentTime >= 0)) return;
1581
- const x = `ginger:resume:${W(f)}`, M = setTimeout(() => p.set(x, c.currentTime), 250);
1582
- return () => clearTimeout(M);
1583
- }, [p, R, c.currentIndex, c.tracks, c.currentTime]);
1584
- const Ir = (Fe = c.tracks[c.currentIndex]) == null ? void 0 : Fe.fileUrl;
1585
- E(() => {
1586
- const f = $.current;
1587
- if (!f) return;
1588
- if (c.isPaused) {
1589
- f.pause();
1590
- return;
1591
- }
1592
- let x = !1;
1593
- return (async () => {
1594
- if (b) {
1595
- let M = !1;
1596
- try {
1597
- M = await b();
1598
- } catch (C) {
1599
- const Ie = C instanceof Error ? C.message : "beforePlay rejected";
1600
- h({ type: "MEDIA_ERROR", payload: { message: Ie } });
1601
- return;
1602
- }
1603
- if (!M) {
1604
- x || (h({ type: "PAUSE" }), S == null || S());
1605
- return;
1606
- }
1607
- }
1608
- x || f.play().catch((M) => {
1609
- const C = M instanceof Error ? M.message : typeof M == "string" ? M : "Playback failed (e.g. autoplay blocked or unavailable source)";
1610
- h({ type: "MEDIA_ERROR", payload: { message: C } });
1611
- });
1612
- })(), () => {
1613
- x = !0;
1614
- };
1615
- }, [b, Ir, S, c.isPaused]);
1616
- const Te = v(() => {
1617
- const f = Qr(Le.current);
1618
- if (f.kind === "replay_same") {
1619
- const M = $.current;
1620
- M && (M.currentTime = 0), h({ type: "PLAY" });
1621
- return;
1622
- }
1623
- if (f.kind === "stop") {
1624
- h({ type: "PAUSE" }), ne == null || ne();
1625
- return;
1626
- }
1627
- const x = f.nextIndex;
1628
- h({ type: "SET_INDEX", payload: { index: x, autoPlay: !0 } });
1629
- }, [ne]), Er = P(
1630
- () => ({ play: L, pause: D, next: Q, prev: H, seek: F }),
1631
- [L, D, Q, H, F]
1632
- );
1633
- Tn(!!k, c, Er);
1634
- const Ar = y != null && y.seek && /[\u0590-\u08FF]/.test(y.seek) ? "rtl" : "ltr", Sr = P(
1635
- () => ({
1636
- state: c,
1637
- dispatch: h,
1638
- audioRef: $,
1639
- notifyEnded: Te,
1640
- init: Me,
1641
- play: L,
1642
- pause: D,
1643
- togglePlayPause: ie,
1644
- seek: F,
1645
- setVolume: oe,
1646
- setMuted: ue,
1647
- toggleMute: se,
1648
- setPlaybackRate: le,
1649
- next: Q,
1650
- prev: H,
1651
- setRepeatMode: ce,
1652
- cycleRepeat: de,
1653
- toggleShuffle: fe,
1654
- setQueue: pe,
1655
- insertTrackAt: ge,
1656
- removeTrackAt: me,
1657
- moveTrack: ye,
1658
- enqueueNext: he,
1659
- playTrackAt: be,
1660
- selectTrackAt: ve,
1661
- setPlaylistMeta: ke,
1662
- setPlaybackMode: xe
1663
- }),
1664
- [
1665
- de,
1666
- h,
1667
- Me,
1668
- Q,
1669
- Te,
1670
- D,
1671
- L,
1672
- be,
1673
- ge,
1674
- me,
1675
- ye,
1676
- he,
1677
- ve,
1678
- H,
1679
- F,
1680
- ue,
1681
- le,
1682
- pe,
1683
- ce,
1684
- ke,
1685
- xe,
1686
- oe,
1687
- c,
1688
- se,
1689
- ie,
1690
- fe
1691
- ]
1692
- ), Pr = P(
1693
- () => ({
1694
- tracks: c.tracks,
1695
- currentIndex: c.currentIndex,
1696
- isPaused: c.isPaused,
1697
- isShuffled: c.isShuffled,
1698
- repeatMode: c.repeatMode,
1699
- originalTracks: c.originalTracks,
1700
- playlistMeta: c.playlistMeta,
1701
- init: Me,
1702
- play: L,
1703
- pause: D,
1704
- togglePlayPause: ie,
1705
- next: Q,
1706
- prev: H,
1707
- setRepeatMode: ce,
1708
- cycleRepeat: de,
1709
- toggleShuffle: fe,
1710
- playbackMode: c.playbackMode,
1711
- setQueue: pe,
1712
- insertTrackAt: ge,
1713
- removeTrackAt: me,
1714
- moveTrack: ye,
1715
- enqueueNext: he,
1716
- playTrackAt: be,
1717
- selectTrackAt: ve,
1718
- setPlaylistMeta: ke,
1719
- setPlaybackMode: xe,
1720
- dispatch: h
1721
- }),
1722
- [
1723
- c.tracks,
1724
- c.currentIndex,
1725
- c.isPaused,
1726
- c.isShuffled,
1727
- c.repeatMode,
1728
- c.playbackMode,
1729
- c.originalTracks,
1730
- c.playlistMeta,
1731
- Me,
1732
- L,
1733
- D,
1734
- ie,
1735
- Q,
1736
- H,
1737
- ce,
1738
- de,
1739
- fe,
1740
- pe,
1741
- ge,
1742
- me,
1743
- ye,
1744
- he,
1745
- be,
1746
- ve,
1747
- ke,
1748
- xe,
1749
- h
1750
- ]
1751
- ), Rr = P(
1752
- () => ({
1753
- currentTime: c.currentTime,
1754
- duration: c.duration,
1755
- bufferedFraction: c.bufferedFraction,
1756
- isBuffering: c.isBuffering,
1757
- errorMessage: c.errorMessage,
1758
- volume: c.volume,
1759
- muted: c.muted,
1760
- playbackRate: c.playbackRate,
1761
- seek: F,
1762
- setVolume: oe,
1763
- setMuted: ue,
1764
- toggleMute: se,
1765
- setPlaybackRate: le,
1766
- audioRef: $,
1767
- notifyEnded: Te,
1768
- dispatch: h
1769
- }),
1770
- [
1771
- c.currentTime,
1772
- c.duration,
1773
- c.bufferedFraction,
1774
- c.isBuffering,
1775
- c.errorMessage,
1776
- c.volume,
1777
- c.muted,
1778
- c.playbackRate,
1779
- F,
1780
- oe,
1781
- ue,
1782
- se,
1783
- le,
1784
- $,
1785
- Te,
1786
- h
1787
- ]
1788
- ), _r = je(c), Gr = P(
1789
- () => w ? K : { ...In, ...K },
1790
- [K, w]
1791
- );
1792
- return /* @__PURE__ */ d(Vr, { locale: y, children: /* @__PURE__ */ d(Cr.Provider, { value: Pr, children: /* @__PURE__ */ d(Lr.Provider, { value: Rr, children: /* @__PURE__ */ d(Oe.Provider, { value: Sr, children: /* @__PURE__ */ d(
1793
- "div",
1794
- {
1795
- className: Se,
1796
- style: Gr,
1797
- "data-ginger-playback": _r,
1798
- dir: Ar,
1799
- children: e
1800
- }
1801
- ) }) }) }) });
1802
- }
1803
- const Rn = {
1804
- Provider: En,
1805
- Player: Fr,
1806
- Current: {
1807
- Title: nn,
1808
- Artist: tn,
1809
- Album: an,
1810
- Description: on,
1811
- Copyright: un,
1812
- Genre: sn,
1813
- Label: ln,
1814
- Isrc: cn,
1815
- TrackNumber: dn,
1816
- Year: tr,
1817
- Lyrics: ar,
1818
- LyricsSynced: ir,
1819
- Chapters: or,
1820
- FileUrl: ur,
1821
- Artwork: sr,
1822
- QueueIndex: lr,
1823
- QueueLength: cr,
1824
- QueuePosition: dr,
1825
- Elapsed: fr,
1826
- Duration: pr,
1827
- Remaining: gr,
1828
- Progress: mr,
1829
- TimeRail: yr,
1830
- BufferRail: hr,
1831
- PlaybackState: br,
1832
- ErrorMessage: vr
1833
- },
1834
- Queue: {
1835
- Title: hn,
1836
- Subtitle: bn,
1837
- Description: vn,
1838
- Copyright: kn,
1839
- Artwork: Mr
1840
- },
1841
- Control: {
1842
- PlayPause: Xe,
1843
- Repeat: ze,
1844
- Next: We,
1845
- Previous: qe,
1846
- Shuffle: Je,
1847
- SeekBar: Ze,
1848
- Volume: er,
1849
- Mute: rr,
1850
- PlaybackRate: nr
1851
- },
1852
- Playlist: yn
1853
- };
1854
- export {
1855
- or as C,
1856
- Rn as G,
1857
- ir as L,
1858
- Ae as a,
1859
- je as b,
1860
- Ce as c,
1861
- Ee as d,
1862
- N as e,
1863
- pn as f,
1864
- en as g,
1865
- Jr as h,
1866
- Zr as i,
1867
- Wr as j,
1868
- Ke as k,
1869
- zr as l,
1870
- J as m,
1871
- V as n,
1872
- Hr as o,
1873
- fn as p,
1874
- qr as r,
1875
- gn as u
1876
- };
1877
- //# sourceMappingURL=ginger-DE4TKdCR.js.map