@lucaismyname/ginger 0.0.20 → 0.0.22
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/dist/audio/GingerPlayer.d.ts.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.js +2 -2
- package/dist/ginger-BKmH7kWx.cjs +2 -0
- package/dist/ginger-BKmH7kWx.cjs.map +1 -0
- package/dist/{ginger-8x4WzVmw.js → ginger-BoNnuade.js} +121 -118
- package/dist/ginger-BoNnuade.js.map +1 -0
- 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/{useNextTrackPrefetch-CV1khU0h.js → useNextTrackPrefetch-BUx0bK_a.js} +2 -2
- package/dist/{useNextTrackPrefetch-CV1khU0h.js.map → useNextTrackPrefetch-BUx0bK_a.js.map} +1 -1
- package/dist/{useNextTrackPrefetch-CFoUynDv.cjs → useNextTrackPrefetch-CaTRhYHd.cjs} +2 -2
- package/dist/{useNextTrackPrefetch-CFoUynDv.cjs.map → useNextTrackPrefetch-CaTRhYHd.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/ginger-8x4WzVmw.js.map +0 -1
- package/dist/ginger-CMbd3s8C.cjs +0 -2
- package/dist/ginger-CMbd3s8C.cjs.map +0 -1
|
@@ -19,7 +19,7 @@ function Fr({
|
|
|
19
19
|
respectReducedMotion: t = !1
|
|
20
20
|
}) {
|
|
21
21
|
var S;
|
|
22
|
-
const { audioRef: i, dispatch: o, state: u, notifyEnded: s } = Dr(),
|
|
22
|
+
const { audioRef: i, dispatch: o, state: u, notifyEnded: s } = Dr(), l = ((S = u.tracks[u.currentIndex]) == null ? void 0 : S.fileUrl) ?? "", g = O({
|
|
23
23
|
currentTime: -1,
|
|
24
24
|
duration: -1,
|
|
25
25
|
bufferedFraction: -1
|
|
@@ -42,17 +42,20 @@ function Fr({
|
|
|
42
42
|
};
|
|
43
43
|
return E(() => {
|
|
44
44
|
const p = i.current;
|
|
45
|
-
p && (p.volume = u.volume, p.muted = u.muted
|
|
46
|
-
}, [i, u.volume, u.muted
|
|
45
|
+
p && (p.volume = u.volume, p.muted = u.muted);
|
|
46
|
+
}, [i, u.volume, u.muted]), E(() => {
|
|
47
47
|
const p = i.current;
|
|
48
48
|
if (p) {
|
|
49
|
-
if (!
|
|
49
|
+
if (!l) {
|
|
50
50
|
p.removeAttribute("src"), g.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }, m.current !== "" && o({ type: "MEDIA_SOURCE_CLEARED" }), m.current = "";
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
p.getAttribute("src") !==
|
|
53
|
+
p.getAttribute("src") !== l && (p.src = l, p.load(), g.current = { currentTime: -1, duration: -1, bufferedFraction: -1 }), m.current = l;
|
|
54
54
|
}
|
|
55
|
-
}, [i, o, u.currentIndex, u.tracks,
|
|
55
|
+
}, [i, o, u.currentIndex, u.tracks, l]), E(() => {
|
|
56
|
+
const p = i.current;
|
|
57
|
+
p && (p.playbackRate = u.playbackRate);
|
|
58
|
+
}, [i, u.playbackRate, l]), /* @__PURE__ */ d(
|
|
56
59
|
"audio",
|
|
57
60
|
{
|
|
58
61
|
ref: i,
|
|
@@ -204,9 +207,9 @@ function zr(e) {
|
|
|
204
207
|
}
|
|
205
208
|
function B(e, r) {
|
|
206
209
|
function n(a) {
|
|
207
|
-
const t = I(), o = (r(t) ?? "").trim(), { className: u, style: s, fallback:
|
|
210
|
+
const t = I(), o = (r(t) ?? "").trim(), { className: u, style: s, fallback: l, empty: g, children: m } = a;
|
|
208
211
|
if (!o) {
|
|
209
|
-
const y = g ??
|
|
212
|
+
const y = g ?? l ?? null;
|
|
210
213
|
return y ? /* @__PURE__ */ d("span", { className: u, style: s, children: y }) : null;
|
|
211
214
|
}
|
|
212
215
|
return m ? /* @__PURE__ */ d("span", { className: u, style: s, children: m(o, t) }) : /* @__PURE__ */ d("span", { className: u, style: s, children: o });
|
|
@@ -225,8 +228,8 @@ const Wr = Y("Ginger.Current.Title", (e) => e == null ? void 0 : e.title), qr =
|
|
|
225
228
|
(e) => (e == null ? void 0 : e.trackNumber) != null ? String(e.trackNumber) : void 0
|
|
226
229
|
);
|
|
227
230
|
function Ke({ className: e, style: r, fallback: n, empty: a, children: t, format: i }) {
|
|
228
|
-
var
|
|
229
|
-
const o = I(), u = (
|
|
231
|
+
var l;
|
|
232
|
+
const o = I(), u = (l = V(o)) == null ? void 0 : l.year;
|
|
230
233
|
if (typeof u != "number" || !Number.isFinite(u)) {
|
|
231
234
|
const g = a ?? n ?? null;
|
|
232
235
|
return g ? /* @__PURE__ */ d("span", { className: e, style: r, children: g }) : null;
|
|
@@ -242,8 +245,8 @@ function Xe({ className: e, style: r, fallback: n, empty: a, children: t, preser
|
|
|
242
245
|
const m = a ?? n ?? null;
|
|
243
246
|
return m ? /* @__PURE__ */ d("span", { className: e, style: r, children: m }) : null;
|
|
244
247
|
}
|
|
245
|
-
const
|
|
246
|
-
return t ? /* @__PURE__ */ d("span", { className: e, style: { ...
|
|
248
|
+
const l = i ? { whiteSpace: "pre-wrap" } : void 0;
|
|
249
|
+
return t ? /* @__PURE__ */ d("span", { className: e, style: { ...l, ...r }, children: t(s, o) }) : /* @__PURE__ */ d("span", { className: e, style: { ...l, ...r }, children: s });
|
|
247
250
|
}
|
|
248
251
|
Xe.displayName = "Ginger.Current.Lyrics";
|
|
249
252
|
const Ve = /\[(\d{1,2}):(\d{2})(?:\.(\d{1,3}))?\]/g;
|
|
@@ -254,8 +257,8 @@ function on(e) {
|
|
|
254
257
|
if (a.length === 0) continue;
|
|
255
258
|
const t = n.replace(Ve, "").trim();
|
|
256
259
|
for (const i of a) {
|
|
257
|
-
const o = Number(i[1] ?? 0), u = Number(i[2] ?? 0), s = Number((i[3] ?? "0").padEnd(3, "0")),
|
|
258
|
-
Number.isFinite(
|
|
260
|
+
const o = Number(i[1] ?? 0), u = Number(i[2] ?? 0), s = Number((i[3] ?? "0").padEnd(3, "0")), l = o * 60 + u + s / 1e3;
|
|
261
|
+
Number.isFinite(l) && l >= 0 && r.push({ time: l, text: t });
|
|
259
262
|
}
|
|
260
263
|
}
|
|
261
264
|
return r.sort((n, a) => n.time - a.time);
|
|
@@ -282,8 +285,8 @@ function ze({
|
|
|
282
285
|
lineClassName: o,
|
|
283
286
|
children: u
|
|
284
287
|
}) {
|
|
285
|
-
const s = I(), { lines:
|
|
286
|
-
if (
|
|
288
|
+
const s = I(), { lines: l, activeIndex: g } = un();
|
|
289
|
+
if (l.length === 0) {
|
|
287
290
|
const y = a ?? n ?? null;
|
|
288
291
|
return y ? /* @__PURE__ */ d("span", { className: e, style: r, children: y }) : null;
|
|
289
292
|
}
|
|
@@ -294,7 +297,7 @@ function ze({
|
|
|
294
297
|
fontFamily: "var(--ginger-font-family, system-ui, sans-serif)",
|
|
295
298
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
296
299
|
color: "var(--ginger-primary-color, #111827)"
|
|
297
|
-
}, ...r }, "aria-label": "Synced lyrics", children:
|
|
300
|
+
}, ...r }, "aria-label": "Synced lyrics", children: l.map((y, k) => {
|
|
298
301
|
const b = k === g;
|
|
299
302
|
return /* @__PURE__ */ d(
|
|
300
303
|
"li",
|
|
@@ -317,7 +320,7 @@ ze.displayName = "Ginger.Current.LyricsSynced";
|
|
|
317
320
|
function sn() {
|
|
318
321
|
const { tracks: e, currentIndex: r } = _(), { currentTime: n, seek: a } = j(), t = P(() => {
|
|
319
322
|
var u;
|
|
320
|
-
return [...((u = e[r]) == null ? void 0 : u.chapters) ?? []].filter((s) => s && Number.isFinite(s.startSeconds) && s.startSeconds >= 0).sort((s,
|
|
323
|
+
return [...((u = e[r]) == null ? void 0 : u.chapters) ?? []].filter((s) => s && Number.isFinite(s.startSeconds) && s.startSeconds >= 0).sort((s, l) => s.startSeconds - l.startSeconds);
|
|
321
324
|
}, [r, e]), i = P(() => {
|
|
322
325
|
if (t.length === 0) return -1;
|
|
323
326
|
for (let o = t.length - 1; o >= 0; o -= 1)
|
|
@@ -348,7 +351,7 @@ function We({
|
|
|
348
351
|
formatStart: i = z,
|
|
349
352
|
children: o
|
|
350
353
|
}) {
|
|
351
|
-
const u = I(), { list: s, activeIndex:
|
|
354
|
+
const u = I(), { list: s, activeIndex: l, seekTo: g } = sn();
|
|
352
355
|
if (s.length === 0) {
|
|
353
356
|
const y = a ?? n ?? null;
|
|
354
357
|
return y ? /* @__PURE__ */ d("span", { className: e, style: r, children: y }) : null;
|
|
@@ -361,7 +364,7 @@ function We({
|
|
|
361
364
|
fontSize: "var(--ginger-font-size, 14px)",
|
|
362
365
|
color: "var(--ginger-primary-color, #111827)"
|
|
363
366
|
}, ...r }, "aria-label": "Chapters", children: s.map((y, k) => {
|
|
364
|
-
const b = k ===
|
|
367
|
+
const b = k === l;
|
|
365
368
|
return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ d(
|
|
366
369
|
"button",
|
|
367
370
|
{
|
|
@@ -394,8 +397,8 @@ function qe({ visible: e = !1, className: r, style: n, fallback: a, empty: t, ch
|
|
|
394
397
|
if (!e) return null;
|
|
395
398
|
const u = ((s = V(o)) == null ? void 0 : s.fileUrl) ?? "";
|
|
396
399
|
if (!u) {
|
|
397
|
-
const
|
|
398
|
-
return
|
|
400
|
+
const l = t ?? a ?? null;
|
|
401
|
+
return l ? /* @__PURE__ */ d("span", { className: r, style: n, children: l }) : null;
|
|
399
402
|
}
|
|
400
403
|
return i ? /* @__PURE__ */ d("span", { className: r, style: n, children: i(u, o) }) : /* @__PURE__ */ d("span", { className: r, style: n, children: u });
|
|
401
404
|
}
|
|
@@ -410,7 +413,7 @@ function Je({
|
|
|
410
413
|
onError: o,
|
|
411
414
|
decoding: u,
|
|
412
415
|
unstyled: s = !1,
|
|
413
|
-
imgStyle:
|
|
416
|
+
imgStyle: l
|
|
414
417
|
}) {
|
|
415
418
|
const g = I(), m = V(g), y = Xr(g);
|
|
416
419
|
if (!y) {
|
|
@@ -442,7 +445,7 @@ function Je({
|
|
|
442
445
|
width: s ? void 0 : "100%",
|
|
443
446
|
height: s ? void 0 : "100%",
|
|
444
447
|
objectFit: s ? void 0 : "cover",
|
|
445
|
-
...
|
|
448
|
+
...l
|
|
446
449
|
}
|
|
447
450
|
}
|
|
448
451
|
)
|
|
@@ -453,8 +456,8 @@ Je.displayName = "Ginger.Current.Artwork";
|
|
|
453
456
|
function Ze({ base: e = 0, className: r, style: n, fallback: a, empty: t, children: i }) {
|
|
454
457
|
const o = I();
|
|
455
458
|
if (o.tracks.length === 0) {
|
|
456
|
-
const
|
|
457
|
-
return
|
|
459
|
+
const l = t ?? a ?? null;
|
|
460
|
+
return l ? /* @__PURE__ */ d("span", { className: r, style: n, children: l }) : null;
|
|
458
461
|
}
|
|
459
462
|
const s = String(o.currentIndex + e);
|
|
460
463
|
return i ? /* @__PURE__ */ d("span", { className: r, style: n, children: i(s, o) }) : /* @__PURE__ */ d("span", { className: r, style: n, children: s });
|
|
@@ -483,8 +486,8 @@ function rr({
|
|
|
483
486
|
const y = i ?? t ?? null;
|
|
484
487
|
return y ? /* @__PURE__ */ d("span", { className: n, style: a, children: y }) : null;
|
|
485
488
|
}
|
|
486
|
-
const
|
|
487
|
-
return o ? /* @__PURE__ */ d("span", { className: n, style: a, children: o({ index:
|
|
489
|
+
const l = String(u.currentIndex + e), g = String(s), m = `${l}${r}${g}`;
|
|
490
|
+
return o ? /* @__PURE__ */ d("span", { className: n, style: a, children: o({ index: l, length: g, label: m }, u) }) : /* @__PURE__ */ d("span", { className: n, style: a, children: m });
|
|
488
491
|
}
|
|
489
492
|
rr.displayName = "Ginger.Current.QueuePosition";
|
|
490
493
|
function we(e, r, n) {
|
|
@@ -493,8 +496,8 @@ function we(e, r, n) {
|
|
|
493
496
|
const g = o ?? i ?? null;
|
|
494
497
|
return g ? /* @__PURE__ */ d("span", { className: a, style: t, children: g }) : null;
|
|
495
498
|
}
|
|
496
|
-
const
|
|
497
|
-
return u ? /* @__PURE__ */ d("span", { className: a, style: t, children: u(
|
|
499
|
+
const l = s(e);
|
|
500
|
+
return u ? /* @__PURE__ */ d("span", { className: a, style: t, children: u(l, r) }) : /* @__PURE__ */ d("span", { className: a, style: t, children: l });
|
|
498
501
|
}
|
|
499
502
|
function nr(e) {
|
|
500
503
|
const r = I();
|
|
@@ -653,8 +656,8 @@ function N() {
|
|
|
653
656
|
return Ge(cr);
|
|
654
657
|
}
|
|
655
658
|
function dn() {
|
|
656
|
-
const e = _(), r = j(), n = N(), a = P(() => $e(e, r), [e, r]), t = q(a), i = t > 0 ? a.currentTime : 0, o = Number.isFinite(i) ? i : 0, u = t > 0 ? `${z(o)} of ${z(t)}` : z(o), s = (
|
|
657
|
-
r.seek(Number(
|
|
659
|
+
const e = _(), r = j(), n = N(), a = P(() => $e(e, r), [e, r]), t = q(a), i = t > 0 ? a.currentTime : 0, o = Number.isFinite(i) ? i : 0, u = t > 0 ? `${z(o)} of ${z(t)}` : z(o), s = (l) => {
|
|
660
|
+
r.seek(Number(l.currentTarget.value));
|
|
658
661
|
};
|
|
659
662
|
return {
|
|
660
663
|
state: a,
|
|
@@ -702,8 +705,8 @@ function dr({
|
|
|
702
705
|
onClick: o,
|
|
703
706
|
...u
|
|
704
707
|
}) {
|
|
705
|
-
const s = N(),
|
|
706
|
-
playAriaLabel: n ??
|
|
708
|
+
const s = N(), l = typeof e == "string" ? e : s.play, g = typeof r == "string" ? r : s.pause, m = pn({
|
|
709
|
+
playAriaLabel: n ?? l,
|
|
707
710
|
pauseAriaLabel: a ?? g
|
|
708
711
|
});
|
|
709
712
|
return /* @__PURE__ */ d(
|
|
@@ -851,7 +854,7 @@ function br({
|
|
|
851
854
|
onClick: t,
|
|
852
855
|
...i
|
|
853
856
|
}) {
|
|
854
|
-
const { muted: o, toggleMute: u } = j(), s = N(),
|
|
857
|
+
const { muted: o, toggleMute: u } = j(), s = N(), l = r ?? s.mute, g = n ?? s.unmute;
|
|
855
858
|
return /* @__PURE__ */ d(
|
|
856
859
|
"button",
|
|
857
860
|
{
|
|
@@ -862,7 +865,7 @@ function br({
|
|
|
862
865
|
onClick: (m) => {
|
|
863
866
|
u(), t == null || t(m);
|
|
864
867
|
},
|
|
865
|
-
children: o ? g :
|
|
868
|
+
children: o ? g : l
|
|
866
869
|
}
|
|
867
870
|
);
|
|
868
871
|
}
|
|
@@ -875,7 +878,7 @@ function vr({
|
|
|
875
878
|
...a
|
|
876
879
|
}) {
|
|
877
880
|
const { playbackRate: t, setPlaybackRate: i } = j(), o = N(), u = P(
|
|
878
|
-
() => Array.from(/* @__PURE__ */ new Set([...e, t])).sort((s,
|
|
881
|
+
() => Array.from(/* @__PURE__ */ new Set([...e, t])).sort((s, l) => s - l),
|
|
879
882
|
[e, t]
|
|
880
883
|
);
|
|
881
884
|
return /* @__PURE__ */ d(
|
|
@@ -907,7 +910,7 @@ function kr({
|
|
|
907
910
|
style: i,
|
|
908
911
|
...o
|
|
909
912
|
}) {
|
|
910
|
-
const { tracks: u, currentIndex: s, playTrackAt:
|
|
913
|
+
const { tracks: u, currentIndex: s, playTrackAt: l, selectTrackAt: g } = _(), m = r ? { ...i } : {
|
|
911
914
|
listStyle: "none",
|
|
912
915
|
margin: 0,
|
|
913
916
|
padding: 0,
|
|
@@ -923,7 +926,7 @@ function kr({
|
|
|
923
926
|
{
|
|
924
927
|
type: "button",
|
|
925
928
|
onClick: () => {
|
|
926
|
-
t ?
|
|
929
|
+
t ? l(b) : g(b);
|
|
927
930
|
},
|
|
928
931
|
style: {
|
|
929
932
|
width: r ? void 0 : "100%",
|
|
@@ -955,7 +958,7 @@ function Mr({
|
|
|
955
958
|
onClick: o,
|
|
956
959
|
...u
|
|
957
960
|
}) {
|
|
958
|
-
const { playOnSelect: s } = mn(), { tracks:
|
|
961
|
+
const { playOnSelect: s } = mn(), { tracks: l, currentIndex: g, playTrackAt: m, selectTrackAt: y } = _(), k = e === g, b = l[e], S = b != null ? /* @__PURE__ */ Ae("span", { children: [
|
|
959
962
|
b.title,
|
|
960
963
|
b.artist ? ` — ${b.artist}` : ""
|
|
961
964
|
] }) : null;
|
|
@@ -1002,8 +1005,8 @@ const yn = Object.assign(kr, {
|
|
|
1002
1005
|
return (r = e.playlistMeta) == null ? void 0 : r.copyright;
|
|
1003
1006
|
});
|
|
1004
1007
|
function xr({ className: e, style: r, fallback: n, empty: a, unstyled: t = !1, imgStyle: i }) {
|
|
1005
|
-
var
|
|
1006
|
-
const o = I(), u = (
|
|
1008
|
+
var l, g;
|
|
1009
|
+
const o = I(), u = (l = o.playlistMeta) == null ? void 0 : l.artworkUrl;
|
|
1007
1010
|
if (!u) {
|
|
1008
1011
|
const m = a ?? n ?? null;
|
|
1009
1012
|
return m ? /* @__PURE__ */ d("span", { className: e, style: r, children: m }) : null;
|
|
@@ -1085,7 +1088,7 @@ function xn(e, r) {
|
|
|
1085
1088
|
isShuffled: o,
|
|
1086
1089
|
repeatMode: u,
|
|
1087
1090
|
playbackMode: s,
|
|
1088
|
-
volume:
|
|
1091
|
+
volume: l,
|
|
1089
1092
|
muted: g,
|
|
1090
1093
|
playbackRate: m
|
|
1091
1094
|
} = r.payload;
|
|
@@ -1097,7 +1100,7 @@ function xn(e, r) {
|
|
|
1097
1100
|
isShuffled: o ?? !1,
|
|
1098
1101
|
repeatMode: u ?? "off",
|
|
1099
1102
|
playbackMode: s ?? "playlist",
|
|
1100
|
-
volume:
|
|
1103
|
+
volume: l,
|
|
1101
1104
|
muted: g,
|
|
1102
1105
|
playbackRate: m
|
|
1103
1106
|
});
|
|
@@ -1286,28 +1289,28 @@ function Tn(e, r, n) {
|
|
|
1286
1289
|
var s;
|
|
1287
1290
|
const a = r.tracks[r.currentIndex], t = a == null ? void 0 : a.title, i = a == null ? void 0 : a.artist, o = a == null ? void 0 : a.album, u = Qe(a, (s = r.playlistMeta) == null ? void 0 : s.artworkUrl);
|
|
1288
1291
|
E(() => {
|
|
1289
|
-
const
|
|
1290
|
-
!e || !
|
|
1292
|
+
const l = Re();
|
|
1293
|
+
!e || !l || (l.metadata = new MediaMetadata({
|
|
1291
1294
|
title: t ?? "Unknown track",
|
|
1292
1295
|
artist: i,
|
|
1293
1296
|
album: o,
|
|
1294
1297
|
artwork: u ? [{ src: u }] : void 0
|
|
1295
1298
|
}));
|
|
1296
1299
|
}, [e, t, i, o, u]), E(() => {
|
|
1297
|
-
const
|
|
1298
|
-
!e || !
|
|
1300
|
+
const l = Re();
|
|
1301
|
+
!e || !l || (l.playbackState = r.isPaused ? "paused" : "playing");
|
|
1299
1302
|
}, [e, r.isPaused]), E(() => {
|
|
1300
|
-
const
|
|
1301
|
-
if (!(!e || !
|
|
1303
|
+
const l = Re();
|
|
1304
|
+
if (!(!e || !l)) {
|
|
1302
1305
|
try {
|
|
1303
|
-
|
|
1306
|
+
l.setActionHandler("play", n.play), l.setActionHandler("pause", n.pause), l.setActionHandler("nexttrack", n.next), l.setActionHandler("previoustrack", n.prev), l.setActionHandler("seekto", (g) => {
|
|
1304
1307
|
typeof g.seekTime == "number" && Number.isFinite(g.seekTime) && n.seek(g.seekTime);
|
|
1305
1308
|
});
|
|
1306
1309
|
} catch {
|
|
1307
1310
|
}
|
|
1308
1311
|
return () => {
|
|
1309
1312
|
try {
|
|
1310
|
-
|
|
1313
|
+
l.setActionHandler("play", null), l.setActionHandler("pause", null), l.setActionHandler("nexttrack", null), l.setActionHandler("previoustrack", null), l.setActionHandler("seekto", null);
|
|
1311
1314
|
} catch {
|
|
1312
1315
|
}
|
|
1313
1316
|
};
|
|
@@ -1336,7 +1339,7 @@ function En({
|
|
|
1336
1339
|
initialPlaybackMode: o = "playlist",
|
|
1337
1340
|
initialPaused: u = !0,
|
|
1338
1341
|
initialVolume: s = 1,
|
|
1339
|
-
initialMuted:
|
|
1342
|
+
initialMuted: l = !1,
|
|
1340
1343
|
initialPlaybackRate: g = 1,
|
|
1341
1344
|
initialStateKey: m,
|
|
1342
1345
|
locale: y,
|
|
@@ -1356,7 +1359,7 @@ function En({
|
|
|
1356
1359
|
onError: ne
|
|
1357
1360
|
}) {
|
|
1358
1361
|
var Fe;
|
|
1359
|
-
const $ = O(null), [
|
|
1362
|
+
const $ = O(null), [c, h] = wr(
|
|
1360
1363
|
xn,
|
|
1361
1364
|
void 0,
|
|
1362
1365
|
() => Tr({
|
|
@@ -1368,10 +1371,10 @@ function En({
|
|
|
1368
1371
|
repeatMode: i,
|
|
1369
1372
|
playbackMode: o,
|
|
1370
1373
|
volume: s,
|
|
1371
|
-
muted:
|
|
1374
|
+
muted: l,
|
|
1372
1375
|
playbackRate: g
|
|
1373
1376
|
})
|
|
1374
|
-
), Le = O(
|
|
1377
|
+
), Le = O(c), Pe = O({
|
|
1375
1378
|
tracks: r,
|
|
1376
1379
|
currentIndex: n,
|
|
1377
1380
|
playlistMeta: a,
|
|
@@ -1380,7 +1383,7 @@ function En({
|
|
|
1380
1383
|
repeatMode: i,
|
|
1381
1384
|
playbackMode: o,
|
|
1382
1385
|
volume: s,
|
|
1383
|
-
muted:
|
|
1386
|
+
muted: l,
|
|
1384
1387
|
playbackRate: g
|
|
1385
1388
|
});
|
|
1386
1389
|
Pe.current = {
|
|
@@ -1392,7 +1395,7 @@ function En({
|
|
|
1392
1395
|
repeatMode: i,
|
|
1393
1396
|
playbackMode: o,
|
|
1394
1397
|
volume: s,
|
|
1395
|
-
muted:
|
|
1398
|
+
muted: l,
|
|
1396
1399
|
playbackRate: g
|
|
1397
1400
|
};
|
|
1398
1401
|
const X = O(void 0);
|
|
@@ -1424,30 +1427,30 @@ function En({
|
|
|
1424
1427
|
}
|
|
1425
1428
|
});
|
|
1426
1429
|
}, [m, h]), E(() => {
|
|
1427
|
-
Le.current =
|
|
1428
|
-
}, [
|
|
1429
|
-
const De =
|
|
1430
|
+
Le.current = c;
|
|
1431
|
+
}, [c]);
|
|
1432
|
+
const De = c.tracks[c.currentIndex] ?? null;
|
|
1430
1433
|
E(() => {
|
|
1431
|
-
J == null || J(De,
|
|
1432
|
-
}, [De,
|
|
1433
|
-
|
|
1434
|
-
}, [
|
|
1434
|
+
J == null || J(De, c.currentIndex);
|
|
1435
|
+
}, [De, c.currentIndex, J]), E(() => {
|
|
1436
|
+
c.errorMessage && (ne == null || ne(c.errorMessage));
|
|
1437
|
+
}, [c.errorMessage, ne]);
|
|
1435
1438
|
const te = O(void 0);
|
|
1436
1439
|
E(() => {
|
|
1437
1440
|
if (te.current === void 0) {
|
|
1438
|
-
te.current =
|
|
1441
|
+
te.current = c.isPaused;
|
|
1439
1442
|
return;
|
|
1440
1443
|
}
|
|
1441
|
-
te.current !==
|
|
1442
|
-
}, [
|
|
1444
|
+
te.current !== c.isPaused && (c.isPaused ? ee == null || ee() : Z == null || Z()), te.current = c.isPaused;
|
|
1445
|
+
}, [c.isPaused, ee, Z]);
|
|
1443
1446
|
const L = v(() => {
|
|
1444
1447
|
h({ type: "PLAY" });
|
|
1445
1448
|
}, []), D = v(() => {
|
|
1446
1449
|
var f;
|
|
1447
1450
|
h({ type: "PAUSE" }), (f = $.current) == null || f.pause();
|
|
1448
1451
|
}, []), ae = v(() => {
|
|
1449
|
-
|
|
1450
|
-
}, [D, L,
|
|
1452
|
+
c.isPaused ? L() : D();
|
|
1453
|
+
}, [D, L, c.isPaused]), F = v((f) => {
|
|
1451
1454
|
const M = $.current;
|
|
1452
1455
|
M && Number.isFinite(f) && (M.currentTime = Math.max(0, f));
|
|
1453
1456
|
}, []), ie = v((f) => {
|
|
@@ -1508,25 +1511,25 @@ function En({
|
|
|
1508
1511
|
}
|
|
1509
1512
|
});
|
|
1510
1513
|
}, [T, p]), E(() => {
|
|
1511
|
-
p && (p.set("ginger:volume",
|
|
1512
|
-
}, [p,
|
|
1514
|
+
p && (p.set("ginger:volume", c.volume), p.set("ginger:muted", c.muted), p.set("ginger:playbackRate", c.playbackRate), p.set("ginger:repeatMode", c.repeatMode), p.set("ginger:currentIndex", c.currentIndex));
|
|
1515
|
+
}, [p, c.volume, c.muted, c.playbackRate, c.repeatMode, c.currentIndex]), E(() => {
|
|
1513
1516
|
if (!p || !R) return;
|
|
1514
|
-
const f =
|
|
1517
|
+
const f = c.tracks[c.currentIndex];
|
|
1515
1518
|
if (!f) return;
|
|
1516
1519
|
const M = `ginger:resume:${W(f)}`, x = p.get(M);
|
|
1517
1520
|
typeof x == "number" && Number.isFinite(x) && F(x);
|
|
1518
|
-
}, [p, R,
|
|
1521
|
+
}, [p, R, c.currentIndex, c.tracks, F]), E(() => {
|
|
1519
1522
|
if (!p || !R) return;
|
|
1520
|
-
const f =
|
|
1521
|
-
if (!f || !(
|
|
1522
|
-
const M = `ginger:resume:${W(f)}`, x = setTimeout(() => p.set(M,
|
|
1523
|
+
const f = c.tracks[c.currentIndex];
|
|
1524
|
+
if (!f || !(c.currentTime >= 0)) return;
|
|
1525
|
+
const M = `ginger:resume:${W(f)}`, x = setTimeout(() => p.set(M, c.currentTime), 250);
|
|
1523
1526
|
return () => clearTimeout(x);
|
|
1524
|
-
}, [p, R,
|
|
1525
|
-
const Ir = (Fe =
|
|
1527
|
+
}, [p, R, c.currentIndex, c.tracks, c.currentTime]);
|
|
1528
|
+
const Ir = (Fe = c.tracks[c.currentIndex]) == null ? void 0 : Fe.fileUrl;
|
|
1526
1529
|
E(() => {
|
|
1527
1530
|
const f = $.current;
|
|
1528
1531
|
if (!f) return;
|
|
1529
|
-
if (
|
|
1532
|
+
if (c.isPaused) {
|
|
1530
1533
|
f.pause();
|
|
1531
1534
|
return;
|
|
1532
1535
|
}
|
|
@@ -1553,7 +1556,7 @@ function En({
|
|
|
1553
1556
|
})(), () => {
|
|
1554
1557
|
M = !0;
|
|
1555
1558
|
};
|
|
1556
|
-
}, [b, Ir, S,
|
|
1559
|
+
}, [b, Ir, S, c.isPaused]);
|
|
1557
1560
|
const xe = v(() => {
|
|
1558
1561
|
const f = Br(Le.current);
|
|
1559
1562
|
if (f.kind === "replay_same") {
|
|
@@ -1571,10 +1574,10 @@ function En({
|
|
|
1571
1574
|
() => ({ play: L, pause: D, next: Q, prev: H, seek: F }),
|
|
1572
1575
|
[L, D, Q, H, F]
|
|
1573
1576
|
);
|
|
1574
|
-
Tn(!!k,
|
|
1577
|
+
Tn(!!k, c, Er);
|
|
1575
1578
|
const Ar = y != null && y.seek && /[\u0590-\u08FF]/.test(y.seek) ? "rtl" : "ltr", Sr = P(
|
|
1576
1579
|
() => ({
|
|
1577
|
-
state:
|
|
1580
|
+
state: c,
|
|
1578
1581
|
dispatch: h,
|
|
1579
1582
|
audioRef: $,
|
|
1580
1583
|
notifyEnded: xe,
|
|
@@ -1625,20 +1628,20 @@ function En({
|
|
|
1625
1628
|
ve,
|
|
1626
1629
|
ke,
|
|
1627
1630
|
ie,
|
|
1628
|
-
|
|
1631
|
+
c,
|
|
1629
1632
|
ue,
|
|
1630
1633
|
ae,
|
|
1631
1634
|
de
|
|
1632
1635
|
]
|
|
1633
1636
|
), Pr = P(
|
|
1634
1637
|
() => ({
|
|
1635
|
-
tracks:
|
|
1636
|
-
currentIndex:
|
|
1637
|
-
isPaused:
|
|
1638
|
-
isShuffled:
|
|
1639
|
-
repeatMode:
|
|
1640
|
-
originalTracks:
|
|
1641
|
-
playlistMeta:
|
|
1638
|
+
tracks: c.tracks,
|
|
1639
|
+
currentIndex: c.currentIndex,
|
|
1640
|
+
isPaused: c.isPaused,
|
|
1641
|
+
isShuffled: c.isShuffled,
|
|
1642
|
+
repeatMode: c.repeatMode,
|
|
1643
|
+
originalTracks: c.originalTracks,
|
|
1644
|
+
playlistMeta: c.playlistMeta,
|
|
1642
1645
|
init: Me,
|
|
1643
1646
|
play: L,
|
|
1644
1647
|
pause: D,
|
|
@@ -1648,7 +1651,7 @@ function En({
|
|
|
1648
1651
|
setRepeatMode: le,
|
|
1649
1652
|
cycleRepeat: ce,
|
|
1650
1653
|
toggleShuffle: de,
|
|
1651
|
-
playbackMode:
|
|
1654
|
+
playbackMode: c.playbackMode,
|
|
1652
1655
|
setQueue: fe,
|
|
1653
1656
|
insertTrackAt: pe,
|
|
1654
1657
|
removeTrackAt: ge,
|
|
@@ -1661,14 +1664,14 @@ function En({
|
|
|
1661
1664
|
dispatch: h
|
|
1662
1665
|
}),
|
|
1663
1666
|
[
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1667
|
+
c.tracks,
|
|
1668
|
+
c.currentIndex,
|
|
1669
|
+
c.isPaused,
|
|
1670
|
+
c.isShuffled,
|
|
1671
|
+
c.repeatMode,
|
|
1672
|
+
c.playbackMode,
|
|
1673
|
+
c.originalTracks,
|
|
1674
|
+
c.playlistMeta,
|
|
1672
1675
|
Me,
|
|
1673
1676
|
L,
|
|
1674
1677
|
D,
|
|
@@ -1691,14 +1694,14 @@ function En({
|
|
|
1691
1694
|
]
|
|
1692
1695
|
), Rr = P(
|
|
1693
1696
|
() => ({
|
|
1694
|
-
currentTime:
|
|
1695
|
-
duration:
|
|
1696
|
-
bufferedFraction:
|
|
1697
|
-
isBuffering:
|
|
1698
|
-
errorMessage:
|
|
1699
|
-
volume:
|
|
1700
|
-
muted:
|
|
1701
|
-
playbackRate:
|
|
1697
|
+
currentTime: c.currentTime,
|
|
1698
|
+
duration: c.duration,
|
|
1699
|
+
bufferedFraction: c.bufferedFraction,
|
|
1700
|
+
isBuffering: c.isBuffering,
|
|
1701
|
+
errorMessage: c.errorMessage,
|
|
1702
|
+
volume: c.volume,
|
|
1703
|
+
muted: c.muted,
|
|
1704
|
+
playbackRate: c.playbackRate,
|
|
1702
1705
|
seek: F,
|
|
1703
1706
|
setVolume: ie,
|
|
1704
1707
|
setMuted: oe,
|
|
@@ -1709,14 +1712,14 @@ function En({
|
|
|
1709
1712
|
dispatch: h
|
|
1710
1713
|
}),
|
|
1711
1714
|
[
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1715
|
+
c.currentTime,
|
|
1716
|
+
c.duration,
|
|
1717
|
+
c.bufferedFraction,
|
|
1718
|
+
c.isBuffering,
|
|
1719
|
+
c.errorMessage,
|
|
1720
|
+
c.volume,
|
|
1721
|
+
c.muted,
|
|
1722
|
+
c.playbackRate,
|
|
1720
1723
|
F,
|
|
1721
1724
|
ie,
|
|
1722
1725
|
oe,
|
|
@@ -1726,7 +1729,7 @@ function En({
|
|
|
1726
1729
|
xe,
|
|
1727
1730
|
h
|
|
1728
1731
|
]
|
|
1729
|
-
), _r = He(
|
|
1732
|
+
), _r = He(c), Gr = P(
|
|
1730
1733
|
() => w ? K : { ...In, ...K },
|
|
1731
1734
|
[K, w]
|
|
1732
1735
|
);
|
|
@@ -1815,4 +1818,4 @@ export {
|
|
|
1815
1818
|
zr as r,
|
|
1816
1819
|
sn as u
|
|
1817
1820
|
};
|
|
1818
|
-
//# sourceMappingURL=ginger-
|
|
1821
|
+
//# sourceMappingURL=ginger-BoNnuade.js.map
|