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