@banou/media-player 0.10.26 → 0.10.28
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 +27 -1
- package/dist/engine/index.js +1 -1
- package/dist/engine/playback.d.ts +5 -0
- package/dist/{engine-AjFLuCdA.js → engine-DeEY2qao.js} +94 -92
- package/dist/index.js +745 -700
- package/dist/language/index.d.ts +25 -0
- package/dist/language/index.js +75 -0
- package/dist/react/video-player.d.ts +25 -0
- package/dist/volume-normalizer-worklet.js +15 -7
- package/package.json +5 -1
- package/src/lib/audio/volume-normalizer-worklet.js +15 -7
- package/src/lib/engine/playback.ts +18 -6
- package/src/lib/language/index.ts +129 -0
- package/src/lib/react/hooks/use-playback.ts +50 -17
- package/src/lib/react/video-player.tsx +51 -6
package/dist/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
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-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
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-DeEY2qao.js";
|
|
2
|
+
import { languageOf as c, preferredTrack as l } from "./language/index.js";
|
|
3
|
+
import { Children as u, Fragment as d, isValidElement as f, useCallback as p, useEffect as m, useMemo as h, useRef as g, useState as _, useSyncExternalStore as v } from "react";
|
|
4
|
+
import { css as y, keyframes as b } from "@emotion/react";
|
|
5
|
+
import { createPlayer as x, useContainerAttach as S, useMediaAttach as C } from "@videojs/react";
|
|
6
|
+
import { definePlayerFeature as w, videoFeatures as T } from "@videojs/core/dom";
|
|
7
|
+
import { makeRemuxer as E } from "libav-wasm";
|
|
8
|
+
import { createMediaElementSource as D } from "@banou/ponyfill/web-audio";
|
|
9
|
+
import { Fragment as O, jsx as k, jsxs as A } from "@emotion/react/jsx-runtime";
|
|
10
|
+
import { Captions as j, CaptionsOff as M, Check as N, ChevronLeft as P, ChevronRight as F, Copy as I, Maximize as L, Minimize as R, Pause as z, Play as B, RotateCcw as V, Settings as H, TriangleAlert as U, Volume1 as W, Volume2 as ee, VolumeX as G } from "lucide-react";
|
|
11
|
+
import { Tooltip as K } from "react-tooltip";
|
|
11
12
|
//#region src/lib/react/source-feature.ts
|
|
12
|
-
var
|
|
13
|
+
var q = {
|
|
13
14
|
indexes: [],
|
|
14
15
|
chapters: [],
|
|
15
16
|
thumbnails: [],
|
|
@@ -34,19 +35,19 @@ var U = {
|
|
|
34
35
|
playbackErrors: [],
|
|
35
36
|
ready: !1,
|
|
36
37
|
setSourceState: () => {}
|
|
37
|
-
},
|
|
38
|
+
}, te = w({
|
|
38
39
|
name: "source",
|
|
39
|
-
state: () => ({ ...
|
|
40
|
+
state: () => ({ ...q }),
|
|
40
41
|
attach({ set: e }) {
|
|
41
42
|
e({
|
|
42
43
|
setSourceState: (t) => e(t),
|
|
43
44
|
setHideUI: (t) => e({ hideUI: t })
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
|
-
}),
|
|
47
|
-
features: [...
|
|
47
|
+
}), J = x({
|
|
48
|
+
features: [...T, te],
|
|
48
49
|
displayName: "MediaPlayer"
|
|
49
|
-
}),
|
|
50
|
+
}), Y = J.usePlayer, ne = (e) => {
|
|
50
51
|
if (e && e !== "und") try {
|
|
51
52
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
52
53
|
type: "language",
|
|
@@ -55,64 +56,83 @@ var U = {
|
|
|
55
56
|
} catch {
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
|
-
},
|
|
59
|
-
let t = e.map((e) =>
|
|
59
|
+
}, re = (e) => e?.replace(/_/g, " ").trim() || void 0, X = (e) => {
|
|
60
|
+
let t = e.map((e) => ne(e.language) ?? re(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
60
61
|
...e,
|
|
61
62
|
[t]: (e[t] ?? 0) + 1
|
|
62
63
|
}), {});
|
|
63
64
|
return e.map((e, r) => {
|
|
64
|
-
let i = t[r], a =
|
|
65
|
+
let i = t[r], a = re(e.title);
|
|
65
66
|
return {
|
|
66
67
|
track: e,
|
|
67
68
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
68
69
|
};
|
|
69
70
|
});
|
|
70
|
-
},
|
|
71
|
+
}, ie = (e) => X(e).map(({ track: e, label: t }) => ({
|
|
71
72
|
id: e.streamIndex,
|
|
72
73
|
label: t
|
|
73
|
-
})),
|
|
74
|
+
})), ae = [
|
|
74
75
|
0,
|
|
75
76
|
250,
|
|
76
77
|
1e3,
|
|
77
78
|
3e3,
|
|
78
79
|
1e4
|
|
79
|
-
],
|
|
80
|
+
], Z = 6e4, oe = 500, se = 15e3, ce = (e, t) => {
|
|
81
|
+
if (e === null) return;
|
|
82
|
+
let n = e === void 0 ? 0 : l(e, t);
|
|
83
|
+
return t[Math.max(n, 0)]?.streamIndex;
|
|
84
|
+
}, le = (e) => e instanceof Error ? e.message : String(e), ue = (e) => {
|
|
80
85
|
let t = [], n = e?.cause;
|
|
81
86
|
for (let e = 0; n != null && e < 8; e++) {
|
|
82
87
|
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
83
88
|
t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
|
|
84
89
|
break;
|
|
85
90
|
}
|
|
86
|
-
t.push(
|
|
91
|
+
t.push(le(n)), n = n?.cause;
|
|
87
92
|
}
|
|
88
93
|
return t.length ? t.join("\n") : void 0;
|
|
89
|
-
},
|
|
90
|
-
let o =
|
|
91
|
-
|
|
92
|
-
let [
|
|
94
|
+
}, de = (e, t, n, i) => {
|
|
95
|
+
let o = Y(), { read: s, size: u, publicPath: d = "", libavWorkerUrl: f = "", jassubWorkerUrl: h = "", jassubWasmUrl: v = "", jassubLegacyWasmUrl: y, defaultFontUrl: b, cjkFontUrl: x, bufferSize: S, autoplay: C = !1, chapters: w, seekPrepareBudgetMs: T = oe } = n ?? {}, E = g(w);
|
|
96
|
+
E.current = w;
|
|
97
|
+
let [D, O] = _(), k = D && D.size === u ? D.streamIndex : void 0, [A, j] = _(0), M = g({
|
|
93
98
|
count: 0,
|
|
94
99
|
at: 0
|
|
95
|
-
}),
|
|
96
|
-
|
|
100
|
+
}), N = g(void 0);
|
|
101
|
+
m(() => (M.current = {
|
|
97
102
|
count: 0,
|
|
98
103
|
at: 0
|
|
99
104
|
}, o.setSourceState({ playbackErrors: [] }), () => {
|
|
100
|
-
|
|
101
|
-
}), [
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
let
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
N.current && clearTimeout(N.current);
|
|
106
|
+
}), [u]);
|
|
107
|
+
let P = g(null), F = g(null), I = g(void 0), L = g(u);
|
|
108
|
+
L.current = u;
|
|
109
|
+
let R = g({
|
|
110
|
+
audio: [],
|
|
111
|
+
subtitles: []
|
|
112
|
+
}), z = g(s);
|
|
113
|
+
z.current = s;
|
|
114
|
+
let B = g(n?.preferredAudioLanguage);
|
|
115
|
+
B.current = n?.preferredAudioLanguage;
|
|
116
|
+
let V = g(n?.preferredSubtitleLanguage);
|
|
117
|
+
V.current = n?.preferredSubtitleLanguage;
|
|
118
|
+
let H = g(n?.onPreferredAudioLanguageChange);
|
|
119
|
+
H.current = n?.onPreferredAudioLanguageChange;
|
|
120
|
+
let U = g(n?.onPreferredSubtitleLanguageChange);
|
|
121
|
+
U.current = n?.onPreferredSubtitleLanguageChange;
|
|
122
|
+
let W = g(n?.onSeek);
|
|
123
|
+
W.current = n?.onSeek;
|
|
124
|
+
let ee = g(n?.onPlaybackError);
|
|
125
|
+
ee.current = n?.onPlaybackError;
|
|
126
|
+
let G = g(i);
|
|
127
|
+
G.current = i;
|
|
128
|
+
let K = p((e) => {
|
|
129
|
+
let t = typeof e == "number" ? e : void 0, n = o.selectedSubtitleTrack === void 0;
|
|
130
|
+
I.current = L.current, o.setSourceState({ selectedSubtitleTrack: t }), P.current?.selectSubtitleStream(t);
|
|
131
|
+
let r = R.current.subtitles.find((e) => e.streamIndex === t), i = t === void 0 ? null : c(r) ?? (n ? r?.title?.trim() || "und" : void 0);
|
|
132
|
+
i !== void 0 && U.current?.(i);
|
|
133
|
+
}, [o]), q = p((e) => {
|
|
134
|
+
let t = P.current;
|
|
135
|
+
if (!t || T <= 0) {
|
|
116
136
|
o.seek(e);
|
|
117
137
|
return;
|
|
118
138
|
}
|
|
@@ -126,37 +146,43 @@ var U = {
|
|
|
126
146
|
o.setSourceState({ seekingTo: e });
|
|
127
147
|
let c = t.videoElement, l = () => {
|
|
128
148
|
c?.removeEventListener("seeked", l), clearTimeout(u), o.setSourceState({ seekingTo: void 0 });
|
|
129
|
-
}, u = setTimeout(l,
|
|
149
|
+
}, u = setTimeout(l, se);
|
|
130
150
|
c?.addEventListener("seeked", l);
|
|
131
151
|
let d = setTimeout(() => {
|
|
132
152
|
a = "deadline", s();
|
|
133
|
-
},
|
|
153
|
+
}, T);
|
|
134
154
|
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
135
155
|
clearTimeout(d), s();
|
|
136
156
|
});
|
|
137
|
-
}, [o,
|
|
138
|
-
typeof e
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
}, [o, T]), te = p((e) => {
|
|
158
|
+
if (typeof e != "number" || L.current === void 0) return;
|
|
159
|
+
o.setSourceState({ selectedAudioTrack: e }), O({
|
|
160
|
+
size: L.current,
|
|
161
|
+
streamIndex: e
|
|
162
|
+
});
|
|
163
|
+
let t = c(R.current.audio.find((t) => t.streamIndex === e));
|
|
164
|
+
t !== void 0 && H.current?.(t);
|
|
165
|
+
}, [o]), J = Y((e) => e.setSourceState);
|
|
166
|
+
m(() => {
|
|
167
|
+
J({
|
|
168
|
+
selectSubtitleTrack: K,
|
|
169
|
+
selectAudioTrack: te,
|
|
170
|
+
requestSeek: q
|
|
145
171
|
});
|
|
146
172
|
}, [
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
]),
|
|
152
|
-
if (!e || !t || !
|
|
173
|
+
J,
|
|
174
|
+
K,
|
|
175
|
+
te,
|
|
176
|
+
q
|
|
177
|
+
]), m(() => {
|
|
178
|
+
if (!e || !t || !u || !s) return;
|
|
153
179
|
let n = !1;
|
|
154
180
|
o.setSourceState({
|
|
155
181
|
playbackError: null,
|
|
156
182
|
ready: !1
|
|
157
183
|
});
|
|
158
184
|
let i = (t, n) => {
|
|
159
|
-
let r = Date.now(), i =
|
|
185
|
+
let r = Date.now(), i = le(t), a = ue(t), s = o.playbackErrors, c = s[s.length - 1];
|
|
160
186
|
if (c && c.message === i && c.detail === a && c.recovered === n) {
|
|
161
187
|
let e = {
|
|
162
188
|
...c,
|
|
@@ -176,107 +202,111 @@ var U = {
|
|
|
176
202
|
recovered: n
|
|
177
203
|
};
|
|
178
204
|
o.setSourceState({ playbackErrors: [...s, l] });
|
|
179
|
-
},
|
|
205
|
+
}, c = (e) => {
|
|
180
206
|
if (n) return;
|
|
181
207
|
let t = r(e);
|
|
182
208
|
if (i(e, t), t) {
|
|
183
209
|
let t = performance.now();
|
|
184
|
-
t -
|
|
210
|
+
t - M.current.at > Z && (M.current = {
|
|
185
211
|
count: 0,
|
|
186
212
|
at: t
|
|
187
213
|
});
|
|
188
|
-
let n =
|
|
189
|
-
|
|
190
|
-
count:
|
|
214
|
+
let n = ae[Math.min(M.current.count, ae.length - 1)];
|
|
215
|
+
M.current = {
|
|
216
|
+
count: M.current.count + 1,
|
|
191
217
|
at: t
|
|
192
|
-
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e),
|
|
218
|
+
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), N.current && clearTimeout(N.current), N.current = setTimeout(() => j((e) => e + 1), n);
|
|
193
219
|
return;
|
|
194
220
|
}
|
|
195
|
-
console.error("playback failed", e), o.setSourceState({ playbackError: e }),
|
|
221
|
+
console.error("playback failed", e), o.setSourceState({ playbackError: e }), ee.current?.(e);
|
|
196
222
|
};
|
|
197
223
|
return (async () => {
|
|
198
224
|
try {
|
|
199
225
|
let r = await a({
|
|
200
226
|
videoElement: e,
|
|
201
227
|
subtitleContainer: t,
|
|
202
|
-
read: (e, t) =>
|
|
203
|
-
length:
|
|
204
|
-
publicPath:
|
|
205
|
-
libavWorkerUrl:
|
|
206
|
-
jassubWorkerUrl:
|
|
207
|
-
jassubWasmUrl:
|
|
208
|
-
jassubLegacyWasmUrl:
|
|
209
|
-
defaultFontUrl:
|
|
210
|
-
cjkFontUrl:
|
|
211
|
-
bufferSize:
|
|
212
|
-
audioStreamIndex:
|
|
228
|
+
read: (e, t) => z.current(e, t),
|
|
229
|
+
length: u,
|
|
230
|
+
publicPath: d,
|
|
231
|
+
libavWorkerUrl: f,
|
|
232
|
+
jassubWorkerUrl: h,
|
|
233
|
+
jassubWasmUrl: v,
|
|
234
|
+
jassubLegacyWasmUrl: y,
|
|
235
|
+
defaultFontUrl: b,
|
|
236
|
+
cjkFontUrl: x,
|
|
237
|
+
bufferSize: S,
|
|
238
|
+
audioStreamIndex: k,
|
|
239
|
+
chooseAudioStream: (e) => {
|
|
240
|
+
let t = B.current;
|
|
241
|
+
return t === void 0 ? void 0 : e[l(t, e)]?.streamIndex;
|
|
242
|
+
},
|
|
213
243
|
onReady: () => {
|
|
214
244
|
if (n) return;
|
|
215
245
|
o.setSourceState({ ready: !0 });
|
|
216
|
-
let t =
|
|
217
|
-
|
|
246
|
+
let t = F.current;
|
|
247
|
+
F.current = null, t && t.size === u && t.time > 0 && (e.currentTime = t.time), C && e.play().catch(() => {});
|
|
218
248
|
},
|
|
219
|
-
onError:
|
|
249
|
+
onError: c,
|
|
220
250
|
onRecovered: () => {
|
|
221
251
|
n || o.setSourceState({ playbackError: null });
|
|
222
252
|
},
|
|
223
|
-
onSeek: (e) =>
|
|
224
|
-
onOutput: (e) =>
|
|
253
|
+
onSeek: (e) => W.current?.(e),
|
|
254
|
+
onOutput: (e) => G.current?.(e),
|
|
225
255
|
onSubtitleStreams: (e) => {
|
|
226
|
-
n || o.setSourceState({
|
|
227
|
-
subtitleTracks:
|
|
228
|
-
...
|
|
229
|
-
});
|
|
256
|
+
n || (R.current.subtitles = e, o.setSourceState({
|
|
257
|
+
subtitleTracks: ie(e),
|
|
258
|
+
...I.current === u ? {} : { selectedSubtitleTrack: ce(V.current, e) }
|
|
259
|
+
}));
|
|
230
260
|
},
|
|
231
261
|
onAudioStreams: (e, t) => {
|
|
232
|
-
n || o.setSourceState({
|
|
233
|
-
audioTracks:
|
|
262
|
+
n || (R.current.audio = e, o.setSourceState({
|
|
263
|
+
audioTracks: ie(e),
|
|
234
264
|
selectedAudioTrack: t
|
|
235
|
-
});
|
|
265
|
+
}));
|
|
236
266
|
}
|
|
237
267
|
});
|
|
238
268
|
if (n) {
|
|
239
269
|
r.destroy();
|
|
240
270
|
return;
|
|
241
271
|
}
|
|
242
|
-
|
|
272
|
+
P.current = r, o.setSourceState({
|
|
243
273
|
indexes: r.indexes,
|
|
244
|
-
chapters:
|
|
274
|
+
chapters: E.current ?? r.chapters
|
|
245
275
|
});
|
|
246
276
|
let i = o.selectedSubtitleTrack;
|
|
247
|
-
typeof i == "number"
|
|
277
|
+
r.selectSubtitleStream(typeof i == "number" ? i : void 0);
|
|
248
278
|
} catch (e) {
|
|
249
|
-
|
|
279
|
+
c(e);
|
|
250
280
|
}
|
|
251
281
|
})(), () => {
|
|
252
|
-
n = !0,
|
|
282
|
+
n = !0, F.current = {
|
|
253
283
|
time: e.currentTime,
|
|
254
|
-
size:
|
|
255
|
-
},
|
|
284
|
+
size: u
|
|
285
|
+
}, P.current?.destroy(), P.current = null, o.setSourceState({ ready: !1 });
|
|
256
286
|
};
|
|
257
287
|
}, [
|
|
258
288
|
o,
|
|
259
289
|
e,
|
|
260
290
|
t,
|
|
261
|
-
c,
|
|
262
|
-
l,
|
|
263
291
|
u,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
292
|
+
d,
|
|
293
|
+
f,
|
|
294
|
+
h,
|
|
267
295
|
v,
|
|
268
296
|
y,
|
|
269
297
|
b,
|
|
270
|
-
T,
|
|
271
298
|
x,
|
|
272
|
-
|
|
299
|
+
S,
|
|
300
|
+
k,
|
|
301
|
+
C,
|
|
302
|
+
A
|
|
273
303
|
]);
|
|
274
|
-
},
|
|
304
|
+
}, fe = 1001 / 24e3, pe = (e, t) => new Promise((n) => {
|
|
275
305
|
let r = setTimeout(n, t);
|
|
276
306
|
e.requestVideoFrameCallback(() => {
|
|
277
307
|
clearTimeout(r), n();
|
|
278
308
|
});
|
|
279
|
-
}),
|
|
309
|
+
}), me = (e) => {
|
|
280
310
|
let t = !1, n, r = async (i) => {
|
|
281
311
|
if (t) {
|
|
282
312
|
n = i;
|
|
@@ -292,14 +322,14 @@ var U = {
|
|
|
292
322
|
}
|
|
293
323
|
};
|
|
294
324
|
return r;
|
|
295
|
-
},
|
|
296
|
-
let n =
|
|
325
|
+
}, he = (e, t) => {
|
|
326
|
+
let n = Y(), r = Y((e) => e.setSourceState), i = g(t);
|
|
297
327
|
i.current = t;
|
|
298
328
|
let a = !!t;
|
|
299
|
-
|
|
329
|
+
m(() => {
|
|
300
330
|
let t = e;
|
|
301
331
|
if (!t) return;
|
|
302
|
-
if (typeof t.requestVideoFrameCallback != "function") return a ? (r({ stepFrame:
|
|
332
|
+
if (typeof t.requestVideoFrameCallback != "function") return a ? (r({ stepFrame: me(async (e) => {
|
|
303
333
|
try {
|
|
304
334
|
await i.current?.(e);
|
|
305
335
|
} catch (e) {
|
|
@@ -318,11 +348,11 @@ var U = {
|
|
|
318
348
|
};
|
|
319
349
|
d = t.requestVideoFrameCallback(f);
|
|
320
350
|
let p = () => {
|
|
321
|
-
if (c.length < 5) return
|
|
351
|
+
if (c.length < 5) return fe;
|
|
322
352
|
let e = [...c].sort((e, t) => e - t), t = e[e.length >> 1], n = e.filter((e) => Math.abs(e - t) <= t / 4);
|
|
323
353
|
return n.reduce((e, t) => e + t, 0) / n.length;
|
|
324
|
-
}, m =
|
|
325
|
-
t.paused || (t.pause(), await
|
|
354
|
+
}, m = me(async (e) => {
|
|
355
|
+
t.paused || (t.pause(), await pe(t, 100));
|
|
326
356
|
let r = p(), i = n.state.seekingTo, a = i === void 0 ? o ? o.mediaTime + (e > 0 ? 1.5 : -.5) * r : t.currentTime + e * r : i + e * r, s = Math.max(0, Math.min(a, t.duration || a)), c = new Promise((e) => {
|
|
327
357
|
let n = setTimeout(e, 1e3);
|
|
328
358
|
t.addEventListener("seeked", () => {
|
|
@@ -340,13 +370,13 @@ var U = {
|
|
|
340
370
|
n,
|
|
341
371
|
r
|
|
342
372
|
]);
|
|
343
|
-
},
|
|
344
|
-
let [o, s] =
|
|
373
|
+
}, ge = 5e3, _e = 6e4, ve = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: a }) => {
|
|
374
|
+
let [o, s] = _([]), c = g(null), l = g(r);
|
|
345
375
|
l.current = r;
|
|
346
|
-
let u =
|
|
347
|
-
return
|
|
376
|
+
let u = h(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), d = g(u);
|
|
377
|
+
return d.current = u, m(() => {
|
|
348
378
|
if (!n || !r || !e || !t) return;
|
|
349
|
-
let a = !1, o = null, u,
|
|
379
|
+
let a = !1, o = null, u, f = ge, p = () => {
|
|
350
380
|
i({
|
|
351
381
|
publicPath: e,
|
|
352
382
|
workerUrl: t,
|
|
@@ -360,29 +390,29 @@ var U = {
|
|
|
360
390
|
e.destroy();
|
|
361
391
|
return;
|
|
362
392
|
}
|
|
363
|
-
o = e, c.current = e, e.update(
|
|
393
|
+
o = e, c.current = e, e.update(d.current);
|
|
364
394
|
}, () => {
|
|
365
|
-
a || (u = setTimeout(
|
|
395
|
+
a || (u = setTimeout(p, f), f = Math.min(f * 2, _e));
|
|
366
396
|
});
|
|
367
397
|
};
|
|
368
|
-
return
|
|
398
|
+
return p(), () => {
|
|
369
399
|
a = !0, clearTimeout(u), c.current = null, o?.destroy(), s([]);
|
|
370
400
|
};
|
|
371
401
|
}, [
|
|
372
402
|
n,
|
|
373
403
|
e,
|
|
374
404
|
t
|
|
375
|
-
]),
|
|
405
|
+
]), m(() => {
|
|
376
406
|
c.current?.update(u);
|
|
377
407
|
}, [u]), {
|
|
378
408
|
thumbnails: o,
|
|
379
|
-
requestThumbnail:
|
|
409
|
+
requestThumbnail: p((e) => {
|
|
380
410
|
c.current?.prioritize(e);
|
|
381
411
|
}, [])
|
|
382
412
|
};
|
|
383
|
-
},
|
|
384
|
-
let r =
|
|
385
|
-
|
|
413
|
+
}, ye = (e, t) => {
|
|
414
|
+
let r = g(null), [i, a] = _(!1), [s] = _(() => n());
|
|
415
|
+
m(() => {
|
|
386
416
|
if (!e || !t || !s) return;
|
|
387
417
|
let n = o({
|
|
388
418
|
video: e,
|
|
@@ -398,7 +428,7 @@ var U = {
|
|
|
398
428
|
t,
|
|
399
429
|
s
|
|
400
430
|
]);
|
|
401
|
-
let c =
|
|
431
|
+
let c = p(() => {
|
|
402
432
|
r.current?.toggle().catch((e) => {
|
|
403
433
|
console.warn("picture in picture was refused", e);
|
|
404
434
|
});
|
|
@@ -408,21 +438,21 @@ var U = {
|
|
|
408
438
|
mode: s,
|
|
409
439
|
burnedIn: i
|
|
410
440
|
};
|
|
411
|
-
},
|
|
412
|
-
let t =
|
|
441
|
+
}, be = "(hover: hover) and (pointer: fine)", xe = () => typeof matchMedia == "function" ? matchMedia(be) : void 0, Se = (e) => {
|
|
442
|
+
let t = xe();
|
|
413
443
|
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
414
|
-
},
|
|
415
|
-
let [n, r] =
|
|
444
|
+
}, Ce = () => !!xe()?.matches, we = () => !1, Te = (e, t) => {
|
|
445
|
+
let [n, r] = _(!1), [i, a] = _(), o = g(t);
|
|
416
446
|
t && (o.current = t);
|
|
417
|
-
let s =
|
|
447
|
+
let s = g(!1), c = p((e) => {
|
|
418
448
|
s.current !== e && (s.current = e, o.current?.onArmedChange(e));
|
|
419
|
-
}, []), l =
|
|
449
|
+
}, []), l = p((t) => {
|
|
420
450
|
!e || e.readyState < 1 || e.error || (a(t), c(!0));
|
|
421
|
-
}, [e, c]), u =
|
|
451
|
+
}, [e, c]), u = p(() => {
|
|
422
452
|
a(void 0), c(!1);
|
|
423
|
-
}, [c]),
|
|
424
|
-
|
|
425
|
-
if (!
|
|
453
|
+
}, [c]), d = !!t && !!e;
|
|
454
|
+
m(() => {
|
|
455
|
+
if (!d || !e) return;
|
|
426
456
|
let t = () => {
|
|
427
457
|
r(!0), u();
|
|
428
458
|
}, n = () => r(!1);
|
|
@@ -431,12 +461,12 @@ var U = {
|
|
|
431
461
|
};
|
|
432
462
|
}, [
|
|
433
463
|
e,
|
|
434
|
-
|
|
464
|
+
d,
|
|
435
465
|
u
|
|
436
466
|
]);
|
|
437
|
-
let
|
|
438
|
-
|
|
439
|
-
if (!
|
|
467
|
+
let f = v(Se, Ce, we), [y, b] = _(!1);
|
|
468
|
+
m(() => {
|
|
469
|
+
if (!d) return;
|
|
440
470
|
let e = (e) => {
|
|
441
471
|
e.pointerType === "touch" && b(!0);
|
|
442
472
|
}, t = (e) => {
|
|
@@ -451,17 +481,17 @@ var U = {
|
|
|
451
481
|
}), () => {
|
|
452
482
|
window.removeEventListener("pointerdown", e, { capture: !0 }), window.removeEventListener("pointermove", t, { capture: !0 });
|
|
453
483
|
};
|
|
454
|
-
}, [
|
|
455
|
-
let x =
|
|
456
|
-
|
|
484
|
+
}, [d]);
|
|
485
|
+
let x = d && f && !y;
|
|
486
|
+
m(() => {
|
|
457
487
|
x || u();
|
|
458
488
|
}, [x, u]);
|
|
459
|
-
let S =
|
|
489
|
+
let S = p(() => {
|
|
460
490
|
Promise.resolve(e?.exitPictureInPicture?.()).catch((e) => {
|
|
461
491
|
console.warn("leaving picture in picture was refused", e);
|
|
462
492
|
});
|
|
463
493
|
}, [e]);
|
|
464
|
-
return
|
|
494
|
+
return h(() => x ? {
|
|
465
495
|
active: n,
|
|
466
496
|
armed: i,
|
|
467
497
|
arm: l,
|
|
@@ -475,16 +505,16 @@ var U = {
|
|
|
475
505
|
u,
|
|
476
506
|
S
|
|
477
507
|
]);
|
|
478
|
-
},
|
|
508
|
+
}, Ee = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
|
|
479
509
|
channelCountMode: "max",
|
|
480
510
|
processorOptions: n
|
|
481
|
-
})),
|
|
511
|
+
})), De = /* @__PURE__ */ new WeakMap(), Oe = (e) => new Promise((t, n) => {
|
|
482
512
|
let r = () => {
|
|
483
513
|
(e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
|
|
484
514
|
};
|
|
485
515
|
e.addEventListener("statechange", r), r();
|
|
486
|
-
}),
|
|
487
|
-
let r =
|
|
516
|
+
}), ke = (e, t, n = {}) => {
|
|
517
|
+
let r = De.get(e);
|
|
488
518
|
if (r) return r.wake(), r;
|
|
489
519
|
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 = () => {
|
|
490
520
|
i.state === "suspended" && i.resume().catch(() => {});
|
|
@@ -500,13 +530,13 @@ var U = {
|
|
|
500
530
|
};
|
|
501
531
|
i.addEventListener("statechange", f), f();
|
|
502
532
|
let p = (async () => {
|
|
503
|
-
let r = await
|
|
533
|
+
let r = await Ee(i, t, {
|
|
504
534
|
...n,
|
|
505
535
|
enabled: a,
|
|
506
536
|
inputGainDb: c()
|
|
507
537
|
});
|
|
508
|
-
await
|
|
509
|
-
let s =
|
|
538
|
+
await Oe(i);
|
|
539
|
+
let s = D(i, e);
|
|
510
540
|
return r.port.postMessage({
|
|
511
541
|
enabled: a,
|
|
512
542
|
inputGainDb: c()
|
|
@@ -522,14 +552,14 @@ var U = {
|
|
|
522
552
|
a = e, o?.port.postMessage({ enabled: a });
|
|
523
553
|
},
|
|
524
554
|
release: () => {
|
|
525
|
-
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (
|
|
555
|
+
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (De.delete(e), i.close().catch(() => {}));
|
|
526
556
|
},
|
|
527
557
|
wake: () => {
|
|
528
558
|
i.state !== "closed" && (s = !1, u(), f());
|
|
529
559
|
}
|
|
530
560
|
};
|
|
531
|
-
return
|
|
532
|
-
},
|
|
561
|
+
return De.set(e, m), m;
|
|
562
|
+
}, Ae = 20, je = 5, Me = 1, Ne = 50, Pe = ({ node: t, element: n, scriptUrl: r, source: i }) => {
|
|
533
563
|
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
534
564
|
for (let e of [...c]) e();
|
|
535
565
|
c.clear();
|
|
@@ -560,7 +590,7 @@ var U = {
|
|
|
560
590
|
}, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
|
|
561
591
|
p.onmessage = ({ data: e }) => {
|
|
562
592
|
if (e.type === "unsupported") {
|
|
563
|
-
|
|
593
|
+
G();
|
|
564
594
|
return;
|
|
565
595
|
}
|
|
566
596
|
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(h.spans) || e.end !== h.end) && g++, h = {
|
|
@@ -576,7 +606,7 @@ var U = {
|
|
|
576
606
|
}), S = () => p.postMessage({
|
|
577
607
|
type: "playhead",
|
|
578
608
|
time: n.currentTime
|
|
579
|
-
}), C = setInterval(x,
|
|
609
|
+
}), C = setInterval(x, Ne), w = [
|
|
580
610
|
"play",
|
|
581
611
|
"playing",
|
|
582
612
|
"pause",
|
|
@@ -586,14 +616,14 @@ var U = {
|
|
|
586
616
|
"waiting",
|
|
587
617
|
"ended"
|
|
588
618
|
];
|
|
589
|
-
for (let e of
|
|
590
|
-
let
|
|
619
|
+
for (let e of w) n.addEventListener(e, x);
|
|
620
|
+
let T = Infinity, D = !1, O = 0, k = !1, A = 0, j = 0, M = /* @__PURE__ */ new Map(), N = (e) => {
|
|
591
621
|
let t = e;
|
|
592
622
|
for (let [e, n] of h.spans) e <= t && t < n && (t = n);
|
|
593
|
-
return t >= (h.end ??
|
|
623
|
+
return t >= (h.end ?? T) - .05 ? null : t;
|
|
594
624
|
}, P = (e) => M.get(Math.round(e * 10)) === g ? "idle" : e, F = () => {
|
|
595
625
|
let e = n.currentTime, t = N(e), r = k && y !== O;
|
|
596
|
-
if (t !== null && t < e +
|
|
626
|
+
if (t !== null && t < e + Ae) return r && A <= t + 1 && t <= j + je ? "read" : P(t);
|
|
597
627
|
if (r) return "read";
|
|
598
628
|
let i = t ?? N(0);
|
|
599
629
|
return i === null ? "done" : P(i);
|
|
@@ -622,8 +652,8 @@ var U = {
|
|
|
622
652
|
run: O,
|
|
623
653
|
data: e.data
|
|
624
654
|
}, [e.data]), await t;
|
|
625
|
-
},
|
|
626
|
-
if (B = await
|
|
655
|
+
}, U = async (t) => {
|
|
656
|
+
if (B = await E({
|
|
627
657
|
publicPath: t.publicPath,
|
|
628
658
|
workerUrl: t.libavWorkerUrl,
|
|
629
659
|
workerOptions: { type: "module" },
|
|
@@ -633,7 +663,7 @@ var U = {
|
|
|
633
663
|
}), a) return e(B);
|
|
634
664
|
let n = await B.init();
|
|
635
665
|
if (!a) {
|
|
636
|
-
for (
|
|
666
|
+
for (T = n.info.input.duration || Infinity, p.postMessage({
|
|
637
667
|
type: "init",
|
|
638
668
|
data: n.data,
|
|
639
669
|
codec: n.info.output.audioMimeType
|
|
@@ -657,7 +687,7 @@ var U = {
|
|
|
657
687
|
await H(e), e.finished && await V(!0);
|
|
658
688
|
} else {
|
|
659
689
|
await V(!1), M.set(Math.round(e * 10), g);
|
|
660
|
-
let t = B.seek(Math.max(0, e -
|
|
690
|
+
let t = B.seek(Math.max(0, e - Me));
|
|
661
691
|
f(!0);
|
|
662
692
|
let n = await L(t);
|
|
663
693
|
if (a) return;
|
|
@@ -676,7 +706,7 @@ var U = {
|
|
|
676
706
|
}
|
|
677
707
|
e(B), B = void 0;
|
|
678
708
|
}
|
|
679
|
-
},
|
|
709
|
+
}, W = () => {}, ee = (e, t) => {
|
|
680
710
|
let n = !1, r = (e) => {
|
|
681
711
|
n && p.postMessage({
|
|
682
712
|
type: "end",
|
|
@@ -684,7 +714,7 @@ var U = {
|
|
|
684
714
|
finished: e
|
|
685
715
|
}), n = !1;
|
|
686
716
|
};
|
|
687
|
-
|
|
717
|
+
W = e.attach(t, (e, t) => {
|
|
688
718
|
if (e.type === "init") {
|
|
689
719
|
r(!1);
|
|
690
720
|
let t = e.data.slice(0);
|
|
@@ -710,29 +740,29 @@ var U = {
|
|
|
710
740
|
}, [t]);
|
|
711
741
|
}
|
|
712
742
|
});
|
|
713
|
-
},
|
|
743
|
+
}, G = () => {
|
|
714
744
|
if (!a) {
|
|
715
745
|
a = !0, f(!0), l(), clearInterval(C);
|
|
716
|
-
for (let e of
|
|
717
|
-
n.removeEventListener("seeking", R), n.removeEventListener("seeked", z), n.removeEventListener("timeupdate", z),
|
|
746
|
+
for (let e of w) n.removeEventListener(e, x);
|
|
747
|
+
n.removeEventListener("seeking", R), n.removeEventListener("seeked", z), n.removeEventListener("timeupdate", z), W(), B && e(B), p.terminate(), t.port.postMessage({ analysis: null });
|
|
718
748
|
for (let e of _.values()) e(h);
|
|
719
749
|
_.clear();
|
|
720
750
|
}
|
|
721
751
|
};
|
|
722
|
-
return "tap" in i ?
|
|
723
|
-
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e),
|
|
752
|
+
return "tap" in i ? ee(i.tap, i.audioStreamIndex) : U(i).catch((e) => {
|
|
753
|
+
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), G());
|
|
724
754
|
}), S(), {
|
|
725
755
|
update: (e) => {
|
|
726
756
|
o = e, f(!1);
|
|
727
757
|
},
|
|
728
|
-
stop:
|
|
758
|
+
stop: G
|
|
729
759
|
};
|
|
730
|
-
},
|
|
731
|
-
let a =
|
|
732
|
-
|
|
760
|
+
}, Fe = (e, t, n, r, i) => {
|
|
761
|
+
let a = g(null), [o, s] = _(!1), [c, l] = _(null);
|
|
762
|
+
m(() => {
|
|
733
763
|
if (e && t) {
|
|
734
764
|
if (n && !a.current) {
|
|
735
|
-
let r =
|
|
765
|
+
let r = ke(e, t, { enabled: n });
|
|
736
766
|
a.current = r, r.routed.then((e) => {
|
|
737
767
|
a.current === r && l(e);
|
|
738
768
|
}, (e) => {
|
|
@@ -745,18 +775,18 @@ var U = {
|
|
|
745
775
|
e,
|
|
746
776
|
t,
|
|
747
777
|
n
|
|
748
|
-
]),
|
|
778
|
+
]), m(() => () => {
|
|
749
779
|
a.current?.release(), a.current = null, l(null);
|
|
750
780
|
}, [e]);
|
|
751
|
-
let u =
|
|
781
|
+
let u = g(i);
|
|
752
782
|
u.current = i;
|
|
753
|
-
let d =
|
|
754
|
-
|
|
755
|
-
let { length:
|
|
756
|
-
return
|
|
757
|
-
let r =
|
|
783
|
+
let d = g(null), f = g(r);
|
|
784
|
+
f.current = r;
|
|
785
|
+
let { length: p, publicPath: h, libavWorkerUrl: v } = r && "read" in r ? r : {}, y = r && "tap" in r ? r.tap : void 0, b = r?.audioStreamIndex;
|
|
786
|
+
return m(() => {
|
|
787
|
+
let r = f.current;
|
|
758
788
|
if (!c || !e || !t || !n || !r) return;
|
|
759
|
-
let i =
|
|
789
|
+
let i = Pe({
|
|
760
790
|
node: c,
|
|
761
791
|
element: e,
|
|
762
792
|
scriptUrl: t,
|
|
@@ -770,15 +800,15 @@ var U = {
|
|
|
770
800
|
e,
|
|
771
801
|
t,
|
|
772
802
|
n,
|
|
773
|
-
|
|
774
|
-
|
|
803
|
+
p,
|
|
804
|
+
h,
|
|
775
805
|
v,
|
|
776
806
|
b,
|
|
777
807
|
y
|
|
778
|
-
]),
|
|
808
|
+
]), m(() => {
|
|
779
809
|
d.current?.update(i);
|
|
780
810
|
}, [i]), { refused: o };
|
|
781
|
-
},
|
|
811
|
+
}, Ie = () => {
|
|
782
812
|
let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
|
|
783
813
|
return {
|
|
784
814
|
push: (n) => {
|
|
@@ -800,7 +830,7 @@ var U = {
|
|
|
800
830
|
};
|
|
801
831
|
}
|
|
802
832
|
};
|
|
803
|
-
},
|
|
833
|
+
}, Q = {
|
|
804
834
|
headings: {
|
|
805
835
|
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 ",
|
|
806
836
|
medium: "\n font-weight: 600;\n font-size: calc(2.4 * var(--mp-unit));\n line-height: calc(2.9 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n }\n ",
|
|
@@ -827,7 +857,7 @@ var U = {
|
|
|
827
857
|
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 ",
|
|
828
858
|
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 "
|
|
829
859
|
}
|
|
830
|
-
},
|
|
860
|
+
}, Le = y`
|
|
831
861
|
display: flex;
|
|
832
862
|
justify-content: center;
|
|
833
863
|
align-items: center;
|
|
@@ -840,7 +870,7 @@ var U = {
|
|
|
840
870
|
margin: auto;
|
|
841
871
|
pointer-events: none;
|
|
842
872
|
}
|
|
843
|
-
`,
|
|
873
|
+
`, Re = y`
|
|
844
874
|
position: absolute;
|
|
845
875
|
top: 0;
|
|
846
876
|
left: 0;
|
|
@@ -848,7 +878,7 @@ var U = {
|
|
|
848
878
|
padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
|
|
849
879
|
/* clears a notch once the player is fullscreen; resolves to zero everywhere else */
|
|
850
880
|
padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
|
|
851
|
-
${
|
|
881
|
+
${Q.headings.small}
|
|
852
882
|
color: white;
|
|
853
883
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
854
884
|
z-index: 2;
|
|
@@ -869,9 +899,9 @@ var U = {
|
|
|
869
899
|
|
|
870
900
|
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%);
|
|
871
901
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
872
|
-
`,
|
|
902
|
+
`, ze = b`
|
|
873
903
|
to { transform: rotate(360deg); }
|
|
874
|
-
`,
|
|
904
|
+
`, Be = y`
|
|
875
905
|
position: absolute;
|
|
876
906
|
inset: 0;
|
|
877
907
|
z-index: 2;
|
|
@@ -887,46 +917,46 @@ var U = {
|
|
|
887
917
|
border-radius: 50%;
|
|
888
918
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
889
919
|
border-top-color: #fff;
|
|
890
|
-
animation: ${
|
|
920
|
+
animation: ${ze} 0.8s linear infinite;
|
|
891
921
|
}
|
|
892
|
-
`,
|
|
922
|
+
`, Ve = y`
|
|
893
923
|
position: absolute;
|
|
894
924
|
inset: auto 0 20%;
|
|
895
925
|
z-index: 3;
|
|
896
926
|
padding: 0 calc(2 * var(--mp-unit));
|
|
897
927
|
text-align: center;
|
|
898
928
|
color: #fff;
|
|
899
|
-
${
|
|
929
|
+
${Q.bLarge.regular}
|
|
900
930
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
901
931
|
pointer-events: none;
|
|
902
|
-
`,
|
|
903
|
-
let t =
|
|
904
|
-
return /* @__PURE__ */ O
|
|
905
|
-
t ? /* @__PURE__ */
|
|
932
|
+
`, He = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Ue = ({ onSubtitleRef: e }) => {
|
|
933
|
+
let t = Y((e) => e.title), n = Y((e) => e.hideUI), r = Y((e) => e.playbackError), i = Y((e) => e.ready), a = Y((e) => e.size), o = Y((e) => e.waiting), s = Y((e) => e.seekingTo);
|
|
934
|
+
return /* @__PURE__ */ A(O, { children: [
|
|
935
|
+
t ? /* @__PURE__ */ k("div", {
|
|
906
936
|
className: "title",
|
|
907
|
-
css:
|
|
937
|
+
css: Re,
|
|
908
938
|
style: { ...n ? {
|
|
909
939
|
opacity: "0",
|
|
910
940
|
pointerEvents: "none"
|
|
911
941
|
} : {} },
|
|
912
942
|
children: t
|
|
913
943
|
}) : void 0,
|
|
914
|
-
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */
|
|
915
|
-
r ? /* @__PURE__ */
|
|
916
|
-
css:
|
|
917
|
-
children:
|
|
944
|
+
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ k("div", { css: Be }) : void 0,
|
|
945
|
+
r ? /* @__PURE__ */ k("div", {
|
|
946
|
+
css: Ve,
|
|
947
|
+
children: He(r)
|
|
918
948
|
}) : void 0,
|
|
919
|
-
/* @__PURE__ */
|
|
949
|
+
/* @__PURE__ */ k("div", {
|
|
920
950
|
className: "subtitles",
|
|
921
951
|
ref: e,
|
|
922
|
-
css:
|
|
952
|
+
css: Le
|
|
923
953
|
})
|
|
924
954
|
] });
|
|
925
|
-
},
|
|
955
|
+
}, We = 1e-4, Ge = 1, Ke = (e) => Math.max(We, Math.min(Ge, e)) ** 2, qe = (e) => Math.max(We, Math.min(Ge, e)) ** (Ge / 2), Je = (e) => {
|
|
926
956
|
if (e === void 0) return "0:00";
|
|
927
957
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
928
958
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
929
|
-
},
|
|
959
|
+
}, Ye = (e, t) => `${Je(e)} / ${Je(t)}`, Xe = (e) => y`
|
|
930
960
|
display: flex;
|
|
931
961
|
justify-content: flex-start;
|
|
932
962
|
|
|
@@ -958,44 +988,44 @@ var U = {
|
|
|
958
988
|
z-index: 3;
|
|
959
989
|
|
|
960
990
|
* {
|
|
961
|
-
${
|
|
991
|
+
${Q.bMedium.regular}
|
|
962
992
|
}
|
|
963
993
|
|
|
964
|
-
${e === "sm" &&
|
|
994
|
+
${e === "sm" && y`
|
|
965
995
|
padding: calc(0.4 * var(--mp-unit))!important;
|
|
966
996
|
`}
|
|
967
|
-
${e === "md" &&
|
|
997
|
+
${e === "md" && y`
|
|
968
998
|
padding: calc(0.6 * var(--mp-unit))!important;
|
|
969
999
|
`}
|
|
970
|
-
${e === "lg" &&
|
|
1000
|
+
${e === "lg" && y`
|
|
971
1001
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
972
1002
|
`}
|
|
973
|
-
`,
|
|
1003
|
+
`, Ze = {
|
|
974
1004
|
x: -1,
|
|
975
1005
|
y: -1,
|
|
976
1006
|
anchors: 0
|
|
977
|
-
},
|
|
978
|
-
|
|
979
|
-
},
|
|
1007
|
+
}, Qe = (e) => {
|
|
1008
|
+
Ze.x = e.clientX, Ze.y = e.clientY;
|
|
1009
|
+
}, $e = () => (Ze.anchors++ === 0 && window.addEventListener("pointermove", Qe, {
|
|
980
1010
|
capture: !0,
|
|
981
1011
|
passive: !0
|
|
982
1012
|
}), () => {
|
|
983
|
-
--
|
|
1013
|
+
--Ze.anchors === 0 && window.removeEventListener("pointermove", Qe, { capture: !0 });
|
|
984
1014
|
}), $ = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
985
|
-
let l =
|
|
986
|
-
return
|
|
987
|
-
let e =
|
|
1015
|
+
let l = g(null), u = g(null);
|
|
1016
|
+
return m(() => {
|
|
1017
|
+
let e = $e(), t = () => {
|
|
988
1018
|
let e = l.current;
|
|
989
1019
|
if (!e) return;
|
|
990
1020
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
991
|
-
|
|
1021
|
+
Ze.x >= t && Ze.x < n && Ze.y >= r && Ze.y < i || u.current?.close();
|
|
992
1022
|
}, n = ["fullscreenchange", "webkitfullscreenchange"];
|
|
993
1023
|
for (let e of n) document.addEventListener(e, t);
|
|
994
1024
|
return () => {
|
|
995
1025
|
e();
|
|
996
1026
|
for (let e of n) document.removeEventListener(e, t);
|
|
997
1027
|
};
|
|
998
|
-
}, []), /* @__PURE__ */ O
|
|
1028
|
+
}, []), /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k("div", {
|
|
999
1029
|
ref: l,
|
|
1000
1030
|
"data-tooltip-id": e,
|
|
1001
1031
|
"data-open": !0,
|
|
@@ -1004,22 +1034,22 @@ var U = {
|
|
|
1004
1034
|
"data-tooltip-delay-hide": i,
|
|
1005
1035
|
"data-tooltip-place": o,
|
|
1006
1036
|
children: n
|
|
1007
|
-
}), !s && /* @__PURE__ */
|
|
1037
|
+
}), !s && /* @__PURE__ */ k(K, {
|
|
1008
1038
|
ref: u,
|
|
1009
|
-
css:
|
|
1039
|
+
css: Xe(c),
|
|
1010
1040
|
id: e,
|
|
1011
1041
|
noArrow: !0,
|
|
1012
1042
|
children: t
|
|
1013
1043
|
})] });
|
|
1014
|
-
},
|
|
1015
|
-
let [i, a] =
|
|
1044
|
+
}, et = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
1045
|
+
let [i, a] = _(!1), o = g(t);
|
|
1016
1046
|
o.current = t;
|
|
1017
|
-
let s =
|
|
1047
|
+
let s = g(null), c = p((t, r) => {
|
|
1018
1048
|
let i = e.current;
|
|
1019
1049
|
if (!i) return 0;
|
|
1020
1050
|
let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
|
|
1021
1051
|
return Math.min(Math.max(l, 0), 1);
|
|
1022
|
-
}, [e, n]), l =
|
|
1052
|
+
}, [e, n]), l = p((e) => {
|
|
1023
1053
|
if (!(r || e.button > 0)) {
|
|
1024
1054
|
s.current = e.pointerId;
|
|
1025
1055
|
try {
|
|
@@ -1027,9 +1057,9 @@ var U = {
|
|
|
1027
1057
|
} catch {}
|
|
1028
1058
|
a(!0), o.current(c(e.clientX, e.clientY));
|
|
1029
1059
|
}
|
|
1030
|
-
}, [r, c]), u =
|
|
1060
|
+
}, [r, c]), u = p((e) => {
|
|
1031
1061
|
s.current === e.pointerId && o.current(c(e.clientX, e.clientY));
|
|
1032
|
-
}, [c]),
|
|
1062
|
+
}, [c]), d = p((e) => {
|
|
1033
1063
|
if (s.current === e.pointerId) {
|
|
1034
1064
|
s.current = null;
|
|
1035
1065
|
try {
|
|
@@ -1038,38 +1068,38 @@ var U = {
|
|
|
1038
1068
|
a(!1);
|
|
1039
1069
|
}
|
|
1040
1070
|
}, []);
|
|
1041
|
-
return
|
|
1071
|
+
return m(() => {
|
|
1042
1072
|
r && (s.current = null, a(!1));
|
|
1043
1073
|
}, [r]), {
|
|
1044
1074
|
dragging: i,
|
|
1045
1075
|
handlers: {
|
|
1046
1076
|
onPointerDown: l,
|
|
1047
1077
|
onPointerMove: u,
|
|
1048
|
-
onPointerUp:
|
|
1049
|
-
onPointerCancel:
|
|
1078
|
+
onPointerUp: d,
|
|
1079
|
+
onPointerCancel: d,
|
|
1050
1080
|
style: { touchAction: "none" }
|
|
1051
1081
|
}
|
|
1052
1082
|
};
|
|
1053
|
-
},
|
|
1083
|
+
}, tt = 2, nt = .005, rt = "#000", it = "#0000", at = (e, t) => {
|
|
1054
1084
|
if (!t) return [];
|
|
1055
1085
|
let n = /* @__PURE__ */ new Set();
|
|
1056
1086
|
for (let { start: r, end: i } of e) for (let e of [r, i]) {
|
|
1057
1087
|
let r = e / t;
|
|
1058
|
-
r <=
|
|
1088
|
+
r <= nt || r >= .995 || n.add(Number((r * 100).toFixed(4)));
|
|
1059
1089
|
}
|
|
1060
1090
|
return n.size ? [
|
|
1061
1091
|
0,
|
|
1062
1092
|
...[...n].sort((e, t) => e - t),
|
|
1063
1093
|
100
|
|
1064
1094
|
] : [];
|
|
1065
|
-
},
|
|
1066
|
-
let n =
|
|
1095
|
+
}, ot = (e, t) => {
|
|
1096
|
+
let n = tt / 2, r = e.length - 2, i = [];
|
|
1067
1097
|
for (let a = 0; a <= r; a += 1) {
|
|
1068
1098
|
let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
|
|
1069
|
-
i.push(`${t(a) ?
|
|
1099
|
+
i.push(`${t(a) ? rt : it} ${c} ${l}`), a !== r && i.push(`${it} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
|
|
1070
1100
|
}
|
|
1071
1101
|
return `linear-gradient(90deg, ${i.join(", ")})`;
|
|
1072
|
-
},
|
|
1102
|
+
}, st = /* @__PURE__ */ new Set([
|
|
1073
1103
|
"op",
|
|
1074
1104
|
"ops",
|
|
1075
1105
|
"opening",
|
|
@@ -1077,7 +1107,7 @@ var U = {
|
|
|
1077
1107
|
"ncop",
|
|
1078
1108
|
"オープニング",
|
|
1079
1109
|
"op主題歌"
|
|
1080
|
-
]),
|
|
1110
|
+
]), ct = /* @__PURE__ */ new Set([
|
|
1081
1111
|
"ed",
|
|
1082
1112
|
"eds",
|
|
1083
1113
|
"ending",
|
|
@@ -1090,13 +1120,13 @@ var U = {
|
|
|
1090
1120
|
"エンドカード",
|
|
1091
1121
|
"エンドロール",
|
|
1092
1122
|
"ed主題歌"
|
|
1093
|
-
]),
|
|
1123
|
+
]), lt = /* @__PURE__ */ new Set(["intro", "イントロ"]), ut = /* @__PURE__ */ new Set(["outro", "アウトロ"]), dt = {
|
|
1094
1124
|
"credits start": "ending",
|
|
1095
1125
|
"credits end": null,
|
|
1096
1126
|
"preview end": null,
|
|
1097
1127
|
"end credits": "ending",
|
|
1098
1128
|
"closing credits": "ending"
|
|
1099
|
-
},
|
|
1129
|
+
}, ft = /* @__PURE__ */ new Set([
|
|
1100
1130
|
"theme",
|
|
1101
1131
|
"themes",
|
|
1102
1132
|
"song",
|
|
@@ -1115,53 +1145,53 @@ var U = {
|
|
|
1115
1145
|
"the",
|
|
1116
1146
|
"主題歌",
|
|
1117
1147
|
"ノンクレジット"
|
|
1118
|
-
]),
|
|
1148
|
+
]), pt = /* @__PURE__ */ new Set([
|
|
1119
1149
|
"post",
|
|
1120
1150
|
"pre",
|
|
1121
1151
|
"after",
|
|
1122
1152
|
"before",
|
|
1123
1153
|
"non"
|
|
1124
|
-
]),
|
|
1125
|
-
if (
|
|
1126
|
-
if (
|
|
1154
|
+
]), mt = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, ht = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), gt = (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) && !ft.has(e)), _t = (e, t) => {
|
|
1155
|
+
if (st.has(e)) return "opening";
|
|
1156
|
+
if (ct.has(e)) return "ending";
|
|
1127
1157
|
if (t) {
|
|
1128
|
-
if (
|
|
1129
|
-
if (
|
|
1158
|
+
if (lt.has(e)) return "opening";
|
|
1159
|
+
if (ut.has(e)) return "ending";
|
|
1130
1160
|
}
|
|
1131
|
-
},
|
|
1132
|
-
if (
|
|
1161
|
+
}, vt = (e, t) => {
|
|
1162
|
+
if (ht(e)) return;
|
|
1133
1163
|
let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
|
|
1134
|
-
if (n in
|
|
1135
|
-
let r = n.split(
|
|
1136
|
-
if (r.some((e) => e.split(/[\s_]+/u).some((e) =>
|
|
1164
|
+
if (n in dt) return dt[n] ?? void 0;
|
|
1165
|
+
let r = n.split(mt).map((e) => e.trim()).filter(Boolean);
|
|
1166
|
+
if (r.some((e) => e.split(/[\s_]+/u).some((e) => pt.has(e)))) return;
|
|
1137
1167
|
let i = r.length > 1 ? [r[0], r.at(-1)] : r;
|
|
1138
1168
|
for (let e of i) {
|
|
1139
|
-
let n =
|
|
1169
|
+
let n = gt(e);
|
|
1140
1170
|
if (n.length !== 1) continue;
|
|
1141
|
-
let r =
|
|
1171
|
+
let r = _t(n[0], t);
|
|
1142
1172
|
if (r) return r;
|
|
1143
1173
|
}
|
|
1144
|
-
},
|
|
1174
|
+
}, yt = 15, bt = 87, xt = 93, St = (e) => {
|
|
1145
1175
|
let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
|
|
1146
1176
|
if (!n) return t;
|
|
1147
1177
|
let r = e.map((e, t) => ({
|
|
1148
1178
|
index: t,
|
|
1149
1179
|
start: e.start,
|
|
1150
1180
|
length: e.end - e.start
|
|
1151
|
-
})).filter(({ length: e }) => e >=
|
|
1181
|
+
})).filter(({ length: e }) => e >= bt && e <= xt), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
|
|
1152
1182
|
return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
|
|
1153
|
-
},
|
|
1154
|
-
let t = e.map(({ title: e }) =>
|
|
1183
|
+
}, Ct = (e) => {
|
|
1184
|
+
let t = e.map(({ title: e }) => vt(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);
|
|
1155
1185
|
if (r > 0 && n * 2 > r) return e.map(() => void 0);
|
|
1156
1186
|
let i = e.map((e, n) => {
|
|
1157
|
-
if (e.end - e.start <
|
|
1187
|
+
if (e.end - e.start < yt) return;
|
|
1158
1188
|
let r = t[n];
|
|
1159
1189
|
if (r) return r;
|
|
1160
|
-
let i =
|
|
1190
|
+
let i = vt(e.title, !0);
|
|
1161
1191
|
return i && !t.includes(i) ? i : void 0;
|
|
1162
1192
|
});
|
|
1163
|
-
return e.every(({ title: e }) =>
|
|
1164
|
-
},
|
|
1193
|
+
return e.every(({ title: e }) => ht(e)) ? St(e) : i;
|
|
1194
|
+
}, wt = y`
|
|
1165
1195
|
position: relative;
|
|
1166
1196
|
height: calc(.4 * var(--mp-unit));
|
|
1167
1197
|
|
|
@@ -1246,7 +1276,7 @@ var U = {
|
|
|
1246
1276
|
box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
|
|
1247
1277
|
|
|
1248
1278
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1249
|
-
${
|
|
1279
|
+
${Q.bMedium.bold}
|
|
1250
1280
|
|
|
1251
1281
|
gap: calc(.6 * var(--mp-unit));
|
|
1252
1282
|
|
|
@@ -1380,58 +1410,58 @@ var U = {
|
|
|
1380
1410
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1381
1411
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1382
1412
|
}
|
|
1383
|
-
`,
|
|
1384
|
-
let e =
|
|
1413
|
+
`, Tt = 4, Et = () => {
|
|
1414
|
+
let e = Y(), t = Y((e) => e.currentTime), n = Y((e) => e.requestSeek), r = Y((e) => e.duration), i = Y((e) => e.size), a = Y((e) => e.downloadedRanges), o = Y((e) => e.buffered), s = Y((e) => e.indexes), c = Y((e) => e.thumbnails), l = Y((e) => e.thumbnailAt), u = Y((e) => e.requestThumbnail), d = Y((e) => e.chapters), f = Y((e) => e.seekingTo), p = Y((e) => e.setSourceState), v = Y((e) => e.hideUI), y = g(null), [b, x] = _(void 0), [S, C] = _(void 0), w = (e) => {
|
|
1385
1415
|
C(e), u(e);
|
|
1386
1416
|
}, T = !!S;
|
|
1387
|
-
|
|
1388
|
-
if (T) return
|
|
1389
|
-
}, [
|
|
1417
|
+
m(() => {
|
|
1418
|
+
if (T) return p({ seekPreview: !0 }), () => p({ seekPreview: !1 });
|
|
1419
|
+
}, [p, T]), m(() => {
|
|
1390
1420
|
v && w(void 0);
|
|
1391
1421
|
}, [v]);
|
|
1392
|
-
let E =
|
|
1422
|
+
let E = g(void 0), D = g(0), O = g(void 0), j = g(void 0), M = g(!1), { dragging: N, handlers: P } = et({
|
|
1393
1423
|
ref: y,
|
|
1394
1424
|
onChange: (e) => {
|
|
1395
|
-
if (
|
|
1425
|
+
if (D.current += 1, O.current = e, j.current === void 0) j.current = e;
|
|
1396
1426
|
else if (!M.current) {
|
|
1397
1427
|
let t = y.current?.getBoundingClientRect().width ?? 0;
|
|
1398
|
-
Math.abs(e - j.current) * t >
|
|
1428
|
+
Math.abs(e - j.current) * t > Tt && (M.current = !0);
|
|
1399
1429
|
}
|
|
1400
1430
|
x(e), E.current !== "mouse" && w(e * r);
|
|
1401
1431
|
}
|
|
1402
1432
|
}), F = (e) => {
|
|
1403
|
-
E.current = e.pointerType,
|
|
1433
|
+
E.current = e.pointerType, D.current = 0, j.current = void 0, M.current = !1, P.onPointerDown(e);
|
|
1404
1434
|
}, I = (t) => {
|
|
1405
1435
|
P.onPointerUp(t);
|
|
1406
|
-
let i =
|
|
1436
|
+
let i = D.current > 0 ? O.current : void 0;
|
|
1407
1437
|
if (i !== void 0 && r) {
|
|
1408
1438
|
let t = i * r;
|
|
1409
1439
|
n ? n(t) : e.seek(t);
|
|
1410
1440
|
}
|
|
1411
|
-
|
|
1441
|
+
D.current = 0, M.current = !1, j.current = void 0, t.pointerType !== "mouse" && w(void 0);
|
|
1412
1442
|
}, L = (e) => {
|
|
1413
1443
|
if (!y.current) return;
|
|
1414
1444
|
let { left: t, right: n } = y.current.getBoundingClientRect();
|
|
1415
1445
|
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
1416
|
-
}, R =
|
|
1446
|
+
}, R = g("mouse"), z = (e) => {
|
|
1417
1447
|
R.current = e.pointerType;
|
|
1418
1448
|
}, B = (e) => {
|
|
1419
1449
|
R.current !== "touch" && w(L(e.clientX));
|
|
1420
1450
|
}, V = () => {
|
|
1421
1451
|
y.current && w(void 0);
|
|
1422
|
-
}, H = (e) => r ? e / r * 100 : 0,
|
|
1452
|
+
}, H = (e) => r ? e / r * 100 : 0, U = (e, t, n) => {
|
|
1423
1453
|
let r = Number((n - t).toFixed(4)), i = t * 100;
|
|
1424
|
-
return /* @__PURE__ */
|
|
1454
|
+
return /* @__PURE__ */ k("div", {
|
|
1425
1455
|
className: "loaded-part",
|
|
1426
1456
|
style: {
|
|
1427
1457
|
transform: `scaleX(${r})`,
|
|
1428
1458
|
marginLeft: `${i}%`
|
|
1429
1459
|
}
|
|
1430
1460
|
}, e);
|
|
1431
|
-
},
|
|
1461
|
+
}, W = h(() => i === void 0 ? r ? o.map(([e, t], n) => U(n, e / r, t / r)) : [] : a?.map((e, t) => {
|
|
1432
1462
|
if (!i || !r) return null;
|
|
1433
1463
|
let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
|
|
1434
|
-
return !a || !o ? null :
|
|
1464
|
+
return !a || !o ? null : U(t, a.timestamp / r, o.timestamp / r);
|
|
1435
1465
|
}) ?? [], [
|
|
1436
1466
|
r,
|
|
1437
1467
|
i,
|
|
@@ -1439,7 +1469,7 @@ var U = {
|
|
|
1439
1469
|
s.length,
|
|
1440
1470
|
a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
1441
1471
|
]);
|
|
1442
|
-
|
|
1472
|
+
m(() => {
|
|
1443
1473
|
b !== void 0 && r && N && M.current && e.seek(b * r);
|
|
1444
1474
|
}, [
|
|
1445
1475
|
e,
|
|
@@ -1447,33 +1477,33 @@ var U = {
|
|
|
1447
1477
|
b,
|
|
1448
1478
|
r
|
|
1449
1479
|
]);
|
|
1450
|
-
let
|
|
1480
|
+
let ee = h(() => {
|
|
1451
1481
|
if (!r) return 0;
|
|
1452
1482
|
if (N && b !== void 0) return b;
|
|
1453
|
-
let e =
|
|
1483
|
+
let e = f ?? t;
|
|
1454
1484
|
return typeof e == "number" ? e / r : 0;
|
|
1455
1485
|
}, [
|
|
1456
1486
|
r,
|
|
1457
1487
|
t,
|
|
1458
1488
|
N,
|
|
1459
1489
|
b,
|
|
1460
|
-
|
|
1461
|
-
]),
|
|
1462
|
-
if (!
|
|
1463
|
-
let e = S / r * 100, t =
|
|
1464
|
-
return t >= 0 ? t :
|
|
1490
|
+
f
|
|
1491
|
+
]), G = h(() => at(d, r), [d, r]), K = G.length > 0, q = h(() => {
|
|
1492
|
+
if (!K || S === void 0 || !r) return -1;
|
|
1493
|
+
let e = S / r * 100, t = G.findIndex((t, n) => n < G.length - 1 && e >= t && e < G[n + 1]);
|
|
1494
|
+
return t >= 0 ? t : G.length - 2;
|
|
1465
1495
|
}, [
|
|
1466
|
-
|
|
1467
|
-
|
|
1496
|
+
K,
|
|
1497
|
+
G,
|
|
1468
1498
|
S,
|
|
1469
1499
|
r
|
|
1470
|
-
]),
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
]),
|
|
1500
|
+
]), te = h(() => K ? ot(G, (e) => e !== q) : void 0, [
|
|
1501
|
+
K,
|
|
1502
|
+
G,
|
|
1503
|
+
q
|
|
1504
|
+
]), J = h(() => q >= 0 ? ot(G, (e) => e === q) : void 0, [G, q]), ne = h(() => {
|
|
1475
1505
|
if (S !== void 0) return d.find(({ start: e, end: t }) => e <= S && S < t);
|
|
1476
|
-
}, [d, S]),
|
|
1506
|
+
}, [d, S]), re = h(() => {
|
|
1477
1507
|
if (S) {
|
|
1478
1508
|
if (l) return l(S);
|
|
1479
1509
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= S && S < t);
|
|
@@ -1482,71 +1512,71 @@ var U = {
|
|
|
1482
1512
|
c,
|
|
1483
1513
|
l,
|
|
1484
1514
|
S
|
|
1485
|
-
]),
|
|
1515
|
+
]), X = (e, t) => /* @__PURE__ */ A("div", {
|
|
1486
1516
|
className: e ? `track ${e}` : "track",
|
|
1487
1517
|
style: t ? { maskImage: t } : void 0,
|
|
1488
1518
|
children: [
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1519
|
+
/* @__PURE__ */ k("div", { className: "background-bar" }),
|
|
1520
|
+
/* @__PURE__ */ k("div", {
|
|
1491
1521
|
className: "loaded",
|
|
1492
|
-
children:
|
|
1522
|
+
children: W
|
|
1493
1523
|
}),
|
|
1494
|
-
/* @__PURE__ */
|
|
1524
|
+
/* @__PURE__ */ k("div", {
|
|
1495
1525
|
className: "play-container",
|
|
1496
|
-
children: /* @__PURE__ */
|
|
1526
|
+
children: /* @__PURE__ */ k("div", {
|
|
1497
1527
|
className: "play",
|
|
1498
|
-
style: { transform: `scaleX(${
|
|
1528
|
+
style: { transform: `scaleX(${ee})` }
|
|
1499
1529
|
})
|
|
1500
1530
|
})
|
|
1501
1531
|
]
|
|
1502
1532
|
});
|
|
1503
|
-
return /* @__PURE__ */
|
|
1504
|
-
css:
|
|
1533
|
+
return /* @__PURE__ */ A("div", {
|
|
1534
|
+
css: wt,
|
|
1505
1535
|
ref: y,
|
|
1506
1536
|
className: [
|
|
1507
1537
|
"progress-bar",
|
|
1508
1538
|
N ? "dragging" : "",
|
|
1509
|
-
|
|
1539
|
+
K ? "segmented" : ""
|
|
1510
1540
|
].filter(Boolean).join(" "),
|
|
1511
1541
|
onPointerDown: z,
|
|
1512
1542
|
onPointerMove: z,
|
|
1513
1543
|
onMouseMove: B,
|
|
1514
1544
|
onMouseOut: V,
|
|
1515
1545
|
children: [
|
|
1516
|
-
|
|
1517
|
-
S ? /* @__PURE__ */
|
|
1546
|
+
X(void 0, te),
|
|
1547
|
+
S ? /* @__PURE__ */ A("div", {
|
|
1518
1548
|
className: "cursor-time",
|
|
1519
1549
|
style: {
|
|
1520
|
-
left:
|
|
1521
|
-
maxWidth:
|
|
1550
|
+
left: ne ? `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))))`,
|
|
1551
|
+
maxWidth: ne ? "var(--thumbnail-width)" : void 0
|
|
1522
1552
|
},
|
|
1523
|
-
children: [/* @__PURE__ */
|
|
1553
|
+
children: [/* @__PURE__ */ k("span", {
|
|
1524
1554
|
className: "cursor-time-value",
|
|
1525
|
-
children:
|
|
1526
|
-
}),
|
|
1555
|
+
children: Je(S)
|
|
1556
|
+
}), ne ? /* @__PURE__ */ k("span", {
|
|
1527
1557
|
className: "chapter-title",
|
|
1528
|
-
children:
|
|
1558
|
+
children: ne.title
|
|
1529
1559
|
}) : void 0]
|
|
1530
1560
|
}) : void 0,
|
|
1531
|
-
/* @__PURE__ */
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1561
|
+
/* @__PURE__ */ k("div", { className: "progress" }),
|
|
1562
|
+
/* @__PURE__ */ k("div", { className: "hover" }),
|
|
1563
|
+
J ? X("focus", J) : void 0,
|
|
1564
|
+
/* @__PURE__ */ k("div", { className: "scrubber" }),
|
|
1565
|
+
/* @__PURE__ */ k("div", {
|
|
1536
1566
|
className: "padding",
|
|
1537
1567
|
...P,
|
|
1538
1568
|
onPointerDown: F,
|
|
1539
1569
|
onPointerUp: I,
|
|
1540
1570
|
onPointerCancel: I
|
|
1541
1571
|
}),
|
|
1542
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ k("div", {
|
|
1543
1573
|
className: "thumbnail",
|
|
1544
1574
|
style: { left: `clamp(var(--thumbnail-half), ${H(S ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1545
|
-
children:
|
|
1575
|
+
children: re?.url ? /* @__PURE__ */ k("img", { src: re.url }) : void 0
|
|
1546
1576
|
})
|
|
1547
1577
|
]
|
|
1548
1578
|
});
|
|
1549
|
-
},
|
|
1579
|
+
}, Dt = "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", Ot = {
|
|
1550
1580
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1551
1581
|
width: 24,
|
|
1552
1582
|
height: 24,
|
|
@@ -1556,12 +1586,12 @@ var U = {
|
|
|
1556
1586
|
strokeWidth: 2,
|
|
1557
1587
|
strokeLinecap: "round",
|
|
1558
1588
|
strokeLinejoin: "round"
|
|
1559
|
-
},
|
|
1560
|
-
...
|
|
1589
|
+
}, kt = (e) => /* @__PURE__ */ A("svg", {
|
|
1590
|
+
...Ot,
|
|
1561
1591
|
...e,
|
|
1562
1592
|
children: [
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ k("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
1594
|
+
/* @__PURE__ */ k("rect", {
|
|
1565
1595
|
x: "12",
|
|
1566
1596
|
y: "13",
|
|
1567
1597
|
width: "10",
|
|
@@ -1569,14 +1599,14 @@ var U = {
|
|
|
1569
1599
|
rx: "1",
|
|
1570
1600
|
ry: "1"
|
|
1571
1601
|
}),
|
|
1572
|
-
/* @__PURE__ */
|
|
1602
|
+
/* @__PURE__ */ k("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1573
1603
|
]
|
|
1574
|
-
}),
|
|
1575
|
-
...
|
|
1604
|
+
}), At = (e) => /* @__PURE__ */ A("svg", {
|
|
1605
|
+
...Ot,
|
|
1576
1606
|
...e,
|
|
1577
1607
|
children: [
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ k("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
1609
|
+
/* @__PURE__ */ k("rect", {
|
|
1580
1610
|
x: "12",
|
|
1581
1611
|
y: "13",
|
|
1582
1612
|
width: "10",
|
|
@@ -1584,9 +1614,9 @@ var U = {
|
|
|
1584
1614
|
rx: "1",
|
|
1585
1615
|
ry: "1"
|
|
1586
1616
|
}),
|
|
1587
|
-
/* @__PURE__ */
|
|
1617
|
+
/* @__PURE__ */ k("path", { d: "M6 9h3m2 0h2" })
|
|
1588
1618
|
]
|
|
1589
|
-
}),
|
|
1619
|
+
}), jt = y`
|
|
1590
1620
|
.popover {
|
|
1591
1621
|
position: absolute;
|
|
1592
1622
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1625,7 +1655,7 @@ var U = {
|
|
|
1625
1655
|
|
|
1626
1656
|
border-radius: 8px;
|
|
1627
1657
|
background-color: rgba(28,28,28,0.95);
|
|
1628
|
-
${
|
|
1658
|
+
${Q.bMedium.regular}
|
|
1629
1659
|
|
|
1630
1660
|
z-index: 4;
|
|
1631
1661
|
|
|
@@ -1668,7 +1698,7 @@ var U = {
|
|
|
1668
1698
|
|
|
1669
1699
|
.secondary {
|
|
1670
1700
|
color: #eee;
|
|
1671
|
-
${
|
|
1701
|
+
${Q.bSmall.regular}
|
|
1672
1702
|
}
|
|
1673
1703
|
}
|
|
1674
1704
|
}
|
|
@@ -1710,29 +1740,29 @@ var U = {
|
|
|
1710
1740
|
.failed {
|
|
1711
1741
|
border-bottom: 1px solid #4D4D4E;
|
|
1712
1742
|
color: #f66;
|
|
1713
|
-
${
|
|
1743
|
+
${Q.bSmall.regular}
|
|
1714
1744
|
}
|
|
1715
1745
|
}
|
|
1716
|
-
`,
|
|
1746
|
+
`, Mt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1717
1747
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1718
1748
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1719
|
-
return /* @__PURE__ */
|
|
1749
|
+
return /* @__PURE__ */ A("div", {
|
|
1720
1750
|
onClick: () => {
|
|
1721
1751
|
l || r(e ?? void 0);
|
|
1722
1752
|
},
|
|
1723
1753
|
className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
|
|
1724
|
-
children: [/* @__PURE__ */
|
|
1754
|
+
children: [/* @__PURE__ */ k("span", { children: i }), /* @__PURE__ */ k("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
|
|
1725
1755
|
}, e ?? "__off__");
|
|
1726
1756
|
};
|
|
1727
|
-
return /* @__PURE__ */
|
|
1757
|
+
return /* @__PURE__ */ A("div", {
|
|
1728
1758
|
className: "popover track-list",
|
|
1729
1759
|
children: [
|
|
1730
|
-
/* @__PURE__ */
|
|
1760
|
+
/* @__PURE__ */ A("div", {
|
|
1731
1761
|
className: i ? "back" : "back no-hover",
|
|
1732
1762
|
onClick: i,
|
|
1733
|
-
children: [i ? /* @__PURE__ */
|
|
1763
|
+
children: [i ? /* @__PURE__ */ k(P, {}) : null, /* @__PURE__ */ k("span", { children: e })]
|
|
1734
1764
|
}),
|
|
1735
|
-
s ? /* @__PURE__ */
|
|
1765
|
+
s ? /* @__PURE__ */ k("div", {
|
|
1736
1766
|
className: "no-hover failed",
|
|
1737
1767
|
children: "Could not switch. Try again."
|
|
1738
1768
|
}) : null,
|
|
@@ -1740,13 +1770,13 @@ var U = {
|
|
|
1740
1770
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1741
1771
|
]
|
|
1742
1772
|
});
|
|
1743
|
-
},
|
|
1744
|
-
let t =
|
|
1773
|
+
}, Nt = ({ onReset: e } = {}) => {
|
|
1774
|
+
let t = g(null), [n, r] = _(!1), [i, a] = _(void 0), [o, s] = _(!1), c = g(e);
|
|
1745
1775
|
c.current = e;
|
|
1746
1776
|
let l = () => {
|
|
1747
1777
|
r(!1), c.current?.();
|
|
1748
1778
|
};
|
|
1749
|
-
return
|
|
1779
|
+
return m(() => {
|
|
1750
1780
|
let e = (e) => {
|
|
1751
1781
|
n && t.current && !t.current.contains(e.target) && l();
|
|
1752
1782
|
};
|
|
@@ -1781,7 +1811,7 @@ var U = {
|
|
|
1781
1811
|
});
|
|
1782
1812
|
}
|
|
1783
1813
|
};
|
|
1784
|
-
},
|
|
1814
|
+
}, Pt = y`
|
|
1785
1815
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1786
1816
|
which is the width of the player box, so it can be clamped to it. */
|
|
1787
1817
|
position: static;
|
|
@@ -1797,7 +1827,7 @@ position: static;
|
|
|
1797
1827
|
}
|
|
1798
1828
|
}
|
|
1799
1829
|
|
|
1800
|
-
${
|
|
1830
|
+
${jt}
|
|
1801
1831
|
|
|
1802
1832
|
.popover.error-list {
|
|
1803
1833
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1825,7 +1855,7 @@ ${Ot}
|
|
|
1825
1855
|
|
|
1826
1856
|
color: #fff;
|
|
1827
1857
|
cursor: pointer;
|
|
1828
|
-
${
|
|
1858
|
+
${Q.bSmall.regular}
|
|
1829
1859
|
|
|
1830
1860
|
&:hover {
|
|
1831
1861
|
background-color: rgba(255,255,255,.1);
|
|
@@ -1846,7 +1876,7 @@ ${Ot}
|
|
|
1846
1876
|
|
|
1847
1877
|
.when {
|
|
1848
1878
|
color: #bbb;
|
|
1849
|
-
${
|
|
1879
|
+
${Q.bSmall.regular}
|
|
1850
1880
|
|
|
1851
1881
|
/* the one part of the line worth scanning for, so it is the one part at full brightness */
|
|
1852
1882
|
.count {
|
|
@@ -1865,72 +1895,72 @@ ${Ot}
|
|
|
1865
1895
|
color: #ddd;
|
|
1866
1896
|
overflow-wrap: anywhere;
|
|
1867
1897
|
white-space: pre-wrap;
|
|
1868
|
-
${
|
|
1898
|
+
${Q.bSmall.regular}
|
|
1869
1899
|
}
|
|
1870
1900
|
}
|
|
1871
1901
|
}
|
|
1872
|
-
`,
|
|
1873
|
-
let n =
|
|
1902
|
+
`, Ft = (e) => new Date(e).toLocaleTimeString(), It = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Je(Math.max(0, e)), Lt = (e) => e.reduce((e, t) => e + t.count, 0), Rt = (e) => e.map((e, t) => {
|
|
1903
|
+
let n = It(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1874
1904
|
return [
|
|
1875
1905
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1876
1906
|
e.message,
|
|
1877
1907
|
e.detail
|
|
1878
1908
|
].filter(Boolean).join("\n");
|
|
1879
|
-
}).join("\n\n"),
|
|
1880
|
-
let e =
|
|
1909
|
+
}).join("\n\n"), zt = () => {
|
|
1910
|
+
let e = Y((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Nt(), [i, a] = _(!1);
|
|
1881
1911
|
if (e.length === 0) return null;
|
|
1882
1912
|
let o = () => {
|
|
1883
|
-
navigator.clipboard?.writeText(
|
|
1913
|
+
navigator.clipboard?.writeText(Rt(e)).then(() => {
|
|
1884
1914
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1885
1915
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1886
|
-
}, s = `Playback errors (${
|
|
1887
|
-
return /* @__PURE__ */
|
|
1888
|
-
css:
|
|
1916
|
+
}, s = `Playback errors (${Lt(e)})`;
|
|
1917
|
+
return /* @__PURE__ */ A("div", {
|
|
1918
|
+
css: Pt,
|
|
1889
1919
|
ref: r,
|
|
1890
|
-
children: [/* @__PURE__ */
|
|
1920
|
+
children: [/* @__PURE__ */ k($, {
|
|
1891
1921
|
id: "errors",
|
|
1892
1922
|
disabled: t,
|
|
1893
|
-
text: /* @__PURE__ */
|
|
1923
|
+
text: /* @__PURE__ */ k("button", {
|
|
1894
1924
|
className: "errors",
|
|
1895
1925
|
type: "button",
|
|
1896
1926
|
onClick: n,
|
|
1897
1927
|
"aria-label": s,
|
|
1898
1928
|
"aria-expanded": t,
|
|
1899
|
-
children: /* @__PURE__ */
|
|
1929
|
+
children: /* @__PURE__ */ k(U, { className: "alert-triangle" })
|
|
1900
1930
|
}),
|
|
1901
|
-
toolTipText: /* @__PURE__ */
|
|
1902
|
-
}), t && /* @__PURE__ */
|
|
1931
|
+
toolTipText: /* @__PURE__ */ k("span", { children: s })
|
|
1932
|
+
}), t && /* @__PURE__ */ A("div", {
|
|
1903
1933
|
className: "popover error-list",
|
|
1904
|
-
children: [/* @__PURE__ */
|
|
1934
|
+
children: [/* @__PURE__ */ A("div", {
|
|
1905
1935
|
className: "back no-hover",
|
|
1906
|
-
children: [/* @__PURE__ */
|
|
1936
|
+
children: [/* @__PURE__ */ k("span", { children: s }), /* @__PURE__ */ A("button", {
|
|
1907
1937
|
className: "copy",
|
|
1908
1938
|
type: "button",
|
|
1909
1939
|
onClick: o,
|
|
1910
1940
|
"aria-label": "Copy the errors",
|
|
1911
|
-
children: [
|
|
1941
|
+
children: [k(i ? N : I, {}), /* @__PURE__ */ k("span", { children: i ? "Copied" : "Copy" })]
|
|
1912
1942
|
})]
|
|
1913
|
-
}), e.map((e, t) => /* @__PURE__ */
|
|
1943
|
+
}), e.map((e, t) => /* @__PURE__ */ A("div", {
|
|
1914
1944
|
className: "entry no-hover",
|
|
1915
1945
|
children: [
|
|
1916
|
-
/* @__PURE__ */
|
|
1946
|
+
/* @__PURE__ */ A("span", {
|
|
1917
1947
|
className: "when",
|
|
1918
1948
|
children: [
|
|
1919
|
-
|
|
1920
|
-
e.count > 1 ? ` to ${
|
|
1921
|
-
|
|
1949
|
+
Ft(e.at),
|
|
1950
|
+
e.count > 1 ? ` to ${Ft(e.lastAt)}` : "",
|
|
1951
|
+
It(e.atMediaTime) ? ` at ${It(e.atMediaTime)}` : "",
|
|
1922
1952
|
e.recovered ? " recovered" : "",
|
|
1923
|
-
e.count > 1 ? /* @__PURE__ */
|
|
1953
|
+
e.count > 1 ? /* @__PURE__ */ k("span", {
|
|
1924
1954
|
className: "count",
|
|
1925
1955
|
children: `×${e.count}`
|
|
1926
1956
|
}) : null
|
|
1927
1957
|
]
|
|
1928
1958
|
}),
|
|
1929
|
-
/* @__PURE__ */
|
|
1959
|
+
/* @__PURE__ */ k("span", {
|
|
1930
1960
|
className: "what",
|
|
1931
1961
|
children: e.message
|
|
1932
1962
|
}),
|
|
1933
|
-
e.detail ? /* @__PURE__ */
|
|
1963
|
+
e.detail ? /* @__PURE__ */ k("span", {
|
|
1934
1964
|
className: "cause",
|
|
1935
1965
|
children: e.detail
|
|
1936
1966
|
}) : null
|
|
@@ -1938,7 +1968,7 @@ ${Ot}
|
|
|
1938
1968
|
}, `${e.at}-${t}`))]
|
|
1939
1969
|
})]
|
|
1940
1970
|
});
|
|
1941
|
-
},
|
|
1971
|
+
}, Bt = y`
|
|
1942
1972
|
display: flex;
|
|
1943
1973
|
align-items: center;
|
|
1944
1974
|
justify-content: center;
|
|
@@ -1991,8 +2021,8 @@ width: 100%;
|
|
|
1991
2021
|
}
|
|
1992
2022
|
}
|
|
1993
2023
|
}
|
|
1994
|
-
`,
|
|
1995
|
-
let e =
|
|
2024
|
+
`, Vt = () => {
|
|
2025
|
+
let e = Y(), t = Y((e) => e.playbackRate), n = g(null), r = g(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 } = et({
|
|
1996
2026
|
ref: r,
|
|
1997
2027
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1998
2028
|
}), d = (t) => {
|
|
@@ -2000,33 +2030,33 @@ width: 100%;
|
|
|
2000
2030
|
let n = .05, r = s;
|
|
2001
2031
|
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
2002
2032
|
};
|
|
2003
|
-
|
|
2033
|
+
m(() => {
|
|
2004
2034
|
let e = n.current;
|
|
2005
2035
|
return e && e.addEventListener("wheel", d, { passive: !1 }), () => {
|
|
2006
2036
|
e && e.removeEventListener("wheel", d);
|
|
2007
2037
|
};
|
|
2008
2038
|
}, [t]);
|
|
2009
|
-
let
|
|
2010
|
-
return /* @__PURE__ */
|
|
2011
|
-
css:
|
|
2012
|
-
children: [/* @__PURE__ */
|
|
2039
|
+
let f = c(s);
|
|
2040
|
+
return /* @__PURE__ */ A("div", {
|
|
2041
|
+
css: Bt,
|
|
2042
|
+
children: [/* @__PURE__ */ A("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ k("div", {
|
|
2013
2043
|
className: "playback-slider",
|
|
2014
2044
|
ref: n,
|
|
2015
2045
|
...u,
|
|
2016
|
-
children: /* @__PURE__ */
|
|
2046
|
+
children: /* @__PURE__ */ k("div", {
|
|
2017
2047
|
ref: r,
|
|
2018
2048
|
style: { background: `linear-gradient(to right,
|
|
2019
|
-
#fff 0% ${
|
|
2020
|
-
#3A3A3A ${
|
|
2049
|
+
#fff 0% ${f}%,
|
|
2050
|
+
#3A3A3A ${f}% 100%
|
|
2021
2051
|
)` },
|
|
2022
|
-
children: /* @__PURE__ */
|
|
2052
|
+
children: /* @__PURE__ */ k("div", {
|
|
2023
2053
|
className: "playback-handle",
|
|
2024
|
-
style: { left: `${
|
|
2054
|
+
style: { left: `${f}%` }
|
|
2025
2055
|
})
|
|
2026
2056
|
})
|
|
2027
2057
|
})]
|
|
2028
2058
|
});
|
|
2029
|
-
},
|
|
2059
|
+
}, Ht = y`
|
|
2030
2060
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
2031
2061
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
2032
2062
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -2044,7 +2074,7 @@ position: static;
|
|
|
2044
2074
|
}
|
|
2045
2075
|
}
|
|
2046
2076
|
|
|
2047
|
-
${
|
|
2077
|
+
${jt}
|
|
2048
2078
|
|
|
2049
2079
|
.switch {
|
|
2050
2080
|
position: relative;
|
|
@@ -2120,55 +2150,55 @@ ${Ot}
|
|
|
2120
2150
|
}
|
|
2121
2151
|
}
|
|
2122
2152
|
|
|
2123
|
-
`,
|
|
2124
|
-
let e =
|
|
2153
|
+
`, Ut = () => {
|
|
2154
|
+
let e = Y(), t = Y((e) => e.playbackRate), n = Y((e) => e.audioTracks), r = Y((e) => e.selectedAudioTrack), i = Y((e) => e.selectAudioTrack), a = Y((e) => e.quality), o = Y((e) => e.volumeNormalizer), [s, c] = _(0), { open: l, toggle: u, containerRef: d, pending: f, failed: p, runSelect: m } = Nt({ onReset: () => c(0) }), h = (t) => {
|
|
2125
2155
|
e.setPlaybackRate(t), c(0);
|
|
2126
|
-
},
|
|
2156
|
+
}, g = (e) => {
|
|
2127
2157
|
e !== void 0 && m(e, () => i(e));
|
|
2128
2158
|
}, v = (e) => {
|
|
2129
2159
|
a && m(e ?? null, () => a.select(e === void 0 ? null : String(e)));
|
|
2130
2160
|
}, 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) => () => {
|
|
2131
2161
|
c(e);
|
|
2132
2162
|
};
|
|
2133
|
-
return /* @__PURE__ */
|
|
2134
|
-
css:
|
|
2163
|
+
return /* @__PURE__ */ A("div", {
|
|
2164
|
+
css: Ht,
|
|
2135
2165
|
ref: d,
|
|
2136
2166
|
children: [
|
|
2137
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ k($, {
|
|
2138
2168
|
id: "settings",
|
|
2139
2169
|
disabled: l,
|
|
2140
|
-
text: /* @__PURE__ */
|
|
2170
|
+
text: /* @__PURE__ */ k("button", {
|
|
2141
2171
|
className: "settings",
|
|
2142
2172
|
type: "button",
|
|
2143
2173
|
onClick: u,
|
|
2144
2174
|
"aria-label": "Settings",
|
|
2145
2175
|
"aria-expanded": l,
|
|
2146
|
-
children: /* @__PURE__ */
|
|
2176
|
+
children: /* @__PURE__ */ k(H, {})
|
|
2147
2177
|
}),
|
|
2148
|
-
toolTipText: /* @__PURE__ */
|
|
2178
|
+
toolTipText: /* @__PURE__ */ k("span", { children: "Settings" })
|
|
2149
2179
|
}),
|
|
2150
|
-
l && s === 0 && /* @__PURE__ */
|
|
2180
|
+
l && s === 0 && /* @__PURE__ */ A("div", {
|
|
2151
2181
|
className: "popover menu",
|
|
2152
2182
|
children: [
|
|
2153
|
-
n.length > 1 ? /* @__PURE__ */
|
|
2183
|
+
n.length > 1 ? /* @__PURE__ */ A("div", {
|
|
2154
2184
|
onClick: x(2),
|
|
2155
|
-
children: [/* @__PURE__ */
|
|
2185
|
+
children: [/* @__PURE__ */ k("div", { children: "Audio" }), /* @__PURE__ */ k("div", { children: /* @__PURE__ */ k(F, {}) })]
|
|
2156
2186
|
}) : null,
|
|
2157
|
-
y > 1 ? /* @__PURE__ */
|
|
2187
|
+
y > 1 ? /* @__PURE__ */ A("div", {
|
|
2158
2188
|
onClick: x(3),
|
|
2159
|
-
children: [/* @__PURE__ */
|
|
2189
|
+
children: [/* @__PURE__ */ k("div", { children: "Quality" }), /* @__PURE__ */ A("div", { children: [b ? /* @__PURE__ */ k("span", {
|
|
2160
2190
|
className: "secondary",
|
|
2161
2191
|
children: b
|
|
2162
|
-
}) : null, /* @__PURE__ */
|
|
2192
|
+
}) : null, /* @__PURE__ */ k(F, {})] })]
|
|
2163
2193
|
}) : null,
|
|
2164
|
-
/* @__PURE__ */
|
|
2194
|
+
/* @__PURE__ */ A("div", {
|
|
2165
2195
|
onClick: x(1),
|
|
2166
|
-
children: [/* @__PURE__ */
|
|
2196
|
+
children: [/* @__PURE__ */ k("div", { children: "Playback speed" }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("span", {
|
|
2167
2197
|
className: "secondary",
|
|
2168
2198
|
children: t === 1 ? "(Default)" : t.toFixed(2)
|
|
2169
|
-
}), /* @__PURE__ */
|
|
2199
|
+
}), /* @__PURE__ */ k(F, {})] })]
|
|
2170
2200
|
}),
|
|
2171
|
-
o ? /* @__PURE__ */
|
|
2201
|
+
o ? /* @__PURE__ */ A("div", {
|
|
2172
2202
|
role: "switch",
|
|
2173
2203
|
"aria-checked": o.available && o.enabled,
|
|
2174
2204
|
"aria-disabled": !o.available,
|
|
@@ -2176,58 +2206,58 @@ ${Ot}
|
|
|
2176
2206
|
onClick: () => {
|
|
2177
2207
|
o.available && o.setEnabled(!o.enabled);
|
|
2178
2208
|
},
|
|
2179
|
-
children: [/* @__PURE__ */
|
|
2209
|
+
children: [/* @__PURE__ */ k("div", { children: "Normalize volume" }), /* @__PURE__ */ k("div", { children: o.available ? /* @__PURE__ */ k("span", { className: o.enabled ? "switch on" : "switch" }) : /* @__PURE__ */ k("span", {
|
|
2180
2210
|
className: "secondary",
|
|
2181
2211
|
children: "Unavailable"
|
|
2182
2212
|
}) })]
|
|
2183
2213
|
}) : null
|
|
2184
2214
|
]
|
|
2185
2215
|
}),
|
|
2186
|
-
l && s === 1 && /* @__PURE__ */
|
|
2216
|
+
l && s === 1 && /* @__PURE__ */ A("div", {
|
|
2187
2217
|
className: "popover playback-rate",
|
|
2188
2218
|
children: [
|
|
2189
|
-
/* @__PURE__ */
|
|
2219
|
+
/* @__PURE__ */ A("div", {
|
|
2190
2220
|
className: "back",
|
|
2191
2221
|
onClick: x(0),
|
|
2192
|
-
children: [/* @__PURE__ */
|
|
2222
|
+
children: [/* @__PURE__ */ k(P, {}), /* @__PURE__ */ k("span", { children: "Playback speed" })]
|
|
2193
2223
|
}),
|
|
2194
|
-
/* @__PURE__ */
|
|
2224
|
+
/* @__PURE__ */ k("div", {
|
|
2195
2225
|
className: "slider no-hover",
|
|
2196
|
-
children: /* @__PURE__ */
|
|
2226
|
+
children: /* @__PURE__ */ k(Vt, {})
|
|
2197
2227
|
}),
|
|
2198
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ A("div", {
|
|
2199
2229
|
className: "options no-hover",
|
|
2200
2230
|
children: [
|
|
2201
|
-
/* @__PURE__ */
|
|
2202
|
-
onClick: () =>
|
|
2231
|
+
/* @__PURE__ */ k("div", {
|
|
2232
|
+
onClick: () => h(.5),
|
|
2203
2233
|
children: "0.5x"
|
|
2204
2234
|
}),
|
|
2205
|
-
/* @__PURE__ */
|
|
2206
|
-
onClick: () =>
|
|
2235
|
+
/* @__PURE__ */ k("div", {
|
|
2236
|
+
onClick: () => h(1),
|
|
2207
2237
|
children: "1x"
|
|
2208
2238
|
}),
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
onClick: () =>
|
|
2239
|
+
/* @__PURE__ */ k("div", {
|
|
2240
|
+
onClick: () => h(1.5),
|
|
2211
2241
|
children: "1.5x"
|
|
2212
2242
|
}),
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
onClick: () =>
|
|
2243
|
+
/* @__PURE__ */ k("div", {
|
|
2244
|
+
onClick: () => h(2),
|
|
2215
2245
|
children: "2x"
|
|
2216
2246
|
})
|
|
2217
2247
|
]
|
|
2218
2248
|
})
|
|
2219
2249
|
]
|
|
2220
2250
|
}),
|
|
2221
|
-
l && s === 2 && /* @__PURE__ */
|
|
2251
|
+
l && s === 2 && /* @__PURE__ */ k(Mt, {
|
|
2222
2252
|
title: "Audio",
|
|
2223
2253
|
tracks: n,
|
|
2224
2254
|
selected: r,
|
|
2225
|
-
onSelect:
|
|
2255
|
+
onSelect: g,
|
|
2226
2256
|
onBack: x(0),
|
|
2227
2257
|
pending: f,
|
|
2228
2258
|
failed: p
|
|
2229
2259
|
}),
|
|
2230
|
-
l && s === 3 && a && /* @__PURE__ */
|
|
2260
|
+
l && s === 3 && a && /* @__PURE__ */ k(Mt, {
|
|
2231
2261
|
title: "Quality",
|
|
2232
2262
|
tracks: a.options,
|
|
2233
2263
|
selected: a.selectedId ?? void 0,
|
|
@@ -2239,7 +2269,7 @@ ${Ot}
|
|
|
2239
2269
|
})
|
|
2240
2270
|
]
|
|
2241
2271
|
});
|
|
2242
|
-
},
|
|
2272
|
+
}, Wt = y`
|
|
2243
2273
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
2244
2274
|
which is the width of the player box, so it can be clamped to it. */
|
|
2245
2275
|
position: static;
|
|
@@ -2255,28 +2285,28 @@ position: static;
|
|
|
2255
2285
|
}
|
|
2256
2286
|
}
|
|
2257
2287
|
|
|
2258
|
-
${
|
|
2259
|
-
`,
|
|
2260
|
-
let e =
|
|
2288
|
+
${jt}
|
|
2289
|
+
`, Gt = () => {
|
|
2290
|
+
let e = Y((e) => e.subtitleTracks), t = Y((e) => e.selectedSubtitleTrack), n = Y((e) => e.selectSubtitleTrack), r = Y((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Nt();
|
|
2261
2291
|
if (e.length === 0) return null;
|
|
2262
2292
|
let u = t !== void 0;
|
|
2263
|
-
return /* @__PURE__ */
|
|
2264
|
-
css:
|
|
2293
|
+
return /* @__PURE__ */ A("div", {
|
|
2294
|
+
css: Wt,
|
|
2265
2295
|
ref: o,
|
|
2266
|
-
children: [/* @__PURE__ */
|
|
2296
|
+
children: [/* @__PURE__ */ k($, {
|
|
2267
2297
|
id: "subtitles",
|
|
2268
2298
|
disabled: i,
|
|
2269
|
-
text: /* @__PURE__ */
|
|
2299
|
+
text: /* @__PURE__ */ k("button", {
|
|
2270
2300
|
className: "subtitles",
|
|
2271
2301
|
type: "button",
|
|
2272
2302
|
onClick: a,
|
|
2273
2303
|
"aria-label": "Subtitles",
|
|
2274
2304
|
"aria-expanded": i,
|
|
2275
2305
|
"aria-pressed": u,
|
|
2276
|
-
children: u ? /* @__PURE__ */
|
|
2306
|
+
children: u ? /* @__PURE__ */ k(j, { className: "captions" }) : /* @__PURE__ */ k(M, { className: "captions-off" })
|
|
2277
2307
|
}),
|
|
2278
|
-
toolTipText: /* @__PURE__ */
|
|
2279
|
-
}), i && /* @__PURE__ */
|
|
2308
|
+
toolTipText: /* @__PURE__ */ k("span", { children: "Subtitles" })
|
|
2309
|
+
}), i && /* @__PURE__ */ k(Mt, {
|
|
2280
2310
|
title: "Subtitles",
|
|
2281
2311
|
tracks: e,
|
|
2282
2312
|
selected: t,
|
|
@@ -2286,13 +2316,13 @@ ${Ot}
|
|
|
2286
2316
|
failed: c
|
|
2287
2317
|
})]
|
|
2288
2318
|
});
|
|
2289
|
-
},
|
|
2319
|
+
}, Kt = {
|
|
2290
2320
|
primary: "#EAEBEE",
|
|
2291
2321
|
secondary: "#D0D0D9",
|
|
2292
2322
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
2293
2323
|
borderPrimary: "#384F70",
|
|
2294
2324
|
backgroundTooltip: "#222222"
|
|
2295
|
-
},
|
|
2325
|
+
}, qt = y`
|
|
2296
2326
|
display: flex;
|
|
2297
2327
|
align-items: center;
|
|
2298
2328
|
|
|
@@ -2335,8 +2365,8 @@ ${Ot}
|
|
|
2335
2365
|
width: 10px;
|
|
2336
2366
|
height: 10px;
|
|
2337
2367
|
}
|
|
2338
|
-
`,
|
|
2339
|
-
let n =
|
|
2368
|
+
`, Jt = ({ value: e, onChange: t }) => {
|
|
2369
|
+
let n = Y((e) => e.volume), r = Y((e) => e.muted), i = g(null), a = g(null), { handlers: o } = et({
|
|
2340
2370
|
ref: a,
|
|
2341
2371
|
onChange: t
|
|
2342
2372
|
}), s = (n) => {
|
|
@@ -2344,37 +2374,37 @@ ${Ot}
|
|
|
2344
2374
|
let r = .05, i = e;
|
|
2345
2375
|
i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
|
|
2346
2376
|
};
|
|
2347
|
-
|
|
2377
|
+
m(() => {
|
|
2348
2378
|
let e = i.current;
|
|
2349
2379
|
return e && e.addEventListener("wheel", s, { passive: !1 }), () => {
|
|
2350
2380
|
e && e.removeEventListener("wheel", s);
|
|
2351
2381
|
};
|
|
2352
2382
|
}, [e]);
|
|
2353
|
-
let c = e * 100, l =
|
|
2354
|
-
return /* @__PURE__ */
|
|
2383
|
+
let c = e * 100, l = h(() => Math.round(r ? 0 : qe(n) * 100), [n, r]);
|
|
2384
|
+
return /* @__PURE__ */ k($, {
|
|
2355
2385
|
id: "volume-slider",
|
|
2356
|
-
text: /* @__PURE__ */
|
|
2386
|
+
text: /* @__PURE__ */ k("div", {
|
|
2357
2387
|
ref: i,
|
|
2358
|
-
css:
|
|
2388
|
+
css: qt,
|
|
2359
2389
|
...o,
|
|
2360
|
-
children: /* @__PURE__ */
|
|
2390
|
+
children: /* @__PURE__ */ k("div", {
|
|
2361
2391
|
ref: a,
|
|
2362
2392
|
style: { background: `linear-gradient(to right,
|
|
2363
2393
|
#fff 0% ${c}%,
|
|
2364
2394
|
#3A3A3A ${c}% 100%
|
|
2365
2395
|
)` },
|
|
2366
|
-
children: /* @__PURE__ */
|
|
2396
|
+
children: /* @__PURE__ */ k("div", {
|
|
2367
2397
|
className: "volume-handle",
|
|
2368
2398
|
style: { left: `${e * 100}%` }
|
|
2369
2399
|
})
|
|
2370
2400
|
})
|
|
2371
2401
|
}),
|
|
2372
|
-
toolTipText: /* @__PURE__ */
|
|
2402
|
+
toolTipText: /* @__PURE__ */ A("div", {
|
|
2373
2403
|
className: "volume-value",
|
|
2374
2404
|
children: [l, "%"]
|
|
2375
2405
|
})
|
|
2376
2406
|
});
|
|
2377
|
-
},
|
|
2407
|
+
}, Yt = y`
|
|
2378
2408
|
position: relative;
|
|
2379
2409
|
display: flex;
|
|
2380
2410
|
align-items: center;
|
|
@@ -2399,7 +2429,7 @@ ${Ot}
|
|
|
2399
2429
|
border-radius: 4px;
|
|
2400
2430
|
|
|
2401
2431
|
.volume-value {
|
|
2402
|
-
${
|
|
2432
|
+
${Q.bMedium.regular};
|
|
2403
2433
|
color: #ffffff;
|
|
2404
2434
|
}
|
|
2405
2435
|
}
|
|
@@ -2437,39 +2467,39 @@ ${Ot}
|
|
|
2437
2467
|
}
|
|
2438
2468
|
}
|
|
2439
2469
|
|
|
2440
|
-
`,
|
|
2441
|
-
let t =
|
|
2442
|
-
return /* @__PURE__ */
|
|
2443
|
-
css:
|
|
2444
|
-
children: [/* @__PURE__ */
|
|
2470
|
+
`, Xt = ({ ref: e }) => {
|
|
2471
|
+
let t = Y(), n = Y((e) => e.volume), r = Y((e) => e.muted), i = h(() => qe(n), [n]);
|
|
2472
|
+
return /* @__PURE__ */ A("div", {
|
|
2473
|
+
css: Yt,
|
|
2474
|
+
children: [/* @__PURE__ */ k($, {
|
|
2445
2475
|
id: "sound",
|
|
2446
|
-
text: /* @__PURE__ */
|
|
2476
|
+
text: /* @__PURE__ */ k("button", {
|
|
2447
2477
|
className: "sound",
|
|
2448
2478
|
type: "button",
|
|
2449
2479
|
onClick: () => t.toggleMuted(),
|
|
2450
2480
|
ref: e,
|
|
2451
2481
|
"aria-label": "Mute",
|
|
2452
2482
|
"aria-pressed": r || n === 0,
|
|
2453
|
-
children:
|
|
2483
|
+
children: k(r || n === 0 ? G : n <= .5 ? W : ee, {
|
|
2454
2484
|
size: 18,
|
|
2455
2485
|
color: "#fff"
|
|
2456
2486
|
})
|
|
2457
2487
|
}),
|
|
2458
|
-
toolTipText: /* @__PURE__ */
|
|
2459
|
-
}), /* @__PURE__ */
|
|
2488
|
+
toolTipText: /* @__PURE__ */ k("span", { children: r ? "Unmute (m)" : "Mute (m)" })
|
|
2489
|
+
}), /* @__PURE__ */ k("div", {
|
|
2460
2490
|
className: "volume-slider-container",
|
|
2461
|
-
children: /* @__PURE__ */
|
|
2491
|
+
children: /* @__PURE__ */ k("div", {
|
|
2462
2492
|
className: "volume-slider-background",
|
|
2463
|
-
children: /* @__PURE__ */
|
|
2493
|
+
children: /* @__PURE__ */ k(Jt, {
|
|
2464
2494
|
value: r ? 0 : i,
|
|
2465
2495
|
onChange: (e) => {
|
|
2466
|
-
t.setVolume(
|
|
2496
|
+
t.setVolume(Ke(e));
|
|
2467
2497
|
}
|
|
2468
2498
|
})
|
|
2469
2499
|
})
|
|
2470
2500
|
})]
|
|
2471
2501
|
});
|
|
2472
|
-
},
|
|
2502
|
+
}, Zt = .05, Qt = 5, $t = 50, en = 1e3, tn = y`
|
|
2473
2503
|
position: absolute;
|
|
2474
2504
|
bottom: 0;
|
|
2475
2505
|
width: 100%;
|
|
@@ -2561,7 +2591,7 @@ ${Ot}
|
|
|
2561
2591
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2562
2592
|
of its own and so is never :hover */
|
|
2563
2593
|
:hover, &.armed {
|
|
2564
|
-
background-color: ${
|
|
2594
|
+
background-color: ${Kt.hover};
|
|
2565
2595
|
}
|
|
2566
2596
|
|
|
2567
2597
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2578,7 +2608,7 @@ ${Ot}
|
|
|
2578
2608
|
|
|
2579
2609
|
.left {
|
|
2580
2610
|
.time {
|
|
2581
|
-
${
|
|
2611
|
+
${Q.bMedium.regular}
|
|
2582
2612
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
2583
2613
|
}
|
|
2584
2614
|
}
|
|
@@ -2599,36 +2629,36 @@ ${Ot}
|
|
|
2599
2629
|
}
|
|
2600
2630
|
}
|
|
2601
2631
|
}
|
|
2602
|
-
`,
|
|
2603
|
-
let n =
|
|
2604
|
-
let r =
|
|
2605
|
-
n.setVolume(
|
|
2606
|
-
}, [n]),
|
|
2607
|
-
|
|
2632
|
+
`, nn = ({ shortcuts: e = "window", root: t }) => {
|
|
2633
|
+
let n = Y(), r = Y((e) => e.paused), i = Y((e) => e.currentTime), a = Y((e) => e.duration), o = Y((e) => e.seekingTo), s = Y((e) => e.fullscreen), c = Y((e) => e.hideUI), l = Y((e) => e.togglePictureInPicture), u = Y((e) => e.pictureInPictureMode), d = Y((e) => e.burnedInSubtitles), f = Y((e) => e.passThroughPictureInPicture), h = Y((e) => e.subtitleTracks), v = Y((e) => e.requestSeek), y = Y((e) => e.stepFrame), [b, x] = _(null), S = g(null), C = g(void 0), w = u === "burn-in", T = h.length > 0, E = a > 0 && i === a, D = p(({ direction: e, stepSize: t }) => {
|
|
2634
|
+
let r = qe(n.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, r + i)), o = n.muted;
|
|
2635
|
+
n.setVolume(Ke(a)), o && !n.muted && n.toggleMuted();
|
|
2636
|
+
}, [n]), O = g(!1);
|
|
2637
|
+
m(() => {
|
|
2608
2638
|
let r = (e) => v ? v(e) : n.seek(e), i = (e) => e.composedPath()[0], a = (e) => {
|
|
2609
|
-
|
|
2639
|
+
O.current = !!t.current?.contains(i(e) ?? null);
|
|
2610
2640
|
}, o = (a) => {
|
|
2611
2641
|
let o = i(a);
|
|
2612
2642
|
if (o?.isContentEditable || /^(input|textarea|select)$/i.test(o?.tagName ?? "") || (a.ctrlKey || a.metaKey || a.altKey) && !a.getModifierState("AltGraph")) return;
|
|
2613
|
-
let s = t.current?.contains(o ?? null) || o === document.body &&
|
|
2643
|
+
let s = t.current?.contains(o ?? null) || o === document.body && O.current;
|
|
2614
2644
|
if (e === "player" && !n.fullscreen && !s) return;
|
|
2615
2645
|
let c = !0;
|
|
2616
2646
|
if (a.key === "f") n.toggleFullscreen();
|
|
2617
2647
|
else if (a.key === "k") n.togglePaused();
|
|
2618
2648
|
else if (a.key === " ") n.togglePaused();
|
|
2619
2649
|
else if (a.key === "m") n.toggleMuted();
|
|
2620
|
-
else if (a.key === "ArrowUp")
|
|
2650
|
+
else if (a.key === "ArrowUp") D({
|
|
2621
2651
|
direction: "up",
|
|
2622
|
-
stepSize:
|
|
2652
|
+
stepSize: Zt
|
|
2623
2653
|
});
|
|
2624
|
-
else if (a.key === "ArrowDown")
|
|
2654
|
+
else if (a.key === "ArrowDown") D({
|
|
2625
2655
|
direction: "down",
|
|
2626
|
-
stepSize:
|
|
2656
|
+
stepSize: Zt
|
|
2627
2657
|
});
|
|
2628
2658
|
else if (a.key === "ArrowRight") {
|
|
2629
2659
|
if (!n.duration) return;
|
|
2630
|
-
r(Math.min(n.currentTime +
|
|
2631
|
-
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime -
|
|
2660
|
+
r(Math.min(n.currentTime + Qt, n.duration));
|
|
2661
|
+
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime - Qt, 0)) : (a.key === "<" || a.key === ">") && y ? y(a.key === ">" ? 1 : -1) : c = !1;
|
|
2632
2662
|
c && a.preventDefault();
|
|
2633
2663
|
};
|
|
2634
2664
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
@@ -2636,35 +2666,35 @@ ${Ot}
|
|
|
2636
2666
|
};
|
|
2637
2667
|
}, [
|
|
2638
2668
|
n,
|
|
2639
|
-
|
|
2669
|
+
D,
|
|
2640
2670
|
v,
|
|
2641
2671
|
y,
|
|
2642
2672
|
e,
|
|
2643
2673
|
t
|
|
2644
2674
|
]);
|
|
2645
|
-
let j =
|
|
2646
|
-
e.preventDefault(), e.deltaY < 0 ?
|
|
2675
|
+
let j = p((e) => {
|
|
2676
|
+
e.preventDefault(), e.deltaY < 0 ? D({
|
|
2647
2677
|
direction: "up",
|
|
2648
|
-
stepSize:
|
|
2649
|
-
}) :
|
|
2678
|
+
stepSize: Zt
|
|
2679
|
+
}) : D({
|
|
2650
2680
|
direction: "down",
|
|
2651
|
-
stepSize:
|
|
2681
|
+
stepSize: Zt
|
|
2652
2682
|
});
|
|
2653
|
-
}, [
|
|
2654
|
-
|
|
2683
|
+
}, [D]);
|
|
2684
|
+
m(() => {
|
|
2655
2685
|
if (b) return b.addEventListener("wheel", j, { passive: !1 }), () => b.removeEventListener("wheel", j);
|
|
2656
2686
|
}, [b, j]);
|
|
2657
2687
|
let M = (e) => {
|
|
2658
|
-
if (!
|
|
2688
|
+
if (!f || f.active || f.armed || e.pointerType === "touch") return;
|
|
2659
2689
|
let { left: t, top: n, width: r, height: i } = e.currentTarget.getBoundingClientRect();
|
|
2660
|
-
|
|
2690
|
+
f.arm({
|
|
2661
2691
|
left: t,
|
|
2662
2692
|
top: n,
|
|
2663
2693
|
width: r,
|
|
2664
2694
|
height: i
|
|
2665
2695
|
});
|
|
2666
|
-
}, N = !!
|
|
2667
|
-
return
|
|
2696
|
+
}, N = !!f?.armed;
|
|
2697
|
+
return m(() => {
|
|
2668
2698
|
if (!N) return;
|
|
2669
2699
|
clearInterval(C.current);
|
|
2670
2700
|
let e = Infinity, t = setInterval(() => {
|
|
@@ -2674,99 +2704,99 @@ ${Ot}
|
|
|
2674
2704
|
}
|
|
2675
2705
|
let n = S.current, r = document.activeElement;
|
|
2676
2706
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2677
|
-
},
|
|
2707
|
+
}, $t);
|
|
2678
2708
|
return C.current = t, () => {
|
|
2679
|
-
e = Date.now() +
|
|
2709
|
+
e = Date.now() + en;
|
|
2680
2710
|
};
|
|
2681
|
-
}, [N]),
|
|
2711
|
+
}, [N]), m(() => () => clearInterval(C.current), []), /* @__PURE__ */ A("div", {
|
|
2682
2712
|
className: "control-bar",
|
|
2683
|
-
css:
|
|
2713
|
+
css: tn,
|
|
2684
2714
|
style: { ...c ? {
|
|
2685
2715
|
opacity: "0",
|
|
2686
2716
|
pointerEvents: "none"
|
|
2687
2717
|
} : N ? { pointerEvents: "none" } : {} },
|
|
2688
|
-
children: [/* @__PURE__ */
|
|
2718
|
+
children: [/* @__PURE__ */ k(Et, {}), /* @__PURE__ */ A("div", {
|
|
2689
2719
|
className: "actions",
|
|
2690
|
-
children: [/* @__PURE__ */
|
|
2720
|
+
children: [/* @__PURE__ */ A("div", {
|
|
2691
2721
|
className: "left",
|
|
2692
2722
|
children: [
|
|
2693
|
-
/* @__PURE__ */
|
|
2723
|
+
/* @__PURE__ */ k($, {
|
|
2694
2724
|
id: "play",
|
|
2695
2725
|
tooltipPlace: "top-start",
|
|
2696
|
-
text: /* @__PURE__ */
|
|
2726
|
+
text: /* @__PURE__ */ k("button", {
|
|
2697
2727
|
className: "play",
|
|
2698
2728
|
type: "button",
|
|
2699
2729
|
onClick: () => n.togglePaused(),
|
|
2700
2730
|
"aria-label": E ? "Replay" : r ? "Play" : "Pause",
|
|
2701
|
-
children:
|
|
2731
|
+
children: k(E ? V : r ? B : z, {})
|
|
2702
2732
|
}),
|
|
2703
|
-
toolTipText: /* @__PURE__ */
|
|
2733
|
+
toolTipText: /* @__PURE__ */ k("span", { children: E ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
|
|
2704
2734
|
}),
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
/* @__PURE__ */
|
|
2735
|
+
/* @__PURE__ */ k(Xt, { ref: x }),
|
|
2736
|
+
/* @__PURE__ */ k("div", {
|
|
2707
2737
|
className: "time",
|
|
2708
|
-
children:
|
|
2738
|
+
children: Ye(o ?? i, a)
|
|
2709
2739
|
})
|
|
2710
2740
|
]
|
|
2711
|
-
}), /* @__PURE__ */
|
|
2741
|
+
}), /* @__PURE__ */ A("div", {
|
|
2712
2742
|
className: "right",
|
|
2713
2743
|
children: [
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
|
|
2744
|
+
/* @__PURE__ */ k(zt, {}),
|
|
2745
|
+
/* @__PURE__ */ k(Gt, {}),
|
|
2746
|
+
/* @__PURE__ */ k(Ut, {}),
|
|
2747
|
+
f ? /* @__PURE__ */ k($, {
|
|
2718
2748
|
id: "picture-in-picture",
|
|
2719
2749
|
tooltipPlace: "top-end",
|
|
2720
|
-
text: /* @__PURE__ */
|
|
2750
|
+
text: /* @__PURE__ */ k("button", {
|
|
2721
2751
|
ref: S,
|
|
2722
|
-
className:
|
|
2752
|
+
className: f.armed ? "picture-in-picture armed" : "picture-in-picture",
|
|
2723
2753
|
type: "button",
|
|
2724
2754
|
onPointerEnter: M,
|
|
2725
2755
|
onPointerMove: M,
|
|
2726
|
-
onClick:
|
|
2756
|
+
onClick: f.active ? f.exit : void 0,
|
|
2727
2757
|
"aria-label": "Picture in picture",
|
|
2728
|
-
"aria-pressed":
|
|
2729
|
-
children: /* @__PURE__ */
|
|
2730
|
-
src:
|
|
2758
|
+
"aria-pressed": f.active,
|
|
2759
|
+
children: /* @__PURE__ */ k("img", {
|
|
2760
|
+
src: Dt,
|
|
2731
2761
|
alt: ""
|
|
2732
2762
|
})
|
|
2733
2763
|
}),
|
|
2734
|
-
toolTipText: /* @__PURE__ */
|
|
2735
|
-
}) : l ? /* @__PURE__ */
|
|
2764
|
+
toolTipText: /* @__PURE__ */ k("span", { children: f.active ? "Exit picture in picture" : "Picture in picture" })
|
|
2765
|
+
}) : l ? /* @__PURE__ */ k($, {
|
|
2736
2766
|
id: "picture-in-picture",
|
|
2737
2767
|
tooltipPlace: "top-end",
|
|
2738
|
-
text: /* @__PURE__ */
|
|
2768
|
+
text: /* @__PURE__ */ k("button", {
|
|
2739
2769
|
className: "picture-in-picture",
|
|
2740
2770
|
type: "button",
|
|
2741
2771
|
onClick: l,
|
|
2742
2772
|
disabled: w && !T,
|
|
2743
2773
|
"aria-label": w ? "Put the subtitles in the video" : "Picture in picture",
|
|
2744
|
-
"aria-pressed": w ?
|
|
2745
|
-
children: w ?
|
|
2746
|
-
src:
|
|
2774
|
+
"aria-pressed": w ? d : void 0,
|
|
2775
|
+
children: w ? k(d ? kt : At, {}) : /* @__PURE__ */ k("img", {
|
|
2776
|
+
src: Dt,
|
|
2747
2777
|
alt: ""
|
|
2748
2778
|
})
|
|
2749
2779
|
}),
|
|
2750
|
-
toolTipText: /* @__PURE__ */
|
|
2780
|
+
toolTipText: /* @__PURE__ */ k("span", { children: w ? T ? d ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture" })
|
|
2751
2781
|
}) : null,
|
|
2752
|
-
/* @__PURE__ */
|
|
2782
|
+
/* @__PURE__ */ k($, {
|
|
2753
2783
|
id: "full-screen",
|
|
2754
2784
|
tooltipPlace: "top-end",
|
|
2755
|
-
text: /* @__PURE__ */
|
|
2785
|
+
text: /* @__PURE__ */ k("button", {
|
|
2756
2786
|
className: "full-screen",
|
|
2757
2787
|
type: "button",
|
|
2758
2788
|
onClick: () => n.toggleFullscreen(),
|
|
2759
2789
|
"aria-label": "Full screen",
|
|
2760
2790
|
"aria-pressed": s,
|
|
2761
|
-
children:
|
|
2791
|
+
children: k(s ? R : L, {})
|
|
2762
2792
|
}),
|
|
2763
|
-
toolTipText: /* @__PURE__ */
|
|
2793
|
+
toolTipText: /* @__PURE__ */ k("span", { children: s ? "Exit full screen (f)" : "Full screen (f)" })
|
|
2764
2794
|
})
|
|
2765
2795
|
]
|
|
2766
2796
|
})]
|
|
2767
2797
|
})]
|
|
2768
2798
|
});
|
|
2769
|
-
},
|
|
2799
|
+
}, rn = 9e3, an = y`
|
|
2770
2800
|
position: absolute;
|
|
2771
2801
|
inset: 0;
|
|
2772
2802
|
z-index: 2;
|
|
@@ -2798,7 +2828,7 @@ ${Ot}
|
|
|
2798
2828
|
}
|
|
2799
2829
|
|
|
2800
2830
|
.text {
|
|
2801
|
-
${
|
|
2831
|
+
${Q.bMedium.medium}
|
|
2802
2832
|
color: #fff;
|
|
2803
2833
|
}
|
|
2804
2834
|
|
|
@@ -2809,36 +2839,36 @@ ${Ot}
|
|
|
2809
2839
|
line-height: 1;
|
|
2810
2840
|
color: #fff;
|
|
2811
2841
|
}
|
|
2812
|
-
`,
|
|
2813
|
-
let e =
|
|
2814
|
-
return
|
|
2842
|
+
`, on = () => {
|
|
2843
|
+
let e = Y((e) => e.burnedInSubtitles), t = Y((e) => e.pictureInPictureMode), [n, r] = _(!1);
|
|
2844
|
+
return m(() => {
|
|
2815
2845
|
if (t !== "burn-in" || !e) {
|
|
2816
2846
|
r(!1);
|
|
2817
2847
|
return;
|
|
2818
2848
|
}
|
|
2819
2849
|
r(!0);
|
|
2820
|
-
let n = setTimeout(() => r(!1),
|
|
2850
|
+
let n = setTimeout(() => r(!1), rn);
|
|
2821
2851
|
return () => clearTimeout(n);
|
|
2822
|
-
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */
|
|
2823
|
-
css:
|
|
2852
|
+
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ k("div", {
|
|
2853
|
+
css: an,
|
|
2824
2854
|
className: n ? "show" : "",
|
|
2825
2855
|
role: "status",
|
|
2826
|
-
children: /* @__PURE__ */
|
|
2856
|
+
children: /* @__PURE__ */ A("div", {
|
|
2827
2857
|
className: "card",
|
|
2828
|
-
children: [/* @__PURE__ */
|
|
2858
|
+
children: [/* @__PURE__ */ k("div", {
|
|
2829
2859
|
className: "text",
|
|
2830
2860
|
children: "Now click your browser's pop out button"
|
|
2831
|
-
}), /* @__PURE__ */
|
|
2861
|
+
}), /* @__PURE__ */ k("div", {
|
|
2832
2862
|
className: "arrow",
|
|
2833
2863
|
"aria-hidden": "true",
|
|
2834
2864
|
children: "→"
|
|
2835
2865
|
})]
|
|
2836
2866
|
})
|
|
2837
2867
|
});
|
|
2838
|
-
},
|
|
2868
|
+
}, sn = 1, cn = 6e3, ln = 1, un = {
|
|
2839
2869
|
opening: "Skip Opening",
|
|
2840
2870
|
ending: "Skip Ending"
|
|
2841
|
-
},
|
|
2871
|
+
}, dn = y`
|
|
2842
2872
|
position: absolute;
|
|
2843
2873
|
inset: 0;
|
|
2844
2874
|
z-index: 2;
|
|
@@ -2855,7 +2885,7 @@ ${Ot}
|
|
|
2855
2885
|
pointer-events: auto;
|
|
2856
2886
|
cursor: pointer;
|
|
2857
2887
|
|
|
2858
|
-
${
|
|
2888
|
+
${Q.bMedium.bold}
|
|
2859
2889
|
color: #fff;
|
|
2860
2890
|
padding: calc(1 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
|
|
2861
2891
|
border: 1px solid rgba(255, 255, 255, .55);
|
|
@@ -2889,10 +2919,10 @@ ${Ot}
|
|
|
2889
2919
|
bottom: calc(9 * var(--mp-unit));
|
|
2890
2920
|
}
|
|
2891
2921
|
}
|
|
2892
|
-
`,
|
|
2893
|
-
let e =
|
|
2922
|
+
`, fn = () => {
|
|
2923
|
+
let e = Y((e) => e.chapters), t = Y((e) => e.currentTime), n = Y((e) => e.requestSeek), r = Y((e) => e.seekPreview), i = Y(), a = h(() => Ct(e), [e]), o = h(() => {
|
|
2894
2924
|
if (typeof t != "number") return;
|
|
2895
|
-
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start -
|
|
2925
|
+
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - sn <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
|
|
2896
2926
|
return r ? {
|
|
2897
2927
|
kind: r,
|
|
2898
2928
|
end: e[n].end
|
|
@@ -2901,35 +2931,35 @@ ${Ot}
|
|
|
2901
2931
|
e,
|
|
2902
2932
|
a,
|
|
2903
2933
|
t
|
|
2904
|
-
]), s =
|
|
2905
|
-
|
|
2934
|
+
]), s = g(0), [c, l] = _(0);
|
|
2935
|
+
m(() => {
|
|
2906
2936
|
let e = typeof t == "number" ? t : 0, n = s.current;
|
|
2907
|
-
s.current = e, e < n -
|
|
2937
|
+
s.current = e, e < n - ln && l((e) => e + 1);
|
|
2908
2938
|
}, [t]);
|
|
2909
|
-
let [u, d] =
|
|
2910
|
-
return
|
|
2911
|
-
if (!
|
|
2939
|
+
let [u, d] = _(!1), f = o ? `${o.kind}@${o.end}` : "";
|
|
2940
|
+
return m(() => {
|
|
2941
|
+
if (!f) {
|
|
2912
2942
|
d(!1);
|
|
2913
2943
|
return;
|
|
2914
2944
|
}
|
|
2915
2945
|
d(!0);
|
|
2916
|
-
let e = setTimeout(() => d(!1),
|
|
2946
|
+
let e = setTimeout(() => d(!1), cn);
|
|
2917
2947
|
return () => clearTimeout(e);
|
|
2918
|
-
}, [
|
|
2948
|
+
}, [f, c]), m(() => {
|
|
2919
2949
|
o || d(!1);
|
|
2920
|
-
}, [o]), o ? /* @__PURE__ */
|
|
2921
|
-
css:
|
|
2950
|
+
}, [o]), o ? /* @__PURE__ */ k("div", {
|
|
2951
|
+
css: dn,
|
|
2922
2952
|
className: u && !r ? "show" : "",
|
|
2923
|
-
children: /* @__PURE__ */
|
|
2953
|
+
children: /* @__PURE__ */ k("button", {
|
|
2924
2954
|
type: "button",
|
|
2925
2955
|
className: "skip-chapter",
|
|
2926
2956
|
onClick: () => {
|
|
2927
2957
|
d(!1), n ? n(o.end) : i.seek(o.end);
|
|
2928
2958
|
},
|
|
2929
|
-
children:
|
|
2959
|
+
children: un[o.kind]
|
|
2930
2960
|
})
|
|
2931
2961
|
}) : null;
|
|
2932
|
-
},
|
|
2962
|
+
}, pn = 3e3, mn = y`
|
|
2933
2963
|
position: absolute;
|
|
2934
2964
|
inset: 0;
|
|
2935
2965
|
z-index: 2;
|
|
@@ -2940,10 +2970,10 @@ ${Ot}
|
|
|
2940
2970
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2941
2971
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2942
2972
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2943
|
-
`,
|
|
2973
|
+
`, hn = (e, t) => {
|
|
2944
2974
|
let n = e.left - t.left, r = e.top - t.top;
|
|
2945
2975
|
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')`;
|
|
2946
|
-
},
|
|
2976
|
+
}, gn = y`
|
|
2947
2977
|
position: relative;
|
|
2948
2978
|
background-color: black;
|
|
2949
2979
|
display: flex;
|
|
@@ -3000,19 +3030,19 @@ ${Ot}
|
|
|
3000
3030
|
&.hide {
|
|
3001
3031
|
cursor: none;
|
|
3002
3032
|
}
|
|
3003
|
-
`,
|
|
3004
|
-
let r = `${t}${
|
|
3005
|
-
return
|
|
3033
|
+
`, _n = (e, t = "") => u.toArray(e).flatMap((e, n) => {
|
|
3034
|
+
let r = `${t}${f(e) && e.key != null ? e.key : n}`;
|
|
3035
|
+
return f(e) && e.type === d ? _n(e.props.children, `${r}/`) : [{
|
|
3006
3036
|
key: r,
|
|
3007
3037
|
item: e
|
|
3008
3038
|
}];
|
|
3009
|
-
}),
|
|
3010
|
-
let s =
|
|
3039
|
+
}), vn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, children: o }) => {
|
|
3040
|
+
let s = Y(), c = Y((e) => e.hideUI), l = Y((e) => e.setHideUI), u = Y((e) => e.hasMedia), d = Y((e) => e.passThroughPictureInPicture), f = g(void 0), p = g("mouse"), h = g({
|
|
3011
3041
|
x: -1,
|
|
3012
3042
|
y: -1
|
|
3013
|
-
}), _ =
|
|
3014
|
-
|
|
3015
|
-
u || (clearTimeout(
|
|
3043
|
+
}), _ = g(!1), v = g(null);
|
|
3044
|
+
m(() => () => clearTimeout(f.current), []), m(() => {
|
|
3045
|
+
u || (clearTimeout(f.current), l(!1));
|
|
3016
3046
|
}, [u, l]);
|
|
3017
3047
|
let y = () => {
|
|
3018
3048
|
u && l(!0);
|
|
@@ -3020,31 +3050,31 @@ ${Ot}
|
|
|
3020
3050
|
v.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
|
|
3021
3051
|
}, x = () => {
|
|
3022
3052
|
if (s.passThroughPictureInPicture?.armed) return !0;
|
|
3023
|
-
if (
|
|
3024
|
-
let { x: e, y: t } =
|
|
3053
|
+
if (p.current !== "mouse") return !1;
|
|
3054
|
+
let { x: e, y: t } = h.current;
|
|
3025
3055
|
if (!v.current || e < 0) return !1;
|
|
3026
3056
|
let n = document.elementFromPoint(e, t);
|
|
3027
3057
|
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
3028
3058
|
}, S = () => {
|
|
3029
3059
|
if (x()) {
|
|
3030
|
-
|
|
3060
|
+
f.current = setTimeout(S, pn);
|
|
3031
3061
|
return;
|
|
3032
3062
|
}
|
|
3033
3063
|
y();
|
|
3034
3064
|
}, C = () => {
|
|
3035
|
-
l(!1), clearTimeout(
|
|
3065
|
+
l(!1), clearTimeout(f.current), f.current = setTimeout(S, pn);
|
|
3036
3066
|
}, w = (e) => {
|
|
3037
|
-
|
|
3067
|
+
p.current = e.pointerType, e.pointerType === "mouse" && (h.current = {
|
|
3038
3068
|
x: e.clientX,
|
|
3039
3069
|
y: e.clientY
|
|
3040
3070
|
}, C());
|
|
3041
3071
|
}, T = (e) => {
|
|
3042
|
-
|
|
3072
|
+
p.current = e.pointerType, _.current = !0;
|
|
3043
3073
|
}, E = () => {
|
|
3044
3074
|
_.current = !1;
|
|
3045
|
-
},
|
|
3046
|
-
return /* @__PURE__ */
|
|
3047
|
-
css:
|
|
3075
|
+
}, D = g(!0);
|
|
3076
|
+
return /* @__PURE__ */ A("div", {
|
|
3077
|
+
css: gn,
|
|
3048
3078
|
ref: b,
|
|
3049
3079
|
onPointerMove: w,
|
|
3050
3080
|
onPointerDown: T,
|
|
@@ -3054,14 +3084,14 @@ ${Ot}
|
|
|
3054
3084
|
let t = e.relatedTarget;
|
|
3055
3085
|
if (t && e.currentTarget.contains(t)) return;
|
|
3056
3086
|
let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
|
|
3057
|
-
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(
|
|
3087
|
+
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(f.current), y());
|
|
3058
3088
|
},
|
|
3059
3089
|
className: c ? "hide" : "",
|
|
3060
3090
|
tabIndex: a === "player" ? -1 : void 0,
|
|
3061
3091
|
children: [
|
|
3062
|
-
/* @__PURE__ */
|
|
3063
|
-
|
|
3064
|
-
css:
|
|
3092
|
+
/* @__PURE__ */ k(Ue, { onSubtitleRef: n }),
|
|
3093
|
+
_n(r).map(({ key: e, item: t }) => /* @__PURE__ */ k("div", {
|
|
3094
|
+
css: mn,
|
|
3065
3095
|
style: { ...c ? {
|
|
3066
3096
|
opacity: "0",
|
|
3067
3097
|
visibility: "hidden",
|
|
@@ -3069,177 +3099,192 @@ ${Ot}
|
|
|
3069
3099
|
} : {} },
|
|
3070
3100
|
children: t
|
|
3071
3101
|
}, e)),
|
|
3072
|
-
i === !1 ? null : /* @__PURE__ */
|
|
3102
|
+
i === !1 ? null : /* @__PURE__ */ k(nn, {
|
|
3073
3103
|
shortcuts: a,
|
|
3074
3104
|
root: v
|
|
3075
3105
|
}),
|
|
3076
|
-
/* @__PURE__ */
|
|
3077
|
-
/* @__PURE__ */
|
|
3078
|
-
d?.armed && v.current ? /* @__PURE__ */
|
|
3106
|
+
/* @__PURE__ */ k(on, {}),
|
|
3107
|
+
/* @__PURE__ */ k(fn, {}),
|
|
3108
|
+
d?.armed && v.current ? /* @__PURE__ */ k("div", {
|
|
3079
3109
|
className: "pass-through",
|
|
3080
|
-
style: { clipPath:
|
|
3110
|
+
style: { clipPath: hn(d.armed, v.current.getBoundingClientRect()) },
|
|
3081
3111
|
onPointerOver: d.disarm
|
|
3082
3112
|
}) : null,
|
|
3083
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ A("div", {
|
|
3084
3114
|
className: "video",
|
|
3085
3115
|
onClick: (e) => {
|
|
3086
|
-
if (
|
|
3116
|
+
if (p.current === "mouse") {
|
|
3087
3117
|
if (e.detail > 1) return;
|
|
3088
|
-
|
|
3118
|
+
D.current = s.paused, s.togglePaused();
|
|
3089
3119
|
return;
|
|
3090
3120
|
}
|
|
3091
|
-
c ? C() : (clearTimeout(
|
|
3121
|
+
c ? C() : (clearTimeout(f.current), y());
|
|
3092
3122
|
},
|
|
3093
3123
|
onDoubleClick: () => {
|
|
3094
|
-
|
|
3124
|
+
p.current === "mouse" && (D.current ? s.pause() : s.play().catch(() => {}), s.toggleFullscreen());
|
|
3095
3125
|
},
|
|
3096
|
-
children: [t ? /* @__PURE__ */
|
|
3126
|
+
children: [t ? /* @__PURE__ */ k("video", {
|
|
3097
3127
|
ref: t,
|
|
3098
3128
|
playsInline: !0
|
|
3099
3129
|
}) : null, o]
|
|
3100
3130
|
})
|
|
3101
3131
|
]
|
|
3102
3132
|
});
|
|
3103
|
-
},
|
|
3104
|
-
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath:
|
|
3105
|
-
|
|
3106
|
-
let { expose: O } = e,
|
|
3107
|
-
|
|
3108
|
-
let
|
|
3109
|
-
|
|
3110
|
-
if (!O || !
|
|
3133
|
+
}, yn = (e, t) => ({ title: e.options.find((e) => e.id === t)?.label }), bn = (e, t) => e instanceof Promise ? e.then(t) : t(), xn = ({ options: e, children: t }) => {
|
|
3134
|
+
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: l, libavWorkerUrl: u, read: d, thumbnailRead: f, thumbnailsEnabled: p, readsDownload: v } = r ?? {}, y = C(), b = S(), [x, w] = _(null), [T, E] = _(null), D = n?.media ?? x;
|
|
3135
|
+
m(() => (y?.(D), () => y?.(null)), [D, y]), he(D, n?.stepFrame);
|
|
3136
|
+
let { expose: O } = e, A = O === !0 ? {} : O || void 0, j = g(A);
|
|
3137
|
+
j.current = A;
|
|
3138
|
+
let M = A ? A.id : void 0, N = A ? A.origin : void 0, P = A ? A.channel : void 0;
|
|
3139
|
+
m(() => {
|
|
3140
|
+
if (!O || !D) return;
|
|
3111
3141
|
let e, t = !1;
|
|
3112
3142
|
return import("./remote/index.js").then(({ exposePlayer: n }) => {
|
|
3113
|
-
t || (e = n(
|
|
3143
|
+
t || (e = n(D, j.current ?? {}));
|
|
3114
3144
|
}).catch(() => {}), () => {
|
|
3115
3145
|
t = !0, e?.();
|
|
3116
3146
|
};
|
|
3117
3147
|
}, [
|
|
3118
|
-
|
|
3148
|
+
D,
|
|
3119
3149
|
!!O,
|
|
3120
|
-
j,
|
|
3121
3150
|
M,
|
|
3122
|
-
N
|
|
3151
|
+
N,
|
|
3152
|
+
P
|
|
3123
3153
|
]);
|
|
3124
|
-
let
|
|
3125
|
-
|
|
3126
|
-
let
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
}, [
|
|
3130
|
-
let
|
|
3131
|
-
|
|
3132
|
-
let
|
|
3133
|
-
|
|
3134
|
-
let
|
|
3135
|
-
tap:
|
|
3136
|
-
audioStreamIndex:
|
|
3154
|
+
let F = h(() => Ie(), [o]);
|
|
3155
|
+
de(x, T, r, v ? F.push : void 0);
|
|
3156
|
+
let I = r?.normalizeVolume ?? !0, [L, R] = _(I);
|
|
3157
|
+
m(() => {
|
|
3158
|
+
R(I);
|
|
3159
|
+
}, [I]);
|
|
3160
|
+
let z = g(r?.onNormalizeVolumeChange);
|
|
3161
|
+
z.current = r?.onNormalizeVolumeChange;
|
|
3162
|
+
let B = r?.normalizerWorkletUrl, V = g(f ?? d);
|
|
3163
|
+
V.current = f ?? d;
|
|
3164
|
+
let H = Y((e) => e.selectedAudioTrack), U = !!d, { refused: W } = Fe(x, B, L, h(() => U && o && l && u && typeof H == "number" && H >= 0 ? v ? {
|
|
3165
|
+
tap: F,
|
|
3166
|
+
audioStreamIndex: H
|
|
3137
3167
|
} : {
|
|
3138
|
-
read: (e, t) =>
|
|
3168
|
+
read: (e, t) => V.current(e, t),
|
|
3139
3169
|
length: o,
|
|
3140
|
-
publicPath:
|
|
3141
|
-
libavWorkerUrl:
|
|
3142
|
-
audioStreamIndex:
|
|
3170
|
+
publicPath: l,
|
|
3171
|
+
libavWorkerUrl: u,
|
|
3172
|
+
audioStreamIndex: H
|
|
3143
3173
|
} : void 0, [
|
|
3144
|
-
|
|
3174
|
+
U,
|
|
3145
3175
|
o,
|
|
3146
|
-
c,
|
|
3147
3176
|
l,
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3177
|
+
u,
|
|
3178
|
+
H,
|
|
3179
|
+
v,
|
|
3180
|
+
F
|
|
3181
|
+
]), h(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), ee = h(() => B && typeof AudioWorkletNode == "function" ? {
|
|
3182
|
+
enabled: L,
|
|
3183
|
+
available: !W,
|
|
3154
3184
|
setEnabled: (e) => {
|
|
3155
|
-
|
|
3185
|
+
R(e), z.current?.(e);
|
|
3156
3186
|
}
|
|
3157
3187
|
} : null, [
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
]), { thumbnails:
|
|
3162
|
-
publicPath:
|
|
3163
|
-
workerUrl:
|
|
3164
|
-
length:
|
|
3165
|
-
read:
|
|
3188
|
+
B,
|
|
3189
|
+
L,
|
|
3190
|
+
W
|
|
3191
|
+
]), { thumbnails: G, requestThumbnail: K } = ve({
|
|
3192
|
+
publicPath: l,
|
|
3193
|
+
workerUrl: u,
|
|
3194
|
+
length: p === !1 ? void 0 : o,
|
|
3195
|
+
read: f ?? d,
|
|
3166
3196
|
downloadedRanges: s
|
|
3167
|
-
}),
|
|
3168
|
-
|
|
3169
|
-
|
|
3197
|
+
}), q = n?.thumbnails?.all ?? G, { toggle: te, mode: J, burnedIn: ne } = ye(x, T), re = Te(n?.media ?? null, n?.pictureInPicture), X = Y((e) => e.setSourceState), ie = n ? !!n.media : o !== void 0;
|
|
3198
|
+
m(() => {
|
|
3199
|
+
X({
|
|
3170
3200
|
title: i,
|
|
3171
3201
|
size: o,
|
|
3172
3202
|
downloadedRanges: s,
|
|
3173
|
-
hasMedia:
|
|
3203
|
+
hasMedia: ie
|
|
3174
3204
|
});
|
|
3175
3205
|
}, [
|
|
3176
|
-
|
|
3206
|
+
X,
|
|
3177
3207
|
i,
|
|
3178
3208
|
o,
|
|
3179
3209
|
s,
|
|
3180
|
-
|
|
3210
|
+
ie
|
|
3181
3211
|
]);
|
|
3182
3212
|
let ae = n?.thumbnails?.at;
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
thumbnails:
|
|
3213
|
+
m(() => {
|
|
3214
|
+
X({
|
|
3215
|
+
thumbnails: q,
|
|
3186
3216
|
thumbnailAt: ae,
|
|
3187
|
-
requestThumbnail:
|
|
3188
|
-
togglePictureInPicture:
|
|
3189
|
-
pictureInPictureMode:
|
|
3190
|
-
burnedInSubtitles:
|
|
3217
|
+
requestThumbnail: K,
|
|
3218
|
+
togglePictureInPicture: te,
|
|
3219
|
+
pictureInPictureMode: J,
|
|
3220
|
+
burnedInSubtitles: ne
|
|
3191
3221
|
});
|
|
3192
3222
|
}, [
|
|
3193
|
-
|
|
3194
|
-
|
|
3223
|
+
X,
|
|
3224
|
+
q,
|
|
3195
3225
|
ae,
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
]),
|
|
3201
|
-
|
|
3202
|
-
}, [
|
|
3203
|
-
|
|
3204
|
-
}, [
|
|
3205
|
-
let
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3226
|
+
K,
|
|
3227
|
+
te,
|
|
3228
|
+
J,
|
|
3229
|
+
ne
|
|
3230
|
+
]), m(() => {
|
|
3231
|
+
X({ volumeNormalizer: ee });
|
|
3232
|
+
}, [X, ee]), m(() => {
|
|
3233
|
+
X({ passThroughPictureInPicture: re });
|
|
3234
|
+
}, [X, re]);
|
|
3235
|
+
let Z = n?.subtitles?.selection, oe = n?.audioTracks?.selection, se = g({
|
|
3236
|
+
audio: e.onPreferredAudioLanguageChange,
|
|
3237
|
+
subtitles: e.onPreferredSubtitleLanguageChange
|
|
3238
|
+
});
|
|
3239
|
+
se.current = {
|
|
3240
|
+
audio: e.onPreferredAudioLanguageChange,
|
|
3241
|
+
subtitles: e.onPreferredSubtitleLanguageChange
|
|
3242
|
+
}, m(() => {
|
|
3243
|
+
Z && X({
|
|
3244
|
+
subtitleTracks: Z.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3209
3245
|
id: e,
|
|
3210
3246
|
label: t,
|
|
3211
3247
|
disabled: n
|
|
3212
3248
|
})),
|
|
3213
|
-
selectedSubtitleTrack:
|
|
3214
|
-
selectSubtitleTrack: (e) =>
|
|
3215
|
-
|
|
3249
|
+
selectedSubtitleTrack: Z.selectedId ?? void 0,
|
|
3250
|
+
selectSubtitleTrack: (e) => {
|
|
3251
|
+
let t = e == null ? null : String(e), n = t === null ? void 0 : yn(Z, t), r = Z.selectedId === null;
|
|
3252
|
+
return bn(Z.select(t), () => {
|
|
3253
|
+
let e = t === null ? null : c(n) ?? (r ? n?.title : void 0);
|
|
3254
|
+
e !== void 0 && se.current.subtitles?.(e);
|
|
3255
|
+
});
|
|
3256
|
+
},
|
|
3257
|
+
subtitleOffLabel: Z.offLabel
|
|
3216
3258
|
});
|
|
3217
|
-
}, [
|
|
3218
|
-
oe &&
|
|
3259
|
+
}, [X, Z]), m(() => {
|
|
3260
|
+
oe && X({
|
|
3219
3261
|
audioTracks: oe.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3220
3262
|
id: e,
|
|
3221
3263
|
label: t,
|
|
3222
3264
|
disabled: n
|
|
3223
3265
|
})),
|
|
3224
3266
|
selectedAudioTrack: oe.selectedId ?? void 0,
|
|
3225
|
-
selectAudioTrack: (e) => oe.select(String(e))
|
|
3267
|
+
selectAudioTrack: (e) => bn(oe.select(String(e)), () => {
|
|
3268
|
+
let t = c(yn(oe, String(e)));
|
|
3269
|
+
t !== void 0 && se.current.audio?.(t);
|
|
3270
|
+
})
|
|
3226
3271
|
});
|
|
3227
|
-
}, [
|
|
3228
|
-
let
|
|
3229
|
-
return
|
|
3230
|
-
|
|
3231
|
-
}, [
|
|
3232
|
-
a &&
|
|
3233
|
-
}, [
|
|
3234
|
-
ref:
|
|
3235
|
-
onVideoRef: n ? void 0 :
|
|
3236
|
-
onSubtitleRef:
|
|
3272
|
+
}, [X, oe]);
|
|
3273
|
+
let ce = n?.quality?.selection ?? null;
|
|
3274
|
+
return m(() => {
|
|
3275
|
+
X({ quality: ce });
|
|
3276
|
+
}, [X, ce]), m(() => {
|
|
3277
|
+
a && X({ chapters: a });
|
|
3278
|
+
}, [X, a]), /* @__PURE__ */ k(vn, {
|
|
3279
|
+
ref: b,
|
|
3280
|
+
onVideoRef: n ? void 0 : w,
|
|
3281
|
+
onSubtitleRef: E,
|
|
3237
3282
|
overlay: e.overlay,
|
|
3238
3283
|
controls: e.controls,
|
|
3239
3284
|
shortcuts: e.shortcuts,
|
|
3240
3285
|
children: t
|
|
3241
3286
|
});
|
|
3242
|
-
},
|
|
3287
|
+
}, Sn = y`
|
|
3243
3288
|
/**
|
|
3244
3289
|
* The chrome's whole scale, in one place.
|
|
3245
3290
|
*
|
|
@@ -3309,17 +3354,17 @@ ${Ot}
|
|
|
3309
3354
|
height: 100%;
|
|
3310
3355
|
width: 100%;
|
|
3311
3356
|
overflow: hidden;
|
|
3312
|
-
`,
|
|
3313
|
-
css:
|
|
3314
|
-
children: /* @__PURE__ */
|
|
3357
|
+
`, Cn = (e) => /* @__PURE__ */ k("div", {
|
|
3358
|
+
css: Sn,
|
|
3359
|
+
children: /* @__PURE__ */ k(J.Provider, { children: /* @__PURE__ */ k(xn, {
|
|
3315
3360
|
options: e,
|
|
3316
3361
|
children: e.children
|
|
3317
3362
|
}) })
|
|
3318
|
-
}),
|
|
3363
|
+
}), wn = (e) => !!e && typeof e == "object" && "at" in e, Tn = (e) => !!e && typeof e == "object" && "selection" in e, En = ({ blob: e, name: t }) => ({
|
|
3319
3364
|
length: e.size,
|
|
3320
3365
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
3321
3366
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
3322
|
-
}),
|
|
3367
|
+
}), Dn = async (e, t) => {
|
|
3323
3368
|
let n = await fetch(e, {
|
|
3324
3369
|
headers: { Range: "bytes=0-1" },
|
|
3325
3370
|
credentials: t
|
|
@@ -3329,8 +3374,8 @@ ${Ot}
|
|
|
3329
3374
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
3330
3375
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
3331
3376
|
return i;
|
|
3332
|
-
},
|
|
3333
|
-
let i = t ?? await
|
|
3377
|
+
}, On = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3378
|
+
let i = t ?? await Dn(e, r);
|
|
3334
3379
|
return {
|
|
3335
3380
|
length: i,
|
|
3336
3381
|
name: n,
|
|
@@ -3346,9 +3391,9 @@ ${Ot}
|
|
|
3346
3391
|
},
|
|
3347
3392
|
readsDownload: !0
|
|
3348
3393
|
};
|
|
3349
|
-
},
|
|
3350
|
-
if ("blob" in e) return
|
|
3351
|
-
if ("url" in e) return
|
|
3394
|
+
}, kn = async (e) => {
|
|
3395
|
+
if ("blob" in e) return En(e);
|
|
3396
|
+
if ("url" in e) return On(e);
|
|
3352
3397
|
if ("read" in e) return {
|
|
3353
3398
|
length: e.length,
|
|
3354
3399
|
name: e.name,
|
|
@@ -3357,4 +3402,4 @@ ${Ot}
|
|
|
3357
3402
|
throw Error(`Unknown source type: ${e}`);
|
|
3358
3403
|
};
|
|
3359
3404
|
//#endregion
|
|
3360
|
-
export {
|
|
3405
|
+
export { Cn as MediaPlayer, Cn as default, J as Player, t as SUBTITLES_OFF, o as createPictureInPicture, s as createSubtitleRenderer, i as createThumbnailGenerator, kn as inputToRemuxerInput, Tn as isDelegatedTracks, wn as isExternalThumbnails, te as sourceFeature, a as startPlayback, ye as usePictureInPicture, Y as usePlayer, ve as useSeekThumbnails };
|