@banou/media-player 0.10.8 → 0.10.10

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/index.js CHANGED
@@ -3,11 +3,12 @@ import { Children as s, Fragment as c, isValidElement as l, useCallback as u, us
3
3
  import { css as g, keyframes as _ } from "@emotion/react";
4
4
  import { createPlayer as v, useContainerAttach as y, useMediaAttach as b } from "@videojs/react";
5
5
  import { definePlayerFeature as x, videoFeatures as S } from "@videojs/core/dom";
6
- import { Fragment as C, jsx as w, jsxs as T } from "@emotion/react/jsx-runtime";
7
- import { AlertTriangle as E, Check as D, ChevronLeft as O, ChevronRight as k, Copy as A, Maximize as j, Minimize as M, Pause as N, Play as P, RotateCcw as F, Settings as I, Volume1 as L, Volume2 as R, VolumeX as z } from "react-feather";
8
- import { Tooltip as ee } from "react-tooltip";
6
+ import { createMediaElementSource as C } from "@banou/ponyfill/web-audio";
7
+ import { Fragment as w, jsx as T, jsxs as E } from "@emotion/react/jsx-runtime";
8
+ import { Captions as D, CaptionsOff as O, Check as k, ChevronLeft as A, ChevronRight as j, Copy as M, Maximize as N, Minimize as P, Pause as F, Play as I, RotateCcw as L, Settings as R, TriangleAlert as z, Volume1 as ee, Volume2 as B, VolumeX as V } from "lucide-react";
9
+ import { Tooltip as H } from "react-tooltip";
9
10
  //#region src/lib/react/source-feature.ts
10
- var B = {
11
+ var te = {
11
12
  indexes: [],
12
13
  chapters: [],
13
14
  thumbnails: [],
@@ -26,23 +27,24 @@ var B = {
26
27
  passThroughPictureInPicture: null,
27
28
  pictureInPictureMode: null,
28
29
  burnedInSubtitles: !1,
30
+ volumeNormalizer: null,
29
31
  playbackError: null,
30
32
  playbackErrors: [],
31
33
  ready: !1,
32
34
  setSourceState: () => {}
33
- }, V = x({
35
+ }, U = x({
34
36
  name: "source",
35
- state: () => ({ ...B }),
37
+ state: () => ({ ...te }),
36
38
  attach({ set: e }) {
37
39
  e({
38
40
  setSourceState: (t) => e(t),
39
41
  setHideUI: (t) => e({ hideUI: t })
40
42
  });
41
43
  }
42
- }), H = v({
43
- features: [...S, V],
44
+ }), W = v({
45
+ features: [...S, U],
44
46
  displayName: "MediaPlayer"
45
- }), U = H.usePlayer, te = (e) => {
47
+ }), G = W.usePlayer, K = (e) => {
46
48
  if (e && e !== "und") try {
47
49
  return new Intl.DisplayNames([navigator.language || "en"], {
48
50
  type: "language",
@@ -51,39 +53,39 @@ var B = {
51
53
  } catch {
52
54
  return;
53
55
  }
54
- }, ne = (e) => e?.replace(/_/g, " ").trim() || void 0, W = (e) => {
55
- let t = e.map((e) => te(e.language) ?? ne(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
56
+ }, q = (e) => e?.replace(/_/g, " ").trim() || void 0, J = (e) => {
57
+ let t = e.map((e) => K(e.language) ?? q(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
56
58
  ...e,
57
59
  [t]: (e[t] ?? 0) + 1
58
60
  }), {});
59
61
  return e.map((e, r) => {
60
- let i = t[r], a = ne(e.title);
62
+ let i = t[r], a = q(e.title);
61
63
  return {
62
64
  track: e,
63
65
  label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
64
66
  };
65
67
  });
66
- }, G = (e) => W(e).map(({ track: e, label: t }) => ({
68
+ }, Y = (e) => J(e).map(({ track: e, label: t }) => ({
67
69
  id: e.streamIndex,
68
70
  label: t
69
- })), K = [
71
+ })), X = [
70
72
  0,
71
73
  250,
72
74
  1e3,
73
75
  3e3,
74
76
  1e4
75
- ], re = 6e4, ie = 500, q = 15e3, J = (e) => e instanceof Error ? e.message : String(e), ae = (e) => {
77
+ ], ne = 6e4, re = 500, ie = 15e3, ae = (e) => e instanceof Error ? e.message : String(e), oe = (e) => {
76
78
  let t = [], n = e?.cause;
77
79
  for (let e = 0; n != null && e < 8; e++) {
78
80
  if (typeof MediaError < "u" && n instanceof MediaError) {
79
81
  t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
80
82
  break;
81
83
  }
82
- t.push(J(n)), n = n?.cause;
84
+ t.push(ae(n)), n = n?.cause;
83
85
  }
84
86
  return t.length ? t.join("\n") : void 0;
85
- }, oe = (e, t, r) => {
86
- let a = U(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, chapters: b, seekPrepareBudgetMs: x = ie } = r ?? {}, S = p(b);
87
+ }, se = (e, t, r) => {
88
+ let a = G(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: f = "", jassubWasmUrl: h = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, chapters: b, seekPrepareBudgetMs: x = re } = r ?? {}, S = p(b);
87
89
  S.current = b;
88
90
  let [C, w] = m(void 0), [T, E] = m(0), D = p({
89
91
  count: 0,
@@ -120,7 +122,7 @@ var B = {
120
122
  a.setSourceState({ seekingTo: e });
121
123
  let c = t.videoElement, l = () => {
122
124
  c?.removeEventListener("seeked", l), clearTimeout(u), a.setSourceState({ seekingTo: void 0 });
123
- }, u = setTimeout(l, q);
125
+ }, u = setTimeout(l, ie);
124
126
  c?.addEventListener("seeked", l);
125
127
  let d = setTimeout(() => {
126
128
  o = "deadline", s();
@@ -130,7 +132,7 @@ var B = {
130
132
  });
131
133
  }, [a, x]), L = u((e) => {
132
134
  typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), w(e));
133
- }, [a]), R = U((e) => e.setSourceState);
135
+ }, [a]), R = G((e) => e.setSourceState);
134
136
  d(() => {
135
137
  R({
136
138
  selectSubtitleTrack: F,
@@ -150,7 +152,7 @@ var B = {
150
152
  ready: !1
151
153
  });
152
154
  let u = (t, n) => {
153
- let r = Date.now(), i = J(t), o = ae(t), s = a.playbackErrors, c = s[s.length - 1];
155
+ let r = Date.now(), i = ae(t), o = oe(t), s = a.playbackErrors, c = s[s.length - 1];
154
156
  if (c && c.message === i && c.detail === o && c.recovered === n) {
155
157
  let e = {
156
158
  ...c,
@@ -175,11 +177,11 @@ var B = {
175
177
  let t = n(e);
176
178
  if (u(e, t), t) {
177
179
  let t = performance.now();
178
- t - D.current.at > re && (D.current = {
180
+ t - D.current.at > ne && (D.current = {
179
181
  count: 0,
180
182
  at: t
181
183
  });
182
- let n = K[Math.min(D.current.count, K.length - 1)];
184
+ let n = X[Math.min(D.current.count, X.length - 1)];
183
185
  D.current = {
184
186
  count: D.current.count + 1,
185
187
  at: t
@@ -216,13 +218,13 @@ var B = {
216
218
  onSeek: (e) => N.current?.(e),
217
219
  onSubtitleStreams: (e) => {
218
220
  r || a.setSourceState({
219
- subtitleTracks: G(e),
221
+ subtitleTracks: Y(e),
220
222
  ...j.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
221
223
  });
222
224
  },
223
225
  onAudioStreams: (e, t) => {
224
226
  r || a.setSourceState({
225
- audioTracks: G(e),
227
+ audioTracks: Y(e),
226
228
  selectedAudioTrack: t
227
229
  });
228
230
  }
@@ -262,13 +264,13 @@ var B = {
262
264
  y,
263
265
  T
264
266
  ]);
265
- }, se = 5e3, ce = 6e4, le = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
267
+ }, ce = 5e3, le = 6e4, ue = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
266
268
  let [o, s] = m([]), c = p(null), l = p(i);
267
269
  l.current = i;
268
270
  let h = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = p(h);
269
271
  return g.current = h, d(() => {
270
272
  if (!n || !i || !e || !t) return;
271
- let a = !1, o = null, u, d = se, f = () => {
273
+ let a = !1, o = null, u, d = ce, f = () => {
272
274
  r({
273
275
  publicPath: e,
274
276
  workerUrl: t,
@@ -284,7 +286,7 @@ var B = {
284
286
  }
285
287
  o = e, c.current = e, e.update(g.current);
286
288
  }, () => {
287
- a || (u = setTimeout(f, d), d = Math.min(d * 2, ce));
289
+ a || (u = setTimeout(f, d), d = Math.min(d * 2, le));
288
290
  });
289
291
  };
290
292
  return f(), () => {
@@ -302,7 +304,7 @@ var B = {
302
304
  c.current?.prioritize(e);
303
305
  }, [])
304
306
  };
305
- }, ue = (e, n) => {
307
+ }, de = (e, n) => {
306
308
  let r = p(null), [i, o] = m(!1), [s] = m(() => t());
307
309
  d(() => {
308
310
  if (!e || !n || !s) return;
@@ -330,10 +332,10 @@ var B = {
330
332
  mode: s,
331
333
  burnedIn: i
332
334
  };
333
- }, de = "(hover: hover) and (pointer: fine)", fe = () => typeof matchMedia == "function" ? matchMedia(de) : void 0, pe = (e) => {
334
- let t = fe();
335
+ }, fe = "(hover: hover) and (pointer: fine)", pe = () => typeof matchMedia == "function" ? matchMedia(fe) : void 0, me = (e) => {
336
+ let t = pe();
335
337
  return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
336
- }, me = () => !!fe()?.matches, he = () => !1, ge = (e, t) => {
338
+ }, he = () => !!pe()?.matches, ge = () => !1, _e = (e, t) => {
337
339
  let [n, r] = m(!1), [i, a] = m(), o = p(t);
338
340
  t && (o.current = t);
339
341
  let s = p(!1), c = u((e) => {
@@ -356,7 +358,7 @@ var B = {
356
358
  _,
357
359
  g
358
360
  ]);
359
- let v = h(pe, me, he), [y, b] = m(!1);
361
+ let v = h(me, he, ge), [y, b] = m(!1);
360
362
  d(() => {
361
363
  if (!_) return;
362
364
  let e = (e) => {
@@ -397,7 +399,80 @@ var B = {
397
399
  g,
398
400
  S
399
401
  ]);
400
- }, Y = {
402
+ }, ve = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
403
+ channelCountMode: "max",
404
+ processorOptions: n
405
+ })), ye = /* @__PURE__ */ new WeakMap(), be = (e) => new Promise((t, n) => {
406
+ let r = () => {
407
+ (e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
408
+ };
409
+ e.addEventListener("statechange", r), r();
410
+ }), xe = (e, t, n = {}) => {
411
+ let r = ye.get(e);
412
+ if (r) return r.wake(), r;
413
+ let i = new AudioContext(), a = n.enabled !== !1, o, s = !1, c = () => 20 * Math.log10(Math.max(e.volume, 1e-6)), l = e.ownerDocument, u = () => {
414
+ i.state === "suspended" && i.resume().catch(() => {});
415
+ }, d = (e) => {
416
+ for (let t of [
417
+ "pointerdown",
418
+ "pointerup",
419
+ "keydown"
420
+ ]) e ? l.addEventListener(t, u, !0) : l.removeEventListener(t, u, !0);
421
+ }, f = () => {
422
+ let e = !s && i.state === "suspended";
423
+ d(e), e && o && u();
424
+ };
425
+ i.addEventListener("statechange", f), f();
426
+ let p = (async () => {
427
+ let r = await ve(i, t, {
428
+ ...n,
429
+ enabled: a,
430
+ inputGainDb: c()
431
+ });
432
+ await be(i);
433
+ let s = C(i, e);
434
+ return r.port.postMessage({
435
+ enabled: a,
436
+ inputGainDb: c()
437
+ }), s.connect(r).connect(i.destination), e.addEventListener("volumechange", () => r.port.postMessage({ inputGainDb: c() })), e.addEventListener("seeking", () => r.port.postMessage({ reset: "seek" })), e.addEventListener("emptied", () => r.port.postMessage({ reset: "source" })), o = r, r;
438
+ })();
439
+ p.catch(() => {
440
+ s = !0, d(!1), i.close().catch(() => {});
441
+ });
442
+ let m = {
443
+ context: i,
444
+ routed: p,
445
+ setEnabled: (e) => {
446
+ a = e, o?.port.postMessage({ enabled: a });
447
+ },
448
+ release: () => {
449
+ s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (ye.delete(e), i.close().catch(() => {}));
450
+ },
451
+ wake: () => {
452
+ i.state !== "closed" && (s = !1, u(), f());
453
+ }
454
+ };
455
+ return ye.set(e, m), m;
456
+ }, Se = (e, t, n) => {
457
+ let r = p(null), [i, a] = m(!1);
458
+ return d(() => {
459
+ if (e && t) {
460
+ if (n && !r.current) {
461
+ let i = xe(e, t, { enabled: n });
462
+ r.current = i, i.routed.catch((e) => {
463
+ r.current === i && (console.warn("[media-player] the volume normalizer is unavailable:", e), a(!0));
464
+ });
465
+ }
466
+ r.current?.setEnabled(n);
467
+ }
468
+ }, [
469
+ e,
470
+ t,
471
+ n
472
+ ]), d(() => () => {
473
+ r.current?.release(), r.current = null;
474
+ }, [e]), { refused: i };
475
+ }, Z = {
401
476
  headings: {
402
477
  large: "\n font-weight: 600;\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(3.4 * var(--mp-unit));\n line-height: calc(4.1 * var(--mp-unit));\n }\n ",
403
478
  medium: "\n font-weight: 600;\n font-size: calc(2.4 * var(--mp-unit));\n line-height: calc(2.9 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n }\n ",
@@ -424,7 +499,7 @@ var B = {
424
499
  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 ",
425
500
  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 "
426
501
  }
427
- }, _e = g`
502
+ }, Ce = g`
428
503
  display: flex;
429
504
  justify-content: center;
430
505
  align-items: center;
@@ -437,7 +512,7 @@ var B = {
437
512
  margin: auto;
438
513
  pointer-events: none;
439
514
  }
440
- `, ve = g`
515
+ `, we = g`
441
516
  position: absolute;
442
517
  top: 0;
443
518
  left: 0;
@@ -445,7 +520,7 @@ var B = {
445
520
  padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
446
521
  /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
447
522
  padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
448
- ${Y.headings.small}
523
+ ${Z.headings.small}
449
524
  color: white;
450
525
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
451
526
  z-index: 2;
@@ -466,9 +541,9 @@ var B = {
466
541
 
467
542
  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%);
468
543
  transition: opacity 0.1s cubic-bezier(.4,0,1,1);
469
- `, ye = _`
544
+ `, Te = _`
470
545
  to { transform: rotate(360deg); }
471
- `, be = g`
546
+ `, Ee = g`
472
547
  position: absolute;
473
548
  inset: 0;
474
549
  z-index: 2;
@@ -484,46 +559,46 @@ var B = {
484
559
  border-radius: 50%;
485
560
  border: 3px solid rgba(255, 255, 255, 0.25);
486
561
  border-top-color: #fff;
487
- animation: ${ye} 0.8s linear infinite;
562
+ animation: ${Te} 0.8s linear infinite;
488
563
  }
489
- `, xe = g`
564
+ `, De = g`
490
565
  position: absolute;
491
566
  inset: auto 0 20%;
492
567
  z-index: 3;
493
568
  padding: 0 calc(2 * var(--mp-unit));
494
569
  text-align: center;
495
570
  color: #fff;
496
- ${Y.bLarge.regular}
571
+ ${Z.bLarge.regular}
497
572
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
498
573
  pointer-events: none;
499
- `, Se = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Ce = ({ onSubtitleRef: e }) => {
500
- let t = U((e) => e.title), n = U((e) => e.hideUI), r = U((e) => e.playbackError), i = U((e) => e.ready), a = U((e) => e.size), o = U((e) => e.waiting), s = U((e) => e.seekingTo);
501
- return /* @__PURE__ */ T(C, { children: [
502
- t ? /* @__PURE__ */ w("div", {
574
+ `, Oe = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", ke = ({ onSubtitleRef: e }) => {
575
+ let t = G((e) => e.title), n = G((e) => e.hideUI), r = G((e) => e.playbackError), i = G((e) => e.ready), a = G((e) => e.size), o = G((e) => e.waiting), s = G((e) => e.seekingTo);
576
+ return /* @__PURE__ */ E(w, { children: [
577
+ t ? /* @__PURE__ */ T("div", {
503
578
  className: "title",
504
- css: ve,
579
+ css: we,
505
580
  style: { ...n ? {
506
581
  opacity: "0",
507
582
  pointerEvents: "none"
508
583
  } : {} },
509
584
  children: t
510
585
  }) : void 0,
511
- ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ w("div", { css: be }) : void 0,
512
- r ? /* @__PURE__ */ w("div", {
513
- css: xe,
514
- children: Se(r)
586
+ ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ T("div", { css: Ee }) : void 0,
587
+ r ? /* @__PURE__ */ T("div", {
588
+ css: De,
589
+ children: Oe(r)
515
590
  }) : void 0,
516
- /* @__PURE__ */ w("div", {
591
+ /* @__PURE__ */ T("div", {
517
592
  className: "subtitles",
518
593
  ref: e,
519
- css: _e
594
+ css: Ce
520
595
  })
521
596
  ] });
522
- }, we = 1e-4, Te = 1, Ee = (e) => Math.max(we, Math.min(Te, e)) ** 2, De = (e) => Math.max(we, Math.min(Te, e)) ** (Te / 2), X = (e) => {
597
+ }, Ae = 1e-4, je = 1, Me = (e) => Math.max(Ae, Math.min(je, e)) ** 2, Ne = (e) => Math.max(Ae, Math.min(je, e)) ** (je / 2), Pe = (e) => {
523
598
  if (e === void 0) return "0:00";
524
599
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
525
600
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
526
- }, Oe = (e, t) => `${X(e)} / ${X(t)}`, ke = (e) => g`
601
+ }, Fe = (e, t) => `${Pe(e)} / ${Pe(t)}`, Ie = (e) => g`
527
602
  display: flex;
528
603
  justify-content: flex-start;
529
604
 
@@ -555,7 +630,7 @@ var B = {
555
630
  z-index: 3;
556
631
 
557
632
  * {
558
- ${Y.bMedium.regular}
633
+ ${Z.bMedium.regular}
559
634
  }
560
635
 
561
636
  ${e === "sm" && g`
@@ -567,32 +642,32 @@ var B = {
567
642
  ${e === "lg" && g`
568
643
  padding: calc(1.2 * var(--mp-unit))!important;
569
644
  `}
570
- `, Z = {
645
+ `, Q = {
571
646
  x: -1,
572
647
  y: -1,
573
648
  anchors: 0
574
- }, Ae = (e) => {
575
- Z.x = e.clientX, Z.y = e.clientY;
576
- }, je = () => (Z.anchors++ === 0 && window.addEventListener("pointermove", Ae, {
649
+ }, Le = (e) => {
650
+ Q.x = e.clientX, Q.y = e.clientY;
651
+ }, Re = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", Le, {
577
652
  capture: !0,
578
653
  passive: !0
579
654
  }), () => {
580
- --Z.anchors === 0 && window.removeEventListener("pointermove", Ae, { capture: !0 });
581
- }), Q = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
655
+ --Q.anchors === 0 && window.removeEventListener("pointermove", Le, { capture: !0 });
656
+ }), $ = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
582
657
  let l = p(null), u = p(null);
583
658
  return d(() => {
584
- let e = je(), t = () => {
659
+ let e = Re(), t = () => {
585
660
  let e = l.current;
586
661
  if (!e) return;
587
662
  let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
588
- Z.x >= t && Z.x < n && Z.y >= r && Z.y < i || u.current?.close();
663
+ Q.x >= t && Q.x < n && Q.y >= r && Q.y < i || u.current?.close();
589
664
  }, n = ["fullscreenchange", "webkitfullscreenchange"];
590
665
  for (let e of n) document.addEventListener(e, t);
591
666
  return () => {
592
667
  e();
593
668
  for (let e of n) document.removeEventListener(e, t);
594
669
  };
595
- }, []), /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("div", {
670
+ }, []), /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T("div", {
596
671
  ref: l,
597
672
  "data-tooltip-id": e,
598
673
  "data-open": !0,
@@ -601,14 +676,14 @@ var B = {
601
676
  "data-tooltip-delay-hide": i,
602
677
  "data-tooltip-place": o,
603
678
  children: n
604
- }), !s && /* @__PURE__ */ w(ee, {
679
+ }), !s && /* @__PURE__ */ T(H, {
605
680
  ref: u,
606
- css: ke(c),
681
+ css: Ie(c),
607
682
  id: e,
608
683
  noArrow: !0,
609
684
  children: t
610
685
  })] });
611
- }, Me = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
686
+ }, ze = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
612
687
  let [i, a] = m(!1), o = p(t);
613
688
  o.current = t;
614
689
  let s = p(null), c = u((t, r) => {
@@ -647,26 +722,26 @@ var B = {
647
722
  style: { touchAction: "none" }
648
723
  }
649
724
  };
650
- }, Ne = 2, Pe = .005, Fe = "#000", Ie = "#0000", Le = (e, t) => {
725
+ }, Be = 2, Ve = .005, He = "#000", Ue = "#0000", We = (e, t) => {
651
726
  if (!t) return [];
652
727
  let n = /* @__PURE__ */ new Set();
653
728
  for (let { start: r, end: i } of e) for (let e of [r, i]) {
654
729
  let r = e / t;
655
- r <= Pe || r >= .995 || n.add(Number((r * 100).toFixed(4)));
730
+ r <= Ve || r >= .995 || n.add(Number((r * 100).toFixed(4)));
656
731
  }
657
732
  return n.size ? [
658
733
  0,
659
734
  ...[...n].sort((e, t) => e - t),
660
735
  100
661
736
  ] : [];
662
- }, Re = (e, t) => {
663
- let n = Ne / 2, r = e.length - 2, i = [];
737
+ }, Ge = (e, t) => {
738
+ let n = Be / 2, r = e.length - 2, i = [];
664
739
  for (let a = 0; a <= r; a += 1) {
665
740
  let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
666
- i.push(`${t(a) ? Fe : Ie} ${c} ${l}`), a !== r && i.push(`${Ie} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
741
+ i.push(`${t(a) ? He : Ue} ${c} ${l}`), a !== r && i.push(`${Ue} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
667
742
  }
668
743
  return `linear-gradient(90deg, ${i.join(", ")})`;
669
- }, ze = /* @__PURE__ */ new Set([
744
+ }, Ke = /* @__PURE__ */ new Set([
670
745
  "op",
671
746
  "ops",
672
747
  "opening",
@@ -674,7 +749,7 @@ var B = {
674
749
  "ncop",
675
750
  "オープニング",
676
751
  "op主題歌"
677
- ]), Be = /* @__PURE__ */ new Set([
752
+ ]), qe = /* @__PURE__ */ new Set([
678
753
  "ed",
679
754
  "eds",
680
755
  "ending",
@@ -687,13 +762,13 @@ var B = {
687
762
  "エンドカード",
688
763
  "エンドロール",
689
764
  "ed主題歌"
690
- ]), Ve = /* @__PURE__ */ new Set(["intro", "イントロ"]), He = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Ue = {
765
+ ]), Je = /* @__PURE__ */ new Set(["intro", "イントロ"]), Ye = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Xe = {
691
766
  "credits start": "ending",
692
767
  "credits end": null,
693
768
  "preview end": null,
694
769
  "end credits": "ending",
695
770
  "closing credits": "ending"
696
- }, We = /* @__PURE__ */ new Set([
771
+ }, Ze = /* @__PURE__ */ new Set([
697
772
  "theme",
698
773
  "themes",
699
774
  "song",
@@ -712,53 +787,53 @@ var B = {
712
787
  "the",
713
788
  "主題歌",
714
789
  "ノンクレジット"
715
- ]), Ge = /* @__PURE__ */ new Set([
790
+ ]), Qe = /* @__PURE__ */ new Set([
716
791
  "post",
717
792
  "pre",
718
793
  "after",
719
794
  "before",
720
795
  "non"
721
- ]), Ke = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, qe = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), Je = (e) => e.replace(/([a-z぀-ヿ一-鿿])\s*\d+\s*$/u, "$1").split(/[\s_]+/u).map((e) => e.replace(/^[^\w぀-ヿ一-鿿]+|[^\w぀-ヿ一-鿿]+$/gu, "")).filter((e) => e && !/^\d+$/.test(e) && !We.has(e)), Ye = (e, t) => {
722
- if (ze.has(e)) return "opening";
723
- if (Be.has(e)) return "ending";
796
+ ]), $e = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, et = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), tt = (e) => e.replace(/([a-z぀-ヿ一-鿿])\s*\d+\s*$/u, "$1").split(/[\s_]+/u).map((e) => e.replace(/^[^\w぀-ヿ一-鿿]+|[^\w぀-ヿ一-鿿]+$/gu, "")).filter((e) => e && !/^\d+$/.test(e) && !Ze.has(e)), nt = (e, t) => {
797
+ if (Ke.has(e)) return "opening";
798
+ if (qe.has(e)) return "ending";
724
799
  if (t) {
725
- if (Ve.has(e)) return "opening";
726
- if (He.has(e)) return "ending";
800
+ if (Je.has(e)) return "opening";
801
+ if (Ye.has(e)) return "ending";
727
802
  }
728
- }, Xe = (e, t) => {
729
- if (qe(e)) return;
803
+ }, rt = (e, t) => {
804
+ if (et(e)) return;
730
805
  let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
731
- if (n in Ue) return Ue[n] ?? void 0;
732
- let r = n.split(Ke).map((e) => e.trim()).filter(Boolean);
733
- if (r.some((e) => e.split(/[\s_]+/u).some((e) => Ge.has(e)))) return;
806
+ if (n in Xe) return Xe[n] ?? void 0;
807
+ let r = n.split($e).map((e) => e.trim()).filter(Boolean);
808
+ if (r.some((e) => e.split(/[\s_]+/u).some((e) => Qe.has(e)))) return;
734
809
  let i = r.length > 1 ? [r[0], r.at(-1)] : r;
735
810
  for (let e of i) {
736
- let n = Je(e);
811
+ let n = tt(e);
737
812
  if (n.length !== 1) continue;
738
- let r = Ye(n[0], t);
813
+ let r = nt(n[0], t);
739
814
  if (r) return r;
740
815
  }
741
- }, Ze = 15, Qe = 87, $e = 93, et = (e) => {
816
+ }, it = 15, at = 87, ot = 93, st = (e) => {
742
817
  let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
743
818
  if (!n) return t;
744
819
  let r = e.map((e, t) => ({
745
820
  index: t,
746
821
  start: e.start,
747
822
  length: e.end - e.start
748
- })).filter(({ length: e }) => e >= Qe && e <= $e), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
823
+ })).filter(({ length: e }) => e >= at && e <= ot), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
749
824
  return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
750
- }, tt = (e) => {
751
- let t = e.map(({ title: e }) => Xe(e, !1)), n = e.reduce((e, n, r) => e + (t[r] ? n.end - n.start : 0), 0), r = e.reduce((e, t) => e + (t.end - t.start), 0);
825
+ }, ct = (e) => {
826
+ let t = e.map(({ title: e }) => rt(e, !1)), n = e.reduce((e, n, r) => e + (t[r] ? n.end - n.start : 0), 0), r = e.reduce((e, t) => e + (t.end - t.start), 0);
752
827
  if (r > 0 && n * 2 > r) return e.map(() => void 0);
753
828
  let i = e.map((e, n) => {
754
- if (e.end - e.start < Ze) return;
829
+ if (e.end - e.start < it) return;
755
830
  let r = t[n];
756
831
  if (r) return r;
757
- let i = Xe(e.title, !0);
832
+ let i = rt(e.title, !0);
758
833
  return i && !t.includes(i) ? i : void 0;
759
834
  });
760
- return e.every(({ title: e }) => qe(e)) ? et(e) : i;
761
- }, nt = g`
835
+ return e.every(({ title: e }) => et(e)) ? st(e) : i;
836
+ }, lt = g`
762
837
  position: relative;
763
838
  height: calc(.4 * var(--mp-unit));
764
839
 
@@ -843,7 +918,7 @@ var B = {
843
918
  box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
844
919
 
845
920
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
846
- ${Y.bMedium.bold}
921
+ ${Z.bMedium.bold}
847
922
 
848
923
  gap: calc(.6 * var(--mp-unit));
849
924
 
@@ -977,24 +1052,24 @@ var B = {
977
1052
  --thumbnail-width: calc(18 * var(--mp-unit));
978
1053
  --thumbnail-half: calc(9 * var(--mp-unit));
979
1054
  }
980
- `, rt = 4, it = () => {
981
- let e = U(), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U((e) => e.duration), i = U((e) => e.size), a = U((e) => e.downloadedRanges), o = U((e) => e.buffered), s = U((e) => e.indexes), c = U((e) => e.thumbnails), l = U((e) => e.thumbnailAt), u = U((e) => e.requestThumbnail), h = U((e) => e.chapters), g = U((e) => e.seekingTo), _ = U((e) => e.setSourceState), v = U((e) => e.hideUI), y = p(null), [b, x] = m(void 0), [S, C] = m(void 0), E = (e) => {
1055
+ `, ut = 4, dt = () => {
1056
+ let e = G(), t = G((e) => e.currentTime), n = G((e) => e.requestSeek), r = G((e) => e.duration), i = G((e) => e.size), a = G((e) => e.downloadedRanges), o = G((e) => e.buffered), s = G((e) => e.indexes), c = G((e) => e.thumbnails), l = G((e) => e.thumbnailAt), u = G((e) => e.requestThumbnail), h = G((e) => e.chapters), g = G((e) => e.seekingTo), _ = G((e) => e.setSourceState), v = G((e) => e.hideUI), y = p(null), [b, x] = m(void 0), [S, C] = m(void 0), w = (e) => {
982
1057
  C(e), u(e);
983
1058
  }, D = !!S;
984
1059
  d(() => {
985
1060
  if (D) return _({ seekPreview: !0 }), () => _({ seekPreview: !1 });
986
1061
  }, [_, D]), d(() => {
987
- v && E(void 0);
1062
+ v && w(void 0);
988
1063
  }, [v]);
989
- let O = p(void 0), k = p(0), A = p(void 0), j = p(void 0), M = p(!1), { dragging: N, handlers: P } = Me({
1064
+ let O = p(void 0), k = p(0), A = p(void 0), j = p(void 0), M = p(!1), { dragging: N, handlers: P } = ze({
990
1065
  ref: y,
991
1066
  onChange: (e) => {
992
1067
  if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
993
1068
  else if (!M.current) {
994
1069
  let t = y.current?.getBoundingClientRect().width ?? 0;
995
- Math.abs(e - j.current) * t > rt && (M.current = !0);
1070
+ Math.abs(e - j.current) * t > ut && (M.current = !0);
996
1071
  }
997
- x(e), O.current !== "mouse" && E(e * r);
1072
+ x(e), O.current !== "mouse" && w(e * r);
998
1073
  }
999
1074
  }), F = (e) => {
1000
1075
  O.current = e.pointerType, k.current = 0, j.current = void 0, M.current = !1, P.onPointerDown(e);
@@ -1005,7 +1080,7 @@ var B = {
1005
1080
  let t = i * r;
1006
1081
  n ? n(t) : e.seek(t);
1007
1082
  }
1008
- k.current = 0, M.current = !1, j.current = void 0, t.pointerType !== "mouse" && E(void 0);
1083
+ k.current = 0, M.current = !1, j.current = void 0, t.pointerType !== "mouse" && w(void 0);
1009
1084
  }, L = (e) => {
1010
1085
  if (!y.current) return;
1011
1086
  let { left: t, right: n } = y.current.getBoundingClientRect();
@@ -1013,12 +1088,12 @@ var B = {
1013
1088
  }, R = p("mouse"), z = (e) => {
1014
1089
  R.current = e.pointerType;
1015
1090
  }, ee = (e) => {
1016
- R.current !== "touch" && E(L(e.clientX));
1091
+ R.current !== "touch" && w(L(e.clientX));
1017
1092
  }, B = () => {
1018
- y.current && E(void 0);
1093
+ y.current && w(void 0);
1019
1094
  }, V = (e) => r ? e / r * 100 : 0, H = (e, t, n) => {
1020
1095
  let r = Number((n - t).toFixed(4)), i = t * 100;
1021
- return /* @__PURE__ */ w("div", {
1096
+ return /* @__PURE__ */ T("div", {
1022
1097
  className: "loaded-part",
1023
1098
  style: {
1024
1099
  transform: `scaleX(${r})`,
@@ -1044,7 +1119,7 @@ var B = {
1044
1119
  b,
1045
1120
  r
1046
1121
  ]);
1047
- let ne = f(() => {
1122
+ let U = f(() => {
1048
1123
  if (!r) return 0;
1049
1124
  if (N && b !== void 0) return b;
1050
1125
  let e = g ?? t;
@@ -1055,22 +1130,22 @@ var B = {
1055
1130
  N,
1056
1131
  b,
1057
1132
  g
1058
- ]), W = f(() => Le(h, r), [h, r]), G = W.length > 0, K = f(() => {
1059
- if (!G || S === void 0 || !r) return -1;
1133
+ ]), W = f(() => We(h, r), [h, r]), K = W.length > 0, q = f(() => {
1134
+ if (!K || S === void 0 || !r) return -1;
1060
1135
  let e = S / r * 100, t = W.findIndex((t, n) => n < W.length - 1 && e >= t && e < W[n + 1]);
1061
1136
  return t >= 0 ? t : W.length - 2;
1062
1137
  }, [
1063
- G,
1138
+ K,
1064
1139
  W,
1065
1140
  S,
1066
1141
  r
1067
- ]), re = f(() => G ? Re(W, (e) => e !== K) : void 0, [
1068
- G,
1142
+ ]), J = f(() => K ? Ge(W, (e) => e !== q) : void 0, [
1143
+ K,
1069
1144
  W,
1070
- K
1071
- ]), ie = f(() => K >= 0 ? Re(W, (e) => e === K) : void 0, [W, K]), q = f(() => {
1145
+ q
1146
+ ]), Y = f(() => q >= 0 ? Ge(W, (e) => e === q) : void 0, [W, q]), X = f(() => {
1072
1147
  if (S !== void 0) return h.find(({ start: e, end: t }) => e <= S && S < t);
1073
- }, [h, S]), J = f(() => {
1148
+ }, [h, S]), ne = f(() => {
1074
1149
  if (S) {
1075
1150
  if (l) return l(S);
1076
1151
  if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= S && S < t);
@@ -1079,71 +1154,71 @@ var B = {
1079
1154
  c,
1080
1155
  l,
1081
1156
  S
1082
- ]), ae = (e, t) => /* @__PURE__ */ T("div", {
1157
+ ]), re = (e, t) => /* @__PURE__ */ E("div", {
1083
1158
  className: e ? `track ${e}` : "track",
1084
1159
  style: t ? { maskImage: t } : void 0,
1085
1160
  children: [
1086
- /* @__PURE__ */ w("div", { className: "background-bar" }),
1087
- /* @__PURE__ */ w("div", {
1161
+ /* @__PURE__ */ T("div", { className: "background-bar" }),
1162
+ /* @__PURE__ */ T("div", {
1088
1163
  className: "loaded",
1089
1164
  children: te
1090
1165
  }),
1091
- /* @__PURE__ */ w("div", {
1166
+ /* @__PURE__ */ T("div", {
1092
1167
  className: "play-container",
1093
- children: /* @__PURE__ */ w("div", {
1168
+ children: /* @__PURE__ */ T("div", {
1094
1169
  className: "play",
1095
- style: { transform: `scaleX(${ne})` }
1170
+ style: { transform: `scaleX(${U})` }
1096
1171
  })
1097
1172
  })
1098
1173
  ]
1099
1174
  });
1100
- return /* @__PURE__ */ T("div", {
1101
- css: nt,
1175
+ return /* @__PURE__ */ E("div", {
1176
+ css: lt,
1102
1177
  ref: y,
1103
1178
  className: [
1104
1179
  "progress-bar",
1105
1180
  N ? "dragging" : "",
1106
- G ? "segmented" : ""
1181
+ K ? "segmented" : ""
1107
1182
  ].filter(Boolean).join(" "),
1108
1183
  onPointerDown: z,
1109
1184
  onPointerMove: z,
1110
1185
  onMouseMove: ee,
1111
1186
  onMouseOut: B,
1112
1187
  children: [
1113
- ae(void 0, re),
1114
- S ? /* @__PURE__ */ T("div", {
1188
+ re(void 0, J),
1189
+ S ? /* @__PURE__ */ E("div", {
1115
1190
  className: "cursor-time",
1116
1191
  style: {
1117
- left: q ? `clamp(var(--thumbnail-half), ${V(S)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${V(S)}%, calc(100% - calc(3 * var(--mp-unit))))`,
1118
- maxWidth: q ? "var(--thumbnail-width)" : void 0
1192
+ left: X ? `clamp(var(--thumbnail-half), ${V(S)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${V(S)}%, calc(100% - calc(3 * var(--mp-unit))))`,
1193
+ maxWidth: X ? "var(--thumbnail-width)" : void 0
1119
1194
  },
1120
- children: [/* @__PURE__ */ w("span", {
1195
+ children: [/* @__PURE__ */ T("span", {
1121
1196
  className: "cursor-time-value",
1122
- children: X(S)
1123
- }), q ? /* @__PURE__ */ w("span", {
1197
+ children: Pe(S)
1198
+ }), X ? /* @__PURE__ */ T("span", {
1124
1199
  className: "chapter-title",
1125
- children: q.title
1200
+ children: X.title
1126
1201
  }) : void 0]
1127
1202
  }) : void 0,
1128
- /* @__PURE__ */ w("div", { className: "progress" }),
1129
- /* @__PURE__ */ w("div", { className: "hover" }),
1130
- ie ? ae("focus", ie) : void 0,
1131
- /* @__PURE__ */ w("div", { className: "scrubber" }),
1132
- /* @__PURE__ */ w("div", {
1203
+ /* @__PURE__ */ T("div", { className: "progress" }),
1204
+ /* @__PURE__ */ T("div", { className: "hover" }),
1205
+ Y ? re("focus", Y) : void 0,
1206
+ /* @__PURE__ */ T("div", { className: "scrubber" }),
1207
+ /* @__PURE__ */ T("div", {
1133
1208
  className: "padding",
1134
1209
  ...P,
1135
1210
  onPointerDown: F,
1136
1211
  onPointerUp: I,
1137
1212
  onPointerCancel: I
1138
1213
  }),
1139
- /* @__PURE__ */ w("div", {
1214
+ /* @__PURE__ */ T("div", {
1140
1215
  className: "thumbnail",
1141
1216
  style: { left: `clamp(var(--thumbnail-half), ${V(S ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
1142
- children: J?.url ? /* @__PURE__ */ w("img", { src: J.url }) : void 0
1217
+ children: ne?.url ? /* @__PURE__ */ T("img", { src: ne.url }) : void 0
1143
1218
  })
1144
1219
  ]
1145
1220
  });
1146
- }, at = "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", $ = {
1221
+ }, 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", pt = {
1147
1222
  xmlns: "http://www.w3.org/2000/svg",
1148
1223
  width: 24,
1149
1224
  height: 24,
@@ -1153,43 +1228,12 @@ var B = {
1153
1228
  strokeWidth: 2,
1154
1229
  strokeLinecap: "round",
1155
1230
  strokeLinejoin: "round"
1156
- }, ot = (e) => /* @__PURE__ */ T("svg", {
1157
- ...$,
1158
- ...e,
1159
- children: [/* @__PURE__ */ w("rect", {
1160
- x: "3",
1161
- y: "5",
1162
- width: "18",
1163
- height: "14",
1164
- rx: "2",
1165
- ry: "2"
1166
- }), /* @__PURE__ */ w("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
1167
- }), st = (e) => /* @__PURE__ */ T("svg", {
1168
- ...$,
1169
- ...e,
1170
- children: [
1171
- /* @__PURE__ */ w("rect", {
1172
- x: "3",
1173
- y: "5",
1174
- width: "18",
1175
- height: "14",
1176
- rx: "2",
1177
- ry: "2"
1178
- }),
1179
- /* @__PURE__ */ w("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
1180
- /* @__PURE__ */ w("line", {
1181
- x1: "2",
1182
- y1: "2",
1183
- x2: "22",
1184
- y2: "22"
1185
- })
1186
- ]
1187
- }), ct = (e) => /* @__PURE__ */ T("svg", {
1188
- ...$,
1231
+ }, mt = (e) => /* @__PURE__ */ E("svg", {
1232
+ ...pt,
1189
1233
  ...e,
1190
1234
  children: [
1191
- /* @__PURE__ */ w("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1192
- /* @__PURE__ */ w("rect", {
1235
+ /* @__PURE__ */ T("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1236
+ /* @__PURE__ */ T("rect", {
1193
1237
  x: "12",
1194
1238
  y: "13",
1195
1239
  width: "10",
@@ -1197,14 +1241,14 @@ var B = {
1197
1241
  rx: "1",
1198
1242
  ry: "1"
1199
1243
  }),
1200
- /* @__PURE__ */ w("path", { d: "M14.5 18.5h2m2 0h1" })
1244
+ /* @__PURE__ */ T("path", { d: "M14.5 18.5h2m2 0h1" })
1201
1245
  ]
1202
- }), lt = (e) => /* @__PURE__ */ T("svg", {
1203
- ...$,
1246
+ }), ht = (e) => /* @__PURE__ */ E("svg", {
1247
+ ...pt,
1204
1248
  ...e,
1205
1249
  children: [
1206
- /* @__PURE__ */ w("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1207
- /* @__PURE__ */ w("rect", {
1250
+ /* @__PURE__ */ T("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1251
+ /* @__PURE__ */ T("rect", {
1208
1252
  x: "12",
1209
1253
  y: "13",
1210
1254
  width: "10",
@@ -1212,9 +1256,9 @@ var B = {
1212
1256
  rx: "1",
1213
1257
  ry: "1"
1214
1258
  }),
1215
- /* @__PURE__ */ w("path", { d: "M6 9h3m2 0h2" })
1259
+ /* @__PURE__ */ T("path", { d: "M6 9h3m2 0h2" })
1216
1260
  ]
1217
- }), ut = g`
1261
+ }), gt = g`
1218
1262
  .popover {
1219
1263
  position: absolute;
1220
1264
  /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
@@ -1253,7 +1297,7 @@ var B = {
1253
1297
 
1254
1298
  border-radius: 8px;
1255
1299
  background-color: rgba(28,28,28,0.95);
1256
- ${Y.bMedium.regular}
1300
+ ${Z.bMedium.regular}
1257
1301
 
1258
1302
  z-index: 4;
1259
1303
 
@@ -1296,7 +1340,7 @@ var B = {
1296
1340
 
1297
1341
  .secondary {
1298
1342
  color: #eee;
1299
- ${Y.bSmall.regular}
1343
+ ${Z.bSmall.regular}
1300
1344
  }
1301
1345
  }
1302
1346
  }
@@ -1338,29 +1382,29 @@ var B = {
1338
1382
  .failed {
1339
1383
  border-bottom: 1px solid #4D4D4E;
1340
1384
  color: #f66;
1341
- ${Y.bSmall.regular}
1385
+ ${Z.bSmall.regular}
1342
1386
  }
1343
1387
  }
1344
- `, dt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1388
+ `, _t = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1345
1389
  let c = o !== void 0, l = (e, i, a) => {
1346
1390
  let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
1347
- return /* @__PURE__ */ T("div", {
1391
+ return /* @__PURE__ */ E("div", {
1348
1392
  onClick: () => {
1349
1393
  l || r(e ?? void 0);
1350
1394
  },
1351
1395
  className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
1352
- children: [/* @__PURE__ */ w("span", { children: i }), /* @__PURE__ */ w("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
1396
+ children: [/* @__PURE__ */ T("span", { children: i }), /* @__PURE__ */ T("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
1353
1397
  }, e ?? "__off__");
1354
1398
  };
1355
- return /* @__PURE__ */ T("div", {
1399
+ return /* @__PURE__ */ E("div", {
1356
1400
  className: "popover track-list",
1357
1401
  children: [
1358
- /* @__PURE__ */ T("div", {
1402
+ /* @__PURE__ */ E("div", {
1359
1403
  className: i ? "back" : "back no-hover",
1360
1404
  onClick: i,
1361
- children: [i ? /* @__PURE__ */ w(O, {}) : null, /* @__PURE__ */ w("span", { children: e })]
1405
+ children: [i ? /* @__PURE__ */ T(A, {}) : null, /* @__PURE__ */ T("span", { children: e })]
1362
1406
  }),
1363
- s ? /* @__PURE__ */ w("div", {
1407
+ s ? /* @__PURE__ */ T("div", {
1364
1408
  className: "no-hover failed",
1365
1409
  children: "Could not switch. Try again."
1366
1410
  }) : null,
@@ -1368,7 +1412,7 @@ var B = {
1368
1412
  t.map(({ id: e, label: t }) => l(e, t, "description"))
1369
1413
  ]
1370
1414
  });
1371
- }, ft = ({ onReset: e } = {}) => {
1415
+ }, vt = ({ onReset: e } = {}) => {
1372
1416
  let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
1373
1417
  c.current = e;
1374
1418
  let l = () => {
@@ -1409,7 +1453,7 @@ var B = {
1409
1453
  });
1410
1454
  }
1411
1455
  };
1412
- }, pt = g`
1456
+ }, yt = g`
1413
1457
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1414
1458
  which is the width of the player box, so it can be clamped to it. */
1415
1459
  position: static;
@@ -1425,7 +1469,7 @@ position: static;
1425
1469
  }
1426
1470
  }
1427
1471
 
1428
- ${ut}
1472
+ ${gt}
1429
1473
 
1430
1474
  .popover.error-list {
1431
1475
  /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
@@ -1453,7 +1497,7 @@ ${ut}
1453
1497
 
1454
1498
  color: #fff;
1455
1499
  cursor: pointer;
1456
- ${Y.bSmall.regular}
1500
+ ${Z.bSmall.regular}
1457
1501
 
1458
1502
  &:hover {
1459
1503
  background-color: rgba(255,255,255,.1);
@@ -1474,7 +1518,7 @@ ${ut}
1474
1518
 
1475
1519
  .when {
1476
1520
  color: #bbb;
1477
- ${Y.bSmall.regular}
1521
+ ${Z.bSmall.regular}
1478
1522
 
1479
1523
  /* the one part of the line worth scanning for, so it is the one part at full brightness */
1480
1524
  .count {
@@ -1493,72 +1537,72 @@ ${ut}
1493
1537
  color: #ddd;
1494
1538
  overflow-wrap: anywhere;
1495
1539
  white-space: pre-wrap;
1496
- ${Y.bSmall.regular}
1540
+ ${Z.bSmall.regular}
1497
1541
  }
1498
1542
  }
1499
1543
  }
1500
- `, mt = (e) => new Date(e).toLocaleTimeString(), ht = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : X(Math.max(0, e)), gt = (e) => e.reduce((e, t) => e + t.count, 0), _t = (e) => e.map((e, t) => {
1501
- let n = ht(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
1544
+ `, bt = (e) => new Date(e).toLocaleTimeString(), xt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Pe(Math.max(0, e)), St = (e) => e.reduce((e, t) => e + t.count, 0), Ct = (e) => e.map((e, t) => {
1545
+ let n = xt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
1502
1546
  return [
1503
1547
  `${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
1504
1548
  e.message,
1505
1549
  e.detail
1506
1550
  ].filter(Boolean).join("\n");
1507
- }).join("\n\n"), vt = () => {
1508
- let e = U((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = ft(), [i, a] = m(!1);
1551
+ }).join("\n\n"), wt = () => {
1552
+ let e = G((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = vt(), [i, a] = m(!1);
1509
1553
  if (e.length === 0) return null;
1510
1554
  let o = () => {
1511
- navigator.clipboard?.writeText(_t(e)).then(() => {
1555
+ navigator.clipboard?.writeText(Ct(e)).then(() => {
1512
1556
  a(!0), setTimeout(() => a(!1), 2e3);
1513
1557
  }, (e) => console.warn("[media-player] could not copy the errors:", e));
1514
- }, s = `Playback errors (${gt(e)})`;
1515
- return /* @__PURE__ */ T("div", {
1516
- css: pt,
1558
+ }, s = `Playback errors (${St(e)})`;
1559
+ return /* @__PURE__ */ E("div", {
1560
+ css: yt,
1517
1561
  ref: r,
1518
- children: [/* @__PURE__ */ w(Q, {
1562
+ children: [/* @__PURE__ */ T($, {
1519
1563
  id: "errors",
1520
1564
  disabled: t,
1521
- text: /* @__PURE__ */ w("button", {
1565
+ text: /* @__PURE__ */ T("button", {
1522
1566
  className: "errors",
1523
1567
  type: "button",
1524
1568
  onClick: n,
1525
1569
  "aria-label": s,
1526
1570
  "aria-expanded": t,
1527
- children: /* @__PURE__ */ w(E, { className: "alert-triangle" })
1571
+ children: /* @__PURE__ */ T(z, { className: "alert-triangle" })
1528
1572
  }),
1529
- toolTipText: /* @__PURE__ */ w("span", { children: s })
1530
- }), t && /* @__PURE__ */ T("div", {
1573
+ toolTipText: /* @__PURE__ */ T("span", { children: s })
1574
+ }), t && /* @__PURE__ */ E("div", {
1531
1575
  className: "popover error-list",
1532
- children: [/* @__PURE__ */ T("div", {
1576
+ children: [/* @__PURE__ */ E("div", {
1533
1577
  className: "back no-hover",
1534
- children: [/* @__PURE__ */ w("span", { children: s }), /* @__PURE__ */ T("button", {
1578
+ children: [/* @__PURE__ */ T("span", { children: s }), /* @__PURE__ */ E("button", {
1535
1579
  className: "copy",
1536
1580
  type: "button",
1537
1581
  onClick: o,
1538
1582
  "aria-label": "Copy the errors",
1539
- children: [w(i ? D : A, {}), /* @__PURE__ */ w("span", { children: i ? "Copied" : "Copy" })]
1583
+ children: [T(i ? k : M, {}), /* @__PURE__ */ T("span", { children: i ? "Copied" : "Copy" })]
1540
1584
  })]
1541
- }), e.map((e, t) => /* @__PURE__ */ T("div", {
1585
+ }), e.map((e, t) => /* @__PURE__ */ E("div", {
1542
1586
  className: "entry no-hover",
1543
1587
  children: [
1544
- /* @__PURE__ */ T("span", {
1588
+ /* @__PURE__ */ E("span", {
1545
1589
  className: "when",
1546
1590
  children: [
1547
- mt(e.at),
1548
- e.count > 1 ? ` to ${mt(e.lastAt)}` : "",
1549
- ht(e.atMediaTime) ? ` at ${ht(e.atMediaTime)}` : "",
1591
+ bt(e.at),
1592
+ e.count > 1 ? ` to ${bt(e.lastAt)}` : "",
1593
+ xt(e.atMediaTime) ? ` at ${xt(e.atMediaTime)}` : "",
1550
1594
  e.recovered ? " recovered" : "",
1551
- e.count > 1 ? /* @__PURE__ */ w("span", {
1595
+ e.count > 1 ? /* @__PURE__ */ T("span", {
1552
1596
  className: "count",
1553
1597
  children: `×${e.count}`
1554
1598
  }) : null
1555
1599
  ]
1556
1600
  }),
1557
- /* @__PURE__ */ w("span", {
1601
+ /* @__PURE__ */ T("span", {
1558
1602
  className: "what",
1559
1603
  children: e.message
1560
1604
  }),
1561
- e.detail ? /* @__PURE__ */ w("span", {
1605
+ e.detail ? /* @__PURE__ */ T("span", {
1562
1606
  className: "cause",
1563
1607
  children: e.detail
1564
1608
  }) : null
@@ -1566,7 +1610,7 @@ ${ut}
1566
1610
  }, `${e.at}-${t}`))]
1567
1611
  })]
1568
1612
  });
1569
- }, yt = g`
1613
+ }, Tt = g`
1570
1614
  display: flex;
1571
1615
  align-items: center;
1572
1616
  justify-content: center;
@@ -1619,8 +1663,8 @@ width: 100%;
1619
1663
  }
1620
1664
  }
1621
1665
  }
1622
- `, bt = () => {
1623
- let e = U(), t = U((e) => e.playbackRate), n = p(null), r = p(null), i = .25, a = 2.75, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = Me({
1666
+ `, Et = () => {
1667
+ let e = G(), t = G((e) => e.playbackRate), n = p(null), r = p(null), i = .25, a = 2.75, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = ze({
1624
1668
  ref: r,
1625
1669
  onChange: (t) => e.setPlaybackRate(l(t))
1626
1670
  }), f = (t) => {
@@ -1635,26 +1679,26 @@ width: 100%;
1635
1679
  };
1636
1680
  }, [t]);
1637
1681
  let m = c(s);
1638
- return /* @__PURE__ */ T("div", {
1639
- css: yt,
1640
- children: [/* @__PURE__ */ T("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ w("div", {
1682
+ return /* @__PURE__ */ E("div", {
1683
+ css: Tt,
1684
+ children: [/* @__PURE__ */ E("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ T("div", {
1641
1685
  className: "playback-slider",
1642
1686
  ref: n,
1643
1687
  ...u,
1644
- children: /* @__PURE__ */ w("div", {
1688
+ children: /* @__PURE__ */ T("div", {
1645
1689
  ref: r,
1646
1690
  style: { background: `linear-gradient(to right,
1647
1691
  #fff 0% ${m}%,
1648
1692
  #3A3A3A ${m}% 100%
1649
1693
  )` },
1650
- children: /* @__PURE__ */ w("div", {
1694
+ children: /* @__PURE__ */ T("div", {
1651
1695
  className: "playback-handle",
1652
1696
  style: { left: `${m}%` }
1653
1697
  })
1654
1698
  })
1655
1699
  })]
1656
1700
  });
1657
- }, xt = g`
1701
+ }, Dt = g`
1658
1702
  /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
1659
1703
  as wide as the player box and can therefore be clamped to it. The outside-click check uses
1660
1704
  \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
@@ -1672,7 +1716,42 @@ position: static;
1672
1716
  }
1673
1717
  }
1674
1718
 
1675
- ${ut}
1719
+ ${gt}
1720
+
1721
+ .switch {
1722
+ position: relative;
1723
+ flex-shrink: 0;
1724
+ width: 28px;
1725
+ height: 16px;
1726
+ margin-right: 6px;
1727
+ border-radius: 8px;
1728
+ background-color: rgba(255,255,255,.3);
1729
+ transition: background-color 0.15s ease-in-out;
1730
+
1731
+ ::after {
1732
+ content: '';
1733
+ position: absolute;
1734
+ top: 2px;
1735
+ left: 2px;
1736
+ width: 12px;
1737
+ height: 12px;
1738
+ border-radius: 50%;
1739
+ background-color: #fff;
1740
+ transition: transform 0.15s ease-in-out;
1741
+ }
1742
+
1743
+ &.on {
1744
+ background-color: #fff;
1745
+ ::after {
1746
+ background-color: #1c1c1c;
1747
+ transform: translateX(12px);
1748
+ }
1749
+ }
1750
+ }
1751
+
1752
+ .unavailable {
1753
+ opacity: 0.5;
1754
+ }
1676
1755
 
1677
1756
  .playback-rate {
1678
1757
  .slider {
@@ -1713,91 +1792,107 @@ ${ut}
1713
1792
  }
1714
1793
  }
1715
1794
 
1716
- `, St = () => {
1717
- let e = U(), t = U((e) => e.playbackRate), n = U((e) => e.audioTracks), r = U((e) => e.selectedAudioTrack), i = U((e) => e.selectAudioTrack), [a, o] = m(0), { open: s, toggle: c, containerRef: l, pending: u, failed: d, runSelect: f } = ft({ onReset: () => o(0) }), p = (t) => {
1718
- e.setPlaybackRate(t), o(0);
1719
- }, h = (e) => {
1720
- e !== void 0 && f(e, () => i(e));
1721
- }, g = (e) => () => {
1722
- o(e);
1795
+ `, Ot = () => {
1796
+ let e = G(), t = G((e) => e.playbackRate), n = G((e) => e.audioTracks), r = G((e) => e.selectedAudioTrack), i = G((e) => e.selectAudioTrack), a = G((e) => e.volumeNormalizer), [o, s] = m(0), { open: c, toggle: l, containerRef: u, pending: d, failed: f, runSelect: p } = vt({ onReset: () => s(0) }), h = (t) => {
1797
+ e.setPlaybackRate(t), s(0);
1798
+ }, g = (e) => {
1799
+ e !== void 0 && p(e, () => i(e));
1800
+ }, _ = (e) => () => {
1801
+ s(e);
1723
1802
  };
1724
- return /* @__PURE__ */ T("div", {
1725
- css: xt,
1726
- ref: l,
1803
+ return /* @__PURE__ */ E("div", {
1804
+ css: Dt,
1805
+ ref: u,
1727
1806
  children: [
1728
- /* @__PURE__ */ w(Q, {
1807
+ /* @__PURE__ */ T($, {
1729
1808
  id: "settings",
1730
- disabled: s,
1731
- text: /* @__PURE__ */ w("button", {
1809
+ disabled: c,
1810
+ text: /* @__PURE__ */ T("button", {
1732
1811
  className: "settings",
1733
1812
  type: "button",
1734
- onClick: c,
1813
+ onClick: l,
1735
1814
  "aria-label": "Settings",
1736
- "aria-expanded": s,
1737
- children: /* @__PURE__ */ w(I, {})
1815
+ "aria-expanded": c,
1816
+ children: /* @__PURE__ */ T(R, {})
1738
1817
  }),
1739
- toolTipText: /* @__PURE__ */ w("span", { children: "Settings" })
1818
+ toolTipText: /* @__PURE__ */ T("span", { children: "Settings" })
1740
1819
  }),
1741
- s && a === 0 && /* @__PURE__ */ T("div", {
1820
+ c && o === 0 && /* @__PURE__ */ E("div", {
1742
1821
  className: "popover menu",
1743
- children: [n.length > 1 ? /* @__PURE__ */ T("div", {
1744
- onClick: g(2),
1745
- children: [/* @__PURE__ */ w("div", { children: "Audio" }), /* @__PURE__ */ w("div", { children: /* @__PURE__ */ w(k, {}) })]
1746
- }) : null, /* @__PURE__ */ T("div", {
1747
- onClick: g(1),
1748
- children: [/* @__PURE__ */ w("div", { children: "Playback speed" }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("span", {
1749
- className: "secondary",
1750
- children: t === 1 ? "(Default)" : t.toFixed(2)
1751
- }), /* @__PURE__ */ w(k, {})] })]
1752
- })]
1822
+ children: [
1823
+ n.length > 1 ? /* @__PURE__ */ E("div", {
1824
+ onClick: _(2),
1825
+ children: [/* @__PURE__ */ T("div", { children: "Audio" }), /* @__PURE__ */ T("div", { children: /* @__PURE__ */ T(j, {}) })]
1826
+ }) : null,
1827
+ /* @__PURE__ */ E("div", {
1828
+ onClick: _(1),
1829
+ children: [/* @__PURE__ */ T("div", { children: "Playback speed" }), /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("span", {
1830
+ className: "secondary",
1831
+ children: t === 1 ? "(Default)" : t.toFixed(2)
1832
+ }), /* @__PURE__ */ T(j, {})] })]
1833
+ }),
1834
+ a ? /* @__PURE__ */ E("div", {
1835
+ role: "switch",
1836
+ "aria-checked": a.available && a.enabled,
1837
+ "aria-disabled": !a.available,
1838
+ className: a.available ? void 0 : "no-hover unavailable",
1839
+ onClick: () => {
1840
+ a.available && a.setEnabled(!a.enabled);
1841
+ },
1842
+ children: [/* @__PURE__ */ T("div", { children: "Normalize volume" }), /* @__PURE__ */ T("div", { children: a.available ? /* @__PURE__ */ T("span", { className: a.enabled ? "switch on" : "switch" }) : /* @__PURE__ */ T("span", {
1843
+ className: "secondary",
1844
+ children: "Unavailable"
1845
+ }) })]
1846
+ }) : null
1847
+ ]
1753
1848
  }),
1754
- s && a === 1 && /* @__PURE__ */ T("div", {
1849
+ c && o === 1 && /* @__PURE__ */ E("div", {
1755
1850
  className: "popover playback-rate",
1756
1851
  children: [
1757
- /* @__PURE__ */ T("div", {
1852
+ /* @__PURE__ */ E("div", {
1758
1853
  className: "back",
1759
- onClick: g(0),
1760
- children: [/* @__PURE__ */ w(O, {}), /* @__PURE__ */ w("span", { children: "Playback speed" })]
1854
+ onClick: _(0),
1855
+ children: [/* @__PURE__ */ T(A, {}), /* @__PURE__ */ T("span", { children: "Playback speed" })]
1761
1856
  }),
1762
- /* @__PURE__ */ w("div", {
1857
+ /* @__PURE__ */ T("div", {
1763
1858
  className: "slider no-hover",
1764
- children: /* @__PURE__ */ w(bt, {})
1859
+ children: /* @__PURE__ */ T(Et, {})
1765
1860
  }),
1766
- /* @__PURE__ */ T("div", {
1861
+ /* @__PURE__ */ E("div", {
1767
1862
  className: "options no-hover",
1768
1863
  children: [
1769
- /* @__PURE__ */ w("div", {
1770
- onClick: () => p(.5),
1864
+ /* @__PURE__ */ T("div", {
1865
+ onClick: () => h(.5),
1771
1866
  children: "0.5x"
1772
1867
  }),
1773
- /* @__PURE__ */ w("div", {
1774
- onClick: () => p(1),
1868
+ /* @__PURE__ */ T("div", {
1869
+ onClick: () => h(1),
1775
1870
  children: "1x"
1776
1871
  }),
1777
- /* @__PURE__ */ w("div", {
1778
- onClick: () => p(1.5),
1872
+ /* @__PURE__ */ T("div", {
1873
+ onClick: () => h(1.5),
1779
1874
  children: "1.5x"
1780
1875
  }),
1781
- /* @__PURE__ */ w("div", {
1782
- onClick: () => p(2),
1876
+ /* @__PURE__ */ T("div", {
1877
+ onClick: () => h(2),
1783
1878
  children: "2x"
1784
1879
  })
1785
1880
  ]
1786
1881
  })
1787
1882
  ]
1788
1883
  }),
1789
- s && a === 2 && /* @__PURE__ */ w(dt, {
1884
+ c && o === 2 && /* @__PURE__ */ T(_t, {
1790
1885
  title: "Audio",
1791
1886
  tracks: n,
1792
1887
  selected: r,
1793
- onSelect: h,
1794
- onBack: g(0),
1795
- pending: u,
1796
- failed: d
1888
+ onSelect: g,
1889
+ onBack: _(0),
1890
+ pending: d,
1891
+ failed: f
1797
1892
  })
1798
1893
  ]
1799
1894
  });
1800
- }, Ct = g`
1895
+ }, kt = g`
1801
1896
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1802
1897
  which is the width of the player box, so it can be clamped to it. */
1803
1898
  position: static;
@@ -1813,28 +1908,28 @@ position: static;
1813
1908
  }
1814
1909
  }
1815
1910
 
1816
- ${ut}
1817
- `, wt = () => {
1818
- let e = U((e) => e.subtitleTracks), t = U((e) => e.selectedSubtitleTrack), n = U((e) => e.selectSubtitleTrack), r = U((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = ft();
1911
+ ${gt}
1912
+ `, At = () => {
1913
+ let e = G((e) => e.subtitleTracks), t = G((e) => e.selectedSubtitleTrack), n = G((e) => e.selectSubtitleTrack), r = G((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = vt();
1819
1914
  if (e.length === 0) return null;
1820
1915
  let u = t !== void 0;
1821
- return /* @__PURE__ */ T("div", {
1822
- css: Ct,
1916
+ return /* @__PURE__ */ E("div", {
1917
+ css: kt,
1823
1918
  ref: o,
1824
- children: [/* @__PURE__ */ w(Q, {
1919
+ children: [/* @__PURE__ */ T($, {
1825
1920
  id: "subtitles",
1826
1921
  disabled: i,
1827
- text: /* @__PURE__ */ w("button", {
1922
+ text: /* @__PURE__ */ T("button", {
1828
1923
  className: "subtitles",
1829
1924
  type: "button",
1830
1925
  onClick: a,
1831
1926
  "aria-label": "Subtitles",
1832
1927
  "aria-expanded": i,
1833
1928
  "aria-pressed": u,
1834
- children: u ? /* @__PURE__ */ w(ot, { className: "captions" }) : /* @__PURE__ */ w(st, { className: "captions-off" })
1929
+ children: u ? /* @__PURE__ */ T(D, { className: "captions" }) : /* @__PURE__ */ T(O, { className: "captions-off" })
1835
1930
  }),
1836
- toolTipText: /* @__PURE__ */ w("span", { children: "Subtitles" })
1837
- }), i && /* @__PURE__ */ w(dt, {
1931
+ toolTipText: /* @__PURE__ */ T("span", { children: "Subtitles" })
1932
+ }), i && /* @__PURE__ */ T(_t, {
1838
1933
  title: "Subtitles",
1839
1934
  tracks: e,
1840
1935
  selected: t,
@@ -1844,13 +1939,13 @@ ${ut}
1844
1939
  failed: c
1845
1940
  })]
1846
1941
  });
1847
- }, Tt = {
1942
+ }, jt = {
1848
1943
  primary: "#EAEBEE",
1849
1944
  secondary: "#D0D0D9",
1850
1945
  hover: "rgba(255, 255, 255, 0.13)",
1851
1946
  borderPrimary: "#384F70",
1852
1947
  backgroundTooltip: "#222222"
1853
- }, Et = g`
1948
+ }, Mt = g`
1854
1949
  display: flex;
1855
1950
  align-items: center;
1856
1951
 
@@ -1893,8 +1988,8 @@ ${ut}
1893
1988
  width: 10px;
1894
1989
  height: 10px;
1895
1990
  }
1896
- `, Dt = ({ value: e, onChange: t }) => {
1897
- let n = U((e) => e.volume), r = U((e) => e.muted), i = p(null), a = p(null), { handlers: o } = Me({
1991
+ `, Nt = ({ value: e, onChange: t }) => {
1992
+ let n = G((e) => e.volume), r = G((e) => e.muted), i = p(null), a = p(null), { handlers: o } = ze({
1898
1993
  ref: a,
1899
1994
  onChange: t
1900
1995
  }), s = (n) => {
@@ -1908,31 +2003,31 @@ ${ut}
1908
2003
  e && e.removeEventListener("wheel", s);
1909
2004
  };
1910
2005
  }, [e]);
1911
- let c = e * 100, l = f(() => Math.round(r ? 0 : De(n) * 100), [n, r]);
1912
- return /* @__PURE__ */ w(Q, {
2006
+ let c = e * 100, l = f(() => Math.round(r ? 0 : Ne(n) * 100), [n, r]);
2007
+ return /* @__PURE__ */ T($, {
1913
2008
  id: "volume-slider",
1914
- text: /* @__PURE__ */ w("div", {
2009
+ text: /* @__PURE__ */ T("div", {
1915
2010
  ref: i,
1916
- css: Et,
2011
+ css: Mt,
1917
2012
  ...o,
1918
- children: /* @__PURE__ */ w("div", {
2013
+ children: /* @__PURE__ */ T("div", {
1919
2014
  ref: a,
1920
2015
  style: { background: `linear-gradient(to right,
1921
2016
  #fff 0% ${c}%,
1922
2017
  #3A3A3A ${c}% 100%
1923
2018
  )` },
1924
- children: /* @__PURE__ */ w("div", {
2019
+ children: /* @__PURE__ */ T("div", {
1925
2020
  className: "volume-handle",
1926
2021
  style: { left: `${e * 100}%` }
1927
2022
  })
1928
2023
  })
1929
2024
  }),
1930
- toolTipText: /* @__PURE__ */ T("div", {
2025
+ toolTipText: /* @__PURE__ */ E("div", {
1931
2026
  className: "volume-value",
1932
2027
  children: [l, "%"]
1933
2028
  })
1934
2029
  });
1935
- }, Ot = g`
2030
+ }, Pt = g`
1936
2031
  position: relative;
1937
2032
  display: flex;
1938
2033
  align-items: center;
@@ -1957,7 +2052,7 @@ ${ut}
1957
2052
  border-radius: 4px;
1958
2053
 
1959
2054
  .volume-value {
1960
- ${Y.bMedium.regular};
2055
+ ${Z.bMedium.regular};
1961
2056
  color: #ffffff;
1962
2057
  }
1963
2058
  }
@@ -1995,39 +2090,39 @@ ${ut}
1995
2090
  }
1996
2091
  }
1997
2092
 
1998
- `, kt = ({ ref: e }) => {
1999
- let t = U(), n = U((e) => e.volume), r = U((e) => e.muted), i = f(() => De(n), [n]);
2000
- return /* @__PURE__ */ T("div", {
2001
- css: Ot,
2002
- children: [/* @__PURE__ */ w(Q, {
2093
+ `, Ft = ({ ref: e }) => {
2094
+ let t = G(), n = G((e) => e.volume), r = G((e) => e.muted), i = f(() => Ne(n), [n]);
2095
+ return /* @__PURE__ */ E("div", {
2096
+ css: Pt,
2097
+ children: [/* @__PURE__ */ T($, {
2003
2098
  id: "sound",
2004
- text: /* @__PURE__ */ w("button", {
2099
+ text: /* @__PURE__ */ T("button", {
2005
2100
  className: "sound",
2006
2101
  type: "button",
2007
2102
  onClick: () => t.toggleMuted(),
2008
2103
  ref: e,
2009
2104
  "aria-label": "Mute",
2010
2105
  "aria-pressed": r || n === 0,
2011
- children: w(r || n === 0 ? z : n <= .5 ? L : R, {
2106
+ children: T(r || n === 0 ? V : n <= .5 ? ee : B, {
2012
2107
  size: 18,
2013
2108
  color: "#fff"
2014
2109
  })
2015
2110
  }),
2016
- toolTipText: /* @__PURE__ */ w("span", { children: r ? "Unmute (m)" : "Mute (m)" })
2017
- }), /* @__PURE__ */ w("div", {
2111
+ toolTipText: /* @__PURE__ */ T("span", { children: r ? "Unmute (m)" : "Mute (m)" })
2112
+ }), /* @__PURE__ */ T("div", {
2018
2113
  className: "volume-slider-container",
2019
- children: /* @__PURE__ */ w("div", {
2114
+ children: /* @__PURE__ */ T("div", {
2020
2115
  className: "volume-slider-background",
2021
- children: /* @__PURE__ */ w(Dt, {
2116
+ children: /* @__PURE__ */ T(Nt, {
2022
2117
  value: r ? 0 : i,
2023
2118
  onChange: (e) => {
2024
- t.setVolume(Ee(e));
2119
+ t.setVolume(Me(e));
2025
2120
  }
2026
2121
  })
2027
2122
  })
2028
2123
  })]
2029
2124
  });
2030
- }, At = .05, jt = 5, Mt = 50, Nt = 1e3, Pt = g`
2125
+ }, It = .05, Lt = 5, Rt = 50, zt = 1e3, Bt = g`
2031
2126
  display: flex;
2032
2127
  flex-direction: column;
2033
2128
  gap: calc(0.4 * var(--mp-unit));
@@ -2036,7 +2131,7 @@ ${ut}
2036
2131
  opacity: 0.72;
2037
2132
  font-size: 0.9em;
2038
2133
  }
2039
- `, Ft = g`
2134
+ `, Vt = g`
2040
2135
  position: absolute;
2041
2136
  bottom: 0;
2042
2137
  width: 100%;
@@ -2128,7 +2223,7 @@ ${ut}
2128
2223
  /* .armed is the hover of a control letting its click through, which takes no pointer events
2129
2224
  of its own and so is never :hover */
2130
2225
  :hover, &.armed {
2131
- background-color: ${Tt.hover};
2226
+ background-color: ${jt.hover};
2132
2227
  }
2133
2228
 
2134
2229
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -2145,7 +2240,7 @@ ${ut}
2145
2240
 
2146
2241
  .left {
2147
2242
  .time {
2148
- ${Y.bMedium.regular}
2243
+ ${Z.bMedium.regular}
2149
2244
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
2150
2245
  }
2151
2246
  }
@@ -2166,10 +2261,10 @@ ${ut}
2166
2261
  }
2167
2262
  }
2168
2263
  }
2169
- `, It = () => {
2170
- let e = U(), t = U((e) => e.paused), n = U((e) => e.currentTime), r = U((e) => e.duration), i = U((e) => e.seekingTo), a = U((e) => e.fullscreen), o = U((e) => e.hideUI), s = U((e) => e.togglePictureInPicture), c = U((e) => e.pictureInPictureMode), l = U((e) => e.burnedInSubtitles), f = U((e) => e.passThroughPictureInPicture), h = U((e) => e.subtitleTracks), g = U((e) => e.requestSeek), [_, v] = m(null), y = p(null), b = p(void 0), x = c === "burn-in", S = h.length > 0, C = r > 0 && n === r, E = u(({ direction: t, stepSize: n }) => {
2171
- let r = De(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
2172
- e.setVolume(Ee(a)), o && !e.muted && e.toggleMuted();
2264
+ `, Ht = () => {
2265
+ let e = G(), t = G((e) => e.paused), n = G((e) => e.currentTime), r = G((e) => e.duration), i = G((e) => e.seekingTo), a = G((e) => e.fullscreen), o = G((e) => e.hideUI), s = G((e) => e.togglePictureInPicture), c = G((e) => e.pictureInPictureMode), l = G((e) => e.burnedInSubtitles), f = G((e) => e.passThroughPictureInPicture), h = G((e) => e.subtitleTracks), g = G((e) => e.requestSeek), [_, v] = m(null), y = p(null), b = p(void 0), x = c === "burn-in", S = h.length > 0, C = r > 0 && n === r, w = u(({ direction: t, stepSize: n }) => {
2266
+ let r = Ne(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
2267
+ e.setVolume(Me(a)), o && !e.muted && e.toggleMuted();
2173
2268
  }, [e]);
2174
2269
  d(() => {
2175
2270
  let t = (t) => g ? g(t) : e.seek(t), n = (n) => {
@@ -2180,35 +2275,35 @@ ${ut}
2180
2275
  else if (n.key === "k") e.togglePaused();
2181
2276
  else if (n.key === " ") e.togglePaused();
2182
2277
  else if (n.key === "m") e.toggleMuted();
2183
- else if (n.key === "ArrowUp") E({
2278
+ else if (n.key === "ArrowUp") w({
2184
2279
  direction: "up",
2185
- stepSize: At
2280
+ stepSize: It
2186
2281
  });
2187
- else if (n.key === "ArrowDown") E({
2282
+ else if (n.key === "ArrowDown") w({
2188
2283
  direction: "down",
2189
- stepSize: At
2284
+ stepSize: It
2190
2285
  });
2191
2286
  else if (n.key === "ArrowRight") {
2192
2287
  if (!e.duration) return;
2193
- t(Math.min(e.currentTime + jt, e.duration));
2194
- } else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - jt, 0)) : i = !1;
2288
+ t(Math.min(e.currentTime + Lt, e.duration));
2289
+ } else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - Lt, 0)) : i = !1;
2195
2290
  i && n.preventDefault();
2196
2291
  };
2197
2292
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
2198
2293
  }, [
2199
2294
  e,
2200
- E,
2295
+ w,
2201
2296
  g
2202
2297
  ]);
2203
2298
  let D = u((e) => {
2204
- e.preventDefault(), e.deltaY < 0 ? E({
2299
+ e.preventDefault(), e.deltaY < 0 ? w({
2205
2300
  direction: "up",
2206
- stepSize: At
2207
- }) : E({
2301
+ stepSize: It
2302
+ }) : w({
2208
2303
  direction: "down",
2209
- stepSize: At
2304
+ stepSize: It
2210
2305
  });
2211
- }, [E]);
2306
+ }, [w]);
2212
2307
  d(() => {
2213
2308
  if (_) return _.addEventListener("wheel", D, { passive: !1 }), () => _.removeEventListener("wheel", D);
2214
2309
  }, [_, D]);
@@ -2232,49 +2327,49 @@ ${ut}
2232
2327
  }
2233
2328
  let n = y.current, r = document.activeElement;
2234
2329
  n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
2235
- }, Mt);
2330
+ }, Rt);
2236
2331
  return b.current = t, () => {
2237
- e = Date.now() + Nt;
2332
+ e = Date.now() + zt;
2238
2333
  };
2239
- }, [k]), d(() => () => clearInterval(b.current), []), /* @__PURE__ */ T("div", {
2240
- css: Ft,
2334
+ }, [k]), d(() => () => clearInterval(b.current), []), /* @__PURE__ */ E("div", {
2335
+ css: Vt,
2241
2336
  style: { ...o ? {
2242
2337
  opacity: "0",
2243
2338
  pointerEvents: "none"
2244
2339
  } : k ? { pointerEvents: "none" } : {} },
2245
- children: [/* @__PURE__ */ w(it, {}), /* @__PURE__ */ T("div", {
2340
+ children: [/* @__PURE__ */ T(dt, {}), /* @__PURE__ */ E("div", {
2246
2341
  className: "actions",
2247
- children: [/* @__PURE__ */ T("div", {
2342
+ children: [/* @__PURE__ */ E("div", {
2248
2343
  className: "left",
2249
2344
  children: [
2250
- /* @__PURE__ */ w(Q, {
2345
+ /* @__PURE__ */ T($, {
2251
2346
  id: "play",
2252
2347
  tooltipPlace: "top-start",
2253
- text: /* @__PURE__ */ w("button", {
2348
+ text: /* @__PURE__ */ T("button", {
2254
2349
  className: "play",
2255
2350
  type: "button",
2256
2351
  onClick: () => e.togglePaused(),
2257
2352
  "aria-label": C ? "Replay" : t ? "Play" : "Pause",
2258
- children: w(C ? F : t ? P : N, {})
2353
+ children: T(C ? L : t ? I : F, {})
2259
2354
  }),
2260
- toolTipText: /* @__PURE__ */ w("span", { children: C ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
2355
+ toolTipText: /* @__PURE__ */ T("span", { children: C ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
2261
2356
  }),
2262
- /* @__PURE__ */ w(kt, { ref: v }),
2263
- /* @__PURE__ */ w("div", {
2357
+ /* @__PURE__ */ T(Ft, { ref: v }),
2358
+ /* @__PURE__ */ T("div", {
2264
2359
  className: "time",
2265
- children: Oe(i ?? n, r)
2360
+ children: Fe(i ?? n, r)
2266
2361
  })
2267
2362
  ]
2268
- }), /* @__PURE__ */ T("div", {
2363
+ }), /* @__PURE__ */ E("div", {
2269
2364
  className: "right",
2270
2365
  children: [
2271
- /* @__PURE__ */ w(vt, {}),
2272
- /* @__PURE__ */ w(wt, {}),
2273
- /* @__PURE__ */ w(St, {}),
2274
- f ? /* @__PURE__ */ w(Q, {
2366
+ /* @__PURE__ */ T(wt, {}),
2367
+ /* @__PURE__ */ T(At, {}),
2368
+ /* @__PURE__ */ T(Ot, {}),
2369
+ f ? /* @__PURE__ */ T($, {
2275
2370
  id: "picture-in-picture",
2276
2371
  tooltipPlace: "top-end",
2277
- text: /* @__PURE__ */ w("button", {
2372
+ text: /* @__PURE__ */ T("button", {
2278
2373
  ref: y,
2279
2374
  className: f.armed ? "picture-in-picture armed" : "picture-in-picture",
2280
2375
  type: "button",
@@ -2283,56 +2378,56 @@ ${ut}
2283
2378
  onClick: f.active ? f.exit : void 0,
2284
2379
  "aria-label": "Picture in picture",
2285
2380
  "aria-pressed": f.active,
2286
- children: /* @__PURE__ */ w("img", {
2287
- src: at,
2381
+ children: /* @__PURE__ */ T("img", {
2382
+ src: ft,
2288
2383
  alt: ""
2289
2384
  })
2290
2385
  }),
2291
- toolTipText: /* @__PURE__ */ w("span", { children: f.active ? "Exit picture in picture" : "Picture in picture" })
2292
- }) : s ? /* @__PURE__ */ w(Q, {
2386
+ toolTipText: /* @__PURE__ */ T("span", { children: f.active ? "Exit picture in picture" : "Picture in picture" })
2387
+ }) : s ? /* @__PURE__ */ T($, {
2293
2388
  id: "picture-in-picture",
2294
2389
  tooltipPlace: "top-end",
2295
- text: /* @__PURE__ */ w("button", {
2390
+ text: /* @__PURE__ */ T("button", {
2296
2391
  className: "picture-in-picture",
2297
2392
  type: "button",
2298
2393
  onClick: s,
2299
2394
  disabled: x && !S,
2300
2395
  "aria-label": x ? "Put the subtitles in the video" : "Picture in picture",
2301
2396
  "aria-pressed": x ? l : void 0,
2302
- children: x ? w(l ? ct : lt, {}) : /* @__PURE__ */ w("img", {
2303
- src: at,
2397
+ children: x ? T(l ? mt : ht, {}) : /* @__PURE__ */ T("img", {
2398
+ src: ft,
2304
2399
  alt: ""
2305
2400
  })
2306
2401
  }),
2307
- toolTipText: /* @__PURE__ */ T("span", {
2308
- css: Pt,
2309
- children: [/* @__PURE__ */ w("span", {
2402
+ toolTipText: /* @__PURE__ */ E("span", {
2403
+ css: Bt,
2404
+ children: [/* @__PURE__ */ T("span", {
2310
2405
  className: "lead",
2311
2406
  children: x ? S ? l ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
2312
- }), x && S ? /* @__PURE__ */ w("span", {
2407
+ }), x && S ? /* @__PURE__ */ T("span", {
2313
2408
  className: "hint",
2314
2409
  children: "Then hover the video and click your browser's own pop out button"
2315
2410
  }) : null]
2316
2411
  })
2317
2412
  }) : null,
2318
- /* @__PURE__ */ w(Q, {
2413
+ /* @__PURE__ */ T($, {
2319
2414
  id: "full-screen",
2320
2415
  tooltipPlace: "top-end",
2321
- text: /* @__PURE__ */ w("button", {
2416
+ text: /* @__PURE__ */ T("button", {
2322
2417
  className: "full-screen",
2323
2418
  type: "button",
2324
2419
  onClick: () => e.toggleFullscreen(),
2325
2420
  "aria-label": "Full screen",
2326
2421
  "aria-pressed": a,
2327
- children: w(a ? M : j, {})
2422
+ children: T(a ? P : N, {})
2328
2423
  }),
2329
- toolTipText: /* @__PURE__ */ w("span", { children: a ? "Exit full screen (f)" : "Full screen (f)" })
2424
+ toolTipText: /* @__PURE__ */ T("span", { children: a ? "Exit full screen (f)" : "Full screen (f)" })
2330
2425
  })
2331
2426
  ]
2332
2427
  })]
2333
2428
  })]
2334
2429
  });
2335
- }, Lt = 9e3, Rt = g`
2430
+ }, Ut = 9e3, Wt = g`
2336
2431
  position: absolute;
2337
2432
  inset: 0;
2338
2433
  z-index: 2;
@@ -2370,12 +2465,12 @@ ${ut}
2370
2465
  }
2371
2466
 
2372
2467
  .title {
2373
- ${Y.bMedium.bold}
2468
+ ${Z.bMedium.bold}
2374
2469
  color: #fff;
2375
2470
  }
2376
2471
 
2377
2472
  .body {
2378
- ${Y.bSmall.regular}
2473
+ ${Z.bSmall.regular}
2379
2474
  color: rgba(255, 255, 255, 0.75);
2380
2475
  }
2381
2476
 
@@ -2386,42 +2481,42 @@ ${ut}
2386
2481
  line-height: 1;
2387
2482
  color: #fff;
2388
2483
  }
2389
- `, zt = () => {
2390
- let e = U((e) => e.burnedInSubtitles), t = U((e) => e.pictureInPictureMode), [n, r] = m(!1);
2484
+ `, Gt = () => {
2485
+ let e = G((e) => e.burnedInSubtitles), t = G((e) => e.pictureInPictureMode), [n, r] = m(!1);
2391
2486
  return d(() => {
2392
2487
  if (t !== "burn-in" || !e) {
2393
2488
  r(!1);
2394
2489
  return;
2395
2490
  }
2396
2491
  r(!0);
2397
- let n = setTimeout(() => r(!1), Lt);
2492
+ let n = setTimeout(() => r(!1), Ut);
2398
2493
  return () => clearTimeout(n);
2399
- }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ w("div", {
2400
- css: Rt,
2494
+ }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ T("div", {
2495
+ css: Wt,
2401
2496
  className: n ? "show" : "",
2402
2497
  role: "status",
2403
- children: /* @__PURE__ */ T("div", {
2498
+ children: /* @__PURE__ */ E("div", {
2404
2499
  className: "card",
2405
- children: [/* @__PURE__ */ T("div", {
2500
+ children: [/* @__PURE__ */ E("div", {
2406
2501
  className: "words",
2407
- children: [/* @__PURE__ */ w("div", {
2502
+ children: [/* @__PURE__ */ T("div", {
2408
2503
  className: "title",
2409
2504
  children: "Subtitles are in the picture"
2410
- }), /* @__PURE__ */ w("div", {
2505
+ }), /* @__PURE__ */ T("div", {
2411
2506
  className: "body",
2412
2507
  children: "Now hover the video and click your browser's own pop out button"
2413
2508
  })]
2414
- }), /* @__PURE__ */ w("div", {
2509
+ }), /* @__PURE__ */ T("div", {
2415
2510
  className: "arrow",
2416
2511
  "aria-hidden": "true",
2417
2512
  children: "→"
2418
2513
  })]
2419
2514
  })
2420
2515
  });
2421
- }, Bt = 1, Vt = 6e3, Ht = 1, Ut = {
2516
+ }, Kt = 1, qt = 6e3, Jt = 1, Yt = {
2422
2517
  opening: "Skip Opening",
2423
2518
  ending: "Skip Ending"
2424
- }, Wt = g`
2519
+ }, Xt = g`
2425
2520
  position: absolute;
2426
2521
  inset: 0;
2427
2522
  z-index: 2;
@@ -2438,7 +2533,7 @@ ${ut}
2438
2533
  pointer-events: auto;
2439
2534
  cursor: pointer;
2440
2535
 
2441
- ${Y.bMedium.bold}
2536
+ ${Z.bMedium.bold}
2442
2537
  color: #fff;
2443
2538
  padding: calc(1 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
2444
2539
  border: 1px solid rgba(255, 255, 255, .55);
@@ -2472,10 +2567,10 @@ ${ut}
2472
2567
  bottom: calc(9 * var(--mp-unit));
2473
2568
  }
2474
2569
  }
2475
- `, Gt = () => {
2476
- let e = U((e) => e.chapters), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U((e) => e.seekPreview), i = U(), a = f(() => tt(e), [e]), o = f(() => {
2570
+ `, Zt = () => {
2571
+ let e = G((e) => e.chapters), t = G((e) => e.currentTime), n = G((e) => e.requestSeek), r = G((e) => e.seekPreview), i = G(), a = f(() => ct(e), [e]), o = f(() => {
2477
2572
  if (typeof t != "number") return;
2478
- let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - Bt <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
2573
+ let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - Kt <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
2479
2574
  return r ? {
2480
2575
  kind: r,
2481
2576
  end: e[n].end
@@ -2487,7 +2582,7 @@ ${ut}
2487
2582
  ]), s = p(0), [c, l] = m(0);
2488
2583
  d(() => {
2489
2584
  let e = typeof t == "number" ? t : 0, n = s.current;
2490
- s.current = e, e < n - Ht && l((e) => e + 1);
2585
+ s.current = e, e < n - Jt && l((e) => e + 1);
2491
2586
  }, [t]);
2492
2587
  let [u, h] = m(!1), g = o ? `${o.kind}@${o.end}` : "";
2493
2588
  return d(() => {
@@ -2496,23 +2591,23 @@ ${ut}
2496
2591
  return;
2497
2592
  }
2498
2593
  h(!0);
2499
- let e = setTimeout(() => h(!1), Vt);
2594
+ let e = setTimeout(() => h(!1), qt);
2500
2595
  return () => clearTimeout(e);
2501
2596
  }, [g, c]), d(() => {
2502
2597
  o || h(!1);
2503
- }, [o]), o ? /* @__PURE__ */ w("div", {
2504
- css: Wt,
2598
+ }, [o]), o ? /* @__PURE__ */ T("div", {
2599
+ css: Xt,
2505
2600
  className: u && !r ? "show" : "",
2506
- children: /* @__PURE__ */ w("button", {
2601
+ children: /* @__PURE__ */ T("button", {
2507
2602
  type: "button",
2508
2603
  className: "skip-chapter",
2509
2604
  onClick: () => {
2510
2605
  h(!1), n ? n(o.end) : i.seek(o.end);
2511
2606
  },
2512
- children: Ut[o.kind]
2607
+ children: Yt[o.kind]
2513
2608
  })
2514
2609
  }) : null;
2515
- }, Kt = 3e3, qt = g`
2610
+ }, Qt = 3e3, $t = g`
2516
2611
  position: absolute;
2517
2612
  inset: 0;
2518
2613
  z-index: 2;
@@ -2523,10 +2618,10 @@ ${ut}
2523
2618
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
2524
2619
  not, and transitioning it holds the item on screen for the length of the fade. */
2525
2620
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
2526
- `, Jt = (e, t) => {
2621
+ `, en = (e, t) => {
2527
2622
  let n = e.left - t.left, r = e.top - t.top;
2528
2623
  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')`;
2529
- }, Yt = g`
2624
+ }, tn = g`
2530
2625
  position: relative;
2531
2626
  background-color: black;
2532
2627
  display: flex;
@@ -2580,14 +2675,14 @@ ${ut}
2580
2675
  &.hide {
2581
2676
  cursor: none;
2582
2677
  }
2583
- `, Xt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2678
+ `, nn = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2584
2679
  let r = `${t}${l(e) && e.key != null ? e.key : n}`;
2585
- return l(e) && e.type === c ? Xt(e.props.children, `${r}/`) : [{
2680
+ return l(e) && e.type === c ? nn(e.props.children, `${r}/`) : [{
2586
2681
  key: r,
2587
2682
  item: e
2588
2683
  }];
2589
- }), Zt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2590
- let o = U(), s = U((e) => e.hideUI), c = U((e) => e.setHideUI), l = U((e) => e.hasMedia), u = U((e) => e.passThroughPictureInPicture), f = p(void 0), m = p("mouse"), h = p({
2684
+ }), rn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2685
+ let o = G(), s = G((e) => e.hideUI), c = G((e) => e.setHideUI), l = G((e) => e.hasMedia), u = G((e) => e.passThroughPictureInPicture), f = p(void 0), m = p("mouse"), h = p({
2591
2686
  x: -1,
2592
2687
  y: -1
2593
2688
  }), g = p(null);
@@ -2607,15 +2702,15 @@ ${ut}
2607
2702
  return !!n && g.current.contains(n) && !n.closest(".video");
2608
2703
  }, b = () => {
2609
2704
  if (y()) {
2610
- f.current = setTimeout(b, Kt);
2705
+ f.current = setTimeout(b, Qt);
2611
2706
  return;
2612
2707
  }
2613
2708
  _();
2614
2709
  }, x = () => {
2615
- c(!1), clearTimeout(f.current), f.current = setTimeout(b, Kt);
2710
+ c(!1), clearTimeout(f.current), f.current = setTimeout(b, Qt);
2616
2711
  };
2617
- return /* @__PURE__ */ T("div", {
2618
- css: Yt,
2712
+ return /* @__PURE__ */ E("div", {
2713
+ css: tn,
2619
2714
  ref: v,
2620
2715
  onPointerMove: (e) => {
2621
2716
  m.current = e.pointerType, e.pointerType === "mouse" && (h.current = {
@@ -2634,9 +2729,9 @@ ${ut}
2634
2729
  },
2635
2730
  className: s ? "hide" : "",
2636
2731
  children: [
2637
- /* @__PURE__ */ w(Ce, { onSubtitleRef: n }),
2638
- Xt(r).map(({ key: e, item: t }) => /* @__PURE__ */ w("div", {
2639
- css: qt,
2732
+ /* @__PURE__ */ T(ke, { onSubtitleRef: n }),
2733
+ nn(r).map(({ key: e, item: t }) => /* @__PURE__ */ T("div", {
2734
+ css: $t,
2640
2735
  style: { ...s ? {
2641
2736
  opacity: "0",
2642
2737
  visibility: "hidden",
@@ -2644,15 +2739,15 @@ ${ut}
2644
2739
  } : {} },
2645
2740
  children: t
2646
2741
  }, e)),
2647
- i === !1 ? null : /* @__PURE__ */ w(It, {}),
2648
- /* @__PURE__ */ w(zt, {}),
2649
- /* @__PURE__ */ w(Gt, {}),
2650
- u?.armed && g.current ? /* @__PURE__ */ w("div", {
2742
+ i === !1 ? null : /* @__PURE__ */ T(Ht, {}),
2743
+ /* @__PURE__ */ T(Gt, {}),
2744
+ /* @__PURE__ */ T(Zt, {}),
2745
+ u?.armed && g.current ? /* @__PURE__ */ T("div", {
2651
2746
  className: "pass-through",
2652
- style: { clipPath: Jt(u.armed, g.current.getBoundingClientRect()) },
2747
+ style: { clipPath: en(u.armed, g.current.getBoundingClientRect()) },
2653
2748
  onPointerOver: u.disarm
2654
2749
  }) : null,
2655
- /* @__PURE__ */ T("div", {
2750
+ /* @__PURE__ */ E("div", {
2656
2751
  className: "video",
2657
2752
  onClick: () => {
2658
2753
  if (m.current === "mouse") {
@@ -2661,109 +2756,127 @@ ${ut}
2661
2756
  }
2662
2757
  s ? x() : (clearTimeout(f.current), _());
2663
2758
  },
2664
- children: [t ? /* @__PURE__ */ w("video", {
2759
+ children: [t ? /* @__PURE__ */ T("video", {
2665
2760
  ref: t,
2666
2761
  playsInline: !0
2667
2762
  }) : null, a]
2668
2763
  })
2669
2764
  ]
2670
2765
  });
2671
- }, Qt = ({ options: e, children: t }) => {
2672
- 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: f, thumbnailsEnabled: h } = r ?? {}, g = b(), _ = y(), [v, x] = m(null), [S, C] = m(null), T = n?.media ?? v;
2673
- d(() => (g?.(T), () => g?.(null)), [T, g]);
2674
- let { expose: E } = e, D = E === !0 ? {} : E || void 0, O = p(D);
2675
- O.current = D;
2676
- let k = D ? D.id : void 0, A = D ? D.origin : void 0, j = D ? D.channel : void 0;
2766
+ }, an = ({ options: e, children: t }) => {
2767
+ let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead: h, thumbnailsEnabled: g } = r ?? {}, _ = b(), v = y(), [x, S] = m(null), [C, w] = m(null), E = n?.media ?? x;
2768
+ d(() => (_?.(E), () => _?.(null)), [E, _]);
2769
+ let { expose: D } = e, O = D === !0 ? {} : D || void 0, k = p(O);
2770
+ k.current = O;
2771
+ let A = O ? O.id : void 0, j = O ? O.origin : void 0, M = O ? O.channel : void 0;
2677
2772
  d(() => {
2678
- if (!E || !T) return;
2773
+ if (!D || !E) return;
2679
2774
  let e, t = !1;
2680
2775
  return import("./remote/index.js").then(({ exposePlayer: n }) => {
2681
- t || (e = n(T, O.current ?? {}));
2776
+ t || (e = n(E, k.current ?? {}));
2682
2777
  }).catch(() => {}), () => {
2683
2778
  t = !0, e?.();
2684
2779
  };
2685
2780
  }, [
2686
- T,
2687
- !!E,
2688
- k,
2781
+ E,
2782
+ !!D,
2689
2783
  A,
2690
- j
2691
- ]), oe(v, S, r);
2692
- let { thumbnails: M, requestThumbnail: N } = le({
2784
+ j,
2785
+ M
2786
+ ]), se(x, C, r);
2787
+ let N = r?.normalizeVolume, [P, F] = m(!!N);
2788
+ d(() => {
2789
+ F(!!N);
2790
+ }, [N]);
2791
+ let I = p(r?.onNormalizeVolumeChange);
2792
+ I.current = r?.onNormalizeVolumeChange;
2793
+ let L = r?.normalizerWorkletUrl, { refused: R } = Se(x, L, P), z = f(() => L && typeof AudioWorkletNode == "function" ? {
2794
+ enabled: P,
2795
+ available: !R,
2796
+ setEnabled: (e) => {
2797
+ F(e), I.current?.(e);
2798
+ }
2799
+ } : null, [
2800
+ L,
2801
+ P,
2802
+ R
2803
+ ]), { thumbnails: ee, requestThumbnail: B } = ue({
2693
2804
  publicPath: c,
2694
2805
  workerUrl: l,
2695
- length: h === !1 ? void 0 : o,
2696
- read: f ?? u,
2806
+ length: g === !1 ? void 0 : o,
2807
+ read: h ?? u,
2697
2808
  downloadedRanges: s
2698
- }), P = n?.thumbnails?.all ?? M, { toggle: F, mode: I, burnedIn: L } = ue(v, S), R = ge(n?.media ?? null, n?.pictureInPicture), z = U((e) => e.setSourceState), ee = n ? !!n.media : o !== void 0;
2809
+ }), V = n?.thumbnails?.all ?? ee, { toggle: H, mode: te, burnedIn: U } = de(x, C), W = _e(n?.media ?? null, n?.pictureInPicture), K = G((e) => e.setSourceState), q = n ? !!n.media : o !== void 0;
2699
2810
  d(() => {
2700
- z({
2811
+ K({
2701
2812
  title: i,
2702
2813
  size: o,
2703
2814
  downloadedRanges: s,
2704
- hasMedia: ee
2815
+ hasMedia: q
2705
2816
  });
2706
2817
  }, [
2707
- z,
2818
+ K,
2708
2819
  i,
2709
2820
  o,
2710
2821
  s,
2711
- ee
2822
+ q
2712
2823
  ]);
2713
- let B = n?.thumbnails?.at;
2824
+ let J = n?.thumbnails?.at;
2714
2825
  d(() => {
2715
- z({
2716
- thumbnails: P,
2717
- thumbnailAt: B,
2718
- requestThumbnail: N,
2719
- togglePictureInPicture: F,
2720
- pictureInPictureMode: I,
2721
- burnedInSubtitles: L
2826
+ K({
2827
+ thumbnails: V,
2828
+ thumbnailAt: J,
2829
+ requestThumbnail: B,
2830
+ togglePictureInPicture: H,
2831
+ pictureInPictureMode: te,
2832
+ burnedInSubtitles: U
2722
2833
  });
2723
2834
  }, [
2724
- z,
2725
- P,
2835
+ K,
2836
+ V,
2837
+ J,
2726
2838
  B,
2727
- N,
2728
- F,
2729
- I,
2730
- L
2839
+ H,
2840
+ te,
2841
+ U
2731
2842
  ]), d(() => {
2732
- z({ passThroughPictureInPicture: R });
2733
- }, [z, R]);
2734
- let V = n?.subtitles?.selection, H = n?.audioTracks?.selection;
2843
+ K({ volumeNormalizer: z });
2844
+ }, [K, z]), d(() => {
2845
+ K({ passThroughPictureInPicture: W });
2846
+ }, [K, W]);
2847
+ let Y = n?.subtitles?.selection, X = n?.audioTracks?.selection;
2735
2848
  return d(() => {
2736
- V && z({
2737
- subtitleTracks: V.options.map(({ id: e, label: t, disabled: n }) => ({
2849
+ Y && K({
2850
+ subtitleTracks: Y.options.map(({ id: e, label: t, disabled: n }) => ({
2738
2851
  id: e,
2739
2852
  label: t,
2740
2853
  disabled: n
2741
2854
  })),
2742
- selectedSubtitleTrack: V.selectedId ?? void 0,
2743
- selectSubtitleTrack: (e) => V.select(e == null ? null : String(e)),
2744
- subtitleOffLabel: V.offLabel
2855
+ selectedSubtitleTrack: Y.selectedId ?? void 0,
2856
+ selectSubtitleTrack: (e) => Y.select(e == null ? null : String(e)),
2857
+ subtitleOffLabel: Y.offLabel
2745
2858
  });
2746
- }, [z, V]), d(() => {
2747
- H && z({
2748
- audioTracks: H.options.map(({ id: e, label: t, disabled: n }) => ({
2859
+ }, [K, Y]), d(() => {
2860
+ X && K({
2861
+ audioTracks: X.options.map(({ id: e, label: t, disabled: n }) => ({
2749
2862
  id: e,
2750
2863
  label: t,
2751
2864
  disabled: n
2752
2865
  })),
2753
- selectedAudioTrack: H.selectedId ?? void 0,
2754
- selectAudioTrack: (e) => H.select(String(e))
2866
+ selectedAudioTrack: X.selectedId ?? void 0,
2867
+ selectAudioTrack: (e) => X.select(String(e))
2755
2868
  });
2756
- }, [z, H]), d(() => {
2757
- a && z({ chapters: a });
2758
- }, [z, a]), /* @__PURE__ */ w(Zt, {
2759
- ref: _,
2760
- onVideoRef: n ? void 0 : x,
2761
- onSubtitleRef: C,
2869
+ }, [K, X]), d(() => {
2870
+ a && K({ chapters: a });
2871
+ }, [K, a]), /* @__PURE__ */ T(rn, {
2872
+ ref: v,
2873
+ onVideoRef: n ? void 0 : S,
2874
+ onSubtitleRef: w,
2762
2875
  overlay: e.overlay,
2763
2876
  controls: e.controls,
2764
2877
  children: t
2765
2878
  });
2766
- }, $t = g`
2879
+ }, on = g`
2767
2880
  /**
2768
2881
  * The chrome's whole scale, in one place.
2769
2882
  *
@@ -2833,17 +2946,17 @@ ${ut}
2833
2946
  height: 100%;
2834
2947
  width: 100%;
2835
2948
  overflow: hidden;
2836
- `, en = (e) => /* @__PURE__ */ w("div", {
2837
- css: $t,
2838
- children: /* @__PURE__ */ w(H.Provider, { children: /* @__PURE__ */ w(Qt, {
2949
+ `, sn = (e) => /* @__PURE__ */ T("div", {
2950
+ css: on,
2951
+ children: /* @__PURE__ */ T(W.Provider, { children: /* @__PURE__ */ T(an, {
2839
2952
  options: e,
2840
2953
  children: e.children
2841
2954
  }) })
2842
- }), tn = (e) => !!e && typeof e == "object" && "at" in e, nn = (e) => !!e && typeof e == "object" && "selection" in e, rn = ({ blob: e, name: t }) => ({
2955
+ }), cn = (e) => !!e && typeof e == "object" && "at" in e, ln = (e) => !!e && typeof e == "object" && "selection" in e, un = ({ blob: e, name: t }) => ({
2843
2956
  length: e.size,
2844
2957
  name: t ?? (e instanceof File ? e.name : void 0),
2845
2958
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
2846
- }), an = async (e, t) => {
2959
+ }), dn = async (e, t) => {
2847
2960
  let n = await fetch(e, {
2848
2961
  headers: { Range: "bytes=0-1" },
2849
2962
  credentials: t
@@ -2853,8 +2966,8 @@ ${ut}
2853
2966
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
2854
2967
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
2855
2968
  return i;
2856
- }, on = async ({ url: e, length: t, name: n, credentials: r }) => {
2857
- let i = t ?? await an(e, r);
2969
+ }, fn = async ({ url: e, length: t, name: n, credentials: r }) => {
2970
+ let i = t ?? await dn(e, r);
2858
2971
  return {
2859
2972
  length: i,
2860
2973
  name: n,
@@ -2869,9 +2982,9 @@ ${ut}
2869
2982
  return o.arrayBuffer();
2870
2983
  }
2871
2984
  };
2872
- }, sn = async (e) => {
2873
- if ("blob" in e) return rn(e);
2874
- if ("url" in e) return on(e);
2985
+ }, pn = async (e) => {
2986
+ if ("blob" in e) return un(e);
2987
+ if ("url" in e) return fn(e);
2875
2988
  if ("read" in e) return {
2876
2989
  length: e.length,
2877
2990
  name: e.name,
@@ -2880,4 +2993,4 @@ ${ut}
2880
2993
  throw Error(`Unknown source type: ${e}`);
2881
2994
  };
2882
2995
  //#endregion
2883
- export { en as MediaPlayer, en as default, H as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, sn as inputToRemuxerInput, nn as isDelegatedTracks, tn as isExternalThumbnails, V as sourceFeature, i as startPlayback, ue as usePictureInPicture, U as usePlayer, le as useSeekThumbnails };
2996
+ export { sn as MediaPlayer, sn as default, W as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, pn as inputToRemuxerInput, ln as isDelegatedTracks, cn as isExternalThumbnails, U as sourceFeature, i as startPlayback, de as usePictureInPicture, G as usePlayer, ue as useSeekThumbnails };