@lucaismyname/ginger 0.0.5 → 0.0.9

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 (99) hide show
  1. package/README.md +844 -0
  2. package/dist/GingerSplitContexts-4YZ-OJ9V.js +63 -0
  3. package/dist/GingerSplitContexts-4YZ-OJ9V.js.map +1 -0
  4. package/dist/GingerSplitContexts-Bze1Bqe2.cjs +2 -0
  5. package/dist/GingerSplitContexts-Bze1Bqe2.cjs.map +1 -0
  6. package/dist/audio/GingerPlayer.d.ts +2 -1
  7. package/dist/audio/GingerPlayer.d.ts.map +1 -1
  8. package/dist/client.cjs +2 -0
  9. package/dist/client.cjs.map +1 -0
  10. package/dist/client.d.ts +2 -0
  11. package/dist/client.d.ts.map +1 -0
  12. package/dist/client.js +28 -0
  13. package/dist/client.js.map +1 -0
  14. package/dist/components/controls/Controls.d.ts +7 -3
  15. package/dist/components/controls/Controls.d.ts.map +1 -1
  16. package/dist/components/current/Artwork.d.ts.map +1 -1
  17. package/dist/components/current/Playback.d.ts +2 -1
  18. package/dist/components/current/Playback.d.ts.map +1 -1
  19. package/dist/components/current/Time.d.ts +11 -1
  20. package/dist/components/current/Time.d.ts.map +1 -1
  21. package/dist/components/current/index.d.ts +1 -1
  22. package/dist/components/current/index.d.ts.map +1 -1
  23. package/dist/components/playlist/GingerPlaylist.d.ts.map +1 -1
  24. package/dist/context/GingerContext.d.ts +7 -1
  25. package/dist/context/GingerContext.d.ts.map +1 -1
  26. package/dist/context/GingerLocaleContext.d.ts +9 -0
  27. package/dist/context/GingerLocaleContext.d.ts.map +1 -0
  28. package/dist/context/GingerProvider.d.ts +1 -1
  29. package/dist/context/GingerProvider.d.ts.map +1 -1
  30. package/dist/context/GingerSplitContexts.d.ts +46 -0
  31. package/dist/context/GingerSplitContexts.d.ts.map +1 -0
  32. package/dist/core/playbackReducer.d.ts +1 -0
  33. package/dist/core/playbackReducer.d.ts.map +1 -1
  34. package/dist/core/queue.d.ts +4 -0
  35. package/dist/core/queue.d.ts.map +1 -1
  36. package/dist/core/transitions.d.ts.map +1 -1
  37. package/dist/core/transitions.test.d.ts +2 -0
  38. package/dist/core/transitions.test.d.ts.map +1 -0
  39. package/dist/experimental-gapless/index.cjs +2 -0
  40. package/dist/experimental-gapless/index.cjs.map +1 -0
  41. package/dist/experimental-gapless/index.d.ts +11 -0
  42. package/dist/experimental-gapless/index.d.ts.map +1 -0
  43. package/dist/experimental-gapless/index.js +17 -0
  44. package/dist/experimental-gapless/index.js.map +1 -0
  45. package/dist/ginger-C1fV612c.cjs +2 -0
  46. package/dist/ginger-C1fV612c.cjs.map +1 -0
  47. package/dist/ginger-gb6OJ3eQ.js +1547 -0
  48. package/dist/ginger-gb6OJ3eQ.js.map +1 -0
  49. package/dist/ginger.d.ts +1 -0
  50. package/dist/ginger.d.ts.map +1 -1
  51. package/dist/hooks/useControlBindings.d.ts +40 -0
  52. package/dist/hooks/useControlBindings.d.ts.map +1 -0
  53. package/dist/hooks/useGinger.d.ts +5 -0
  54. package/dist/hooks/useGinger.d.ts.map +1 -1
  55. package/dist/hooks/useGingerChapters.d.ts +12 -0
  56. package/dist/hooks/useGingerChapters.d.ts.map +1 -0
  57. package/dist/hooks/useGingerDebugLog.d.ts +2 -0
  58. package/dist/hooks/useGingerDebugLog.d.ts.map +1 -0
  59. package/dist/hooks/useGingerKeyboardShortcuts.d.ts +8 -0
  60. package/dist/hooks/useGingerKeyboardShortcuts.d.ts.map +1 -0
  61. package/dist/hooks/useGingerLyricsSync.d.ts +8 -0
  62. package/dist/hooks/useGingerLyricsSync.d.ts.map +1 -0
  63. package/dist/hooks/useGingerSleepTimer.d.ts +9 -0
  64. package/dist/hooks/useGingerSleepTimer.d.ts.map +1 -0
  65. package/dist/hooks/useSeekDrag.d.ts +8 -0
  66. package/dist/hooks/useSeekDrag.d.ts.map +1 -0
  67. package/dist/index.cjs +1 -1
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.d.ts +21 -2
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +25 -1071
  72. package/dist/index.js.map +1 -1
  73. package/dist/internal/lyrics.d.ts +6 -0
  74. package/dist/internal/lyrics.d.ts.map +1 -0
  75. package/dist/internal/lyrics.test.d.ts +2 -0
  76. package/dist/internal/lyrics.test.d.ts.map +1 -0
  77. package/dist/media/useMediaSession.d.ts +10 -0
  78. package/dist/media/useMediaSession.d.ts.map +1 -0
  79. package/dist/testing/index.cjs +91 -0
  80. package/dist/testing/index.cjs.map +1 -0
  81. package/dist/testing/index.d.ts +8 -0
  82. package/dist/testing/index.d.ts.map +1 -0
  83. package/dist/testing/index.js +11076 -0
  84. package/dist/testing/index.js.map +1 -0
  85. package/dist/types.d.ts +77 -0
  86. package/dist/types.d.ts.map +1 -1
  87. package/dist/useSeekDrag-CU-8Mi3A.cjs +2 -0
  88. package/dist/useSeekDrag-CU-8Mi3A.cjs.map +1 -0
  89. package/dist/useSeekDrag-DdlE-Qej.js +174 -0
  90. package/dist/useSeekDrag-DdlE-Qej.js.map +1 -0
  91. package/dist/waveform/index.cjs +2 -0
  92. package/dist/waveform/index.cjs.map +1 -0
  93. package/dist/waveform/index.d.ts +3 -0
  94. package/dist/waveform/index.d.ts.map +1 -0
  95. package/dist/waveform/index.js +40 -0
  96. package/dist/waveform/index.js.map +1 -0
  97. package/dist/waveform/useAudioPeaks.d.ts +7 -0
  98. package/dist/waveform/useAudioPeaks.d.ts.map +1 -0
  99. package/package.json +25 -3
package/dist/index.js CHANGED
@@ -1,1074 +1,28 @@
1
- import { jsx as l, jsxs as de } from "react/jsx-runtime";
2
- import { useContext as fe, createContext as pe, useRef as U, useEffect as x, useMemo as L, useReducer as He, useCallback as P } from "react";
3
- const ge = pe(null);
4
- function g() {
5
- const e = fe(ge);
6
- if (!e) throw new Error("Ginger components must be used within <Ginger.Provider>");
7
- return e;
8
- }
9
- function oe(e) {
10
- const { buffered: r, duration: t } = e;
11
- return !(t > 0) || r.length === 0 ? 0 : Math.min(1, r.end(r.length - 1) / t);
12
- }
13
- function qe({ className: e, style: r, preload: t = "metadata", crossOrigin: n }) {
14
- var y;
15
- const { audioRef: i, dispatch: u, state: a, notifyEnded: s } = g(), c = ((y = a.tracks[a.currentIndex]) == null ? void 0 : y.fileUrl) ?? "", d = U({
16
- currentTime: -1,
17
- duration: -1,
18
- bufferedFraction: -1
19
- }), f = (o, m = !1) => {
20
- const T = {
21
- currentTime: o.currentTime,
22
- duration: o.duration,
23
- bufferedFraction: oe(o)
24
- }, k = d.current, M = Math.abs(T.currentTime - k.currentTime) >= 0.25 || Math.abs(T.duration - k.duration) >= 0.01 || Math.abs(T.bufferedFraction - k.bufferedFraction) >= 0.01;
25
- !m && !M || (d.current = T, u({
26
- type: "MEDIA_TIME_UPDATE",
27
- payload: T
28
- }));
29
- };
30
- return x(() => {
31
- const o = i.current;
32
- o && (o.volume = a.volume, o.muted = a.muted, o.playbackRate = a.playbackRate);
33
- }, [i, a.volume, a.muted, a.playbackRate]), x(() => {
34
- const o = i.current;
35
- if (o) {
36
- if (!c) {
37
- o.removeAttribute("src"), d.current = { currentTime: -1, duration: -1, bufferedFraction: -1 };
38
- return;
39
- }
40
- o.getAttribute("src") !== c && (o.src = c, o.load(), d.current = { currentTime: -1, duration: -1, bufferedFraction: -1 });
41
- }
42
- }, [i, a.currentIndex, a.tracks, c]), /* @__PURE__ */ l(
43
- "audio",
44
- {
45
- ref: i,
46
- className: e,
47
- style: r,
48
- preload: t,
49
- crossOrigin: n,
50
- controls: !1,
51
- playsInline: !0,
52
- onTimeUpdate: (o) => {
53
- f(o.currentTarget);
54
- },
55
- onLoadedMetadata: (o) => {
56
- const m = o.currentTarget;
57
- d.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, u({
58
- type: "MEDIA_LOADED_METADATA",
59
- payload: {
60
- duration: m.duration,
61
- bufferedFraction: oe(m)
62
- }
63
- });
64
- },
65
- onSeeking: (o) => f(o.currentTarget, !0),
66
- onSeeked: (o) => f(o.currentTarget, !0),
67
- onEnded: () => s(),
68
- onPlay: () => u({ type: "MEDIA_PLAY" }),
69
- onPause: () => u({ type: "MEDIA_PAUSE" }),
70
- onWaiting: () => u({ type: "MEDIA_WAITING" }),
71
- onCanPlay: () => u({ type: "MEDIA_CANPLAY" }),
72
- onProgress: (o) => f(o.currentTarget, !0),
73
- onVolumeChange: (o) => {
74
- const m = o.currentTarget;
75
- u({
76
- type: "MEDIA_VOLUME_SYNC",
77
- payload: { volume: m.volume, muted: m.muted }
78
- });
79
- },
80
- onError: () => {
81
- var k;
82
- const o = i.current, m = (k = o == null ? void 0 : o.error) == null ? void 0 : k.code;
83
- u({ type: "MEDIA_ERROR", payload: { message: m === 1 ? "MEDIA_ERR_ABORTED" : m === 2 ? "MEDIA_ERR_NETWORK" : m === 3 ? "MEDIA_ERR_DECODE" : m === 4 ? "MEDIA_ERR_SRC_NOT_SUPPORTED" : "MEDIA_ERR_UNKNOWN" } });
84
- }
85
- }
86
- );
87
- }
88
- function R(e, r) {
89
- return r <= 0 ? 0 : Math.max(0, Math.min(r - 1, e));
90
- }
91
- function ye(e, r) {
92
- if (e.length <= 1) return [...e];
93
- const t = e[r];
94
- if (!t) return [...e];
95
- const n = e.filter((i, u) => u !== r);
96
- for (let i = n.length - 1; i > 0; i--) {
97
- const u = Math.floor(Math.random() * (i + 1));
98
- [n[i], n[u]] = [n[u], n[i]];
99
- }
100
- return [t, ...n];
101
- }
102
- function se(e) {
103
- return e ? e.id != null && e.id !== "" ? `id:${e.id}` : `file:${e.fileUrl}` : "";
104
- }
105
- function Je(e, r) {
106
- const t = se(r);
107
- if (!t) return 0;
108
- const n = e.findIndex((i) => se(i) === t);
109
- return n === -1 ? 0 : n;
110
- }
111
- function Ze(e) {
112
- const { tracks: r, currentIndex: t, repeatMode: n } = e, i = r.length;
113
- return i === 0 ? { kind: "stop", nextIndex: 0 } : n === "one" ? { kind: "replay_same" } : t < i - 1 ? { kind: "advance", nextIndex: t + 1 } : n === "all" ? { kind: "wrap", nextIndex: 0 } : { kind: "stop", nextIndex: R(t, i) };
114
- }
115
- function er(e) {
116
- const { tracks: r, currentIndex: t, repeatMode: n } = e, i = r.length;
117
- return i === 0 ? 0 : t < i - 1 ? t + 1 : n === "all" ? 0 : R(t, i);
118
- }
119
- function rr(e) {
120
- const { tracks: r, currentIndex: t, repeatMode: n } = e, i = r.length;
121
- return i === 0 ? 0 : t > 0 ? t - 1 : n === "all" ? i - 1 : 0;
122
- }
123
- function tr(e) {
124
- return e === "off" ? "all" : e === "all" ? "one" : "off";
125
- }
126
- function nr(e, r) {
127
- return (e == null ? void 0 : e.artworkUrl) ?? r ?? void 0;
128
- }
129
- function ir(e, r) {
130
- return (e == null ? void 0 : e.album) ?? r ?? void 0;
131
- }
132
- function A(e) {
133
- return e.tracks[e.currentIndex] ?? null;
134
- }
135
- function me(e) {
136
- 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";
137
- }
138
- function C(e) {
139
- var n;
140
- const r = e.duration;
141
- if (Number.isFinite(r) && r > 0) return r;
142
- const t = (n = e.tracks[e.currentIndex]) == null ? void 0 : n.durationSeconds;
143
- return typeof t == "number" && Number.isFinite(t) && t > 0 ? t : 0;
144
- }
145
- function he(e) {
146
- const t = C(e) - e.currentTime;
147
- return Number.isFinite(t) ? Math.max(0, t) : 0;
148
- }
149
- function $(e) {
150
- const r = C(e);
151
- return r > 0 ? Math.min(1, Math.max(0, e.currentTime / r)) : 0;
152
- }
153
- function be(e) {
154
- var t;
155
- const r = A(e);
156
- return nr(r, (t = e.playlistMeta) == null ? void 0 : t.artworkUrl);
157
- }
158
- function Pe(e) {
159
- var t;
160
- const r = A(e);
161
- return ir(r, (t = e.playlistMeta) == null ? void 0 : t.subtitle);
162
- }
163
- function v(e, r) {
164
- function t(n) {
165
- const { state: i } = g(), a = (r(i) ?? "").trim(), { className: s, style: c, fallback: d, empty: f, children: y } = n;
166
- if (!a) {
167
- const o = f ?? d ?? null;
168
- return o ? /* @__PURE__ */ l("span", { className: s, style: c, children: o }) : null;
169
- }
170
- return y ? /* @__PURE__ */ l("span", { className: s, style: c, children: y(a, i) }) : /* @__PURE__ */ l("span", { className: s, style: c, children: a });
171
- }
172
- return t.displayName = e, t;
173
- }
174
- function I(e, r) {
175
- return v(e, (t) => r(A(t)));
176
- }
177
- const ur = I("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), ar = I("Ginger.Current.Artist", (e) => e == null ? void 0 : e.artist), lr = v("Ginger.Current.Album", (e) => Pe(e)), or = I("Ginger.Current.Description", (e) => e == null ? void 0 : e.description), sr = v("Ginger.Current.Copyright", (e) => {
178
- var t;
179
- const r = A(e);
180
- return (r == null ? void 0 : r.copyright) ?? ((t = e.playlistMeta) == null ? void 0 : t.copyright);
181
- }), cr = I("Ginger.Current.Genre", (e) => e == null ? void 0 : e.genre), dr = I("Ginger.Current.Label", (e) => e == null ? void 0 : e.label), fr = I("Ginger.Current.Isrc", (e) => e == null ? void 0 : e.isrc), pr = I(
182
- "Ginger.Current.TrackNumber",
183
- (e) => (e == null ? void 0 : e.trackNumber) != null ? String(e.trackNumber) : void 0
184
- );
185
- function Te({ className: e, style: r, fallback: t, empty: n, children: i, format: u }) {
186
- var d;
187
- const { state: a } = g(), s = (d = A(a)) == null ? void 0 : d.year;
188
- if (typeof s != "number" || !Number.isFinite(s)) {
189
- const f = n ?? t ?? null;
190
- return f ? /* @__PURE__ */ l("span", { className: e, style: r, children: f }) : null;
191
- }
192
- const c = u ? u(s) : String(s);
193
- return i ? /* @__PURE__ */ l("span", { className: e, style: r, children: i(c, a) }) : /* @__PURE__ */ l("span", { className: e, style: r, children: c });
194
- }
195
- Te.displayName = "Ginger.Current.Year";
196
- function ke({ className: e, style: r, fallback: t, empty: n, children: i, preserveWhitespace: u = !0 }) {
197
- var f;
198
- const { state: a } = g(), s = ((f = A(a)) == null ? void 0 : f.lyrics) ?? "", c = u ? s.replace(/^\s+|\s+$/g, "") : s.trim();
199
- if (!c) {
200
- const y = n ?? t ?? null;
201
- return y ? /* @__PURE__ */ l("span", { className: e, style: r, children: y }) : null;
202
- }
203
- const d = u ? { whiteSpace: "pre-wrap" } : void 0;
204
- return i ? /* @__PURE__ */ l("span", { className: e, style: { ...d, ...r }, children: i(c, a) }) : /* @__PURE__ */ l("span", { className: e, style: { ...d, ...r }, children: c });
205
- }
206
- ke.displayName = "Ginger.Current.Lyrics";
207
- function Me({ visible: e = !1, className: r, style: t, fallback: n, empty: i, children: u }) {
208
- var c;
209
- const { state: a } = g();
210
- if (!e) return null;
211
- const s = ((c = A(a)) == null ? void 0 : c.fileUrl) ?? "";
212
- if (!s) {
213
- const d = i ?? n ?? null;
214
- return d ? /* @__PURE__ */ l("span", { className: r, style: t, children: d }) : null;
215
- }
216
- return u ? /* @__PURE__ */ l("span", { className: r, style: t, children: u(s, a) }) : /* @__PURE__ */ l("span", { className: r, style: t, children: s });
217
- }
218
- Me.displayName = "Ginger.Current.FileUrl";
219
- function Ee({ className: e, style: r, fallback: t, empty: n, sizes: i, loading: u, onError: a, decoding: s, imgStyle: c }) {
220
- const { state: d } = g(), f = A(d), y = be(d);
221
- if (!y) {
222
- const m = n ?? t ?? null;
223
- return m ? /* @__PURE__ */ l("span", { className: e, style: r, children: m }) : null;
224
- }
225
- const o = [f == null ? void 0 : f.title, f == null ? void 0 : f.artist].filter(Boolean).join(" — ") || "Artwork";
226
- return /* @__PURE__ */ l(
227
- "span",
228
- {
229
- className: e,
230
- style: {
231
- display: "inline-block",
232
- background: "var(--ginger-artwork-bg, transparent)",
233
- borderRadius: "var(--ginger-artwork-radius, 0)",
234
- overflow: "hidden",
235
- ...r
236
- },
237
- children: /* @__PURE__ */ l(
238
- "img",
239
- {
240
- src: y,
241
- alt: o,
242
- sizes: i,
243
- loading: u,
244
- decoding: s,
245
- onError: a,
246
- style: {
247
- display: "block",
248
- width: "100%",
249
- height: "100%",
250
- objectFit: "cover",
251
- ...c
252
- }
253
- }
254
- )
255
- }
256
- );
257
- }
258
- Ee.displayName = "Ginger.Current.Artwork";
259
- function Ae({ base: e = 0, className: r, style: t, fallback: n, empty: i, children: u }) {
260
- const { state: a } = g();
261
- if (a.tracks.length === 0) {
262
- const d = i ?? n ?? null;
263
- return d ? /* @__PURE__ */ l("span", { className: r, style: t, children: d }) : null;
264
- }
265
- const c = String(a.currentIndex + e);
266
- return u ? /* @__PURE__ */ l("span", { className: r, style: t, children: u(c, a) }) : /* @__PURE__ */ l("span", { className: r, style: t, children: c });
267
- }
268
- Ae.displayName = "Ginger.Current.QueueIndex";
269
- function xe({ className: e, style: r, fallback: t, empty: n, children: i }) {
270
- const { state: u } = g(), a = String(u.tracks.length);
271
- if (u.tracks.length === 0) {
272
- const s = n ?? t ?? null;
273
- return s ? /* @__PURE__ */ l("span", { className: e, style: r, children: s }) : null;
274
- }
275
- return i ? /* @__PURE__ */ l("span", { className: e, style: r, children: i(a, u) }) : /* @__PURE__ */ l("span", { className: e, style: r, children: a });
276
- }
277
- xe.displayName = "Ginger.Current.QueueLength";
278
- function ve({
279
- base: e = 0,
280
- separator: r = " / ",
281
- className: t,
282
- style: n,
283
- fallback: i,
284
- empty: u,
285
- children: a
286
- }) {
287
- const { state: s } = g(), c = s.tracks.length;
288
- if (c === 0) {
289
- const o = u ?? i ?? null;
290
- return o ? /* @__PURE__ */ l("span", { className: t, style: n, children: o }) : null;
291
- }
292
- const d = String(s.currentIndex + e), f = String(c), y = `${d}${r}${f}`;
293
- return a ? /* @__PURE__ */ l("span", { className: t, style: n, children: a({ index: d, length: f, label: y }, s) }) : /* @__PURE__ */ l("span", { className: t, style: n, children: y });
294
- }
295
- ve.displayName = "Ginger.Current.QueuePosition";
296
- function gr(e) {
297
- if (!Number.isFinite(e) || e < 0) return "0:00";
298
- const r = Math.floor(e % 60);
299
- return `${Math.floor(e / 60)}:${r.toString().padStart(2, "0")}`;
300
- }
301
- function Y(e, r, t) {
302
- const { className: n, style: i, fallback: u, empty: a, children: s, format: c = gr } = t;
303
- if (!(e >= 0) || !Number.isFinite(e)) {
304
- const f = a ?? u ?? null;
305
- return f ? /* @__PURE__ */ l("span", { className: n, style: i, children: f }) : null;
306
- }
307
- const d = c(e);
308
- return s ? /* @__PURE__ */ l("span", { className: n, style: i, children: s(d, r) }) : /* @__PURE__ */ l("span", { className: n, style: i, children: d });
309
- }
310
- function Ie(e) {
311
- const { state: r } = g();
312
- return Y(r.currentTime, r, e);
313
- }
314
- Ie.displayName = "Ginger.Current.Elapsed";
315
- function Re(e) {
316
- const { state: r } = g();
317
- return Y(C(r), r, e);
318
- }
319
- Re.displayName = "Ginger.Current.Duration";
320
- function Se(e) {
321
- const { state: r } = g();
322
- return Y(he(r), r, e);
323
- }
324
- Se.displayName = "Ginger.Current.Remaining";
325
- function Ge({ className: e, style: r, fallback: t, empty: n, children: i }) {
326
- const { state: u } = g(), a = C(u), s = $(u);
327
- if (!(a > 0)) {
328
- const c = n ?? t ?? null;
329
- return c ? /* @__PURE__ */ l("span", { className: e, style: r, children: c }) : null;
330
- }
331
- return i ? /* @__PURE__ */ l("span", { className: e, style: r, children: i({ fraction: s, currentTime: u.currentTime, duration: a }, u) }) : /* @__PURE__ */ l("span", { className: e, style: r, children: `${Math.round(s * 100)}%` });
332
- }
333
- Ge.displayName = "Ginger.Current.Progress";
334
- function Ce({ className: e, style: r, height: t = 4 }) {
335
- const { state: n } = g(), i = `${Math.round($(n) * 100)}%`;
336
- return /* @__PURE__ */ l(
337
- "div",
338
- {
339
- className: e,
340
- style: {
341
- width: "100%",
342
- height: t,
343
- background: "var(--ginger-muted-color, #e5e7eb)",
344
- borderRadius: 999,
345
- overflow: "hidden",
346
- ...r
347
- },
348
- "aria-hidden": !0,
349
- children: /* @__PURE__ */ l("div", { style: { width: i, height: "100%", background: "var(--ginger-primary-color, #111827)" } })
350
- }
351
- );
352
- }
353
- Ce.displayName = "Ginger.Current.TimeRail";
354
- function _e({ className: e, style: r, fallback: t, empty: n, children: i }) {
355
- const { state: u } = g(), a = me(u);
356
- return i ? /* @__PURE__ */ l("span", { className: e, style: r, children: i(a, u) }) : /* @__PURE__ */ l("span", { className: e, style: r, children: a });
357
- }
358
- _e.displayName = "Ginger.Current.PlaybackState";
359
- function Ne({ className: e, style: r, fallback: t, empty: n, children: i }) {
360
- const { state: u } = g(), a = u.errorMessage ?? "";
361
- if (!a) {
362
- const s = n ?? t ?? null;
363
- return s ? /* @__PURE__ */ l("span", { className: e, style: r, children: s }) : null;
364
- }
365
- return i ? /* @__PURE__ */ l("span", { className: e, style: r, children: i(a, u) }) : /* @__PURE__ */ l("span", { className: e, style: r, children: a });
366
- }
367
- Ne.displayName = "Ginger.Current.ErrorMessage";
368
- function De({ playLabel: e = "Play", pauseLabel: r = "Pause", type: t = "button", ...n }) {
369
- const { state: i, togglePlayPause: u } = g();
370
- return /* @__PURE__ */ l("button", { type: t, "aria-label": i.isPaused ? "Play" : "Pause", onClick: u, ...n, children: i.isPaused ? e : r });
371
- }
372
- De.displayName = "Ginger.Control.PlayPause";
373
- const ce = {
374
- off: "Repeat off",
375
- all: "Repeat all",
376
- one: "Repeat one"
377
- };
378
- function we({ type: e = "button", ...r }) {
379
- const { state: t, cycleRepeat: n } = g();
380
- return /* @__PURE__ */ l("button", { type: e, "aria-label": ce[t.repeatMode], onClick: n, ...r, children: ce[t.repeatMode] });
381
- }
382
- we.displayName = "Ginger.Control.Repeat";
383
- function Ue({ type: e = "button", children: r = "Next", ...t }) {
384
- const { next: n } = g();
385
- return /* @__PURE__ */ l("button", { type: e, "aria-label": "Next track", onClick: n, ...t, children: r });
386
- }
387
- Ue.displayName = "Ginger.Control.Next";
388
- function Le({ type: e = "button", children: r = "Previous", ...t }) {
389
- const { prev: n } = g();
390
- return /* @__PURE__ */ l("button", { type: e, "aria-label": "Previous track", onClick: n, ...t, children: r });
391
- }
392
- Le.displayName = "Ginger.Control.Previous";
393
- function Fe({ type: e = "button", children: r = "Shuffle", ...t }) {
394
- const { state: n, toggleShuffle: i } = g();
395
- return /* @__PURE__ */ l("button", { type: e, "aria-pressed": n.isShuffled, "aria-label": "Shuffle", onClick: i, ...t, children: r });
396
- }
397
- Fe.displayName = "Ginger.Control.Shuffle";
398
- function Oe({ inputStyle: e, style: r, ...t }) {
399
- const { state: n, seek: i } = g(), u = Number.isFinite(n.duration) && n.duration > 0 ? n.duration : 0, a = u > 0 ? n.currentTime : 0;
400
- return /* @__PURE__ */ l(
401
- "input",
402
- {
403
- type: "range",
404
- min: 0,
405
- max: u > 0 ? u : 1,
406
- step: "any",
407
- value: Number.isFinite(a) ? a : 0,
408
- "aria-label": "Seek",
409
- onChange: (s) => i(Number(s.currentTarget.value)),
410
- style: { width: "100%", ...r, ...e },
411
- ...t
412
- }
413
- );
414
- }
415
- Oe.displayName = "Ginger.Control.SeekBar";
416
- function $e({ inputStyle: e, style: r, ...t }) {
417
- const { state: n, setVolume: i } = g();
418
- return /* @__PURE__ */ l(
419
- "input",
420
- {
421
- type: "range",
422
- min: 0,
423
- max: 1,
424
- step: "any",
425
- value: n.volume,
426
- "aria-label": "Volume",
427
- onChange: (u) => i(Number(u.currentTarget.value)),
428
- style: { width: "100%", ...r, ...e },
429
- ...t
430
- }
431
- );
432
- }
433
- $e.displayName = "Ginger.Control.Volume";
434
- function Ye({
435
- muteLabel: e = "Mute",
436
- unmuteLabel: r = "Unmute",
437
- type: t = "button",
438
- ...n
439
- }) {
440
- const { state: i, toggleMute: u } = g();
441
- return /* @__PURE__ */ l(
442
- "button",
443
- {
444
- type: t,
445
- "aria-pressed": i.muted,
446
- "aria-label": i.muted ? "Unmute" : "Mute",
447
- onClick: u,
448
- ...n,
449
- children: i.muted ? r : e
450
- }
451
- );
452
- }
453
- Ye.displayName = "Ginger.Control.Mute";
454
- const yr = [0.5, 0.75, 1, 1.25, 1.5, 2];
455
- function Be({ rates: e = yr, style: r, ...t }) {
456
- const { state: n, setPlaybackRate: i } = g(), u = L(
457
- () => Array.from(/* @__PURE__ */ new Set([...e, n.playbackRate])).sort((a, s) => a - s),
458
- [e, n.playbackRate]
459
- );
460
- return /* @__PURE__ */ l(
461
- "select",
462
- {
463
- "aria-label": "Playback speed",
464
- value: String(n.playbackRate),
465
- style: r,
466
- onChange: (a) => i(Number(a.currentTarget.value)),
467
- ...t,
468
- children: u.map((a) => /* @__PURE__ */ l("option", { value: String(a), children: a === 1 ? "1× normal" : `${a}×` }, a))
469
- }
470
- );
471
- }
472
- Be.displayName = "Ginger.Control.PlaybackRate";
473
- const O = pe(null);
474
- function mr() {
475
- const e = fe(O);
476
- if (!e)
477
- throw new Error("Ginger.Playlist.Track must be used inside <Ginger.Playlist>");
478
- return e;
479
- }
480
- function Ve({
481
- children: e,
482
- rowStyle: r,
483
- renderTrack: t,
484
- playOnSelect: n = !0,
485
- style: i,
486
- ...u
487
- }) {
488
- const { state: a, playTrackAt: s, selectTrackAt: c } = g(), d = {
489
- listStyle: "none",
490
- margin: 0,
491
- padding: 0,
492
- fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
493
- fontSize: "var(--ginger-font-size, 14px)",
494
- color: "var(--ginger-primary-color, #111827)",
495
- ...i
496
- };
497
- return e !== void 0 ? /* @__PURE__ */ l(O.Provider, { value: { playOnSelect: n }, children: /* @__PURE__ */ l("ul", { style: d, ...u, children: e }) }) : /* @__PURE__ */ l(O.Provider, { value: { playOnSelect: n }, children: /* @__PURE__ */ l("ul", { style: d, ...u, children: a.tracks.map((y, o) => {
498
- const m = o === a.currentIndex;
499
- return /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(
500
- "button",
501
- {
502
- type: "button",
503
- onClick: () => {
504
- n ? s(o) : c(o);
505
- },
506
- style: {
507
- width: "100%",
508
- textAlign: "left",
509
- border: "none",
510
- background: m ? "rgba(17, 24, 39, 0.06)" : "transparent",
511
- color: "inherit",
512
- font: "inherit",
513
- cursor: "pointer",
514
- padding: "var(--ginger-playlist-row-padding, 6px 8px)",
515
- ...r
516
- },
517
- children: t ? t(y, o, m) : /* @__PURE__ */ de("span", { children: [
518
- y.title,
519
- y.artist ? ` — ${y.artist}` : ""
520
- ] })
521
- }
522
- ) }, `${y.fileUrl}-${o}`);
523
- }) }) });
524
- }
525
- Ve.displayName = "Ginger.Playlist";
526
- function Qe({
527
- index: e,
528
- className: r,
529
- style: t,
530
- children: n,
531
- liProps: i,
532
- onClick: u,
533
- ...a
534
- }) {
535
- const { playOnSelect: s } = mr(), { state: c, playTrackAt: d, selectTrackAt: f } = g(), y = e === c.currentIndex, o = c.tracks[e], m = o != null ? /* @__PURE__ */ de("span", { children: [
536
- o.title,
537
- o.artist ? ` — ${o.artist}` : ""
538
- ] }) : null;
539
- return /* @__PURE__ */ l("li", { ...i, children: /* @__PURE__ */ l(
540
- "button",
541
- {
542
- type: "button",
543
- "aria-current": y ? "true" : void 0,
544
- "data-ginger-active": y || void 0,
545
- className: r,
546
- style: {
547
- width: "100%",
548
- textAlign: "left",
549
- border: "none",
550
- background: y ? "rgba(17, 24, 39, 0.06)" : "transparent",
551
- color: "inherit",
552
- font: "inherit",
553
- cursor: "pointer",
554
- padding: "var(--ginger-playlist-row-padding, 6px 8px)",
555
- ...t
556
- },
557
- ...a,
558
- onClick: (T) => {
559
- u == null || u(T), !T.defaultPrevented && (s ? d(e) : f(e));
560
- },
561
- children: n ?? m
562
- }
563
- ) });
564
- }
565
- Qe.displayName = "Ginger.Playlist.Track";
566
- const hr = Object.assign(Ve, {
567
- Track: Qe
568
- }), br = v("Ginger.Queue.Title", (e) => {
569
- var r;
570
- return (r = e.playlistMeta) == null ? void 0 : r.title;
571
- }), Pr = v("Ginger.Queue.Subtitle", (e) => {
572
- var r;
573
- return (r = e.playlistMeta) == null ? void 0 : r.subtitle;
574
- }), Tr = v("Ginger.Queue.Description", (e) => {
575
- var r;
576
- return (r = e.playlistMeta) == null ? void 0 : r.description;
577
- }), kr = v("Ginger.Queue.Copyright", (e) => {
578
- var r;
579
- return (r = e.playlistMeta) == null ? void 0 : r.copyright;
580
- });
581
- function je({ className: e, style: r, fallback: t, empty: n, imgStyle: i }) {
582
- var c, d;
583
- const { state: u } = g(), a = (c = u.playlistMeta) == null ? void 0 : c.artworkUrl;
584
- if (!a) {
585
- const f = n ?? t ?? null;
586
- return f ? /* @__PURE__ */ l("span", { className: e, style: r, children: f }) : null;
587
- }
588
- const s = ((d = u.playlistMeta) == null ? void 0 : d.title) ?? "Playlist artwork";
589
- return /* @__PURE__ */ l(
590
- "span",
591
- {
592
- className: e,
593
- style: {
594
- display: "inline-block",
595
- background: "var(--ginger-artwork-bg, #f3f4f6)",
596
- borderRadius: "var(--ginger-artwork-radius, 6px)",
597
- overflow: "hidden",
598
- ...r
599
- },
600
- children: /* @__PURE__ */ l(
601
- "img",
602
- {
603
- src: a,
604
- alt: s,
605
- style: {
606
- display: "block",
607
- width: "100%",
608
- height: "100%",
609
- objectFit: "cover",
610
- ...i
611
- }
612
- }
613
- )
614
- }
615
- );
616
- }
617
- je.displayName = "Ginger.Queue.Artwork";
618
- function F(e) {
619
- return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 1;
620
- }
621
- function B(e) {
622
- return Number.isFinite(e) ? Math.min(4, Math.max(0.25, e)) : 1;
623
- }
624
- const G = {
625
- currentTime: 0,
626
- duration: 0,
627
- bufferedFraction: 0,
628
- isBuffering: !1,
629
- errorMessage: null
630
- }, Mr = {
631
- ...G,
632
- volume: 1,
633
- muted: !1,
634
- playbackRate: 1
635
- };
636
- function Xe(e) {
637
- const r = [...e.tracks];
638
- let t = R(e.currentIndex ?? 0, r.length), n = null, i = r;
639
- return e.isShuffled && r.length > 1 && (n = [...r], i = ye(r, t), t = 0), {
640
- tracks: i,
641
- currentIndex: t,
642
- isPaused: e.isPaused ?? !0,
643
- isShuffled: !!(e.isShuffled && i.length > 1),
644
- repeatMode: e.repeatMode ?? "off",
645
- originalTracks: n,
646
- playlistMeta: e.playlistMeta ?? null,
647
- ...Mr,
648
- volume: F(e.volume ?? 1),
649
- muted: e.muted ?? !1,
650
- playbackRate: B(e.playbackRate ?? 1)
651
- };
652
- }
653
- function Er(e, r) {
654
- switch (r.type) {
655
- case "INIT": {
656
- const {
657
- tracks: t,
658
- currentIndex: n,
659
- playlistMeta: i,
660
- isPaused: u,
661
- isShuffled: a,
662
- repeatMode: s,
663
- volume: c,
664
- muted: d,
665
- playbackRate: f
666
- } = r.payload;
667
- return Xe({
668
- tracks: t,
669
- currentIndex: n,
670
- playlistMeta: i ?? null,
671
- isPaused: u ?? !0,
672
- isShuffled: a ?? !1,
673
- repeatMode: s ?? "off",
674
- volume: c,
675
- muted: d,
676
- playbackRate: f
677
- });
678
- }
679
- case "SET_QUEUE": {
680
- const { tracks: t, currentIndex: n } = r.payload, i = [...t], u = R(n ?? e.currentIndex, i.length);
681
- return {
682
- ...e,
683
- tracks: i,
684
- currentIndex: u,
685
- isShuffled: !1,
686
- originalTracks: null,
687
- ...G
688
- };
689
- }
690
- case "SET_INDEX": {
691
- const t = R(r.payload.index, e.tracks.length), n = r.payload.autoPlay, i = n === !0 ? !1 : n === !1 ? !0 : e.isPaused;
692
- return {
693
- ...e,
694
- currentIndex: t,
695
- ...G,
696
- isPaused: i
697
- };
698
- }
699
- case "PLAY":
700
- return { ...e, isPaused: !1 };
701
- case "PAUSE":
702
- return { ...e, isPaused: !0 };
703
- case "TOGGLE_PAUSE":
704
- return { ...e, isPaused: !e.isPaused };
705
- case "SET_REPEAT":
706
- return { ...e, repeatMode: r.payload };
707
- case "CYCLE_REPEAT":
708
- return { ...e, repeatMode: tr(e.repeatMode) };
709
- case "TOGGLE_SHUFFLE": {
710
- if (e.tracks.length <= 1) return { ...e, isShuffled: !1, originalTracks: null };
711
- if (!e.isShuffled) {
712
- const u = [...e.tracks], a = ye(u, e.currentIndex);
713
- return {
714
- ...e,
715
- isShuffled: !0,
716
- originalTracks: u,
717
- tracks: a,
718
- currentIndex: 0
719
- };
720
- }
721
- const t = e.originalTracks ? [...e.originalTracks] : [...e.tracks], n = e.tracks[e.currentIndex], i = Je(t, n);
722
- return {
723
- ...e,
724
- isShuffled: !1,
725
- originalTracks: null,
726
- tracks: t,
727
- currentIndex: R(i, t.length)
728
- };
729
- }
730
- case "NEXT": {
731
- const t = er(e), n = t === e.currentIndex;
732
- return {
733
- ...e,
734
- currentIndex: t,
735
- ...n ? {} : G,
736
- isPaused: n ? e.isPaused : !1
737
- };
738
- }
739
- case "PREV": {
740
- const t = rr(e), n = t === e.currentIndex;
741
- return {
742
- ...e,
743
- currentIndex: t,
744
- ...n ? {} : G,
745
- isPaused: n ? e.isPaused : !1
746
- };
747
- }
748
- case "MEDIA_TIME_UPDATE":
749
- return {
750
- ...e,
751
- currentTime: r.payload.currentTime,
752
- duration: Number.isFinite(r.payload.duration) ? r.payload.duration : e.duration,
753
- bufferedFraction: r.payload.bufferedFraction,
754
- isBuffering: !1
755
- };
756
- case "MEDIA_LOADED_METADATA":
757
- return {
758
- ...e,
759
- duration: Number.isFinite(r.payload.duration) ? r.payload.duration : e.duration,
760
- bufferedFraction: r.payload.bufferedFraction,
761
- errorMessage: null
762
- };
763
- case "SET_PLAYLIST_META":
764
- return { ...e, playlistMeta: r.payload };
765
- case "MEDIA_ERROR":
766
- return {
767
- ...e,
768
- errorMessage: r.payload.message,
769
- isPaused: !0,
770
- isBuffering: !1
771
- };
772
- case "MEDIA_WAITING":
773
- return { ...e, isBuffering: !0 };
774
- case "MEDIA_CANPLAY":
775
- return { ...e, isBuffering: !1, errorMessage: null };
776
- case "MEDIA_PLAY":
777
- return { ...e, isPaused: !1, isBuffering: !1 };
778
- case "MEDIA_PAUSE":
779
- return { ...e, isPaused: !0 };
780
- case "RESET_MEDIA_TIMES":
781
- return { ...e, currentTime: 0, duration: 0, bufferedFraction: 0 };
782
- case "SET_VOLUME":
783
- return { ...e, volume: F(r.payload) };
784
- case "SET_MUTED":
785
- return { ...e, muted: r.payload };
786
- case "TOGGLE_MUTE":
787
- return { ...e, muted: !e.muted };
788
- case "SET_PLAYBACK_RATE":
789
- return { ...e, playbackRate: B(r.payload) };
790
- case "MEDIA_VOLUME_SYNC": {
791
- const { volume: t, muted: n } = r.payload, i = F(t);
792
- return i === e.volume && n === e.muted ? e : { ...e, volume: i, muted: n };
793
- }
794
- default:
795
- return e;
796
- }
797
- }
798
- const Ar = {
799
- "--ginger-primary-color": "#111827",
800
- "--ginger-muted-color": "#6b7280",
801
- "--ginger-font-size": "14px",
802
- "--ginger-font-family": "system-ui, sans-serif",
803
- "--ginger-playlist-row-padding": "6px 8px",
804
- "--ginger-artwork-radius": "6px",
805
- "--ginger-artwork-bg": "#f3f4f6"
806
- };
807
- function xr({
808
- children: e,
809
- initialTracks: r = [],
810
- initialIndex: t = 0,
811
- initialPlaylistMeta: n = null,
812
- initialShuffle: i = !1,
813
- initialRepeatMode: u = "off",
814
- initialPaused: a = !0,
815
- initialVolume: s = 1,
816
- initialMuted: c = !1,
817
- initialPlaybackRate: d = 1,
818
- className: f,
819
- style: y,
820
- onTrackChange: o,
821
- onPlay: m,
822
- onPause: T,
823
- onQueueEnd: k,
824
- onError: M
825
- }) {
826
- var le;
827
- const S = U(null), [h, b] = He(
828
- Er,
829
- void 0,
830
- () => Xe({
831
- tracks: r,
832
- currentIndex: t,
833
- playlistMeta: n,
834
- isPaused: a,
835
- isShuffled: i,
836
- repeatMode: u,
837
- volume: s,
838
- muted: c,
839
- playbackRate: d
840
- })
841
- ), V = U(h);
842
- x(() => {
843
- V.current = h;
844
- }, [h]);
845
- const Q = h.tracks[h.currentIndex] ?? null;
846
- x(() => {
847
- o == null || o(Q, h.currentIndex);
848
- }, [Q, h.currentIndex, o]), x(() => {
849
- h.errorMessage && (M == null || M(h.errorMessage));
850
- }, [h.errorMessage, M]);
851
- const _ = U(void 0);
852
- x(() => {
853
- if (_.current === void 0) {
854
- _.current = h.isPaused;
855
- return;
856
- }
857
- _.current !== h.isPaused && (h.isPaused ? T == null || T() : m == null || m()), _.current = h.isPaused;
858
- }, [h.isPaused, T, m]);
859
- const N = P(() => {
860
- b({ type: "PLAY" });
861
- }, []), D = P(() => {
862
- var p;
863
- b({ type: "PAUSE" }), (p = S.current) == null || p.pause();
864
- }, []), j = P(() => {
865
- h.isPaused ? N() : D();
866
- }, [D, N, h.isPaused]), X = P((p) => {
867
- const E = S.current;
868
- E && Number.isFinite(p) && (E.currentTime = Math.max(0, p));
869
- }, []), W = P((p) => {
870
- b({ type: "SET_VOLUME", payload: F(p) });
871
- }, []), K = P((p) => {
872
- b({ type: "SET_MUTED", payload: p });
873
- }, []), z = P(() => {
874
- b({ type: "TOGGLE_MUTE" });
875
- }, []), H = P((p) => {
876
- b({ type: "SET_PLAYBACK_RATE", payload: B(p) });
877
- }, []), q = P(() => {
878
- b({ type: "NEXT" });
879
- }, []), J = P(() => {
880
- b({ type: "PREV" });
881
- }, []), Z = P((p) => {
882
- b({ type: "SET_REPEAT", payload: p });
883
- }, []), ee = P(() => {
884
- b({ type: "CYCLE_REPEAT" });
885
- }, []), re = P(() => {
886
- b({ type: "TOGGLE_SHUFFLE" });
887
- }, []), te = P((p, E) => {
888
- b({ type: "SET_QUEUE", payload: { tracks: p, currentIndex: E } });
889
- }, []), ne = P((p) => {
890
- b({ type: "SET_INDEX", payload: { index: p, autoPlay: !0 } });
891
- }, []), ie = P((p) => {
892
- b({ type: "SET_INDEX", payload: { index: p, autoPlay: !1 } });
893
- }, []), ue = P((p) => {
894
- b({ type: "SET_PLAYLIST_META", payload: p });
895
- }, []), We = (le = h.tracks[h.currentIndex]) == null ? void 0 : le.fileUrl;
896
- x(() => {
897
- const p = S.current;
898
- p && (h.isPaused ? p.pause() : p.play().catch((E) => {
899
- b({ type: "PAUSE" });
900
- const w = E instanceof Error ? E.message : "Playback failed";
901
- M == null || M(w);
902
- }));
903
- }, [h.isPaused, We, M]);
904
- const ae = P(() => {
905
- const p = Ze(V.current);
906
- if (p.kind === "replay_same") {
907
- const w = S.current;
908
- w && (w.currentTime = 0), b({ type: "PLAY" });
909
- return;
910
- }
911
- if (p.kind === "stop") {
912
- b({ type: "PAUSE" }), k == null || k();
913
- return;
914
- }
915
- const E = p.nextIndex;
916
- b({ type: "SET_INDEX", payload: { index: E, autoPlay: !0 } });
917
- }, [k]), Ke = L(
918
- () => ({
919
- state: h,
920
- dispatch: b,
921
- audioRef: S,
922
- notifyEnded: ae,
923
- play: N,
924
- pause: D,
925
- togglePlayPause: j,
926
- seek: X,
927
- setVolume: W,
928
- setMuted: K,
929
- toggleMute: z,
930
- setPlaybackRate: H,
931
- next: q,
932
- prev: J,
933
- setRepeatMode: Z,
934
- cycleRepeat: ee,
935
- toggleShuffle: re,
936
- setQueue: te,
937
- playTrackAt: ne,
938
- selectTrackAt: ie,
939
- setPlaylistMeta: ue
940
- }),
941
- [
942
- ee,
943
- b,
944
- q,
945
- ae,
946
- D,
947
- N,
948
- ne,
949
- ie,
950
- J,
951
- X,
952
- K,
953
- H,
954
- te,
955
- Z,
956
- ue,
957
- W,
958
- h,
959
- z,
960
- j,
961
- re
962
- ]
963
- ), ze = L(() => ({ ...Ar, ...y }), [y]);
964
- return /* @__PURE__ */ l(ge.Provider, { value: Ke, children: /* @__PURE__ */ l("div", { className: f, style: ze, children: e }) });
965
- }
966
- const Rr = {
967
- Provider: xr,
968
- Player: qe,
969
- Current: {
970
- Title: ur,
971
- Artist: ar,
972
- Album: lr,
973
- Description: or,
974
- Copyright: sr,
975
- Genre: cr,
976
- Label: dr,
977
- Isrc: fr,
978
- TrackNumber: pr,
979
- Year: Te,
980
- Lyrics: ke,
981
- FileUrl: Me,
982
- Artwork: Ee,
983
- QueueIndex: Ae,
984
- QueueLength: xe,
985
- QueuePosition: ve,
986
- Elapsed: Ie,
987
- Duration: Re,
988
- Remaining: Se,
989
- Progress: Ge,
990
- TimeRail: Ce,
991
- PlaybackState: _e,
992
- ErrorMessage: Ne
993
- },
994
- Queue: {
995
- Title: br,
996
- Subtitle: Pr,
997
- Description: Tr,
998
- Copyright: kr,
999
- Artwork: je
1000
- },
1001
- Control: {
1002
- PlayPause: De,
1003
- Repeat: we,
1004
- Next: Ue,
1005
- Previous: Le,
1006
- Shuffle: Fe,
1007
- SeekBar: Oe,
1008
- Volume: $e,
1009
- Mute: Ye,
1010
- PlaybackRate: Be
1011
- },
1012
- Playlist: hr
1013
- };
1014
- function Sr() {
1015
- const e = g(), { state: r } = e;
1016
- return L(
1017
- () => ({
1018
- state: r,
1019
- currentTrack: A(r),
1020
- playbackUi: me(r),
1021
- duration: C(r),
1022
- remaining: he(r),
1023
- progress: $(r),
1024
- artworkUrl: be(r),
1025
- albumLine: Pe(r),
1026
- play: e.play,
1027
- pause: e.pause,
1028
- togglePlayPause: e.togglePlayPause,
1029
- seek: e.seek,
1030
- setVolume: e.setVolume,
1031
- setMuted: e.setMuted,
1032
- toggleMute: e.toggleMute,
1033
- setPlaybackRate: e.setPlaybackRate,
1034
- next: e.next,
1035
- prev: e.prev,
1036
- setRepeatMode: e.setRepeatMode,
1037
- cycleRepeat: e.cycleRepeat,
1038
- toggleShuffle: e.toggleShuffle,
1039
- setQueue: e.setQueue,
1040
- playTrackAt: e.playTrackAt,
1041
- selectTrackAt: e.selectTrackAt,
1042
- setPlaylistMeta: e.setPlaylistMeta,
1043
- audioRef: e.audioRef,
1044
- dispatch: e.dispatch
1045
- }),
1046
- [
1047
- e.audioRef,
1048
- e.cycleRepeat,
1049
- e.dispatch,
1050
- e.next,
1051
- e.pause,
1052
- e.play,
1053
- e.playTrackAt,
1054
- e.selectTrackAt,
1055
- e.prev,
1056
- e.seek,
1057
- e.setMuted,
1058
- e.setPlaybackRate,
1059
- e.setPlaylistMeta,
1060
- e.setQueue,
1061
- e.setRepeatMode,
1062
- e.setVolume,
1063
- e.toggleMute,
1064
- e.togglePlayPause,
1065
- e.toggleShuffle,
1066
- r
1067
- ]
1068
- );
1069
- }
1
+ import { G as s, c as r, a as i, d as u, b as g, u as n, e as t, f as o, g as c } from "./ginger-gb6OJ3eQ.js";
2
+ import { p as G, u as m, a as S, b as d, c as p, d as b, e as y, f } from "./useSeekDrag-DdlE-Qej.js";
3
+ import { g as x, a as L, u as P, b as B, c as C } from "./GingerSplitContexts-4YZ-OJ9V.js";
1070
4
  export {
1071
- Rr as Ginger,
1072
- Sr as useGinger
5
+ s as Ginger,
6
+ r as clampPlaybackRate,
7
+ i as clampVolume,
8
+ u as defaultGingerLocale,
9
+ g as derivePlaybackUiState,
10
+ x as gingerStateFromContextValues,
11
+ L as gingerStateFromContexts,
12
+ G as parseLrc,
13
+ m as useGinger,
14
+ S as useGingerChapters,
15
+ d as useGingerDebugLog,
16
+ p as useGingerKeyboardShortcuts,
17
+ n as useGingerLocale,
18
+ b as useGingerLyricsSync,
19
+ P as useGingerMedia,
20
+ B as useGingerPlayback,
21
+ y as useGingerSleepTimer,
22
+ C as useGingerState,
23
+ t as usePlayPauseBinding,
24
+ o as useSeekBarBinding,
25
+ f as useSeekDrag,
26
+ c as useVolumeSlider
1073
27
  };
1074
28
  //# sourceMappingURL=index.js.map