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