@lucaismyname/ginger 0.0.40 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.js +2 -2
- package/dist/context/GingerProvider.d.ts.map +1 -1
- package/dist/{ginger-Ca8910_n.js → ginger-CgHqHrrG.js} +309 -304
- package/dist/{ginger-Ca8910_n.js.map → ginger-CgHqHrrG.js.map} +1 -1
- package/dist/{ginger-DrD8F4HX.cjs → ginger-DFdZGaMi.cjs} +2 -2
- package/dist/{ginger-DrD8F4HX.cjs.map → ginger-DFdZGaMi.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/{useGingerChapterProgress-TeWWJ8Fd.cjs → useGingerChapterProgress-COLWYX2-.cjs} +2 -2
- package/dist/{useGingerChapterProgress-TeWWJ8Fd.cjs.map → useGingerChapterProgress-COLWYX2-.cjs.map} +1 -1
- package/dist/{useGingerChapterProgress-Dbwiwnko.js → useGingerChapterProgress-Jj_zfnds.js} +2 -2
- package/dist/{useGingerChapterProgress-Dbwiwnko.js.map → useGingerChapterProgress-Jj_zfnds.js.map} +1 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -18
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as c, jsxs as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { b as D, u as X, g as
|
|
4
|
-
import { b as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as c, jsxs as w, Fragment as ir } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as $e, createContext as He, useRef as L, useState as on, useEffect as I, useMemo as A, useReducer as cn, useCallback as E, Children as sn, isValidElement as un, cloneElement as ln } from "react";
|
|
3
|
+
import { b as D, u as X, g as or, c as P, G as dn, d as pn } from "./GingerSplitContexts-BzBExb95.js";
|
|
4
|
+
import { b as Ye, g as K, r as gn, a as fn, p as cr, e as mn, d as sr, t as Be, f as yn, c as hn, s as ur, h as Ue, i as H, j as vn, k as Ze, m as kn, l as er, n as rr, o as bn, q as nr } from "./selectors-BalBCc7X.js";
|
|
5
|
+
const lr = He(null);
|
|
6
6
|
function Tn() {
|
|
7
|
-
const e =
|
|
7
|
+
const e = $e(lr);
|
|
8
8
|
if (!e) throw new Error("Ginger components must be used within <Ginger.Provider>");
|
|
9
9
|
return e;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function tr(e) {
|
|
12
12
|
const { buffered: r, duration: t } = e;
|
|
13
13
|
return !(t > 0) || r.length === 0 ? 0 : Math.min(1, r.end(r.length - 1) / t);
|
|
14
14
|
}
|
|
@@ -24,8 +24,8 @@ function xn({
|
|
|
24
24
|
currentTime: -1,
|
|
25
25
|
duration: -1,
|
|
26
26
|
bufferedFraction: -1
|
|
27
|
-
}), y = L(""), [k, g] =
|
|
28
|
-
|
|
27
|
+
}), y = L(""), [k, g] = on(!1);
|
|
28
|
+
I(() => {
|
|
29
29
|
if (!n || typeof window > "u") return;
|
|
30
30
|
const f = window.matchMedia("(prefers-reduced-motion: reduce)"), M = () => g(f.matches);
|
|
31
31
|
return M(), f.addEventListener("change", M), () => f.removeEventListener("change", M);
|
|
@@ -34,17 +34,17 @@ function xn({
|
|
|
34
34
|
const S = {
|
|
35
35
|
currentTime: f.currentTime,
|
|
36
36
|
duration: f.duration,
|
|
37
|
-
bufferedFraction:
|
|
38
|
-
},
|
|
37
|
+
bufferedFraction: tr(f)
|
|
38
|
+
}, N = m.current, Z = k ? 0.5 : 0.25, ee = Math.abs(S.currentTime - N.currentTime) >= Z || Math.abs(S.duration - N.duration) >= 0.01 || Math.abs(S.bufferedFraction - N.bufferedFraction) >= 0.01;
|
|
39
39
|
!M && !ee || (m.current = S, o({
|
|
40
40
|
type: "MEDIA_TIME_UPDATE",
|
|
41
41
|
payload: S
|
|
42
42
|
}));
|
|
43
43
|
};
|
|
44
|
-
return
|
|
44
|
+
return I(() => {
|
|
45
45
|
const f = a.current;
|
|
46
46
|
f && (f.volume = s.volume, f.muted = s.muted);
|
|
47
|
-
}, [a, s.volume, s.muted]),
|
|
47
|
+
}, [a, s.volume, s.muted]), I(() => {
|
|
48
48
|
const f = a.current;
|
|
49
49
|
if (f) {
|
|
50
50
|
if (!d) {
|
|
@@ -53,7 +53,7 @@ function xn({
|
|
|
53
53
|
}
|
|
54
54
|
f.getAttribute("src") !== d && (f.src = d, f.load(), m.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }), y.current = d;
|
|
55
55
|
}
|
|
56
|
-
}, [a, o, s.currentIndex, s.tracks, d]),
|
|
56
|
+
}, [a, o, s.currentIndex, s.tracks, d]), I(() => {
|
|
57
57
|
const f = a.current;
|
|
58
58
|
f && (f.playbackRate = s.playbackRate);
|
|
59
59
|
}, [a, s.playbackRate, d]), /* @__PURE__ */ c(
|
|
@@ -76,7 +76,7 @@ function xn({
|
|
|
76
76
|
type: "MEDIA_LOADED_METADATA",
|
|
77
77
|
payload: {
|
|
78
78
|
duration: M.duration,
|
|
79
|
-
bufferedFraction:
|
|
79
|
+
bufferedFraction: tr(M)
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
},
|
|
@@ -96,8 +96,8 @@ function xn({
|
|
|
96
96
|
});
|
|
97
97
|
},
|
|
98
98
|
onError: () => {
|
|
99
|
-
var
|
|
100
|
-
const f = a.current, M = (
|
|
99
|
+
var N;
|
|
100
|
+
const f = a.current, M = (N = f == null ? void 0 : f.error) == null ? void 0 : N.code;
|
|
101
101
|
o({ 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" } });
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -131,24 +131,24 @@ function Mn(e) {
|
|
|
131
131
|
repeat: { ...Le.repeat, ...e.repeat }
|
|
132
132
|
} : Le;
|
|
133
133
|
}
|
|
134
|
-
const
|
|
135
|
-
function
|
|
134
|
+
const dr = He(Le);
|
|
135
|
+
function En({
|
|
136
136
|
locale: e,
|
|
137
137
|
children: r
|
|
138
138
|
}) {
|
|
139
139
|
const t = Mn(e);
|
|
140
|
-
return /* @__PURE__ */ c(
|
|
140
|
+
return /* @__PURE__ */ c(dr.Provider, { value: t, children: r });
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
return
|
|
142
|
+
function G() {
|
|
143
|
+
return $e(dr);
|
|
144
144
|
}
|
|
145
145
|
function J(e) {
|
|
146
146
|
if (!Number.isFinite(e) || e < 0) return "0:00";
|
|
147
147
|
const r = Math.floor(e % 60);
|
|
148
148
|
return `${Math.floor(e / 60)}:${r.toString().padStart(2, "0")}`;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
const e = D(), r = X(), t =
|
|
150
|
+
function In() {
|
|
151
|
+
const e = D(), r = X(), t = G(), i = A(() => or(e, r), [e, r]), n = Ye(i), a = n > 0 ? i.currentTime : 0, o = Number.isFinite(a) ? a : 0, s = n > 0 ? `${J(o)} of ${J(n)}` : J(o), l = (d) => {
|
|
152
152
|
r.seek(Number(d.currentTarget.value));
|
|
153
153
|
};
|
|
154
154
|
return {
|
|
@@ -164,7 +164,7 @@ function En() {
|
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
166
|
function Pn() {
|
|
167
|
-
const e = D(), r = X(), t =
|
|
167
|
+
const e = D(), r = X(), t = G(), i = A(() => or(e, r), [e, r]), n = (a) => {
|
|
168
168
|
r.setVolume(Number(a.currentTarget.value));
|
|
169
169
|
};
|
|
170
170
|
return {
|
|
@@ -180,7 +180,7 @@ function Pn() {
|
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
182
|
function An(e) {
|
|
183
|
-
const r = D(), t =
|
|
183
|
+
const r = D(), t = G(), i = (e == null ? void 0 : e.playAriaLabel) ?? t.play, n = (e == null ? void 0 : e.pauseAriaLabel) ?? t.pause;
|
|
184
184
|
return {
|
|
185
185
|
isPaused: r.isPaused,
|
|
186
186
|
toggle: r.togglePlayPause,
|
|
@@ -222,31 +222,31 @@ function _(e) {
|
|
|
222
222
|
}
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function pr() {
|
|
226
226
|
return /* @__PURE__ */ c(_, { children: /* @__PURE__ */ c("path", { "data-ginger-component": "Pause", d: "M6 4h4v16H6zM14 4h4v16h-4z" }) });
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function gr() {
|
|
229
229
|
return /* @__PURE__ */ c(_, { children: /* @__PURE__ */ c("path", { "data-ginger-component": "Play", d: "M5 3L19 12 5 21 5 3z" }) });
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
return /* @__PURE__ */
|
|
231
|
+
function Ve() {
|
|
232
|
+
return /* @__PURE__ */ w(ir, { children: [
|
|
233
233
|
/* @__PURE__ */ c("path", { d: "m17 2 4 4-4 4" }),
|
|
234
234
|
/* @__PURE__ */ c("path", { d: "M3 11v-1a4 4 0 0 1 4-4h14" }),
|
|
235
235
|
/* @__PURE__ */ c("path", { d: "m7 22-4-4 4-4" }),
|
|
236
236
|
/* @__PURE__ */ c("path", { d: "M21 13v1a4 4 0 0 1-4 4H3" })
|
|
237
237
|
] });
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
return e === "one" ? /* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */ c(
|
|
239
|
+
function fr({ mode: e }) {
|
|
240
|
+
return e === "one" ? /* @__PURE__ */ w(_, { children: [
|
|
241
|
+
/* @__PURE__ */ c(Ve, {}),
|
|
242
242
|
/* @__PURE__ */ c("path", { "data-ginger-component": "RepeatGlyph", d: "M11 10h1v4" })
|
|
243
|
-
] }) : e === "all" ? /* @__PURE__ */ c(_, { children: /* @__PURE__ */ c(
|
|
244
|
-
/* @__PURE__ */ c(
|
|
243
|
+
] }) : e === "all" ? /* @__PURE__ */ c(_, { children: /* @__PURE__ */ c(Ve, {}) }) : /* @__PURE__ */ w(_, { children: [
|
|
244
|
+
/* @__PURE__ */ c(Ve, {}),
|
|
245
245
|
/* @__PURE__ */ c("line", { "data-ginger-component": "RepeatGlyph", x1: "3", x2: "21", y1: "3", y2: "21" })
|
|
246
246
|
] });
|
|
247
247
|
}
|
|
248
|
-
function
|
|
249
|
-
return /* @__PURE__ */
|
|
248
|
+
function mr() {
|
|
249
|
+
return /* @__PURE__ */ w(_, { children: [
|
|
250
250
|
/* @__PURE__ */ c("path", { d: "m18 14 4 4-4 4" }),
|
|
251
251
|
/* @__PURE__ */ c("path", { d: "m18 2 4 4-4 4" }),
|
|
252
252
|
/* @__PURE__ */ c(
|
|
@@ -260,8 +260,8 @@ function fr() {
|
|
|
260
260
|
/* @__PURE__ */ c("path", { d: "M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45" })
|
|
261
261
|
] });
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
return /* @__PURE__ */
|
|
263
|
+
function yr() {
|
|
264
|
+
return /* @__PURE__ */ w(_, { children: [
|
|
265
265
|
/* @__PURE__ */ c(
|
|
266
266
|
"path",
|
|
267
267
|
{
|
|
@@ -272,8 +272,8 @@ function mr() {
|
|
|
272
272
|
/* @__PURE__ */ c("path", { d: "M3 20V4" })
|
|
273
273
|
] });
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
return /* @__PURE__ */
|
|
275
|
+
function hr() {
|
|
276
|
+
return /* @__PURE__ */ w(_, { children: [
|
|
277
277
|
/* @__PURE__ */ c("path", { d: "M21 4v16" }),
|
|
278
278
|
/* @__PURE__ */ c(
|
|
279
279
|
"path",
|
|
@@ -284,8 +284,8 @@ function yr() {
|
|
|
284
284
|
)
|
|
285
285
|
] });
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
return /* @__PURE__ */
|
|
287
|
+
function vr() {
|
|
288
|
+
return /* @__PURE__ */ w(_, { children: [
|
|
289
289
|
/* @__PURE__ */ c(
|
|
290
290
|
"path",
|
|
291
291
|
{
|
|
@@ -297,8 +297,8 @@ function hr() {
|
|
|
297
297
|
/* @__PURE__ */ c("path", { d: "M19.364 18.364a9 9 0 0 0 0-12.728" })
|
|
298
298
|
] });
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
return /* @__PURE__ */
|
|
300
|
+
function kr() {
|
|
301
|
+
return /* @__PURE__ */ w(_, { children: [
|
|
302
302
|
/* @__PURE__ */ c(
|
|
303
303
|
"path",
|
|
304
304
|
{
|
|
@@ -310,7 +310,7 @@ function vr() {
|
|
|
310
310
|
/* @__PURE__ */ c("line", { x1: "16", x2: "22", y1: "9", y2: "15" })
|
|
311
311
|
] });
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function br({
|
|
314
314
|
playLabel: e = "Play",
|
|
315
315
|
pauseLabel: r = "Pause",
|
|
316
316
|
playAriaLabel: t,
|
|
@@ -320,7 +320,7 @@ function kr({
|
|
|
320
320
|
onClick: o,
|
|
321
321
|
...s
|
|
322
322
|
}) {
|
|
323
|
-
const l =
|
|
323
|
+
const l = G(), d = typeof e == "string" ? e : l.play, m = typeof r == "string" ? r : l.pause, y = An({
|
|
324
324
|
playAriaLabel: t ?? d,
|
|
325
325
|
pauseAriaLabel: i ?? m
|
|
326
326
|
});
|
|
@@ -334,13 +334,13 @@ function kr({
|
|
|
334
334
|
onClick: (k) => {
|
|
335
335
|
y.toggle(), o == null || o(k);
|
|
336
336
|
},
|
|
337
|
-
children: n ?? (y.isPaused ? /* @__PURE__ */ c(
|
|
337
|
+
children: n ?? (y.isPaused ? /* @__PURE__ */ c(gr, {}) : /* @__PURE__ */ c(pr, {}))
|
|
338
338
|
}
|
|
339
339
|
);
|
|
340
340
|
}
|
|
341
|
-
|
|
342
|
-
function
|
|
343
|
-
const { repeatMode: a, cycleRepeat: o } = D(), l =
|
|
341
|
+
br.displayName = "Ginger.Control.PlayPause";
|
|
342
|
+
function Tr({ type: e = "button", ariaLabel: r, onClick: t, children: i, ...n }) {
|
|
343
|
+
const { repeatMode: a, cycleRepeat: o } = D(), l = G().repeat[a];
|
|
344
344
|
return /* @__PURE__ */ c(
|
|
345
345
|
"button",
|
|
346
346
|
{
|
|
@@ -351,13 +351,13 @@ function br({ type: e = "button", ariaLabel: r, onClick: t, children: i, ...n })
|
|
|
351
351
|
onClick: (d) => {
|
|
352
352
|
o(), t == null || t(d);
|
|
353
353
|
},
|
|
354
|
-
children: i ?? /* @__PURE__ */ c(
|
|
354
|
+
children: i ?? /* @__PURE__ */ c(fr, { mode: a })
|
|
355
355
|
}
|
|
356
356
|
);
|
|
357
357
|
}
|
|
358
|
-
|
|
359
|
-
function
|
|
360
|
-
const { next: a } = D(), o =
|
|
358
|
+
Tr.displayName = "Ginger.Control.Repeat";
|
|
359
|
+
function xr({ type: e = "button", children: r, ariaLabel: t, onClick: i, ...n }) {
|
|
360
|
+
const { next: a } = D(), o = G();
|
|
361
361
|
return /* @__PURE__ */ c(
|
|
362
362
|
"button",
|
|
363
363
|
{
|
|
@@ -368,19 +368,19 @@ function Tr({ type: e = "button", children: r, ariaLabel: t, onClick: i, ...n })
|
|
|
368
368
|
onClick: (s) => {
|
|
369
369
|
a(), i == null || i(s);
|
|
370
370
|
},
|
|
371
|
-
children: r ?? /* @__PURE__ */ c(
|
|
371
|
+
children: r ?? /* @__PURE__ */ c(hr, {})
|
|
372
372
|
}
|
|
373
373
|
);
|
|
374
374
|
}
|
|
375
|
-
|
|
376
|
-
function
|
|
375
|
+
xr.displayName = "Ginger.Control.Next";
|
|
376
|
+
function Mr({
|
|
377
377
|
type: e = "button",
|
|
378
378
|
children: r,
|
|
379
379
|
ariaLabel: t,
|
|
380
380
|
onClick: i,
|
|
381
381
|
...n
|
|
382
382
|
}) {
|
|
383
|
-
const { prev: a } = D(), o =
|
|
383
|
+
const { prev: a } = D(), o = G();
|
|
384
384
|
return /* @__PURE__ */ c(
|
|
385
385
|
"button",
|
|
386
386
|
{
|
|
@@ -391,13 +391,13 @@ function xr({
|
|
|
391
391
|
onClick: (s) => {
|
|
392
392
|
a(), i == null || i(s);
|
|
393
393
|
},
|
|
394
|
-
children: r ?? /* @__PURE__ */ c(
|
|
394
|
+
children: r ?? /* @__PURE__ */ c(yr, {})
|
|
395
395
|
}
|
|
396
396
|
);
|
|
397
397
|
}
|
|
398
|
-
|
|
399
|
-
function
|
|
400
|
-
const { isShuffled: a, toggleShuffle: o } = D(), s =
|
|
398
|
+
Mr.displayName = "Ginger.Control.Previous";
|
|
399
|
+
function Er({ type: e = "button", children: r, ariaLabel: t, onClick: i, ...n }) {
|
|
400
|
+
const { isShuffled: a, toggleShuffle: o } = D(), s = G();
|
|
401
401
|
return /* @__PURE__ */ c(
|
|
402
402
|
"button",
|
|
403
403
|
{
|
|
@@ -409,13 +409,13 @@ function Mr({ type: e = "button", children: r, ariaLabel: t, onClick: i, ...n })
|
|
|
409
409
|
onClick: (l) => {
|
|
410
410
|
o(), i == null || i(l);
|
|
411
411
|
},
|
|
412
|
-
children: r ?? /* @__PURE__ */ c(
|
|
412
|
+
children: r ?? /* @__PURE__ */ c(mr, {})
|
|
413
413
|
}
|
|
414
414
|
);
|
|
415
415
|
}
|
|
416
|
-
|
|
416
|
+
Er.displayName = "Ginger.Control.Shuffle";
|
|
417
417
|
function Ir({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: i, ...n }) {
|
|
418
|
-
const a =
|
|
418
|
+
const a = In(), o = t ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
419
419
|
return /* @__PURE__ */ c(
|
|
420
420
|
"input",
|
|
421
421
|
{
|
|
@@ -435,7 +435,7 @@ function Ir({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: i, ...n }) {
|
|
|
435
435
|
);
|
|
436
436
|
}
|
|
437
437
|
Ir.displayName = "Ginger.Control.SeekBar";
|
|
438
|
-
function
|
|
438
|
+
function Pr({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: i, ...n }) {
|
|
439
439
|
const a = Pn(), o = t ? { ...r, ...e } : { width: "100%", ...r, ...e };
|
|
440
440
|
return /* @__PURE__ */ c(
|
|
441
441
|
"input",
|
|
@@ -455,8 +455,8 @@ function Er({ inputStyle: e, style: r, unstyled: t = !1, ariaLabel: i, ...n }) {
|
|
|
455
455
|
}
|
|
456
456
|
);
|
|
457
457
|
}
|
|
458
|
-
|
|
459
|
-
function
|
|
458
|
+
Pr.displayName = "Ginger.Control.Volume";
|
|
459
|
+
function Ar({
|
|
460
460
|
ariaLabel: e,
|
|
461
461
|
muteLabel: r,
|
|
462
462
|
unmuteLabel: t,
|
|
@@ -465,7 +465,7 @@ function Pr({
|
|
|
465
465
|
children: a,
|
|
466
466
|
...o
|
|
467
467
|
}) {
|
|
468
|
-
const { muted: s, toggleMute: l } = X(), d =
|
|
468
|
+
const { muted: s, toggleMute: l } = X(), d = G();
|
|
469
469
|
return /* @__PURE__ */ c(
|
|
470
470
|
"button",
|
|
471
471
|
{
|
|
@@ -477,20 +477,20 @@ function Pr({
|
|
|
477
477
|
onClick: (m) => {
|
|
478
478
|
l(), n == null || n(m);
|
|
479
479
|
},
|
|
480
|
-
children: a ?? (s ? t ?? /* @__PURE__ */ c(
|
|
480
|
+
children: a ?? (s ? t ?? /* @__PURE__ */ c(kr, {}) : r ?? /* @__PURE__ */ c(vr, {}))
|
|
481
481
|
}
|
|
482
482
|
);
|
|
483
483
|
}
|
|
484
|
-
|
|
484
|
+
Ar.displayName = "Ginger.Control.Mute";
|
|
485
485
|
const Sn = [0.5, 0.75, 1, 1.25, 1.5, 2];
|
|
486
|
-
function
|
|
486
|
+
function Sr({
|
|
487
487
|
rates: e = Sn,
|
|
488
488
|
style: r,
|
|
489
489
|
ariaLabel: t,
|
|
490
490
|
children: i,
|
|
491
491
|
...n
|
|
492
492
|
}) {
|
|
493
|
-
const { playbackRate: a, setPlaybackRate: o } = X(), s =
|
|
493
|
+
const { playbackRate: a, setPlaybackRate: o } = X(), s = G(), l = A(
|
|
494
494
|
() => Array.from(/* @__PURE__ */ new Set([...e, a])).sort((d, m) => d - m),
|
|
495
495
|
[e, a]
|
|
496
496
|
);
|
|
@@ -507,7 +507,7 @@ function Ar({
|
|
|
507
507
|
}
|
|
508
508
|
);
|
|
509
509
|
}
|
|
510
|
-
|
|
510
|
+
Sr.displayName = "Ginger.Control.PlaybackRate";
|
|
511
511
|
function Q(e, r) {
|
|
512
512
|
function t(i) {
|
|
513
513
|
const n = P(), o = (r(n) ?? "").trim(), { className: s, style: l, fallback: d, empty: m, children: y } = i;
|
|
@@ -522,7 +522,7 @@ function Q(e, r) {
|
|
|
522
522
|
function j(e, r) {
|
|
523
523
|
return Q(e, (t) => r(K(t)));
|
|
524
524
|
}
|
|
525
|
-
const Rn = j("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), wn = j("Ginger.Current.Artist", (e) => e == null ? void 0 : e.artist), Nn = Q("Ginger.Current.Album", (e) =>
|
|
525
|
+
const Rn = j("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), wn = j("Ginger.Current.Artist", (e) => e == null ? void 0 : e.artist), Nn = Q("Ginger.Current.Album", (e) => gn(e)), Gn = j(
|
|
526
526
|
"Ginger.Current.Description",
|
|
527
527
|
(e) => e == null ? void 0 : e.description
|
|
528
528
|
), Ln = Q("Ginger.Current.Copyright", (e) => {
|
|
@@ -533,7 +533,7 @@ const Rn = j("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), wn =
|
|
|
533
533
|
"Ginger.Current.TrackNumber",
|
|
534
534
|
(e) => (e == null ? void 0 : e.trackNumber) != null ? String(e.trackNumber) : void 0
|
|
535
535
|
);
|
|
536
|
-
function
|
|
536
|
+
function Rr({ className: e, style: r, fallback: t, empty: i, children: n, format: a }) {
|
|
537
537
|
var d;
|
|
538
538
|
const o = P(), s = (d = K(o)) == null ? void 0 : d.year;
|
|
539
539
|
if (typeof s != "number" || !Number.isFinite(s)) {
|
|
@@ -543,8 +543,8 @@ function Sr({ className: e, style: r, fallback: t, empty: i, children: n, format
|
|
|
543
543
|
const l = a ? a(s) : String(s);
|
|
544
544
|
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: n(l, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Year", className: e, style: r, children: l });
|
|
545
545
|
}
|
|
546
|
-
|
|
547
|
-
function
|
|
546
|
+
Rr.displayName = "Ginger.Current.Year";
|
|
547
|
+
function wr({
|
|
548
548
|
className: e,
|
|
549
549
|
style: r,
|
|
550
550
|
fallback: t,
|
|
@@ -562,14 +562,14 @@ function Rr({
|
|
|
562
562
|
const m = !o && a ? { whiteSpace: "pre-wrap" } : void 0;
|
|
563
563
|
return n ? /* @__PURE__ */ c("span", { className: e, style: { ...m, ...r }, children: n(d, s) }) : /* @__PURE__ */ c("span", { className: e, style: { ...m, ...r }, children: d });
|
|
564
564
|
}
|
|
565
|
-
|
|
566
|
-
const
|
|
565
|
+
wr.displayName = "Ginger.Current.Lyrics";
|
|
566
|
+
const ar = /\[(\d{1,2}):(\d{2})(?:\.(\d{1,3}))?\]/g;
|
|
567
567
|
function Un(e) {
|
|
568
568
|
const r = [];
|
|
569
569
|
for (const t of e.split(/\r?\n/)) {
|
|
570
|
-
const i = [...t.matchAll(
|
|
570
|
+
const i = [...t.matchAll(ar)];
|
|
571
571
|
if (i.length === 0) continue;
|
|
572
|
-
const n = t.replace(
|
|
572
|
+
const n = t.replace(ar, "").trim();
|
|
573
573
|
for (const a of i) {
|
|
574
574
|
const o = Number(a[1] ?? 0), s = Number(a[2] ?? 0), l = Number((a[3] ?? "0").padEnd(3, "0")), d = o * 60 + s + l / 1e3;
|
|
575
575
|
Number.isFinite(d) && d >= 0 && r.push({ time: d, text: n });
|
|
@@ -589,7 +589,7 @@ function Vn() {
|
|
|
589
589
|
activeLine: a >= 0 ? n[a] ?? null : null
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
|
-
function
|
|
592
|
+
function Nr({
|
|
593
593
|
className: e,
|
|
594
594
|
style: r,
|
|
595
595
|
fallback: t,
|
|
@@ -599,7 +599,7 @@ function wr({
|
|
|
599
599
|
lineClassName: o,
|
|
600
600
|
children: s
|
|
601
601
|
}) {
|
|
602
|
-
const l = P(), d =
|
|
602
|
+
const l = P(), d = G(), { lines: m, activeIndex: y } = Vn();
|
|
603
603
|
if (m.length === 0) {
|
|
604
604
|
const g = i ?? t ?? null;
|
|
605
605
|
return g ? /* @__PURE__ */ c("span", { "data-ginger-component": "LyricsSynced", className: e, style: r, children: g }) : null;
|
|
@@ -638,7 +638,7 @@ function wr({
|
|
|
638
638
|
}
|
|
639
639
|
);
|
|
640
640
|
}
|
|
641
|
-
|
|
641
|
+
Nr.displayName = "Ginger.Current.LyricsSynced";
|
|
642
642
|
function Bn() {
|
|
643
643
|
const { tracks: e, currentIndex: r } = D(), { currentTime: t, seek: i } = X(), n = A(() => {
|
|
644
644
|
var s;
|
|
@@ -659,7 +659,7 @@ function Bn() {
|
|
|
659
659
|
}
|
|
660
660
|
};
|
|
661
661
|
}
|
|
662
|
-
function
|
|
662
|
+
function Gr({
|
|
663
663
|
className: e,
|
|
664
664
|
style: r,
|
|
665
665
|
fallback: t,
|
|
@@ -668,7 +668,7 @@ function Nr({
|
|
|
668
668
|
formatStart: a = J,
|
|
669
669
|
children: o
|
|
670
670
|
}) {
|
|
671
|
-
const s = P(), l =
|
|
671
|
+
const s = P(), l = G(), { list: d, activeIndex: m, seekTo: y } = Bn();
|
|
672
672
|
if (d.length === 0) {
|
|
673
673
|
const g = i ?? t ?? null;
|
|
674
674
|
return g ? /* @__PURE__ */ c("span", { "data-ginger-component": "Chapters", className: e, style: r, children: g }) : null;
|
|
@@ -699,11 +699,11 @@ function Nr({
|
|
|
699
699
|
cursor: n ? void 0 : "pointer",
|
|
700
700
|
padding: n ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)"
|
|
701
701
|
},
|
|
702
|
-
children: o ? o(g, h, b, s) : n ? /* @__PURE__ */
|
|
702
|
+
children: o ? o(g, h, b, s) : n ? /* @__PURE__ */ w(ir, { children: [
|
|
703
703
|
a(g.startSeconds),
|
|
704
704
|
" ",
|
|
705
705
|
g.title
|
|
706
|
-
] }) : /* @__PURE__ */
|
|
706
|
+
] }) : /* @__PURE__ */ w("span", { children: [
|
|
707
707
|
/* @__PURE__ */ c("span", { style: { opacity: 0.75, marginRight: "0.35em" }, children: a(g.startSeconds) }),
|
|
708
708
|
g.title
|
|
709
709
|
] })
|
|
@@ -711,8 +711,8 @@ function Nr({
|
|
|
711
711
|
) }, `${g.startSeconds}-${g.title}`);
|
|
712
712
|
}) });
|
|
713
713
|
}
|
|
714
|
-
|
|
715
|
-
function
|
|
714
|
+
Gr.displayName = "Ginger.Current.Chapters";
|
|
715
|
+
function Lr({
|
|
716
716
|
visible: e = !1,
|
|
717
717
|
className: r,
|
|
718
718
|
style: t,
|
|
@@ -730,8 +730,8 @@ function Gr({
|
|
|
730
730
|
}
|
|
731
731
|
return a ? /* @__PURE__ */ c("span", { "data-ginger-component": "FileUrl", className: r, style: t, children: a(s, o) }) : /* @__PURE__ */ c("span", { className: r, style: t, children: s });
|
|
732
732
|
}
|
|
733
|
-
|
|
734
|
-
function
|
|
733
|
+
Lr.displayName = "Ginger.Current.FileUrl";
|
|
734
|
+
function _r({
|
|
735
735
|
className: e,
|
|
736
736
|
style: r,
|
|
737
737
|
fallback: t,
|
|
@@ -743,7 +743,7 @@ function Lr({
|
|
|
743
743
|
unstyled: l = !1,
|
|
744
744
|
imgStyle: d
|
|
745
745
|
}) {
|
|
746
|
-
const m = P(), y = K(m), k =
|
|
746
|
+
const m = P(), y = K(m), k = fn(m);
|
|
747
747
|
if (!k) {
|
|
748
748
|
const h = i ?? t ?? null;
|
|
749
749
|
return h ? /* @__PURE__ */ c("span", { className: e, style: r, children: h }) : null;
|
|
@@ -781,8 +781,8 @@ function Lr({
|
|
|
781
781
|
}
|
|
782
782
|
);
|
|
783
783
|
}
|
|
784
|
-
|
|
785
|
-
function
|
|
784
|
+
_r.displayName = "Ginger.Current.Artwork";
|
|
785
|
+
function Dr({
|
|
786
786
|
base: e = 0,
|
|
787
787
|
className: r,
|
|
788
788
|
style: t,
|
|
@@ -798,8 +798,8 @@ function _r({
|
|
|
798
798
|
const l = String(o.currentIndex + e);
|
|
799
799
|
return a ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: t, children: a(l, o) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueIndex", className: r, style: t, children: l });
|
|
800
800
|
}
|
|
801
|
-
|
|
802
|
-
function
|
|
801
|
+
Dr.displayName = "Ginger.Current.QueueIndex";
|
|
802
|
+
function Cr({ className: e, style: r, fallback: t, empty: i, children: n }) {
|
|
803
803
|
const a = P(), o = String(a.tracks.length);
|
|
804
804
|
if (a.tracks.length === 0) {
|
|
805
805
|
const s = i ?? t ?? null;
|
|
@@ -807,8 +807,8 @@ function Dr({ className: e, style: r, fallback: t, empty: i, children: n }) {
|
|
|
807
807
|
}
|
|
808
808
|
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: n(o, a) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueueLength", className: e, style: r, children: o });
|
|
809
809
|
}
|
|
810
|
-
|
|
811
|
-
function
|
|
810
|
+
Cr.displayName = "Ginger.Current.QueueLength";
|
|
811
|
+
function Fr({
|
|
812
812
|
base: e = 0,
|
|
813
813
|
separator: r = " / ",
|
|
814
814
|
className: t,
|
|
@@ -825,8 +825,8 @@ function Cr({
|
|
|
825
825
|
const d = String(s.currentIndex + e), m = String(l), y = `${d}${r}${m}`;
|
|
826
826
|
return o ? /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: t, style: i, children: o({ index: d, length: m, label: y }, s) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "QueuePosition", className: t, style: i, children: y });
|
|
827
827
|
}
|
|
828
|
-
|
|
829
|
-
function
|
|
828
|
+
Fr.displayName = "Ginger.Current.QueuePosition";
|
|
829
|
+
function Qe(e, r, t) {
|
|
830
830
|
const { className: i, style: n, fallback: a, empty: o, children: s, format: l = J } = t;
|
|
831
831
|
if (!(e >= 0) || !Number.isFinite(e)) {
|
|
832
832
|
const m = o ?? a ?? null;
|
|
@@ -835,39 +835,39 @@ function Ye(e, r, t) {
|
|
|
835
835
|
const d = l(e);
|
|
836
836
|
return s ? /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: i, style: n, children: s(d, r) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "TimeText", className: i, style: n, children: d });
|
|
837
837
|
}
|
|
838
|
-
function Fr(e) {
|
|
839
|
-
const r = P();
|
|
840
|
-
return Ye(r.currentTime, r, e);
|
|
841
|
-
}
|
|
842
|
-
Fr.displayName = "Ginger.Current.Elapsed";
|
|
843
838
|
function Ur(e) {
|
|
844
839
|
const r = P();
|
|
845
|
-
return
|
|
840
|
+
return Qe(r.currentTime, r, e);
|
|
846
841
|
}
|
|
847
|
-
Ur.displayName = "Ginger.Current.
|
|
842
|
+
Ur.displayName = "Ginger.Current.Elapsed";
|
|
848
843
|
function Vr(e) {
|
|
849
844
|
const r = P();
|
|
850
|
-
return Ye(
|
|
845
|
+
return Qe(Ye(r), r, e);
|
|
846
|
+
}
|
|
847
|
+
Vr.displayName = "Ginger.Current.Duration";
|
|
848
|
+
function Br(e) {
|
|
849
|
+
const r = P();
|
|
850
|
+
return Qe(mn(r), r, e);
|
|
851
851
|
}
|
|
852
|
-
|
|
853
|
-
function
|
|
854
|
-
const a = P(), o =
|
|
852
|
+
Br.displayName = "Ginger.Current.Remaining";
|
|
853
|
+
function Or({ className: e, style: r, fallback: t, empty: i, children: n }) {
|
|
854
|
+
const a = P(), o = Ye(a), s = cr(a);
|
|
855
855
|
if (!(o > 0)) {
|
|
856
856
|
const l = i ?? t ?? null;
|
|
857
857
|
return l ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: l }) : null;
|
|
858
858
|
}
|
|
859
859
|
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: n({ fraction: s, currentTime: a.currentTime, duration: o }, a) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "Progress", className: e, style: r, children: `${Math.round(s * 100)}%` });
|
|
860
860
|
}
|
|
861
|
-
|
|
862
|
-
function
|
|
861
|
+
Or.displayName = "Ginger.Current.Progress";
|
|
862
|
+
function $r({
|
|
863
863
|
className: e,
|
|
864
864
|
style: r,
|
|
865
865
|
height: t = 4,
|
|
866
866
|
showBuffered: i = !1,
|
|
867
867
|
unstyled: n = !1
|
|
868
868
|
}) {
|
|
869
|
-
const a = P(), o = `${Math.round(
|
|
870
|
-
return /* @__PURE__ */
|
|
869
|
+
const a = P(), o = `${Math.round(cr(a) * 100)}%`, s = `${Math.round(Math.min(1, Math.max(0, a.bufferedFraction)) * 100)}%`;
|
|
870
|
+
return /* @__PURE__ */ w(
|
|
871
871
|
"div",
|
|
872
872
|
{
|
|
873
873
|
"data-ginger-component": "TimeRail",
|
|
@@ -913,8 +913,8 @@ function Or({
|
|
|
913
913
|
}
|
|
914
914
|
);
|
|
915
915
|
}
|
|
916
|
-
|
|
917
|
-
function
|
|
916
|
+
$r.displayName = "Ginger.Current.TimeRail";
|
|
917
|
+
function Hr({ className: e, style: r, height: t = 4, unstyled: i = !1 }) {
|
|
918
918
|
const n = P(), a = `${Math.round(Math.min(1, Math.max(0, n.bufferedFraction)) * 100)}%`;
|
|
919
919
|
return /* @__PURE__ */ c(
|
|
920
920
|
"div",
|
|
@@ -944,13 +944,13 @@ function $r({ className: e, style: r, height: t = 4, unstyled: i = !1 }) {
|
|
|
944
944
|
}
|
|
945
945
|
);
|
|
946
946
|
}
|
|
947
|
-
|
|
948
|
-
function
|
|
949
|
-
const a = P(), o =
|
|
947
|
+
Hr.displayName = "Ginger.Current.BufferRail";
|
|
948
|
+
function Yr({ className: e, style: r, fallback: t, empty: i, children: n }) {
|
|
949
|
+
const a = P(), o = sr(a);
|
|
950
950
|
return n ? /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: n(o, a) }) : /* @__PURE__ */ c("span", { "data-ginger-component": "PlaybackState", className: e, style: r, children: o });
|
|
951
951
|
}
|
|
952
|
-
|
|
953
|
-
function
|
|
952
|
+
Yr.displayName = "Ginger.Current.PlaybackState";
|
|
953
|
+
function Qr({
|
|
954
954
|
className: e,
|
|
955
955
|
style: r,
|
|
956
956
|
fallback: t,
|
|
@@ -974,15 +974,15 @@ function Yr({
|
|
|
974
974
|
}
|
|
975
975
|
) : /* @__PURE__ */ c("span", { "data-ginger-component": "ErrorMessage", className: e, style: r, "aria-live": n, children: s });
|
|
976
976
|
}
|
|
977
|
-
|
|
978
|
-
const
|
|
977
|
+
Qr.displayName = "Ginger.Current.ErrorMessage";
|
|
978
|
+
const Oe = He(null);
|
|
979
979
|
function On() {
|
|
980
|
-
const e = Oe
|
|
980
|
+
const e = $e(Oe);
|
|
981
981
|
if (!e)
|
|
982
982
|
throw new Error("Ginger.Playlist.Track must be used inside <Ginger.Playlist>");
|
|
983
983
|
return e;
|
|
984
984
|
}
|
|
985
|
-
function
|
|
985
|
+
function jr({
|
|
986
986
|
children: e,
|
|
987
987
|
unstyled: r = !1,
|
|
988
988
|
rowStyle: t,
|
|
@@ -1000,7 +1000,7 @@ function Qr({
|
|
|
1000
1000
|
color: "var(--ginger-primary-color, #111827)",
|
|
1001
1001
|
...a
|
|
1002
1002
|
};
|
|
1003
|
-
return e !== void 0 ? /* @__PURE__ */ c(
|
|
1003
|
+
return e !== void 0 ? /* @__PURE__ */ c(Oe.Provider, { value: { playOnSelect: n }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: y, ...o, children: e }) }) : /* @__PURE__ */ c(Oe.Provider, { value: { playOnSelect: n }, children: /* @__PURE__ */ c("ul", { "data-ginger-component": "Playlist", style: y, ...o, children: s.map((g, h) => {
|
|
1004
1004
|
const b = h === l;
|
|
1005
1005
|
return /* @__PURE__ */ c("li", { children: /* @__PURE__ */ c(
|
|
1006
1006
|
"button",
|
|
@@ -1020,16 +1020,16 @@ function Qr({
|
|
|
1020
1020
|
padding: r ? void 0 : "var(--ginger-playlist-row-padding, 6px 8px)",
|
|
1021
1021
|
...t
|
|
1022
1022
|
},
|
|
1023
|
-
children: i ? i(g, h, b) : /* @__PURE__ */
|
|
1023
|
+
children: i ? i(g, h, b) : /* @__PURE__ */ w("span", { children: [
|
|
1024
1024
|
g.title,
|
|
1025
1025
|
g.artist ? ` — ${g.artist}` : ""
|
|
1026
1026
|
] })
|
|
1027
1027
|
}
|
|
1028
|
-
) }, `${h}-${
|
|
1028
|
+
) }, `${h}-${Be(g)}`);
|
|
1029
1029
|
}) }) });
|
|
1030
1030
|
}
|
|
1031
|
-
|
|
1032
|
-
function
|
|
1031
|
+
jr.displayName = "Ginger.Playlist";
|
|
1032
|
+
function zr({
|
|
1033
1033
|
index: e,
|
|
1034
1034
|
unstyled: r = !1,
|
|
1035
1035
|
className: t,
|
|
@@ -1039,7 +1039,7 @@ function jr({
|
|
|
1039
1039
|
onClick: o,
|
|
1040
1040
|
...s
|
|
1041
1041
|
}) {
|
|
1042
|
-
const { playOnSelect: l } = On(), { tracks: d, currentIndex: m, playTrackAt: y, selectTrackAt: k } = D(), g = e === m, h = d[e], b = h != null ? /* @__PURE__ */
|
|
1042
|
+
const { playOnSelect: l } = On(), { tracks: d, currentIndex: m, playTrackAt: y, selectTrackAt: k } = D(), g = e === m, h = d[e], b = h != null ? /* @__PURE__ */ w("span", { "data-ginger-component": "PlaylistTrack", children: [
|
|
1043
1043
|
h.title,
|
|
1044
1044
|
h.artist ? ` — ${h.artist}` : ""
|
|
1045
1045
|
] }) : null;
|
|
@@ -1070,9 +1070,9 @@ function jr({
|
|
|
1070
1070
|
}
|
|
1071
1071
|
) });
|
|
1072
1072
|
}
|
|
1073
|
-
|
|
1074
|
-
const $n = Object.assign(
|
|
1075
|
-
Track:
|
|
1073
|
+
zr.displayName = "Ginger.Playlist.Track";
|
|
1074
|
+
const $n = Object.assign(jr, {
|
|
1075
|
+
Track: zr
|
|
1076
1076
|
}), Hn = Q("Ginger.Queue.Title", (e) => {
|
|
1077
1077
|
var r;
|
|
1078
1078
|
return (r = e.playlistMeta) == null ? void 0 : r.title;
|
|
@@ -1092,7 +1092,7 @@ const $n = Object.assign(Qr, {
|
|
|
1092
1092
|
return (r = e.playlistMeta) == null ? void 0 : r.copyright;
|
|
1093
1093
|
}
|
|
1094
1094
|
);
|
|
1095
|
-
function
|
|
1095
|
+
function Wr({
|
|
1096
1096
|
className: e,
|
|
1097
1097
|
style: r,
|
|
1098
1098
|
fallback: t,
|
|
@@ -1136,11 +1136,11 @@ function zr({
|
|
|
1136
1136
|
}
|
|
1137
1137
|
);
|
|
1138
1138
|
}
|
|
1139
|
-
|
|
1139
|
+
Wr.displayName = "Ginger.Queue.Artwork";
|
|
1140
1140
|
function _e(e) {
|
|
1141
1141
|
return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 1;
|
|
1142
1142
|
}
|
|
1143
|
-
function
|
|
1143
|
+
function je(e) {
|
|
1144
1144
|
return Number.isFinite(e) ? Math.min(4, Math.max(0.25, e)) : 1;
|
|
1145
1145
|
}
|
|
1146
1146
|
const Y = {
|
|
@@ -1155,10 +1155,10 @@ const Y = {
|
|
|
1155
1155
|
muted: !1,
|
|
1156
1156
|
playbackRate: 1
|
|
1157
1157
|
};
|
|
1158
|
-
function
|
|
1158
|
+
function Xr(e) {
|
|
1159
1159
|
const r = [...e.tracks];
|
|
1160
1160
|
let t = H(e.currentIndex ?? 0, r.length), i = null, n = r;
|
|
1161
|
-
return e.isShuffled && r.length > 1 && (i = [...r], n =
|
|
1161
|
+
return e.isShuffled && r.length > 1 && (i = [...r], n = ur(r, t), t = 0), {
|
|
1162
1162
|
tracks: n,
|
|
1163
1163
|
currentIndex: t,
|
|
1164
1164
|
playbackMode: e.playbackMode ?? "playlist",
|
|
@@ -1170,7 +1170,7 @@ function Wr(e) {
|
|
|
1170
1170
|
...zn,
|
|
1171
1171
|
volume: _e(e.volume ?? 1),
|
|
1172
1172
|
muted: e.muted ?? !1,
|
|
1173
|
-
playbackRate:
|
|
1173
|
+
playbackRate: je(e.playbackRate ?? 1)
|
|
1174
1174
|
};
|
|
1175
1175
|
}
|
|
1176
1176
|
function Wn(e, r) {
|
|
@@ -1188,7 +1188,7 @@ function Wn(e, r) {
|
|
|
1188
1188
|
muted: m,
|
|
1189
1189
|
playbackRate: y
|
|
1190
1190
|
} = r.payload;
|
|
1191
|
-
return
|
|
1191
|
+
return Xr({
|
|
1192
1192
|
tracks: t,
|
|
1193
1193
|
currentIndex: i,
|
|
1194
1194
|
playlistMeta: n ?? null,
|
|
@@ -1236,7 +1236,7 @@ function Wn(e, r) {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
case "REMOVE_TRACK": {
|
|
1238
1238
|
const t = r.payload.index, i = er(e.tracks, t), n = t < e.currentIndex ? e.currentIndex - 1 : t === e.currentIndex ? Math.min(e.currentIndex, Math.max(0, i.length - 1)) : e.currentIndex, a = e.isShuffled && e.originalTracks ? (() => {
|
|
1239
|
-
const s = e.tracks[t], l =
|
|
1239
|
+
const s = e.tracks[t], l = Ue(e.originalTracks, s);
|
|
1240
1240
|
return er(e.originalTracks, l);
|
|
1241
1241
|
})() : e.originalTracks, o = e.isShuffled && i.length > 1;
|
|
1242
1242
|
return {
|
|
@@ -1249,7 +1249,7 @@ function Wn(e, r) {
|
|
|
1249
1249
|
};
|
|
1250
1250
|
}
|
|
1251
1251
|
case "MOVE_TRACK": {
|
|
1252
|
-
const { fromIndex: t, toIndex: i } = r.payload, n =
|
|
1252
|
+
const { fromIndex: t, toIndex: i } = r.payload, n = kn(e.tracks, t, i);
|
|
1253
1253
|
let a = e.currentIndex;
|
|
1254
1254
|
return e.currentIndex === t ? a = i : t < e.currentIndex && i >= e.currentIndex ? a -= 1 : t > e.currentIndex && i <= e.currentIndex && (a += 1), {
|
|
1255
1255
|
...e,
|
|
@@ -1261,7 +1261,7 @@ function Wn(e, r) {
|
|
|
1261
1261
|
}
|
|
1262
1262
|
case "ADD_NEXT": {
|
|
1263
1263
|
const t = Ze(e.tracks, e.currentIndex, r.payload.track), i = e.isShuffled && e.originalTracks ? (() => {
|
|
1264
|
-
const n = e.tracks[e.currentIndex], a =
|
|
1264
|
+
const n = e.tracks[e.currentIndex], a = Ue(e.originalTracks, n);
|
|
1265
1265
|
return Ze(e.originalTracks, a, r.payload.track);
|
|
1266
1266
|
})() : e.originalTracks;
|
|
1267
1267
|
return {
|
|
@@ -1288,11 +1288,11 @@ function Wn(e, r) {
|
|
|
1288
1288
|
case "SET_REPEAT":
|
|
1289
1289
|
return { ...e, repeatMode: r.payload };
|
|
1290
1290
|
case "CYCLE_REPEAT":
|
|
1291
|
-
return { ...e, repeatMode:
|
|
1291
|
+
return { ...e, repeatMode: vn(e.repeatMode) };
|
|
1292
1292
|
case "TOGGLE_SHUFFLE": {
|
|
1293
1293
|
if (e.tracks.length <= 1) return { ...e, isShuffled: !1, originalTracks: null };
|
|
1294
1294
|
if (!e.isShuffled) {
|
|
1295
|
-
const a = [...e.tracks], o =
|
|
1295
|
+
const a = [...e.tracks], o = ur(a, e.currentIndex);
|
|
1296
1296
|
return {
|
|
1297
1297
|
...e,
|
|
1298
1298
|
isShuffled: !0,
|
|
@@ -1301,7 +1301,7 @@ function Wn(e, r) {
|
|
|
1301
1301
|
currentIndex: 0
|
|
1302
1302
|
};
|
|
1303
1303
|
}
|
|
1304
|
-
const t = e.originalTracks ? [...e.originalTracks] : [...e.tracks], i = e.tracks[e.currentIndex], n =
|
|
1304
|
+
const t = e.originalTracks ? [...e.originalTracks] : [...e.tracks], i = e.tracks[e.currentIndex], n = Ue(t, i);
|
|
1305
1305
|
return {
|
|
1306
1306
|
...e,
|
|
1307
1307
|
isShuffled: !1,
|
|
@@ -1311,7 +1311,7 @@ function Wn(e, r) {
|
|
|
1311
1311
|
};
|
|
1312
1312
|
}
|
|
1313
1313
|
case "NEXT": {
|
|
1314
|
-
const t =
|
|
1314
|
+
const t = hn(e), i = t === e.currentIndex;
|
|
1315
1315
|
return {
|
|
1316
1316
|
...e,
|
|
1317
1317
|
currentIndex: t,
|
|
@@ -1320,7 +1320,7 @@ function Wn(e, r) {
|
|
|
1320
1320
|
};
|
|
1321
1321
|
}
|
|
1322
1322
|
case "PREV": {
|
|
1323
|
-
const t =
|
|
1323
|
+
const t = yn(e), i = t === e.currentIndex;
|
|
1324
1324
|
return {
|
|
1325
1325
|
...e,
|
|
1326
1326
|
currentIndex: t,
|
|
@@ -1373,7 +1373,7 @@ function Wn(e, r) {
|
|
|
1373
1373
|
case "TOGGLE_MUTE":
|
|
1374
1374
|
return { ...e, muted: !e.muted };
|
|
1375
1375
|
case "SET_PLAYBACK_RATE":
|
|
1376
|
-
return { ...e, playbackRate:
|
|
1376
|
+
return { ...e, playbackRate: je(r.payload) };
|
|
1377
1377
|
case "MEDIA_VOLUME_SYNC": {
|
|
1378
1378
|
const { volume: t, muted: i } = r.payload, n = _e(t);
|
|
1379
1379
|
return n === e.volume && i === e.muted ? e : { ...e, volume: n, muted: i };
|
|
@@ -1389,8 +1389,8 @@ function Xn(e, r, t, i = {}) {
|
|
|
1389
1389
|
var k;
|
|
1390
1390
|
const n = L(r);
|
|
1391
1391
|
n.current = r;
|
|
1392
|
-
const a = r.tracks[r.currentIndex], o = a == null ? void 0 : a.title, s = a == null ? void 0 : a.artist, l = a == null ? void 0 : a.album, d =
|
|
1393
|
-
|
|
1392
|
+
const a = r.tracks[r.currentIndex], o = a == null ? void 0 : a.title, s = a == null ? void 0 : a.artist, l = a == null ? void 0 : a.album, d = bn(a, (k = r.playlistMeta) == null ? void 0 : k.artworkUrl);
|
|
1393
|
+
I(() => {
|
|
1394
1394
|
const g = Ge();
|
|
1395
1395
|
!e || !g || (g.metadata = new MediaMetadata({
|
|
1396
1396
|
title: o ?? "Unknown track",
|
|
@@ -1398,12 +1398,12 @@ function Xn(e, r, t, i = {}) {
|
|
|
1398
1398
|
album: l,
|
|
1399
1399
|
artwork: d ? [{ src: d }] : void 0
|
|
1400
1400
|
}));
|
|
1401
|
-
}, [e, o, s, l, d]),
|
|
1401
|
+
}, [e, o, s, l, d]), I(() => {
|
|
1402
1402
|
const g = Ge();
|
|
1403
1403
|
!e || !g || (g.playbackState = r.isPaused ? "paused" : "playing");
|
|
1404
1404
|
}, [e, r.isPaused]);
|
|
1405
1405
|
const m = i.seekForwardSeconds, y = i.seekBackwardSeconds;
|
|
1406
|
-
|
|
1406
|
+
I(() => {
|
|
1407
1407
|
const g = Ge();
|
|
1408
1408
|
if (!(!e || !g)) {
|
|
1409
1409
|
try {
|
|
@@ -1425,7 +1425,7 @@ function Xn(e, r, t, i = {}) {
|
|
|
1425
1425
|
}
|
|
1426
1426
|
};
|
|
1427
1427
|
}
|
|
1428
|
-
}, [e, t, m, y]),
|
|
1428
|
+
}, [e, t, m, y]), I(() => {
|
|
1429
1429
|
var M, S;
|
|
1430
1430
|
const g = Ge();
|
|
1431
1431
|
if (!e || !g || !i.positionState) return;
|
|
@@ -1443,9 +1443,9 @@ function Xn(e, r, t, i = {}) {
|
|
|
1443
1443
|
} catch {
|
|
1444
1444
|
}
|
|
1445
1445
|
return () => {
|
|
1446
|
-
var
|
|
1446
|
+
var N;
|
|
1447
1447
|
try {
|
|
1448
|
-
(
|
|
1448
|
+
(N = g.setPositionState) == null || N.call(g);
|
|
1449
1449
|
} catch {
|
|
1450
1450
|
}
|
|
1451
1451
|
};
|
|
@@ -1483,12 +1483,12 @@ function qn({
|
|
|
1483
1483
|
persistence: f,
|
|
1484
1484
|
hydrateOnMount: M = !1,
|
|
1485
1485
|
resumeOnTrackChange: S = !1,
|
|
1486
|
-
unstyled:
|
|
1486
|
+
unstyled: N = !1,
|
|
1487
1487
|
asChild: Z = !1,
|
|
1488
1488
|
className: ee,
|
|
1489
1489
|
style: De,
|
|
1490
|
-
dir:
|
|
1491
|
-
prevRestartThresholdSeconds:
|
|
1490
|
+
dir: Kr,
|
|
1491
|
+
prevRestartThresholdSeconds: ze = 3,
|
|
1492
1492
|
onTrackChange: re,
|
|
1493
1493
|
onPlay: ne,
|
|
1494
1494
|
onPause: te,
|
|
@@ -1496,13 +1496,13 @@ function qn({
|
|
|
1496
1496
|
onError: ie,
|
|
1497
1497
|
onVolumeChange: oe,
|
|
1498
1498
|
onPlaybackRateChange: ce,
|
|
1499
|
-
onSeek:
|
|
1499
|
+
onSeek: V
|
|
1500
1500
|
}) {
|
|
1501
1501
|
var Je;
|
|
1502
|
-
const
|
|
1502
|
+
const U = L(null), [u, v] = cn(
|
|
1503
1503
|
Wn,
|
|
1504
1504
|
void 0,
|
|
1505
|
-
() =>
|
|
1505
|
+
() => Xr({
|
|
1506
1506
|
tracks: r,
|
|
1507
1507
|
currentIndex: t,
|
|
1508
1508
|
playlistMeta: i,
|
|
@@ -1514,7 +1514,7 @@ function qn({
|
|
|
1514
1514
|
muted: d,
|
|
1515
1515
|
playbackRate: m
|
|
1516
1516
|
})
|
|
1517
|
-
),
|
|
1517
|
+
), Ce = L(u), Fe = L({
|
|
1518
1518
|
tracks: r,
|
|
1519
1519
|
currentIndex: t,
|
|
1520
1520
|
playlistMeta: i,
|
|
@@ -1526,7 +1526,7 @@ function qn({
|
|
|
1526
1526
|
muted: d,
|
|
1527
1527
|
playbackRate: m
|
|
1528
1528
|
});
|
|
1529
|
-
|
|
1529
|
+
Fe.current = {
|
|
1530
1530
|
tracks: r,
|
|
1531
1531
|
currentIndex: t,
|
|
1532
1532
|
playlistMeta: i,
|
|
@@ -1539,7 +1539,7 @@ function qn({
|
|
|
1539
1539
|
playbackRate: m
|
|
1540
1540
|
};
|
|
1541
1541
|
const q = L(void 0);
|
|
1542
|
-
|
|
1542
|
+
I(() => {
|
|
1543
1543
|
if (y === void 0) {
|
|
1544
1544
|
q.current = void 0;
|
|
1545
1545
|
return;
|
|
@@ -1550,7 +1550,7 @@ function qn({
|
|
|
1550
1550
|
}
|
|
1551
1551
|
if (q.current === y) return;
|
|
1552
1552
|
q.current = y;
|
|
1553
|
-
const p =
|
|
1553
|
+
const p = Fe.current;
|
|
1554
1554
|
v({
|
|
1555
1555
|
type: "INIT",
|
|
1556
1556
|
payload: {
|
|
@@ -1566,17 +1566,17 @@ function qn({
|
|
|
1566
1566
|
playbackRate: p.playbackRate
|
|
1567
1567
|
}
|
|
1568
1568
|
});
|
|
1569
|
-
}, [y, v]),
|
|
1570
|
-
|
|
1569
|
+
}, [y, v]), I(() => {
|
|
1570
|
+
Ce.current = u;
|
|
1571
1571
|
}, [u]);
|
|
1572
1572
|
const We = u.tracks[u.currentIndex] ?? null;
|
|
1573
|
-
|
|
1573
|
+
I(() => {
|
|
1574
1574
|
re == null || re(We, u.currentIndex);
|
|
1575
|
-
}, [We, u.currentIndex, re]),
|
|
1575
|
+
}, [We, u.currentIndex, re]), I(() => {
|
|
1576
1576
|
u.errorMessage && (ie == null || ie(u.errorMessage));
|
|
1577
1577
|
}, [u.errorMessage, ie]);
|
|
1578
1578
|
const se = L(void 0);
|
|
1579
|
-
|
|
1579
|
+
I(() => {
|
|
1580
1580
|
if (se.current === void 0) {
|
|
1581
1581
|
se.current = u.isPaused;
|
|
1582
1582
|
return;
|
|
@@ -1584,7 +1584,7 @@ function qn({
|
|
|
1584
1584
|
se.current !== u.isPaused && (u.isPaused ? te == null || te() : ne == null || ne()), se.current = u.isPaused;
|
|
1585
1585
|
}, [u.isPaused, te, ne]);
|
|
1586
1586
|
const ue = L(void 0), le = L(void 0);
|
|
1587
|
-
|
|
1587
|
+
I(() => {
|
|
1588
1588
|
if (ue.current === void 0 || le.current === void 0) {
|
|
1589
1589
|
ue.current = u.volume, le.current = u.muted;
|
|
1590
1590
|
return;
|
|
@@ -1592,70 +1592,70 @@ function qn({
|
|
|
1592
1592
|
(ue.current !== u.volume || le.current !== u.muted) && (oe == null || oe(u.volume, u.muted)), ue.current = u.volume, le.current = u.muted;
|
|
1593
1593
|
}, [u.volume, u.muted, oe]);
|
|
1594
1594
|
const de = L(void 0);
|
|
1595
|
-
|
|
1595
|
+
I(() => {
|
|
1596
1596
|
if (de.current === void 0) {
|
|
1597
1597
|
de.current = u.playbackRate;
|
|
1598
1598
|
return;
|
|
1599
1599
|
}
|
|
1600
1600
|
de.current !== u.playbackRate && (ce == null || ce(u.playbackRate)), de.current = u.playbackRate;
|
|
1601
1601
|
}, [u.playbackRate, ce]);
|
|
1602
|
-
const B =
|
|
1602
|
+
const B = E(() => {
|
|
1603
1603
|
v({ type: "PLAY" });
|
|
1604
|
-
}, []), O =
|
|
1604
|
+
}, []), O = E(() => {
|
|
1605
1605
|
var p;
|
|
1606
|
-
v({ type: "PAUSE" }), (p =
|
|
1607
|
-
}, []), pe =
|
|
1606
|
+
v({ type: "PAUSE" }), (p = U.current) == null || p.pause();
|
|
1607
|
+
}, []), pe = E(() => {
|
|
1608
1608
|
u.isPaused ? B() : O();
|
|
1609
|
-
}, [O, B, u.isPaused]), $ =
|
|
1609
|
+
}, [O, B, u.isPaused]), $ = E(
|
|
1610
1610
|
(p) => {
|
|
1611
|
-
const T =
|
|
1612
|
-
T && Number.isFinite(p) && (T.currentTime = Math.max(0, p),
|
|
1611
|
+
const T = U.current;
|
|
1612
|
+
T && Number.isFinite(p) && (T.currentTime = Math.max(0, p), V == null || V(Math.max(0, p)));
|
|
1613
1613
|
},
|
|
1614
|
-
[
|
|
1615
|
-
), ge =
|
|
1614
|
+
[V]
|
|
1615
|
+
), ge = E((p) => {
|
|
1616
1616
|
v({ type: "SET_VOLUME", payload: _e(p) });
|
|
1617
|
-
}, []), fe =
|
|
1617
|
+
}, []), fe = E((p) => {
|
|
1618
1618
|
v({ type: "SET_MUTED", payload: p });
|
|
1619
|
-
}, []), me =
|
|
1619
|
+
}, []), me = E(() => {
|
|
1620
1620
|
v({ type: "TOGGLE_MUTE" });
|
|
1621
|
-
}, []), ye =
|
|
1622
|
-
v({ type: "SET_PLAYBACK_RATE", payload:
|
|
1623
|
-
}, []), z =
|
|
1621
|
+
}, []), ye = E((p) => {
|
|
1622
|
+
v({ type: "SET_PLAYBACK_RATE", payload: je(p) });
|
|
1623
|
+
}, []), z = E(() => {
|
|
1624
1624
|
v({ type: "NEXT" });
|
|
1625
|
-
}, []), W =
|
|
1626
|
-
const p =
|
|
1627
|
-
p && T > 0 && p.currentTime > T ? (p.currentTime = 0,
|
|
1628
|
-
}, [
|
|
1625
|
+
}, []), W = E(() => {
|
|
1626
|
+
const p = U.current, T = ze ?? 3;
|
|
1627
|
+
p && T > 0 && p.currentTime > T ? (p.currentTime = 0, V == null || V(0)) : v({ type: "PREV" });
|
|
1628
|
+
}, [ze, V]), he = E((p) => {
|
|
1629
1629
|
v({ type: "SET_REPEAT", payload: p });
|
|
1630
|
-
}, []), ve =
|
|
1630
|
+
}, []), ve = E(() => {
|
|
1631
1631
|
v({ type: "CYCLE_REPEAT" });
|
|
1632
|
-
}, []), ke =
|
|
1632
|
+
}, []), ke = E(() => {
|
|
1633
1633
|
v({ type: "TOGGLE_SHUFFLE" });
|
|
1634
|
-
}, []), be =
|
|
1634
|
+
}, []), be = E((p, T) => {
|
|
1635
1635
|
v({ type: "SET_QUEUE", payload: { tracks: p, currentIndex: T } });
|
|
1636
|
-
}, []), Te =
|
|
1636
|
+
}, []), Te = E((p, T, x) => {
|
|
1637
1637
|
v({ type: "INSERT_TRACK", payload: { track: p, index: T, autoPlay: x } });
|
|
1638
|
-
}, []), xe =
|
|
1638
|
+
}, []), xe = E((p) => {
|
|
1639
1639
|
v({ type: "REMOVE_TRACK", payload: { index: p } });
|
|
1640
|
-
}, []), Me =
|
|
1640
|
+
}, []), Me = E((p, T) => {
|
|
1641
1641
|
v({ type: "MOVE_TRACK", payload: { fromIndex: p, toIndex: T } });
|
|
1642
|
-
}, []),
|
|
1642
|
+
}, []), Ee = E((p) => {
|
|
1643
1643
|
v({ type: "ADD_NEXT", payload: { track: p } });
|
|
1644
|
-
}, []),
|
|
1644
|
+
}, []), Ie = E((p) => {
|
|
1645
1645
|
v({ type: "SET_INDEX", payload: { index: p, autoPlay: !0 } });
|
|
1646
|
-
}, []), Pe =
|
|
1646
|
+
}, []), Pe = E((p) => {
|
|
1647
1647
|
v({ type: "SET_INDEX", payload: { index: p, autoPlay: !1 } });
|
|
1648
|
-
}, []), Ae =
|
|
1648
|
+
}, []), Ae = E((p) => {
|
|
1649
1649
|
v({ type: "SET_PLAYLIST_META", payload: p });
|
|
1650
|
-
}, []), Se =
|
|
1650
|
+
}, []), Se = E((p) => {
|
|
1651
1651
|
v({ type: "SET_PLAYBACK_MODE", payload: p });
|
|
1652
|
-
}, []), Re =
|
|
1652
|
+
}, []), Re = E((p) => {
|
|
1653
1653
|
v({ type: "INIT", payload: p });
|
|
1654
1654
|
}, []);
|
|
1655
|
-
|
|
1655
|
+
I(() => {
|
|
1656
1656
|
if (!(!f || !M))
|
|
1657
1657
|
try {
|
|
1658
|
-
const p = f.get("ginger:volume"), T = f.get("ginger:muted"), x = f.get("ginger:playbackRate"),
|
|
1658
|
+
const p = f.get("ginger:volume"), T = f.get("ginger:muted"), x = f.get("ginger:playbackRate"), R = f.get("ginger:repeatMode"), Ne = f.get("ginger:currentIndex"), F = Fe.current;
|
|
1659
1659
|
v({
|
|
1660
1660
|
type: "INIT",
|
|
1661
1661
|
payload: {
|
|
@@ -1665,7 +1665,7 @@ function qn({
|
|
|
1665
1665
|
isShuffled: F.isShuffled,
|
|
1666
1666
|
playbackMode: F.playbackMode,
|
|
1667
1667
|
currentIndex: typeof Ne == "number" ? Ne : F.currentIndex,
|
|
1668
|
-
repeatMode:
|
|
1668
|
+
repeatMode: R === "off" || R === "all" || R === "one" ? R : F.repeatMode,
|
|
1669
1669
|
volume: typeof p == "number" ? p : F.volume,
|
|
1670
1670
|
muted: typeof T == "boolean" ? T : F.muted,
|
|
1671
1671
|
playbackRate: typeof x == "number" ? x : F.playbackRate
|
|
@@ -1674,7 +1674,7 @@ function qn({
|
|
|
1674
1674
|
} catch (p) {
|
|
1675
1675
|
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.get() threw during hydration:", p);
|
|
1676
1676
|
}
|
|
1677
|
-
}, [M, f]),
|
|
1677
|
+
}, [M, f]), I(() => {
|
|
1678
1678
|
if (f)
|
|
1679
1679
|
try {
|
|
1680
1680
|
f.set("ginger:volume", u.volume), f.set("ginger:muted", u.muted), f.set("ginger:playbackRate", u.playbackRate), f.set("ginger:repeatMode", u.repeatMode), f.set("ginger:currentIndex", u.currentIndex);
|
|
@@ -1688,46 +1688,50 @@ function qn({
|
|
|
1688
1688
|
u.playbackRate,
|
|
1689
1689
|
u.repeatMode,
|
|
1690
1690
|
u.currentIndex
|
|
1691
|
-
]),
|
|
1691
|
+
]), I(() => {
|
|
1692
1692
|
if (!f || !S) return;
|
|
1693
1693
|
const p = u.tracks[u.currentIndex];
|
|
1694
1694
|
if (!p) return;
|
|
1695
|
-
const T = `ginger:resume:${
|
|
1695
|
+
const T = `ginger:resume:${Be(p)}`;
|
|
1696
1696
|
try {
|
|
1697
1697
|
const x = f.get(T);
|
|
1698
1698
|
typeof x == "number" && Number.isFinite(x) && $(x);
|
|
1699
1699
|
} catch (x) {
|
|
1700
1700
|
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.get() threw during resume:", x);
|
|
1701
1701
|
}
|
|
1702
|
-
}, [f, S, u.currentIndex, u.tracks, $]),
|
|
1702
|
+
}, [f, S, u.currentIndex, u.tracks, $]), I(() => {
|
|
1703
1703
|
if (!f || !S) return;
|
|
1704
1704
|
const p = u.tracks[u.currentIndex];
|
|
1705
1705
|
if (!p || !(u.currentTime >= 0)) return;
|
|
1706
|
-
const T = `ginger:resume:${
|
|
1706
|
+
const T = `ginger:resume:${Be(p)}`, x = setTimeout(() => {
|
|
1707
1707
|
try {
|
|
1708
1708
|
f.set(T, u.currentTime);
|
|
1709
|
-
} catch (
|
|
1710
|
-
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw during resume save:",
|
|
1709
|
+
} catch (R) {
|
|
1710
|
+
process.env.NODE_ENV !== "production" && console.warn("[@lucaismyname/ginger] persistence.set() threw during resume save:", R);
|
|
1711
1711
|
}
|
|
1712
1712
|
}, 250);
|
|
1713
1713
|
return () => clearTimeout(x);
|
|
1714
1714
|
}, [f, S, u.currentIndex, u.tracks, u.currentTime]);
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1717
|
-
const p =
|
|
1715
|
+
const qr = (Je = u.tracks[u.currentIndex]) == null ? void 0 : Je.fileUrl;
|
|
1716
|
+
I(() => {
|
|
1717
|
+
const p = U.current;
|
|
1718
1718
|
if (!p) return;
|
|
1719
1719
|
if (u.isPaused) {
|
|
1720
1720
|
p.pause();
|
|
1721
1721
|
return;
|
|
1722
1722
|
}
|
|
1723
|
+
if (p.ended && nr(Ce.current).kind === "stop") {
|
|
1724
|
+
v({ type: "PAUSE" });
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1723
1727
|
let T = !1;
|
|
1724
1728
|
return (async () => {
|
|
1725
1729
|
if (h) {
|
|
1726
1730
|
let x = !1;
|
|
1727
1731
|
try {
|
|
1728
1732
|
x = await h();
|
|
1729
|
-
} catch (
|
|
1730
|
-
const Ne =
|
|
1733
|
+
} catch (R) {
|
|
1734
|
+
const Ne = R instanceof Error ? R.message : "beforePlay rejected";
|
|
1731
1735
|
v({ type: "MEDIA_ERROR", payload: { message: Ne } });
|
|
1732
1736
|
return;
|
|
1733
1737
|
}
|
|
@@ -1737,39 +1741,40 @@ function qn({
|
|
|
1737
1741
|
}
|
|
1738
1742
|
}
|
|
1739
1743
|
T || p.play().catch((x) => {
|
|
1740
|
-
const
|
|
1741
|
-
v({ type: "MEDIA_ERROR", payload: { message:
|
|
1744
|
+
const R = x instanceof Error ? x.message : typeof x == "string" ? x : "Playback failed (e.g. autoplay blocked or unavailable source)";
|
|
1745
|
+
v({ type: "MEDIA_ERROR", payload: { message: R } });
|
|
1742
1746
|
});
|
|
1743
1747
|
})(), () => {
|
|
1744
1748
|
T = !0;
|
|
1745
1749
|
};
|
|
1746
|
-
}, [h,
|
|
1747
|
-
const we =
|
|
1748
|
-
|
|
1750
|
+
}, [h, qr, b, u.isPaused]);
|
|
1751
|
+
const we = E(() => {
|
|
1752
|
+
var x;
|
|
1753
|
+
const p = nr(Ce.current);
|
|
1749
1754
|
if (p.kind === "replay_same") {
|
|
1750
|
-
const
|
|
1751
|
-
|
|
1755
|
+
const R = U.current;
|
|
1756
|
+
R && (R.currentTime = 0), v({ type: "PLAY" });
|
|
1752
1757
|
return;
|
|
1753
1758
|
}
|
|
1754
1759
|
if (p.kind === "stop") {
|
|
1755
|
-
v({ type: "PAUSE" }), ae == null || ae();
|
|
1760
|
+
(x = U.current) == null || x.pause(), v({ type: "PAUSE" }), ae == null || ae();
|
|
1756
1761
|
return;
|
|
1757
1762
|
}
|
|
1758
1763
|
const T = p.nextIndex;
|
|
1759
1764
|
v({ type: "SET_INDEX", payload: { index: T, autoPlay: !0 } });
|
|
1760
|
-
}, [ae]),
|
|
1765
|
+
}, [ae]), Jr = A(
|
|
1761
1766
|
() => ({ play: B, pause: O, next: z, prev: W, seek: $ }),
|
|
1762
1767
|
[B, O, z, W, $]
|
|
1763
|
-
),
|
|
1768
|
+
), Zr = typeof g == "object" ? !0 : !!g, en = A(
|
|
1764
1769
|
() => typeof g == "object" ? g : {},
|
|
1765
1770
|
[g]
|
|
1766
1771
|
);
|
|
1767
|
-
Xn(
|
|
1768
|
-
const Xe =
|
|
1772
|
+
Xn(Zr, u, Jr, en);
|
|
1773
|
+
const Xe = Kr ?? (k != null && k.seek && /[\u0590-\u08FF]/.test(k.seek) ? "rtl" : "ltr"), rn = A(
|
|
1769
1774
|
() => ({
|
|
1770
1775
|
state: u,
|
|
1771
1776
|
dispatch: v,
|
|
1772
|
-
audioRef:
|
|
1777
|
+
audioRef: U,
|
|
1773
1778
|
notifyEnded: we,
|
|
1774
1779
|
init: Re,
|
|
1775
1780
|
play: B,
|
|
@@ -1789,8 +1794,8 @@ function qn({
|
|
|
1789
1794
|
insertTrackAt: Te,
|
|
1790
1795
|
removeTrackAt: xe,
|
|
1791
1796
|
moveTrack: Me,
|
|
1792
|
-
enqueueNext:
|
|
1793
|
-
playTrackAt:
|
|
1797
|
+
enqueueNext: Ee,
|
|
1798
|
+
playTrackAt: Ie,
|
|
1794
1799
|
selectTrackAt: Pe,
|
|
1795
1800
|
setPlaylistMeta: Ae,
|
|
1796
1801
|
setPlaybackMode: Se
|
|
@@ -1803,11 +1808,11 @@ function qn({
|
|
|
1803
1808
|
we,
|
|
1804
1809
|
O,
|
|
1805
1810
|
B,
|
|
1806
|
-
|
|
1811
|
+
Ie,
|
|
1807
1812
|
Te,
|
|
1808
1813
|
xe,
|
|
1809
1814
|
Me,
|
|
1810
|
-
|
|
1815
|
+
Ee,
|
|
1811
1816
|
Pe,
|
|
1812
1817
|
W,
|
|
1813
1818
|
$,
|
|
@@ -1823,7 +1828,7 @@ function qn({
|
|
|
1823
1828
|
pe,
|
|
1824
1829
|
ke
|
|
1825
1830
|
]
|
|
1826
|
-
),
|
|
1831
|
+
), nn = A(
|
|
1827
1832
|
() => ({
|
|
1828
1833
|
tracks: u.tracks,
|
|
1829
1834
|
currentIndex: u.currentIndex,
|
|
@@ -1846,8 +1851,8 @@ function qn({
|
|
|
1846
1851
|
insertTrackAt: Te,
|
|
1847
1852
|
removeTrackAt: xe,
|
|
1848
1853
|
moveTrack: Me,
|
|
1849
|
-
enqueueNext:
|
|
1850
|
-
playTrackAt:
|
|
1854
|
+
enqueueNext: Ee,
|
|
1855
|
+
playTrackAt: Ie,
|
|
1851
1856
|
selectTrackAt: Pe,
|
|
1852
1857
|
setPlaylistMeta: Ae,
|
|
1853
1858
|
setPlaybackMode: Se,
|
|
@@ -1875,14 +1880,14 @@ function qn({
|
|
|
1875
1880
|
Te,
|
|
1876
1881
|
xe,
|
|
1877
1882
|
Me,
|
|
1878
|
-
Ie,
|
|
1879
1883
|
Ee,
|
|
1884
|
+
Ie,
|
|
1880
1885
|
Pe,
|
|
1881
1886
|
Ae,
|
|
1882
1887
|
Se,
|
|
1883
1888
|
v
|
|
1884
1889
|
]
|
|
1885
|
-
),
|
|
1890
|
+
), tn = A(
|
|
1886
1891
|
() => ({
|
|
1887
1892
|
currentTime: u.currentTime,
|
|
1888
1893
|
duration: u.duration,
|
|
@@ -1897,7 +1902,7 @@ function qn({
|
|
|
1897
1902
|
setMuted: fe,
|
|
1898
1903
|
toggleMute: me,
|
|
1899
1904
|
setPlaybackRate: ye,
|
|
1900
|
-
audioRef:
|
|
1905
|
+
audioRef: U,
|
|
1901
1906
|
notifyEnded: we,
|
|
1902
1907
|
dispatch: v
|
|
1903
1908
|
}),
|
|
@@ -1915,13 +1920,13 @@ function qn({
|
|
|
1915
1920
|
fe,
|
|
1916
1921
|
me,
|
|
1917
1922
|
ye,
|
|
1918
|
-
|
|
1923
|
+
U,
|
|
1919
1924
|
we,
|
|
1920
1925
|
v
|
|
1921
1926
|
]
|
|
1922
|
-
), Ke =
|
|
1923
|
-
() =>
|
|
1924
|
-
[De,
|
|
1927
|
+
), Ke = sr(u), qe = A(
|
|
1928
|
+
() => N ? De : { ...Kn, ...De },
|
|
1929
|
+
[De, N]
|
|
1925
1930
|
), C = A(
|
|
1926
1931
|
() => ({
|
|
1927
1932
|
className: ee,
|
|
@@ -1930,7 +1935,7 @@ function qn({
|
|
|
1930
1935
|
dir: Xe
|
|
1931
1936
|
}),
|
|
1932
1937
|
[ee, qe, Ke, Xe]
|
|
1933
|
-
),
|
|
1938
|
+
), an = A(() => {
|
|
1934
1939
|
if (!Z)
|
|
1935
1940
|
return /* @__PURE__ */ c(
|
|
1936
1941
|
"div",
|
|
@@ -1942,18 +1947,18 @@ function qn({
|
|
|
1942
1947
|
children: e
|
|
1943
1948
|
}
|
|
1944
1949
|
);
|
|
1945
|
-
const p =
|
|
1946
|
-
if (!
|
|
1950
|
+
const p = sn.only(e);
|
|
1951
|
+
if (!un(p))
|
|
1947
1952
|
throw new Error("Ginger.Provider asChild expects a single React element child.");
|
|
1948
1953
|
const T = p, x = T.props.style;
|
|
1949
|
-
return
|
|
1954
|
+
return ln(T, {
|
|
1950
1955
|
className: Jn(T.props.className, C.className),
|
|
1951
1956
|
style: x && typeof x == "object" ? { ...x, ...C.style } : C.style,
|
|
1952
1957
|
"data-ginger-playback": C["data-ginger-playback"],
|
|
1953
1958
|
dir: C.dir
|
|
1954
1959
|
});
|
|
1955
1960
|
}, [Z, e, C]);
|
|
1956
|
-
return /* @__PURE__ */ c(
|
|
1961
|
+
return /* @__PURE__ */ c(En, { locale: k, children: /* @__PURE__ */ c(dn.Provider, { value: nn, children: /* @__PURE__ */ c(pn.Provider, { value: tn, children: /* @__PURE__ */ c(lr.Provider, { value: rn, children: an }) }) }) });
|
|
1957
1962
|
}
|
|
1958
1963
|
function Jn(e, r) {
|
|
1959
1964
|
const t = [e, r].filter(Boolean).join(" ");
|
|
@@ -1972,79 +1977,79 @@ const tt = {
|
|
|
1972
1977
|
Label: Dn,
|
|
1973
1978
|
Isrc: Cn,
|
|
1974
1979
|
TrackNumber: Fn,
|
|
1975
|
-
Year:
|
|
1976
|
-
Lyrics:
|
|
1977
|
-
LyricsSynced:
|
|
1978
|
-
Chapters:
|
|
1979
|
-
FileUrl:
|
|
1980
|
-
Artwork:
|
|
1981
|
-
QueueIndex:
|
|
1982
|
-
QueueLength:
|
|
1983
|
-
QueuePosition:
|
|
1984
|
-
Elapsed:
|
|
1985
|
-
Duration:
|
|
1986
|
-
Remaining:
|
|
1987
|
-
Progress:
|
|
1988
|
-
TimeRail:
|
|
1989
|
-
BufferRail:
|
|
1990
|
-
PlaybackState:
|
|
1991
|
-
ErrorMessage:
|
|
1980
|
+
Year: Rr,
|
|
1981
|
+
Lyrics: wr,
|
|
1982
|
+
LyricsSynced: Nr,
|
|
1983
|
+
Chapters: Gr,
|
|
1984
|
+
FileUrl: Lr,
|
|
1985
|
+
Artwork: _r,
|
|
1986
|
+
QueueIndex: Dr,
|
|
1987
|
+
QueueLength: Cr,
|
|
1988
|
+
QueuePosition: Fr,
|
|
1989
|
+
Elapsed: Ur,
|
|
1990
|
+
Duration: Vr,
|
|
1991
|
+
Remaining: Br,
|
|
1992
|
+
Progress: Or,
|
|
1993
|
+
TimeRail: $r,
|
|
1994
|
+
BufferRail: Hr,
|
|
1995
|
+
PlaybackState: Yr,
|
|
1996
|
+
ErrorMessage: Qr
|
|
1992
1997
|
},
|
|
1993
1998
|
Queue: {
|
|
1994
1999
|
Title: Hn,
|
|
1995
2000
|
Subtitle: Yn,
|
|
1996
2001
|
Description: Qn,
|
|
1997
2002
|
Copyright: jn,
|
|
1998
|
-
Artwork:
|
|
2003
|
+
Artwork: Wr
|
|
1999
2004
|
},
|
|
2000
2005
|
Control: {
|
|
2001
|
-
PlayPause:
|
|
2002
|
-
Repeat:
|
|
2003
|
-
Next:
|
|
2004
|
-
Previous:
|
|
2005
|
-
Shuffle:
|
|
2006
|
+
PlayPause: br,
|
|
2007
|
+
Repeat: Tr,
|
|
2008
|
+
Next: xr,
|
|
2009
|
+
Previous: Mr,
|
|
2010
|
+
Shuffle: Er,
|
|
2006
2011
|
SeekBar: Ir,
|
|
2007
|
-
Volume:
|
|
2008
|
-
Mute:
|
|
2009
|
-
PlaybackRate:
|
|
2012
|
+
Volume: Pr,
|
|
2013
|
+
Mute: Ar,
|
|
2014
|
+
PlaybackRate: Sr
|
|
2010
2015
|
},
|
|
2011
2016
|
Icon: {
|
|
2012
|
-
Play:
|
|
2013
|
-
Pause:
|
|
2014
|
-
SkipForward:
|
|
2015
|
-
SkipBack:
|
|
2016
|
-
Shuffle:
|
|
2017
|
-
Volume2:
|
|
2018
|
-
VolumeX:
|
|
2019
|
-
RepeatGlyph:
|
|
2017
|
+
Play: gr,
|
|
2018
|
+
Pause: pr,
|
|
2019
|
+
SkipForward: hr,
|
|
2020
|
+
SkipBack: yr,
|
|
2021
|
+
Shuffle: mr,
|
|
2022
|
+
Volume2: vr,
|
|
2023
|
+
VolumeX: kr,
|
|
2024
|
+
RepeatGlyph: fr,
|
|
2020
2025
|
Wrapper: _
|
|
2021
2026
|
},
|
|
2022
2027
|
Playlist: $n
|
|
2023
2028
|
};
|
|
2024
2029
|
export {
|
|
2025
|
-
|
|
2030
|
+
Gr as C,
|
|
2026
2031
|
tt as G,
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
+
Nr as L,
|
|
2033
|
+
pr as P,
|
|
2034
|
+
fr as R,
|
|
2035
|
+
mr as S,
|
|
2036
|
+
vr as V,
|
|
2032
2037
|
_ as W,
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
+
gr as a,
|
|
2039
|
+
yr as b,
|
|
2040
|
+
hr as c,
|
|
2041
|
+
kr as d,
|
|
2042
|
+
je as e,
|
|
2038
2043
|
_e as f,
|
|
2039
2044
|
Le as g,
|
|
2040
|
-
|
|
2045
|
+
G as h,
|
|
2041
2046
|
Vn as i,
|
|
2042
2047
|
An as j,
|
|
2043
|
-
|
|
2048
|
+
In as k,
|
|
2044
2049
|
Pn as l,
|
|
2045
|
-
|
|
2050
|
+
Xr as m,
|
|
2046
2051
|
Wn as n,
|
|
2047
2052
|
Un as p,
|
|
2048
2053
|
Bn as u
|
|
2049
2054
|
};
|
|
2050
|
-
//# sourceMappingURL=ginger-
|
|
2055
|
+
//# sourceMappingURL=ginger-CgHqHrrG.js.map
|