@banou/media-player 0.10.54 → 0.10.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ar-CWVutin3.js → ar-CSjwFY8l.js} +2 -0
- package/dist/{cs-CmwRGxyE.js → cs-Dk6IDwX9.js} +2 -0
- package/dist/{de-DLdKEf3t.js → de-G319tpSe.js} +2 -0
- package/dist/{el-Ckj-z6DX.js → el-CtRdEeUl.js} +2 -0
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/index.js +2 -2
- package/dist/engine/playback.d.ts +2 -0
- package/dist/engine/subtitle-convert.d.ts +8 -0
- package/dist/engine/subtitles.d.ts +2 -0
- package/dist/{engine-DZ6BX5XH.js → engine-tBJeFD6J.js} +285 -147
- package/dist/{es-419-zORhhU8D.js → es-419-BzuTB161.js} +2 -0
- package/dist/{fr-BtPmNkri.js → fr-BC0Ncjsm.js} +2 -0
- package/dist/{he-Bu79qEth.js → he-UutSGaSy.js} +2 -0
- package/dist/{hi-BsH3tSHa.js → hi-kNW0VH4d.js} +2 -0
- package/dist/{hu-BkYBW-YP.js → hu-UJBXN0lB.js} +2 -0
- package/dist/{id-nUaBCV4o.js → id-DYADKCdp.js} +2 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1188 -953
- package/dist/{it-CqPSHyFA.js → it-GodcqBoI.js} +2 -0
- package/dist/{ja-DTjvriHw.js → ja-r3FM4zNQ.js} +2 -0
- package/dist/{ko-dV8T7XOJ.js → ko-kNn9SZJT.js} +2 -0
- package/dist/labels.d.ts +2 -0
- package/dist/{ms-VZQ7BI0z.js → ms-B_95sgk7.js} +2 -0
- package/dist/{nl-Q6iDxbDz.js → nl-DUua8lM5.js} +2 -0
- package/dist/{pl-BN7bK74l.js → pl-DYN3cCvL.js} +2 -0
- package/dist/{pt-BR-CPFILeFW.js → pt-BR-CRH5nyyj.js} +2 -0
- package/dist/react/components/chrome.d.ts +3 -2
- package/dist/react/components/control-bar.d.ts +3 -2
- package/dist/react/hooks/use-playback.d.ts +1 -5
- package/dist/react/video-player.d.ts +29 -1
- package/dist/remote/index.d.ts +25 -2
- package/dist/remote/index.js +134 -68
- package/dist/remote/protocol.d.ts +22 -6
- package/dist/{ro-Bwcm-i3k.js → ro-lXdsKpft.js} +2 -0
- package/dist/{ru-D1FMz751.js → ru-Du_uJXdo.js} +2 -0
- package/dist/{sv-ci9K0Lkk.js → sv-CpEL6oGd.js} +2 -0
- package/dist/{th-DR-UBONQ.js → th-CQac_Jcd.js} +2 -0
- package/dist/{tr-BqhdfT22.js → tr-DLRAnIOh.js} +2 -0
- package/dist/{uk-8pkZqdni.js → uk-Cra5hJzT.js} +2 -0
- package/dist/{vi-3mKZ9G_M.js → vi-L2-IGJYQ.js} +2 -0
- package/dist/{zh-Hans-CDgigWKY.js → zh-Hans-Dp0UkPYn.js} +2 -0
- package/dist/{zh-Hant-3WSNI0ne.js → zh-Hant-CS16XV8X.js} +2 -0
- package/package.json +1 -1
- package/src/lib/engine/index.ts +3 -0
- package/src/lib/engine/playback.ts +4 -0
- package/src/lib/engine/subtitle-convert.ts +186 -0
- package/src/lib/engine/subtitles.ts +46 -7
- package/src/lib/index.tsx +7 -0
- package/src/lib/labels.ts +2 -0
- package/src/lib/locales/ar.json +2 -0
- package/src/lib/locales/cs.json +2 -0
- package/src/lib/locales/de.json +2 -0
- package/src/lib/locales/el.json +2 -0
- package/src/lib/locales/es-419.json +2 -0
- package/src/lib/locales/fr.json +2 -0
- package/src/lib/locales/he.json +2 -0
- package/src/lib/locales/hi.json +2 -0
- package/src/lib/locales/hu.json +2 -0
- package/src/lib/locales/id.json +2 -0
- package/src/lib/locales/it.json +2 -0
- package/src/lib/locales/ja.json +2 -0
- package/src/lib/locales/ko.json +2 -0
- package/src/lib/locales/ms.json +2 -0
- package/src/lib/locales/nl.json +2 -0
- package/src/lib/locales/pl.json +2 -0
- package/src/lib/locales/pt-BR.json +2 -0
- package/src/lib/locales/ro.json +2 -0
- package/src/lib/locales/ru.json +2 -0
- package/src/lib/locales/sv.json +2 -0
- package/src/lib/locales/th.json +2 -0
- package/src/lib/locales/tr.json +2 -0
- package/src/lib/locales/uk.json +2 -0
- package/src/lib/locales/vi.json +2 -0
- package/src/lib/locales/zh-Hans.json +2 -0
- package/src/lib/locales/zh-Hant.json +2 -0
- package/src/lib/react/components/chrome.tsx +4 -3
- package/src/lib/react/components/control-bar.tsx +51 -6
- package/src/lib/react/hooks/use-playback.ts +207 -15
- package/src/lib/react/video-player.tsx +116 -3
- package/src/lib/remote/index.ts +149 -12
- package/src/lib/remote/protocol.ts +32 -7
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { c as e,
|
|
2
|
-
import { languageOf as
|
|
3
|
-
import { n as
|
|
4
|
-
import { Children as
|
|
5
|
-
import { css as
|
|
6
|
-
import { createPlayer as
|
|
7
|
-
import { definePlayerFeature as
|
|
8
|
-
import { makeRemuxer as
|
|
9
|
-
import { Fragment as
|
|
10
|
-
import { createMediaElementSource as
|
|
11
|
-
import { Captions as
|
|
12
|
-
import { Tooltip as
|
|
1
|
+
import { c as e, d as t, h as n, i as r, l as i, m as a, n as o, r as s, s as c, t as l, u } from "./engine-tBJeFD6J.js";
|
|
2
|
+
import { languageOf as d, playsIn as f, startingTracks as p } from "./language/index.js";
|
|
3
|
+
import { n as m, r as h, t as g } from "./chapters-EBYXcEml.js";
|
|
4
|
+
import { Children as _, Fragment as v, createContext as y, isValidElement as b, useCallback as x, useContext as S, useEffect as C, useMemo as w, useRef as T, useState as E, useSyncExternalStore as D } from "react";
|
|
5
|
+
import { css as O, keyframes as k } from "@emotion/react";
|
|
6
|
+
import { createPlayer as A, useContainerAttach as j, useMediaAttach as M } from "@videojs/react";
|
|
7
|
+
import { definePlayerFeature as N, videoFeatures as ee } from "@videojs/core/dom";
|
|
8
|
+
import { makeRemuxer as te } from "libav-wasm";
|
|
9
|
+
import { Fragment as P, jsx as F, jsxs as I } from "@emotion/react/jsx-runtime";
|
|
10
|
+
import { createMediaElementSource as ne } from "@banou/ponyfill/web-audio";
|
|
11
|
+
import { Captions as L, CaptionsOff as R, Check as z, ChevronLeft as B, ChevronRight as V, Copy as H, Maximize as U, Minimize as W, Pause as G, Play as K, RotateCcw as q, Settings as J, SkipBack as Y, SkipForward as re, TriangleAlert as ie, Volume1 as ae, Volume2 as oe, VolumeX as se } from "lucide-react";
|
|
12
|
+
import { Tooltip as ce } from "react-tooltip";
|
|
13
13
|
//#region src/lib/react/source-feature.ts
|
|
14
|
-
var
|
|
14
|
+
var le = {
|
|
15
15
|
indexes: [],
|
|
16
16
|
chapters: [],
|
|
17
17
|
thumbnails: [],
|
|
@@ -37,46 +37,46 @@ var oe = {
|
|
|
37
37
|
playbackErrors: [],
|
|
38
38
|
ready: !1,
|
|
39
39
|
setSourceState: () => {}
|
|
40
|
-
},
|
|
40
|
+
}, ue = N({
|
|
41
41
|
name: "source",
|
|
42
|
-
state: () => ({ ...
|
|
42
|
+
state: () => ({ ...le }),
|
|
43
43
|
attach({ set: e }) {
|
|
44
44
|
e({
|
|
45
45
|
setSourceState: (t) => e(t),
|
|
46
46
|
setHideUI: (t) => e({ hideUI: t })
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
}),
|
|
50
|
-
features: [...
|
|
49
|
+
}), de = A({
|
|
50
|
+
features: [...ee, ue],
|
|
51
51
|
displayName: "MediaPlayer"
|
|
52
|
-
}), X =
|
|
53
|
-
ar: () => import("./ar-
|
|
54
|
-
cs: () => import("./cs-
|
|
55
|
-
de: () => import("./de-
|
|
56
|
-
el: () => import("./el-
|
|
57
|
-
"es-419": () => import("./es-419-
|
|
58
|
-
fr: () => import("./fr-
|
|
59
|
-
he: () => import("./he-
|
|
60
|
-
hi: () => import("./hi-
|
|
61
|
-
hu: () => import("./hu-
|
|
62
|
-
id: () => import("./id-
|
|
63
|
-
it: () => import("./it-
|
|
64
|
-
ja: () => import("./ja-
|
|
65
|
-
ko: () => import("./ko-
|
|
66
|
-
ms: () => import("./ms-
|
|
67
|
-
nl: () => import("./nl-
|
|
68
|
-
pl: () => import("./pl-
|
|
69
|
-
"pt-BR": () => import("./pt-BR-
|
|
70
|
-
ro: () => import("./ro-
|
|
71
|
-
ru: () => import("./ru-
|
|
72
|
-
sv: () => import("./sv-
|
|
73
|
-
th: () => import("./th-
|
|
74
|
-
tr: () => import("./tr-
|
|
75
|
-
uk: () => import("./uk-
|
|
76
|
-
vi: () => import("./vi-
|
|
77
|
-
"zh-Hans": () => import("./zh-Hans-
|
|
78
|
-
"zh-Hant": () => import("./zh-Hant-
|
|
79
|
-
},
|
|
52
|
+
}), X = de.usePlayer, fe = {
|
|
53
|
+
ar: () => import("./ar-CSjwFY8l.js"),
|
|
54
|
+
cs: () => import("./cs-Dk6IDwX9.js"),
|
|
55
|
+
de: () => import("./de-G319tpSe.js"),
|
|
56
|
+
el: () => import("./el-CtRdEeUl.js"),
|
|
57
|
+
"es-419": () => import("./es-419-BzuTB161.js"),
|
|
58
|
+
fr: () => import("./fr-BC0Ncjsm.js"),
|
|
59
|
+
he: () => import("./he-UutSGaSy.js"),
|
|
60
|
+
hi: () => import("./hi-kNW0VH4d.js"),
|
|
61
|
+
hu: () => import("./hu-UJBXN0lB.js"),
|
|
62
|
+
id: () => import("./id-DYADKCdp.js"),
|
|
63
|
+
it: () => import("./it-GodcqBoI.js"),
|
|
64
|
+
ja: () => import("./ja-r3FM4zNQ.js"),
|
|
65
|
+
ko: () => import("./ko-kNn9SZJT.js"),
|
|
66
|
+
ms: () => import("./ms-B_95sgk7.js"),
|
|
67
|
+
nl: () => import("./nl-DUua8lM5.js"),
|
|
68
|
+
pl: () => import("./pl-DYN3cCvL.js"),
|
|
69
|
+
"pt-BR": () => import("./pt-BR-CRH5nyyj.js"),
|
|
70
|
+
ro: () => import("./ro-lXdsKpft.js"),
|
|
71
|
+
ru: () => import("./ru-Du_uJXdo.js"),
|
|
72
|
+
sv: () => import("./sv-CpEL6oGd.js"),
|
|
73
|
+
th: () => import("./th-CQac_Jcd.js"),
|
|
74
|
+
tr: () => import("./tr-DLRAnIOh.js"),
|
|
75
|
+
uk: () => import("./uk-Cra5hJzT.js"),
|
|
76
|
+
vi: () => import("./vi-L2-IGJYQ.js"),
|
|
77
|
+
"zh-Hans": () => import("./zh-Hans-Dp0UkPYn.js"),
|
|
78
|
+
"zh-Hant": () => import("./zh-Hant-CS16XV8X.js")
|
|
79
|
+
}, pe = Object.keys(fe), me = (e) => {
|
|
80
80
|
try {
|
|
81
81
|
let t = new Intl.Locale(e), { language: n, script: r } = t.maximize();
|
|
82
82
|
return {
|
|
@@ -87,32 +87,32 @@ var oe = {
|
|
|
87
87
|
} catch {
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
|
-
},
|
|
91
|
-
let t =
|
|
90
|
+
}, he = (e) => {
|
|
91
|
+
let t = me(e);
|
|
92
92
|
if (!t) return;
|
|
93
|
-
let n =
|
|
94
|
-
...
|
|
93
|
+
let n = pe.map((e) => ({
|
|
94
|
+
...me(e),
|
|
95
95
|
catalogue: e
|
|
96
96
|
}));
|
|
97
97
|
return (n.find(({ tag: e }) => e === t.tag) ?? n.find(({ language: e, script: n }) => e === t.language && n === t.script) ?? n.find(({ language: e }) => e === t.language))?.catalogue;
|
|
98
|
-
},
|
|
99
|
-
let n =
|
|
100
|
-
return n || (n = Promise.all([import("@formatjs/intl"),
|
|
98
|
+
}, ge = /* @__PURE__ */ new Map(), _e = /* @__PURE__ */ new Map(), ve = (e, t) => {
|
|
99
|
+
let n = _e.get(e);
|
|
100
|
+
return n || (n = Promise.all([import("@formatjs/intl"), fe[t]()]).then(([{ createIntl: t }, { default: n }]) => {
|
|
101
101
|
let r = t({
|
|
102
102
|
locale: e,
|
|
103
103
|
defaultLocale: "en",
|
|
104
104
|
messages: n
|
|
105
105
|
});
|
|
106
|
-
return
|
|
107
|
-
}), n.catch(() =>
|
|
108
|
-
},
|
|
106
|
+
return ge.set(e, r), r;
|
|
107
|
+
}), n.catch(() => _e.delete(e)), _e.set(e, n)), n;
|
|
108
|
+
}, ye = (e) => {
|
|
109
109
|
try {
|
|
110
110
|
return Intl.getCanonicalLocales(e)[0];
|
|
111
111
|
} catch {
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
-
},
|
|
115
|
-
let r = t ?
|
|
114
|
+
}, be = (e, t) => {
|
|
115
|
+
let r = t ? ye(t) ?? "en" : void 0;
|
|
116
116
|
return {
|
|
117
117
|
format: (t, ...[r]) => e ? e.formatMessage({
|
|
118
118
|
id: t,
|
|
@@ -121,23 +121,23 @@ var oe = {
|
|
|
121
121
|
number: (e, t) => new Intl.NumberFormat(r ?? "en", t).format(e),
|
|
122
122
|
locale: r
|
|
123
123
|
};
|
|
124
|
-
},
|
|
125
|
-
let n = e ?
|
|
126
|
-
|
|
127
|
-
if (!e || !n ||
|
|
124
|
+
}, xe = be(void 0, void 0), Se = y(xe), Z = () => S(Se), Ce = ({ language: e, children: t }) => {
|
|
125
|
+
let n = e ? he(e) : void 0, [, r] = E();
|
|
126
|
+
C(() => {
|
|
127
|
+
if (!e || !n || ge.has(e)) return;
|
|
128
128
|
let t = !1;
|
|
129
|
-
return
|
|
129
|
+
return ve(e, n).then((e) => {
|
|
130
130
|
t || r(e);
|
|
131
131
|
}, () => {}), () => {
|
|
132
132
|
t = !0;
|
|
133
133
|
};
|
|
134
134
|
}, [e, n]);
|
|
135
|
-
let i = e && n ?
|
|
136
|
-
return /* @__PURE__ */
|
|
135
|
+
let i = e && n ? ge.get(e) : void 0, a = w(() => e ? be(i, e) : xe, [i, e]);
|
|
136
|
+
return /* @__PURE__ */ F(Se.Provider, {
|
|
137
137
|
value: a,
|
|
138
138
|
children: t
|
|
139
139
|
});
|
|
140
|
-
},
|
|
140
|
+
}, we = (e, t) => {
|
|
141
141
|
if (e && e !== "und") try {
|
|
142
142
|
return new Intl.DisplayNames([t ?? (navigator.language || "en")], {
|
|
143
143
|
type: "language",
|
|
@@ -146,318 +146,468 @@ var oe = {
|
|
|
146
146
|
} catch {
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
},
|
|
150
|
-
let r = (e) => t ? t.format(a.track, { number: e }) : n(a.track, { number: e }), i = e.map((e) =>
|
|
149
|
+
}, Te = (e) => e?.replace(/_/g, " ").trim() || void 0, Ee = (e, t) => {
|
|
150
|
+
let r = (e) => t ? t.format(a.track, { number: e }) : n(a.track, { number: e }), i = e.map((e) => we(e.language, t?.locale) ?? Te(e.title) ?? r(e.streamIndex)), o = i.reduce((e, t) => ({
|
|
151
151
|
...e,
|
|
152
152
|
[t]: (e[t] ?? 0) + 1
|
|
153
153
|
}), {});
|
|
154
154
|
return e.map((e, t) => {
|
|
155
|
-
let n = i[t], r =
|
|
155
|
+
let n = i[t], r = Te(e.title);
|
|
156
156
|
return {
|
|
157
157
|
track: e,
|
|
158
158
|
label: (o[n] ?? 0) > 1 && r && r !== n ? `${n} (${r})` : n
|
|
159
159
|
};
|
|
160
160
|
});
|
|
161
|
-
},
|
|
161
|
+
}, De = (e, t) => Ee(e, t).map(({ track: e, label: t }) => ({
|
|
162
162
|
id: e.streamIndex,
|
|
163
163
|
label: t
|
|
164
|
-
})),
|
|
164
|
+
})), Oe = [
|
|
165
165
|
0,
|
|
166
166
|
250,
|
|
167
167
|
1e3,
|
|
168
168
|
3e3,
|
|
169
169
|
1e4
|
|
170
|
-
],
|
|
170
|
+
], Q = 6e4, ke = 500, Ae = 15e3, je = (e) => e instanceof Error ? e.message : String(e), Me = (e) => {
|
|
171
171
|
let t = [], n = e?.cause;
|
|
172
172
|
for (let e = 0; n != null && e < 8; e++) {
|
|
173
173
|
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
174
174
|
t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
177
|
-
t.push(
|
|
177
|
+
t.push(je(n)), n = n?.cause;
|
|
178
178
|
}
|
|
179
179
|
return t.length ? t.join("\n") : void 0;
|
|
180
|
-
},
|
|
181
|
-
let
|
|
182
|
-
|
|
183
|
-
let
|
|
180
|
+
}, Ne = "ext:", Pe = (e) => typeof e == "string" && e.startsWith(Ne), Fe = (e) => e.slice(4), Ie = (t, n, i, a, o) => {
|
|
181
|
+
let s = X(), { read: l, size: u, publicPath: m = "", libavWorkerUrl: h = "", jassubWorkerUrl: g = "", jassubWasmUrl: _ = "", jassubWasmWorkerUrl: v = "", jassubLegacyWasmUrl: y, jassubLegacyWasmWorkerUrl: b, defaultFontUrl: S, cjkFontUrl: w, bufferSize: D, autoplay: O = !1, chapters: k, seekPrepareBudgetMs: A = ke, externalSubtitles: j } = i ?? {}, M = T(j ?? []);
|
|
182
|
+
M.current = j ?? [];
|
|
183
|
+
let N = JSON.stringify(j?.map((e) => [
|
|
184
|
+
e.id,
|
|
185
|
+
e.language,
|
|
186
|
+
e.label,
|
|
187
|
+
e.format,
|
|
188
|
+
e.content ?? null
|
|
189
|
+
]) ?? []), ee = T(k);
|
|
190
|
+
ee.current = k;
|
|
191
|
+
let [te, P] = E(), F = te && te.size === u ? te.streamIndex : void 0, [I, ne] = E(0), L = T({
|
|
184
192
|
count: 0,
|
|
185
193
|
at: 0
|
|
186
|
-
}),
|
|
187
|
-
|
|
194
|
+
}), R = T(void 0), z = T(/* @__PURE__ */ new Map()), B = T(null), V = T(0);
|
|
195
|
+
C(() => (L.current = {
|
|
188
196
|
count: 0,
|
|
189
197
|
at: 0
|
|
190
|
-
},
|
|
198
|
+
}, J.current = {
|
|
199
|
+
audio: [],
|
|
200
|
+
subtitles: []
|
|
201
|
+
}, B.current = null, z.current.clear(), V.current++, u !== void 0 && s.setSourceState({
|
|
191
202
|
playbackErrors: [],
|
|
192
|
-
seekingTo: void 0
|
|
203
|
+
seekingTo: void 0,
|
|
204
|
+
selectedSubtitleTrack: void 0,
|
|
205
|
+
subtitleTracks: M.current.map((e) => ({
|
|
206
|
+
id: `${Ne}${e.id}`,
|
|
207
|
+
label: e.label.trim() || e.language || e.id
|
|
208
|
+
}))
|
|
193
209
|
}), () => {
|
|
194
|
-
|
|
195
|
-
}), [
|
|
196
|
-
let
|
|
197
|
-
|
|
198
|
-
let
|
|
199
|
-
|
|
200
|
-
if (!
|
|
201
|
-
let
|
|
202
|
-
|
|
203
|
-
}, n = Object.getOwnPropertyDescriptor(
|
|
204
|
-
return
|
|
205
|
-
return
|
|
206
|
-
},
|
|
207
|
-
|
|
210
|
+
R.current && clearTimeout(R.current);
|
|
211
|
+
}), [u]);
|
|
212
|
+
let H = T(null), U = T(null), W = T(void 0), G = T(u);
|
|
213
|
+
G.current = u;
|
|
214
|
+
let K = T(null), q = T(!1);
|
|
215
|
+
C(() => {
|
|
216
|
+
if (!t) return;
|
|
217
|
+
let e = () => {
|
|
218
|
+
q.current = !1;
|
|
219
|
+
}, n = Object.getOwnPropertyDescriptor(t, "pause"), r = t.pause;
|
|
220
|
+
return t.pause = function() {
|
|
221
|
+
return K.current ? K.current() : q.current = !0, r.call(this);
|
|
222
|
+
}, t.addEventListener("play", e), () => {
|
|
223
|
+
t.removeEventListener("play", e), n ? Object.defineProperty(t, "pause", n) : delete t.pause;
|
|
208
224
|
};
|
|
209
|
-
}, [
|
|
210
|
-
let
|
|
225
|
+
}, [t]);
|
|
226
|
+
let J = T({
|
|
211
227
|
audio: [],
|
|
212
228
|
subtitles: []
|
|
213
|
-
}),
|
|
214
|
-
|
|
215
|
-
let
|
|
216
|
-
|
|
217
|
-
let
|
|
218
|
-
audio:
|
|
219
|
-
original:
|
|
220
|
-
subtitles:
|
|
221
|
-
alwaysSubtitles:
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
let
|
|
225
|
-
|
|
226
|
-
let
|
|
227
|
-
|
|
228
|
-
let
|
|
229
|
-
|
|
230
|
-
let
|
|
231
|
-
|
|
232
|
-
let
|
|
233
|
-
|
|
234
|
-
let
|
|
235
|
-
|
|
236
|
-
let
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
let
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
229
|
+
}), Y = x(() => J.current.audio.find((e) => e.streamIndex === s.selectedAudioTrack), [s]), re = T(l);
|
|
230
|
+
re.current = l;
|
|
231
|
+
let ie = T(O);
|
|
232
|
+
ie.current = O;
|
|
233
|
+
let ae = {
|
|
234
|
+
audio: i?.preferredAudioLanguage,
|
|
235
|
+
original: i?.originalLanguage,
|
|
236
|
+
subtitles: i?.preferredSubtitleLanguage,
|
|
237
|
+
alwaysSubtitles: i?.alwaysShowSubtitles
|
|
238
|
+
}, oe = T(ae);
|
|
239
|
+
oe.current = ae;
|
|
240
|
+
let se = T(i?.onPreferredAudioLanguageChange);
|
|
241
|
+
se.current = i?.onPreferredAudioLanguageChange;
|
|
242
|
+
let ce = T(i?.onPreferredSubtitleLanguageChange);
|
|
243
|
+
ce.current = i?.onPreferredSubtitleLanguageChange;
|
|
244
|
+
let le = T(i?.onAlwaysShowSubtitlesChange);
|
|
245
|
+
le.current = i?.onAlwaysShowSubtitlesChange;
|
|
246
|
+
let ue = T(i?.onSeek);
|
|
247
|
+
ue.current = i?.onSeek;
|
|
248
|
+
let de = T(i?.onPlaybackError);
|
|
249
|
+
de.current = i?.onPlaybackError;
|
|
250
|
+
let fe = T(a);
|
|
251
|
+
fe.current = a;
|
|
252
|
+
let pe = Z(), me = T(pe);
|
|
253
|
+
me.current = pe;
|
|
254
|
+
let he = x((e) => [...De(J.current.subtitles, e), ...M.current.map((e) => ({
|
|
255
|
+
id: `${Ne}${e.id}`,
|
|
256
|
+
label: e.label.trim() || e.language || e.id
|
|
257
|
+
}))], []), ge = x(async (e, t) => {
|
|
258
|
+
let n = `${t}:${e.id}`, i = z.current.get(n);
|
|
259
|
+
if (e.content !== void 0) {
|
|
260
|
+
if (i && i.raw === e.content) return i.ass;
|
|
261
|
+
let t = r(e.content, e.format, e.label);
|
|
262
|
+
return z.current.set(n, {
|
|
263
|
+
raw: e.content,
|
|
264
|
+
ass: t
|
|
265
|
+
}), t;
|
|
266
|
+
}
|
|
267
|
+
if (i) return i.ass;
|
|
268
|
+
if (!e.load) throw Error("External subtitle track has no content or loader");
|
|
269
|
+
let a = await e.load(), o = r(a, e.format, e.label);
|
|
270
|
+
return G.current === t && z.current.set(n, {
|
|
271
|
+
raw: a,
|
|
272
|
+
ass: o
|
|
273
|
+
}), o;
|
|
274
|
+
}, []);
|
|
275
|
+
C(() => {
|
|
276
|
+
let { audio: e, subtitles: t } = J.current;
|
|
277
|
+
(t.length || G.current !== void 0 && M.current.length) && s.setSourceState({ subtitleTracks: he(pe) }), e.length && s.setSourceState({ audioTracks: De(e, pe) });
|
|
278
|
+
}, [
|
|
279
|
+
s,
|
|
280
|
+
pe,
|
|
281
|
+
he
|
|
282
|
+
]);
|
|
283
|
+
let _e = x((e) => {
|
|
284
|
+
let t = G.current, n = ++V.current, i = s.selectedSubtitleTrack === void 0;
|
|
285
|
+
if (W.current = t, e === void 0) {
|
|
286
|
+
B.current = null, s.setSourceState({ selectedSubtitleTrack: void 0 }), H.current?.clearExternalSubtitleTrack(), H.current?.selectSubtitleStream(void 0), ce.current?.(null);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (Pe(e)) {
|
|
290
|
+
let a = Fe(e), o = M.current.find((e) => e.id === a);
|
|
291
|
+
if (!o || t === void 0) return Promise.reject(/* @__PURE__ */ Error("External subtitle track not found"));
|
|
292
|
+
let c = (t) => {
|
|
293
|
+
B.current = {
|
|
294
|
+
id: e,
|
|
295
|
+
ass: t
|
|
296
|
+
}, s.setSourceState({ selectedSubtitleTrack: e }), H.current?.setExternalSubtitleTrack(t);
|
|
297
|
+
let n = d({
|
|
298
|
+
language: o.language,
|
|
299
|
+
title: o.label
|
|
300
|
+
}) ?? (i ? o.label.trim() || "und" : void 0);
|
|
301
|
+
n !== void 0 && ce.current?.(n), n && f(Y(), n) && le.current?.(!0);
|
|
302
|
+
}, l = `${t}:${o.id}`, u = z.current.get(l);
|
|
303
|
+
if (o.content !== void 0) {
|
|
304
|
+
let e = u && u.raw === o.content ? u.ass : r(o.content, o.format, o.label);
|
|
305
|
+
z.current.set(l, {
|
|
306
|
+
raw: o.content,
|
|
307
|
+
ass: e
|
|
308
|
+
}), c(e);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
if (u) {
|
|
312
|
+
c(u.ass);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
return ge(o, t).then((e) => {
|
|
316
|
+
V.current === n && G.current === t && c(e);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
let a = typeof e == "number" ? e : void 0;
|
|
320
|
+
B.current = null, s.setSourceState({ selectedSubtitleTrack: a }), H.current?.selectSubtitleStream(a);
|
|
321
|
+
let o = J.current.subtitles.find((e) => e.streamIndex === a), c = a === void 0 ? null : d(o) ?? (i ? o?.title?.trim() || "und" : void 0);
|
|
322
|
+
c !== void 0 && ce.current?.(c), c && f(Y(), c) && le.current?.(!0);
|
|
323
|
+
}, [
|
|
324
|
+
s,
|
|
325
|
+
Y,
|
|
326
|
+
ge
|
|
327
|
+
]), ve = x(() => {
|
|
328
|
+
let e = G.current;
|
|
329
|
+
if (!H.current || e === void 0 || W.current === e || oe.current.subtitles == null) return;
|
|
330
|
+
let t = Y(), n = t ? [t] : [], i = p(n, J.current.subtitles, oe.current).subtitles;
|
|
331
|
+
if (i === null || i >= 0) return;
|
|
332
|
+
let a = M.current;
|
|
333
|
+
if (!a.length) return;
|
|
334
|
+
let o = p(n, a.map((e) => ({
|
|
335
|
+
language: e.language,
|
|
336
|
+
title: e.label
|
|
337
|
+
})), oe.current).subtitles;
|
|
338
|
+
if (o === null || o < 0) return;
|
|
339
|
+
let c = a[o];
|
|
340
|
+
if (!c) return;
|
|
341
|
+
let l = `${Ne}${c.id}`;
|
|
342
|
+
if (s.selectedSubtitleTrack === l) return;
|
|
343
|
+
let u = ++V.current, d = (e) => {
|
|
344
|
+
B.current = {
|
|
345
|
+
id: l,
|
|
346
|
+
ass: e
|
|
347
|
+
}, s.setSourceState({ selectedSubtitleTrack: l }), H.current?.setExternalSubtitleTrack(e);
|
|
348
|
+
}, f = `${e}:${c.id}`, m = z.current.get(f);
|
|
349
|
+
if (c.content !== void 0) {
|
|
350
|
+
let e = m && m.raw === c.content ? m.ass : r(c.content, c.format, c.label);
|
|
351
|
+
z.current.set(f, {
|
|
352
|
+
raw: c.content,
|
|
353
|
+
ass: e
|
|
354
|
+
}), d(e);
|
|
250
355
|
return;
|
|
251
356
|
}
|
|
252
|
-
|
|
253
|
-
|
|
357
|
+
if (m) {
|
|
358
|
+
d(m.ass);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
ge(c, e).then((t) => {
|
|
362
|
+
V.current === u && G.current === e && W.current !== e && d(t);
|
|
363
|
+
}, () => {});
|
|
364
|
+
}, [
|
|
365
|
+
s,
|
|
366
|
+
Y,
|
|
367
|
+
ge
|
|
368
|
+
]), ye = T(0), be = x((e, t = !1) => {
|
|
369
|
+
let n = ++ye.current, r = H.current;
|
|
370
|
+
if (!r || A <= 0 || t) {
|
|
371
|
+
s.setSourceState({ seekingTo: void 0 }), s.seek(e);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
let i = typeof window < "u" && window.__mediaPlayerSeekDebug, a = performance.now(), o = !1, c = "prepared", l = () => {
|
|
375
|
+
if (!o && (o = !0, H.current === r && ye.current === n && (s.seek(e), i))) {
|
|
254
376
|
let t = r.videoElement, n = 0;
|
|
255
377
|
if (t) for (let r = 0; r < t.buffered.length; r++) t.buffered.start(r) <= e + 1 && e < t.buffered.end(r) && (n = t.buffered.end(r) - e);
|
|
256
|
-
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() -
|
|
378
|
+
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - a)}ms via ${c}, runway ${n.toFixed(1)}s${c === "deadline" ? " (EXPOSED: moved before its data was ready)" : ""}`);
|
|
257
379
|
}
|
|
258
380
|
};
|
|
259
|
-
|
|
381
|
+
s.setSourceState({ seekingTo: e });
|
|
260
382
|
let u = r.videoElement, d = () => {
|
|
261
|
-
u?.removeEventListener("seeked", f), clearTimeout(p),
|
|
383
|
+
u?.removeEventListener("seeked", f), clearTimeout(p), ye.current === n && s.setSourceState({ seekingTo: void 0 });
|
|
262
384
|
}, f = () => {
|
|
263
|
-
|
|
264
|
-
}, p = setTimeout(d,
|
|
385
|
+
o && d();
|
|
386
|
+
}, p = setTimeout(d, Ae);
|
|
265
387
|
u?.addEventListener("seeked", f);
|
|
266
388
|
let m = setTimeout(() => {
|
|
267
389
|
c = "deadline", l();
|
|
268
|
-
},
|
|
390
|
+
}, A);
|
|
269
391
|
r.prepareSeek(e).catch(() => {}).finally(() => {
|
|
270
392
|
clearTimeout(m), l();
|
|
271
393
|
});
|
|
272
|
-
}, [
|
|
273
|
-
if (typeof e != "number" ||
|
|
274
|
-
|
|
275
|
-
size:
|
|
394
|
+
}, [s, A]), xe = x((e) => {
|
|
395
|
+
if (typeof e != "number" || G.current === void 0) return;
|
|
396
|
+
s.setSourceState({ selectedAudioTrack: e }), P({
|
|
397
|
+
size: G.current,
|
|
276
398
|
streamIndex: e
|
|
277
399
|
});
|
|
278
|
-
let t =
|
|
279
|
-
t !== void 0 &&
|
|
280
|
-
}, [
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
selectSubtitleTrack:
|
|
284
|
-
selectAudioTrack:
|
|
285
|
-
requestSeek:
|
|
400
|
+
let t = d(J.current.audio.find((t) => t.streamIndex === e));
|
|
401
|
+
t !== void 0 && se.current?.(t);
|
|
402
|
+
}, [s]), Se = X((e) => e.setSourceState);
|
|
403
|
+
C(() => {
|
|
404
|
+
Se({
|
|
405
|
+
selectSubtitleTrack: _e,
|
|
406
|
+
selectAudioTrack: xe,
|
|
407
|
+
requestSeek: be
|
|
286
408
|
});
|
|
287
409
|
}, [
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
])
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
410
|
+
Se,
|
|
411
|
+
_e,
|
|
412
|
+
xe,
|
|
413
|
+
be
|
|
414
|
+
]);
|
|
415
|
+
let Ce = T(o);
|
|
416
|
+
C(() => {
|
|
417
|
+
if (Ce.current !== o && (Ce.current = o, z.current.clear()), u === void 0) return;
|
|
418
|
+
let e = B.current;
|
|
419
|
+
if (e) {
|
|
420
|
+
let t = M.current.find((t) => `${Ne}${t.id}` === e.id);
|
|
421
|
+
if (!t) B.current = null, H.current?.clearExternalSubtitleTrack(), s.setSourceState({ selectedSubtitleTrack: void 0 });
|
|
422
|
+
else if (t.content !== void 0) {
|
|
423
|
+
let n = r(t.content, t.format, t.label);
|
|
424
|
+
z.current.set(`${u}:${t.id}`, {
|
|
425
|
+
raw: t.content,
|
|
426
|
+
ass: n
|
|
427
|
+
}), n !== e.ass && (B.current = {
|
|
428
|
+
id: e.id,
|
|
429
|
+
ass: n
|
|
430
|
+
}, H.current?.setExternalSubtitleTrack(n));
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
s.setSourceState({ subtitleTracks: he(me.current) }), ve();
|
|
434
|
+
}, [
|
|
435
|
+
s,
|
|
436
|
+
Se,
|
|
437
|
+
u,
|
|
438
|
+
N,
|
|
439
|
+
o,
|
|
440
|
+
he,
|
|
441
|
+
ve
|
|
442
|
+
]), C(() => {
|
|
443
|
+
if (!t || !n || !u || !l) return;
|
|
444
|
+
U.current && U.current.size !== u && (U.current = null);
|
|
445
|
+
let r = !1, i = !1, a = q.current;
|
|
446
|
+
q.current = !1;
|
|
447
|
+
let o = !1, d = !1, f = !1, x = () => {
|
|
448
|
+
a = !1, o = !0, d = !1, f = !1, !i && U.current?.size === u && (U.current = {
|
|
449
|
+
...U.current,
|
|
300
450
|
play: !0
|
|
301
451
|
});
|
|
302
|
-
},
|
|
303
|
-
if (
|
|
304
|
-
|
|
452
|
+
}, C = () => {
|
|
453
|
+
if (f) {
|
|
454
|
+
f = !1;
|
|
305
455
|
return;
|
|
306
456
|
}
|
|
307
|
-
|
|
457
|
+
o = !1, d = !1;
|
|
458
|
+
}, T = () => {
|
|
459
|
+
o && t.paused && (d = !0, f = !0);
|
|
308
460
|
}, E = () => {
|
|
309
|
-
d
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
time: R.current?.size === c ? R.current.time : 0,
|
|
313
|
-
size: c,
|
|
461
|
+
o = !1, d = !1, f = !1, i || (a = !0, U.current = {
|
|
462
|
+
time: U.current?.size === u ? U.current.time : 0,
|
|
463
|
+
size: u,
|
|
314
464
|
play: !1
|
|
315
465
|
});
|
|
316
466
|
};
|
|
317
|
-
|
|
467
|
+
K.current = E, t.addEventListener("play", x), t.addEventListener("pause", C), t.addEventListener("error", T), s.setSourceState({
|
|
318
468
|
playbackError: null,
|
|
319
469
|
ready: !1
|
|
320
470
|
});
|
|
321
|
-
let O = (
|
|
322
|
-
let r = Date.now(), i =
|
|
323
|
-
if (c && c.message === i && c.detail ===
|
|
471
|
+
let O = (e, n) => {
|
|
472
|
+
let r = Date.now(), i = je(e), a = Me(e), o = s.playbackErrors, c = o[o.length - 1];
|
|
473
|
+
if (c && c.message === i && c.detail === a && c.recovered === n) {
|
|
324
474
|
let e = {
|
|
325
475
|
...c,
|
|
326
476
|
count: c.count + 1,
|
|
327
477
|
lastAt: r
|
|
328
478
|
};
|
|
329
|
-
|
|
479
|
+
s.setSourceState({ playbackErrors: [...o.slice(0, -1), e] });
|
|
330
480
|
return;
|
|
331
481
|
}
|
|
332
482
|
let l = {
|
|
333
483
|
at: r,
|
|
334
484
|
lastAt: r,
|
|
335
485
|
count: 1,
|
|
336
|
-
atMediaTime: Number.isFinite(
|
|
486
|
+
atMediaTime: Number.isFinite(t.currentTime) ? t.currentTime : void 0,
|
|
337
487
|
message: i,
|
|
338
|
-
detail:
|
|
488
|
+
detail: a,
|
|
339
489
|
recovered: n
|
|
340
490
|
};
|
|
341
|
-
|
|
342
|
-
},
|
|
343
|
-
if (
|
|
344
|
-
let t =
|
|
491
|
+
s.setSourceState({ playbackErrors: [...o, l] });
|
|
492
|
+
}, k = (e) => {
|
|
493
|
+
if (r) return;
|
|
494
|
+
let t = c(e);
|
|
345
495
|
if (O(e, t), t) {
|
|
346
496
|
let t = performance.now();
|
|
347
|
-
t -
|
|
497
|
+
t - L.current.at > Q && (L.current = {
|
|
348
498
|
count: 0,
|
|
349
499
|
at: t
|
|
350
500
|
});
|
|
351
|
-
let n =
|
|
352
|
-
|
|
353
|
-
count:
|
|
501
|
+
let n = Oe[Math.min(L.current.count, Oe.length - 1)];
|
|
502
|
+
L.current = {
|
|
503
|
+
count: L.current.count + 1,
|
|
354
504
|
at: t
|
|
355
|
-
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e),
|
|
505
|
+
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), R.current && clearTimeout(R.current), R.current = setTimeout(() => ne((e) => e + 1), n);
|
|
356
506
|
return;
|
|
357
507
|
}
|
|
358
|
-
console.error("playback failed", e),
|
|
508
|
+
console.error("playback failed", e), s.setSourceState({ playbackError: e }), de.current?.(e);
|
|
359
509
|
};
|
|
360
510
|
return (async () => {
|
|
361
511
|
try {
|
|
362
|
-
let
|
|
363
|
-
videoElement:
|
|
364
|
-
subtitleContainer:
|
|
365
|
-
read: (e, t) =>
|
|
366
|
-
length:
|
|
367
|
-
publicPath:
|
|
368
|
-
libavWorkerUrl:
|
|
369
|
-
jassubWorkerUrl:
|
|
370
|
-
jassubWasmUrl:
|
|
371
|
-
jassubWasmWorkerUrl:
|
|
372
|
-
jassubLegacyWasmUrl:
|
|
373
|
-
jassubLegacyWasmWorkerUrl:
|
|
374
|
-
defaultFontUrl:
|
|
375
|
-
cjkFontUrl:
|
|
376
|
-
bufferSize:
|
|
377
|
-
audioStreamIndex:
|
|
378
|
-
chooseAudioStream: (e) => e[
|
|
512
|
+
let c = await e({
|
|
513
|
+
videoElement: t,
|
|
514
|
+
subtitleContainer: n,
|
|
515
|
+
read: (e, t) => re.current(e, t),
|
|
516
|
+
length: u,
|
|
517
|
+
publicPath: m,
|
|
518
|
+
libavWorkerUrl: h,
|
|
519
|
+
jassubWorkerUrl: g,
|
|
520
|
+
jassubWasmUrl: _,
|
|
521
|
+
jassubWasmWorkerUrl: v,
|
|
522
|
+
jassubLegacyWasmUrl: y,
|
|
523
|
+
jassubLegacyWasmWorkerUrl: b,
|
|
524
|
+
defaultFontUrl: S,
|
|
525
|
+
cjkFontUrl: w,
|
|
526
|
+
bufferSize: D,
|
|
527
|
+
audioStreamIndex: F,
|
|
528
|
+
chooseAudioStream: (e) => e[p(e, [], oe.current).audio]?.streamIndex,
|
|
379
529
|
onReady: () => {
|
|
380
|
-
if (
|
|
381
|
-
|
|
382
|
-
let
|
|
383
|
-
|
|
384
|
-
let
|
|
385
|
-
|
|
386
|
-
let
|
|
387
|
-
|
|
388
|
-
|
|
530
|
+
if (r) return;
|
|
531
|
+
i = !0, s.setSourceState({ ready: !0 });
|
|
532
|
+
let e = U.current;
|
|
533
|
+
U.current = null;
|
|
534
|
+
let n = !!e && e.size === u;
|
|
535
|
+
n && e.time > 0 ? t.currentTime = e.time : s.setSourceState({ seekingTo: void 0 });
|
|
536
|
+
let c = !a && (n ? e.play : ie.current);
|
|
537
|
+
o = c, c && t.play().catch(() => {
|
|
538
|
+
t.paused && !d && (o = !1);
|
|
389
539
|
});
|
|
390
540
|
},
|
|
391
|
-
onError:
|
|
541
|
+
onError: k,
|
|
392
542
|
onRecovered: () => {
|
|
393
|
-
|
|
543
|
+
r || s.setSourceState({ playbackError: null });
|
|
394
544
|
},
|
|
395
|
-
onSeek: (e) =>
|
|
396
|
-
onOutput: (e) =>
|
|
545
|
+
onSeek: (e) => ue.current?.(e),
|
|
546
|
+
onOutput: (e) => fe.current?.(e),
|
|
397
547
|
onSubtitleStreams: (e) => {
|
|
398
|
-
if (
|
|
399
|
-
|
|
400
|
-
let t =
|
|
401
|
-
|
|
402
|
-
subtitleTracks:
|
|
403
|
-
...
|
|
548
|
+
if (r) return;
|
|
549
|
+
J.current.subtitles = e;
|
|
550
|
+
let t = Y(), n = p(t ? [t] : [], e, oe.current).subtitles, i = W.current === u || B.current !== null;
|
|
551
|
+
s.setSourceState({
|
|
552
|
+
subtitleTracks: he(me.current),
|
|
553
|
+
...i ? {} : { selectedSubtitleTrack: n === null ? void 0 : e[Math.max(n, 0)]?.streamIndex }
|
|
404
554
|
});
|
|
405
555
|
},
|
|
406
556
|
onAudioStreams: (e, t) => {
|
|
407
|
-
|
|
408
|
-
audioTracks:
|
|
557
|
+
r || (J.current.audio = e, s.setSourceState({
|
|
558
|
+
audioTracks: De(e, me.current),
|
|
409
559
|
selectedAudioTrack: t
|
|
410
560
|
}));
|
|
411
561
|
}
|
|
412
562
|
});
|
|
413
|
-
if (
|
|
414
|
-
|
|
563
|
+
if (r) {
|
|
564
|
+
c.destroy();
|
|
415
565
|
return;
|
|
416
566
|
}
|
|
417
|
-
|
|
418
|
-
indexes:
|
|
419
|
-
chapters:
|
|
567
|
+
H.current = c, s.setSourceState({
|
|
568
|
+
indexes: c.indexes,
|
|
569
|
+
chapters: ee.current ?? c.chapters
|
|
420
570
|
});
|
|
421
|
-
let
|
|
422
|
-
|
|
571
|
+
let l = s.selectedSubtitleTrack;
|
|
572
|
+
B.current && typeof l == "string" && l === B.current.id ? c.setExternalSubtitleTrack(B.current.ass) : c.selectSubtitleStream(typeof l == "number" ? l : void 0), ve();
|
|
423
573
|
} catch (e) {
|
|
424
|
-
|
|
574
|
+
k(e);
|
|
425
575
|
}
|
|
426
576
|
})(), () => {
|
|
427
|
-
|
|
428
|
-
time:
|
|
429
|
-
size:
|
|
430
|
-
play: !
|
|
431
|
-
} :
|
|
432
|
-
...
|
|
433
|
-
time:
|
|
434
|
-
}),
|
|
577
|
+
r = !0, K.current === E && (K.current = null), t.removeEventListener("play", x), t.removeEventListener("pause", C), t.removeEventListener("error", T), i ? U.current = {
|
|
578
|
+
time: s.state.seekingTo ?? t.currentTime,
|
|
579
|
+
size: u,
|
|
580
|
+
play: !t.ended && (d ? o : !t.paused)
|
|
581
|
+
} : U.current?.size === u && s.state.seekingTo !== void 0 && (U.current = {
|
|
582
|
+
...U.current,
|
|
583
|
+
time: s.state.seekingTo
|
|
584
|
+
}), H.current?.destroy(), H.current = null, s.setSourceState({ ready: !1 });
|
|
435
585
|
};
|
|
436
586
|
}, [
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
e,
|
|
587
|
+
s,
|
|
588
|
+
Y,
|
|
440
589
|
t,
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
p,
|
|
590
|
+
n,
|
|
591
|
+
u,
|
|
444
592
|
m,
|
|
445
593
|
h,
|
|
446
594
|
g,
|
|
447
595
|
_,
|
|
448
596
|
v,
|
|
449
597
|
y,
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
598
|
+
b,
|
|
599
|
+
S,
|
|
600
|
+
w,
|
|
601
|
+
D,
|
|
602
|
+
F,
|
|
603
|
+
I
|
|
454
604
|
]);
|
|
455
|
-
},
|
|
605
|
+
}, Le = 1001 / 24e3, Re = (e, t) => new Promise((n) => {
|
|
456
606
|
let r = setTimeout(n, t);
|
|
457
607
|
e.requestVideoFrameCallback(() => {
|
|
458
608
|
clearTimeout(r), n();
|
|
459
609
|
});
|
|
460
|
-
}),
|
|
610
|
+
}), ze = (e) => {
|
|
461
611
|
let t = !1, n, r = async (i) => {
|
|
462
612
|
if (t) {
|
|
463
613
|
n = i;
|
|
@@ -473,14 +623,14 @@ var oe = {
|
|
|
473
623
|
}
|
|
474
624
|
};
|
|
475
625
|
return r;
|
|
476
|
-
},
|
|
477
|
-
let n = X(), r = X((e) => e.setSourceState), i =
|
|
626
|
+
}, Be = (e, t) => {
|
|
627
|
+
let n = X(), r = X((e) => e.setSourceState), i = T(t);
|
|
478
628
|
i.current = t;
|
|
479
629
|
let a = !!t;
|
|
480
|
-
|
|
630
|
+
C(() => {
|
|
481
631
|
let t = e;
|
|
482
632
|
if (!t) return;
|
|
483
|
-
if (typeof t.requestVideoFrameCallback != "function") return a ? (r({ stepFrame:
|
|
633
|
+
if (typeof t.requestVideoFrameCallback != "function") return a ? (r({ stepFrame: ze(async (e) => {
|
|
484
634
|
try {
|
|
485
635
|
await i.current?.(e);
|
|
486
636
|
} catch (e) {
|
|
@@ -499,11 +649,11 @@ var oe = {
|
|
|
499
649
|
};
|
|
500
650
|
f = t.requestVideoFrameCallback(p);
|
|
501
651
|
let m = () => {
|
|
502
|
-
if (c.length < 5) return
|
|
652
|
+
if (c.length < 5) return Le;
|
|
503
653
|
let e = [...c].sort((e, t) => e - t), t = e[Math.floor(e.length / 10)], n = e.filter((e) => Math.abs(e - t) <= t / 4);
|
|
504
654
|
return n.reduce((e, t) => e + t, 0) / n.length;
|
|
505
|
-
}, h = !0, g =
|
|
506
|
-
if (!h || t.readyState === HTMLMediaElement.HAVE_NOTHING || !t.paused && (t.pause(), await
|
|
655
|
+
}, h = !0, g = ze(async (e) => {
|
|
656
|
+
if (!h || t.readyState === HTMLMediaElement.HAVE_NOTHING || !t.paused && (t.pause(), await Re(t, 100), !h)) return;
|
|
507
657
|
let r = m(), i = n.state.seekingTo, a = i === void 0 ? o && !t.seeking ? 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) => {
|
|
508
658
|
let n = () => {
|
|
509
659
|
clearTimeout(r), t.removeEventListener("seeked", n), e();
|
|
@@ -521,24 +671,24 @@ var oe = {
|
|
|
521
671
|
n,
|
|
522
672
|
r
|
|
523
673
|
]);
|
|
524
|
-
},
|
|
525
|
-
let [a,
|
|
674
|
+
}, Ve = 5e3, He = 6e4, Ue = 1e6, We = (e, t) => !e || e.some(([e, n]) => e <= 0 && n >= Math.min(Ue, t)), Ge = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: i }) => {
|
|
675
|
+
let [a, o] = E([]), c = T(null), l = T(r);
|
|
526
676
|
l.current = r;
|
|
527
|
-
let u =
|
|
677
|
+
let u = w(() => i?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [i?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), d = T(u);
|
|
528
678
|
d.current = u;
|
|
529
|
-
let f =
|
|
530
|
-
return
|
|
679
|
+
let f = T(null);
|
|
680
|
+
return C(() => {
|
|
531
681
|
if (!n || !r || !e || !t) return;
|
|
532
|
-
let i = !1, a = null, u, p =
|
|
682
|
+
let i = !1, a = null, u, p = Ve, m = () => {
|
|
533
683
|
f.current = null;
|
|
534
|
-
let r = !
|
|
535
|
-
|
|
684
|
+
let r = !We(d.current, n);
|
|
685
|
+
s({
|
|
536
686
|
publicPath: e,
|
|
537
687
|
workerUrl: t,
|
|
538
688
|
length: n,
|
|
539
689
|
read: (e, t) => l.current(e, t),
|
|
540
690
|
onThumbnails: (e) => {
|
|
541
|
-
i ||
|
|
691
|
+
i || o(e);
|
|
542
692
|
}
|
|
543
693
|
}).then((e) => {
|
|
544
694
|
if (i) {
|
|
@@ -547,70 +697,70 @@ var oe = {
|
|
|
547
697
|
}
|
|
548
698
|
a = e, c.current = e, e.update(d.current);
|
|
549
699
|
}, () => {
|
|
550
|
-
if (i || (u = setTimeout(m, p), p = Math.min(p * 2,
|
|
700
|
+
if (i || (u = setTimeout(m, p), p = Math.min(p * 2, He), !r)) return;
|
|
551
701
|
let e = () => {
|
|
552
702
|
clearTimeout(u), m();
|
|
553
703
|
};
|
|
554
|
-
|
|
704
|
+
We(d.current, n) ? e() : f.current = e;
|
|
555
705
|
});
|
|
556
706
|
};
|
|
557
707
|
return m(), () => {
|
|
558
|
-
i = !0, f.current = null, clearTimeout(u), c.current = null, a?.destroy(),
|
|
708
|
+
i = !0, f.current = null, clearTimeout(u), c.current = null, a?.destroy(), o([]);
|
|
559
709
|
};
|
|
560
710
|
}, [
|
|
561
711
|
n,
|
|
562
712
|
e,
|
|
563
713
|
t
|
|
564
|
-
]),
|
|
565
|
-
c.current?.update(u), n &&
|
|
714
|
+
]), C(() => {
|
|
715
|
+
c.current?.update(u), n && We(u, n) && f.current?.();
|
|
566
716
|
}, [u]), {
|
|
567
717
|
thumbnails: a,
|
|
568
|
-
requestThumbnail:
|
|
718
|
+
requestThumbnail: x((e) => {
|
|
569
719
|
c.current?.prioritize(e);
|
|
570
720
|
}, [])
|
|
571
721
|
};
|
|
572
|
-
},
|
|
573
|
-
let n =
|
|
574
|
-
|
|
575
|
-
if (!e || !t || !
|
|
576
|
-
let r =
|
|
722
|
+
}, Ke = (e, t) => {
|
|
723
|
+
let n = T(null), [r, i] = E(!1), [a] = E(() => o());
|
|
724
|
+
C(() => {
|
|
725
|
+
if (!e || !t || !a) return;
|
|
726
|
+
let r = l({
|
|
577
727
|
video: e,
|
|
578
728
|
subtitles: t,
|
|
579
|
-
mode:
|
|
580
|
-
onBurnedInChange:
|
|
729
|
+
mode: a,
|
|
730
|
+
onBurnedInChange: i
|
|
581
731
|
});
|
|
582
732
|
return n.current = r, () => {
|
|
583
|
-
r.destroy(), n.current = null,
|
|
733
|
+
r.destroy(), n.current = null, i(!1);
|
|
584
734
|
};
|
|
585
735
|
}, [
|
|
586
736
|
e,
|
|
587
737
|
t,
|
|
588
|
-
|
|
738
|
+
a
|
|
589
739
|
]);
|
|
590
|
-
let s =
|
|
740
|
+
let s = x(() => {
|
|
591
741
|
n.current?.toggle().catch((e) => {
|
|
592
742
|
console.warn("picture in picture was refused", e);
|
|
593
743
|
});
|
|
594
744
|
}, []);
|
|
595
745
|
return {
|
|
596
|
-
toggle: e && t &&
|
|
597
|
-
mode:
|
|
598
|
-
burnedIn:
|
|
746
|
+
toggle: e && t && a ? s : null,
|
|
747
|
+
mode: a,
|
|
748
|
+
burnedIn: r
|
|
599
749
|
};
|
|
600
|
-
},
|
|
601
|
-
let t =
|
|
750
|
+
}, qe = "(hover: hover) and (pointer: fine)", Je = () => typeof matchMedia == "function" ? matchMedia(qe) : void 0, Ye = (e) => {
|
|
751
|
+
let t = Je();
|
|
602
752
|
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
603
|
-
},
|
|
604
|
-
let [n, r] =
|
|
753
|
+
}, Xe = () => !!Je()?.matches, Ze = () => !1, Qe = (e, t) => {
|
|
754
|
+
let [n, r] = E(!1), [i, a] = E(), o = T(t);
|
|
605
755
|
t && (o.current = t);
|
|
606
|
-
let s =
|
|
756
|
+
let s = T(!1), c = x((e) => {
|
|
607
757
|
s.current !== e && (s.current = e, o.current?.onArmedChange(e));
|
|
608
|
-
}, []), l =
|
|
758
|
+
}, []), l = x((t) => {
|
|
609
759
|
!e || e.readyState < 1 || e.error || (a(t), c(!0));
|
|
610
|
-
}, [e, c]), u =
|
|
760
|
+
}, [e, c]), u = x(() => {
|
|
611
761
|
a(void 0), c(!1);
|
|
612
762
|
}, [c]), d = !!t && !!e;
|
|
613
|
-
|
|
763
|
+
C(() => {
|
|
614
764
|
if (!d || !e) return;
|
|
615
765
|
let t = () => {
|
|
616
766
|
r(!0), u();
|
|
@@ -623,8 +773,8 @@ var oe = {
|
|
|
623
773
|
d,
|
|
624
774
|
u
|
|
625
775
|
]);
|
|
626
|
-
let f =
|
|
627
|
-
|
|
776
|
+
let f = D(Ye, Xe, Ze), [p, m] = E(!1);
|
|
777
|
+
C(() => {
|
|
628
778
|
if (!d) return;
|
|
629
779
|
let e = (e) => {
|
|
630
780
|
e.pointerType === "touch" && m(!0);
|
|
@@ -642,15 +792,15 @@ var oe = {
|
|
|
642
792
|
};
|
|
643
793
|
}, [d]);
|
|
644
794
|
let h = d && f && !p;
|
|
645
|
-
|
|
795
|
+
C(() => {
|
|
646
796
|
h || u();
|
|
647
797
|
}, [h, u]);
|
|
648
|
-
let g =
|
|
798
|
+
let g = x(() => {
|
|
649
799
|
Promise.resolve(e?.exitPictureInPicture?.()).catch((e) => {
|
|
650
800
|
console.warn("leaving picture in picture was refused", e);
|
|
651
801
|
});
|
|
652
802
|
}, [e]);
|
|
653
|
-
return
|
|
803
|
+
return w(() => h ? {
|
|
654
804
|
active: n,
|
|
655
805
|
armed: i,
|
|
656
806
|
arm: l,
|
|
@@ -664,16 +814,16 @@ var oe = {
|
|
|
664
814
|
u,
|
|
665
815
|
g
|
|
666
816
|
]);
|
|
667
|
-
},
|
|
817
|
+
}, $e = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
|
|
668
818
|
channelCountMode: "max",
|
|
669
819
|
processorOptions: n
|
|
670
|
-
})),
|
|
820
|
+
})), et = /* @__PURE__ */ new WeakMap(), tt = (e) => new Promise((t, n) => {
|
|
671
821
|
let r = () => {
|
|
672
822
|
(e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
|
|
673
823
|
};
|
|
674
824
|
e.addEventListener("statechange", r), r();
|
|
675
|
-
}),
|
|
676
|
-
let r =
|
|
825
|
+
}), nt = (e, t, n = {}) => {
|
|
826
|
+
let r = et.get(e);
|
|
677
827
|
if (r) return r.wake(), r;
|
|
678
828
|
let i = new AudioContext(), a = n.enabled !== !1, o, s = !1, c = !1, l = () => 20 * Math.log10(Math.max(e.volume, 1e-6)), u = e.ownerDocument, d = () => {
|
|
679
829
|
i.state === "suspended" && i.resume().catch(() => {});
|
|
@@ -690,13 +840,13 @@ var oe = {
|
|
|
690
840
|
};
|
|
691
841
|
i.addEventListener("statechange", p), p();
|
|
692
842
|
let m = (async () => {
|
|
693
|
-
let r = await
|
|
843
|
+
let r = await $e(i, t, {
|
|
694
844
|
...n,
|
|
695
845
|
enabled: a,
|
|
696
846
|
inputGainDb: l()
|
|
697
847
|
});
|
|
698
|
-
await
|
|
699
|
-
let s =
|
|
848
|
+
await tt(i);
|
|
849
|
+
let s = ne(i, e);
|
|
700
850
|
return r.port.postMessage({
|
|
701
851
|
enabled: a,
|
|
702
852
|
inputGainDb: l()
|
|
@@ -716,14 +866,14 @@ var oe = {
|
|
|
716
866
|
a = e, o?.port.postMessage({ enabled: a });
|
|
717
867
|
},
|
|
718
868
|
release: () => {
|
|
719
|
-
s = !0, f(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (
|
|
869
|
+
s = !0, f(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (et.delete(e), i.close().catch(() => {}));
|
|
720
870
|
},
|
|
721
871
|
wake: () => {
|
|
722
872
|
i.state !== "closed" && (s = !1, d(), p());
|
|
723
873
|
}
|
|
724
874
|
};
|
|
725
|
-
return
|
|
726
|
-
},
|
|
875
|
+
return et.set(e, h), h;
|
|
876
|
+
}, rt = 20, it = 5, at = 1, ot = 50, st = ({ node: e, element: t, scriptUrl: n, source: r }) => {
|
|
727
877
|
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
728
878
|
for (let e of [...c]) e();
|
|
729
879
|
c.clear();
|
|
@@ -736,7 +886,7 @@ var oe = {
|
|
|
736
886
|
s.clear();
|
|
737
887
|
}, p;
|
|
738
888
|
try {
|
|
739
|
-
p = new Worker(
|
|
889
|
+
p = new Worker(n, { type: "module" });
|
|
740
890
|
} catch (e) {
|
|
741
891
|
return console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), {
|
|
742
892
|
update: () => {},
|
|
@@ -747,7 +897,7 @@ var oe = {
|
|
|
747
897
|
p.postMessage({
|
|
748
898
|
type: "port",
|
|
749
899
|
port: m.port1
|
|
750
|
-
}, [m.port1]),
|
|
900
|
+
}, [m.port1]), e.port.postMessage({ analysis: m.port2 }, [m.port2]);
|
|
751
901
|
let h = {
|
|
752
902
|
spans: [],
|
|
753
903
|
start: null,
|
|
@@ -755,7 +905,7 @@ var oe = {
|
|
|
755
905
|
}, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
|
|
756
906
|
p.onmessage = ({ data: e }) => {
|
|
757
907
|
if (e.type === "unsupported") {
|
|
758
|
-
|
|
908
|
+
W();
|
|
759
909
|
return;
|
|
760
910
|
}
|
|
761
911
|
if (e.spans) {
|
|
@@ -768,15 +918,15 @@ var oe = {
|
|
|
768
918
|
}
|
|
769
919
|
e.type === "merged" && (y = e.run), _.get(`${e.type}:${e.run}`)?.(h), _.delete(`${e.type}:${e.run}`), l();
|
|
770
920
|
};
|
|
771
|
-
let b =
|
|
772
|
-
media:
|
|
921
|
+
let b = e.context, x = () => e.port.postMessage({
|
|
922
|
+
media: t.currentTime,
|
|
773
923
|
ctx: b.currentTime,
|
|
774
|
-
rate:
|
|
775
|
-
paused:
|
|
924
|
+
rate: t.playbackRate,
|
|
925
|
+
paused: t.paused || t.seeking || t.readyState < 3
|
|
776
926
|
}), S = () => p.postMessage({
|
|
777
927
|
type: "playhead",
|
|
778
|
-
time:
|
|
779
|
-
}), C = setInterval(x,
|
|
928
|
+
time: t.currentTime
|
|
929
|
+
}), C = setInterval(x, ot), w = [
|
|
780
930
|
"play",
|
|
781
931
|
"playing",
|
|
782
932
|
"pause",
|
|
@@ -786,27 +936,27 @@ var oe = {
|
|
|
786
936
|
"waiting",
|
|
787
937
|
"ended"
|
|
788
938
|
];
|
|
789
|
-
for (let e of w)
|
|
939
|
+
for (let e of w) t.addEventListener(e, x);
|
|
790
940
|
let T = Infinity, E = !1, D = 0, O = !1, k = 0, A = 0, j = /* @__PURE__ */ new Map(), M = (e) => {
|
|
791
941
|
let t = Math.max(e, h.start ?? 0);
|
|
792
942
|
for (let [e, n] of h.spans) e <= t && t < n && (t = n);
|
|
793
943
|
return t >= (h.end ?? T) - .05 ? null : t;
|
|
794
|
-
}, N = (e) => j.get(Math.round(e * 10)) === g ? "idle" : e,
|
|
795
|
-
if (
|
|
796
|
-
let e =
|
|
797
|
-
if (
|
|
944
|
+
}, N = (e) => j.get(Math.round(e * 10)) === g ? "idle" : e, ee = () => h.start !== null && h.end !== null && h.spans.length === 1 && h.spans[0][0] <= h.start && h.spans[0][1] >= h.end, P = () => {
|
|
945
|
+
if (ee()) return "done";
|
|
946
|
+
let e = t.currentTime, n = M(e), r = O && y !== D;
|
|
947
|
+
if (n !== null && n < e + rt) return r && k <= n + 1 && n <= A + it ? "read" : N(n);
|
|
798
948
|
if (r) return "read";
|
|
799
|
-
let i =
|
|
949
|
+
let i = n ?? M(0);
|
|
800
950
|
return i === null ? "done" : N(i);
|
|
801
|
-
},
|
|
802
|
-
|
|
803
|
-
})])),
|
|
804
|
-
S(), E && s.size && typeof
|
|
805
|
-
},
|
|
951
|
+
}, F = () => {}, I = (e) => (e.catch(() => {}), Promise.race([e, new Promise((e) => {
|
|
952
|
+
F = () => e(void 0);
|
|
953
|
+
})])), ne = () => {
|
|
954
|
+
S(), E && s.size && typeof P() == "number" && F(), l();
|
|
955
|
+
}, L = () => {
|
|
806
956
|
S(), l();
|
|
807
957
|
};
|
|
808
|
-
|
|
809
|
-
let
|
|
958
|
+
t.addEventListener("seeking", ne), t.addEventListener("seeked", L), t.addEventListener("timeupdate", L);
|
|
959
|
+
let R, z = async (e) => {
|
|
810
960
|
if (!O) return;
|
|
811
961
|
O = !1;
|
|
812
962
|
let t = v("ended", D);
|
|
@@ -815,7 +965,7 @@ var oe = {
|
|
|
815
965
|
run: D,
|
|
816
966
|
finished: e
|
|
817
967
|
}), await t;
|
|
818
|
-
},
|
|
968
|
+
}, B = async (e) => {
|
|
819
969
|
if (A = e.pts + e.duration, !e.data.byteLength) return;
|
|
820
970
|
let t = v("ack", D);
|
|
821
971
|
p.postMessage({
|
|
@@ -823,29 +973,29 @@ var oe = {
|
|
|
823
973
|
run: D,
|
|
824
974
|
data: e.data
|
|
825
975
|
}, [e.data]), await t;
|
|
826
|
-
},
|
|
827
|
-
if (
|
|
828
|
-
publicPath:
|
|
829
|
-
workerUrl:
|
|
976
|
+
}, V = async (e) => {
|
|
977
|
+
if (R = await te({
|
|
978
|
+
publicPath: e.publicPath,
|
|
979
|
+
workerUrl: e.libavWorkerUrl,
|
|
830
980
|
workerOptions: { type: "module" },
|
|
831
|
-
length:
|
|
832
|
-
read: (
|
|
833
|
-
audioStreamIndex:
|
|
834
|
-
}), a) return
|
|
835
|
-
let
|
|
981
|
+
length: e.length,
|
|
982
|
+
read: (t, n) => d(e, t, n),
|
|
983
|
+
audioStreamIndex: e.audioStreamIndex
|
|
984
|
+
}), a) return i(R);
|
|
985
|
+
let t = await R.init();
|
|
836
986
|
if (!a) {
|
|
837
|
-
for (T =
|
|
987
|
+
for (T = t.info.input.duration || Infinity, p.postMessage({
|
|
838
988
|
type: "init",
|
|
839
|
-
data:
|
|
840
|
-
codec:
|
|
841
|
-
}, [
|
|
989
|
+
data: t.data,
|
|
990
|
+
codec: t.info.output.audioMimeType
|
|
991
|
+
}, [t.data]), O = !0, E = !0, p.postMessage({
|
|
842
992
|
type: "run",
|
|
843
993
|
run: D,
|
|
844
|
-
pts:
|
|
994
|
+
pts: t.timestampOffset,
|
|
845
995
|
from: 0,
|
|
846
996
|
start: !0
|
|
847
997
|
}); !a;) {
|
|
848
|
-
let e =
|
|
998
|
+
let e = P();
|
|
849
999
|
if (e === "done") break;
|
|
850
1000
|
if (e === "idle") {
|
|
851
1001
|
await u();
|
|
@@ -853,33 +1003,33 @@ var oe = {
|
|
|
853
1003
|
}
|
|
854
1004
|
try {
|
|
855
1005
|
if (e === "read") {
|
|
856
|
-
let e = await R
|
|
1006
|
+
let e = await I(R.read());
|
|
857
1007
|
if (a) return;
|
|
858
1008
|
if (!e) continue;
|
|
859
|
-
await
|
|
1009
|
+
await B(e), e.finished && await z(!0);
|
|
860
1010
|
} else {
|
|
861
|
-
await
|
|
862
|
-
let
|
|
1011
|
+
await z(!1), j.set(Math.round(e * 10), g);
|
|
1012
|
+
let n = R.seek(Math.max(0, e - at));
|
|
863
1013
|
f(!0);
|
|
864
|
-
let r = await
|
|
1014
|
+
let r = await I(n);
|
|
865
1015
|
if (a) return;
|
|
866
1016
|
if (!r) continue;
|
|
867
1017
|
D++, O = !0, k = r.pts, p.postMessage({
|
|
868
1018
|
type: "run",
|
|
869
1019
|
run: D,
|
|
870
|
-
pts:
|
|
1020
|
+
pts: t.timestampOffset,
|
|
871
1021
|
from: r.pts,
|
|
872
1022
|
start: r.pts <= 0
|
|
873
|
-
}), await
|
|
1023
|
+
}), await B(r), r.finished && await z(!0);
|
|
874
1024
|
}
|
|
875
1025
|
} catch {
|
|
876
1026
|
if (a) return;
|
|
877
|
-
await
|
|
1027
|
+
await z(!1), typeof P() != "number" && await u();
|
|
878
1028
|
}
|
|
879
1029
|
}
|
|
880
|
-
a || await
|
|
1030
|
+
a || await z(!1), !a && (i(R), R = void 0);
|
|
881
1031
|
}
|
|
882
|
-
},
|
|
1032
|
+
}, H = () => {}, U = (e, t) => {
|
|
883
1033
|
let n = !1, r = (e) => {
|
|
884
1034
|
n && p.postMessage({
|
|
885
1035
|
type: "end",
|
|
@@ -887,7 +1037,7 @@ var oe = {
|
|
|
887
1037
|
finished: e
|
|
888
1038
|
}), n = !1;
|
|
889
1039
|
};
|
|
890
|
-
|
|
1040
|
+
H = e.attach(t, (e, t) => {
|
|
891
1041
|
if (e.type === "init") {
|
|
892
1042
|
r(!1);
|
|
893
1043
|
let t = e.data.slice(0);
|
|
@@ -914,29 +1064,29 @@ var oe = {
|
|
|
914
1064
|
}, [t]);
|
|
915
1065
|
}
|
|
916
1066
|
});
|
|
917
|
-
},
|
|
1067
|
+
}, W = () => {
|
|
918
1068
|
if (!a) {
|
|
919
1069
|
a = !0, f(!0), l(), clearInterval(C);
|
|
920
|
-
for (let e of w)
|
|
921
|
-
|
|
1070
|
+
for (let e of w) t.removeEventListener(e, x);
|
|
1071
|
+
t.removeEventListener("seeking", ne), t.removeEventListener("seeked", L), t.removeEventListener("timeupdate", L), H(), R && i(R), p.terminate(), e.port.postMessage({ analysis: null });
|
|
922
1072
|
for (let e of _.values()) e(h);
|
|
923
1073
|
_.clear();
|
|
924
1074
|
}
|
|
925
1075
|
};
|
|
926
|
-
return "tap" in
|
|
927
|
-
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e),
|
|
1076
|
+
return "tap" in r ? U(r.tap, r.audioStreamIndex) : V(r).catch((e) => {
|
|
1077
|
+
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), W());
|
|
928
1078
|
}), S(), {
|
|
929
1079
|
update: (e) => {
|
|
930
1080
|
o = e, f(!1);
|
|
931
1081
|
},
|
|
932
|
-
stop:
|
|
1082
|
+
stop: W
|
|
933
1083
|
};
|
|
934
|
-
},
|
|
935
|
-
let a =
|
|
936
|
-
|
|
1084
|
+
}, ct = (e, t, n, r, i) => {
|
|
1085
|
+
let a = T(null), [o, s] = E(!1), [c, l] = E(null);
|
|
1086
|
+
C(() => {
|
|
937
1087
|
if (e && t) {
|
|
938
1088
|
if (n && !a.current) {
|
|
939
|
-
let r =
|
|
1089
|
+
let r = nt(e, t, { enabled: n });
|
|
940
1090
|
a.current = r, r.routed.then((e) => {
|
|
941
1091
|
a.current === r && l(e);
|
|
942
1092
|
}, (e) => {
|
|
@@ -949,18 +1099,18 @@ var oe = {
|
|
|
949
1099
|
e,
|
|
950
1100
|
t,
|
|
951
1101
|
n
|
|
952
|
-
]),
|
|
1102
|
+
]), C(() => () => {
|
|
953
1103
|
a.current?.release(), a.current = null, l(null);
|
|
954
1104
|
}, [e]);
|
|
955
|
-
let u =
|
|
1105
|
+
let u = T(i);
|
|
956
1106
|
u.current = i;
|
|
957
|
-
let d =
|
|
1107
|
+
let d = T(null), f = T(r);
|
|
958
1108
|
f.current = r;
|
|
959
1109
|
let { length: p, publicPath: m, libavWorkerUrl: h } = r && "read" in r ? r : {}, g = r && "tap" in r ? r.tap : void 0, _ = r?.audioStreamIndex;
|
|
960
|
-
return
|
|
1110
|
+
return C(() => {
|
|
961
1111
|
let r = f.current;
|
|
962
1112
|
if (!c || !e || !t || !n || !r) return;
|
|
963
|
-
let i =
|
|
1113
|
+
let i = st({
|
|
964
1114
|
node: c,
|
|
965
1115
|
element: e,
|
|
966
1116
|
scriptUrl: t,
|
|
@@ -979,10 +1129,10 @@ var oe = {
|
|
|
979
1129
|
h,
|
|
980
1130
|
_,
|
|
981
1131
|
g
|
|
982
|
-
]),
|
|
1132
|
+
]), C(() => {
|
|
983
1133
|
d.current?.update(i);
|
|
984
1134
|
}, [i]), { refused: o };
|
|
985
|
-
},
|
|
1135
|
+
}, lt = () => {
|
|
986
1136
|
let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
|
|
987
1137
|
return {
|
|
988
1138
|
push: (n) => {
|
|
@@ -1028,7 +1178,7 @@ var oe = {
|
|
|
1028
1178
|
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 ",
|
|
1029
1179
|
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 "
|
|
1030
1180
|
}
|
|
1031
|
-
},
|
|
1181
|
+
}, ut = O`
|
|
1032
1182
|
display: flex;
|
|
1033
1183
|
justify-content: center;
|
|
1034
1184
|
align-items: center;
|
|
@@ -1041,7 +1191,7 @@ var oe = {
|
|
|
1041
1191
|
margin: auto;
|
|
1042
1192
|
pointer-events: none;
|
|
1043
1193
|
}
|
|
1044
|
-
`,
|
|
1194
|
+
`, dt = O`
|
|
1045
1195
|
position: absolute;
|
|
1046
1196
|
top: 0;
|
|
1047
1197
|
left: 0;
|
|
@@ -1070,9 +1220,9 @@ var oe = {
|
|
|
1070
1220
|
|
|
1071
1221
|
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%);
|
|
1072
1222
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
1073
|
-
`,
|
|
1223
|
+
`, ft = k`
|
|
1074
1224
|
to { transform: rotate(360deg); }
|
|
1075
|
-
`,
|
|
1225
|
+
`, pt = O`
|
|
1076
1226
|
position: absolute;
|
|
1077
1227
|
inset: 0;
|
|
1078
1228
|
z-index: 2;
|
|
@@ -1088,9 +1238,9 @@ var oe = {
|
|
|
1088
1238
|
border-radius: 50%;
|
|
1089
1239
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
1090
1240
|
border-top-color: #fff;
|
|
1091
|
-
animation: ${
|
|
1241
|
+
animation: ${ft} 0.8s linear infinite;
|
|
1092
1242
|
}
|
|
1093
|
-
`,
|
|
1243
|
+
`, mt = O`
|
|
1094
1244
|
position: absolute;
|
|
1095
1245
|
inset: auto 0 20%;
|
|
1096
1246
|
z-index: 3;
|
|
@@ -1100,36 +1250,36 @@ var oe = {
|
|
|
1100
1250
|
${$.bLarge.regular}
|
|
1101
1251
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
1102
1252
|
pointer-events: none;
|
|
1103
|
-
`,
|
|
1104
|
-
let t =
|
|
1105
|
-
return /* @__PURE__ */
|
|
1106
|
-
n ? /* @__PURE__ */
|
|
1253
|
+
`, ht = new Set(Object.values(a)), gt = (e) => e instanceof Error && ht.has(e.label ?? ""), _t = (e, { format: t }) => gt(e) ? t(e.label, e.values) : e instanceof Error ? e.message : typeof e == "string" ? e : t(a.failed), vt = ({ onSubtitleRef: e }) => {
|
|
1254
|
+
let t = Z(), n = X((e) => e.title), r = X((e) => e.hideUI), i = X((e) => e.playbackError), a = X((e) => e.ready), o = X((e) => e.size), s = X((e) => e.waiting), c = X((e) => e.seekingTo);
|
|
1255
|
+
return /* @__PURE__ */ I(P, { children: [
|
|
1256
|
+
n ? /* @__PURE__ */ F("div", {
|
|
1107
1257
|
className: "title",
|
|
1108
1258
|
dir: "auto",
|
|
1109
|
-
css:
|
|
1259
|
+
css: dt,
|
|
1110
1260
|
style: { ...r ? {
|
|
1111
1261
|
opacity: "0",
|
|
1112
1262
|
pointerEvents: "none"
|
|
1113
1263
|
} : {} },
|
|
1114
1264
|
children: n
|
|
1115
1265
|
}) : void 0,
|
|
1116
|
-
((o ? !a : s) || c !== void 0) && !i ? /* @__PURE__ */
|
|
1117
|
-
i ? /* @__PURE__ */
|
|
1118
|
-
css:
|
|
1266
|
+
((o ? !a : s) || c !== void 0) && !i ? /* @__PURE__ */ F("div", { css: pt }) : void 0,
|
|
1267
|
+
i ? /* @__PURE__ */ F("div", {
|
|
1268
|
+
css: mt,
|
|
1119
1269
|
dir: "auto",
|
|
1120
|
-
children:
|
|
1270
|
+
children: _t(i, t)
|
|
1121
1271
|
}) : void 0,
|
|
1122
|
-
/* @__PURE__ */
|
|
1272
|
+
/* @__PURE__ */ F("div", {
|
|
1123
1273
|
className: "subtitles",
|
|
1124
1274
|
ref: e,
|
|
1125
|
-
css:
|
|
1275
|
+
css: ut
|
|
1126
1276
|
})
|
|
1127
1277
|
] });
|
|
1128
|
-
},
|
|
1278
|
+
}, yt = 1e-4, bt = 1, xt = (e) => Math.max(yt, Math.min(bt, e)) ** 2, St = (e) => Math.max(yt, Math.min(bt, e)) ** (bt / 2), Ct = (e) => {
|
|
1129
1279
|
if (e === void 0) return "0:00";
|
|
1130
1280
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
1131
1281
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
1132
|
-
},
|
|
1282
|
+
}, wt = (e, t) => `${Ct(e)} / ${Ct(t)}`, Tt = (e) => O`
|
|
1133
1283
|
display: flex;
|
|
1134
1284
|
justify-content: flex-start;
|
|
1135
1285
|
|
|
@@ -1166,34 +1316,34 @@ var oe = {
|
|
|
1166
1316
|
unicode-bidi: plaintext;
|
|
1167
1317
|
}
|
|
1168
1318
|
|
|
1169
|
-
${e === "sm" &&
|
|
1319
|
+
${e === "sm" && O`
|
|
1170
1320
|
padding: calc(0.4 * var(--mp-unit))!important;
|
|
1171
1321
|
`}
|
|
1172
|
-
${e === "md" &&
|
|
1322
|
+
${e === "md" && O`
|
|
1173
1323
|
padding: calc(0.6 * var(--mp-unit))!important;
|
|
1174
1324
|
`}
|
|
1175
|
-
${e === "lg" &&
|
|
1325
|
+
${e === "lg" && O`
|
|
1176
1326
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
1177
1327
|
`}
|
|
1178
|
-
`,
|
|
1328
|
+
`, Et = {
|
|
1179
1329
|
x: -1,
|
|
1180
1330
|
y: -1,
|
|
1181
1331
|
anchors: 0
|
|
1182
|
-
},
|
|
1183
|
-
|
|
1184
|
-
},
|
|
1332
|
+
}, Dt = (e) => {
|
|
1333
|
+
Et.x = e.clientX, Et.y = e.clientY;
|
|
1334
|
+
}, Ot = () => (Et.anchors++ === 0 && window.addEventListener("pointermove", Dt, {
|
|
1185
1335
|
capture: !0,
|
|
1186
1336
|
passive: !0
|
|
1187
1337
|
}), () => {
|
|
1188
|
-
--
|
|
1189
|
-
}),
|
|
1190
|
-
let l =
|
|
1191
|
-
return
|
|
1192
|
-
let e =
|
|
1338
|
+
--Et.anchors === 0 && window.removeEventListener("pointermove", Dt, { capture: !0 });
|
|
1339
|
+
}), kt = y(!1), At = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
1340
|
+
let l = T(null), u = T(null), d = S(kt);
|
|
1341
|
+
return C(() => {
|
|
1342
|
+
let e = Ot(), t = () => {
|
|
1193
1343
|
let e = l.current;
|
|
1194
1344
|
if (!e) return;
|
|
1195
1345
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
1196
|
-
|
|
1346
|
+
Et.x >= t && Et.x < n && Et.y >= r && Et.y < i || u.current?.close();
|
|
1197
1347
|
}, n = ["fullscreenchange", "webkitfullscreenchange"];
|
|
1198
1348
|
for (let e of n) document.addEventListener(e, t);
|
|
1199
1349
|
return d && window.addEventListener("resize", t), () => {
|
|
@@ -1201,7 +1351,7 @@ var oe = {
|
|
|
1201
1351
|
for (let e of n) document.removeEventListener(e, t);
|
|
1202
1352
|
window.removeEventListener("resize", t);
|
|
1203
1353
|
};
|
|
1204
|
-
}, [d]), /* @__PURE__ */
|
|
1354
|
+
}, [d]), /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
|
|
1205
1355
|
ref: l,
|
|
1206
1356
|
"data-tooltip-id": e,
|
|
1207
1357
|
"data-open": !0,
|
|
@@ -1210,22 +1360,22 @@ var oe = {
|
|
|
1210
1360
|
"data-tooltip-delay-hide": i,
|
|
1211
1361
|
"data-tooltip-place": o,
|
|
1212
1362
|
children: n
|
|
1213
|
-
}), !s && /* @__PURE__ */
|
|
1363
|
+
}), !s && /* @__PURE__ */ F(ce, {
|
|
1214
1364
|
ref: u,
|
|
1215
|
-
css:
|
|
1365
|
+
css: Tt(c),
|
|
1216
1366
|
id: e,
|
|
1217
1367
|
noArrow: !0,
|
|
1218
1368
|
children: t
|
|
1219
1369
|
})] });
|
|
1220
|
-
},
|
|
1221
|
-
let [i, a] =
|
|
1370
|
+
}, jt = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
1371
|
+
let [i, a] = E(!1), o = T(t);
|
|
1222
1372
|
o.current = t;
|
|
1223
|
-
let s =
|
|
1373
|
+
let s = T(null), c = x((t, r) => {
|
|
1224
1374
|
let i = e.current;
|
|
1225
1375
|
if (!i) return 0;
|
|
1226
1376
|
let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
|
|
1227
1377
|
return Math.min(Math.max(l, 0), 1);
|
|
1228
|
-
}, [e, n]), l =
|
|
1378
|
+
}, [e, n]), l = x((e) => {
|
|
1229
1379
|
if (!(r || e.button > 0)) {
|
|
1230
1380
|
s.current = e.pointerId;
|
|
1231
1381
|
try {
|
|
@@ -1233,9 +1383,9 @@ var oe = {
|
|
|
1233
1383
|
} catch {}
|
|
1234
1384
|
a(!0), o.current(c(e.clientX, e.clientY));
|
|
1235
1385
|
}
|
|
1236
|
-
}, [r, c]), u =
|
|
1386
|
+
}, [r, c]), u = x((e) => {
|
|
1237
1387
|
s.current === e.pointerId && o.current(c(e.clientX, e.clientY));
|
|
1238
|
-
}, [c]), d =
|
|
1388
|
+
}, [c]), d = x((e) => {
|
|
1239
1389
|
if (s.current === e.pointerId) {
|
|
1240
1390
|
s.current = null;
|
|
1241
1391
|
try {
|
|
@@ -1244,7 +1394,7 @@ var oe = {
|
|
|
1244
1394
|
a(!1);
|
|
1245
1395
|
}
|
|
1246
1396
|
}, []);
|
|
1247
|
-
return
|
|
1397
|
+
return C(() => {
|
|
1248
1398
|
r && (s.current = null, a(!1));
|
|
1249
1399
|
}, [r]), {
|
|
1250
1400
|
dragging: i,
|
|
@@ -1256,7 +1406,7 @@ var oe = {
|
|
|
1256
1406
|
style: { touchAction: "none" }
|
|
1257
1407
|
}
|
|
1258
1408
|
};
|
|
1259
|
-
},
|
|
1409
|
+
}, Mt = O`
|
|
1260
1410
|
position: relative;
|
|
1261
1411
|
height: calc(.4 * var(--mp-unit));
|
|
1262
1412
|
|
|
@@ -1475,58 +1625,58 @@ var oe = {
|
|
|
1475
1625
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1476
1626
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1477
1627
|
}
|
|
1478
|
-
`,
|
|
1479
|
-
let e = X(), t = X((e) => e.currentTime), n = X((e) => e.requestSeek), r = X((e) => e.duration), i = X((e) => e.size), a = X((e) => e.downloadedRanges), o = X((e) => e.buffered), s = X((e) => e.indexes), c = X((e) => e.thumbnails), l = X((e) => e.thumbnailAt), u = X((e) => e.requestThumbnail), d = X((e) => e.chapters), f = X((e) => e.seekingTo),
|
|
1628
|
+
`, Nt = 4, Pt = () => {
|
|
1629
|
+
let e = X(), t = X((e) => e.currentTime), n = X((e) => e.requestSeek), r = X((e) => e.duration), i = X((e) => e.size), a = X((e) => e.downloadedRanges), o = X((e) => e.buffered), s = X((e) => e.indexes), c = X((e) => e.thumbnails), l = X((e) => e.thumbnailAt), u = X((e) => e.requestThumbnail), d = X((e) => e.chapters), f = X((e) => e.seekingTo), p = X((e) => e.setSourceState), g = X((e) => e.hideUI), _ = T(null), [v, y] = E(void 0), [b, x] = E(void 0), S = (e) => {
|
|
1480
1630
|
x(e), u(e);
|
|
1481
1631
|
}, D = !!b;
|
|
1482
|
-
|
|
1483
|
-
if (D) return
|
|
1484
|
-
}, [
|
|
1485
|
-
g &&
|
|
1632
|
+
C(() => {
|
|
1633
|
+
if (D) return p({ seekPreview: !0 }), () => p({ seekPreview: !1 });
|
|
1634
|
+
}, [p, D]), C(() => {
|
|
1635
|
+
g && S(void 0);
|
|
1486
1636
|
}, [g]);
|
|
1487
|
-
let O =
|
|
1637
|
+
let O = T(void 0), k = T(0), A = T(void 0), j = T(void 0), M = T(!1), { dragging: N, handlers: ee } = jt({
|
|
1488
1638
|
ref: _,
|
|
1489
1639
|
onChange: (e) => {
|
|
1490
1640
|
if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
|
|
1491
1641
|
else if (!M.current) {
|
|
1492
1642
|
let t = _.current?.getBoundingClientRect().width ?? 0;
|
|
1493
|
-
Math.abs(e - j.current) * t >
|
|
1643
|
+
Math.abs(e - j.current) * t > Nt && (M.current = !0);
|
|
1494
1644
|
}
|
|
1495
|
-
y(e), O.current !== "mouse" &&
|
|
1645
|
+
y(e), O.current !== "mouse" && S(e * r);
|
|
1496
1646
|
}
|
|
1497
|
-
}),
|
|
1498
|
-
O.current = e.pointerType, k.current = 0, j.current = void 0, M.current = !1,
|
|
1499
|
-
},
|
|
1500
|
-
|
|
1647
|
+
}), te = (e) => {
|
|
1648
|
+
O.current = e.pointerType, k.current = 0, j.current = void 0, M.current = !1, ee.onPointerDown(e);
|
|
1649
|
+
}, P = (t) => {
|
|
1650
|
+
ee.onPointerUp(t);
|
|
1501
1651
|
let i = k.current > 0 ? A.current : void 0;
|
|
1502
1652
|
if (i !== void 0 && r) {
|
|
1503
1653
|
let t = i * r;
|
|
1504
1654
|
n ? n(t) : e.seek(t);
|
|
1505
1655
|
}
|
|
1506
|
-
k.current = 0, M.current = !1, j.current = void 0, t.pointerType !== "mouse" &&
|
|
1507
|
-
},
|
|
1656
|
+
k.current = 0, M.current = !1, j.current = void 0, t.pointerType !== "mouse" && S(void 0);
|
|
1657
|
+
}, ne = (e) => {
|
|
1508
1658
|
if (!_.current) return;
|
|
1509
1659
|
let { left: t, right: n } = _.current.getBoundingClientRect();
|
|
1510
1660
|
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
1511
|
-
},
|
|
1512
|
-
|
|
1513
|
-
},
|
|
1514
|
-
|
|
1515
|
-
},
|
|
1516
|
-
_.current &&
|
|
1517
|
-
},
|
|
1661
|
+
}, L = T("mouse"), R = (e) => {
|
|
1662
|
+
L.current = e.pointerType;
|
|
1663
|
+
}, z = (e) => {
|
|
1664
|
+
L.current !== "touch" && S(ne(e.clientX));
|
|
1665
|
+
}, B = () => {
|
|
1666
|
+
_.current && S(void 0);
|
|
1667
|
+
}, V = (e) => r ? e / r * 100 : 0, H = (e, t, n) => {
|
|
1518
1668
|
let r = Number((n - t).toFixed(4)), i = t * 100;
|
|
1519
|
-
return /* @__PURE__ */
|
|
1669
|
+
return /* @__PURE__ */ F("div", {
|
|
1520
1670
|
className: "loaded-part",
|
|
1521
1671
|
style: {
|
|
1522
1672
|
transform: `scaleX(${r})`,
|
|
1523
1673
|
marginLeft: `${i}%`
|
|
1524
1674
|
}
|
|
1525
1675
|
}, e);
|
|
1526
|
-
},
|
|
1676
|
+
}, U = w(() => i === void 0 ? r ? o.map(([e, t], n) => H(n, e / r, t / r)) : [] : a?.map((e, t) => {
|
|
1527
1677
|
if (!i || !r) return null;
|
|
1528
1678
|
let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
|
|
1529
|
-
return !a || !o ? null :
|
|
1679
|
+
return !a || !o ? null : H(t, a.timestamp / r, o.timestamp / r);
|
|
1530
1680
|
}) ?? [], [
|
|
1531
1681
|
r,
|
|
1532
1682
|
i,
|
|
@@ -1534,7 +1684,7 @@ var oe = {
|
|
|
1534
1684
|
s.length,
|
|
1535
1685
|
a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
1536
1686
|
]);
|
|
1537
|
-
|
|
1687
|
+
C(() => {
|
|
1538
1688
|
v !== void 0 && r && N && M.current && (n ? n(v * r, !0) : e.seek(v * r));
|
|
1539
1689
|
}, [
|
|
1540
1690
|
e,
|
|
@@ -1543,7 +1693,7 @@ var oe = {
|
|
|
1543
1693
|
v,
|
|
1544
1694
|
r
|
|
1545
1695
|
]);
|
|
1546
|
-
let
|
|
1696
|
+
let W = w(() => {
|
|
1547
1697
|
if (!r) return 0;
|
|
1548
1698
|
if (N && v !== void 0) return v;
|
|
1549
1699
|
let e = f ?? t;
|
|
@@ -1554,22 +1704,22 @@ var oe = {
|
|
|
1554
1704
|
N,
|
|
1555
1705
|
v,
|
|
1556
1706
|
f
|
|
1557
|
-
]),
|
|
1558
|
-
if (!
|
|
1559
|
-
let e = b / r * 100, t =
|
|
1560
|
-
return t >= 0 ? t :
|
|
1707
|
+
]), G = w(() => m(d, r), [d, r]), K = G.length > 0, q = w(() => {
|
|
1708
|
+
if (!K || b === void 0 || !r) return -1;
|
|
1709
|
+
let e = b / r * 100, t = G.findIndex((t, n) => n < G.length - 1 && e >= t && e < G[n + 1]);
|
|
1710
|
+
return t >= 0 ? t : G.length - 2;
|
|
1561
1711
|
}, [
|
|
1562
|
-
ne,
|
|
1563
1712
|
K,
|
|
1713
|
+
G,
|
|
1564
1714
|
b,
|
|
1565
1715
|
r
|
|
1566
|
-
]),
|
|
1567
|
-
ne,
|
|
1716
|
+
]), J = w(() => K ? h(G, (e) => e !== q) : void 0, [
|
|
1568
1717
|
K,
|
|
1718
|
+
G,
|
|
1569
1719
|
q
|
|
1570
|
-
]),
|
|
1720
|
+
]), Y = w(() => q >= 0 ? h(G, (e) => e === q) : void 0, [G, q]), re = w(() => {
|
|
1571
1721
|
if (b !== void 0) return d.find(({ start: e, end: t }) => e <= b && b < t);
|
|
1572
|
-
}, [d, b]),
|
|
1722
|
+
}, [d, b]), ie = w(() => {
|
|
1573
1723
|
if (b) {
|
|
1574
1724
|
if (l) return l(b);
|
|
1575
1725
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= b && b < t);
|
|
@@ -1578,71 +1728,71 @@ var oe = {
|
|
|
1578
1728
|
c,
|
|
1579
1729
|
l,
|
|
1580
1730
|
b
|
|
1581
|
-
]),
|
|
1731
|
+
]), ae = (e, t) => /* @__PURE__ */ I("div", {
|
|
1582
1732
|
className: e ? `track ${e}` : "track",
|
|
1583
1733
|
style: t ? { maskImage: t } : void 0,
|
|
1584
1734
|
children: [
|
|
1585
|
-
/* @__PURE__ */
|
|
1586
|
-
/* @__PURE__ */
|
|
1735
|
+
/* @__PURE__ */ F("div", { className: "background-bar" }),
|
|
1736
|
+
/* @__PURE__ */ F("div", {
|
|
1587
1737
|
className: "loaded",
|
|
1588
|
-
children:
|
|
1738
|
+
children: U
|
|
1589
1739
|
}),
|
|
1590
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ F("div", {
|
|
1591
1741
|
className: "play-container",
|
|
1592
|
-
children: /* @__PURE__ */
|
|
1742
|
+
children: /* @__PURE__ */ F("div", {
|
|
1593
1743
|
className: "play",
|
|
1594
|
-
style: { transform: `scaleX(${
|
|
1744
|
+
style: { transform: `scaleX(${W})` }
|
|
1595
1745
|
})
|
|
1596
1746
|
})
|
|
1597
1747
|
]
|
|
1598
1748
|
});
|
|
1599
|
-
return /* @__PURE__ */
|
|
1600
|
-
css:
|
|
1749
|
+
return /* @__PURE__ */ I("div", {
|
|
1750
|
+
css: Mt,
|
|
1601
1751
|
ref: _,
|
|
1602
1752
|
className: [
|
|
1603
1753
|
"progress-bar",
|
|
1604
1754
|
N ? "dragging" : "",
|
|
1605
|
-
|
|
1755
|
+
K ? "segmented" : ""
|
|
1606
1756
|
].filter(Boolean).join(" "),
|
|
1607
|
-
onPointerDown:
|
|
1608
|
-
onPointerMove:
|
|
1609
|
-
onMouseMove:
|
|
1610
|
-
onMouseOut:
|
|
1757
|
+
onPointerDown: R,
|
|
1758
|
+
onPointerMove: R,
|
|
1759
|
+
onMouseMove: z,
|
|
1760
|
+
onMouseOut: B,
|
|
1611
1761
|
children: [
|
|
1612
|
-
|
|
1613
|
-
b ? /* @__PURE__ */
|
|
1762
|
+
ae(void 0, J),
|
|
1763
|
+
b ? /* @__PURE__ */ I("div", {
|
|
1614
1764
|
className: "cursor-time",
|
|
1615
1765
|
style: {
|
|
1616
|
-
left:
|
|
1617
|
-
maxWidth:
|
|
1766
|
+
left: re ? `clamp(var(--thumbnail-half), ${V(b)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${V(b)}%, calc(100% - calc(3 * var(--mp-unit))))`,
|
|
1767
|
+
maxWidth: re ? "var(--thumbnail-width)" : void 0
|
|
1618
1768
|
},
|
|
1619
|
-
children: [/* @__PURE__ */
|
|
1769
|
+
children: [/* @__PURE__ */ F("span", {
|
|
1620
1770
|
className: "cursor-time-value",
|
|
1621
|
-
children:
|
|
1622
|
-
}),
|
|
1771
|
+
children: Ct(b)
|
|
1772
|
+
}), re ? /* @__PURE__ */ F("span", {
|
|
1623
1773
|
className: "chapter-title",
|
|
1624
|
-
children:
|
|
1774
|
+
children: re.title
|
|
1625
1775
|
}) : void 0]
|
|
1626
1776
|
}) : void 0,
|
|
1627
|
-
/* @__PURE__ */
|
|
1628
|
-
/* @__PURE__ */
|
|
1629
|
-
|
|
1630
|
-
/* @__PURE__ */
|
|
1631
|
-
/* @__PURE__ */
|
|
1777
|
+
/* @__PURE__ */ F("div", { className: "progress" }),
|
|
1778
|
+
/* @__PURE__ */ F("div", { className: "hover" }),
|
|
1779
|
+
Y ? ae("focus", Y) : void 0,
|
|
1780
|
+
/* @__PURE__ */ F("div", { className: "scrubber" }),
|
|
1781
|
+
/* @__PURE__ */ F("div", {
|
|
1632
1782
|
className: "padding",
|
|
1633
|
-
...
|
|
1634
|
-
onPointerDown:
|
|
1635
|
-
onPointerUp:
|
|
1636
|
-
onPointerCancel:
|
|
1783
|
+
...ee,
|
|
1784
|
+
onPointerDown: te,
|
|
1785
|
+
onPointerUp: P,
|
|
1786
|
+
onPointerCancel: P
|
|
1637
1787
|
}),
|
|
1638
|
-
/* @__PURE__ */
|
|
1788
|
+
/* @__PURE__ */ F("div", {
|
|
1639
1789
|
className: "thumbnail",
|
|
1640
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
1641
|
-
children:
|
|
1790
|
+
style: { left: `clamp(var(--thumbnail-half), ${V(b ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1791
|
+
children: ie?.url ? /* @__PURE__ */ F("img", { src: ie.url }) : void 0
|
|
1642
1792
|
})
|
|
1643
1793
|
]
|
|
1644
1794
|
});
|
|
1645
|
-
},
|
|
1795
|
+
}, Ft = "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", It = {
|
|
1646
1796
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1647
1797
|
width: 24,
|
|
1648
1798
|
height: 24,
|
|
@@ -1652,12 +1802,12 @@ var oe = {
|
|
|
1652
1802
|
strokeWidth: 2,
|
|
1653
1803
|
strokeLinecap: "round",
|
|
1654
1804
|
strokeLinejoin: "round"
|
|
1655
|
-
},
|
|
1656
|
-
...
|
|
1805
|
+
}, Lt = (e) => /* @__PURE__ */ I("svg", {
|
|
1806
|
+
...It,
|
|
1657
1807
|
...e,
|
|
1658
1808
|
children: [
|
|
1659
|
-
/* @__PURE__ */
|
|
1660
|
-
/* @__PURE__ */
|
|
1809
|
+
/* @__PURE__ */ F("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
1810
|
+
/* @__PURE__ */ F("rect", {
|
|
1661
1811
|
x: "12",
|
|
1662
1812
|
y: "13",
|
|
1663
1813
|
width: "10",
|
|
@@ -1665,14 +1815,14 @@ var oe = {
|
|
|
1665
1815
|
rx: "1",
|
|
1666
1816
|
ry: "1"
|
|
1667
1817
|
}),
|
|
1668
|
-
/* @__PURE__ */
|
|
1818
|
+
/* @__PURE__ */ F("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1669
1819
|
]
|
|
1670
|
-
}),
|
|
1671
|
-
...
|
|
1820
|
+
}), Rt = (e) => /* @__PURE__ */ I("svg", {
|
|
1821
|
+
...It,
|
|
1672
1822
|
...e,
|
|
1673
1823
|
children: [
|
|
1674
|
-
/* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1824
|
+
/* @__PURE__ */ F("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
1825
|
+
/* @__PURE__ */ F("rect", {
|
|
1676
1826
|
x: "12",
|
|
1677
1827
|
y: "13",
|
|
1678
1828
|
width: "10",
|
|
@@ -1680,9 +1830,9 @@ var oe = {
|
|
|
1680
1830
|
rx: "1",
|
|
1681
1831
|
ry: "1"
|
|
1682
1832
|
}),
|
|
1683
|
-
/* @__PURE__ */
|
|
1833
|
+
/* @__PURE__ */ F("path", { d: "M6 9h3m2 0h2" })
|
|
1684
1834
|
]
|
|
1685
|
-
}),
|
|
1835
|
+
}), zt = O`
|
|
1686
1836
|
.popover {
|
|
1687
1837
|
position: absolute;
|
|
1688
1838
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1810,26 +1960,26 @@ var oe = {
|
|
|
1810
1960
|
${$.bSmall.regular}
|
|
1811
1961
|
}
|
|
1812
1962
|
}
|
|
1813
|
-
`,
|
|
1814
|
-
let { format: l } =
|
|
1963
|
+
`, Bt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: o, pending: s, failed: c }) => {
|
|
1964
|
+
let { format: l } = Z(), u = s !== void 0, d = (e, i, a) => {
|
|
1815
1965
|
let o = u && s === e, c = u || t.find((t) => t.id === e)?.disabled;
|
|
1816
|
-
return /* @__PURE__ */
|
|
1966
|
+
return /* @__PURE__ */ I("div", {
|
|
1817
1967
|
onClick: () => {
|
|
1818
1968
|
c || r(e ?? void 0);
|
|
1819
1969
|
},
|
|
1820
1970
|
className: [a, c ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
|
|
1821
|
-
children: [/* @__PURE__ */
|
|
1971
|
+
children: [/* @__PURE__ */ F("span", { children: i }), /* @__PURE__ */ F("span", { children: o ? "…" : (n ?? null) === e ? "✓" : "" })]
|
|
1822
1972
|
}, e ?? "__off__");
|
|
1823
1973
|
};
|
|
1824
|
-
return /* @__PURE__ */
|
|
1974
|
+
return /* @__PURE__ */ I("div", {
|
|
1825
1975
|
className: "popover track-list",
|
|
1826
1976
|
children: [
|
|
1827
|
-
/* @__PURE__ */
|
|
1977
|
+
/* @__PURE__ */ I("div", {
|
|
1828
1978
|
className: i ? "back" : "back no-hover",
|
|
1829
1979
|
onClick: i,
|
|
1830
|
-
children: [i ? /* @__PURE__ */
|
|
1980
|
+
children: [i ? /* @__PURE__ */ F(B, {}) : null, /* @__PURE__ */ F("span", { children: e })]
|
|
1831
1981
|
}),
|
|
1832
|
-
c ? /* @__PURE__ */
|
|
1982
|
+
c ? /* @__PURE__ */ F("div", {
|
|
1833
1983
|
className: "no-hover failed",
|
|
1834
1984
|
dir: "auto",
|
|
1835
1985
|
children: l(a.switchFailed)
|
|
@@ -1838,13 +1988,13 @@ var oe = {
|
|
|
1838
1988
|
t.map(({ id: e, label: t }) => d(e, t, "description"))
|
|
1839
1989
|
]
|
|
1840
1990
|
});
|
|
1841
|
-
},
|
|
1842
|
-
let t =
|
|
1991
|
+
}, Vt = ({ onReset: e } = {}) => {
|
|
1992
|
+
let t = T(null), [n, r] = E(!1), [i, a] = E(void 0), [o, s] = E(!1), c = T(e);
|
|
1843
1993
|
c.current = e;
|
|
1844
1994
|
let l = () => {
|
|
1845
1995
|
r(!1), c.current?.();
|
|
1846
1996
|
};
|
|
1847
|
-
return
|
|
1997
|
+
return C(() => {
|
|
1848
1998
|
let e = (e) => {
|
|
1849
1999
|
n && t.current && !t.current.contains(e.target) && l();
|
|
1850
2000
|
};
|
|
@@ -1879,7 +2029,7 @@ var oe = {
|
|
|
1879
2029
|
});
|
|
1880
2030
|
}
|
|
1881
2031
|
};
|
|
1882
|
-
},
|
|
2032
|
+
}, Ht = O`
|
|
1883
2033
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1884
2034
|
which is the width of the player box, so it can be clamped to it. */
|
|
1885
2035
|
position: static;
|
|
@@ -1895,7 +2045,7 @@ position: static;
|
|
|
1895
2045
|
}
|
|
1896
2046
|
}
|
|
1897
2047
|
|
|
1898
|
-
${
|
|
2048
|
+
${zt}
|
|
1899
2049
|
|
|
1900
2050
|
.popover.error-list {
|
|
1901
2051
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1967,70 +2117,70 @@ ${Nt}
|
|
|
1967
2117
|
}
|
|
1968
2118
|
}
|
|
1969
2119
|
}
|
|
1970
|
-
`,
|
|
1971
|
-
let n =
|
|
2120
|
+
`, Ut = (e, t) => new Date(e).toLocaleTimeString(t ?? "en"), Wt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Ct(Math.max(0, e)), Gt = (e) => e.reduce((e, t) => e + t.count, 0), Kt = (e) => e.map((e, t) => {
|
|
2121
|
+
let n = Wt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1972
2122
|
return [
|
|
1973
2123
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1974
2124
|
e.message,
|
|
1975
2125
|
e.detail
|
|
1976
2126
|
].filter(Boolean).join("\n");
|
|
1977
|
-
}).join("\n\n"),
|
|
1978
|
-
let e = X((e) => e.playbackErrors), { format: t, locale: n } =
|
|
2127
|
+
}).join("\n\n"), qt = () => {
|
|
2128
|
+
let e = X((e) => e.playbackErrors), { format: t, locale: n } = Z(), { open: r, toggle: i, containerRef: o } = Vt(), [s, c] = E(!1);
|
|
1979
2129
|
if (e.length === 0) return null;
|
|
1980
2130
|
let l = () => {
|
|
1981
|
-
navigator.clipboard?.writeText(
|
|
2131
|
+
navigator.clipboard?.writeText(Kt(e)).then(() => {
|
|
1982
2132
|
c(!0), setTimeout(() => c(!1), 2e3);
|
|
1983
2133
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1984
|
-
}, u = t(a.errors, { count:
|
|
1985
|
-
return /* @__PURE__ */
|
|
1986
|
-
css:
|
|
2134
|
+
}, u = t(a.errors, { count: Gt(e) });
|
|
2135
|
+
return /* @__PURE__ */ I("div", {
|
|
2136
|
+
css: Ht,
|
|
1987
2137
|
ref: o,
|
|
1988
|
-
children: [/* @__PURE__ */
|
|
2138
|
+
children: [/* @__PURE__ */ F(At, {
|
|
1989
2139
|
id: "errors",
|
|
1990
2140
|
disabled: r,
|
|
1991
|
-
text: /* @__PURE__ */
|
|
2141
|
+
text: /* @__PURE__ */ F("button", {
|
|
1992
2142
|
className: "errors",
|
|
1993
2143
|
type: "button",
|
|
1994
2144
|
onClick: i,
|
|
1995
2145
|
"aria-label": u,
|
|
1996
2146
|
"aria-expanded": r,
|
|
1997
|
-
children: /* @__PURE__ */
|
|
2147
|
+
children: /* @__PURE__ */ F(ie, { className: "alert-triangle" })
|
|
1998
2148
|
}),
|
|
1999
|
-
toolTipText: /* @__PURE__ */
|
|
2000
|
-
}), r && /* @__PURE__ */
|
|
2149
|
+
toolTipText: /* @__PURE__ */ F("span", { children: u })
|
|
2150
|
+
}), r && /* @__PURE__ */ I("div", {
|
|
2001
2151
|
className: "popover error-list",
|
|
2002
|
-
children: [/* @__PURE__ */
|
|
2152
|
+
children: [/* @__PURE__ */ I("div", {
|
|
2003
2153
|
className: "back no-hover",
|
|
2004
|
-
children: [/* @__PURE__ */
|
|
2154
|
+
children: [/* @__PURE__ */ F("span", { children: u }), /* @__PURE__ */ I("button", {
|
|
2005
2155
|
className: "copy",
|
|
2006
2156
|
type: "button",
|
|
2007
2157
|
onClick: l,
|
|
2008
2158
|
"aria-label": t(a.copyErrors),
|
|
2009
|
-
children: [
|
|
2159
|
+
children: [F(s ? z : H, {}), /* @__PURE__ */ F("span", { children: t(s ? a.copied : a.copy) })]
|
|
2010
2160
|
})]
|
|
2011
|
-
}), e.map((e, r) => /* @__PURE__ */
|
|
2161
|
+
}), e.map((e, r) => /* @__PURE__ */ I("div", {
|
|
2012
2162
|
className: "entry no-hover",
|
|
2013
2163
|
children: [
|
|
2014
|
-
/* @__PURE__ */
|
|
2164
|
+
/* @__PURE__ */ I("span", {
|
|
2015
2165
|
className: "when",
|
|
2016
2166
|
children: [
|
|
2017
2167
|
e.count > 1 ? t(a.errorSpan, {
|
|
2018
|
-
start:
|
|
2019
|
-
end:
|
|
2020
|
-
}) :
|
|
2021
|
-
|
|
2168
|
+
start: Ut(e.at, n),
|
|
2169
|
+
end: Ut(e.lastAt, n)
|
|
2170
|
+
}) : Ut(e.at, n),
|
|
2171
|
+
Wt(e.atMediaTime) ? ` ${t(a.errorAt, { time: Wt(e.atMediaTime) })}` : "",
|
|
2022
2172
|
e.recovered ? ` ${t(a.recovered)}` : "",
|
|
2023
|
-
e.count > 1 ? /* @__PURE__ */
|
|
2173
|
+
e.count > 1 ? /* @__PURE__ */ F("span", {
|
|
2024
2174
|
className: "count",
|
|
2025
2175
|
children: `×${e.count}`
|
|
2026
2176
|
}) : null
|
|
2027
2177
|
]
|
|
2028
2178
|
}),
|
|
2029
|
-
/* @__PURE__ */
|
|
2179
|
+
/* @__PURE__ */ F("span", {
|
|
2030
2180
|
className: "what",
|
|
2031
2181
|
children: e.message
|
|
2032
2182
|
}),
|
|
2033
|
-
e.detail ? /* @__PURE__ */
|
|
2183
|
+
e.detail ? /* @__PURE__ */ F("span", {
|
|
2034
2184
|
className: "cause",
|
|
2035
2185
|
children: e.detail
|
|
2036
2186
|
}) : null
|
|
@@ -2038,7 +2188,7 @@ ${Nt}
|
|
|
2038
2188
|
}, `${e.at}-${r}`))]
|
|
2039
2189
|
})]
|
|
2040
2190
|
});
|
|
2041
|
-
},
|
|
2191
|
+
}, Jt = O`
|
|
2042
2192
|
display: flex;
|
|
2043
2193
|
align-items: center;
|
|
2044
2194
|
justify-content: center;
|
|
@@ -2091,8 +2241,8 @@ width: 100%;
|
|
|
2091
2241
|
}
|
|
2092
2242
|
}
|
|
2093
2243
|
}
|
|
2094
|
-
`,
|
|
2095
|
-
let e = X(), { format: t, number: n } =
|
|
2244
|
+
`, Yt = () => {
|
|
2245
|
+
let e = X(), { format: t, number: n } = Z(), r = X((e) => e.playbackRate), i = T(null), o = T(null), s = .25, c = 2.75, l = (e, t = .05) => Math.round(e / t) * t, u = l(r || 1), d = (e) => (e - s) / c * 100, f = (e) => l(s + e * c), { handlers: p } = jt({
|
|
2096
2246
|
ref: o,
|
|
2097
2247
|
onChange: (t) => e.setPlaybackRate(f(t))
|
|
2098
2248
|
}), m = (t) => {
|
|
@@ -2100,36 +2250,36 @@ width: 100%;
|
|
|
2100
2250
|
let n = .05, r = u;
|
|
2101
2251
|
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(s, r - n), e.setPlaybackRate(r);
|
|
2102
2252
|
};
|
|
2103
|
-
|
|
2253
|
+
C(() => {
|
|
2104
2254
|
let e = i.current;
|
|
2105
2255
|
return e && e.addEventListener("wheel", m, { passive: !1 }), () => {
|
|
2106
2256
|
e && e.removeEventListener("wheel", m);
|
|
2107
2257
|
};
|
|
2108
2258
|
}, [r]);
|
|
2109
2259
|
let h = d(u);
|
|
2110
|
-
return /* @__PURE__ */
|
|
2111
|
-
css:
|
|
2112
|
-
children: [/* @__PURE__ */
|
|
2260
|
+
return /* @__PURE__ */ I("div", {
|
|
2261
|
+
css: Jt,
|
|
2262
|
+
children: [/* @__PURE__ */ F("div", { children: t(a.speed, { rate: n(u, {
|
|
2113
2263
|
minimumFractionDigits: 2,
|
|
2114
2264
|
maximumFractionDigits: 2
|
|
2115
|
-
}) }) }), /* @__PURE__ */
|
|
2265
|
+
}) }) }), /* @__PURE__ */ F("div", {
|
|
2116
2266
|
className: "playback-slider",
|
|
2117
2267
|
ref: i,
|
|
2118
2268
|
...p,
|
|
2119
|
-
children: /* @__PURE__ */
|
|
2269
|
+
children: /* @__PURE__ */ F("div", {
|
|
2120
2270
|
ref: o,
|
|
2121
2271
|
style: { background: `linear-gradient(to right,
|
|
2122
2272
|
#fff 0% ${h}%,
|
|
2123
2273
|
#3A3A3A ${h}% 100%
|
|
2124
2274
|
)` },
|
|
2125
|
-
children: /* @__PURE__ */
|
|
2275
|
+
children: /* @__PURE__ */ F("div", {
|
|
2126
2276
|
className: "playback-handle",
|
|
2127
2277
|
style: { left: `${h}%` }
|
|
2128
2278
|
})
|
|
2129
2279
|
})
|
|
2130
2280
|
})]
|
|
2131
2281
|
});
|
|
2132
|
-
},
|
|
2282
|
+
}, Xt = O`
|
|
2133
2283
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
2134
2284
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
2135
2285
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -2147,7 +2297,7 @@ position: static;
|
|
|
2147
2297
|
}
|
|
2148
2298
|
}
|
|
2149
2299
|
|
|
2150
|
-
${
|
|
2300
|
+
${zt}
|
|
2151
2301
|
|
|
2152
2302
|
.switch {
|
|
2153
2303
|
position: relative;
|
|
@@ -2224,13 +2374,13 @@ ${Nt}
|
|
|
2224
2374
|
}
|
|
2225
2375
|
}
|
|
2226
2376
|
|
|
2227
|
-
`,
|
|
2377
|
+
`, Zt = [
|
|
2228
2378
|
.5,
|
|
2229
2379
|
1,
|
|
2230
2380
|
1.5,
|
|
2231
2381
|
2
|
|
2232
|
-
],
|
|
2233
|
-
let e = X(), { format: t, number: n } =
|
|
2382
|
+
], Qt = () => {
|
|
2383
|
+
let e = X(), { format: t, number: n } = Z(), r = X((e) => e.playbackRate), i = X((e) => e.audioTracks), o = X((e) => e.selectedAudioTrack), s = X((e) => e.selectAudioTrack), c = X((e) => e.quality), l = X((e) => e.volumeNormalizer), u = X((e) => e.autoplayNext), [d, f] = E(0), { open: p, toggle: m, containerRef: h, pending: g, failed: _, runSelect: v } = Vt({ onReset: () => f(0) }), y = (t) => {
|
|
2234
2384
|
e.setPlaybackRate(t), f(0);
|
|
2235
2385
|
}, b = (e) => {
|
|
2236
2386
|
e !== void 0 && v(e, () => s(e));
|
|
@@ -2239,54 +2389,54 @@ ${Nt}
|
|
|
2239
2389
|
}, S = c ? c.options.length + +!!c.offLabel : 0, C = c?.selectedId == null ? c?.offLabel : c.options.find(({ id: e }) => e === c.selectedId)?.label, w = (e) => () => {
|
|
2240
2390
|
f(e);
|
|
2241
2391
|
};
|
|
2242
|
-
return /* @__PURE__ */
|
|
2243
|
-
css:
|
|
2392
|
+
return /* @__PURE__ */ I("div", {
|
|
2393
|
+
css: Xt,
|
|
2244
2394
|
ref: h,
|
|
2245
2395
|
children: [
|
|
2246
|
-
/* @__PURE__ */
|
|
2396
|
+
/* @__PURE__ */ F(At, {
|
|
2247
2397
|
id: "settings",
|
|
2248
2398
|
disabled: p,
|
|
2249
|
-
text: /* @__PURE__ */
|
|
2399
|
+
text: /* @__PURE__ */ F("button", {
|
|
2250
2400
|
className: "settings",
|
|
2251
2401
|
type: "button",
|
|
2252
2402
|
onClick: m,
|
|
2253
2403
|
"aria-label": t(a.settings),
|
|
2254
2404
|
"aria-expanded": p,
|
|
2255
|
-
children: /* @__PURE__ */
|
|
2405
|
+
children: /* @__PURE__ */ F(J, {})
|
|
2256
2406
|
}),
|
|
2257
|
-
toolTipText: /* @__PURE__ */
|
|
2407
|
+
toolTipText: /* @__PURE__ */ F("span", { children: t(a.settings) })
|
|
2258
2408
|
}),
|
|
2259
|
-
p && d === 0 && /* @__PURE__ */
|
|
2409
|
+
p && d === 0 && /* @__PURE__ */ I("div", {
|
|
2260
2410
|
className: "popover menu",
|
|
2261
2411
|
children: [
|
|
2262
|
-
u ? /* @__PURE__ */
|
|
2412
|
+
u ? /* @__PURE__ */ I("div", {
|
|
2263
2413
|
role: "switch",
|
|
2264
2414
|
"aria-checked": u.enabled,
|
|
2265
2415
|
onClick: () => u.setEnabled(!u.enabled),
|
|
2266
|
-
children: [/* @__PURE__ */
|
|
2416
|
+
children: [/* @__PURE__ */ F("div", { children: t(a.autoplayNext) }), /* @__PURE__ */ F("div", { children: /* @__PURE__ */ F("span", { className: u.enabled ? "switch on" : "switch" }) })]
|
|
2267
2417
|
}) : null,
|
|
2268
|
-
i.length > 1 ? /* @__PURE__ */
|
|
2418
|
+
i.length > 1 ? /* @__PURE__ */ I("div", {
|
|
2269
2419
|
onClick: w(2),
|
|
2270
|
-
children: [/* @__PURE__ */
|
|
2420
|
+
children: [/* @__PURE__ */ F("div", { children: t(a.audio) }), /* @__PURE__ */ F("div", { children: /* @__PURE__ */ F(V, {}) })]
|
|
2271
2421
|
}) : null,
|
|
2272
|
-
S > 1 ? /* @__PURE__ */
|
|
2422
|
+
S > 1 ? /* @__PURE__ */ I("div", {
|
|
2273
2423
|
onClick: w(3),
|
|
2274
|
-
children: [/* @__PURE__ */
|
|
2424
|
+
children: [/* @__PURE__ */ F("div", { children: t(a.quality) }), /* @__PURE__ */ I("div", { children: [C ? /* @__PURE__ */ F("span", {
|
|
2275
2425
|
className: "secondary",
|
|
2276
2426
|
children: C
|
|
2277
|
-
}) : null, /* @__PURE__ */
|
|
2427
|
+
}) : null, /* @__PURE__ */ F(V, {})] })]
|
|
2278
2428
|
}) : null,
|
|
2279
|
-
/* @__PURE__ */
|
|
2429
|
+
/* @__PURE__ */ I("div", {
|
|
2280
2430
|
onClick: w(1),
|
|
2281
|
-
children: [/* @__PURE__ */
|
|
2431
|
+
children: [/* @__PURE__ */ F("div", { children: t(a.playbackSpeed) }), /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("span", {
|
|
2282
2432
|
className: "secondary",
|
|
2283
2433
|
children: r === 1 ? t(a.defaultSpeed) : n(r, {
|
|
2284
2434
|
minimumFractionDigits: 2,
|
|
2285
2435
|
maximumFractionDigits: 2
|
|
2286
2436
|
})
|
|
2287
|
-
}), /* @__PURE__ */
|
|
2437
|
+
}), /* @__PURE__ */ F(V, {})] })]
|
|
2288
2438
|
}),
|
|
2289
|
-
l ? /* @__PURE__ */
|
|
2439
|
+
l ? /* @__PURE__ */ I("div", {
|
|
2290
2440
|
role: "switch",
|
|
2291
2441
|
"aria-checked": l.available && l.enabled,
|
|
2292
2442
|
"aria-disabled": !l.available,
|
|
@@ -2294,35 +2444,35 @@ ${Nt}
|
|
|
2294
2444
|
onClick: () => {
|
|
2295
2445
|
l.available && l.setEnabled(!l.enabled);
|
|
2296
2446
|
},
|
|
2297
|
-
children: [/* @__PURE__ */
|
|
2447
|
+
children: [/* @__PURE__ */ F("div", { children: t(a.normalizeVolume) }), /* @__PURE__ */ F("div", { children: l.available ? /* @__PURE__ */ F("span", { className: l.enabled ? "switch on" : "switch" }) : /* @__PURE__ */ F("span", {
|
|
2298
2448
|
className: "secondary",
|
|
2299
2449
|
children: t(a.unavailable)
|
|
2300
2450
|
}) })]
|
|
2301
2451
|
}) : null
|
|
2302
2452
|
]
|
|
2303
2453
|
}),
|
|
2304
|
-
p && d === 1 && /* @__PURE__ */
|
|
2454
|
+
p && d === 1 && /* @__PURE__ */ I("div", {
|
|
2305
2455
|
className: "popover playback-rate",
|
|
2306
2456
|
children: [
|
|
2307
|
-
/* @__PURE__ */
|
|
2457
|
+
/* @__PURE__ */ I("div", {
|
|
2308
2458
|
className: "back",
|
|
2309
2459
|
onClick: w(0),
|
|
2310
|
-
children: [/* @__PURE__ */
|
|
2460
|
+
children: [/* @__PURE__ */ F(B, {}), /* @__PURE__ */ F("span", { children: t(a.playbackSpeed) })]
|
|
2311
2461
|
}),
|
|
2312
|
-
/* @__PURE__ */
|
|
2462
|
+
/* @__PURE__ */ F("div", {
|
|
2313
2463
|
className: "slider no-hover",
|
|
2314
|
-
children: /* @__PURE__ */
|
|
2464
|
+
children: /* @__PURE__ */ F(Yt, {})
|
|
2315
2465
|
}),
|
|
2316
|
-
/* @__PURE__ */
|
|
2466
|
+
/* @__PURE__ */ F("div", {
|
|
2317
2467
|
className: "options no-hover",
|
|
2318
|
-
children:
|
|
2468
|
+
children: Zt.map((e) => /* @__PURE__ */ F("div", {
|
|
2319
2469
|
onClick: () => y(e),
|
|
2320
2470
|
children: t(a.speed, { rate: n(e) })
|
|
2321
2471
|
}, e))
|
|
2322
2472
|
})
|
|
2323
2473
|
]
|
|
2324
2474
|
}),
|
|
2325
|
-
p && d === 2 && /* @__PURE__ */
|
|
2475
|
+
p && d === 2 && /* @__PURE__ */ F(Bt, {
|
|
2326
2476
|
title: t(a.audio),
|
|
2327
2477
|
tracks: i,
|
|
2328
2478
|
selected: o,
|
|
@@ -2331,7 +2481,7 @@ ${Nt}
|
|
|
2331
2481
|
pending: g,
|
|
2332
2482
|
failed: _
|
|
2333
2483
|
}),
|
|
2334
|
-
p && d === 3 && c && /* @__PURE__ */
|
|
2484
|
+
p && d === 3 && c && /* @__PURE__ */ F(Bt, {
|
|
2335
2485
|
title: t(a.quality),
|
|
2336
2486
|
tracks: c.options,
|
|
2337
2487
|
selected: c.selectedId ?? void 0,
|
|
@@ -2343,7 +2493,7 @@ ${Nt}
|
|
|
2343
2493
|
})
|
|
2344
2494
|
]
|
|
2345
2495
|
});
|
|
2346
|
-
},
|
|
2496
|
+
}, $t = O`
|
|
2347
2497
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
2348
2498
|
which is the width of the player box, so it can be clamped to it. */
|
|
2349
2499
|
position: static;
|
|
@@ -2359,28 +2509,28 @@ position: static;
|
|
|
2359
2509
|
}
|
|
2360
2510
|
}
|
|
2361
2511
|
|
|
2362
|
-
${
|
|
2363
|
-
`,
|
|
2364
|
-
let { format: e } =
|
|
2512
|
+
${zt}
|
|
2513
|
+
`, en = () => {
|
|
2514
|
+
let { format: e } = Z(), t = X((e) => e.subtitleTracks), n = X((e) => e.selectedSubtitleTrack), r = X((e) => e.selectSubtitleTrack), i = X((e) => e.subtitleOffLabel), { open: o, toggle: s, containerRef: c, pending: l, failed: u, runSelect: d } = Vt();
|
|
2365
2515
|
if (t.length === 0) return null;
|
|
2366
2516
|
let f = n !== void 0;
|
|
2367
|
-
return /* @__PURE__ */
|
|
2368
|
-
css:
|
|
2517
|
+
return /* @__PURE__ */ I("div", {
|
|
2518
|
+
css: $t,
|
|
2369
2519
|
ref: c,
|
|
2370
|
-
children: [/* @__PURE__ */
|
|
2520
|
+
children: [/* @__PURE__ */ F(At, {
|
|
2371
2521
|
id: "subtitles",
|
|
2372
2522
|
disabled: o,
|
|
2373
|
-
text: /* @__PURE__ */
|
|
2523
|
+
text: /* @__PURE__ */ F("button", {
|
|
2374
2524
|
className: "subtitles",
|
|
2375
2525
|
type: "button",
|
|
2376
2526
|
onClick: s,
|
|
2377
2527
|
"aria-label": e(a.subtitles),
|
|
2378
2528
|
"aria-expanded": o,
|
|
2379
2529
|
"aria-pressed": f,
|
|
2380
|
-
children: f ? /* @__PURE__ */
|
|
2530
|
+
children: f ? /* @__PURE__ */ F(L, { className: "captions" }) : /* @__PURE__ */ F(R, { className: "captions-off" })
|
|
2381
2531
|
}),
|
|
2382
|
-
toolTipText: /* @__PURE__ */
|
|
2383
|
-
}), o && /* @__PURE__ */
|
|
2532
|
+
toolTipText: /* @__PURE__ */ F("span", { children: e(a.subtitles) })
|
|
2533
|
+
}), o && /* @__PURE__ */ F(Bt, {
|
|
2384
2534
|
title: e(a.subtitles),
|
|
2385
2535
|
tracks: t,
|
|
2386
2536
|
selected: n,
|
|
@@ -2390,13 +2540,13 @@ ${Nt}
|
|
|
2390
2540
|
failed: u
|
|
2391
2541
|
})]
|
|
2392
2542
|
});
|
|
2393
|
-
},
|
|
2543
|
+
}, tn = {
|
|
2394
2544
|
primary: "#EAEBEE",
|
|
2395
2545
|
secondary: "#D0D0D9",
|
|
2396
2546
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
2397
2547
|
borderPrimary: "#384F70",
|
|
2398
2548
|
backgroundTooltip: "#222222"
|
|
2399
|
-
},
|
|
2549
|
+
}, nn = O`
|
|
2400
2550
|
display: flex;
|
|
2401
2551
|
align-items: center;
|
|
2402
2552
|
|
|
@@ -2439,8 +2589,8 @@ ${Nt}
|
|
|
2439
2589
|
width: 10px;
|
|
2440
2590
|
height: 10px;
|
|
2441
2591
|
}
|
|
2442
|
-
`,
|
|
2443
|
-
let { number: n } =
|
|
2592
|
+
`, rn = ({ value: e, onChange: t }) => {
|
|
2593
|
+
let { number: n } = Z(), r = X((e) => e.volume), i = X((e) => e.muted), a = T(null), o = T(null), { handlers: s } = jt({
|
|
2444
2594
|
ref: o,
|
|
2445
2595
|
onChange: t
|
|
2446
2596
|
}), c = (n) => {
|
|
@@ -2448,37 +2598,37 @@ ${Nt}
|
|
|
2448
2598
|
let r = .05, i = e;
|
|
2449
2599
|
i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
|
|
2450
2600
|
};
|
|
2451
|
-
|
|
2601
|
+
C(() => {
|
|
2452
2602
|
let e = a.current;
|
|
2453
2603
|
return e && e.addEventListener("wheel", c, { passive: !1 }), () => {
|
|
2454
2604
|
e && e.removeEventListener("wheel", c);
|
|
2455
2605
|
};
|
|
2456
2606
|
}, [e]);
|
|
2457
|
-
let l = e * 100, u =
|
|
2458
|
-
return /* @__PURE__ */
|
|
2607
|
+
let l = e * 100, u = w(() => Math.round(i ? 0 : St(r) * 100), [r, i]);
|
|
2608
|
+
return /* @__PURE__ */ F(At, {
|
|
2459
2609
|
id: "volume-slider",
|
|
2460
|
-
text: /* @__PURE__ */
|
|
2610
|
+
text: /* @__PURE__ */ F("div", {
|
|
2461
2611
|
ref: a,
|
|
2462
|
-
css:
|
|
2612
|
+
css: nn,
|
|
2463
2613
|
...s,
|
|
2464
|
-
children: /* @__PURE__ */
|
|
2614
|
+
children: /* @__PURE__ */ F("div", {
|
|
2465
2615
|
ref: o,
|
|
2466
2616
|
style: { background: `linear-gradient(to right,
|
|
2467
2617
|
#fff 0% ${l}%,
|
|
2468
2618
|
#3A3A3A ${l}% 100%
|
|
2469
2619
|
)` },
|
|
2470
|
-
children: /* @__PURE__ */
|
|
2620
|
+
children: /* @__PURE__ */ F("div", {
|
|
2471
2621
|
className: "volume-handle",
|
|
2472
2622
|
style: { left: `${e * 100}%` }
|
|
2473
2623
|
})
|
|
2474
2624
|
})
|
|
2475
2625
|
}),
|
|
2476
|
-
toolTipText: /* @__PURE__ */
|
|
2626
|
+
toolTipText: /* @__PURE__ */ F("div", {
|
|
2477
2627
|
className: "volume-value",
|
|
2478
2628
|
children: n(u / 100, { style: "percent" })
|
|
2479
2629
|
})
|
|
2480
2630
|
});
|
|
2481
|
-
},
|
|
2631
|
+
}, an = O`
|
|
2482
2632
|
position: relative;
|
|
2483
2633
|
display: flex;
|
|
2484
2634
|
align-items: center;
|
|
@@ -2541,39 +2691,39 @@ ${Nt}
|
|
|
2541
2691
|
}
|
|
2542
2692
|
}
|
|
2543
2693
|
|
|
2544
|
-
`,
|
|
2545
|
-
let t = X(), { format: n } =
|
|
2546
|
-
return /* @__PURE__ */
|
|
2547
|
-
css:
|
|
2548
|
-
children: [/* @__PURE__ */
|
|
2694
|
+
`, on = ({ ref: e }) => {
|
|
2695
|
+
let t = X(), { format: n } = Z(), r = X((e) => e.volume), i = X((e) => e.muted), o = w(() => St(r), [r]);
|
|
2696
|
+
return /* @__PURE__ */ I("div", {
|
|
2697
|
+
css: an,
|
|
2698
|
+
children: [/* @__PURE__ */ F(At, {
|
|
2549
2699
|
id: "sound",
|
|
2550
|
-
text: /* @__PURE__ */
|
|
2700
|
+
text: /* @__PURE__ */ F("button", {
|
|
2551
2701
|
className: "sound",
|
|
2552
2702
|
type: "button",
|
|
2553
2703
|
onClick: () => t.toggleMuted(),
|
|
2554
2704
|
ref: e,
|
|
2555
2705
|
"aria-label": n(a.mute),
|
|
2556
2706
|
"aria-pressed": i || r === 0,
|
|
2557
|
-
children:
|
|
2707
|
+
children: F(i || r === 0 ? se : r <= .5 ? ae : oe, {
|
|
2558
2708
|
size: 18,
|
|
2559
2709
|
color: "#fff"
|
|
2560
2710
|
})
|
|
2561
2711
|
}),
|
|
2562
|
-
toolTipText: /* @__PURE__ */
|
|
2563
|
-
}), /* @__PURE__ */
|
|
2712
|
+
toolTipText: /* @__PURE__ */ F("span", { children: n(i ? a.unmuteKey : a.muteKey) })
|
|
2713
|
+
}), /* @__PURE__ */ F("div", {
|
|
2564
2714
|
className: "volume-slider-container",
|
|
2565
|
-
children: /* @__PURE__ */
|
|
2715
|
+
children: /* @__PURE__ */ F("div", {
|
|
2566
2716
|
className: "volume-slider-background",
|
|
2567
|
-
children: /* @__PURE__ */
|
|
2717
|
+
children: /* @__PURE__ */ F(rn, {
|
|
2568
2718
|
value: i ? 0 : o,
|
|
2569
2719
|
onChange: (e) => {
|
|
2570
|
-
t.setVolume(
|
|
2720
|
+
t.setVolume(xt(e));
|
|
2571
2721
|
}
|
|
2572
2722
|
})
|
|
2573
2723
|
})
|
|
2574
2724
|
})]
|
|
2575
2725
|
});
|
|
2576
|
-
},
|
|
2726
|
+
}, sn = .05, cn = 5, ln = 50, un = 1e3, dn = O`
|
|
2577
2727
|
position: absolute;
|
|
2578
2728
|
bottom: 0;
|
|
2579
2729
|
width: 100%;
|
|
@@ -2631,7 +2781,7 @@ ${Nt}
|
|
|
2631
2781
|
}
|
|
2632
2782
|
}
|
|
2633
2783
|
|
|
2634
|
-
.play, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
2784
|
+
.play, .previous, .next, .sound, .time, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
2635
2785
|
display: flex;
|
|
2636
2786
|
align-items: center;
|
|
2637
2787
|
|
|
@@ -2649,7 +2799,7 @@ ${Nt}
|
|
|
2649
2799
|
}
|
|
2650
2800
|
}
|
|
2651
2801
|
|
|
2652
|
-
.play, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
2802
|
+
.play, .previous, .next, .sound, .errors, .subtitles, .settings, .picture-in-picture, .full-screen {
|
|
2653
2803
|
border-radius: 4px;
|
|
2654
2804
|
|
|
2655
2805
|
padding: 8px;
|
|
@@ -2664,8 +2814,8 @@ ${Nt}
|
|
|
2664
2814
|
|
|
2665
2815
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2666
2816
|
of its own and so is never :hover */
|
|
2667
|
-
:hover, &.armed {
|
|
2668
|
-
background-color: ${
|
|
2817
|
+
:hover, &:focus-visible, &.armed {
|
|
2818
|
+
background-color: ${tn.hover};
|
|
2669
2819
|
}
|
|
2670
2820
|
|
|
2671
2821
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2703,181 +2853,211 @@ ${Nt}
|
|
|
2703
2853
|
}
|
|
2704
2854
|
}
|
|
2705
2855
|
}
|
|
2706
|
-
`,
|
|
2707
|
-
let
|
|
2708
|
-
|
|
2709
|
-
let
|
|
2710
|
-
let n =
|
|
2711
|
-
|
|
2712
|
-
}, [
|
|
2713
|
-
|
|
2714
|
-
}, [
|
|
2715
|
-
|
|
2716
|
-
let n = (e) =>
|
|
2717
|
-
|
|
2856
|
+
`, fn = ({ shortcuts: e = "window", root: t, fullscreen: n, episodeNavigation: r }) => {
|
|
2857
|
+
let i = X(), { format: o } = Z(), s = X((e) => e.paused), c = X((e) => e.currentTime), l = X((e) => e.duration), u = X((e) => e.seekingTo), d = X((e) => e.fullscreen), f = n ? n.active : d, p = T(n);
|
|
2858
|
+
p.current = n;
|
|
2859
|
+
let m = X((e) => e.hideUI), h = X((e) => e.togglePictureInPicture), g = X((e) => e.pictureInPictureMode), _ = X((e) => e.burnedInSubtitles), v = X((e) => e.passThroughPictureInPicture), y = X((e) => e.subtitleTracks), b = X((e) => e.requestSeek), S = X((e) => e.stepFrame), [w, D] = E(null), O = T(null), k = T(void 0), A = g === "burn-in", j = y.length > 0, M = l > 0 && c === l, N = x(({ direction: e, stepSize: t }) => {
|
|
2860
|
+
let n = St(i.volume), r = e === "up" ? t : -t, a = Math.max(0, Math.min(1, n + r)), o = i.muted;
|
|
2861
|
+
i.setVolume(xt(a)), o && !i.muted && i.toggleMuted();
|
|
2862
|
+
}, [i]), ee = T(!1), te = x(() => {
|
|
2863
|
+
p.current ? p.current.request() : i.toggleFullscreen();
|
|
2864
|
+
}, [i]);
|
|
2865
|
+
C(() => {
|
|
2866
|
+
let n = (e) => b ? b(e) : i.seek(e), r = (e) => e.composedPath()[0], a = (e) => {
|
|
2867
|
+
ee.current = !!t.current?.contains(r(e) ?? null);
|
|
2718
2868
|
}, o = (a) => {
|
|
2719
|
-
let o =
|
|
2869
|
+
let o = r(a);
|
|
2720
2870
|
if (o?.isContentEditable || /^(input|textarea|select)$/i.test(o?.tagName ?? "") || (a.ctrlKey || a.metaKey || a.altKey) && !a.getModifierState("AltGraph")) return;
|
|
2721
|
-
let s = t.current?.contains(o ?? null) || o === document.body &&
|
|
2871
|
+
let s = t.current?.contains(o ?? null) || o === document.body && ee.current, c = p.current ? p.current.active : i.fullscreen;
|
|
2722
2872
|
if (e === "player" && !c && !s) return;
|
|
2723
2873
|
let l = !0;
|
|
2724
|
-
if (a.key === "f")
|
|
2725
|
-
else if (a.key === "k")
|
|
2726
|
-
else if (a.key === " ")
|
|
2727
|
-
else if (a.key === "m")
|
|
2728
|
-
else if (a.key === "ArrowUp")
|
|
2874
|
+
if (a.key === "f") te();
|
|
2875
|
+
else if (a.key === "k") i.togglePaused();
|
|
2876
|
+
else if (a.key === " ") i.togglePaused();
|
|
2877
|
+
else if (a.key === "m") i.toggleMuted();
|
|
2878
|
+
else if (a.key === "ArrowUp") N({
|
|
2729
2879
|
direction: "up",
|
|
2730
|
-
stepSize:
|
|
2880
|
+
stepSize: sn
|
|
2731
2881
|
});
|
|
2732
|
-
else if (a.key === "ArrowDown")
|
|
2882
|
+
else if (a.key === "ArrowDown") N({
|
|
2733
2883
|
direction: "down",
|
|
2734
|
-
stepSize:
|
|
2884
|
+
stepSize: sn
|
|
2735
2885
|
});
|
|
2736
2886
|
else if (a.key === "ArrowRight" || a.key === "ArrowLeft") {
|
|
2737
|
-
let e =
|
|
2738
|
-
if (!e?.readyState || t && !
|
|
2739
|
-
let
|
|
2740
|
-
n(t ? Math.min(
|
|
2741
|
-
} else (a.key === "<" || a.key === ">") &&
|
|
2887
|
+
let e = i.target?.media, t = a.key === "ArrowRight";
|
|
2888
|
+
if (!e?.readyState || t && !i.duration) return;
|
|
2889
|
+
let r = i.state.seekingTo ?? e.currentTime;
|
|
2890
|
+
n(t ? Math.min(r + cn, i.duration) : Math.max(r - cn, 0));
|
|
2891
|
+
} else (a.key === "<" || a.key === ">") && S ? S(a.key === ">" ? 1 : -1) : l = !1;
|
|
2742
2892
|
l && a.preventDefault();
|
|
2743
2893
|
};
|
|
2744
2894
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
2745
2895
|
window.removeEventListener("keydown", o), window.removeEventListener("pointerdown", a, !0), window.removeEventListener("focusin", a, !0);
|
|
2746
2896
|
};
|
|
2747
2897
|
}, [
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2898
|
+
i,
|
|
2899
|
+
N,
|
|
2900
|
+
b,
|
|
2901
|
+
S,
|
|
2752
2902
|
e,
|
|
2753
2903
|
t,
|
|
2754
|
-
|
|
2904
|
+
te
|
|
2755
2905
|
]);
|
|
2756
|
-
let
|
|
2757
|
-
e.preventDefault(), e.deltaY < 0 ?
|
|
2906
|
+
let P = x((e) => {
|
|
2907
|
+
e.preventDefault(), e.deltaY < 0 ? N({
|
|
2758
2908
|
direction: "up",
|
|
2759
|
-
stepSize:
|
|
2760
|
-
}) :
|
|
2909
|
+
stepSize: sn
|
|
2910
|
+
}) : N({
|
|
2761
2911
|
direction: "down",
|
|
2762
|
-
stepSize:
|
|
2912
|
+
stepSize: sn
|
|
2763
2913
|
});
|
|
2764
|
-
}, [
|
|
2765
|
-
|
|
2766
|
-
if (
|
|
2767
|
-
}, [
|
|
2768
|
-
let
|
|
2769
|
-
if (!
|
|
2914
|
+
}, [N]);
|
|
2915
|
+
C(() => {
|
|
2916
|
+
if (w) return w.addEventListener("wheel", P, { passive: !1 }), () => w.removeEventListener("wheel", P);
|
|
2917
|
+
}, [w, P]);
|
|
2918
|
+
let ne = (e) => {
|
|
2919
|
+
if (!v || v.active || v.armed || e.pointerType === "touch") return;
|
|
2770
2920
|
let { left: t, top: n, width: r, height: i } = e.currentTarget.getBoundingClientRect();
|
|
2771
|
-
|
|
2921
|
+
v.arm({
|
|
2772
2922
|
left: t,
|
|
2773
2923
|
top: n,
|
|
2774
2924
|
width: r,
|
|
2775
2925
|
height: i
|
|
2776
2926
|
});
|
|
2777
|
-
},
|
|
2778
|
-
return
|
|
2779
|
-
if (!
|
|
2780
|
-
clearInterval(
|
|
2927
|
+
}, L = !!v?.armed;
|
|
2928
|
+
return C(() => {
|
|
2929
|
+
if (!L) return;
|
|
2930
|
+
clearInterval(k.current);
|
|
2781
2931
|
let e = Infinity, t = setInterval(() => {
|
|
2782
2932
|
if (Date.now() > e) {
|
|
2783
2933
|
clearInterval(t);
|
|
2784
2934
|
return;
|
|
2785
2935
|
}
|
|
2786
|
-
let n =
|
|
2936
|
+
let n = O.current, r = document.activeElement;
|
|
2787
2937
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2788
|
-
},
|
|
2789
|
-
return
|
|
2790
|
-
e = Date.now() +
|
|
2938
|
+
}, ln);
|
|
2939
|
+
return k.current = t, () => {
|
|
2940
|
+
e = Date.now() + un;
|
|
2791
2941
|
};
|
|
2792
|
-
}, [
|
|
2942
|
+
}, [L]), C(() => () => clearInterval(k.current), []), /* @__PURE__ */ I("div", {
|
|
2793
2943
|
className: "control-bar",
|
|
2794
|
-
css:
|
|
2795
|
-
style: { ...
|
|
2944
|
+
css: dn,
|
|
2945
|
+
style: { ...m ? {
|
|
2796
2946
|
opacity: "0",
|
|
2797
2947
|
pointerEvents: "none"
|
|
2798
|
-
} :
|
|
2799
|
-
children: [/* @__PURE__ */
|
|
2948
|
+
} : L ? { pointerEvents: "none" } : {} },
|
|
2949
|
+
children: [/* @__PURE__ */ F(Pt, {}), /* @__PURE__ */ I("div", {
|
|
2800
2950
|
className: "actions",
|
|
2801
|
-
children: [/* @__PURE__ */
|
|
2951
|
+
children: [/* @__PURE__ */ I("div", {
|
|
2802
2952
|
className: "left",
|
|
2803
2953
|
children: [
|
|
2804
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ F(At, {
|
|
2805
2955
|
id: "play",
|
|
2806
2956
|
tooltipPlace: "top-start",
|
|
2807
|
-
text: /* @__PURE__ */
|
|
2957
|
+
text: /* @__PURE__ */ F("button", {
|
|
2808
2958
|
className: "play",
|
|
2809
2959
|
type: "button",
|
|
2810
|
-
onClick: () =>
|
|
2811
|
-
"aria-label":
|
|
2812
|
-
children:
|
|
2960
|
+
onClick: () => i.togglePaused(),
|
|
2961
|
+
"aria-label": o(M ? a.replay : s ? a.play : a.pause),
|
|
2962
|
+
children: F(M ? q : s ? K : G, {})
|
|
2813
2963
|
}),
|
|
2814
|
-
toolTipText: /* @__PURE__ */
|
|
2964
|
+
toolTipText: /* @__PURE__ */ F("span", { children: o(M ? a.replayKey : s ? a.playKey : a.pauseKey) })
|
|
2815
2965
|
}),
|
|
2816
|
-
|
|
2817
|
-
|
|
2966
|
+
r?.previous ? (() => {
|
|
2967
|
+
let e = r.previous.title?.trim() || o(a.previousEpisode);
|
|
2968
|
+
return /* @__PURE__ */ F(At, {
|
|
2969
|
+
id: "previous-episode",
|
|
2970
|
+
tooltipPlace: "top-start",
|
|
2971
|
+
text: /* @__PURE__ */ F("button", {
|
|
2972
|
+
className: "previous",
|
|
2973
|
+
type: "button",
|
|
2974
|
+
onClick: () => r.previous?.request(),
|
|
2975
|
+
"aria-label": e,
|
|
2976
|
+
children: /* @__PURE__ */ F(Y, {})
|
|
2977
|
+
}),
|
|
2978
|
+
toolTipText: /* @__PURE__ */ F("span", { children: e })
|
|
2979
|
+
});
|
|
2980
|
+
})() : null,
|
|
2981
|
+
r?.next ? (() => {
|
|
2982
|
+
let e = r.next.title?.trim() || o(a.nextEpisode);
|
|
2983
|
+
return /* @__PURE__ */ F(At, {
|
|
2984
|
+
id: "next-episode",
|
|
2985
|
+
tooltipPlace: "top-start",
|
|
2986
|
+
text: /* @__PURE__ */ F("button", {
|
|
2987
|
+
className: "next",
|
|
2988
|
+
type: "button",
|
|
2989
|
+
onClick: () => r.next?.request(),
|
|
2990
|
+
"aria-label": e,
|
|
2991
|
+
children: /* @__PURE__ */ F(re, {})
|
|
2992
|
+
}),
|
|
2993
|
+
toolTipText: /* @__PURE__ */ F("span", { children: e })
|
|
2994
|
+
});
|
|
2995
|
+
})() : null,
|
|
2996
|
+
/* @__PURE__ */ F(on, { ref: D }),
|
|
2997
|
+
/* @__PURE__ */ F("div", {
|
|
2818
2998
|
className: "time",
|
|
2819
|
-
children:
|
|
2999
|
+
children: wt(u ?? c, l)
|
|
2820
3000
|
})
|
|
2821
3001
|
]
|
|
2822
|
-
}), /* @__PURE__ */
|
|
3002
|
+
}), /* @__PURE__ */ I("div", {
|
|
2823
3003
|
className: "right",
|
|
2824
3004
|
children: [
|
|
2825
|
-
/* @__PURE__ */
|
|
2826
|
-
/* @__PURE__ */
|
|
2827
|
-
/* @__PURE__ */
|
|
2828
|
-
|
|
3005
|
+
/* @__PURE__ */ F(qt, {}),
|
|
3006
|
+
/* @__PURE__ */ F(en, {}),
|
|
3007
|
+
/* @__PURE__ */ F(Qt, {}),
|
|
3008
|
+
v ? /* @__PURE__ */ F(At, {
|
|
2829
3009
|
id: "picture-in-picture",
|
|
2830
3010
|
tooltipPlace: "top-end",
|
|
2831
|
-
text: /* @__PURE__ */
|
|
2832
|
-
ref:
|
|
2833
|
-
className:
|
|
3011
|
+
text: /* @__PURE__ */ F("button", {
|
|
3012
|
+
ref: O,
|
|
3013
|
+
className: v.armed ? "picture-in-picture armed" : "picture-in-picture",
|
|
2834
3014
|
type: "button",
|
|
2835
|
-
onPointerEnter:
|
|
2836
|
-
onPointerMove:
|
|
2837
|
-
onClick:
|
|
2838
|
-
"aria-label":
|
|
2839
|
-
"aria-pressed":
|
|
2840
|
-
children: /* @__PURE__ */
|
|
2841
|
-
src:
|
|
3015
|
+
onPointerEnter: ne,
|
|
3016
|
+
onPointerMove: ne,
|
|
3017
|
+
onClick: v.active ? v.exit : void 0,
|
|
3018
|
+
"aria-label": o(a.pictureInPicture),
|
|
3019
|
+
"aria-pressed": v.active,
|
|
3020
|
+
children: /* @__PURE__ */ F("img", {
|
|
3021
|
+
src: Ft,
|
|
2842
3022
|
alt: ""
|
|
2843
3023
|
})
|
|
2844
3024
|
}),
|
|
2845
|
-
toolTipText: /* @__PURE__ */
|
|
2846
|
-
}) :
|
|
3025
|
+
toolTipText: /* @__PURE__ */ F("span", { children: o(v.active ? a.exitPictureInPicture : a.pictureInPicture) })
|
|
3026
|
+
}) : h ? /* @__PURE__ */ F(At, {
|
|
2847
3027
|
id: "picture-in-picture",
|
|
2848
3028
|
tooltipPlace: "top-end",
|
|
2849
|
-
text: /* @__PURE__ */
|
|
3029
|
+
text: /* @__PURE__ */ F("button", {
|
|
2850
3030
|
className: "picture-in-picture",
|
|
2851
3031
|
type: "button",
|
|
2852
|
-
onClick:
|
|
2853
|
-
disabled:
|
|
2854
|
-
"aria-label":
|
|
2855
|
-
"aria-pressed":
|
|
2856
|
-
children:
|
|
2857
|
-
src:
|
|
3032
|
+
onClick: h,
|
|
3033
|
+
disabled: A && !j,
|
|
3034
|
+
"aria-label": o(A ? a.burnIn : a.pictureInPicture),
|
|
3035
|
+
"aria-pressed": A ? _ : void 0,
|
|
3036
|
+
children: A ? F(_ ? Lt : Rt, {}) : /* @__PURE__ */ F("img", {
|
|
3037
|
+
src: Ft,
|
|
2858
3038
|
alt: ""
|
|
2859
3039
|
})
|
|
2860
3040
|
}),
|
|
2861
|
-
toolTipText: /* @__PURE__ */
|
|
3041
|
+
toolTipText: /* @__PURE__ */ F("span", { children: o(A ? j ? _ ? a.burnedIn : a.burnInOffer : a.noSubtitles : a.pictureInPicture) })
|
|
2862
3042
|
}) : null,
|
|
2863
|
-
/* @__PURE__ */
|
|
3043
|
+
/* @__PURE__ */ F(At, {
|
|
2864
3044
|
id: "full-screen",
|
|
2865
3045
|
tooltipPlace: "top-end",
|
|
2866
|
-
text: /* @__PURE__ */
|
|
3046
|
+
text: /* @__PURE__ */ F("button", {
|
|
2867
3047
|
className: "full-screen",
|
|
2868
3048
|
type: "button",
|
|
2869
|
-
onClick:
|
|
2870
|
-
"aria-label":
|
|
2871
|
-
"aria-pressed":
|
|
2872
|
-
children:
|
|
3049
|
+
onClick: te,
|
|
3050
|
+
"aria-label": o(a.fullScreen),
|
|
3051
|
+
"aria-pressed": f,
|
|
3052
|
+
children: F(f ? W : U, {})
|
|
2873
3053
|
}),
|
|
2874
|
-
toolTipText: /* @__PURE__ */
|
|
3054
|
+
toolTipText: /* @__PURE__ */ F("span", { children: o(f ? a.exitFullScreenKey : a.fullScreenKey) })
|
|
2875
3055
|
})
|
|
2876
3056
|
]
|
|
2877
3057
|
})]
|
|
2878
3058
|
})]
|
|
2879
3059
|
});
|
|
2880
|
-
},
|
|
3060
|
+
}, pn = 9e3, mn = O`
|
|
2881
3061
|
position: absolute;
|
|
2882
3062
|
inset: 0;
|
|
2883
3063
|
z-index: 2;
|
|
@@ -2920,36 +3100,36 @@ ${Nt}
|
|
|
2920
3100
|
line-height: 1;
|
|
2921
3101
|
color: #fff;
|
|
2922
3102
|
}
|
|
2923
|
-
`,
|
|
2924
|
-
let { format: e } =
|
|
2925
|
-
return
|
|
3103
|
+
`, hn = () => {
|
|
3104
|
+
let { format: e } = Z(), t = X((e) => e.burnedInSubtitles), n = X((e) => e.pictureInPictureMode), [r, i] = E(!1);
|
|
3105
|
+
return C(() => {
|
|
2926
3106
|
if (n !== "burn-in" || !t) {
|
|
2927
3107
|
i(!1);
|
|
2928
3108
|
return;
|
|
2929
3109
|
}
|
|
2930
3110
|
i(!0);
|
|
2931
|
-
let e = setTimeout(() => i(!1),
|
|
3111
|
+
let e = setTimeout(() => i(!1), pn);
|
|
2932
3112
|
return () => clearTimeout(e);
|
|
2933
|
-
}, [n, t]), n !== "burn-in" || !t ? null : /* @__PURE__ */
|
|
2934
|
-
css:
|
|
3113
|
+
}, [n, t]), n !== "burn-in" || !t ? null : /* @__PURE__ */ F("div", {
|
|
3114
|
+
css: mn,
|
|
2935
3115
|
className: r ? "show" : "",
|
|
2936
3116
|
role: "status",
|
|
2937
|
-
children: /* @__PURE__ */
|
|
3117
|
+
children: /* @__PURE__ */ I("div", {
|
|
2938
3118
|
className: "card",
|
|
2939
|
-
children: [/* @__PURE__ */
|
|
3119
|
+
children: [/* @__PURE__ */ F("div", {
|
|
2940
3120
|
className: "text",
|
|
2941
3121
|
children: e(a.burnInHint)
|
|
2942
|
-
}), /* @__PURE__ */
|
|
3122
|
+
}), /* @__PURE__ */ F("div", {
|
|
2943
3123
|
className: "arrow",
|
|
2944
3124
|
"aria-hidden": "true",
|
|
2945
3125
|
children: "→"
|
|
2946
3126
|
})]
|
|
2947
3127
|
})
|
|
2948
3128
|
});
|
|
2949
|
-
},
|
|
3129
|
+
}, gn = 1, _n = 6e3, vn = 1, yn = {
|
|
2950
3130
|
opening: a.skipOpening,
|
|
2951
3131
|
ending: a.skipEnding
|
|
2952
|
-
},
|
|
3132
|
+
}, bn = O`
|
|
2953
3133
|
position: absolute;
|
|
2954
3134
|
inset: 0;
|
|
2955
3135
|
z-index: 2;
|
|
@@ -3000,13 +3180,13 @@ ${Nt}
|
|
|
3000
3180
|
bottom: calc(9 * var(--mp-unit));
|
|
3001
3181
|
}
|
|
3002
3182
|
}
|
|
3003
|
-
`,
|
|
3004
|
-
let t = X((e) => e.chapters), n = X((e) => e.currentTime), r = X((e) => e.requestSeek), i = X((e) => e.seekPreview), a = X(), { format: o } =
|
|
3005
|
-
let n =
|
|
3183
|
+
`, xn = ({ endingOffered: e }) => {
|
|
3184
|
+
let t = X((e) => e.chapters), n = X((e) => e.currentTime), r = X((e) => e.requestSeek), i = X((e) => e.seekPreview), a = X(), { format: o } = Z(), s = w(() => {
|
|
3185
|
+
let n = g(t), r = e ? -1 : n.lastIndexOf("ending");
|
|
3006
3186
|
return n.map((e, t) => t === r ? void 0 : e);
|
|
3007
|
-
}, [t, e]), c =
|
|
3187
|
+
}, [t, e]), c = w(() => {
|
|
3008
3188
|
if (typeof n != "number") return;
|
|
3009
|
-
let e = t.findIndex((e, t) => s[t] !== void 0 && e.start -
|
|
3189
|
+
let e = t.findIndex((e, t) => s[t] !== void 0 && e.start - gn <= n && n < e.end), r = e >= 0 ? s[e] : void 0;
|
|
3010
3190
|
return r ? {
|
|
3011
3191
|
kind: r,
|
|
3012
3192
|
end: t[e].end
|
|
@@ -3015,35 +3195,35 @@ ${Nt}
|
|
|
3015
3195
|
t,
|
|
3016
3196
|
s,
|
|
3017
3197
|
n
|
|
3018
|
-
]), l =
|
|
3019
|
-
|
|
3198
|
+
]), l = T(0), [u, d] = E(0);
|
|
3199
|
+
C(() => {
|
|
3020
3200
|
let e = typeof n == "number" ? n : 0, t = l.current;
|
|
3021
|
-
l.current = e, e < t -
|
|
3201
|
+
l.current = e, e < t - vn && d((e) => e + 1);
|
|
3022
3202
|
}, [n]);
|
|
3023
|
-
let [f, p] =
|
|
3024
|
-
return
|
|
3203
|
+
let [f, p] = E(!1), m = c ? `${c.kind}@${c.end}` : "";
|
|
3204
|
+
return C(() => {
|
|
3025
3205
|
if (!m) {
|
|
3026
3206
|
p(!1);
|
|
3027
3207
|
return;
|
|
3028
3208
|
}
|
|
3029
3209
|
p(!0);
|
|
3030
|
-
let e = setTimeout(() => p(!1),
|
|
3210
|
+
let e = setTimeout(() => p(!1), _n);
|
|
3031
3211
|
return () => clearTimeout(e);
|
|
3032
|
-
}, [m, u]),
|
|
3212
|
+
}, [m, u]), C(() => {
|
|
3033
3213
|
c || p(!1);
|
|
3034
|
-
}, [c]), c ? /* @__PURE__ */
|
|
3035
|
-
css:
|
|
3214
|
+
}, [c]), c ? /* @__PURE__ */ F("div", {
|
|
3215
|
+
css: bn,
|
|
3036
3216
|
className: f && !i ? "show" : "",
|
|
3037
|
-
children: /* @__PURE__ */
|
|
3217
|
+
children: /* @__PURE__ */ F("button", {
|
|
3038
3218
|
type: "button",
|
|
3039
3219
|
className: "skip-chapter",
|
|
3040
3220
|
onClick: () => {
|
|
3041
3221
|
p(!1), r ? r(c.end) : a.seek(c.end);
|
|
3042
3222
|
},
|
|
3043
|
-
children: o(
|
|
3223
|
+
children: o(yn[c.kind])
|
|
3044
3224
|
})
|
|
3045
3225
|
}) : null;
|
|
3046
|
-
},
|
|
3226
|
+
}, Sn = 3e3, Cn = O`
|
|
3047
3227
|
position: absolute;
|
|
3048
3228
|
inset: 0;
|
|
3049
3229
|
z-index: 2;
|
|
@@ -3054,10 +3234,10 @@ ${Nt}
|
|
|
3054
3234
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
3055
3235
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
3056
3236
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
3057
|
-
`,
|
|
3237
|
+
`, wn = (e, t) => {
|
|
3058
3238
|
let n = e.left - t.left, r = e.top - t.top;
|
|
3059
3239
|
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')`;
|
|
3060
|
-
},
|
|
3240
|
+
}, Tn = O`
|
|
3061
3241
|
position: relative;
|
|
3062
3242
|
background-color: black;
|
|
3063
3243
|
display: flex;
|
|
@@ -3114,308 +3294,363 @@ ${Nt}
|
|
|
3114
3294
|
&.hide {
|
|
3115
3295
|
cursor: none;
|
|
3116
3296
|
}
|
|
3117
|
-
`,
|
|
3118
|
-
let r = `${t}${
|
|
3119
|
-
return
|
|
3297
|
+
`, En = (e, t = "") => _.toArray(e).flatMap((e, n) => {
|
|
3298
|
+
let r = `${t}${b(e) && e.key != null ? e.key : n}`;
|
|
3299
|
+
return b(e) && e.type === v ? En(e.props.children, `${r}/`) : [{
|
|
3120
3300
|
key: r,
|
|
3121
3301
|
item: e
|
|
3122
3302
|
}];
|
|
3123
|
-
}),
|
|
3124
|
-
let
|
|
3303
|
+
}), Dn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, fullscreen: o, endingOffered: s, episodeNavigation: c, children: l }) => {
|
|
3304
|
+
let u = X(), d = X((e) => e.hideUI), f = X((e) => e.setHideUI), p = X((e) => e.hasMedia), m = X((e) => e.passThroughPictureInPicture), h = T(void 0), g = T("mouse"), _ = T({
|
|
3125
3305
|
x: -1,
|
|
3126
3306
|
y: -1
|
|
3127
|
-
}),
|
|
3128
|
-
|
|
3129
|
-
let e =
|
|
3307
|
+
}), v = T(!1), y = T(null);
|
|
3308
|
+
C(() => () => clearTimeout(h.current), []), C(() => {
|
|
3309
|
+
let e = y.current;
|
|
3130
3310
|
if (!e) return;
|
|
3131
3311
|
let t = new ResizeObserver(([t]) => e.style.setProperty("--mp-height", `${t.contentRect.height}px`));
|
|
3132
3312
|
return t.observe(e), () => t.disconnect();
|
|
3133
|
-
}, []),
|
|
3134
|
-
|
|
3135
|
-
}, [
|
|
3136
|
-
let
|
|
3137
|
-
|
|
3138
|
-
},
|
|
3139
|
-
|
|
3140
|
-
},
|
|
3141
|
-
if (
|
|
3142
|
-
if (
|
|
3143
|
-
let { x: e, y: t } =
|
|
3144
|
-
if (!
|
|
3313
|
+
}, []), C(() => {
|
|
3314
|
+
p || (clearTimeout(h.current), f(!1));
|
|
3315
|
+
}, [p, f]);
|
|
3316
|
+
let b = () => {
|
|
3317
|
+
p && f(!0);
|
|
3318
|
+
}, x = (t) => {
|
|
3319
|
+
y.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
|
|
3320
|
+
}, S = () => {
|
|
3321
|
+
if (u.passThroughPictureInPicture?.armed) return !0;
|
|
3322
|
+
if (g.current !== "mouse") return !1;
|
|
3323
|
+
let { x: e, y: t } = _.current;
|
|
3324
|
+
if (!y.current || e < 0) return !1;
|
|
3145
3325
|
let n = document.elementFromPoint(e, t);
|
|
3146
|
-
return !n || !
|
|
3147
|
-
},
|
|
3148
|
-
if (
|
|
3149
|
-
|
|
3326
|
+
return !n || !y.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || v.current || !!y.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
3327
|
+
}, w = () => {
|
|
3328
|
+
if (S()) {
|
|
3329
|
+
h.current = setTimeout(w, Sn);
|
|
3150
3330
|
return;
|
|
3151
3331
|
}
|
|
3152
|
-
|
|
3153
|
-
},
|
|
3154
|
-
|
|
3155
|
-
},
|
|
3156
|
-
|
|
3332
|
+
b();
|
|
3333
|
+
}, E = () => {
|
|
3334
|
+
f(!1), clearTimeout(h.current), h.current = setTimeout(w, Sn);
|
|
3335
|
+
}, D = (e) => {
|
|
3336
|
+
g.current = e.pointerType, e.pointerType === "mouse" && (_.current = {
|
|
3157
3337
|
x: e.clientX,
|
|
3158
3338
|
y: e.clientY
|
|
3159
|
-
},
|
|
3160
|
-
},
|
|
3161
|
-
|
|
3162
|
-
},
|
|
3163
|
-
|
|
3164
|
-
},
|
|
3165
|
-
return /* @__PURE__ */
|
|
3166
|
-
css:
|
|
3167
|
-
ref:
|
|
3168
|
-
onPointerMove:
|
|
3169
|
-
onPointerDown:
|
|
3170
|
-
onPointerUp:
|
|
3171
|
-
onPointerCancel:
|
|
3339
|
+
}, E());
|
|
3340
|
+
}, O = (e) => {
|
|
3341
|
+
g.current = e.pointerType, v.current = !0;
|
|
3342
|
+
}, k = () => {
|
|
3343
|
+
v.current = !1;
|
|
3344
|
+
}, A = T(!0);
|
|
3345
|
+
return /* @__PURE__ */ I("div", {
|
|
3346
|
+
css: Tn,
|
|
3347
|
+
ref: x,
|
|
3348
|
+
onPointerMove: D,
|
|
3349
|
+
onPointerDown: O,
|
|
3350
|
+
onPointerUp: k,
|
|
3351
|
+
onPointerCancel: k,
|
|
3172
3352
|
onMouseOut: (e) => {
|
|
3173
3353
|
let t = e.relatedTarget;
|
|
3174
3354
|
if (t && e.currentTarget.contains(t)) return;
|
|
3175
3355
|
let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
|
|
3176
|
-
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(
|
|
3356
|
+
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(h.current), b());
|
|
3177
3357
|
},
|
|
3178
|
-
className:
|
|
3358
|
+
className: d ? "hide" : "",
|
|
3179
3359
|
tabIndex: a === "player" ? -1 : void 0,
|
|
3180
3360
|
children: [
|
|
3181
|
-
/* @__PURE__ */
|
|
3182
|
-
|
|
3183
|
-
css:
|
|
3184
|
-
style: { ...
|
|
3361
|
+
/* @__PURE__ */ F(vt, { onSubtitleRef: n }),
|
|
3362
|
+
En(r).map(({ key: e, item: t }) => /* @__PURE__ */ F("div", {
|
|
3363
|
+
css: Cn,
|
|
3364
|
+
style: { ...d ? {
|
|
3185
3365
|
opacity: "0",
|
|
3186
3366
|
visibility: "hidden",
|
|
3187
3367
|
pointerEvents: "none"
|
|
3188
3368
|
} : {} },
|
|
3189
3369
|
children: t
|
|
3190
3370
|
}, e)),
|
|
3191
|
-
i === !1 ? null : /* @__PURE__ */
|
|
3371
|
+
i === !1 ? null : /* @__PURE__ */ F(kt, {
|
|
3192
3372
|
value: !!o,
|
|
3193
|
-
children: /* @__PURE__ */
|
|
3373
|
+
children: /* @__PURE__ */ F(fn, {
|
|
3194
3374
|
shortcuts: a,
|
|
3195
|
-
root:
|
|
3196
|
-
fullscreen: o
|
|
3375
|
+
root: y,
|
|
3376
|
+
fullscreen: o,
|
|
3377
|
+
episodeNavigation: c
|
|
3197
3378
|
})
|
|
3198
3379
|
}),
|
|
3199
|
-
/* @__PURE__ */
|
|
3200
|
-
/* @__PURE__ */
|
|
3201
|
-
|
|
3380
|
+
/* @__PURE__ */ F(hn, {}),
|
|
3381
|
+
/* @__PURE__ */ F(xn, { endingOffered: s }),
|
|
3382
|
+
m?.armed && y.current ? /* @__PURE__ */ F("div", {
|
|
3202
3383
|
className: "pass-through",
|
|
3203
|
-
style: { clipPath:
|
|
3204
|
-
onPointerOver:
|
|
3384
|
+
style: { clipPath: wn(m.armed, y.current.getBoundingClientRect()) },
|
|
3385
|
+
onPointerOver: m.disarm
|
|
3205
3386
|
}) : null,
|
|
3206
|
-
/* @__PURE__ */
|
|
3387
|
+
/* @__PURE__ */ I("div", {
|
|
3207
3388
|
className: "video",
|
|
3208
3389
|
onClick: (e) => {
|
|
3209
|
-
if (
|
|
3390
|
+
if (g.current === "mouse") {
|
|
3210
3391
|
if (e.detail > 1) return;
|
|
3211
|
-
|
|
3392
|
+
A.current = u.paused, u.togglePaused();
|
|
3212
3393
|
return;
|
|
3213
3394
|
}
|
|
3214
|
-
|
|
3395
|
+
d ? E() : (clearTimeout(h.current), b());
|
|
3215
3396
|
},
|
|
3216
3397
|
onDoubleClick: () => {
|
|
3217
|
-
|
|
3398
|
+
g.current === "mouse" && (A.current ? u.pause() : u.play().catch(() => {}), o ? o.request() : u.toggleFullscreen());
|
|
3218
3399
|
},
|
|
3219
|
-
children: [t ? /* @__PURE__ */
|
|
3400
|
+
children: [t ? /* @__PURE__ */ F("video", {
|
|
3220
3401
|
ref: t,
|
|
3221
3402
|
playsInline: !0
|
|
3222
|
-
}) : null,
|
|
3403
|
+
}) : null, l]
|
|
3223
3404
|
})
|
|
3224
3405
|
]
|
|
3225
3406
|
});
|
|
3226
|
-
},
|
|
3227
|
-
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read:
|
|
3228
|
-
|
|
3229
|
-
let { expose: D } = e, [O, k] =
|
|
3407
|
+
}, On = (e, t) => ({ title: e.options.find((e) => e.id === t)?.label }), kn = (e, t) => e instanceof Promise ? e.then(t) : t(), An = ({ options: e, children: t }) => {
|
|
3408
|
+
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead: p, thumbnailsEnabled: m, readsDownload: h } = r ?? {}, g = M(), _ = j(), [v, y] = E(null), [b, x] = E(null), S = n?.media ?? v;
|
|
3409
|
+
C(() => (g?.(S), () => g?.(null)), [S, g]), Be(S, n?.stepFrame);
|
|
3410
|
+
let { expose: D } = e, [O, k] = E(null), [A, N] = E(!0), [ee, te] = E(null), [P, I] = E(e.autoplayNext), [ne, L] = E(void 0), [R, z] = E(void 0), [B, V] = E(null), [H, U] = E(0), W = T(/* @__PURE__ */ new Map()), [G] = E(() => Object.assign(new EventTarget(), {
|
|
3230
3411
|
chapters: [],
|
|
3231
3412
|
endingOffered: !0,
|
|
3232
3413
|
autoplayNext: null,
|
|
3233
3414
|
onHostFullscreen: k,
|
|
3234
3415
|
onEndingOffered: N,
|
|
3235
3416
|
onAutoplayNext: (e) => {
|
|
3236
|
-
|
|
3417
|
+
te(e), e !== null && I(e);
|
|
3418
|
+
},
|
|
3419
|
+
onPreviousEpisode: (e) => L(e),
|
|
3420
|
+
onNextEpisode: (e) => z(e),
|
|
3421
|
+
onExternalSubtitles: (e) => {
|
|
3422
|
+
if (e === null) {
|
|
3423
|
+
for (let { reject: e } of W.current.values()) e(/* @__PURE__ */ Error("External subtitle host disconnected"));
|
|
3424
|
+
W.current.clear();
|
|
3425
|
+
} else {
|
|
3426
|
+
let t = new Set(e.map((e) => e.id));
|
|
3427
|
+
for (let [e, n] of [...W.current.entries()]) t.has(e) || (W.current.delete(e), n.reject(/* @__PURE__ */ Error("External subtitle track was removed")));
|
|
3428
|
+
}
|
|
3429
|
+
V(e), U((e) => e + 1);
|
|
3430
|
+
},
|
|
3431
|
+
onProvideExternalSubtitle: (e, t, n) => {
|
|
3432
|
+
let r = W.current.get(e);
|
|
3433
|
+
r && (W.current.delete(e), t !== null && !n ? r.resolve(t) : r.reject(Error(n ?? "External subtitle track failed to load")));
|
|
3237
3434
|
}
|
|
3238
|
-
}))
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3435
|
+
}));
|
|
3436
|
+
C(() => () => {
|
|
3437
|
+
for (let { reject: e } of W.current.values()) e(/* @__PURE__ */ Error("Player unmounted"));
|
|
3438
|
+
W.current.clear();
|
|
3439
|
+
}, []);
|
|
3440
|
+
let K = D === !0 ? {} : D || void 0, q = T(K);
|
|
3441
|
+
q.current = K;
|
|
3442
|
+
let J = K ? K.id : void 0, Y = K ? K.origin : void 0, re = K ? K.channel : void 0;
|
|
3443
|
+
C(() => {
|
|
3444
|
+
if (!D || !S) return;
|
|
3243
3445
|
let e, t = !1;
|
|
3244
3446
|
return import("./remote/index.js").then(({ exposePlayer: n }) => {
|
|
3245
|
-
t || (e = n(
|
|
3246
|
-
...
|
|
3247
|
-
player:
|
|
3447
|
+
t || (e = n(S, {
|
|
3448
|
+
...q.current,
|
|
3449
|
+
player: G
|
|
3248
3450
|
}));
|
|
3249
3451
|
}).catch(() => {}), () => {
|
|
3250
3452
|
t = !0, e?.();
|
|
3251
3453
|
};
|
|
3252
3454
|
}, [
|
|
3253
|
-
|
|
3455
|
+
S,
|
|
3254
3456
|
!!D,
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3457
|
+
J,
|
|
3458
|
+
Y,
|
|
3459
|
+
re
|
|
3258
3460
|
]);
|
|
3259
|
-
let
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
}, [
|
|
3263
|
-
let
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
}, [
|
|
3267
|
-
let
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
}, [
|
|
3271
|
-
let
|
|
3461
|
+
let ie = X((e) => e.chapters), ae = JSON.stringify(ie);
|
|
3462
|
+
C(() => {
|
|
3463
|
+
G.chapters = ie, G.endingOffered = A, G.dispatchEvent(new Event("chapterschange"));
|
|
3464
|
+
}, [ae, A]);
|
|
3465
|
+
let oe = e.autoplayNext;
|
|
3466
|
+
C(() => {
|
|
3467
|
+
ee === null && I(oe);
|
|
3468
|
+
}, [oe, ee]);
|
|
3469
|
+
let se = T(e.onAutoplayNextChange);
|
|
3470
|
+
se.current = e.onAutoplayNextChange, C(() => {
|
|
3471
|
+
G.autoplayNext = P ?? null, G.dispatchEvent(new Event("autoplaynextchange"));
|
|
3472
|
+
}, [P]);
|
|
3473
|
+
let ce = e.fullscreen ?? (O === null ? void 0 : {
|
|
3272
3474
|
active: O,
|
|
3273
|
-
request: () =>
|
|
3274
|
-
}),
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3475
|
+
request: () => G.dispatchEvent(new Event("fullscreenrequest"))
|
|
3476
|
+
}), le = w(() => {
|
|
3477
|
+
let t = (e, t, n) => e === void 0 ? t : e === !1 || e === null ? null : {
|
|
3478
|
+
...typeof e == "string" && e ? { title: e } : {},
|
|
3479
|
+
request: () => G.dispatchEvent(new Event(n))
|
|
3480
|
+
}, n = t(ne, e.episodeNavigation?.previous, "previousrequest"), r = t(R, e.episodeNavigation?.next, "nextrequest");
|
|
3481
|
+
return n !== void 0 || r !== void 0 ? {
|
|
3482
|
+
previous: n,
|
|
3483
|
+
next: r
|
|
3484
|
+
} : void 0;
|
|
3485
|
+
}, [
|
|
3486
|
+
ne,
|
|
3487
|
+
R,
|
|
3488
|
+
e.episodeNavigation,
|
|
3489
|
+
G
|
|
3490
|
+
]), ue = w(() => {
|
|
3491
|
+
if (B) return B.map((e) => ({
|
|
3492
|
+
id: e.id,
|
|
3493
|
+
language: e.language,
|
|
3494
|
+
label: e.label,
|
|
3495
|
+
format: e.format,
|
|
3496
|
+
...e.content === void 0 ? {} : { content: e.content },
|
|
3497
|
+
load: e.content === void 0 ? () => new Promise((t, n) => {
|
|
3498
|
+
let r = W.current.get(e.id);
|
|
3499
|
+
r && r.reject(/* @__PURE__ */ Error("Replaced by a newer subtitle load request")), W.current.set(e.id, {
|
|
3500
|
+
resolve: t,
|
|
3501
|
+
reject: n
|
|
3502
|
+
}), G.dispatchEvent(new CustomEvent("subtitleloadrequest", { detail: { trackId: e.id } }));
|
|
3503
|
+
}) : void 0
|
|
3504
|
+
}));
|
|
3505
|
+
}, [B, G]), de = w(() => r ? ue === void 0 ? r : {
|
|
3506
|
+
...r,
|
|
3507
|
+
externalSubtitles: ue
|
|
3508
|
+
} : null, [r, ue]), fe = w(() => lt(), [o]);
|
|
3509
|
+
Ie(v, b, de, h ? fe.push : void 0, H);
|
|
3510
|
+
let pe = r?.normalizeVolume ?? !0, [me, he] = E(pe);
|
|
3511
|
+
C(() => {
|
|
3512
|
+
he(pe);
|
|
3513
|
+
}, [pe]);
|
|
3514
|
+
let ge = T(r?.onNormalizeVolumeChange);
|
|
3515
|
+
ge.current = r?.onNormalizeVolumeChange;
|
|
3516
|
+
let _e = r?.normalizerWorkletUrl, ve = T(p ?? u);
|
|
3517
|
+
ve.current = p ?? u;
|
|
3518
|
+
let ye = X((e) => e.selectedAudioTrack), be = !!u, { refused: xe } = ct(v, _e, me, w(() => be && o && c && l && typeof ye == "number" && ye >= 0 ? h ? {
|
|
3519
|
+
tap: fe,
|
|
3520
|
+
audioStreamIndex: ye
|
|
3287
3521
|
} : {
|
|
3288
|
-
read: (e, t) =>
|
|
3522
|
+
read: (e, t) => ve.current(e, t),
|
|
3289
3523
|
length: o,
|
|
3290
3524
|
publicPath: c,
|
|
3291
3525
|
libavWorkerUrl: l,
|
|
3292
|
-
audioStreamIndex:
|
|
3526
|
+
audioStreamIndex: ye
|
|
3293
3527
|
} : void 0, [
|
|
3294
|
-
|
|
3528
|
+
be,
|
|
3295
3529
|
o,
|
|
3296
3530
|
c,
|
|
3297
3531
|
l,
|
|
3298
|
-
|
|
3532
|
+
ye,
|
|
3299
3533
|
h,
|
|
3300
|
-
|
|
3301
|
-
]),
|
|
3302
|
-
enabled:
|
|
3303
|
-
available: !
|
|
3534
|
+
fe
|
|
3535
|
+
]), w(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), Se = w(() => _e && typeof AudioWorkletNode == "function" ? {
|
|
3536
|
+
enabled: me,
|
|
3537
|
+
available: !xe,
|
|
3304
3538
|
setEnabled: (e) => {
|
|
3305
|
-
|
|
3539
|
+
he(e), ge.current?.(e);
|
|
3306
3540
|
}
|
|
3307
3541
|
} : null, [
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
]), { thumbnails:
|
|
3542
|
+
_e,
|
|
3543
|
+
me,
|
|
3544
|
+
xe
|
|
3545
|
+
]), { thumbnails: Z, requestThumbnail: Ce } = Ge({
|
|
3312
3546
|
publicPath: c,
|
|
3313
3547
|
workerUrl: l,
|
|
3314
3548
|
length: m === !1 ? void 0 : o,
|
|
3315
|
-
read: p ??
|
|
3549
|
+
read: p ?? u,
|
|
3316
3550
|
downloadedRanges: s
|
|
3317
|
-
}),
|
|
3318
|
-
|
|
3319
|
-
|
|
3551
|
+
}), we = n?.thumbnails?.all ?? Z, { toggle: Te, mode: Ee, burnedIn: De } = Ke(v, b), Oe = Qe(n?.media ?? null, n?.pictureInPicture), Q = X((e) => e.setSourceState), ke = n ? !!n.media : o !== void 0;
|
|
3552
|
+
C(() => {
|
|
3553
|
+
Q({
|
|
3320
3554
|
title: i,
|
|
3321
3555
|
size: o,
|
|
3322
3556
|
downloadedRanges: s,
|
|
3323
|
-
hasMedia:
|
|
3557
|
+
hasMedia: ke
|
|
3324
3558
|
});
|
|
3325
3559
|
}, [
|
|
3326
|
-
|
|
3560
|
+
Q,
|
|
3327
3561
|
i,
|
|
3328
3562
|
o,
|
|
3329
3563
|
s,
|
|
3330
|
-
|
|
3564
|
+
ke
|
|
3331
3565
|
]);
|
|
3332
|
-
let
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
thumbnails:
|
|
3336
|
-
thumbnailAt:
|
|
3337
|
-
requestThumbnail:
|
|
3338
|
-
togglePictureInPicture:
|
|
3339
|
-
pictureInPictureMode:
|
|
3340
|
-
burnedInSubtitles:
|
|
3566
|
+
let Ae = n?.thumbnails?.at;
|
|
3567
|
+
C(() => {
|
|
3568
|
+
Q({
|
|
3569
|
+
thumbnails: we,
|
|
3570
|
+
thumbnailAt: Ae,
|
|
3571
|
+
requestThumbnail: Ce,
|
|
3572
|
+
togglePictureInPicture: Te,
|
|
3573
|
+
pictureInPictureMode: Ee,
|
|
3574
|
+
burnedInSubtitles: De
|
|
3341
3575
|
});
|
|
3342
3576
|
}, [
|
|
3343
|
-
Z,
|
|
3344
|
-
pe,
|
|
3345
3577
|
Q,
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3578
|
+
we,
|
|
3579
|
+
Ae,
|
|
3580
|
+
Ce,
|
|
3581
|
+
Te,
|
|
3582
|
+
Ee,
|
|
3583
|
+
De
|
|
3584
|
+
]), C(() => {
|
|
3585
|
+
Q({ volumeNormalizer: Se });
|
|
3586
|
+
}, [Q, Se]), C(() => {
|
|
3587
|
+
Q({ autoplayNext: P === void 0 ? null : {
|
|
3588
|
+
enabled: P,
|
|
3355
3589
|
setEnabled: (e) => {
|
|
3356
|
-
|
|
3590
|
+
I(e), se.current?.(e);
|
|
3357
3591
|
}
|
|
3358
3592
|
} });
|
|
3359
|
-
}, [
|
|
3360
|
-
|
|
3361
|
-
}, [
|
|
3362
|
-
let
|
|
3593
|
+
}, [Q, P]), C(() => {
|
|
3594
|
+
Q({ passThroughPictureInPicture: Oe });
|
|
3595
|
+
}, [Q, Oe]);
|
|
3596
|
+
let je = n?.subtitles?.selection, Me = n?.audioTracks?.selection, Ne = T({
|
|
3363
3597
|
options: e,
|
|
3364
|
-
audio:
|
|
3598
|
+
audio: Me
|
|
3365
3599
|
});
|
|
3366
|
-
|
|
3600
|
+
Ne.current = {
|
|
3367
3601
|
options: e,
|
|
3368
|
-
audio:
|
|
3369
|
-
},
|
|
3370
|
-
|
|
3371
|
-
subtitleTracks:
|
|
3602
|
+
audio: Me
|
|
3603
|
+
}, C(() => {
|
|
3604
|
+
je && Q({
|
|
3605
|
+
subtitleTracks: je.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3372
3606
|
id: e,
|
|
3373
3607
|
label: t,
|
|
3374
3608
|
disabled: n
|
|
3375
3609
|
})),
|
|
3376
|
-
selectedSubtitleTrack:
|
|
3610
|
+
selectedSubtitleTrack: je.selectedId ?? void 0,
|
|
3377
3611
|
selectSubtitleTrack: (e) => {
|
|
3378
|
-
let t = e == null ? null : String(e), n = t === null ? void 0 :
|
|
3379
|
-
return
|
|
3380
|
-
let e = t === null ? null :
|
|
3612
|
+
let t = e == null ? null : String(e), n = t === null ? void 0 : On(je, t), r = je.selectedId === null;
|
|
3613
|
+
return kn(je.select(t), () => {
|
|
3614
|
+
let e = t === null ? null : d(n) ?? (r ? n?.title : void 0), i = Ne.current;
|
|
3381
3615
|
e !== void 0 && i.options.onPreferredSubtitleLanguageChange?.(e);
|
|
3382
|
-
let a = i.audio &&
|
|
3383
|
-
e &&
|
|
3616
|
+
let a = i.audio && On(i.audio, i.audio.selectedId ?? "");
|
|
3617
|
+
e && f(a, e) && i.options.onAlwaysShowSubtitlesChange?.(!0);
|
|
3384
3618
|
});
|
|
3385
3619
|
},
|
|
3386
|
-
subtitleOffLabel:
|
|
3620
|
+
subtitleOffLabel: je.offLabel
|
|
3387
3621
|
});
|
|
3388
|
-
}, [
|
|
3389
|
-
|
|
3390
|
-
audioTracks:
|
|
3622
|
+
}, [Q, je]), C(() => {
|
|
3623
|
+
Me && Q({
|
|
3624
|
+
audioTracks: Me.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3391
3625
|
id: e,
|
|
3392
3626
|
label: t,
|
|
3393
3627
|
disabled: n
|
|
3394
3628
|
})),
|
|
3395
|
-
selectedAudioTrack:
|
|
3396
|
-
selectAudioTrack: (e) =>
|
|
3397
|
-
let t =
|
|
3398
|
-
t !== void 0 &&
|
|
3629
|
+
selectedAudioTrack: Me.selectedId ?? void 0,
|
|
3630
|
+
selectAudioTrack: (e) => kn(Me.select(String(e)), () => {
|
|
3631
|
+
let t = d(On(Me, String(e)));
|
|
3632
|
+
t !== void 0 && Ne.current.options.onPreferredAudioLanguageChange?.(t);
|
|
3399
3633
|
})
|
|
3400
3634
|
});
|
|
3401
|
-
}, [
|
|
3402
|
-
let
|
|
3403
|
-
return
|
|
3404
|
-
|
|
3405
|
-
}, [
|
|
3406
|
-
a &&
|
|
3407
|
-
}, [
|
|
3635
|
+
}, [Q, Me]);
|
|
3636
|
+
let Pe = n?.quality?.selection ?? null;
|
|
3637
|
+
return C(() => {
|
|
3638
|
+
Q({ quality: Pe });
|
|
3639
|
+
}, [Q, Pe]), C(() => {
|
|
3640
|
+
a && Q({ chapters: a });
|
|
3641
|
+
}, [Q, a]), /* @__PURE__ */ F(Dn, {
|
|
3408
3642
|
ref: _,
|
|
3409
3643
|
onVideoRef: n ? void 0 : y,
|
|
3410
3644
|
onSubtitleRef: x,
|
|
3411
3645
|
overlay: e.overlay,
|
|
3412
3646
|
controls: e.controls,
|
|
3413
3647
|
shortcuts: e.shortcuts,
|
|
3414
|
-
fullscreen:
|
|
3415
|
-
endingOffered:
|
|
3648
|
+
fullscreen: ce,
|
|
3649
|
+
endingOffered: A,
|
|
3650
|
+
episodeNavigation: le,
|
|
3416
3651
|
children: t
|
|
3417
3652
|
});
|
|
3418
|
-
},
|
|
3653
|
+
}, jn = O`
|
|
3419
3654
|
/**
|
|
3420
3655
|
* The chrome's whole scale, in one place.
|
|
3421
3656
|
*
|
|
@@ -3485,20 +3720,20 @@ ${Nt}
|
|
|
3485
3720
|
height: 100%;
|
|
3486
3721
|
width: 100%;
|
|
3487
3722
|
overflow: hidden;
|
|
3488
|
-
`,
|
|
3489
|
-
css:
|
|
3490
|
-
children: /* @__PURE__ */
|
|
3723
|
+
`, Mn = (e) => /* @__PURE__ */ F("div", {
|
|
3724
|
+
css: jn,
|
|
3725
|
+
children: /* @__PURE__ */ F(de.Provider, { children: /* @__PURE__ */ F(Ce, {
|
|
3491
3726
|
language: e.language,
|
|
3492
|
-
children: /* @__PURE__ */
|
|
3727
|
+
children: /* @__PURE__ */ F(An, {
|
|
3493
3728
|
options: e,
|
|
3494
3729
|
children: e.children
|
|
3495
3730
|
})
|
|
3496
3731
|
}) })
|
|
3497
|
-
}),
|
|
3732
|
+
}), Nn = (e) => !!e && typeof e == "object" && "at" in e, Pn = (e) => !!e && typeof e == "object" && "selection" in e, Fn = ({ blob: e, name: t }) => ({
|
|
3498
3733
|
length: e.size,
|
|
3499
3734
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
3500
3735
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
3501
|
-
}),
|
|
3736
|
+
}), In = async (e, t) => {
|
|
3502
3737
|
let n = await fetch(e, {
|
|
3503
3738
|
headers: { Range: "bytes=0-1" },
|
|
3504
3739
|
credentials: t
|
|
@@ -3508,8 +3743,8 @@ ${Nt}
|
|
|
3508
3743
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
3509
3744
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
3510
3745
|
return i;
|
|
3511
|
-
},
|
|
3512
|
-
let i = t ?? await
|
|
3746
|
+
}, Ln = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3747
|
+
let i = t ?? await In(e, r);
|
|
3513
3748
|
return {
|
|
3514
3749
|
length: i,
|
|
3515
3750
|
name: n,
|
|
@@ -3525,9 +3760,9 @@ ${Nt}
|
|
|
3525
3760
|
},
|
|
3526
3761
|
readsDownload: !0
|
|
3527
3762
|
};
|
|
3528
|
-
},
|
|
3529
|
-
if ("blob" in e) return
|
|
3530
|
-
if ("url" in e) return
|
|
3763
|
+
}, Rn = async (e) => {
|
|
3764
|
+
if ("blob" in e) return Fn(e);
|
|
3765
|
+
if ("url" in e) return Ln(e);
|
|
3531
3766
|
if ("read" in e) return {
|
|
3532
3767
|
length: e.length,
|
|
3533
3768
|
name: e.name,
|
|
@@ -3536,4 +3771,4 @@ ${Nt}
|
|
|
3536
3771
|
throw Error(`Unknown source type: ${e}`);
|
|
3537
3772
|
};
|
|
3538
3773
|
//#endregion
|
|
3539
|
-
export {
|
|
3774
|
+
export { Mn as MediaPlayer, Mn as default, de as Player, u as SUBTITLES_OFF, l as createPictureInPicture, t as createSubtitleRenderer, s as createThumbnailGenerator, Rn as inputToRemuxerInput, Pn as isDelegatedTracks, Nn as isExternalThumbnails, ue as sourceFeature, e as startPlayback, r as toAssSubtitles, Ke as usePictureInPicture, X as usePlayer, Ge as useSeekThumbnails };
|