@banou/media-player 0.10.19 → 0.10.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -22
- package/dist/audio/loudness-analysis.d.ts +30 -0
- package/dist/audio/volume-normalizer.d.ts +4 -2
- package/dist/index.js +841 -623
- package/dist/react/hooks/use-volume-normalizer.d.ts +5 -1
- package/dist/react/video-player.d.ts +11 -7
- package/dist/volume-normalizer-worklet.js +1190 -78
- package/package.json +1 -1
- package/src/lib/audio/loudness-analysis.ts +274 -0
- package/src/lib/audio/volume-normalizer-worklet.d.ts +49 -0
- package/src/lib/audio/volume-normalizer-worklet.js +1190 -78
- package/src/lib/audio/volume-normalizer.ts +5 -3
- package/src/lib/react/components/chrome.tsx +31 -6
- package/src/lib/react/components/control-bar.tsx +1 -0
- package/src/lib/react/hooks/use-volume-normalizer.ts +37 -2
- package/src/lib/react/video-player.tsx +39 -11
package/dist/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Children as
|
|
3
|
-
import { css as
|
|
4
|
-
import { createPlayer as
|
|
5
|
-
import { definePlayerFeature as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { c as e, l as t, n, o as r, r as i, s as a, t as o, u as s } from "./engine-C4Gj_4zs.js";
|
|
2
|
+
import { Children as c, Fragment as l, isValidElement as u, useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h, useSyncExternalStore as g } from "react";
|
|
3
|
+
import { css as _, keyframes as v } from "@emotion/react";
|
|
4
|
+
import { createPlayer as y, useContainerAttach as b, useMediaAttach as x } from "@videojs/react";
|
|
5
|
+
import { definePlayerFeature as S, videoFeatures as C } from "@videojs/core/dom";
|
|
6
|
+
import { makeRemuxer as w } from "libav-wasm";
|
|
7
|
+
import { createMediaElementSource as T } from "@banou/ponyfill/web-audio";
|
|
8
|
+
import { Fragment as E, jsx as D, jsxs as O } from "@emotion/react/jsx-runtime";
|
|
9
|
+
import { Captions as k, CaptionsOff as A, Check as j, ChevronLeft as M, ChevronRight as N, Copy as P, Maximize as F, Minimize as I, Pause as L, Play as R, RotateCcw as z, Settings as B, TriangleAlert as V, Volume1 as H, Volume2 as ee, VolumeX as te } from "lucide-react";
|
|
10
|
+
import { Tooltip as U } from "react-tooltip";
|
|
10
11
|
//#region src/lib/react/source-feature.ts
|
|
11
|
-
var
|
|
12
|
+
var W = {
|
|
12
13
|
indexes: [],
|
|
13
14
|
chapters: [],
|
|
14
15
|
thumbnails: [],
|
|
@@ -33,19 +34,19 @@ var ne = {
|
|
|
33
34
|
playbackErrors: [],
|
|
34
35
|
ready: !1,
|
|
35
36
|
setSourceState: () => {}
|
|
36
|
-
},
|
|
37
|
+
}, G = S({
|
|
37
38
|
name: "source",
|
|
38
|
-
state: () => ({ ...
|
|
39
|
+
state: () => ({ ...W }),
|
|
39
40
|
attach({ set: e }) {
|
|
40
41
|
e({
|
|
41
42
|
setSourceState: (t) => e(t),
|
|
42
43
|
setHideUI: (t) => e({ hideUI: t })
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
|
-
}),
|
|
46
|
-
features: [...
|
|
46
|
+
}), K = y({
|
|
47
|
+
features: [...C, G],
|
|
47
48
|
displayName: "MediaPlayer"
|
|
48
|
-
}),
|
|
49
|
+
}), q = K.usePlayer, ne = (e) => {
|
|
49
50
|
if (e && e !== "und") try {
|
|
50
51
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
51
52
|
type: "language",
|
|
@@ -54,76 +55,76 @@ var ne = {
|
|
|
54
55
|
} catch {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
},
|
|
58
|
-
let t = e.map((e) =>
|
|
58
|
+
}, J = (e) => e?.replace(/_/g, " ").trim() || void 0, Y = (e) => {
|
|
59
|
+
let t = e.map((e) => ne(e.language) ?? J(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
59
60
|
...e,
|
|
60
61
|
[t]: (e[t] ?? 0) + 1
|
|
61
62
|
}), {});
|
|
62
63
|
return e.map((e, r) => {
|
|
63
|
-
let i = t[r], a =
|
|
64
|
+
let i = t[r], a = J(e.title);
|
|
64
65
|
return {
|
|
65
66
|
track: e,
|
|
66
67
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
67
68
|
};
|
|
68
69
|
});
|
|
69
|
-
},
|
|
70
|
+
}, re = (e) => Y(e).map(({ track: e, label: t }) => ({
|
|
70
71
|
id: e.streamIndex,
|
|
71
72
|
label: t
|
|
72
|
-
})),
|
|
73
|
+
})), X = [
|
|
73
74
|
0,
|
|
74
75
|
250,
|
|
75
76
|
1e3,
|
|
76
77
|
3e3,
|
|
77
78
|
1e4
|
|
78
|
-
],
|
|
79
|
+
], ie = 6e4, ae = 500, oe = 15e3, se = (e) => e instanceof Error ? e.message : String(e), ce = (e) => {
|
|
79
80
|
let t = [], n = e?.cause;
|
|
80
81
|
for (let e = 0; n != null && e < 8; e++) {
|
|
81
82
|
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
82
83
|
t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
85
|
-
t.push(
|
|
86
|
+
t.push(se(n)), n = n?.cause;
|
|
86
87
|
}
|
|
87
88
|
return t.length ? t.join("\n") : void 0;
|
|
88
|
-
},
|
|
89
|
-
let
|
|
89
|
+
}, le = (e, t, n) => {
|
|
90
|
+
let i = q(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: u = "", jassubWasmUrl: p = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, chapters: b, seekPrepareBudgetMs: x = ae } = n ?? {}, S = m(b);
|
|
90
91
|
S.current = b;
|
|
91
|
-
let [C, w] =
|
|
92
|
+
let [C, w] = h(void 0), [T, E] = h(0), D = m({
|
|
92
93
|
count: 0,
|
|
93
94
|
at: 0
|
|
94
|
-
}), O =
|
|
95
|
-
|
|
95
|
+
}), O = m(void 0);
|
|
96
|
+
f(() => (D.current = {
|
|
96
97
|
count: 0,
|
|
97
98
|
at: 0
|
|
98
|
-
},
|
|
99
|
+
}, i.setSourceState({ playbackErrors: [] }), () => {
|
|
99
100
|
O.current && clearTimeout(O.current);
|
|
100
101
|
}), [s]);
|
|
101
|
-
let k =
|
|
102
|
+
let k = m(null), A = m(null), j = m(!1), M = m(o);
|
|
102
103
|
M.current = o;
|
|
103
|
-
let N =
|
|
104
|
-
N.current =
|
|
105
|
-
let P =
|
|
106
|
-
P.current =
|
|
107
|
-
let F =
|
|
104
|
+
let N = m(n?.onSeek);
|
|
105
|
+
N.current = n?.onSeek;
|
|
106
|
+
let P = m(n?.onPlaybackError);
|
|
107
|
+
P.current = n?.onPlaybackError;
|
|
108
|
+
let F = d((e) => {
|
|
108
109
|
let t = typeof e == "number" ? e : void 0;
|
|
109
|
-
j.current = !0,
|
|
110
|
-
}, [
|
|
110
|
+
j.current = !0, i.setSourceState({ selectedSubtitleTrack: t }), k.current?.selectSubtitleStream(t);
|
|
111
|
+
}, [i]), I = d((e) => {
|
|
111
112
|
let t = k.current;
|
|
112
113
|
if (!t || x <= 0) {
|
|
113
|
-
|
|
114
|
+
i.seek(e);
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
116
|
-
let n = typeof window < "u" && window.__mediaPlayerSeekDebug, r = performance.now(),
|
|
117
|
-
if (!
|
|
117
|
+
let n = typeof window < "u" && window.__mediaPlayerSeekDebug, r = performance.now(), a = !1, o = "prepared", s = () => {
|
|
118
|
+
if (!a && (a = !0, i.seek(e), n)) {
|
|
118
119
|
let n = t.videoElement, i = 0;
|
|
119
120
|
if (n) for (let t = 0; t < n.buffered.length; t++) n.buffered.start(t) <= e + 1 && e < n.buffered.end(t) && (i = n.buffered.end(t) - e);
|
|
120
121
|
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - r)}ms via ${o}, runway ${i.toFixed(1)}s${o === "deadline" ? " (EXPOSED: moved before its data was ready)" : ""}`);
|
|
121
122
|
}
|
|
122
123
|
};
|
|
123
|
-
|
|
124
|
+
i.setSourceState({ seekingTo: e });
|
|
124
125
|
let c = t.videoElement, l = () => {
|
|
125
|
-
c?.removeEventListener("seeked", l), clearTimeout(u),
|
|
126
|
-
}, u = setTimeout(l,
|
|
126
|
+
c?.removeEventListener("seeked", l), clearTimeout(u), i.setSourceState({ seekingTo: void 0 });
|
|
127
|
+
}, u = setTimeout(l, oe);
|
|
127
128
|
c?.addEventListener("seeked", l);
|
|
128
129
|
let d = setTimeout(() => {
|
|
129
130
|
o = "deadline", s();
|
|
@@ -131,10 +132,10 @@ var ne = {
|
|
|
131
132
|
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
132
133
|
clearTimeout(d), s();
|
|
133
134
|
});
|
|
134
|
-
}, [
|
|
135
|
-
typeof e == "number" && (
|
|
136
|
-
}, [
|
|
137
|
-
|
|
135
|
+
}, [i, x]), L = d((e) => {
|
|
136
|
+
typeof e == "number" && (i.setSourceState({ selectedAudioTrack: e }), w(e));
|
|
137
|
+
}, [i]), R = q((e) => e.setSourceState);
|
|
138
|
+
f(() => {
|
|
138
139
|
R({
|
|
139
140
|
selectSubtitleTrack: F,
|
|
140
141
|
selectAudioTrack: L,
|
|
@@ -145,22 +146,22 @@ var ne = {
|
|
|
145
146
|
F,
|
|
146
147
|
L,
|
|
147
148
|
I
|
|
148
|
-
]),
|
|
149
|
+
]), f(() => {
|
|
149
150
|
if (!e || !t || !s || !o) return;
|
|
150
|
-
let
|
|
151
|
-
|
|
151
|
+
let n = !1;
|
|
152
|
+
i.setSourceState({
|
|
152
153
|
playbackError: null,
|
|
153
154
|
ready: !1
|
|
154
155
|
});
|
|
155
|
-
let
|
|
156
|
-
let r = Date.now(),
|
|
157
|
-
if (c && c.message ===
|
|
156
|
+
let d = (t, n) => {
|
|
157
|
+
let r = Date.now(), a = se(t), o = ce(t), s = i.playbackErrors, c = s[s.length - 1];
|
|
158
|
+
if (c && c.message === a && c.detail === o && c.recovered === n) {
|
|
158
159
|
let e = {
|
|
159
160
|
...c,
|
|
160
161
|
count: c.count + 1,
|
|
161
162
|
lastAt: r
|
|
162
163
|
};
|
|
163
|
-
|
|
164
|
+
i.setSourceState({ playbackErrors: [...s.slice(0, -1), e] });
|
|
164
165
|
return;
|
|
165
166
|
}
|
|
166
167
|
let l = {
|
|
@@ -168,96 +169,96 @@ var ne = {
|
|
|
168
169
|
lastAt: r,
|
|
169
170
|
count: 1,
|
|
170
171
|
atMediaTime: Number.isFinite(e.currentTime) ? e.currentTime : void 0,
|
|
171
|
-
message:
|
|
172
|
+
message: a,
|
|
172
173
|
detail: o,
|
|
173
174
|
recovered: n
|
|
174
175
|
};
|
|
175
|
-
|
|
176
|
-
},
|
|
177
|
-
if (
|
|
178
|
-
let t =
|
|
179
|
-
if (
|
|
176
|
+
i.setSourceState({ playbackErrors: [...s, l] });
|
|
177
|
+
}, f = (e) => {
|
|
178
|
+
if (n) return;
|
|
179
|
+
let t = r(e);
|
|
180
|
+
if (d(e, t), t) {
|
|
180
181
|
let t = performance.now();
|
|
181
|
-
t - D.current.at >
|
|
182
|
+
t - D.current.at > ie && (D.current = {
|
|
182
183
|
count: 0,
|
|
183
184
|
at: t
|
|
184
185
|
});
|
|
185
|
-
let n =
|
|
186
|
+
let n = X[Math.min(D.current.count, X.length - 1)];
|
|
186
187
|
D.current = {
|
|
187
188
|
count: D.current.count + 1,
|
|
188
189
|
at: t
|
|
189
190
|
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), O.current && clearTimeout(O.current), O.current = setTimeout(() => E((e) => e + 1), n);
|
|
190
191
|
return;
|
|
191
192
|
}
|
|
192
|
-
console.error("playback failed", e),
|
|
193
|
+
console.error("playback failed", e), i.setSourceState({ playbackError: e }), P.current?.(e);
|
|
193
194
|
};
|
|
194
195
|
return (async () => {
|
|
195
196
|
try {
|
|
196
|
-
let
|
|
197
|
+
let r = await a({
|
|
197
198
|
videoElement: e,
|
|
198
199
|
subtitleContainer: t,
|
|
199
200
|
read: (e, t) => M.current(e, t),
|
|
200
201
|
length: s,
|
|
201
202
|
publicPath: c,
|
|
202
203
|
libavWorkerUrl: l,
|
|
203
|
-
jassubWorkerUrl:
|
|
204
|
-
jassubWasmUrl:
|
|
204
|
+
jassubWorkerUrl: u,
|
|
205
|
+
jassubWasmUrl: p,
|
|
205
206
|
jassubLegacyWasmUrl: g,
|
|
206
207
|
defaultFontUrl: _,
|
|
207
208
|
bufferSize: v,
|
|
208
209
|
audioStreamIndex: C,
|
|
209
210
|
onReady: () => {
|
|
210
|
-
if (
|
|
211
|
-
|
|
211
|
+
if (n) return;
|
|
212
|
+
i.setSourceState({ ready: !0 });
|
|
212
213
|
let t = A.current;
|
|
213
214
|
A.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
|
|
214
215
|
},
|
|
215
|
-
onError:
|
|
216
|
+
onError: f,
|
|
216
217
|
onRecovered: () => {
|
|
217
|
-
|
|
218
|
+
n || i.setSourceState({ playbackError: null });
|
|
218
219
|
},
|
|
219
220
|
onSeek: (e) => N.current?.(e),
|
|
220
221
|
onSubtitleStreams: (e) => {
|
|
221
|
-
|
|
222
|
-
subtitleTracks:
|
|
222
|
+
n || i.setSourceState({
|
|
223
|
+
subtitleTracks: re(e),
|
|
223
224
|
...j.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
224
225
|
});
|
|
225
226
|
},
|
|
226
227
|
onAudioStreams: (e, t) => {
|
|
227
|
-
|
|
228
|
-
audioTracks:
|
|
228
|
+
n || i.setSourceState({
|
|
229
|
+
audioTracks: re(e),
|
|
229
230
|
selectedAudioTrack: t
|
|
230
231
|
});
|
|
231
232
|
}
|
|
232
233
|
});
|
|
233
|
-
if (
|
|
234
|
-
|
|
234
|
+
if (n) {
|
|
235
|
+
r.destroy();
|
|
235
236
|
return;
|
|
236
237
|
}
|
|
237
|
-
k.current =
|
|
238
|
-
indexes:
|
|
239
|
-
chapters: S.current ??
|
|
238
|
+
k.current = r, i.setSourceState({
|
|
239
|
+
indexes: r.indexes,
|
|
240
|
+
chapters: S.current ?? r.chapters
|
|
240
241
|
});
|
|
241
|
-
let o =
|
|
242
|
-
typeof o == "number" &&
|
|
242
|
+
let o = i.selectedSubtitleTrack;
|
|
243
|
+
typeof o == "number" && r.selectSubtitleStream(o);
|
|
243
244
|
} catch (e) {
|
|
244
|
-
|
|
245
|
+
f(e);
|
|
245
246
|
}
|
|
246
247
|
})(), () => {
|
|
247
|
-
|
|
248
|
+
n = !0, A.current = {
|
|
248
249
|
time: e.currentTime,
|
|
249
250
|
size: s
|
|
250
|
-
}, k.current?.destroy(), k.current = null,
|
|
251
|
+
}, k.current?.destroy(), k.current = null, i.setSourceState({ ready: !1 });
|
|
251
252
|
};
|
|
252
253
|
}, [
|
|
253
|
-
|
|
254
|
+
i,
|
|
254
255
|
e,
|
|
255
256
|
t,
|
|
256
257
|
s,
|
|
257
258
|
c,
|
|
258
259
|
l,
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
u,
|
|
261
|
+
p,
|
|
261
262
|
g,
|
|
262
263
|
_,
|
|
263
264
|
v,
|
|
@@ -265,14 +266,14 @@ var ne = {
|
|
|
265
266
|
y,
|
|
266
267
|
T
|
|
267
268
|
]);
|
|
268
|
-
},
|
|
269
|
-
let [o, s] =
|
|
270
|
-
l.current =
|
|
271
|
-
let
|
|
272
|
-
return g.current =
|
|
273
|
-
if (!n || !
|
|
274
|
-
let a = !1, o = null, u, d =
|
|
275
|
-
|
|
269
|
+
}, ue = 5e3, de = 6e4, fe = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: a }) => {
|
|
270
|
+
let [o, s] = h([]), c = m(null), l = m(r);
|
|
271
|
+
l.current = r;
|
|
272
|
+
let u = p(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = m(u);
|
|
273
|
+
return g.current = u, f(() => {
|
|
274
|
+
if (!n || !r || !e || !t) return;
|
|
275
|
+
let a = !1, o = null, u, d = ue, f = () => {
|
|
276
|
+
i({
|
|
276
277
|
publicPath: e,
|
|
277
278
|
workerUrl: t,
|
|
278
279
|
length: n,
|
|
@@ -287,7 +288,7 @@ var ne = {
|
|
|
287
288
|
}
|
|
288
289
|
o = e, c.current = e, e.update(g.current);
|
|
289
290
|
}, () => {
|
|
290
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
291
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, de));
|
|
291
292
|
});
|
|
292
293
|
};
|
|
293
294
|
return f(), () => {
|
|
@@ -297,70 +298,70 @@ var ne = {
|
|
|
297
298
|
n,
|
|
298
299
|
e,
|
|
299
300
|
t
|
|
300
|
-
]),
|
|
301
|
-
c.current?.update(
|
|
302
|
-
}, [
|
|
301
|
+
]), f(() => {
|
|
302
|
+
c.current?.update(u);
|
|
303
|
+
}, [u]), {
|
|
303
304
|
thumbnails: o,
|
|
304
|
-
requestThumbnail:
|
|
305
|
+
requestThumbnail: d((e) => {
|
|
305
306
|
c.current?.prioritize(e);
|
|
306
307
|
}, [])
|
|
307
308
|
};
|
|
308
|
-
},
|
|
309
|
-
let r =
|
|
310
|
-
|
|
311
|
-
if (!e || !
|
|
312
|
-
let
|
|
309
|
+
}, pe = (e, t) => {
|
|
310
|
+
let r = m(null), [i, a] = h(!1), [s] = h(() => n());
|
|
311
|
+
f(() => {
|
|
312
|
+
if (!e || !t || !s) return;
|
|
313
|
+
let n = o({
|
|
313
314
|
video: e,
|
|
314
|
-
subtitles:
|
|
315
|
+
subtitles: t,
|
|
315
316
|
mode: s,
|
|
316
|
-
onBurnedInChange:
|
|
317
|
+
onBurnedInChange: a
|
|
317
318
|
});
|
|
318
|
-
return r.current =
|
|
319
|
-
|
|
319
|
+
return r.current = n, () => {
|
|
320
|
+
n.destroy(), r.current = null, a(!1);
|
|
320
321
|
};
|
|
321
322
|
}, [
|
|
322
323
|
e,
|
|
323
|
-
|
|
324
|
+
t,
|
|
324
325
|
s
|
|
325
326
|
]);
|
|
326
|
-
let c =
|
|
327
|
+
let c = d(() => {
|
|
327
328
|
r.current?.toggle().catch((e) => {
|
|
328
329
|
console.warn("picture in picture was refused", e);
|
|
329
330
|
});
|
|
330
331
|
}, []);
|
|
331
332
|
return {
|
|
332
|
-
toggle: e &&
|
|
333
|
+
toggle: e && t && s ? c : null,
|
|
333
334
|
mode: s,
|
|
334
335
|
burnedIn: i
|
|
335
336
|
};
|
|
336
|
-
},
|
|
337
|
-
let t =
|
|
337
|
+
}, me = "(hover: hover) and (pointer: fine)", he = () => typeof matchMedia == "function" ? matchMedia(me) : void 0, ge = (e) => {
|
|
338
|
+
let t = he();
|
|
338
339
|
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
339
|
-
},
|
|
340
|
-
let [n, r] =
|
|
340
|
+
}, _e = () => !!he()?.matches, ve = () => !1, ye = (e, t) => {
|
|
341
|
+
let [n, r] = h(!1), [i, a] = h(), o = m(t);
|
|
341
342
|
t && (o.current = t);
|
|
342
|
-
let s =
|
|
343
|
+
let s = m(!1), c = d((e) => {
|
|
343
344
|
s.current !== e && (s.current = e, o.current?.onArmedChange(e));
|
|
344
|
-
}, []), l =
|
|
345
|
+
}, []), l = d((t) => {
|
|
345
346
|
!e || e.readyState < 1 || e.error || (a(t), c(!0));
|
|
346
|
-
}, [e, c]),
|
|
347
|
+
}, [e, c]), u = d(() => {
|
|
347
348
|
a(void 0), c(!1);
|
|
348
349
|
}, [c]), _ = !!t && !!e;
|
|
349
|
-
|
|
350
|
+
f(() => {
|
|
350
351
|
if (!_ || !e) return;
|
|
351
352
|
let t = () => {
|
|
352
|
-
r(!0),
|
|
353
|
+
r(!0), u();
|
|
353
354
|
}, n = () => r(!1);
|
|
354
355
|
return e.addEventListener("enterpictureinpicture", t), e.addEventListener("leavepictureinpicture", n), () => {
|
|
355
|
-
e.removeEventListener("enterpictureinpicture", t), e.removeEventListener("leavepictureinpicture", n), r(!1),
|
|
356
|
+
e.removeEventListener("enterpictureinpicture", t), e.removeEventListener("leavepictureinpicture", n), r(!1), u();
|
|
356
357
|
};
|
|
357
358
|
}, [
|
|
358
359
|
e,
|
|
359
360
|
_,
|
|
360
|
-
|
|
361
|
+
u
|
|
361
362
|
]);
|
|
362
|
-
let v =
|
|
363
|
-
|
|
363
|
+
let v = g(ge, _e, ve), [y, b] = h(!1);
|
|
364
|
+
f(() => {
|
|
364
365
|
if (!_) return;
|
|
365
366
|
let e = (e) => {
|
|
366
367
|
e.pointerType === "touch" && b(!0);
|
|
@@ -378,38 +379,38 @@ var ne = {
|
|
|
378
379
|
};
|
|
379
380
|
}, [_]);
|
|
380
381
|
let x = _ && v && !y;
|
|
381
|
-
|
|
382
|
-
x ||
|
|
383
|
-
}, [x,
|
|
384
|
-
let S =
|
|
382
|
+
f(() => {
|
|
383
|
+
x || u();
|
|
384
|
+
}, [x, u]);
|
|
385
|
+
let S = d(() => {
|
|
385
386
|
Promise.resolve(e?.exitPictureInPicture?.()).catch((e) => {
|
|
386
387
|
console.warn("leaving picture in picture was refused", e);
|
|
387
388
|
});
|
|
388
389
|
}, [e]);
|
|
389
|
-
return
|
|
390
|
+
return p(() => x ? {
|
|
390
391
|
active: n,
|
|
391
392
|
armed: i,
|
|
392
393
|
arm: l,
|
|
393
|
-
disarm:
|
|
394
|
+
disarm: u,
|
|
394
395
|
exit: S
|
|
395
396
|
} : null, [
|
|
396
397
|
x,
|
|
397
398
|
n,
|
|
398
399
|
i,
|
|
399
400
|
l,
|
|
400
|
-
|
|
401
|
+
u,
|
|
401
402
|
S
|
|
402
403
|
]);
|
|
403
|
-
},
|
|
404
|
+
}, be = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
|
|
404
405
|
channelCountMode: "max",
|
|
405
406
|
processorOptions: n
|
|
406
|
-
})),
|
|
407
|
+
})), xe = /* @__PURE__ */ new WeakMap(), Se = (e) => new Promise((t, n) => {
|
|
407
408
|
let r = () => {
|
|
408
409
|
(e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
|
|
409
410
|
};
|
|
410
411
|
e.addEventListener("statechange", r), r();
|
|
411
|
-
}),
|
|
412
|
-
let r =
|
|
412
|
+
}), Ce = (e, t, n = {}) => {
|
|
413
|
+
let r = xe.get(e);
|
|
413
414
|
if (r) return r.wake(), r;
|
|
414
415
|
let i = new AudioContext(), a = n.enabled !== !1, o, s = !1, c = () => 20 * Math.log10(Math.max(e.volume, 1e-6)), l = e.ownerDocument, u = () => {
|
|
415
416
|
i.state === "suspended" && i.resume().catch(() => {});
|
|
@@ -425,13 +426,13 @@ var ne = {
|
|
|
425
426
|
};
|
|
426
427
|
i.addEventListener("statechange", f), f();
|
|
427
428
|
let p = (async () => {
|
|
428
|
-
let r = await
|
|
429
|
+
let r = await be(i, t, {
|
|
429
430
|
...n,
|
|
430
431
|
enabled: a,
|
|
431
432
|
inputGainDb: c()
|
|
432
433
|
});
|
|
433
|
-
await
|
|
434
|
-
let s =
|
|
434
|
+
await Se(i);
|
|
435
|
+
let s = T(i, e);
|
|
435
436
|
return r.port.postMessage({
|
|
436
437
|
enabled: a,
|
|
437
438
|
inputGainDb: c()
|
|
@@ -447,32 +448,226 @@ var ne = {
|
|
|
447
448
|
a = e, o?.port.postMessage({ enabled: a });
|
|
448
449
|
},
|
|
449
450
|
release: () => {
|
|
450
|
-
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (
|
|
451
|
+
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (xe.delete(e), i.close().catch(() => {}));
|
|
451
452
|
},
|
|
452
453
|
wake: () => {
|
|
453
454
|
i.state !== "closed" && (s = !1, u(), f());
|
|
454
455
|
}
|
|
455
456
|
};
|
|
456
|
-
return
|
|
457
|
-
},
|
|
458
|
-
let
|
|
459
|
-
|
|
457
|
+
return xe.set(e, m), m;
|
|
458
|
+
}, we = 20, Te = 5, Ee = 1, De = 50, Oe = ({ node: t, element: n, scriptUrl: r, source: i }) => {
|
|
459
|
+
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
460
|
+
for (let e of [...c]) e();
|
|
461
|
+
c.clear();
|
|
462
|
+
}, u = () => new Promise((e) => c.add(e)), d = (e, t) => !o || o.some(([n, r]) => n <= e && Math.min(e + t, i.length) <= r), f = async (e, t) => {
|
|
463
|
+
for (; !d(e, t);) if (a || await new Promise((e) => s.add(e))) throw Error("Cancelled");
|
|
464
|
+
return i.read(e, t);
|
|
465
|
+
}, p = (e) => {
|
|
466
|
+
for (let t of [...s]) t(e);
|
|
467
|
+
s.clear();
|
|
468
|
+
}, m;
|
|
469
|
+
try {
|
|
470
|
+
m = new Worker(r, { type: "module" });
|
|
471
|
+
} catch (e) {
|
|
472
|
+
return console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), {
|
|
473
|
+
update: () => {},
|
|
474
|
+
stop: () => {}
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
let h = new MessageChannel();
|
|
478
|
+
m.postMessage({
|
|
479
|
+
type: "port",
|
|
480
|
+
port: h.port1
|
|
481
|
+
}, [h.port1]), t.port.postMessage({ analysis: h.port2 }, [h.port2]);
|
|
482
|
+
let g = {
|
|
483
|
+
spans: [],
|
|
484
|
+
end: null
|
|
485
|
+
}, _ = 0, v = /* @__PURE__ */ new Map(), y = (e, t) => new Promise((n) => v.set(`${e}:${t}`, n)), b = -1;
|
|
486
|
+
m.onmessage = ({ data: e }) => {
|
|
487
|
+
if (e.type === "unsupported") {
|
|
488
|
+
U();
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(g.spans) || e.end !== g.end) && _++, g = {
|
|
492
|
+
spans: e.spans,
|
|
493
|
+
end: e.end
|
|
494
|
+
}), e.type === "merged" && (b = e.run), v.get(`${e.type}:${e.run}`)?.(g), v.delete(`${e.type}:${e.run}`), l();
|
|
495
|
+
};
|
|
496
|
+
let x = t.context, S = () => t.port.postMessage({
|
|
497
|
+
media: n.currentTime,
|
|
498
|
+
ctx: x.currentTime,
|
|
499
|
+
rate: n.playbackRate,
|
|
500
|
+
paused: n.paused || n.seeking || n.readyState < 3
|
|
501
|
+
}), C = () => m.postMessage({
|
|
502
|
+
type: "playhead",
|
|
503
|
+
time: n.currentTime
|
|
504
|
+
}), T = setInterval(S, De), E = [
|
|
505
|
+
"play",
|
|
506
|
+
"playing",
|
|
507
|
+
"pause",
|
|
508
|
+
"seeking",
|
|
509
|
+
"seeked",
|
|
510
|
+
"ratechange",
|
|
511
|
+
"waiting",
|
|
512
|
+
"ended"
|
|
513
|
+
];
|
|
514
|
+
for (let e of E) n.addEventListener(e, S);
|
|
515
|
+
let D = Infinity, O = !1, k = 0, A = !1, j = 0, M = 0, N = /* @__PURE__ */ new Map(), P = (e) => {
|
|
516
|
+
let t = e;
|
|
517
|
+
for (let [e, n] of g.spans) e <= t && t < n && (t = n);
|
|
518
|
+
return t >= (g.end ?? D) - .05 ? null : t;
|
|
519
|
+
}, F = (e) => N.get(Math.round(e * 10)) === _ ? "idle" : e, I = () => {
|
|
520
|
+
let e = n.currentTime, t = P(e), r = A && b !== k;
|
|
521
|
+
if (t !== null && t < e + we) return r && j <= t + 1 && t <= M + Te ? "read" : F(t);
|
|
522
|
+
if (r) return "read";
|
|
523
|
+
let i = t ?? P(0);
|
|
524
|
+
return i === null ? "done" : F(i);
|
|
525
|
+
}, L = () => {}, R = (e) => (e.catch(() => {}), Promise.race([e, new Promise((e) => {
|
|
526
|
+
L = () => e(void 0);
|
|
527
|
+
})])), z = () => {
|
|
528
|
+
C(), O && s.size && typeof I() == "number" && L(), l();
|
|
529
|
+
}, B = () => {
|
|
530
|
+
C(), l();
|
|
531
|
+
};
|
|
532
|
+
n.addEventListener("seeking", z), n.addEventListener("seeked", B), n.addEventListener("timeupdate", B);
|
|
533
|
+
let V, H = async (e) => {
|
|
534
|
+
if (!A) return;
|
|
535
|
+
A = !1;
|
|
536
|
+
let t = y("ended", k);
|
|
537
|
+
m.postMessage({
|
|
538
|
+
type: "end",
|
|
539
|
+
run: k,
|
|
540
|
+
finished: e
|
|
541
|
+
}), await t;
|
|
542
|
+
}, ee = async (e) => {
|
|
543
|
+
if (M = e.pts + e.duration, !e.data.byteLength) return;
|
|
544
|
+
let t = y("ack", k);
|
|
545
|
+
m.postMessage({
|
|
546
|
+
type: "fragment",
|
|
547
|
+
run: k,
|
|
548
|
+
data: e.data
|
|
549
|
+
}, [e.data]), await t;
|
|
550
|
+
}, te = async () => {
|
|
551
|
+
if (V = await w({
|
|
552
|
+
publicPath: i.publicPath,
|
|
553
|
+
workerUrl: i.libavWorkerUrl,
|
|
554
|
+
workerOptions: { type: "module" },
|
|
555
|
+
length: i.length,
|
|
556
|
+
read: f,
|
|
557
|
+
audioStreamIndex: i.audioStreamIndex
|
|
558
|
+
}), a) return e(V);
|
|
559
|
+
let t = await V.init();
|
|
560
|
+
if (!a) {
|
|
561
|
+
for (D = t.info.input.duration || Infinity, m.postMessage({
|
|
562
|
+
type: "init",
|
|
563
|
+
data: t.data,
|
|
564
|
+
codec: t.info.output.audioMimeType
|
|
565
|
+
}, [t.data]), A = !0, O = !0, m.postMessage({
|
|
566
|
+
type: "run",
|
|
567
|
+
run: k,
|
|
568
|
+
pts: 0,
|
|
569
|
+
start: !0
|
|
570
|
+
}); !a;) {
|
|
571
|
+
let e = I();
|
|
572
|
+
if (e === "done") break;
|
|
573
|
+
if (e === "idle") {
|
|
574
|
+
await u();
|
|
575
|
+
continue;
|
|
576
|
+
}
|
|
577
|
+
try {
|
|
578
|
+
if (e === "read") {
|
|
579
|
+
let e = await R(V.read());
|
|
580
|
+
if (a) return;
|
|
581
|
+
if (!e) continue;
|
|
582
|
+
await ee(e), e.finished && await H(!0);
|
|
583
|
+
} else {
|
|
584
|
+
await H(!1), N.set(Math.round(e * 10), _);
|
|
585
|
+
let t = V.seek(Math.max(0, e - Ee));
|
|
586
|
+
p(!0);
|
|
587
|
+
let n = await R(t);
|
|
588
|
+
if (a) return;
|
|
589
|
+
if (!n) continue;
|
|
590
|
+
k++, A = !0, j = n.pts, m.postMessage({
|
|
591
|
+
type: "run",
|
|
592
|
+
run: k,
|
|
593
|
+
pts: n.pts,
|
|
594
|
+
start: n.pts <= 0
|
|
595
|
+
}), await ee(n), n.finished && await H(!0);
|
|
596
|
+
}
|
|
597
|
+
} catch {
|
|
598
|
+
if (a) return;
|
|
599
|
+
await H(!1), typeof I() != "number" && await u();
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
e(V), V = void 0;
|
|
603
|
+
}
|
|
604
|
+
}, U = () => {
|
|
605
|
+
if (!a) {
|
|
606
|
+
a = !0, p(!0), l(), clearInterval(T);
|
|
607
|
+
for (let e of E) n.removeEventListener(e, S);
|
|
608
|
+
n.removeEventListener("seeking", z), n.removeEventListener("seeked", B), n.removeEventListener("timeupdate", B), V && e(V), m.terminate(), t.port.postMessage({ analysis: null });
|
|
609
|
+
for (let e of v.values()) e(g);
|
|
610
|
+
v.clear();
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
return te().catch((e) => {
|
|
614
|
+
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), U());
|
|
615
|
+
}), C(), {
|
|
616
|
+
update: (e) => {
|
|
617
|
+
o = e, p(!1);
|
|
618
|
+
},
|
|
619
|
+
stop: U
|
|
620
|
+
};
|
|
621
|
+
}, ke = (e, t, n, r, i) => {
|
|
622
|
+
let a = m(null), [o, s] = h(!1), [c, l] = h(null);
|
|
623
|
+
f(() => {
|
|
460
624
|
if (e && t) {
|
|
461
|
-
if (n && !
|
|
462
|
-
let
|
|
463
|
-
|
|
464
|
-
|
|
625
|
+
if (n && !a.current) {
|
|
626
|
+
let r = Ce(e, t, { enabled: n });
|
|
627
|
+
a.current = r, r.routed.then((e) => {
|
|
628
|
+
a.current === r && l(e);
|
|
629
|
+
}, (e) => {
|
|
630
|
+
a.current === r && (console.warn("[media-player] the volume normalizer is unavailable:", e), s(!0));
|
|
465
631
|
});
|
|
466
632
|
}
|
|
467
|
-
|
|
633
|
+
a.current?.setEnabled(n);
|
|
468
634
|
}
|
|
469
635
|
}, [
|
|
470
636
|
e,
|
|
471
637
|
t,
|
|
472
638
|
n
|
|
473
|
-
]),
|
|
474
|
-
|
|
475
|
-
}, [e])
|
|
639
|
+
]), f(() => () => {
|
|
640
|
+
a.current?.release(), a.current = null, l(null);
|
|
641
|
+
}, [e]);
|
|
642
|
+
let u = m(i);
|
|
643
|
+
u.current = i;
|
|
644
|
+
let d = m(null), p = m(r);
|
|
645
|
+
p.current = r;
|
|
646
|
+
let { length: g, publicPath: _, libavWorkerUrl: v, audioStreamIndex: y } = r ?? {};
|
|
647
|
+
return f(() => {
|
|
648
|
+
let r = p.current;
|
|
649
|
+
if (!c || !e || !t || !n || !r) return;
|
|
650
|
+
let i = Oe({
|
|
651
|
+
node: c,
|
|
652
|
+
element: e,
|
|
653
|
+
scriptUrl: t,
|
|
654
|
+
source: r
|
|
655
|
+
});
|
|
656
|
+
return i.update(u.current), d.current = i, () => {
|
|
657
|
+
i.stop(), d.current = null;
|
|
658
|
+
};
|
|
659
|
+
}, [
|
|
660
|
+
c,
|
|
661
|
+
e,
|
|
662
|
+
t,
|
|
663
|
+
n,
|
|
664
|
+
g,
|
|
665
|
+
_,
|
|
666
|
+
v,
|
|
667
|
+
y
|
|
668
|
+
]), f(() => {
|
|
669
|
+
d.current?.update(i);
|
|
670
|
+
}, [i]), { refused: o };
|
|
476
671
|
}, Z = {
|
|
477
672
|
headings: {
|
|
478
673
|
large: "\n font-weight: 600;\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(3.4 * var(--mp-unit));\n line-height: calc(4.1 * var(--mp-unit));\n }\n ",
|
|
@@ -500,7 +695,7 @@ var ne = {
|
|
|
500
695
|
medium: "\n font-weight: 500;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n ",
|
|
501
696
|
regular: "\n font-weight: 400;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n "
|
|
502
697
|
}
|
|
503
|
-
},
|
|
698
|
+
}, Ae = _`
|
|
504
699
|
display: flex;
|
|
505
700
|
justify-content: center;
|
|
506
701
|
align-items: center;
|
|
@@ -513,7 +708,7 @@ var ne = {
|
|
|
513
708
|
margin: auto;
|
|
514
709
|
pointer-events: none;
|
|
515
710
|
}
|
|
516
|
-
`,
|
|
711
|
+
`, je = _`
|
|
517
712
|
position: absolute;
|
|
518
713
|
top: 0;
|
|
519
714
|
left: 0;
|
|
@@ -542,9 +737,9 @@ var ne = {
|
|
|
542
737
|
|
|
543
738
|
background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
|
|
544
739
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
545
|
-
`,
|
|
740
|
+
`, Me = v`
|
|
546
741
|
to { transform: rotate(360deg); }
|
|
547
|
-
`,
|
|
742
|
+
`, Ne = _`
|
|
548
743
|
position: absolute;
|
|
549
744
|
inset: 0;
|
|
550
745
|
z-index: 2;
|
|
@@ -560,9 +755,9 @@ var ne = {
|
|
|
560
755
|
border-radius: 50%;
|
|
561
756
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
562
757
|
border-top-color: #fff;
|
|
563
|
-
animation: ${
|
|
758
|
+
animation: ${Me} 0.8s linear infinite;
|
|
564
759
|
}
|
|
565
|
-
`,
|
|
760
|
+
`, Pe = _`
|
|
566
761
|
position: absolute;
|
|
567
762
|
inset: auto 0 20%;
|
|
568
763
|
z-index: 3;
|
|
@@ -572,34 +767,34 @@ var ne = {
|
|
|
572
767
|
${Z.bLarge.regular}
|
|
573
768
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
574
769
|
pointer-events: none;
|
|
575
|
-
`,
|
|
576
|
-
let t =
|
|
577
|
-
return /* @__PURE__ */ E
|
|
578
|
-
t ? /* @__PURE__ */
|
|
770
|
+
`, Fe = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Ie = ({ onSubtitleRef: e }) => {
|
|
771
|
+
let t = q((e) => e.title), n = q((e) => e.hideUI), r = q((e) => e.playbackError), i = q((e) => e.ready), a = q((e) => e.size), o = q((e) => e.waiting), s = q((e) => e.seekingTo);
|
|
772
|
+
return /* @__PURE__ */ O(E, { children: [
|
|
773
|
+
t ? /* @__PURE__ */ D("div", {
|
|
579
774
|
className: "title",
|
|
580
|
-
css:
|
|
775
|
+
css: je,
|
|
581
776
|
style: { ...n ? {
|
|
582
777
|
opacity: "0",
|
|
583
778
|
pointerEvents: "none"
|
|
584
779
|
} : {} },
|
|
585
780
|
children: t
|
|
586
781
|
}) : void 0,
|
|
587
|
-
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */
|
|
588
|
-
r ? /* @__PURE__ */
|
|
589
|
-
css:
|
|
590
|
-
children:
|
|
782
|
+
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css: Ne }) : void 0,
|
|
783
|
+
r ? /* @__PURE__ */ D("div", {
|
|
784
|
+
css: Pe,
|
|
785
|
+
children: Fe(r)
|
|
591
786
|
}) : void 0,
|
|
592
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ D("div", {
|
|
593
788
|
className: "subtitles",
|
|
594
789
|
ref: e,
|
|
595
|
-
css:
|
|
790
|
+
css: Ae
|
|
596
791
|
})
|
|
597
792
|
] });
|
|
598
|
-
},
|
|
793
|
+
}, Le = 1e-4, Re = 1, ze = (e) => Math.max(Le, Math.min(Re, e)) ** 2, Be = (e) => Math.max(Le, Math.min(Re, e)) ** (Re / 2), Ve = (e) => {
|
|
599
794
|
if (e === void 0) return "0:00";
|
|
600
795
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
601
796
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
602
|
-
},
|
|
797
|
+
}, He = (e, t) => `${Ve(e)} / ${Ve(t)}`, Ue = (e) => _`
|
|
603
798
|
display: flex;
|
|
604
799
|
justify-content: flex-start;
|
|
605
800
|
|
|
@@ -634,30 +829,30 @@ var ne = {
|
|
|
634
829
|
${Z.bMedium.regular}
|
|
635
830
|
}
|
|
636
831
|
|
|
637
|
-
${e === "sm" &&
|
|
832
|
+
${e === "sm" && _`
|
|
638
833
|
padding: calc(0.4 * var(--mp-unit))!important;
|
|
639
834
|
`}
|
|
640
|
-
${e === "md" &&
|
|
835
|
+
${e === "md" && _`
|
|
641
836
|
padding: calc(0.6 * var(--mp-unit))!important;
|
|
642
837
|
`}
|
|
643
|
-
${e === "lg" &&
|
|
838
|
+
${e === "lg" && _`
|
|
644
839
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
645
840
|
`}
|
|
646
841
|
`, Q = {
|
|
647
842
|
x: -1,
|
|
648
843
|
y: -1,
|
|
649
844
|
anchors: 0
|
|
650
|
-
},
|
|
845
|
+
}, We = (e) => {
|
|
651
846
|
Q.x = e.clientX, Q.y = e.clientY;
|
|
652
|
-
},
|
|
847
|
+
}, Ge = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", We, {
|
|
653
848
|
capture: !0,
|
|
654
849
|
passive: !0
|
|
655
850
|
}), () => {
|
|
656
|
-
--Q.anchors === 0 && window.removeEventListener("pointermove",
|
|
851
|
+
--Q.anchors === 0 && window.removeEventListener("pointermove", We, { capture: !0 });
|
|
657
852
|
}), $ = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
658
|
-
let l =
|
|
659
|
-
return
|
|
660
|
-
let e =
|
|
853
|
+
let l = m(null), u = m(null);
|
|
854
|
+
return f(() => {
|
|
855
|
+
let e = Ge(), t = () => {
|
|
661
856
|
let e = l.current;
|
|
662
857
|
if (!e) return;
|
|
663
858
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
@@ -668,7 +863,7 @@ var ne = {
|
|
|
668
863
|
e();
|
|
669
864
|
for (let e of n) document.removeEventListener(e, t);
|
|
670
865
|
};
|
|
671
|
-
}, []), /* @__PURE__ */ E
|
|
866
|
+
}, []), /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
|
|
672
867
|
ref: l,
|
|
673
868
|
"data-tooltip-id": e,
|
|
674
869
|
"data-open": !0,
|
|
@@ -677,22 +872,22 @@ var ne = {
|
|
|
677
872
|
"data-tooltip-delay-hide": i,
|
|
678
873
|
"data-tooltip-place": o,
|
|
679
874
|
children: n
|
|
680
|
-
}), !s && /* @__PURE__ */
|
|
875
|
+
}), !s && /* @__PURE__ */ D(U, {
|
|
681
876
|
ref: u,
|
|
682
|
-
css:
|
|
877
|
+
css: Ue(c),
|
|
683
878
|
id: e,
|
|
684
879
|
noArrow: !0,
|
|
685
880
|
children: t
|
|
686
881
|
})] });
|
|
687
|
-
},
|
|
688
|
-
let [i, a] =
|
|
882
|
+
}, Ke = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
883
|
+
let [i, a] = h(!1), o = m(t);
|
|
689
884
|
o.current = t;
|
|
690
|
-
let s =
|
|
885
|
+
let s = m(null), c = d((t, r) => {
|
|
691
886
|
let i = e.current;
|
|
692
887
|
if (!i) return 0;
|
|
693
888
|
let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
|
|
694
889
|
return Math.min(Math.max(l, 0), 1);
|
|
695
|
-
}, [e, n]), l =
|
|
890
|
+
}, [e, n]), l = d((e) => {
|
|
696
891
|
if (!(r || e.button > 0)) {
|
|
697
892
|
s.current = e.pointerId;
|
|
698
893
|
try {
|
|
@@ -700,9 +895,9 @@ var ne = {
|
|
|
700
895
|
} catch {}
|
|
701
896
|
a(!0), o.current(c(e.clientX, e.clientY));
|
|
702
897
|
}
|
|
703
|
-
}, [r, c]),
|
|
898
|
+
}, [r, c]), u = d((e) => {
|
|
704
899
|
s.current === e.pointerId && o.current(c(e.clientX, e.clientY));
|
|
705
|
-
}, [c]),
|
|
900
|
+
}, [c]), p = d((e) => {
|
|
706
901
|
if (s.current === e.pointerId) {
|
|
707
902
|
s.current = null;
|
|
708
903
|
try {
|
|
@@ -711,38 +906,38 @@ var ne = {
|
|
|
711
906
|
a(!1);
|
|
712
907
|
}
|
|
713
908
|
}, []);
|
|
714
|
-
return
|
|
909
|
+
return f(() => {
|
|
715
910
|
r && (s.current = null, a(!1));
|
|
716
911
|
}, [r]), {
|
|
717
912
|
dragging: i,
|
|
718
913
|
handlers: {
|
|
719
914
|
onPointerDown: l,
|
|
720
|
-
onPointerMove:
|
|
721
|
-
onPointerUp:
|
|
722
|
-
onPointerCancel:
|
|
915
|
+
onPointerMove: u,
|
|
916
|
+
onPointerUp: p,
|
|
917
|
+
onPointerCancel: p,
|
|
723
918
|
style: { touchAction: "none" }
|
|
724
919
|
}
|
|
725
920
|
};
|
|
726
|
-
},
|
|
921
|
+
}, qe = 2, Je = .005, Ye = "#000", Xe = "#0000", Ze = (e, t) => {
|
|
727
922
|
if (!t) return [];
|
|
728
923
|
let n = /* @__PURE__ */ new Set();
|
|
729
924
|
for (let { start: r, end: i } of e) for (let e of [r, i]) {
|
|
730
925
|
let r = e / t;
|
|
731
|
-
r <=
|
|
926
|
+
r <= Je || r >= .995 || n.add(Number((r * 100).toFixed(4)));
|
|
732
927
|
}
|
|
733
928
|
return n.size ? [
|
|
734
929
|
0,
|
|
735
930
|
...[...n].sort((e, t) => e - t),
|
|
736
931
|
100
|
|
737
932
|
] : [];
|
|
738
|
-
},
|
|
739
|
-
let n =
|
|
933
|
+
}, Qe = (e, t) => {
|
|
934
|
+
let n = qe / 2, r = e.length - 2, i = [];
|
|
740
935
|
for (let a = 0; a <= r; a += 1) {
|
|
741
936
|
let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
|
|
742
|
-
i.push(`${t(a) ?
|
|
937
|
+
i.push(`${t(a) ? Ye : Xe} ${c} ${l}`), a !== r && i.push(`${Xe} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
|
|
743
938
|
}
|
|
744
939
|
return `linear-gradient(90deg, ${i.join(", ")})`;
|
|
745
|
-
},
|
|
940
|
+
}, $e = /* @__PURE__ */ new Set([
|
|
746
941
|
"op",
|
|
747
942
|
"ops",
|
|
748
943
|
"opening",
|
|
@@ -750,7 +945,7 @@ var ne = {
|
|
|
750
945
|
"ncop",
|
|
751
946
|
"オープニング",
|
|
752
947
|
"op主題歌"
|
|
753
|
-
]),
|
|
948
|
+
]), et = /* @__PURE__ */ new Set([
|
|
754
949
|
"ed",
|
|
755
950
|
"eds",
|
|
756
951
|
"ending",
|
|
@@ -763,13 +958,13 @@ var ne = {
|
|
|
763
958
|
"エンドカード",
|
|
764
959
|
"エンドロール",
|
|
765
960
|
"ed主題歌"
|
|
766
|
-
]),
|
|
961
|
+
]), tt = /* @__PURE__ */ new Set(["intro", "イントロ"]), nt = /* @__PURE__ */ new Set(["outro", "アウトロ"]), rt = {
|
|
767
962
|
"credits start": "ending",
|
|
768
963
|
"credits end": null,
|
|
769
964
|
"preview end": null,
|
|
770
965
|
"end credits": "ending",
|
|
771
966
|
"closing credits": "ending"
|
|
772
|
-
},
|
|
967
|
+
}, it = /* @__PURE__ */ new Set([
|
|
773
968
|
"theme",
|
|
774
969
|
"themes",
|
|
775
970
|
"song",
|
|
@@ -788,53 +983,53 @@ var ne = {
|
|
|
788
983
|
"the",
|
|
789
984
|
"主題歌",
|
|
790
985
|
"ノンクレジット"
|
|
791
|
-
]),
|
|
986
|
+
]), at = /* @__PURE__ */ new Set([
|
|
792
987
|
"post",
|
|
793
988
|
"pre",
|
|
794
989
|
"after",
|
|
795
990
|
"before",
|
|
796
991
|
"non"
|
|
797
|
-
]),
|
|
798
|
-
if (
|
|
799
|
-
if (
|
|
992
|
+
]), ot = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, st = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), ct = (e) => e.replace(/([a-z-ヿ一-鿿])\s*\d+\s*$/u, "$1").split(/[\s_]+/u).map((e) => e.replace(/^[^\w-ヿ一-鿿]+|[^\w-ヿ一-鿿]+$/gu, "")).filter((e) => e && !/^\d+$/.test(e) && !it.has(e)), lt = (e, t) => {
|
|
993
|
+
if ($e.has(e)) return "opening";
|
|
994
|
+
if (et.has(e)) return "ending";
|
|
800
995
|
if (t) {
|
|
801
|
-
if (
|
|
802
|
-
if (
|
|
996
|
+
if (tt.has(e)) return "opening";
|
|
997
|
+
if (nt.has(e)) return "ending";
|
|
803
998
|
}
|
|
804
|
-
},
|
|
805
|
-
if (
|
|
999
|
+
}, ut = (e, t) => {
|
|
1000
|
+
if (st(e)) return;
|
|
806
1001
|
let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
|
|
807
|
-
if (n in
|
|
808
|
-
let r = n.split(
|
|
809
|
-
if (r.some((e) => e.split(/[\s_]+/u).some((e) =>
|
|
1002
|
+
if (n in rt) return rt[n] ?? void 0;
|
|
1003
|
+
let r = n.split(ot).map((e) => e.trim()).filter(Boolean);
|
|
1004
|
+
if (r.some((e) => e.split(/[\s_]+/u).some((e) => at.has(e)))) return;
|
|
810
1005
|
let i = r.length > 1 ? [r[0], r.at(-1)] : r;
|
|
811
1006
|
for (let e of i) {
|
|
812
|
-
let n =
|
|
1007
|
+
let n = ct(e);
|
|
813
1008
|
if (n.length !== 1) continue;
|
|
814
|
-
let r =
|
|
1009
|
+
let r = lt(n[0], t);
|
|
815
1010
|
if (r) return r;
|
|
816
1011
|
}
|
|
817
|
-
},
|
|
1012
|
+
}, dt = 15, ft = 87, pt = 93, mt = (e) => {
|
|
818
1013
|
let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
|
|
819
1014
|
if (!n) return t;
|
|
820
1015
|
let r = e.map((e, t) => ({
|
|
821
1016
|
index: t,
|
|
822
1017
|
start: e.start,
|
|
823
1018
|
length: e.end - e.start
|
|
824
|
-
})).filter(({ length: e }) => e >=
|
|
1019
|
+
})).filter(({ length: e }) => e >= ft && e <= pt), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
|
|
825
1020
|
return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
|
|
826
|
-
},
|
|
827
|
-
let t = e.map(({ title: e }) =>
|
|
1021
|
+
}, ht = (e) => {
|
|
1022
|
+
let t = e.map(({ title: e }) => ut(e, !1)), n = e.reduce((e, n, r) => e + (t[r] ? n.end - n.start : 0), 0), r = e.reduce((e, t) => e + (t.end - t.start), 0);
|
|
828
1023
|
if (r > 0 && n * 2 > r) return e.map(() => void 0);
|
|
829
1024
|
let i = e.map((e, n) => {
|
|
830
|
-
if (e.end - e.start <
|
|
1025
|
+
if (e.end - e.start < dt) return;
|
|
831
1026
|
let r = t[n];
|
|
832
1027
|
if (r) return r;
|
|
833
|
-
let i =
|
|
1028
|
+
let i = ut(e.title, !0);
|
|
834
1029
|
return i && !t.includes(i) ? i : void 0;
|
|
835
1030
|
});
|
|
836
|
-
return e.every(({ title: e }) =>
|
|
837
|
-
},
|
|
1031
|
+
return e.every(({ title: e }) => st(e)) ? mt(e) : i;
|
|
1032
|
+
}, gt = _`
|
|
838
1033
|
position: relative;
|
|
839
1034
|
height: calc(.4 * var(--mp-unit));
|
|
840
1035
|
|
|
@@ -1053,27 +1248,27 @@ var ne = {
|
|
|
1053
1248
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1054
1249
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1055
1250
|
}
|
|
1056
|
-
`,
|
|
1057
|
-
let e =
|
|
1251
|
+
`, _t = 4, vt = () => {
|
|
1252
|
+
let e = q(), t = q((e) => e.currentTime), n = q((e) => e.requestSeek), r = q((e) => e.duration), i = q((e) => e.size), a = q((e) => e.downloadedRanges), o = q((e) => e.buffered), s = q((e) => e.indexes), c = q((e) => e.thumbnails), l = q((e) => e.thumbnailAt), u = q((e) => e.requestThumbnail), d = q((e) => e.chapters), g = q((e) => e.seekingTo), _ = q((e) => e.setSourceState), v = q((e) => e.hideUI), y = m(null), [b, x] = h(void 0), [S, C] = h(void 0), w = (e) => {
|
|
1058
1253
|
C(e), u(e);
|
|
1059
|
-
},
|
|
1060
|
-
|
|
1061
|
-
if (
|
|
1062
|
-
}, [_,
|
|
1254
|
+
}, T = !!S;
|
|
1255
|
+
f(() => {
|
|
1256
|
+
if (T) return _({ seekPreview: !0 }), () => _({ seekPreview: !1 });
|
|
1257
|
+
}, [_, T]), f(() => {
|
|
1063
1258
|
v && w(void 0);
|
|
1064
1259
|
}, [v]);
|
|
1065
|
-
let
|
|
1260
|
+
let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } = Ke({
|
|
1066
1261
|
ref: y,
|
|
1067
1262
|
onChange: (e) => {
|
|
1068
1263
|
if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
|
|
1069
1264
|
else if (!M.current) {
|
|
1070
1265
|
let t = y.current?.getBoundingClientRect().width ?? 0;
|
|
1071
|
-
Math.abs(e - j.current) * t >
|
|
1266
|
+
Math.abs(e - j.current) * t > _t && (M.current = !0);
|
|
1072
1267
|
}
|
|
1073
|
-
x(e),
|
|
1268
|
+
x(e), E.current !== "mouse" && w(e * r);
|
|
1074
1269
|
}
|
|
1075
1270
|
}), F = (e) => {
|
|
1076
|
-
|
|
1271
|
+
E.current = e.pointerType, k.current = 0, j.current = void 0, M.current = !1, P.onPointerDown(e);
|
|
1077
1272
|
}, I = (t) => {
|
|
1078
1273
|
P.onPointerUp(t);
|
|
1079
1274
|
let i = k.current > 0 ? A.current : void 0;
|
|
@@ -1086,25 +1281,25 @@ var ne = {
|
|
|
1086
1281
|
if (!y.current) return;
|
|
1087
1282
|
let { left: t, right: n } = y.current.getBoundingClientRect();
|
|
1088
1283
|
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
1089
|
-
}, R =
|
|
1284
|
+
}, R = m("mouse"), z = (e) => {
|
|
1090
1285
|
R.current = e.pointerType;
|
|
1091
|
-
},
|
|
1286
|
+
}, B = (e) => {
|
|
1092
1287
|
R.current !== "touch" && w(L(e.clientX));
|
|
1093
|
-
},
|
|
1288
|
+
}, V = () => {
|
|
1094
1289
|
y.current && w(void 0);
|
|
1095
|
-
},
|
|
1290
|
+
}, H = (e) => r ? e / r * 100 : 0, ee = (e, t, n) => {
|
|
1096
1291
|
let r = Number((n - t).toFixed(4)), i = t * 100;
|
|
1097
|
-
return /* @__PURE__ */
|
|
1292
|
+
return /* @__PURE__ */ D("div", {
|
|
1098
1293
|
className: "loaded-part",
|
|
1099
1294
|
style: {
|
|
1100
1295
|
transform: `scaleX(${r})`,
|
|
1101
1296
|
marginLeft: `${i}%`
|
|
1102
1297
|
}
|
|
1103
1298
|
}, e);
|
|
1104
|
-
},
|
|
1299
|
+
}, te = p(() => i === void 0 ? r ? o.map(([e, t], n) => ee(n, e / r, t / r)) : [] : a?.map((e, t) => {
|
|
1105
1300
|
if (!i || !r) return null;
|
|
1106
1301
|
let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
|
|
1107
|
-
return !a || !o ? null :
|
|
1302
|
+
return !a || !o ? null : ee(t, a.timestamp / r, o.timestamp / r);
|
|
1108
1303
|
}) ?? [], [
|
|
1109
1304
|
r,
|
|
1110
1305
|
i,
|
|
@@ -1112,7 +1307,7 @@ var ne = {
|
|
|
1112
1307
|
s.length,
|
|
1113
1308
|
a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
1114
1309
|
]);
|
|
1115
|
-
|
|
1310
|
+
f(() => {
|
|
1116
1311
|
b !== void 0 && r && N && M.current && e.seek(b * r);
|
|
1117
1312
|
}, [
|
|
1118
1313
|
e,
|
|
@@ -1120,7 +1315,7 @@ var ne = {
|
|
|
1120
1315
|
b,
|
|
1121
1316
|
r
|
|
1122
1317
|
]);
|
|
1123
|
-
let
|
|
1318
|
+
let U = p(() => {
|
|
1124
1319
|
if (!r) return 0;
|
|
1125
1320
|
if (N && b !== void 0) return b;
|
|
1126
1321
|
let e = g ?? t;
|
|
@@ -1131,22 +1326,22 @@ var ne = {
|
|
|
1131
1326
|
N,
|
|
1132
1327
|
b,
|
|
1133
1328
|
g
|
|
1134
|
-
]),
|
|
1329
|
+
]), W = p(() => Ze(d, r), [d, r]), G = W.length > 0, K = p(() => {
|
|
1135
1330
|
if (!G || S === void 0 || !r) return -1;
|
|
1136
|
-
let e = S / r * 100, t =
|
|
1137
|
-
return t >= 0 ? t :
|
|
1331
|
+
let e = S / r * 100, t = W.findIndex((t, n) => n < W.length - 1 && e >= t && e < W[n + 1]);
|
|
1332
|
+
return t >= 0 ? t : W.length - 2;
|
|
1138
1333
|
}, [
|
|
1139
1334
|
G,
|
|
1140
|
-
|
|
1335
|
+
W,
|
|
1141
1336
|
S,
|
|
1142
1337
|
r
|
|
1143
|
-
]),
|
|
1338
|
+
]), ne = p(() => G ? Qe(W, (e) => e !== K) : void 0, [
|
|
1144
1339
|
G,
|
|
1145
|
-
|
|
1340
|
+
W,
|
|
1146
1341
|
K
|
|
1147
|
-
]), J =
|
|
1148
|
-
if (S !== void 0) return
|
|
1149
|
-
}, [
|
|
1342
|
+
]), J = p(() => K >= 0 ? Qe(W, (e) => e === K) : void 0, [W, K]), Y = p(() => {
|
|
1343
|
+
if (S !== void 0) return d.find(({ start: e, end: t }) => e <= S && S < t);
|
|
1344
|
+
}, [d, S]), re = p(() => {
|
|
1150
1345
|
if (S) {
|
|
1151
1346
|
if (l) return l(S);
|
|
1152
1347
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= S && S < t);
|
|
@@ -1155,26 +1350,26 @@ var ne = {
|
|
|
1155
1350
|
c,
|
|
1156
1351
|
l,
|
|
1157
1352
|
S
|
|
1158
|
-
]),
|
|
1353
|
+
]), X = (e, t) => /* @__PURE__ */ O("div", {
|
|
1159
1354
|
className: e ? `track ${e}` : "track",
|
|
1160
1355
|
style: t ? { maskImage: t } : void 0,
|
|
1161
1356
|
children: [
|
|
1162
|
-
/* @__PURE__ */
|
|
1163
|
-
/* @__PURE__ */
|
|
1357
|
+
/* @__PURE__ */ D("div", { className: "background-bar" }),
|
|
1358
|
+
/* @__PURE__ */ D("div", {
|
|
1164
1359
|
className: "loaded",
|
|
1165
|
-
children:
|
|
1360
|
+
children: te
|
|
1166
1361
|
}),
|
|
1167
|
-
/* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ D("div", {
|
|
1168
1363
|
className: "play-container",
|
|
1169
|
-
children: /* @__PURE__ */
|
|
1364
|
+
children: /* @__PURE__ */ D("div", {
|
|
1170
1365
|
className: "play",
|
|
1171
|
-
style: { transform: `scaleX(${
|
|
1366
|
+
style: { transform: `scaleX(${U})` }
|
|
1172
1367
|
})
|
|
1173
1368
|
})
|
|
1174
1369
|
]
|
|
1175
1370
|
});
|
|
1176
|
-
return /* @__PURE__ */
|
|
1177
|
-
css:
|
|
1371
|
+
return /* @__PURE__ */ O("div", {
|
|
1372
|
+
css: gt,
|
|
1178
1373
|
ref: y,
|
|
1179
1374
|
className: [
|
|
1180
1375
|
"progress-bar",
|
|
@@ -1183,43 +1378,43 @@ var ne = {
|
|
|
1183
1378
|
].filter(Boolean).join(" "),
|
|
1184
1379
|
onPointerDown: z,
|
|
1185
1380
|
onPointerMove: z,
|
|
1186
|
-
onMouseMove:
|
|
1187
|
-
onMouseOut:
|
|
1381
|
+
onMouseMove: B,
|
|
1382
|
+
onMouseOut: V,
|
|
1188
1383
|
children: [
|
|
1189
|
-
|
|
1190
|
-
S ? /* @__PURE__ */
|
|
1384
|
+
X(void 0, ne),
|
|
1385
|
+
S ? /* @__PURE__ */ O("div", {
|
|
1191
1386
|
className: "cursor-time",
|
|
1192
1387
|
style: {
|
|
1193
|
-
left: Y ? `clamp(var(--thumbnail-half), ${
|
|
1388
|
+
left: Y ? `clamp(var(--thumbnail-half), ${H(S)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${H(S)}%, calc(100% - calc(3 * var(--mp-unit))))`,
|
|
1194
1389
|
maxWidth: Y ? "var(--thumbnail-width)" : void 0
|
|
1195
1390
|
},
|
|
1196
|
-
children: [/* @__PURE__ */
|
|
1391
|
+
children: [/* @__PURE__ */ D("span", {
|
|
1197
1392
|
className: "cursor-time-value",
|
|
1198
|
-
children:
|
|
1199
|
-
}), Y ? /* @__PURE__ */
|
|
1393
|
+
children: Ve(S)
|
|
1394
|
+
}), Y ? /* @__PURE__ */ D("span", {
|
|
1200
1395
|
className: "chapter-title",
|
|
1201
1396
|
children: Y.title
|
|
1202
1397
|
}) : void 0]
|
|
1203
1398
|
}) : void 0,
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1206
|
-
J ?
|
|
1207
|
-
/* @__PURE__ */
|
|
1208
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ D("div", { className: "progress" }),
|
|
1400
|
+
/* @__PURE__ */ D("div", { className: "hover" }),
|
|
1401
|
+
J ? X("focus", J) : void 0,
|
|
1402
|
+
/* @__PURE__ */ D("div", { className: "scrubber" }),
|
|
1403
|
+
/* @__PURE__ */ D("div", {
|
|
1209
1404
|
className: "padding",
|
|
1210
1405
|
...P,
|
|
1211
1406
|
onPointerDown: F,
|
|
1212
1407
|
onPointerUp: I,
|
|
1213
1408
|
onPointerCancel: I
|
|
1214
1409
|
}),
|
|
1215
|
-
/* @__PURE__ */
|
|
1410
|
+
/* @__PURE__ */ D("div", {
|
|
1216
1411
|
className: "thumbnail",
|
|
1217
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
1218
|
-
children:
|
|
1412
|
+
style: { left: `clamp(var(--thumbnail-half), ${H(S ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1413
|
+
children: re?.url ? /* @__PURE__ */ D("img", { src: re.url }) : void 0
|
|
1219
1414
|
})
|
|
1220
1415
|
]
|
|
1221
1416
|
});
|
|
1222
|
-
},
|
|
1417
|
+
}, yt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23fff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='icon%20icon-tabler%20icons-tabler-outline%20icon-tabler-picture-in-picture'%3e%3cpath%20stroke='none'%20d='M0%200h24v24H0z'%20fill='none'%20/%3e%3cpath%20d='M11%2019h-6a2%202%200%200%201%20-2%20-2v-10a2%202%200%200%201%202%20-2h14a2%202%200%200%201%202%202v4'%20/%3e%3cpath%20d='M14%2014m0%201a1%201%200%200%201%201%20-1h5a1%201%200%200%201%201%201v3a1%201%200%200%201%20-1%201h-5a1%201%200%200%201%20-1%20-1z'%20/%3e%3c/svg%3e", bt = {
|
|
1223
1418
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1224
1419
|
width: 24,
|
|
1225
1420
|
height: 24,
|
|
@@ -1229,12 +1424,12 @@ var ne = {
|
|
|
1229
1424
|
strokeWidth: 2,
|
|
1230
1425
|
strokeLinecap: "round",
|
|
1231
1426
|
strokeLinejoin: "round"
|
|
1232
|
-
},
|
|
1233
|
-
...
|
|
1427
|
+
}, xt = (e) => /* @__PURE__ */ O("svg", {
|
|
1428
|
+
...bt,
|
|
1234
1429
|
...e,
|
|
1235
1430
|
children: [
|
|
1236
|
-
/* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1431
|
+
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
1432
|
+
/* @__PURE__ */ D("rect", {
|
|
1238
1433
|
x: "12",
|
|
1239
1434
|
y: "13",
|
|
1240
1435
|
width: "10",
|
|
@@ -1242,14 +1437,14 @@ var ne = {
|
|
|
1242
1437
|
rx: "1",
|
|
1243
1438
|
ry: "1"
|
|
1244
1439
|
}),
|
|
1245
|
-
/* @__PURE__ */
|
|
1440
|
+
/* @__PURE__ */ D("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1246
1441
|
]
|
|
1247
|
-
}),
|
|
1248
|
-
...
|
|
1442
|
+
}), St = (e) => /* @__PURE__ */ O("svg", {
|
|
1443
|
+
...bt,
|
|
1249
1444
|
...e,
|
|
1250
1445
|
children: [
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
/* @__PURE__ */
|
|
1446
|
+
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
1447
|
+
/* @__PURE__ */ D("rect", {
|
|
1253
1448
|
x: "12",
|
|
1254
1449
|
y: "13",
|
|
1255
1450
|
width: "10",
|
|
@@ -1257,9 +1452,9 @@ var ne = {
|
|
|
1257
1452
|
rx: "1",
|
|
1258
1453
|
ry: "1"
|
|
1259
1454
|
}),
|
|
1260
|
-
/* @__PURE__ */
|
|
1455
|
+
/* @__PURE__ */ D("path", { d: "M6 9h3m2 0h2" })
|
|
1261
1456
|
]
|
|
1262
|
-
}),
|
|
1457
|
+
}), Ct = _`
|
|
1263
1458
|
.popover {
|
|
1264
1459
|
position: absolute;
|
|
1265
1460
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1386,26 +1581,26 @@ var ne = {
|
|
|
1386
1581
|
${Z.bSmall.regular}
|
|
1387
1582
|
}
|
|
1388
1583
|
}
|
|
1389
|
-
`,
|
|
1584
|
+
`, wt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1390
1585
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1391
1586
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1392
|
-
return /* @__PURE__ */
|
|
1587
|
+
return /* @__PURE__ */ O("div", {
|
|
1393
1588
|
onClick: () => {
|
|
1394
1589
|
l || r(e ?? void 0);
|
|
1395
1590
|
},
|
|
1396
1591
|
className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
|
|
1397
|
-
children: [/* @__PURE__ */
|
|
1592
|
+
children: [/* @__PURE__ */ D("span", { children: i }), /* @__PURE__ */ D("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
|
|
1398
1593
|
}, e ?? "__off__");
|
|
1399
1594
|
};
|
|
1400
|
-
return /* @__PURE__ */
|
|
1595
|
+
return /* @__PURE__ */ O("div", {
|
|
1401
1596
|
className: "popover track-list",
|
|
1402
1597
|
children: [
|
|
1403
|
-
/* @__PURE__ */
|
|
1598
|
+
/* @__PURE__ */ O("div", {
|
|
1404
1599
|
className: i ? "back" : "back no-hover",
|
|
1405
1600
|
onClick: i,
|
|
1406
|
-
children: [i ? /* @__PURE__ */
|
|
1601
|
+
children: [i ? /* @__PURE__ */ D(M, {}) : null, /* @__PURE__ */ D("span", { children: e })]
|
|
1407
1602
|
}),
|
|
1408
|
-
s ? /* @__PURE__ */
|
|
1603
|
+
s ? /* @__PURE__ */ D("div", {
|
|
1409
1604
|
className: "no-hover failed",
|
|
1410
1605
|
children: "Could not switch. Try again."
|
|
1411
1606
|
}) : null,
|
|
@@ -1413,13 +1608,13 @@ var ne = {
|
|
|
1413
1608
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1414
1609
|
]
|
|
1415
1610
|
});
|
|
1416
|
-
},
|
|
1417
|
-
let t =
|
|
1611
|
+
}, Tt = ({ onReset: e } = {}) => {
|
|
1612
|
+
let t = m(null), [n, r] = h(!1), [i, a] = h(void 0), [o, s] = h(!1), c = m(e);
|
|
1418
1613
|
c.current = e;
|
|
1419
1614
|
let l = () => {
|
|
1420
1615
|
r(!1), c.current?.();
|
|
1421
1616
|
};
|
|
1422
|
-
return
|
|
1617
|
+
return f(() => {
|
|
1423
1618
|
let e = (e) => {
|
|
1424
1619
|
n && t.current && !t.current.contains(e.target) && l();
|
|
1425
1620
|
};
|
|
@@ -1454,7 +1649,7 @@ var ne = {
|
|
|
1454
1649
|
});
|
|
1455
1650
|
}
|
|
1456
1651
|
};
|
|
1457
|
-
},
|
|
1652
|
+
}, Et = _`
|
|
1458
1653
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1459
1654
|
which is the width of the player box, so it can be clamped to it. */
|
|
1460
1655
|
position: static;
|
|
@@ -1470,7 +1665,7 @@ position: static;
|
|
|
1470
1665
|
}
|
|
1471
1666
|
}
|
|
1472
1667
|
|
|
1473
|
-
${
|
|
1668
|
+
${Ct}
|
|
1474
1669
|
|
|
1475
1670
|
.popover.error-list {
|
|
1476
1671
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1542,68 +1737,68 @@ ${gt}
|
|
|
1542
1737
|
}
|
|
1543
1738
|
}
|
|
1544
1739
|
}
|
|
1545
|
-
`,
|
|
1546
|
-
let n =
|
|
1740
|
+
`, Dt = (e) => new Date(e).toLocaleTimeString(), Ot = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Ve(Math.max(0, e)), kt = (e) => e.reduce((e, t) => e + t.count, 0), At = (e) => e.map((e, t) => {
|
|
1741
|
+
let n = Ot(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1547
1742
|
return [
|
|
1548
1743
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1549
1744
|
e.message,
|
|
1550
1745
|
e.detail
|
|
1551
1746
|
].filter(Boolean).join("\n");
|
|
1552
|
-
}).join("\n\n"),
|
|
1553
|
-
let e =
|
|
1747
|
+
}).join("\n\n"), jt = () => {
|
|
1748
|
+
let e = q((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Tt(), [i, a] = h(!1);
|
|
1554
1749
|
if (e.length === 0) return null;
|
|
1555
1750
|
let o = () => {
|
|
1556
|
-
navigator.clipboard?.writeText(
|
|
1751
|
+
navigator.clipboard?.writeText(At(e)).then(() => {
|
|
1557
1752
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1558
1753
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1559
|
-
}, s = `Playback errors (${
|
|
1560
|
-
return /* @__PURE__ */
|
|
1561
|
-
css:
|
|
1754
|
+
}, s = `Playback errors (${kt(e)})`;
|
|
1755
|
+
return /* @__PURE__ */ O("div", {
|
|
1756
|
+
css: Et,
|
|
1562
1757
|
ref: r,
|
|
1563
|
-
children: [/* @__PURE__ */
|
|
1758
|
+
children: [/* @__PURE__ */ D($, {
|
|
1564
1759
|
id: "errors",
|
|
1565
1760
|
disabled: t,
|
|
1566
|
-
text: /* @__PURE__ */
|
|
1761
|
+
text: /* @__PURE__ */ D("button", {
|
|
1567
1762
|
className: "errors",
|
|
1568
1763
|
type: "button",
|
|
1569
1764
|
onClick: n,
|
|
1570
1765
|
"aria-label": s,
|
|
1571
1766
|
"aria-expanded": t,
|
|
1572
|
-
children: /* @__PURE__ */
|
|
1767
|
+
children: /* @__PURE__ */ D(V, { className: "alert-triangle" })
|
|
1573
1768
|
}),
|
|
1574
|
-
toolTipText: /* @__PURE__ */
|
|
1575
|
-
}), t && /* @__PURE__ */
|
|
1769
|
+
toolTipText: /* @__PURE__ */ D("span", { children: s })
|
|
1770
|
+
}), t && /* @__PURE__ */ O("div", {
|
|
1576
1771
|
className: "popover error-list",
|
|
1577
|
-
children: [/* @__PURE__ */
|
|
1772
|
+
children: [/* @__PURE__ */ O("div", {
|
|
1578
1773
|
className: "back no-hover",
|
|
1579
|
-
children: [/* @__PURE__ */
|
|
1774
|
+
children: [/* @__PURE__ */ D("span", { children: s }), /* @__PURE__ */ O("button", {
|
|
1580
1775
|
className: "copy",
|
|
1581
1776
|
type: "button",
|
|
1582
1777
|
onClick: o,
|
|
1583
1778
|
"aria-label": "Copy the errors",
|
|
1584
|
-
children: [
|
|
1779
|
+
children: [D(i ? j : P, {}), /* @__PURE__ */ D("span", { children: i ? "Copied" : "Copy" })]
|
|
1585
1780
|
})]
|
|
1586
|
-
}), e.map((e, t) => /* @__PURE__ */
|
|
1781
|
+
}), e.map((e, t) => /* @__PURE__ */ O("div", {
|
|
1587
1782
|
className: "entry no-hover",
|
|
1588
1783
|
children: [
|
|
1589
|
-
/* @__PURE__ */
|
|
1784
|
+
/* @__PURE__ */ O("span", {
|
|
1590
1785
|
className: "when",
|
|
1591
1786
|
children: [
|
|
1592
|
-
|
|
1593
|
-
e.count > 1 ? ` to ${
|
|
1594
|
-
|
|
1787
|
+
Dt(e.at),
|
|
1788
|
+
e.count > 1 ? ` to ${Dt(e.lastAt)}` : "",
|
|
1789
|
+
Ot(e.atMediaTime) ? ` at ${Ot(e.atMediaTime)}` : "",
|
|
1595
1790
|
e.recovered ? " recovered" : "",
|
|
1596
|
-
e.count > 1 ? /* @__PURE__ */
|
|
1791
|
+
e.count > 1 ? /* @__PURE__ */ D("span", {
|
|
1597
1792
|
className: "count",
|
|
1598
1793
|
children: `×${e.count}`
|
|
1599
1794
|
}) : null
|
|
1600
1795
|
]
|
|
1601
1796
|
}),
|
|
1602
|
-
/* @__PURE__ */
|
|
1797
|
+
/* @__PURE__ */ D("span", {
|
|
1603
1798
|
className: "what",
|
|
1604
1799
|
children: e.message
|
|
1605
1800
|
}),
|
|
1606
|
-
e.detail ? /* @__PURE__ */
|
|
1801
|
+
e.detail ? /* @__PURE__ */ D("span", {
|
|
1607
1802
|
className: "cause",
|
|
1608
1803
|
children: e.detail
|
|
1609
1804
|
}) : null
|
|
@@ -1611,7 +1806,7 @@ ${gt}
|
|
|
1611
1806
|
}, `${e.at}-${t}`))]
|
|
1612
1807
|
})]
|
|
1613
1808
|
});
|
|
1614
|
-
},
|
|
1809
|
+
}, Mt = _`
|
|
1615
1810
|
display: flex;
|
|
1616
1811
|
align-items: center;
|
|
1617
1812
|
justify-content: center;
|
|
@@ -1664,42 +1859,42 @@ width: 100%;
|
|
|
1664
1859
|
}
|
|
1665
1860
|
}
|
|
1666
1861
|
}
|
|
1667
|
-
`,
|
|
1668
|
-
let e =
|
|
1862
|
+
`, Nt = () => {
|
|
1863
|
+
let e = q(), t = q((e) => e.playbackRate), n = m(null), r = m(null), i = .25, a = 2.75, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = Ke({
|
|
1669
1864
|
ref: r,
|
|
1670
1865
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1671
|
-
}),
|
|
1866
|
+
}), d = (t) => {
|
|
1672
1867
|
t.preventDefault();
|
|
1673
1868
|
let n = .05, r = s;
|
|
1674
1869
|
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
1675
1870
|
};
|
|
1676
|
-
|
|
1871
|
+
f(() => {
|
|
1677
1872
|
let e = n.current;
|
|
1678
|
-
return e && e.addEventListener("wheel",
|
|
1679
|
-
e && e.removeEventListener("wheel",
|
|
1873
|
+
return e && e.addEventListener("wheel", d, { passive: !1 }), () => {
|
|
1874
|
+
e && e.removeEventListener("wheel", d);
|
|
1680
1875
|
};
|
|
1681
1876
|
}, [t]);
|
|
1682
|
-
let
|
|
1683
|
-
return /* @__PURE__ */
|
|
1684
|
-
css:
|
|
1685
|
-
children: [/* @__PURE__ */
|
|
1877
|
+
let p = c(s);
|
|
1878
|
+
return /* @__PURE__ */ O("div", {
|
|
1879
|
+
css: Mt,
|
|
1880
|
+
children: [/* @__PURE__ */ O("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ D("div", {
|
|
1686
1881
|
className: "playback-slider",
|
|
1687
1882
|
ref: n,
|
|
1688
1883
|
...u,
|
|
1689
|
-
children: /* @__PURE__ */
|
|
1884
|
+
children: /* @__PURE__ */ D("div", {
|
|
1690
1885
|
ref: r,
|
|
1691
1886
|
style: { background: `linear-gradient(to right,
|
|
1692
|
-
#fff 0% ${
|
|
1693
|
-
#3A3A3A ${
|
|
1887
|
+
#fff 0% ${p}%,
|
|
1888
|
+
#3A3A3A ${p}% 100%
|
|
1694
1889
|
)` },
|
|
1695
|
-
children: /* @__PURE__ */
|
|
1890
|
+
children: /* @__PURE__ */ D("div", {
|
|
1696
1891
|
className: "playback-handle",
|
|
1697
|
-
style: { left: `${
|
|
1892
|
+
style: { left: `${p}%` }
|
|
1698
1893
|
})
|
|
1699
1894
|
})
|
|
1700
1895
|
})]
|
|
1701
1896
|
});
|
|
1702
|
-
},
|
|
1897
|
+
}, Pt = _`
|
|
1703
1898
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1704
1899
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1705
1900
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1717,7 +1912,7 @@ position: static;
|
|
|
1717
1912
|
}
|
|
1718
1913
|
}
|
|
1719
1914
|
|
|
1720
|
-
${
|
|
1915
|
+
${Ct}
|
|
1721
1916
|
|
|
1722
1917
|
.switch {
|
|
1723
1918
|
position: relative;
|
|
@@ -1793,55 +1988,55 @@ ${gt}
|
|
|
1793
1988
|
}
|
|
1794
1989
|
}
|
|
1795
1990
|
|
|
1796
|
-
`,
|
|
1797
|
-
let e =
|
|
1991
|
+
`, Ft = () => {
|
|
1992
|
+
let e = q(), t = q((e) => e.playbackRate), n = q((e) => e.audioTracks), r = q((e) => e.selectedAudioTrack), i = q((e) => e.selectAudioTrack), a = q((e) => e.quality), o = q((e) => e.volumeNormalizer), [s, c] = h(0), { open: l, toggle: u, containerRef: d, pending: f, failed: p, runSelect: m } = Tt({ onReset: () => c(0) }), g = (t) => {
|
|
1798
1993
|
e.setPlaybackRate(t), c(0);
|
|
1799
1994
|
}, _ = (e) => {
|
|
1800
|
-
e !== void 0 &&
|
|
1995
|
+
e !== void 0 && m(e, () => i(e));
|
|
1801
1996
|
}, v = (e) => {
|
|
1802
|
-
a &&
|
|
1997
|
+
a && m(e ?? null, () => a.select(e === void 0 ? null : String(e)));
|
|
1803
1998
|
}, y = a ? a.options.length + +!!a.offLabel : 0, b = a?.selectedId == null ? a?.offLabel : a.options.find(({ id: e }) => e === a.selectedId)?.label, x = (e) => () => {
|
|
1804
1999
|
c(e);
|
|
1805
2000
|
};
|
|
1806
|
-
return /* @__PURE__ */
|
|
1807
|
-
css:
|
|
2001
|
+
return /* @__PURE__ */ O("div", {
|
|
2002
|
+
css: Pt,
|
|
1808
2003
|
ref: d,
|
|
1809
2004
|
children: [
|
|
1810
|
-
/* @__PURE__ */
|
|
2005
|
+
/* @__PURE__ */ D($, {
|
|
1811
2006
|
id: "settings",
|
|
1812
2007
|
disabled: l,
|
|
1813
|
-
text: /* @__PURE__ */
|
|
2008
|
+
text: /* @__PURE__ */ D("button", {
|
|
1814
2009
|
className: "settings",
|
|
1815
2010
|
type: "button",
|
|
1816
2011
|
onClick: u,
|
|
1817
2012
|
"aria-label": "Settings",
|
|
1818
2013
|
"aria-expanded": l,
|
|
1819
|
-
children: /* @__PURE__ */
|
|
2014
|
+
children: /* @__PURE__ */ D(B, {})
|
|
1820
2015
|
}),
|
|
1821
|
-
toolTipText: /* @__PURE__ */
|
|
2016
|
+
toolTipText: /* @__PURE__ */ D("span", { children: "Settings" })
|
|
1822
2017
|
}),
|
|
1823
|
-
l && s === 0 && /* @__PURE__ */
|
|
2018
|
+
l && s === 0 && /* @__PURE__ */ O("div", {
|
|
1824
2019
|
className: "popover menu",
|
|
1825
2020
|
children: [
|
|
1826
|
-
n.length > 1 ? /* @__PURE__ */
|
|
2021
|
+
n.length > 1 ? /* @__PURE__ */ O("div", {
|
|
1827
2022
|
onClick: x(2),
|
|
1828
|
-
children: [/* @__PURE__ */
|
|
2023
|
+
children: [/* @__PURE__ */ D("div", { children: "Audio" }), /* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(N, {}) })]
|
|
1829
2024
|
}) : null,
|
|
1830
|
-
y > 1 ? /* @__PURE__ */
|
|
2025
|
+
y > 1 ? /* @__PURE__ */ O("div", {
|
|
1831
2026
|
onClick: x(3),
|
|
1832
|
-
children: [/* @__PURE__ */
|
|
2027
|
+
children: [/* @__PURE__ */ D("div", { children: "Quality" }), /* @__PURE__ */ O("div", { children: [b ? /* @__PURE__ */ D("span", {
|
|
1833
2028
|
className: "secondary",
|
|
1834
2029
|
children: b
|
|
1835
|
-
}) : null, /* @__PURE__ */
|
|
2030
|
+
}) : null, /* @__PURE__ */ D(N, {})] })]
|
|
1836
2031
|
}) : null,
|
|
1837
|
-
/* @__PURE__ */
|
|
2032
|
+
/* @__PURE__ */ O("div", {
|
|
1838
2033
|
onClick: x(1),
|
|
1839
|
-
children: [/* @__PURE__ */
|
|
2034
|
+
children: [/* @__PURE__ */ D("div", { children: "Playback speed" }), /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("span", {
|
|
1840
2035
|
className: "secondary",
|
|
1841
2036
|
children: t === 1 ? "(Default)" : t.toFixed(2)
|
|
1842
|
-
}), /* @__PURE__ */
|
|
2037
|
+
}), /* @__PURE__ */ D(N, {})] })]
|
|
1843
2038
|
}),
|
|
1844
|
-
o ? /* @__PURE__ */
|
|
2039
|
+
o ? /* @__PURE__ */ O("div", {
|
|
1845
2040
|
role: "switch",
|
|
1846
2041
|
"aria-checked": o.available && o.enabled,
|
|
1847
2042
|
"aria-disabled": !o.available,
|
|
@@ -1849,41 +2044,41 @@ ${gt}
|
|
|
1849
2044
|
onClick: () => {
|
|
1850
2045
|
o.available && o.setEnabled(!o.enabled);
|
|
1851
2046
|
},
|
|
1852
|
-
children: [/* @__PURE__ */
|
|
2047
|
+
children: [/* @__PURE__ */ D("div", { children: "Normalize volume" }), /* @__PURE__ */ D("div", { children: o.available ? /* @__PURE__ */ D("span", { className: o.enabled ? "switch on" : "switch" }) : /* @__PURE__ */ D("span", {
|
|
1853
2048
|
className: "secondary",
|
|
1854
2049
|
children: "Unavailable"
|
|
1855
2050
|
}) })]
|
|
1856
2051
|
}) : null
|
|
1857
2052
|
]
|
|
1858
2053
|
}),
|
|
1859
|
-
l && s === 1 && /* @__PURE__ */
|
|
2054
|
+
l && s === 1 && /* @__PURE__ */ O("div", {
|
|
1860
2055
|
className: "popover playback-rate",
|
|
1861
2056
|
children: [
|
|
1862
|
-
/* @__PURE__ */
|
|
2057
|
+
/* @__PURE__ */ O("div", {
|
|
1863
2058
|
className: "back",
|
|
1864
2059
|
onClick: x(0),
|
|
1865
|
-
children: [/* @__PURE__ */
|
|
2060
|
+
children: [/* @__PURE__ */ D(M, {}), /* @__PURE__ */ D("span", { children: "Playback speed" })]
|
|
1866
2061
|
}),
|
|
1867
|
-
/* @__PURE__ */
|
|
2062
|
+
/* @__PURE__ */ D("div", {
|
|
1868
2063
|
className: "slider no-hover",
|
|
1869
|
-
children: /* @__PURE__ */
|
|
2064
|
+
children: /* @__PURE__ */ D(Nt, {})
|
|
1870
2065
|
}),
|
|
1871
|
-
/* @__PURE__ */
|
|
2066
|
+
/* @__PURE__ */ O("div", {
|
|
1872
2067
|
className: "options no-hover",
|
|
1873
2068
|
children: [
|
|
1874
|
-
/* @__PURE__ */
|
|
2069
|
+
/* @__PURE__ */ D("div", {
|
|
1875
2070
|
onClick: () => g(.5),
|
|
1876
2071
|
children: "0.5x"
|
|
1877
2072
|
}),
|
|
1878
|
-
/* @__PURE__ */
|
|
2073
|
+
/* @__PURE__ */ D("div", {
|
|
1879
2074
|
onClick: () => g(1),
|
|
1880
2075
|
children: "1x"
|
|
1881
2076
|
}),
|
|
1882
|
-
/* @__PURE__ */
|
|
2077
|
+
/* @__PURE__ */ D("div", {
|
|
1883
2078
|
onClick: () => g(1.5),
|
|
1884
2079
|
children: "1.5x"
|
|
1885
2080
|
}),
|
|
1886
|
-
/* @__PURE__ */
|
|
2081
|
+
/* @__PURE__ */ D("div", {
|
|
1887
2082
|
onClick: () => g(2),
|
|
1888
2083
|
children: "2x"
|
|
1889
2084
|
})
|
|
@@ -1891,7 +2086,7 @@ ${gt}
|
|
|
1891
2086
|
})
|
|
1892
2087
|
]
|
|
1893
2088
|
}),
|
|
1894
|
-
l && s === 2 && /* @__PURE__ */
|
|
2089
|
+
l && s === 2 && /* @__PURE__ */ D(wt, {
|
|
1895
2090
|
title: "Audio",
|
|
1896
2091
|
tracks: n,
|
|
1897
2092
|
selected: r,
|
|
@@ -1900,7 +2095,7 @@ ${gt}
|
|
|
1900
2095
|
pending: f,
|
|
1901
2096
|
failed: p
|
|
1902
2097
|
}),
|
|
1903
|
-
l && s === 3 && a && /* @__PURE__ */
|
|
2098
|
+
l && s === 3 && a && /* @__PURE__ */ D(wt, {
|
|
1904
2099
|
title: "Quality",
|
|
1905
2100
|
tracks: a.options,
|
|
1906
2101
|
selected: a.selectedId ?? void 0,
|
|
@@ -1912,7 +2107,7 @@ ${gt}
|
|
|
1912
2107
|
})
|
|
1913
2108
|
]
|
|
1914
2109
|
});
|
|
1915
|
-
},
|
|
2110
|
+
}, It = _`
|
|
1916
2111
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1917
2112
|
which is the width of the player box, so it can be clamped to it. */
|
|
1918
2113
|
position: static;
|
|
@@ -1928,28 +2123,28 @@ position: static;
|
|
|
1928
2123
|
}
|
|
1929
2124
|
}
|
|
1930
2125
|
|
|
1931
|
-
${
|
|
1932
|
-
`,
|
|
1933
|
-
let e =
|
|
2126
|
+
${Ct}
|
|
2127
|
+
`, Lt = () => {
|
|
2128
|
+
let e = q((e) => e.subtitleTracks), t = q((e) => e.selectedSubtitleTrack), n = q((e) => e.selectSubtitleTrack), r = q((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Tt();
|
|
1934
2129
|
if (e.length === 0) return null;
|
|
1935
2130
|
let u = t !== void 0;
|
|
1936
|
-
return /* @__PURE__ */
|
|
1937
|
-
css:
|
|
2131
|
+
return /* @__PURE__ */ O("div", {
|
|
2132
|
+
css: It,
|
|
1938
2133
|
ref: o,
|
|
1939
|
-
children: [/* @__PURE__ */
|
|
2134
|
+
children: [/* @__PURE__ */ D($, {
|
|
1940
2135
|
id: "subtitles",
|
|
1941
2136
|
disabled: i,
|
|
1942
|
-
text: /* @__PURE__ */
|
|
2137
|
+
text: /* @__PURE__ */ D("button", {
|
|
1943
2138
|
className: "subtitles",
|
|
1944
2139
|
type: "button",
|
|
1945
2140
|
onClick: a,
|
|
1946
2141
|
"aria-label": "Subtitles",
|
|
1947
2142
|
"aria-expanded": i,
|
|
1948
2143
|
"aria-pressed": u,
|
|
1949
|
-
children: u ? /* @__PURE__ */
|
|
2144
|
+
children: u ? /* @__PURE__ */ D(k, { className: "captions" }) : /* @__PURE__ */ D(A, { className: "captions-off" })
|
|
1950
2145
|
}),
|
|
1951
|
-
toolTipText: /* @__PURE__ */
|
|
1952
|
-
}), i && /* @__PURE__ */
|
|
2146
|
+
toolTipText: /* @__PURE__ */ D("span", { children: "Subtitles" })
|
|
2147
|
+
}), i && /* @__PURE__ */ D(wt, {
|
|
1953
2148
|
title: "Subtitles",
|
|
1954
2149
|
tracks: e,
|
|
1955
2150
|
selected: t,
|
|
@@ -1959,13 +2154,13 @@ ${gt}
|
|
|
1959
2154
|
failed: c
|
|
1960
2155
|
})]
|
|
1961
2156
|
});
|
|
1962
|
-
},
|
|
2157
|
+
}, Rt = {
|
|
1963
2158
|
primary: "#EAEBEE",
|
|
1964
2159
|
secondary: "#D0D0D9",
|
|
1965
2160
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1966
2161
|
borderPrimary: "#384F70",
|
|
1967
2162
|
backgroundTooltip: "#222222"
|
|
1968
|
-
},
|
|
2163
|
+
}, zt = _`
|
|
1969
2164
|
display: flex;
|
|
1970
2165
|
align-items: center;
|
|
1971
2166
|
|
|
@@ -2008,8 +2203,8 @@ ${gt}
|
|
|
2008
2203
|
width: 10px;
|
|
2009
2204
|
height: 10px;
|
|
2010
2205
|
}
|
|
2011
|
-
`,
|
|
2012
|
-
let n =
|
|
2206
|
+
`, Bt = ({ value: e, onChange: t }) => {
|
|
2207
|
+
let n = q((e) => e.volume), r = q((e) => e.muted), i = m(null), a = m(null), { handlers: o } = Ke({
|
|
2013
2208
|
ref: a,
|
|
2014
2209
|
onChange: t
|
|
2015
2210
|
}), s = (n) => {
|
|
@@ -2017,37 +2212,37 @@ ${gt}
|
|
|
2017
2212
|
let r = .05, i = e;
|
|
2018
2213
|
i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
|
|
2019
2214
|
};
|
|
2020
|
-
|
|
2215
|
+
f(() => {
|
|
2021
2216
|
let e = i.current;
|
|
2022
2217
|
return e && e.addEventListener("wheel", s, { passive: !1 }), () => {
|
|
2023
2218
|
e && e.removeEventListener("wheel", s);
|
|
2024
2219
|
};
|
|
2025
2220
|
}, [e]);
|
|
2026
|
-
let c = e * 100, l =
|
|
2027
|
-
return /* @__PURE__ */
|
|
2221
|
+
let c = e * 100, l = p(() => Math.round(r ? 0 : Be(n) * 100), [n, r]);
|
|
2222
|
+
return /* @__PURE__ */ D($, {
|
|
2028
2223
|
id: "volume-slider",
|
|
2029
|
-
text: /* @__PURE__ */
|
|
2224
|
+
text: /* @__PURE__ */ D("div", {
|
|
2030
2225
|
ref: i,
|
|
2031
|
-
css:
|
|
2226
|
+
css: zt,
|
|
2032
2227
|
...o,
|
|
2033
|
-
children: /* @__PURE__ */
|
|
2228
|
+
children: /* @__PURE__ */ D("div", {
|
|
2034
2229
|
ref: a,
|
|
2035
2230
|
style: { background: `linear-gradient(to right,
|
|
2036
2231
|
#fff 0% ${c}%,
|
|
2037
2232
|
#3A3A3A ${c}% 100%
|
|
2038
2233
|
)` },
|
|
2039
|
-
children: /* @__PURE__ */
|
|
2234
|
+
children: /* @__PURE__ */ D("div", {
|
|
2040
2235
|
className: "volume-handle",
|
|
2041
2236
|
style: { left: `${e * 100}%` }
|
|
2042
2237
|
})
|
|
2043
2238
|
})
|
|
2044
2239
|
}),
|
|
2045
|
-
toolTipText: /* @__PURE__ */
|
|
2240
|
+
toolTipText: /* @__PURE__ */ O("div", {
|
|
2046
2241
|
className: "volume-value",
|
|
2047
2242
|
children: [l, "%"]
|
|
2048
2243
|
})
|
|
2049
2244
|
});
|
|
2050
|
-
},
|
|
2245
|
+
}, Vt = _`
|
|
2051
2246
|
position: relative;
|
|
2052
2247
|
display: flex;
|
|
2053
2248
|
align-items: center;
|
|
@@ -2110,39 +2305,39 @@ ${gt}
|
|
|
2110
2305
|
}
|
|
2111
2306
|
}
|
|
2112
2307
|
|
|
2113
|
-
`,
|
|
2114
|
-
let t =
|
|
2115
|
-
return /* @__PURE__ */
|
|
2116
|
-
css:
|
|
2117
|
-
children: [/* @__PURE__ */
|
|
2308
|
+
`, Ht = ({ ref: e }) => {
|
|
2309
|
+
let t = q(), n = q((e) => e.volume), r = q((e) => e.muted), i = p(() => Be(n), [n]);
|
|
2310
|
+
return /* @__PURE__ */ O("div", {
|
|
2311
|
+
css: Vt,
|
|
2312
|
+
children: [/* @__PURE__ */ D($, {
|
|
2118
2313
|
id: "sound",
|
|
2119
|
-
text: /* @__PURE__ */
|
|
2314
|
+
text: /* @__PURE__ */ D("button", {
|
|
2120
2315
|
className: "sound",
|
|
2121
2316
|
type: "button",
|
|
2122
2317
|
onClick: () => t.toggleMuted(),
|
|
2123
2318
|
ref: e,
|
|
2124
2319
|
"aria-label": "Mute",
|
|
2125
2320
|
"aria-pressed": r || n === 0,
|
|
2126
|
-
children:
|
|
2321
|
+
children: D(r || n === 0 ? te : n <= .5 ? H : ee, {
|
|
2127
2322
|
size: 18,
|
|
2128
2323
|
color: "#fff"
|
|
2129
2324
|
})
|
|
2130
2325
|
}),
|
|
2131
|
-
toolTipText: /* @__PURE__ */
|
|
2132
|
-
}), /* @__PURE__ */
|
|
2326
|
+
toolTipText: /* @__PURE__ */ D("span", { children: r ? "Unmute (m)" : "Mute (m)" })
|
|
2327
|
+
}), /* @__PURE__ */ D("div", {
|
|
2133
2328
|
className: "volume-slider-container",
|
|
2134
|
-
children: /* @__PURE__ */
|
|
2329
|
+
children: /* @__PURE__ */ D("div", {
|
|
2135
2330
|
className: "volume-slider-background",
|
|
2136
|
-
children: /* @__PURE__ */
|
|
2331
|
+
children: /* @__PURE__ */ D(Bt, {
|
|
2137
2332
|
value: r ? 0 : i,
|
|
2138
2333
|
onChange: (e) => {
|
|
2139
|
-
t.setVolume(
|
|
2334
|
+
t.setVolume(ze(e));
|
|
2140
2335
|
}
|
|
2141
2336
|
})
|
|
2142
2337
|
})
|
|
2143
2338
|
})]
|
|
2144
2339
|
});
|
|
2145
|
-
},
|
|
2340
|
+
}, Ut = .05, Wt = 5, Gt = 50, Kt = 1e3, qt = _`
|
|
2146
2341
|
position: absolute;
|
|
2147
2342
|
bottom: 0;
|
|
2148
2343
|
width: 100%;
|
|
@@ -2234,7 +2429,7 @@ ${gt}
|
|
|
2234
2429
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2235
2430
|
of its own and so is never :hover */
|
|
2236
2431
|
:hover, &.armed {
|
|
2237
|
-
background-color: ${
|
|
2432
|
+
background-color: ${Rt.hover};
|
|
2238
2433
|
}
|
|
2239
2434
|
|
|
2240
2435
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2272,12 +2467,12 @@ ${gt}
|
|
|
2272
2467
|
}
|
|
2273
2468
|
}
|
|
2274
2469
|
}
|
|
2275
|
-
`,
|
|
2276
|
-
let n =
|
|
2277
|
-
let r =
|
|
2278
|
-
n.setVolume(
|
|
2279
|
-
}, [n]), k =
|
|
2280
|
-
|
|
2470
|
+
`, Jt = ({ shortcuts: e = "window", root: t }) => {
|
|
2471
|
+
let n = q(), r = q((e) => e.paused), i = q((e) => e.currentTime), a = q((e) => e.duration), o = q((e) => e.seekingTo), s = q((e) => e.fullscreen), c = q((e) => e.hideUI), l = q((e) => e.togglePictureInPicture), u = q((e) => e.pictureInPictureMode), p = q((e) => e.burnedInSubtitles), g = q((e) => e.passThroughPictureInPicture), _ = q((e) => e.subtitleTracks), v = q((e) => e.requestSeek), [y, b] = h(null), x = m(null), S = m(void 0), C = u === "burn-in", w = _.length > 0, T = a > 0 && i === a, E = d(({ direction: e, stepSize: t }) => {
|
|
2472
|
+
let r = Be(n.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, r + i)), o = n.muted;
|
|
2473
|
+
n.setVolume(ze(a)), o && !n.muted && n.toggleMuted();
|
|
2474
|
+
}, [n]), k = m(!1);
|
|
2475
|
+
f(() => {
|
|
2281
2476
|
let r = (e) => v ? v(e) : n.seek(e), i = (e) => e.composedPath()[0], a = (e) => {
|
|
2282
2477
|
k.current = !!t.current?.contains(i(e) ?? null);
|
|
2283
2478
|
}, o = (a) => {
|
|
@@ -2290,18 +2485,18 @@ ${gt}
|
|
|
2290
2485
|
else if (a.key === "k") n.togglePaused();
|
|
2291
2486
|
else if (a.key === " ") n.togglePaused();
|
|
2292
2487
|
else if (a.key === "m") n.toggleMuted();
|
|
2293
|
-
else if (a.key === "ArrowUp")
|
|
2488
|
+
else if (a.key === "ArrowUp") E({
|
|
2294
2489
|
direction: "up",
|
|
2295
|
-
stepSize:
|
|
2490
|
+
stepSize: Ut
|
|
2296
2491
|
});
|
|
2297
|
-
else if (a.key === "ArrowDown")
|
|
2492
|
+
else if (a.key === "ArrowDown") E({
|
|
2298
2493
|
direction: "down",
|
|
2299
|
-
stepSize:
|
|
2494
|
+
stepSize: Ut
|
|
2300
2495
|
});
|
|
2301
2496
|
else if (a.key === "ArrowRight") {
|
|
2302
2497
|
if (!n.duration) return;
|
|
2303
|
-
r(Math.min(n.currentTime +
|
|
2304
|
-
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime -
|
|
2498
|
+
r(Math.min(n.currentTime + Wt, n.duration));
|
|
2499
|
+
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime - Wt, 0)) : c = !1;
|
|
2305
2500
|
c && a.preventDefault();
|
|
2306
2501
|
};
|
|
2307
2502
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
@@ -2309,21 +2504,21 @@ ${gt}
|
|
|
2309
2504
|
};
|
|
2310
2505
|
}, [
|
|
2311
2506
|
n,
|
|
2312
|
-
|
|
2507
|
+
E,
|
|
2313
2508
|
v,
|
|
2314
2509
|
e,
|
|
2315
2510
|
t
|
|
2316
2511
|
]);
|
|
2317
|
-
let A =
|
|
2318
|
-
e.preventDefault(), e.deltaY < 0 ?
|
|
2512
|
+
let A = d((e) => {
|
|
2513
|
+
e.preventDefault(), e.deltaY < 0 ? E({
|
|
2319
2514
|
direction: "up",
|
|
2320
|
-
stepSize:
|
|
2321
|
-
}) :
|
|
2515
|
+
stepSize: Ut
|
|
2516
|
+
}) : E({
|
|
2322
2517
|
direction: "down",
|
|
2323
|
-
stepSize:
|
|
2518
|
+
stepSize: Ut
|
|
2324
2519
|
});
|
|
2325
|
-
}, [
|
|
2326
|
-
|
|
2520
|
+
}, [E]);
|
|
2521
|
+
f(() => {
|
|
2327
2522
|
if (y) return y.addEventListener("wheel", A, { passive: !1 }), () => y.removeEventListener("wheel", A);
|
|
2328
2523
|
}, [y, A]);
|
|
2329
2524
|
let j = (e) => {
|
|
@@ -2336,7 +2531,7 @@ ${gt}
|
|
|
2336
2531
|
height: i
|
|
2337
2532
|
});
|
|
2338
2533
|
}, M = !!g?.armed;
|
|
2339
|
-
return
|
|
2534
|
+
return f(() => {
|
|
2340
2535
|
if (!M) return;
|
|
2341
2536
|
clearInterval(S.current);
|
|
2342
2537
|
let e = Infinity, t = setInterval(() => {
|
|
@@ -2346,49 +2541,50 @@ ${gt}
|
|
|
2346
2541
|
}
|
|
2347
2542
|
let n = x.current, r = document.activeElement;
|
|
2348
2543
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2349
|
-
},
|
|
2544
|
+
}, Gt);
|
|
2350
2545
|
return S.current = t, () => {
|
|
2351
|
-
e = Date.now() +
|
|
2546
|
+
e = Date.now() + Kt;
|
|
2352
2547
|
};
|
|
2353
|
-
}, [M]),
|
|
2354
|
-
|
|
2548
|
+
}, [M]), f(() => () => clearInterval(S.current), []), /* @__PURE__ */ O("div", {
|
|
2549
|
+
className: "control-bar",
|
|
2550
|
+
css: qt,
|
|
2355
2551
|
style: { ...c ? {
|
|
2356
2552
|
opacity: "0",
|
|
2357
2553
|
pointerEvents: "none"
|
|
2358
2554
|
} : M ? { pointerEvents: "none" } : {} },
|
|
2359
|
-
children: [/* @__PURE__ */
|
|
2555
|
+
children: [/* @__PURE__ */ D(vt, {}), /* @__PURE__ */ O("div", {
|
|
2360
2556
|
className: "actions",
|
|
2361
|
-
children: [/* @__PURE__ */
|
|
2557
|
+
children: [/* @__PURE__ */ O("div", {
|
|
2362
2558
|
className: "left",
|
|
2363
2559
|
children: [
|
|
2364
|
-
/* @__PURE__ */
|
|
2560
|
+
/* @__PURE__ */ D($, {
|
|
2365
2561
|
id: "play",
|
|
2366
2562
|
tooltipPlace: "top-start",
|
|
2367
|
-
text: /* @__PURE__ */
|
|
2563
|
+
text: /* @__PURE__ */ D("button", {
|
|
2368
2564
|
className: "play",
|
|
2369
2565
|
type: "button",
|
|
2370
2566
|
onClick: () => n.togglePaused(),
|
|
2371
|
-
"aria-label":
|
|
2372
|
-
children: T
|
|
2567
|
+
"aria-label": T ? "Replay" : r ? "Play" : "Pause",
|
|
2568
|
+
children: D(T ? z : r ? R : L, {})
|
|
2373
2569
|
}),
|
|
2374
|
-
toolTipText: /* @__PURE__ */
|
|
2570
|
+
toolTipText: /* @__PURE__ */ D("span", { children: T ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
|
|
2375
2571
|
}),
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2572
|
+
/* @__PURE__ */ D(Ht, { ref: b }),
|
|
2573
|
+
/* @__PURE__ */ D("div", {
|
|
2378
2574
|
className: "time",
|
|
2379
|
-
children:
|
|
2575
|
+
children: He(o ?? i, a)
|
|
2380
2576
|
})
|
|
2381
2577
|
]
|
|
2382
|
-
}), /* @__PURE__ */
|
|
2578
|
+
}), /* @__PURE__ */ O("div", {
|
|
2383
2579
|
className: "right",
|
|
2384
2580
|
children: [
|
|
2385
|
-
/* @__PURE__ */
|
|
2386
|
-
/* @__PURE__ */
|
|
2387
|
-
/* @__PURE__ */
|
|
2388
|
-
g ? /* @__PURE__ */
|
|
2581
|
+
/* @__PURE__ */ D(jt, {}),
|
|
2582
|
+
/* @__PURE__ */ D(Lt, {}),
|
|
2583
|
+
/* @__PURE__ */ D(Ft, {}),
|
|
2584
|
+
g ? /* @__PURE__ */ D($, {
|
|
2389
2585
|
id: "picture-in-picture",
|
|
2390
2586
|
tooltipPlace: "top-end",
|
|
2391
|
-
text: /* @__PURE__ */
|
|
2587
|
+
text: /* @__PURE__ */ D("button", {
|
|
2392
2588
|
ref: x,
|
|
2393
2589
|
className: g.armed ? "picture-in-picture armed" : "picture-in-picture",
|
|
2394
2590
|
type: "button",
|
|
@@ -2397,47 +2593,47 @@ ${gt}
|
|
|
2397
2593
|
onClick: g.active ? g.exit : void 0,
|
|
2398
2594
|
"aria-label": "Picture in picture",
|
|
2399
2595
|
"aria-pressed": g.active,
|
|
2400
|
-
children: /* @__PURE__ */
|
|
2401
|
-
src:
|
|
2596
|
+
children: /* @__PURE__ */ D("img", {
|
|
2597
|
+
src: yt,
|
|
2402
2598
|
alt: ""
|
|
2403
2599
|
})
|
|
2404
2600
|
}),
|
|
2405
|
-
toolTipText: /* @__PURE__ */
|
|
2406
|
-
}) : l ? /* @__PURE__ */
|
|
2601
|
+
toolTipText: /* @__PURE__ */ D("span", { children: g.active ? "Exit picture in picture" : "Picture in picture" })
|
|
2602
|
+
}) : l ? /* @__PURE__ */ D($, {
|
|
2407
2603
|
id: "picture-in-picture",
|
|
2408
2604
|
tooltipPlace: "top-end",
|
|
2409
|
-
text: /* @__PURE__ */
|
|
2605
|
+
text: /* @__PURE__ */ D("button", {
|
|
2410
2606
|
className: "picture-in-picture",
|
|
2411
2607
|
type: "button",
|
|
2412
2608
|
onClick: l,
|
|
2413
2609
|
disabled: C && !w,
|
|
2414
2610
|
"aria-label": C ? "Put the subtitles in the video" : "Picture in picture",
|
|
2415
|
-
"aria-pressed": C ?
|
|
2416
|
-
children: C ?
|
|
2417
|
-
src:
|
|
2611
|
+
"aria-pressed": C ? p : void 0,
|
|
2612
|
+
children: C ? D(p ? xt : St, {}) : /* @__PURE__ */ D("img", {
|
|
2613
|
+
src: yt,
|
|
2418
2614
|
alt: ""
|
|
2419
2615
|
})
|
|
2420
2616
|
}),
|
|
2421
|
-
toolTipText: /* @__PURE__ */
|
|
2617
|
+
toolTipText: /* @__PURE__ */ D("span", { children: C ? w ? p ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture" })
|
|
2422
2618
|
}) : null,
|
|
2423
|
-
/* @__PURE__ */
|
|
2619
|
+
/* @__PURE__ */ D($, {
|
|
2424
2620
|
id: "full-screen",
|
|
2425
2621
|
tooltipPlace: "top-end",
|
|
2426
|
-
text: /* @__PURE__ */
|
|
2622
|
+
text: /* @__PURE__ */ D("button", {
|
|
2427
2623
|
className: "full-screen",
|
|
2428
2624
|
type: "button",
|
|
2429
2625
|
onClick: () => n.toggleFullscreen(),
|
|
2430
2626
|
"aria-label": "Full screen",
|
|
2431
2627
|
"aria-pressed": s,
|
|
2432
|
-
children:
|
|
2628
|
+
children: D(s ? I : F, {})
|
|
2433
2629
|
}),
|
|
2434
|
-
toolTipText: /* @__PURE__ */
|
|
2630
|
+
toolTipText: /* @__PURE__ */ D("span", { children: s ? "Exit full screen (f)" : "Full screen (f)" })
|
|
2435
2631
|
})
|
|
2436
2632
|
]
|
|
2437
2633
|
})]
|
|
2438
2634
|
})]
|
|
2439
2635
|
});
|
|
2440
|
-
},
|
|
2636
|
+
}, Yt = 9e3, Xt = _`
|
|
2441
2637
|
position: absolute;
|
|
2442
2638
|
inset: 0;
|
|
2443
2639
|
z-index: 2;
|
|
@@ -2480,36 +2676,36 @@ ${gt}
|
|
|
2480
2676
|
line-height: 1;
|
|
2481
2677
|
color: #fff;
|
|
2482
2678
|
}
|
|
2483
|
-
`,
|
|
2484
|
-
let e =
|
|
2485
|
-
return
|
|
2679
|
+
`, Zt = () => {
|
|
2680
|
+
let e = q((e) => e.burnedInSubtitles), t = q((e) => e.pictureInPictureMode), [n, r] = h(!1);
|
|
2681
|
+
return f(() => {
|
|
2486
2682
|
if (t !== "burn-in" || !e) {
|
|
2487
2683
|
r(!1);
|
|
2488
2684
|
return;
|
|
2489
2685
|
}
|
|
2490
2686
|
r(!0);
|
|
2491
|
-
let n = setTimeout(() => r(!1),
|
|
2687
|
+
let n = setTimeout(() => r(!1), Yt);
|
|
2492
2688
|
return () => clearTimeout(n);
|
|
2493
|
-
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */
|
|
2494
|
-
css:
|
|
2689
|
+
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ D("div", {
|
|
2690
|
+
css: Xt,
|
|
2495
2691
|
className: n ? "show" : "",
|
|
2496
2692
|
role: "status",
|
|
2497
|
-
children: /* @__PURE__ */
|
|
2693
|
+
children: /* @__PURE__ */ O("div", {
|
|
2498
2694
|
className: "card",
|
|
2499
|
-
children: [/* @__PURE__ */
|
|
2695
|
+
children: [/* @__PURE__ */ D("div", {
|
|
2500
2696
|
className: "text",
|
|
2501
2697
|
children: "Now click your browser's pop out button"
|
|
2502
|
-
}), /* @__PURE__ */
|
|
2698
|
+
}), /* @__PURE__ */ D("div", {
|
|
2503
2699
|
className: "arrow",
|
|
2504
2700
|
"aria-hidden": "true",
|
|
2505
2701
|
children: "→"
|
|
2506
2702
|
})]
|
|
2507
2703
|
})
|
|
2508
2704
|
});
|
|
2509
|
-
},
|
|
2705
|
+
}, Qt = 1, $t = 6e3, en = 1, tn = {
|
|
2510
2706
|
opening: "Skip Opening",
|
|
2511
2707
|
ending: "Skip Ending"
|
|
2512
|
-
},
|
|
2708
|
+
}, nn = _`
|
|
2513
2709
|
position: absolute;
|
|
2514
2710
|
inset: 0;
|
|
2515
2711
|
z-index: 2;
|
|
@@ -2560,10 +2756,10 @@ ${gt}
|
|
|
2560
2756
|
bottom: calc(9 * var(--mp-unit));
|
|
2561
2757
|
}
|
|
2562
2758
|
}
|
|
2563
|
-
`,
|
|
2564
|
-
let e =
|
|
2759
|
+
`, rn = () => {
|
|
2760
|
+
let e = q((e) => e.chapters), t = q((e) => e.currentTime), n = q((e) => e.requestSeek), r = q((e) => e.seekPreview), i = q(), a = p(() => ht(e), [e]), o = p(() => {
|
|
2565
2761
|
if (typeof t != "number") return;
|
|
2566
|
-
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start -
|
|
2762
|
+
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - Qt <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
|
|
2567
2763
|
return r ? {
|
|
2568
2764
|
kind: r,
|
|
2569
2765
|
end: e[n].end
|
|
@@ -2572,35 +2768,35 @@ ${gt}
|
|
|
2572
2768
|
e,
|
|
2573
2769
|
a,
|
|
2574
2770
|
t
|
|
2575
|
-
]), s =
|
|
2576
|
-
|
|
2771
|
+
]), s = m(0), [c, l] = h(0);
|
|
2772
|
+
f(() => {
|
|
2577
2773
|
let e = typeof t == "number" ? t : 0, n = s.current;
|
|
2578
|
-
s.current = e, e < n -
|
|
2774
|
+
s.current = e, e < n - en && l((e) => e + 1);
|
|
2579
2775
|
}, [t]);
|
|
2580
|
-
let [u,
|
|
2581
|
-
return
|
|
2776
|
+
let [u, d] = h(!1), g = o ? `${o.kind}@${o.end}` : "";
|
|
2777
|
+
return f(() => {
|
|
2582
2778
|
if (!g) {
|
|
2583
|
-
|
|
2779
|
+
d(!1);
|
|
2584
2780
|
return;
|
|
2585
2781
|
}
|
|
2586
|
-
|
|
2587
|
-
let e = setTimeout(() =>
|
|
2782
|
+
d(!0);
|
|
2783
|
+
let e = setTimeout(() => d(!1), $t);
|
|
2588
2784
|
return () => clearTimeout(e);
|
|
2589
|
-
}, [g, c]),
|
|
2590
|
-
o ||
|
|
2591
|
-
}, [o]), o ? /* @__PURE__ */
|
|
2592
|
-
css:
|
|
2785
|
+
}, [g, c]), f(() => {
|
|
2786
|
+
o || d(!1);
|
|
2787
|
+
}, [o]), o ? /* @__PURE__ */ D("div", {
|
|
2788
|
+
css: nn,
|
|
2593
2789
|
className: u && !r ? "show" : "",
|
|
2594
|
-
children: /* @__PURE__ */
|
|
2790
|
+
children: /* @__PURE__ */ D("button", {
|
|
2595
2791
|
type: "button",
|
|
2596
2792
|
className: "skip-chapter",
|
|
2597
2793
|
onClick: () => {
|
|
2598
|
-
|
|
2794
|
+
d(!1), n ? n(o.end) : i.seek(o.end);
|
|
2599
2795
|
},
|
|
2600
|
-
children:
|
|
2796
|
+
children: tn[o.kind]
|
|
2601
2797
|
})
|
|
2602
2798
|
}) : null;
|
|
2603
|
-
},
|
|
2799
|
+
}, an = 3e3, on = _`
|
|
2604
2800
|
position: absolute;
|
|
2605
2801
|
inset: 0;
|
|
2606
2802
|
z-index: 2;
|
|
@@ -2611,10 +2807,10 @@ ${gt}
|
|
|
2611
2807
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2612
2808
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2613
2809
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2614
|
-
`,
|
|
2810
|
+
`, sn = (e, t) => {
|
|
2615
2811
|
let n = e.left - t.left, r = e.top - t.top;
|
|
2616
2812
|
return `path(evenodd, 'M0 0H${t.width}V${t.height}H0Z M${n} ${r}H${n + e.width}V${r + e.height}H${n}Z')`;
|
|
2617
|
-
},
|
|
2813
|
+
}, cn = _`
|
|
2618
2814
|
position: relative;
|
|
2619
2815
|
background-color: black;
|
|
2620
2816
|
display: flex;
|
|
@@ -2671,64 +2867,68 @@ ${gt}
|
|
|
2671
2867
|
&.hide {
|
|
2672
2868
|
cursor: none;
|
|
2673
2869
|
}
|
|
2674
|
-
`,
|
|
2675
|
-
let r = `${t}${
|
|
2676
|
-
return
|
|
2870
|
+
`, ln = (e, t = "") => c.toArray(e).flatMap((e, n) => {
|
|
2871
|
+
let r = `${t}${u(e) && e.key != null ? e.key : n}`;
|
|
2872
|
+
return u(e) && e.type === l ? ln(e.props.children, `${r}/`) : [{
|
|
2677
2873
|
key: r,
|
|
2678
2874
|
item: e
|
|
2679
2875
|
}];
|
|
2680
|
-
}),
|
|
2681
|
-
let s =
|
|
2876
|
+
}), un = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, children: o }) => {
|
|
2877
|
+
let s = q(), c = q((e) => e.hideUI), l = q((e) => e.setHideUI), u = q((e) => e.hasMedia), d = q((e) => e.passThroughPictureInPicture), p = m(void 0), h = m("mouse"), g = m({
|
|
2682
2878
|
x: -1,
|
|
2683
2879
|
y: -1
|
|
2684
|
-
}), _ =
|
|
2685
|
-
|
|
2686
|
-
u || (clearTimeout(
|
|
2880
|
+
}), _ = m(!1), v = m(null);
|
|
2881
|
+
f(() => () => clearTimeout(p.current), []), f(() => {
|
|
2882
|
+
u || (clearTimeout(p.current), l(!1));
|
|
2687
2883
|
}, [u, l]);
|
|
2688
|
-
let
|
|
2884
|
+
let y = () => {
|
|
2689
2885
|
u && l(!0);
|
|
2690
|
-
},
|
|
2691
|
-
|
|
2692
|
-
},
|
|
2886
|
+
}, b = (t) => {
|
|
2887
|
+
v.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
|
|
2888
|
+
}, x = () => {
|
|
2693
2889
|
if (s.passThroughPictureInPicture?.armed) return !0;
|
|
2694
2890
|
if (h.current !== "mouse") return !1;
|
|
2695
2891
|
let { x: e, y: t } = g.current;
|
|
2696
|
-
if (!
|
|
2892
|
+
if (!v.current || e < 0) return !1;
|
|
2697
2893
|
let n = document.elementFromPoint(e, t);
|
|
2698
|
-
return
|
|
2699
|
-
},
|
|
2700
|
-
if (
|
|
2701
|
-
|
|
2894
|
+
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
2895
|
+
}, S = () => {
|
|
2896
|
+
if (x()) {
|
|
2897
|
+
p.current = setTimeout(S, an);
|
|
2702
2898
|
return;
|
|
2703
2899
|
}
|
|
2704
|
-
|
|
2705
|
-
},
|
|
2706
|
-
l(!1), clearTimeout(
|
|
2707
|
-
}
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2900
|
+
y();
|
|
2901
|
+
}, C = () => {
|
|
2902
|
+
l(!1), clearTimeout(p.current), p.current = setTimeout(S, an);
|
|
2903
|
+
}, w = (e) => {
|
|
2904
|
+
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
2905
|
+
x: e.clientX,
|
|
2906
|
+
y: e.clientY
|
|
2907
|
+
}, C());
|
|
2908
|
+
}, T = (e) => {
|
|
2909
|
+
h.current = e.pointerType, _.current = !0;
|
|
2910
|
+
}, E = () => {
|
|
2911
|
+
_.current = !1;
|
|
2912
|
+
}, k = m(!0);
|
|
2913
|
+
return /* @__PURE__ */ O("div", {
|
|
2914
|
+
css: cn,
|
|
2915
|
+
ref: b,
|
|
2916
|
+
onPointerMove: w,
|
|
2917
|
+
onPointerDown: T,
|
|
2918
|
+
onPointerUp: E,
|
|
2919
|
+
onPointerCancel: E,
|
|
2720
2920
|
onMouseOut: (e) => {
|
|
2721
2921
|
let t = e.relatedTarget;
|
|
2722
2922
|
if (t && e.currentTarget.contains(t)) return;
|
|
2723
2923
|
let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
|
|
2724
|
-
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(
|
|
2924
|
+
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(p.current), y());
|
|
2725
2925
|
},
|
|
2726
2926
|
className: c ? "hide" : "",
|
|
2727
2927
|
tabIndex: a === "player" ? -1 : void 0,
|
|
2728
2928
|
children: [
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
|
|
2731
|
-
css:
|
|
2929
|
+
/* @__PURE__ */ D(Ie, { onSubtitleRef: n }),
|
|
2930
|
+
ln(r).map(({ key: e, item: t }) => /* @__PURE__ */ D("div", {
|
|
2931
|
+
css: on,
|
|
2732
2932
|
style: { ...c ? {
|
|
2733
2933
|
opacity: "0",
|
|
2734
2934
|
visibility: "hidden",
|
|
@@ -2736,143 +2936,161 @@ ${gt}
|
|
|
2736
2936
|
} : {} },
|
|
2737
2937
|
children: t
|
|
2738
2938
|
}, e)),
|
|
2739
|
-
i === !1 ? null : /* @__PURE__ */
|
|
2939
|
+
i === !1 ? null : /* @__PURE__ */ D(Jt, {
|
|
2740
2940
|
shortcuts: a,
|
|
2741
|
-
root:
|
|
2941
|
+
root: v
|
|
2742
2942
|
}),
|
|
2743
|
-
/* @__PURE__ */
|
|
2744
|
-
/* @__PURE__ */
|
|
2745
|
-
|
|
2943
|
+
/* @__PURE__ */ D(Zt, {}),
|
|
2944
|
+
/* @__PURE__ */ D(rn, {}),
|
|
2945
|
+
d?.armed && v.current ? /* @__PURE__ */ D("div", {
|
|
2746
2946
|
className: "pass-through",
|
|
2747
|
-
style: { clipPath:
|
|
2748
|
-
onPointerOver:
|
|
2947
|
+
style: { clipPath: sn(d.armed, v.current.getBoundingClientRect()) },
|
|
2948
|
+
onPointerOver: d.disarm
|
|
2749
2949
|
}) : null,
|
|
2750
|
-
/* @__PURE__ */
|
|
2950
|
+
/* @__PURE__ */ O("div", {
|
|
2751
2951
|
className: "video",
|
|
2752
|
-
onClick: () => {
|
|
2952
|
+
onClick: (e) => {
|
|
2753
2953
|
if (h.current === "mouse") {
|
|
2754
|
-
|
|
2954
|
+
if (e.detail > 1) return;
|
|
2955
|
+
k.current = s.paused, s.togglePaused();
|
|
2755
2956
|
return;
|
|
2756
2957
|
}
|
|
2757
|
-
c ?
|
|
2958
|
+
c ? C() : (clearTimeout(p.current), y());
|
|
2758
2959
|
},
|
|
2759
|
-
|
|
2960
|
+
onDoubleClick: () => {
|
|
2961
|
+
h.current === "mouse" && (k.current ? s.pause() : s.play().catch(() => {}), s.toggleFullscreen());
|
|
2962
|
+
},
|
|
2963
|
+
children: [t ? /* @__PURE__ */ D("video", {
|
|
2760
2964
|
ref: t,
|
|
2761
2965
|
playsInline: !0
|
|
2762
2966
|
}) : null, o]
|
|
2763
2967
|
})
|
|
2764
2968
|
]
|
|
2765
2969
|
});
|
|
2766
|
-
},
|
|
2767
|
-
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead:
|
|
2768
|
-
|
|
2769
|
-
let { expose:
|
|
2970
|
+
}, dn = ({ options: e, children: t }) => {
|
|
2971
|
+
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead: d, thumbnailsEnabled: g } = r ?? {}, _ = x(), v = b(), [y, S] = h(null), [C, w] = h(null), T = n?.media ?? y;
|
|
2972
|
+
f(() => (_?.(T), () => _?.(null)), [T, _]);
|
|
2973
|
+
let { expose: E } = e, O = E === !0 ? {} : E || void 0, k = m(O);
|
|
2770
2974
|
k.current = O;
|
|
2771
2975
|
let A = O ? O.id : void 0, j = O ? O.origin : void 0, M = O ? O.channel : void 0;
|
|
2772
|
-
|
|
2773
|
-
if (!
|
|
2976
|
+
f(() => {
|
|
2977
|
+
if (!E || !T) return;
|
|
2774
2978
|
let e, t = !1;
|
|
2775
2979
|
return import("./remote/index.js").then(({ exposePlayer: n }) => {
|
|
2776
|
-
t || (e = n(
|
|
2980
|
+
t || (e = n(T, k.current ?? {}));
|
|
2777
2981
|
}).catch(() => {}), () => {
|
|
2778
2982
|
t = !0, e?.();
|
|
2779
2983
|
};
|
|
2780
2984
|
}, [
|
|
2781
|
-
|
|
2782
|
-
!!
|
|
2985
|
+
T,
|
|
2986
|
+
!!E,
|
|
2783
2987
|
A,
|
|
2784
2988
|
j,
|
|
2785
2989
|
M
|
|
2786
|
-
]),
|
|
2787
|
-
let N = r?.normalizeVolume, [P, F] =
|
|
2788
|
-
|
|
2789
|
-
F(
|
|
2990
|
+
]), le(y, C, r);
|
|
2991
|
+
let N = r?.normalizeVolume ?? !0, [P, F] = h(N);
|
|
2992
|
+
f(() => {
|
|
2993
|
+
F(N);
|
|
2790
2994
|
}, [N]);
|
|
2791
|
-
let I =
|
|
2995
|
+
let I = m(r?.onNormalizeVolumeChange);
|
|
2792
2996
|
I.current = r?.onNormalizeVolumeChange;
|
|
2793
|
-
let L = r?.normalizerWorkletUrl,
|
|
2997
|
+
let L = r?.normalizerWorkletUrl, R = m(d ?? u);
|
|
2998
|
+
R.current = d ?? u;
|
|
2999
|
+
let z = q((e) => e.selectedAudioTrack), B = !!u, { refused: V } = ke(y, L, P, p(() => B && o && c && l && typeof z == "number" && z >= 0 ? {
|
|
3000
|
+
read: (e, t) => R.current(e, t),
|
|
3001
|
+
length: o,
|
|
3002
|
+
publicPath: c,
|
|
3003
|
+
libavWorkerUrl: l,
|
|
3004
|
+
audioStreamIndex: z
|
|
3005
|
+
} : void 0, [
|
|
3006
|
+
B,
|
|
3007
|
+
o,
|
|
3008
|
+
c,
|
|
3009
|
+
l,
|
|
3010
|
+
z
|
|
3011
|
+
]), p(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), H = p(() => L && typeof AudioWorkletNode == "function" ? {
|
|
2794
3012
|
enabled: P,
|
|
2795
|
-
available: !
|
|
3013
|
+
available: !V,
|
|
2796
3014
|
setEnabled: (e) => {
|
|
2797
3015
|
F(e), I.current?.(e);
|
|
2798
3016
|
}
|
|
2799
3017
|
} : null, [
|
|
2800
3018
|
L,
|
|
2801
3019
|
P,
|
|
2802
|
-
|
|
2803
|
-
]), { thumbnails: ee, requestThumbnail: te } =
|
|
3020
|
+
V
|
|
3021
|
+
]), { thumbnails: ee, requestThumbnail: te } = fe({
|
|
2804
3022
|
publicPath: c,
|
|
2805
3023
|
workerUrl: l,
|
|
2806
3024
|
length: g === !1 ? void 0 : o,
|
|
2807
|
-
read:
|
|
3025
|
+
read: d ?? u,
|
|
2808
3026
|
downloadedRanges: s
|
|
2809
|
-
}),
|
|
2810
|
-
|
|
2811
|
-
|
|
3027
|
+
}), U = n?.thumbnails?.all ?? ee, { toggle: W, mode: G, burnedIn: K } = pe(y, C), ne = ye(n?.media ?? null, n?.pictureInPicture), J = q((e) => e.setSourceState), Y = n ? !!n.media : o !== void 0;
|
|
3028
|
+
f(() => {
|
|
3029
|
+
J({
|
|
2812
3030
|
title: i,
|
|
2813
3031
|
size: o,
|
|
2814
3032
|
downloadedRanges: s,
|
|
2815
|
-
hasMedia:
|
|
3033
|
+
hasMedia: Y
|
|
2816
3034
|
});
|
|
2817
3035
|
}, [
|
|
2818
|
-
|
|
3036
|
+
J,
|
|
2819
3037
|
i,
|
|
2820
3038
|
o,
|
|
2821
3039
|
s,
|
|
2822
|
-
|
|
3040
|
+
Y
|
|
2823
3041
|
]);
|
|
2824
|
-
let
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
thumbnails:
|
|
2828
|
-
thumbnailAt:
|
|
3042
|
+
let re = n?.thumbnails?.at;
|
|
3043
|
+
f(() => {
|
|
3044
|
+
J({
|
|
3045
|
+
thumbnails: U,
|
|
3046
|
+
thumbnailAt: re,
|
|
2829
3047
|
requestThumbnail: te,
|
|
2830
|
-
togglePictureInPicture:
|
|
2831
|
-
pictureInPictureMode:
|
|
2832
|
-
burnedInSubtitles:
|
|
3048
|
+
togglePictureInPicture: W,
|
|
3049
|
+
pictureInPictureMode: G,
|
|
3050
|
+
burnedInSubtitles: K
|
|
2833
3051
|
});
|
|
2834
3052
|
}, [
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
3053
|
+
J,
|
|
3054
|
+
U,
|
|
3055
|
+
re,
|
|
2838
3056
|
te,
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
]),
|
|
2843
|
-
|
|
2844
|
-
}, [
|
|
2845
|
-
|
|
2846
|
-
}, [
|
|
2847
|
-
let
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
subtitleTracks:
|
|
3057
|
+
W,
|
|
3058
|
+
G,
|
|
3059
|
+
K
|
|
3060
|
+
]), f(() => {
|
|
3061
|
+
J({ volumeNormalizer: H });
|
|
3062
|
+
}, [J, H]), f(() => {
|
|
3063
|
+
J({ passThroughPictureInPicture: ne });
|
|
3064
|
+
}, [J, ne]);
|
|
3065
|
+
let X = n?.subtitles?.selection, ie = n?.audioTracks?.selection;
|
|
3066
|
+
f(() => {
|
|
3067
|
+
X && J({
|
|
3068
|
+
subtitleTracks: X.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2851
3069
|
id: e,
|
|
2852
3070
|
label: t,
|
|
2853
3071
|
disabled: n
|
|
2854
3072
|
})),
|
|
2855
|
-
selectedSubtitleTrack:
|
|
2856
|
-
selectSubtitleTrack: (e) =>
|
|
2857
|
-
subtitleOffLabel:
|
|
3073
|
+
selectedSubtitleTrack: X.selectedId ?? void 0,
|
|
3074
|
+
selectSubtitleTrack: (e) => X.select(e == null ? null : String(e)),
|
|
3075
|
+
subtitleOffLabel: X.offLabel
|
|
2858
3076
|
});
|
|
2859
|
-
}, [
|
|
2860
|
-
|
|
2861
|
-
audioTracks:
|
|
3077
|
+
}, [J, X]), f(() => {
|
|
3078
|
+
ie && J({
|
|
3079
|
+
audioTracks: ie.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2862
3080
|
id: e,
|
|
2863
3081
|
label: t,
|
|
2864
3082
|
disabled: n
|
|
2865
3083
|
})),
|
|
2866
|
-
selectedAudioTrack:
|
|
2867
|
-
selectAudioTrack: (e) =>
|
|
3084
|
+
selectedAudioTrack: ie.selectedId ?? void 0,
|
|
3085
|
+
selectAudioTrack: (e) => ie.select(String(e))
|
|
2868
3086
|
});
|
|
2869
|
-
}, [
|
|
2870
|
-
let
|
|
2871
|
-
return
|
|
2872
|
-
|
|
2873
|
-
}, [
|
|
2874
|
-
a &&
|
|
2875
|
-
}, [
|
|
3087
|
+
}, [J, ie]);
|
|
3088
|
+
let ae = n?.quality?.selection ?? null;
|
|
3089
|
+
return f(() => {
|
|
3090
|
+
J({ quality: ae });
|
|
3091
|
+
}, [J, ae]), f(() => {
|
|
3092
|
+
a && J({ chapters: a });
|
|
3093
|
+
}, [J, a]), /* @__PURE__ */ D(un, {
|
|
2876
3094
|
ref: v,
|
|
2877
3095
|
onVideoRef: n ? void 0 : S,
|
|
2878
3096
|
onSubtitleRef: w,
|
|
@@ -2881,7 +3099,7 @@ ${gt}
|
|
|
2881
3099
|
shortcuts: e.shortcuts,
|
|
2882
3100
|
children: t
|
|
2883
3101
|
});
|
|
2884
|
-
},
|
|
3102
|
+
}, fn = _`
|
|
2885
3103
|
/**
|
|
2886
3104
|
* The chrome's whole scale, in one place.
|
|
2887
3105
|
*
|
|
@@ -2951,17 +3169,17 @@ ${gt}
|
|
|
2951
3169
|
height: 100%;
|
|
2952
3170
|
width: 100%;
|
|
2953
3171
|
overflow: hidden;
|
|
2954
|
-
`,
|
|
2955
|
-
css:
|
|
2956
|
-
children: /* @__PURE__ */
|
|
3172
|
+
`, pn = (e) => /* @__PURE__ */ D("div", {
|
|
3173
|
+
css: fn,
|
|
3174
|
+
children: /* @__PURE__ */ D(K.Provider, { children: /* @__PURE__ */ D(dn, {
|
|
2957
3175
|
options: e,
|
|
2958
3176
|
children: e.children
|
|
2959
3177
|
}) })
|
|
2960
|
-
}),
|
|
3178
|
+
}), mn = (e) => !!e && typeof e == "object" && "at" in e, hn = (e) => !!e && typeof e == "object" && "selection" in e, gn = ({ blob: e, name: t }) => ({
|
|
2961
3179
|
length: e.size,
|
|
2962
3180
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
2963
3181
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
2964
|
-
}),
|
|
3182
|
+
}), _n = async (e, t) => {
|
|
2965
3183
|
let n = await fetch(e, {
|
|
2966
3184
|
headers: { Range: "bytes=0-1" },
|
|
2967
3185
|
credentials: t
|
|
@@ -2971,8 +3189,8 @@ ${gt}
|
|
|
2971
3189
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2972
3190
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2973
3191
|
return i;
|
|
2974
|
-
},
|
|
2975
|
-
let i = t ?? await
|
|
3192
|
+
}, vn = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3193
|
+
let i = t ?? await _n(e, r);
|
|
2976
3194
|
return {
|
|
2977
3195
|
length: i,
|
|
2978
3196
|
name: n,
|
|
@@ -2987,9 +3205,9 @@ ${gt}
|
|
|
2987
3205
|
return o.arrayBuffer();
|
|
2988
3206
|
}
|
|
2989
3207
|
};
|
|
2990
|
-
},
|
|
2991
|
-
if ("blob" in e) return
|
|
2992
|
-
if ("url" in e) return
|
|
3208
|
+
}, yn = async (e) => {
|
|
3209
|
+
if ("blob" in e) return gn(e);
|
|
3210
|
+
if ("url" in e) return vn(e);
|
|
2993
3211
|
if ("read" in e) return {
|
|
2994
3212
|
length: e.length,
|
|
2995
3213
|
name: e.name,
|
|
@@ -2998,4 +3216,4 @@ ${gt}
|
|
|
2998
3216
|
throw Error(`Unknown source type: ${e}`);
|
|
2999
3217
|
};
|
|
3000
3218
|
//#endregion
|
|
3001
|
-
export {
|
|
3219
|
+
export { pn as MediaPlayer, pn as default, K as Player, t as SUBTITLES_OFF, o as createPictureInPicture, s as createSubtitleRenderer, i as createThumbnailGenerator, yn as inputToRemuxerInput, hn as isDelegatedTracks, mn as isExternalThumbnails, G as sourceFeature, a as startPlayback, pe as usePictureInPicture, q as usePlayer, fe as useSeekThumbnails };
|