@banou/media-player 0.10.9 → 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 { Captions as E, CaptionsOff as D, Check as O, ChevronLeft as k, ChevronRight as A, Copy as j, Maximize as M, Minimize as N, Pause as P, Play as F, RotateCcw as I, Settings as L, TriangleAlert as R, Volume1 as z, Volume2 as B, VolumeX as ee } from "lucide-react";
8
- import { Tooltip as V } 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 H = {
11
+ var te = {
11
12
  indexes: [],
12
13
  chapters: [],
13
14
  thumbnails: [],
@@ -26,23 +27,24 @@ var H = {
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
- }, te = x({
35
+ }, U = x({
34
36
  name: "source",
35
- state: () => ({ ...H }),
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
- }), U = v({
43
- features: [...S, te],
44
+ }), W = v({
45
+ features: [...S, U],
44
46
  displayName: "MediaPlayer"
45
- }), W = U.usePlayer, G = (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,28 +53,28 @@ var H = {
51
53
  } catch {
52
54
  return;
53
55
  }
54
- }, K = (e) => e?.replace(/_/g, " ").trim() || void 0, q = (e) => {
55
- let t = e.map((e) => G(e.language) ?? K(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 = K(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
- }, ne = (e) => q(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
- })), J = [
71
+ })), X = [
70
72
  0,
71
73
  250,
72
74
  1e3,
73
75
  3e3,
74
76
  1e4
75
- ], Y = 6e4, re = 500, ie = 15e3, ae = (e) => e instanceof Error ? e.message : String(e), oe = (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) {
@@ -83,7 +85,7 @@ var H = {
83
85
  }
84
86
  return t.length ? t.join("\n") : void 0;
85
87
  }, se = (e, t, r) => {
86
- let a = W(), { 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);
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,
@@ -130,7 +132,7 @@ var H = {
130
132
  });
131
133
  }, [a, x]), L = u((e) => {
132
134
  typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), w(e));
133
- }, [a]), R = W((e) => e.setSourceState);
135
+ }, [a]), R = G((e) => e.setSourceState);
134
136
  d(() => {
135
137
  R({
136
138
  selectSubtitleTrack: F,
@@ -175,11 +177,11 @@ var H = {
175
177
  let t = n(e);
176
178
  if (u(e, t), t) {
177
179
  let t = performance.now();
178
- t - D.current.at > Y && (D.current = {
180
+ t - D.current.at > ne && (D.current = {
179
181
  count: 0,
180
182
  at: t
181
183
  });
182
- let n = J[Math.min(D.current.count, J.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 H = {
216
218
  onSeek: (e) => N.current?.(e),
217
219
  onSubtitleStreams: (e) => {
218
220
  r || a.setSourceState({
219
- subtitleTracks: ne(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: ne(e),
227
+ audioTracks: Y(e),
226
228
  selectedAudioTrack: t
227
229
  });
228
230
  }
@@ -397,7 +399,80 @@ var H = {
397
399
  g,
398
400
  S
399
401
  ]);
400
- }, X = {
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 H = {
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
- }, ve = g`
502
+ }, Ce = g`
428
503
  display: flex;
429
504
  justify-content: center;
430
505
  align-items: center;
@@ -437,7 +512,7 @@ var H = {
437
512
  margin: auto;
438
513
  pointer-events: none;
439
514
  }
440
- `, ye = g`
515
+ `, we = g`
441
516
  position: absolute;
442
517
  top: 0;
443
518
  left: 0;
@@ -445,7 +520,7 @@ var H = {
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
- ${X.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 H = {
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
- `, be = _`
544
+ `, Te = _`
470
545
  to { transform: rotate(360deg); }
471
- `, xe = g`
546
+ `, Ee = g`
472
547
  position: absolute;
473
548
  inset: 0;
474
549
  z-index: 2;
@@ -484,46 +559,46 @@ var H = {
484
559
  border-radius: 50%;
485
560
  border: 3px solid rgba(255, 255, 255, 0.25);
486
561
  border-top-color: #fff;
487
- animation: ${be} 0.8s linear infinite;
562
+ animation: ${Te} 0.8s linear infinite;
488
563
  }
489
- `, Se = 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
- ${X.bLarge.regular}
571
+ ${Z.bLarge.regular}
497
572
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
498
573
  pointer-events: none;
499
- `, Ce = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", we = ({ onSubtitleRef: e }) => {
500
- let t = W((e) => e.title), n = W((e) => e.hideUI), r = W((e) => e.playbackError), i = W((e) => e.ready), a = W((e) => e.size), o = W((e) => e.waiting), s = W((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: ye,
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: xe }) : void 0,
512
- r ? /* @__PURE__ */ w("div", {
513
- css: Se,
514
- children: Ce(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: ve
594
+ css: Ce
520
595
  })
521
596
  ] });
522
- }, Te = 1e-4, Ee = 1, De = (e) => Math.max(Te, Math.min(Ee, e)) ** 2, Oe = (e) => Math.max(Te, Math.min(Ee, e)) ** (Ee / 2), Z = (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
- }, ke = (e, t) => `${Z(e)} / ${Z(t)}`, Ae = (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 H = {
555
630
  z-index: 3;
556
631
 
557
632
  * {
558
- ${X.bMedium.regular}
633
+ ${Z.bMedium.regular}
559
634
  }
560
635
 
561
636
  ${e === "sm" && g`
@@ -571,17 +646,17 @@ var H = {
571
646
  x: -1,
572
647
  y: -1,
573
648
  anchors: 0
574
- }, je = (e) => {
649
+ }, Le = (e) => {
575
650
  Q.x = e.clientX, Q.y = e.clientY;
576
- }, Me = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", je, {
651
+ }, Re = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", Le, {
577
652
  capture: !0,
578
653
  passive: !0
579
654
  }), () => {
580
- --Q.anchors === 0 && window.removeEventListener("pointermove", je, { capture: !0 });
655
+ --Q.anchors === 0 && window.removeEventListener("pointermove", Le, { capture: !0 });
581
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 = Me(), 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();
@@ -592,7 +667,7 @@ var H = {
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 H = {
601
676
  "data-tooltip-delay-hide": i,
602
677
  "data-tooltip-place": o,
603
678
  children: n
604
- }), !s && /* @__PURE__ */ w(V, {
679
+ }), !s && /* @__PURE__ */ T(H, {
605
680
  ref: u,
606
- css: Ae(c),
681
+ css: Ie(c),
607
682
  id: e,
608
683
  noArrow: !0,
609
684
  children: t
610
685
  })] });
611
- }, Ne = ({ 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 H = {
647
722
  style: { touchAction: "none" }
648
723
  }
649
724
  };
650
- }, Pe = 2, Fe = .005, Ie = "#000", Le = "#0000", Re = (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 <= Fe || 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
- }, ze = (e, t) => {
663
- let n = Pe / 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) ? Ie : Le} ${c} ${l}`), a !== r && i.push(`${Le} 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
- }, Be = /* @__PURE__ */ new Set([
744
+ }, Ke = /* @__PURE__ */ new Set([
670
745
  "op",
671
746
  "ops",
672
747
  "opening",
@@ -674,7 +749,7 @@ var H = {
674
749
  "ncop",
675
750
  "オープニング",
676
751
  "op主題歌"
677
- ]), Ve = /* @__PURE__ */ new Set([
752
+ ]), qe = /* @__PURE__ */ new Set([
678
753
  "ed",
679
754
  "eds",
680
755
  "ending",
@@ -687,13 +762,13 @@ var H = {
687
762
  "エンドカード",
688
763
  "エンドロール",
689
764
  "ed主題歌"
690
- ]), He = /* @__PURE__ */ new Set(["intro", "イントロ"]), Ue = /* @__PURE__ */ new Set(["outro", "アウトロ"]), We = {
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
- }, Ge = /* @__PURE__ */ new Set([
771
+ }, Ze = /* @__PURE__ */ new Set([
697
772
  "theme",
698
773
  "themes",
699
774
  "song",
@@ -712,53 +787,53 @@ var H = {
712
787
  "the",
713
788
  "主題歌",
714
789
  "ノンクレジット"
715
- ]), Ke = /* @__PURE__ */ new Set([
790
+ ]), Qe = /* @__PURE__ */ new Set([
716
791
  "post",
717
792
  "pre",
718
793
  "after",
719
794
  "before",
720
795
  "non"
721
- ]), qe = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, Je = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), Ye = (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) && !Ge.has(e)), Xe = (e, t) => {
722
- if (Be.has(e)) return "opening";
723
- if (Ve.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 (He.has(e)) return "opening";
726
- if (Ue.has(e)) return "ending";
800
+ if (Je.has(e)) return "opening";
801
+ if (Ye.has(e)) return "ending";
727
802
  }
728
- }, Ze = (e, t) => {
729
- if (Je(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 We) return We[n] ?? void 0;
732
- let r = n.split(qe).map((e) => e.trim()).filter(Boolean);
733
- if (r.some((e) => e.split(/[\s_]+/u).some((e) => Ke.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 = Ye(e);
811
+ let n = tt(e);
737
812
  if (n.length !== 1) continue;
738
- let r = Xe(n[0], t);
813
+ let r = nt(n[0], t);
739
814
  if (r) return r;
740
815
  }
741
- }, Qe = 15, $e = 87, et = 93, tt = (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 >= $e && e <= et), 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
- }, nt = (e) => {
751
- let t = e.map(({ title: e }) => Ze(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 < Qe) return;
829
+ if (e.end - e.start < it) return;
755
830
  let r = t[n];
756
831
  if (r) return r;
757
- let i = Ze(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 }) => Je(e)) ? tt(e) : i;
761
- }, rt = 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 H = {
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
- ${X.bMedium.bold}
921
+ ${Z.bMedium.bold}
847
922
 
848
923
  gap: calc(.6 * var(--mp-unit));
849
924
 
@@ -977,24 +1052,24 @@ var H = {
977
1052
  --thumbnail-width: calc(18 * var(--mp-unit));
978
1053
  --thumbnail-half: calc(9 * var(--mp-unit));
979
1054
  }
980
- `, it = 4, at = () => {
981
- let e = W(), t = W((e) => e.currentTime), n = W((e) => e.requestSeek), r = W((e) => e.duration), i = W((e) => e.size), a = W((e) => e.downloadedRanges), o = W((e) => e.buffered), s = W((e) => e.indexes), c = W((e) => e.thumbnails), l = W((e) => e.thumbnailAt), u = W((e) => e.requestThumbnail), h = W((e) => e.chapters), g = W((e) => e.seekingTo), _ = W((e) => e.setSourceState), v = W((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 } = Ne({
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 > it && (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,20 +1080,20 @@ var H = {
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();
1012
1087
  return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
1013
1088
  }, R = p("mouse"), z = (e) => {
1014
1089
  R.current = e.pointerType;
1015
- }, B = (e) => {
1016
- R.current !== "touch" && E(L(e.clientX));
1017
- }, ee = () => {
1018
- y.current && E(void 0);
1090
+ }, ee = (e) => {
1091
+ R.current !== "touch" && w(L(e.clientX));
1092
+ }, B = () => {
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})`,
@@ -1055,22 +1130,22 @@ var H = {
1055
1130
  N,
1056
1131
  b,
1057
1132
  g
1058
- ]), G = f(() => Re(h, r), [h, r]), K = G.length > 0, q = f(() => {
1133
+ ]), W = f(() => We(h, r), [h, r]), K = W.length > 0, q = f(() => {
1059
1134
  if (!K || S === void 0 || !r) return -1;
1060
- let e = S / r * 100, t = G.findIndex((t, n) => n < G.length - 1 && e >= t && e < G[n + 1]);
1061
- return t >= 0 ? t : G.length - 2;
1135
+ let e = S / r * 100, t = W.findIndex((t, n) => n < W.length - 1 && e >= t && e < W[n + 1]);
1136
+ return t >= 0 ? t : W.length - 2;
1062
1137
  }, [
1063
1138
  K,
1064
- G,
1139
+ W,
1065
1140
  S,
1066
1141
  r
1067
- ]), ne = f(() => K ? ze(G, (e) => e !== q) : void 0, [
1142
+ ]), J = f(() => K ? Ge(W, (e) => e !== q) : void 0, [
1068
1143
  K,
1069
- G,
1144
+ W,
1070
1145
  q
1071
- ]), J = f(() => q >= 0 ? ze(G, (e) => e === q) : void 0, [G, q]), Y = f(() => {
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]), re = 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,26 +1154,26 @@ var H = {
1079
1154
  c,
1080
1155
  l,
1081
1156
  S
1082
- ]), ie = (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
1170
  style: { transform: `scaleX(${U})` }
1096
1171
  })
1097
1172
  })
1098
1173
  ]
1099
1174
  });
1100
- return /* @__PURE__ */ T("div", {
1101
- css: rt,
1175
+ return /* @__PURE__ */ E("div", {
1176
+ css: lt,
1102
1177
  ref: y,
1103
1178
  className: [
1104
1179
  "progress-bar",
@@ -1107,43 +1182,43 @@ var H = {
1107
1182
  ].filter(Boolean).join(" "),
1108
1183
  onPointerDown: z,
1109
1184
  onPointerMove: z,
1110
- onMouseMove: B,
1111
- onMouseOut: ee,
1185
+ onMouseMove: ee,
1186
+ onMouseOut: B,
1112
1187
  children: [
1113
- ie(void 0, ne),
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: Y ? `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: Y ? "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: Z(S)
1123
- }), Y ? /* @__PURE__ */ w("span", {
1197
+ children: Pe(S)
1198
+ }), X ? /* @__PURE__ */ T("span", {
1124
1199
  className: "chapter-title",
1125
- children: Y.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
- J ? ie("focus", J) : 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: re?.url ? /* @__PURE__ */ w("img", { src: re.url }) : void 0
1217
+ children: ne?.url ? /* @__PURE__ */ T("img", { src: ne.url }) : void 0
1143
1218
  })
1144
1219
  ]
1145
1220
  });
1146
- }, ot = "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", st = {
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,12 +1228,12 @@ var H = {
1153
1228
  strokeWidth: 2,
1154
1229
  strokeLinecap: "round",
1155
1230
  strokeLinejoin: "round"
1156
- }, ct = (e) => /* @__PURE__ */ T("svg", {
1157
- ...st,
1231
+ }, mt = (e) => /* @__PURE__ */ E("svg", {
1232
+ ...pt,
1158
1233
  ...e,
1159
1234
  children: [
1160
- /* @__PURE__ */ w("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1161
- /* @__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", {
1162
1237
  x: "12",
1163
1238
  y: "13",
1164
1239
  width: "10",
@@ -1166,14 +1241,14 @@ var H = {
1166
1241
  rx: "1",
1167
1242
  ry: "1"
1168
1243
  }),
1169
- /* @__PURE__ */ w("path", { d: "M14.5 18.5h2m2 0h1" })
1244
+ /* @__PURE__ */ T("path", { d: "M14.5 18.5h2m2 0h1" })
1170
1245
  ]
1171
- }), lt = (e) => /* @__PURE__ */ T("svg", {
1172
- ...st,
1246
+ }), ht = (e) => /* @__PURE__ */ E("svg", {
1247
+ ...pt,
1173
1248
  ...e,
1174
1249
  children: [
1175
- /* @__PURE__ */ w("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1176
- /* @__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", {
1177
1252
  x: "12",
1178
1253
  y: "13",
1179
1254
  width: "10",
@@ -1181,9 +1256,9 @@ var H = {
1181
1256
  rx: "1",
1182
1257
  ry: "1"
1183
1258
  }),
1184
- /* @__PURE__ */ w("path", { d: "M6 9h3m2 0h2" })
1259
+ /* @__PURE__ */ T("path", { d: "M6 9h3m2 0h2" })
1185
1260
  ]
1186
- }), ut = g`
1261
+ }), gt = g`
1187
1262
  .popover {
1188
1263
  position: absolute;
1189
1264
  /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
@@ -1222,7 +1297,7 @@ var H = {
1222
1297
 
1223
1298
  border-radius: 8px;
1224
1299
  background-color: rgba(28,28,28,0.95);
1225
- ${X.bMedium.regular}
1300
+ ${Z.bMedium.regular}
1226
1301
 
1227
1302
  z-index: 4;
1228
1303
 
@@ -1265,7 +1340,7 @@ var H = {
1265
1340
 
1266
1341
  .secondary {
1267
1342
  color: #eee;
1268
- ${X.bSmall.regular}
1343
+ ${Z.bSmall.regular}
1269
1344
  }
1270
1345
  }
1271
1346
  }
@@ -1307,29 +1382,29 @@ var H = {
1307
1382
  .failed {
1308
1383
  border-bottom: 1px solid #4D4D4E;
1309
1384
  color: #f66;
1310
- ${X.bSmall.regular}
1385
+ ${Z.bSmall.regular}
1311
1386
  }
1312
1387
  }
1313
- `, 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 }) => {
1314
1389
  let c = o !== void 0, l = (e, i, a) => {
1315
1390
  let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
1316
- return /* @__PURE__ */ T("div", {
1391
+ return /* @__PURE__ */ E("div", {
1317
1392
  onClick: () => {
1318
1393
  l || r(e ?? void 0);
1319
1394
  },
1320
1395
  className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
1321
- 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 ? "✓" : "" })]
1322
1397
  }, e ?? "__off__");
1323
1398
  };
1324
- return /* @__PURE__ */ T("div", {
1399
+ return /* @__PURE__ */ E("div", {
1325
1400
  className: "popover track-list",
1326
1401
  children: [
1327
- /* @__PURE__ */ T("div", {
1402
+ /* @__PURE__ */ E("div", {
1328
1403
  className: i ? "back" : "back no-hover",
1329
1404
  onClick: i,
1330
- children: [i ? /* @__PURE__ */ w(k, {}) : null, /* @__PURE__ */ w("span", { children: e })]
1405
+ children: [i ? /* @__PURE__ */ T(A, {}) : null, /* @__PURE__ */ T("span", { children: e })]
1331
1406
  }),
1332
- s ? /* @__PURE__ */ w("div", {
1407
+ s ? /* @__PURE__ */ T("div", {
1333
1408
  className: "no-hover failed",
1334
1409
  children: "Could not switch. Try again."
1335
1410
  }) : null,
@@ -1337,7 +1412,7 @@ var H = {
1337
1412
  t.map(({ id: e, label: t }) => l(e, t, "description"))
1338
1413
  ]
1339
1414
  });
1340
- }, ft = ({ onReset: e } = {}) => {
1415
+ }, vt = ({ onReset: e } = {}) => {
1341
1416
  let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
1342
1417
  c.current = e;
1343
1418
  let l = () => {
@@ -1378,7 +1453,7 @@ var H = {
1378
1453
  });
1379
1454
  }
1380
1455
  };
1381
- }, pt = g`
1456
+ }, yt = g`
1382
1457
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1383
1458
  which is the width of the player box, so it can be clamped to it. */
1384
1459
  position: static;
@@ -1394,7 +1469,7 @@ position: static;
1394
1469
  }
1395
1470
  }
1396
1471
 
1397
- ${ut}
1472
+ ${gt}
1398
1473
 
1399
1474
  .popover.error-list {
1400
1475
  /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
@@ -1422,7 +1497,7 @@ ${ut}
1422
1497
 
1423
1498
  color: #fff;
1424
1499
  cursor: pointer;
1425
- ${X.bSmall.regular}
1500
+ ${Z.bSmall.regular}
1426
1501
 
1427
1502
  &:hover {
1428
1503
  background-color: rgba(255,255,255,.1);
@@ -1443,7 +1518,7 @@ ${ut}
1443
1518
 
1444
1519
  .when {
1445
1520
  color: #bbb;
1446
- ${X.bSmall.regular}
1521
+ ${Z.bSmall.regular}
1447
1522
 
1448
1523
  /* the one part of the line worth scanning for, so it is the one part at full brightness */
1449
1524
  .count {
@@ -1462,72 +1537,72 @@ ${ut}
1462
1537
  color: #ddd;
1463
1538
  overflow-wrap: anywhere;
1464
1539
  white-space: pre-wrap;
1465
- ${X.bSmall.regular}
1540
+ ${Z.bSmall.regular}
1466
1541
  }
1467
1542
  }
1468
1543
  }
1469
- `, mt = (e) => new Date(e).toLocaleTimeString(), ht = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Z(Math.max(0, e)), gt = (e) => e.reduce((e, t) => e + t.count, 0), _t = (e) => e.map((e, t) => {
1470
- 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();
1471
1546
  return [
1472
1547
  `${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
1473
1548
  e.message,
1474
1549
  e.detail
1475
1550
  ].filter(Boolean).join("\n");
1476
- }).join("\n\n"), vt = () => {
1477
- let e = W((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);
1478
1553
  if (e.length === 0) return null;
1479
1554
  let o = () => {
1480
- navigator.clipboard?.writeText(_t(e)).then(() => {
1555
+ navigator.clipboard?.writeText(Ct(e)).then(() => {
1481
1556
  a(!0), setTimeout(() => a(!1), 2e3);
1482
1557
  }, (e) => console.warn("[media-player] could not copy the errors:", e));
1483
- }, s = `Playback errors (${gt(e)})`;
1484
- return /* @__PURE__ */ T("div", {
1485
- css: pt,
1558
+ }, s = `Playback errors (${St(e)})`;
1559
+ return /* @__PURE__ */ E("div", {
1560
+ css: yt,
1486
1561
  ref: r,
1487
- children: [/* @__PURE__ */ w($, {
1562
+ children: [/* @__PURE__ */ T($, {
1488
1563
  id: "errors",
1489
1564
  disabled: t,
1490
- text: /* @__PURE__ */ w("button", {
1565
+ text: /* @__PURE__ */ T("button", {
1491
1566
  className: "errors",
1492
1567
  type: "button",
1493
1568
  onClick: n,
1494
1569
  "aria-label": s,
1495
1570
  "aria-expanded": t,
1496
- children: /* @__PURE__ */ w(R, { className: "alert-triangle" })
1571
+ children: /* @__PURE__ */ T(z, { className: "alert-triangle" })
1497
1572
  }),
1498
- toolTipText: /* @__PURE__ */ w("span", { children: s })
1499
- }), t && /* @__PURE__ */ T("div", {
1573
+ toolTipText: /* @__PURE__ */ T("span", { children: s })
1574
+ }), t && /* @__PURE__ */ E("div", {
1500
1575
  className: "popover error-list",
1501
- children: [/* @__PURE__ */ T("div", {
1576
+ children: [/* @__PURE__ */ E("div", {
1502
1577
  className: "back no-hover",
1503
- children: [/* @__PURE__ */ w("span", { children: s }), /* @__PURE__ */ T("button", {
1578
+ children: [/* @__PURE__ */ T("span", { children: s }), /* @__PURE__ */ E("button", {
1504
1579
  className: "copy",
1505
1580
  type: "button",
1506
1581
  onClick: o,
1507
1582
  "aria-label": "Copy the errors",
1508
- children: [w(i ? O : j, {}), /* @__PURE__ */ w("span", { children: i ? "Copied" : "Copy" })]
1583
+ children: [T(i ? k : M, {}), /* @__PURE__ */ T("span", { children: i ? "Copied" : "Copy" })]
1509
1584
  })]
1510
- }), e.map((e, t) => /* @__PURE__ */ T("div", {
1585
+ }), e.map((e, t) => /* @__PURE__ */ E("div", {
1511
1586
  className: "entry no-hover",
1512
1587
  children: [
1513
- /* @__PURE__ */ T("span", {
1588
+ /* @__PURE__ */ E("span", {
1514
1589
  className: "when",
1515
1590
  children: [
1516
- mt(e.at),
1517
- e.count > 1 ? ` to ${mt(e.lastAt)}` : "",
1518
- 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)}` : "",
1519
1594
  e.recovered ? " recovered" : "",
1520
- e.count > 1 ? /* @__PURE__ */ w("span", {
1595
+ e.count > 1 ? /* @__PURE__ */ T("span", {
1521
1596
  className: "count",
1522
1597
  children: `×${e.count}`
1523
1598
  }) : null
1524
1599
  ]
1525
1600
  }),
1526
- /* @__PURE__ */ w("span", {
1601
+ /* @__PURE__ */ T("span", {
1527
1602
  className: "what",
1528
1603
  children: e.message
1529
1604
  }),
1530
- e.detail ? /* @__PURE__ */ w("span", {
1605
+ e.detail ? /* @__PURE__ */ T("span", {
1531
1606
  className: "cause",
1532
1607
  children: e.detail
1533
1608
  }) : null
@@ -1535,7 +1610,7 @@ ${ut}
1535
1610
  }, `${e.at}-${t}`))]
1536
1611
  })]
1537
1612
  });
1538
- }, yt = g`
1613
+ }, Tt = g`
1539
1614
  display: flex;
1540
1615
  align-items: center;
1541
1616
  justify-content: center;
@@ -1588,8 +1663,8 @@ width: 100%;
1588
1663
  }
1589
1664
  }
1590
1665
  }
1591
- `, bt = () => {
1592
- let e = W(), t = W((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 } = Ne({
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({
1593
1668
  ref: r,
1594
1669
  onChange: (t) => e.setPlaybackRate(l(t))
1595
1670
  }), f = (t) => {
@@ -1604,26 +1679,26 @@ width: 100%;
1604
1679
  };
1605
1680
  }, [t]);
1606
1681
  let m = c(s);
1607
- return /* @__PURE__ */ T("div", {
1608
- css: yt,
1609
- 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", {
1610
1685
  className: "playback-slider",
1611
1686
  ref: n,
1612
1687
  ...u,
1613
- children: /* @__PURE__ */ w("div", {
1688
+ children: /* @__PURE__ */ T("div", {
1614
1689
  ref: r,
1615
1690
  style: { background: `linear-gradient(to right,
1616
1691
  #fff 0% ${m}%,
1617
1692
  #3A3A3A ${m}% 100%
1618
1693
  )` },
1619
- children: /* @__PURE__ */ w("div", {
1694
+ children: /* @__PURE__ */ T("div", {
1620
1695
  className: "playback-handle",
1621
1696
  style: { left: `${m}%` }
1622
1697
  })
1623
1698
  })
1624
1699
  })]
1625
1700
  });
1626
- }, xt = g`
1701
+ }, Dt = g`
1627
1702
  /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
1628
1703
  as wide as the player box and can therefore be clamped to it. The outside-click check uses
1629
1704
  \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
@@ -1641,7 +1716,42 @@ position: static;
1641
1716
  }
1642
1717
  }
1643
1718
 
1644
- ${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
+ }
1645
1755
 
1646
1756
  .playback-rate {
1647
1757
  .slider {
@@ -1682,91 +1792,107 @@ ${ut}
1682
1792
  }
1683
1793
  }
1684
1794
 
1685
- `, St = () => {
1686
- let e = W(), t = W((e) => e.playbackRate), n = W((e) => e.audioTracks), r = W((e) => e.selectedAudioTrack), i = W((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) => {
1687
- e.setPlaybackRate(t), o(0);
1688
- }, h = (e) => {
1689
- e !== void 0 && f(e, () => i(e));
1690
- }, g = (e) => () => {
1691
- 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);
1692
1802
  };
1693
- return /* @__PURE__ */ T("div", {
1694
- css: xt,
1695
- ref: l,
1803
+ return /* @__PURE__ */ E("div", {
1804
+ css: Dt,
1805
+ ref: u,
1696
1806
  children: [
1697
- /* @__PURE__ */ w($, {
1807
+ /* @__PURE__ */ T($, {
1698
1808
  id: "settings",
1699
- disabled: s,
1700
- text: /* @__PURE__ */ w("button", {
1809
+ disabled: c,
1810
+ text: /* @__PURE__ */ T("button", {
1701
1811
  className: "settings",
1702
1812
  type: "button",
1703
- onClick: c,
1813
+ onClick: l,
1704
1814
  "aria-label": "Settings",
1705
- "aria-expanded": s,
1706
- children: /* @__PURE__ */ w(L, {})
1815
+ "aria-expanded": c,
1816
+ children: /* @__PURE__ */ T(R, {})
1707
1817
  }),
1708
- toolTipText: /* @__PURE__ */ w("span", { children: "Settings" })
1818
+ toolTipText: /* @__PURE__ */ T("span", { children: "Settings" })
1709
1819
  }),
1710
- s && a === 0 && /* @__PURE__ */ T("div", {
1820
+ c && o === 0 && /* @__PURE__ */ E("div", {
1711
1821
  className: "popover menu",
1712
- children: [n.length > 1 ? /* @__PURE__ */ T("div", {
1713
- onClick: g(2),
1714
- children: [/* @__PURE__ */ w("div", { children: "Audio" }), /* @__PURE__ */ w("div", { children: /* @__PURE__ */ w(A, {}) })]
1715
- }) : null, /* @__PURE__ */ T("div", {
1716
- onClick: g(1),
1717
- children: [/* @__PURE__ */ w("div", { children: "Playback speed" }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("span", {
1718
- className: "secondary",
1719
- children: t === 1 ? "(Default)" : t.toFixed(2)
1720
- }), /* @__PURE__ */ w(A, {})] })]
1721
- })]
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
+ ]
1722
1848
  }),
1723
- s && a === 1 && /* @__PURE__ */ T("div", {
1849
+ c && o === 1 && /* @__PURE__ */ E("div", {
1724
1850
  className: "popover playback-rate",
1725
1851
  children: [
1726
- /* @__PURE__ */ T("div", {
1852
+ /* @__PURE__ */ E("div", {
1727
1853
  className: "back",
1728
- onClick: g(0),
1729
- children: [/* @__PURE__ */ w(k, {}), /* @__PURE__ */ w("span", { children: "Playback speed" })]
1854
+ onClick: _(0),
1855
+ children: [/* @__PURE__ */ T(A, {}), /* @__PURE__ */ T("span", { children: "Playback speed" })]
1730
1856
  }),
1731
- /* @__PURE__ */ w("div", {
1857
+ /* @__PURE__ */ T("div", {
1732
1858
  className: "slider no-hover",
1733
- children: /* @__PURE__ */ w(bt, {})
1859
+ children: /* @__PURE__ */ T(Et, {})
1734
1860
  }),
1735
- /* @__PURE__ */ T("div", {
1861
+ /* @__PURE__ */ E("div", {
1736
1862
  className: "options no-hover",
1737
1863
  children: [
1738
- /* @__PURE__ */ w("div", {
1739
- onClick: () => p(.5),
1864
+ /* @__PURE__ */ T("div", {
1865
+ onClick: () => h(.5),
1740
1866
  children: "0.5x"
1741
1867
  }),
1742
- /* @__PURE__ */ w("div", {
1743
- onClick: () => p(1),
1868
+ /* @__PURE__ */ T("div", {
1869
+ onClick: () => h(1),
1744
1870
  children: "1x"
1745
1871
  }),
1746
- /* @__PURE__ */ w("div", {
1747
- onClick: () => p(1.5),
1872
+ /* @__PURE__ */ T("div", {
1873
+ onClick: () => h(1.5),
1748
1874
  children: "1.5x"
1749
1875
  }),
1750
- /* @__PURE__ */ w("div", {
1751
- onClick: () => p(2),
1876
+ /* @__PURE__ */ T("div", {
1877
+ onClick: () => h(2),
1752
1878
  children: "2x"
1753
1879
  })
1754
1880
  ]
1755
1881
  })
1756
1882
  ]
1757
1883
  }),
1758
- s && a === 2 && /* @__PURE__ */ w(dt, {
1884
+ c && o === 2 && /* @__PURE__ */ T(_t, {
1759
1885
  title: "Audio",
1760
1886
  tracks: n,
1761
1887
  selected: r,
1762
- onSelect: h,
1763
- onBack: g(0),
1764
- pending: u,
1765
- failed: d
1888
+ onSelect: g,
1889
+ onBack: _(0),
1890
+ pending: d,
1891
+ failed: f
1766
1892
  })
1767
1893
  ]
1768
1894
  });
1769
- }, Ct = g`
1895
+ }, kt = g`
1770
1896
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1771
1897
  which is the width of the player box, so it can be clamped to it. */
1772
1898
  position: static;
@@ -1782,28 +1908,28 @@ position: static;
1782
1908
  }
1783
1909
  }
1784
1910
 
1785
- ${ut}
1786
- `, wt = () => {
1787
- let e = W((e) => e.subtitleTracks), t = W((e) => e.selectedSubtitleTrack), n = W((e) => e.selectSubtitleTrack), r = W((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();
1788
1914
  if (e.length === 0) return null;
1789
1915
  let u = t !== void 0;
1790
- return /* @__PURE__ */ T("div", {
1791
- css: Ct,
1916
+ return /* @__PURE__ */ E("div", {
1917
+ css: kt,
1792
1918
  ref: o,
1793
- children: [/* @__PURE__ */ w($, {
1919
+ children: [/* @__PURE__ */ T($, {
1794
1920
  id: "subtitles",
1795
1921
  disabled: i,
1796
- text: /* @__PURE__ */ w("button", {
1922
+ text: /* @__PURE__ */ T("button", {
1797
1923
  className: "subtitles",
1798
1924
  type: "button",
1799
1925
  onClick: a,
1800
1926
  "aria-label": "Subtitles",
1801
1927
  "aria-expanded": i,
1802
1928
  "aria-pressed": u,
1803
- children: u ? /* @__PURE__ */ w(E, { className: "captions" }) : /* @__PURE__ */ w(D, { className: "captions-off" })
1929
+ children: u ? /* @__PURE__ */ T(D, { className: "captions" }) : /* @__PURE__ */ T(O, { className: "captions-off" })
1804
1930
  }),
1805
- toolTipText: /* @__PURE__ */ w("span", { children: "Subtitles" })
1806
- }), i && /* @__PURE__ */ w(dt, {
1931
+ toolTipText: /* @__PURE__ */ T("span", { children: "Subtitles" })
1932
+ }), i && /* @__PURE__ */ T(_t, {
1807
1933
  title: "Subtitles",
1808
1934
  tracks: e,
1809
1935
  selected: t,
@@ -1813,13 +1939,13 @@ ${ut}
1813
1939
  failed: c
1814
1940
  })]
1815
1941
  });
1816
- }, Tt = {
1942
+ }, jt = {
1817
1943
  primary: "#EAEBEE",
1818
1944
  secondary: "#D0D0D9",
1819
1945
  hover: "rgba(255, 255, 255, 0.13)",
1820
1946
  borderPrimary: "#384F70",
1821
1947
  backgroundTooltip: "#222222"
1822
- }, Et = g`
1948
+ }, Mt = g`
1823
1949
  display: flex;
1824
1950
  align-items: center;
1825
1951
 
@@ -1862,8 +1988,8 @@ ${ut}
1862
1988
  width: 10px;
1863
1989
  height: 10px;
1864
1990
  }
1865
- `, Dt = ({ value: e, onChange: t }) => {
1866
- let n = W((e) => e.volume), r = W((e) => e.muted), i = p(null), a = p(null), { handlers: o } = Ne({
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({
1867
1993
  ref: a,
1868
1994
  onChange: t
1869
1995
  }), s = (n) => {
@@ -1877,31 +2003,31 @@ ${ut}
1877
2003
  e && e.removeEventListener("wheel", s);
1878
2004
  };
1879
2005
  }, [e]);
1880
- let c = e * 100, l = f(() => Math.round(r ? 0 : Oe(n) * 100), [n, r]);
1881
- return /* @__PURE__ */ w($, {
2006
+ let c = e * 100, l = f(() => Math.round(r ? 0 : Ne(n) * 100), [n, r]);
2007
+ return /* @__PURE__ */ T($, {
1882
2008
  id: "volume-slider",
1883
- text: /* @__PURE__ */ w("div", {
2009
+ text: /* @__PURE__ */ T("div", {
1884
2010
  ref: i,
1885
- css: Et,
2011
+ css: Mt,
1886
2012
  ...o,
1887
- children: /* @__PURE__ */ w("div", {
2013
+ children: /* @__PURE__ */ T("div", {
1888
2014
  ref: a,
1889
2015
  style: { background: `linear-gradient(to right,
1890
2016
  #fff 0% ${c}%,
1891
2017
  #3A3A3A ${c}% 100%
1892
2018
  )` },
1893
- children: /* @__PURE__ */ w("div", {
2019
+ children: /* @__PURE__ */ T("div", {
1894
2020
  className: "volume-handle",
1895
2021
  style: { left: `${e * 100}%` }
1896
2022
  })
1897
2023
  })
1898
2024
  }),
1899
- toolTipText: /* @__PURE__ */ T("div", {
2025
+ toolTipText: /* @__PURE__ */ E("div", {
1900
2026
  className: "volume-value",
1901
2027
  children: [l, "%"]
1902
2028
  })
1903
2029
  });
1904
- }, Ot = g`
2030
+ }, Pt = g`
1905
2031
  position: relative;
1906
2032
  display: flex;
1907
2033
  align-items: center;
@@ -1926,7 +2052,7 @@ ${ut}
1926
2052
  border-radius: 4px;
1927
2053
 
1928
2054
  .volume-value {
1929
- ${X.bMedium.regular};
2055
+ ${Z.bMedium.regular};
1930
2056
  color: #ffffff;
1931
2057
  }
1932
2058
  }
@@ -1964,39 +2090,39 @@ ${ut}
1964
2090
  }
1965
2091
  }
1966
2092
 
1967
- `, kt = ({ ref: e }) => {
1968
- let t = W(), n = W((e) => e.volume), r = W((e) => e.muted), i = f(() => Oe(n), [n]);
1969
- return /* @__PURE__ */ T("div", {
1970
- css: Ot,
1971
- children: [/* @__PURE__ */ w($, {
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($, {
1972
2098
  id: "sound",
1973
- text: /* @__PURE__ */ w("button", {
2099
+ text: /* @__PURE__ */ T("button", {
1974
2100
  className: "sound",
1975
2101
  type: "button",
1976
2102
  onClick: () => t.toggleMuted(),
1977
2103
  ref: e,
1978
2104
  "aria-label": "Mute",
1979
2105
  "aria-pressed": r || n === 0,
1980
- children: w(r || n === 0 ? ee : n <= .5 ? z : B, {
2106
+ children: T(r || n === 0 ? V : n <= .5 ? ee : B, {
1981
2107
  size: 18,
1982
2108
  color: "#fff"
1983
2109
  })
1984
2110
  }),
1985
- toolTipText: /* @__PURE__ */ w("span", { children: r ? "Unmute (m)" : "Mute (m)" })
1986
- }), /* @__PURE__ */ w("div", {
2111
+ toolTipText: /* @__PURE__ */ T("span", { children: r ? "Unmute (m)" : "Mute (m)" })
2112
+ }), /* @__PURE__ */ T("div", {
1987
2113
  className: "volume-slider-container",
1988
- children: /* @__PURE__ */ w("div", {
2114
+ children: /* @__PURE__ */ T("div", {
1989
2115
  className: "volume-slider-background",
1990
- children: /* @__PURE__ */ w(Dt, {
2116
+ children: /* @__PURE__ */ T(Nt, {
1991
2117
  value: r ? 0 : i,
1992
2118
  onChange: (e) => {
1993
- t.setVolume(De(e));
2119
+ t.setVolume(Me(e));
1994
2120
  }
1995
2121
  })
1996
2122
  })
1997
2123
  })]
1998
2124
  });
1999
- }, At = .05, jt = 5, Mt = 50, Nt = 1e3, Pt = g`
2125
+ }, It = .05, Lt = 5, Rt = 50, zt = 1e3, Bt = g`
2000
2126
  display: flex;
2001
2127
  flex-direction: column;
2002
2128
  gap: calc(0.4 * var(--mp-unit));
@@ -2005,7 +2131,7 @@ ${ut}
2005
2131
  opacity: 0.72;
2006
2132
  font-size: 0.9em;
2007
2133
  }
2008
- `, Ft = g`
2134
+ `, Vt = g`
2009
2135
  position: absolute;
2010
2136
  bottom: 0;
2011
2137
  width: 100%;
@@ -2097,7 +2223,7 @@ ${ut}
2097
2223
  /* .armed is the hover of a control letting its click through, which takes no pointer events
2098
2224
  of its own and so is never :hover */
2099
2225
  :hover, &.armed {
2100
- background-color: ${Tt.hover};
2226
+ background-color: ${jt.hover};
2101
2227
  }
2102
2228
 
2103
2229
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -2114,7 +2240,7 @@ ${ut}
2114
2240
 
2115
2241
  .left {
2116
2242
  .time {
2117
- ${X.bMedium.regular}
2243
+ ${Z.bMedium.regular}
2118
2244
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
2119
2245
  }
2120
2246
  }
@@ -2135,10 +2261,10 @@ ${ut}
2135
2261
  }
2136
2262
  }
2137
2263
  }
2138
- `, It = () => {
2139
- let e = W(), t = W((e) => e.paused), n = W((e) => e.currentTime), r = W((e) => e.duration), i = W((e) => e.seekingTo), a = W((e) => e.fullscreen), o = W((e) => e.hideUI), s = W((e) => e.togglePictureInPicture), c = W((e) => e.pictureInPictureMode), l = W((e) => e.burnedInSubtitles), f = W((e) => e.passThroughPictureInPicture), h = W((e) => e.subtitleTracks), g = W((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 }) => {
2140
- let r = Oe(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
2141
- e.setVolume(De(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();
2142
2268
  }, [e]);
2143
2269
  d(() => {
2144
2270
  let t = (t) => g ? g(t) : e.seek(t), n = (n) => {
@@ -2149,35 +2275,35 @@ ${ut}
2149
2275
  else if (n.key === "k") e.togglePaused();
2150
2276
  else if (n.key === " ") e.togglePaused();
2151
2277
  else if (n.key === "m") e.toggleMuted();
2152
- else if (n.key === "ArrowUp") E({
2278
+ else if (n.key === "ArrowUp") w({
2153
2279
  direction: "up",
2154
- stepSize: At
2280
+ stepSize: It
2155
2281
  });
2156
- else if (n.key === "ArrowDown") E({
2282
+ else if (n.key === "ArrowDown") w({
2157
2283
  direction: "down",
2158
- stepSize: At
2284
+ stepSize: It
2159
2285
  });
2160
2286
  else if (n.key === "ArrowRight") {
2161
2287
  if (!e.duration) return;
2162
- t(Math.min(e.currentTime + jt, e.duration));
2163
- } 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;
2164
2290
  i && n.preventDefault();
2165
2291
  };
2166
2292
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
2167
2293
  }, [
2168
2294
  e,
2169
- E,
2295
+ w,
2170
2296
  g
2171
2297
  ]);
2172
2298
  let D = u((e) => {
2173
- e.preventDefault(), e.deltaY < 0 ? E({
2299
+ e.preventDefault(), e.deltaY < 0 ? w({
2174
2300
  direction: "up",
2175
- stepSize: At
2176
- }) : E({
2301
+ stepSize: It
2302
+ }) : w({
2177
2303
  direction: "down",
2178
- stepSize: At
2304
+ stepSize: It
2179
2305
  });
2180
- }, [E]);
2306
+ }, [w]);
2181
2307
  d(() => {
2182
2308
  if (_) return _.addEventListener("wheel", D, { passive: !1 }), () => _.removeEventListener("wheel", D);
2183
2309
  }, [_, D]);
@@ -2201,49 +2327,49 @@ ${ut}
2201
2327
  }
2202
2328
  let n = y.current, r = document.activeElement;
2203
2329
  n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
2204
- }, Mt);
2330
+ }, Rt);
2205
2331
  return b.current = t, () => {
2206
- e = Date.now() + Nt;
2332
+ e = Date.now() + zt;
2207
2333
  };
2208
- }, [k]), d(() => () => clearInterval(b.current), []), /* @__PURE__ */ T("div", {
2209
- css: Ft,
2334
+ }, [k]), d(() => () => clearInterval(b.current), []), /* @__PURE__ */ E("div", {
2335
+ css: Vt,
2210
2336
  style: { ...o ? {
2211
2337
  opacity: "0",
2212
2338
  pointerEvents: "none"
2213
2339
  } : k ? { pointerEvents: "none" } : {} },
2214
- children: [/* @__PURE__ */ w(at, {}), /* @__PURE__ */ T("div", {
2340
+ children: [/* @__PURE__ */ T(dt, {}), /* @__PURE__ */ E("div", {
2215
2341
  className: "actions",
2216
- children: [/* @__PURE__ */ T("div", {
2342
+ children: [/* @__PURE__ */ E("div", {
2217
2343
  className: "left",
2218
2344
  children: [
2219
- /* @__PURE__ */ w($, {
2345
+ /* @__PURE__ */ T($, {
2220
2346
  id: "play",
2221
2347
  tooltipPlace: "top-start",
2222
- text: /* @__PURE__ */ w("button", {
2348
+ text: /* @__PURE__ */ T("button", {
2223
2349
  className: "play",
2224
2350
  type: "button",
2225
2351
  onClick: () => e.togglePaused(),
2226
2352
  "aria-label": C ? "Replay" : t ? "Play" : "Pause",
2227
- children: w(C ? I : t ? F : P, {})
2353
+ children: T(C ? L : t ? I : F, {})
2228
2354
  }),
2229
- 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)" })
2230
2356
  }),
2231
- /* @__PURE__ */ w(kt, { ref: v }),
2232
- /* @__PURE__ */ w("div", {
2357
+ /* @__PURE__ */ T(Ft, { ref: v }),
2358
+ /* @__PURE__ */ T("div", {
2233
2359
  className: "time",
2234
- children: ke(i ?? n, r)
2360
+ children: Fe(i ?? n, r)
2235
2361
  })
2236
2362
  ]
2237
- }), /* @__PURE__ */ T("div", {
2363
+ }), /* @__PURE__ */ E("div", {
2238
2364
  className: "right",
2239
2365
  children: [
2240
- /* @__PURE__ */ w(vt, {}),
2241
- /* @__PURE__ */ w(wt, {}),
2242
- /* @__PURE__ */ w(St, {}),
2243
- f ? /* @__PURE__ */ w($, {
2366
+ /* @__PURE__ */ T(wt, {}),
2367
+ /* @__PURE__ */ T(At, {}),
2368
+ /* @__PURE__ */ T(Ot, {}),
2369
+ f ? /* @__PURE__ */ T($, {
2244
2370
  id: "picture-in-picture",
2245
2371
  tooltipPlace: "top-end",
2246
- text: /* @__PURE__ */ w("button", {
2372
+ text: /* @__PURE__ */ T("button", {
2247
2373
  ref: y,
2248
2374
  className: f.armed ? "picture-in-picture armed" : "picture-in-picture",
2249
2375
  type: "button",
@@ -2252,56 +2378,56 @@ ${ut}
2252
2378
  onClick: f.active ? f.exit : void 0,
2253
2379
  "aria-label": "Picture in picture",
2254
2380
  "aria-pressed": f.active,
2255
- children: /* @__PURE__ */ w("img", {
2256
- src: ot,
2381
+ children: /* @__PURE__ */ T("img", {
2382
+ src: ft,
2257
2383
  alt: ""
2258
2384
  })
2259
2385
  }),
2260
- toolTipText: /* @__PURE__ */ w("span", { children: f.active ? "Exit picture in picture" : "Picture in picture" })
2261
- }) : s ? /* @__PURE__ */ w($, {
2386
+ toolTipText: /* @__PURE__ */ T("span", { children: f.active ? "Exit picture in picture" : "Picture in picture" })
2387
+ }) : s ? /* @__PURE__ */ T($, {
2262
2388
  id: "picture-in-picture",
2263
2389
  tooltipPlace: "top-end",
2264
- text: /* @__PURE__ */ w("button", {
2390
+ text: /* @__PURE__ */ T("button", {
2265
2391
  className: "picture-in-picture",
2266
2392
  type: "button",
2267
2393
  onClick: s,
2268
2394
  disabled: x && !S,
2269
2395
  "aria-label": x ? "Put the subtitles in the video" : "Picture in picture",
2270
2396
  "aria-pressed": x ? l : void 0,
2271
- children: x ? w(l ? ct : lt, {}) : /* @__PURE__ */ w("img", {
2272
- src: ot,
2397
+ children: x ? T(l ? mt : ht, {}) : /* @__PURE__ */ T("img", {
2398
+ src: ft,
2273
2399
  alt: ""
2274
2400
  })
2275
2401
  }),
2276
- toolTipText: /* @__PURE__ */ T("span", {
2277
- css: Pt,
2278
- children: [/* @__PURE__ */ w("span", {
2402
+ toolTipText: /* @__PURE__ */ E("span", {
2403
+ css: Bt,
2404
+ children: [/* @__PURE__ */ T("span", {
2279
2405
  className: "lead",
2280
2406
  children: x ? S ? l ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
2281
- }), x && S ? /* @__PURE__ */ w("span", {
2407
+ }), x && S ? /* @__PURE__ */ T("span", {
2282
2408
  className: "hint",
2283
2409
  children: "Then hover the video and click your browser's own pop out button"
2284
2410
  }) : null]
2285
2411
  })
2286
2412
  }) : null,
2287
- /* @__PURE__ */ w($, {
2413
+ /* @__PURE__ */ T($, {
2288
2414
  id: "full-screen",
2289
2415
  tooltipPlace: "top-end",
2290
- text: /* @__PURE__ */ w("button", {
2416
+ text: /* @__PURE__ */ T("button", {
2291
2417
  className: "full-screen",
2292
2418
  type: "button",
2293
2419
  onClick: () => e.toggleFullscreen(),
2294
2420
  "aria-label": "Full screen",
2295
2421
  "aria-pressed": a,
2296
- children: w(a ? N : M, {})
2422
+ children: T(a ? P : N, {})
2297
2423
  }),
2298
- 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)" })
2299
2425
  })
2300
2426
  ]
2301
2427
  })]
2302
2428
  })]
2303
2429
  });
2304
- }, Lt = 9e3, Rt = g`
2430
+ }, Ut = 9e3, Wt = g`
2305
2431
  position: absolute;
2306
2432
  inset: 0;
2307
2433
  z-index: 2;
@@ -2339,12 +2465,12 @@ ${ut}
2339
2465
  }
2340
2466
 
2341
2467
  .title {
2342
- ${X.bMedium.bold}
2468
+ ${Z.bMedium.bold}
2343
2469
  color: #fff;
2344
2470
  }
2345
2471
 
2346
2472
  .body {
2347
- ${X.bSmall.regular}
2473
+ ${Z.bSmall.regular}
2348
2474
  color: rgba(255, 255, 255, 0.75);
2349
2475
  }
2350
2476
 
@@ -2355,42 +2481,42 @@ ${ut}
2355
2481
  line-height: 1;
2356
2482
  color: #fff;
2357
2483
  }
2358
- `, zt = () => {
2359
- let e = W((e) => e.burnedInSubtitles), t = W((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);
2360
2486
  return d(() => {
2361
2487
  if (t !== "burn-in" || !e) {
2362
2488
  r(!1);
2363
2489
  return;
2364
2490
  }
2365
2491
  r(!0);
2366
- let n = setTimeout(() => r(!1), Lt);
2492
+ let n = setTimeout(() => r(!1), Ut);
2367
2493
  return () => clearTimeout(n);
2368
- }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ w("div", {
2369
- css: Rt,
2494
+ }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ T("div", {
2495
+ css: Wt,
2370
2496
  className: n ? "show" : "",
2371
2497
  role: "status",
2372
- children: /* @__PURE__ */ T("div", {
2498
+ children: /* @__PURE__ */ E("div", {
2373
2499
  className: "card",
2374
- children: [/* @__PURE__ */ T("div", {
2500
+ children: [/* @__PURE__ */ E("div", {
2375
2501
  className: "words",
2376
- children: [/* @__PURE__ */ w("div", {
2502
+ children: [/* @__PURE__ */ T("div", {
2377
2503
  className: "title",
2378
2504
  children: "Subtitles are in the picture"
2379
- }), /* @__PURE__ */ w("div", {
2505
+ }), /* @__PURE__ */ T("div", {
2380
2506
  className: "body",
2381
2507
  children: "Now hover the video and click your browser's own pop out button"
2382
2508
  })]
2383
- }), /* @__PURE__ */ w("div", {
2509
+ }), /* @__PURE__ */ T("div", {
2384
2510
  className: "arrow",
2385
2511
  "aria-hidden": "true",
2386
2512
  children: "→"
2387
2513
  })]
2388
2514
  })
2389
2515
  });
2390
- }, Bt = 1, Vt = 6e3, Ht = 1, Ut = {
2516
+ }, Kt = 1, qt = 6e3, Jt = 1, Yt = {
2391
2517
  opening: "Skip Opening",
2392
2518
  ending: "Skip Ending"
2393
- }, Wt = g`
2519
+ }, Xt = g`
2394
2520
  position: absolute;
2395
2521
  inset: 0;
2396
2522
  z-index: 2;
@@ -2407,7 +2533,7 @@ ${ut}
2407
2533
  pointer-events: auto;
2408
2534
  cursor: pointer;
2409
2535
 
2410
- ${X.bMedium.bold}
2536
+ ${Z.bMedium.bold}
2411
2537
  color: #fff;
2412
2538
  padding: calc(1 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
2413
2539
  border: 1px solid rgba(255, 255, 255, .55);
@@ -2441,10 +2567,10 @@ ${ut}
2441
2567
  bottom: calc(9 * var(--mp-unit));
2442
2568
  }
2443
2569
  }
2444
- `, Gt = () => {
2445
- let e = W((e) => e.chapters), t = W((e) => e.currentTime), n = W((e) => e.requestSeek), r = W((e) => e.seekPreview), i = W(), a = f(() => nt(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(() => {
2446
2572
  if (typeof t != "number") return;
2447
- 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;
2448
2574
  return r ? {
2449
2575
  kind: r,
2450
2576
  end: e[n].end
@@ -2456,7 +2582,7 @@ ${ut}
2456
2582
  ]), s = p(0), [c, l] = m(0);
2457
2583
  d(() => {
2458
2584
  let e = typeof t == "number" ? t : 0, n = s.current;
2459
- s.current = e, e < n - Ht && l((e) => e + 1);
2585
+ s.current = e, e < n - Jt && l((e) => e + 1);
2460
2586
  }, [t]);
2461
2587
  let [u, h] = m(!1), g = o ? `${o.kind}@${o.end}` : "";
2462
2588
  return d(() => {
@@ -2465,23 +2591,23 @@ ${ut}
2465
2591
  return;
2466
2592
  }
2467
2593
  h(!0);
2468
- let e = setTimeout(() => h(!1), Vt);
2594
+ let e = setTimeout(() => h(!1), qt);
2469
2595
  return () => clearTimeout(e);
2470
2596
  }, [g, c]), d(() => {
2471
2597
  o || h(!1);
2472
- }, [o]), o ? /* @__PURE__ */ w("div", {
2473
- css: Wt,
2598
+ }, [o]), o ? /* @__PURE__ */ T("div", {
2599
+ css: Xt,
2474
2600
  className: u && !r ? "show" : "",
2475
- children: /* @__PURE__ */ w("button", {
2601
+ children: /* @__PURE__ */ T("button", {
2476
2602
  type: "button",
2477
2603
  className: "skip-chapter",
2478
2604
  onClick: () => {
2479
2605
  h(!1), n ? n(o.end) : i.seek(o.end);
2480
2606
  },
2481
- children: Ut[o.kind]
2607
+ children: Yt[o.kind]
2482
2608
  })
2483
2609
  }) : null;
2484
- }, Kt = 3e3, qt = g`
2610
+ }, Qt = 3e3, $t = g`
2485
2611
  position: absolute;
2486
2612
  inset: 0;
2487
2613
  z-index: 2;
@@ -2492,10 +2618,10 @@ ${ut}
2492
2618
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
2493
2619
  not, and transitioning it holds the item on screen for the length of the fade. */
2494
2620
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
2495
- `, Jt = (e, t) => {
2621
+ `, en = (e, t) => {
2496
2622
  let n = e.left - t.left, r = e.top - t.top;
2497
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')`;
2498
- }, Yt = g`
2624
+ }, tn = g`
2499
2625
  position: relative;
2500
2626
  background-color: black;
2501
2627
  display: flex;
@@ -2549,14 +2675,14 @@ ${ut}
2549
2675
  &.hide {
2550
2676
  cursor: none;
2551
2677
  }
2552
- `, Xt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2678
+ `, nn = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2553
2679
  let r = `${t}${l(e) && e.key != null ? e.key : n}`;
2554
- return l(e) && e.type === c ? Xt(e.props.children, `${r}/`) : [{
2680
+ return l(e) && e.type === c ? nn(e.props.children, `${r}/`) : [{
2555
2681
  key: r,
2556
2682
  item: e
2557
2683
  }];
2558
- }), Zt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2559
- let o = W(), s = W((e) => e.hideUI), c = W((e) => e.setHideUI), l = W((e) => e.hasMedia), u = W((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({
2560
2686
  x: -1,
2561
2687
  y: -1
2562
2688
  }), g = p(null);
@@ -2576,15 +2702,15 @@ ${ut}
2576
2702
  return !!n && g.current.contains(n) && !n.closest(".video");
2577
2703
  }, b = () => {
2578
2704
  if (y()) {
2579
- f.current = setTimeout(b, Kt);
2705
+ f.current = setTimeout(b, Qt);
2580
2706
  return;
2581
2707
  }
2582
2708
  _();
2583
2709
  }, x = () => {
2584
- c(!1), clearTimeout(f.current), f.current = setTimeout(b, Kt);
2710
+ c(!1), clearTimeout(f.current), f.current = setTimeout(b, Qt);
2585
2711
  };
2586
- return /* @__PURE__ */ T("div", {
2587
- css: Yt,
2712
+ return /* @__PURE__ */ E("div", {
2713
+ css: tn,
2588
2714
  ref: v,
2589
2715
  onPointerMove: (e) => {
2590
2716
  m.current = e.pointerType, e.pointerType === "mouse" && (h.current = {
@@ -2603,9 +2729,9 @@ ${ut}
2603
2729
  },
2604
2730
  className: s ? "hide" : "",
2605
2731
  children: [
2606
- /* @__PURE__ */ w(we, { onSubtitleRef: n }),
2607
- Xt(r).map(({ key: e, item: t }) => /* @__PURE__ */ w("div", {
2608
- css: qt,
2732
+ /* @__PURE__ */ T(ke, { onSubtitleRef: n }),
2733
+ nn(r).map(({ key: e, item: t }) => /* @__PURE__ */ T("div", {
2734
+ css: $t,
2609
2735
  style: { ...s ? {
2610
2736
  opacity: "0",
2611
2737
  visibility: "hidden",
@@ -2613,15 +2739,15 @@ ${ut}
2613
2739
  } : {} },
2614
2740
  children: t
2615
2741
  }, e)),
2616
- i === !1 ? null : /* @__PURE__ */ w(It, {}),
2617
- /* @__PURE__ */ w(zt, {}),
2618
- /* @__PURE__ */ w(Gt, {}),
2619
- 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", {
2620
2746
  className: "pass-through",
2621
- style: { clipPath: Jt(u.armed, g.current.getBoundingClientRect()) },
2747
+ style: { clipPath: en(u.armed, g.current.getBoundingClientRect()) },
2622
2748
  onPointerOver: u.disarm
2623
2749
  }) : null,
2624
- /* @__PURE__ */ T("div", {
2750
+ /* @__PURE__ */ E("div", {
2625
2751
  className: "video",
2626
2752
  onClick: () => {
2627
2753
  if (m.current === "mouse") {
@@ -2630,109 +2756,127 @@ ${ut}
2630
2756
  }
2631
2757
  s ? x() : (clearTimeout(f.current), _());
2632
2758
  },
2633
- children: [t ? /* @__PURE__ */ w("video", {
2759
+ children: [t ? /* @__PURE__ */ T("video", {
2634
2760
  ref: t,
2635
2761
  playsInline: !0
2636
2762
  }) : null, a]
2637
2763
  })
2638
2764
  ]
2639
2765
  });
2640
- }, Qt = ({ options: e, children: t }) => {
2641
- 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;
2642
- d(() => (g?.(T), () => g?.(null)), [T, g]);
2643
- let { expose: E } = e, D = E === !0 ? {} : E || void 0, O = p(D);
2644
- O.current = D;
2645
- 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;
2646
2772
  d(() => {
2647
- if (!E || !T) return;
2773
+ if (!D || !E) return;
2648
2774
  let e, t = !1;
2649
2775
  return import("./remote/index.js").then(({ exposePlayer: n }) => {
2650
- t || (e = n(T, O.current ?? {}));
2776
+ t || (e = n(E, k.current ?? {}));
2651
2777
  }).catch(() => {}), () => {
2652
2778
  t = !0, e?.();
2653
2779
  };
2654
2780
  }, [
2655
- T,
2656
- !!E,
2657
- k,
2781
+ E,
2782
+ !!D,
2658
2783
  A,
2659
- j
2660
- ]), se(v, S, r);
2661
- let { thumbnails: M, requestThumbnail: N } = ue({
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({
2662
2804
  publicPath: c,
2663
2805
  workerUrl: l,
2664
- length: h === !1 ? void 0 : o,
2665
- read: f ?? u,
2806
+ length: g === !1 ? void 0 : o,
2807
+ read: h ?? u,
2666
2808
  downloadedRanges: s
2667
- }), P = n?.thumbnails?.all ?? M, { toggle: F, mode: I, burnedIn: L } = de(v, S), R = _e(n?.media ?? null, n?.pictureInPicture), z = W((e) => e.setSourceState), B = 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;
2668
2810
  d(() => {
2669
- z({
2811
+ K({
2670
2812
  title: i,
2671
2813
  size: o,
2672
2814
  downloadedRanges: s,
2673
- hasMedia: B
2815
+ hasMedia: q
2674
2816
  });
2675
2817
  }, [
2676
- z,
2818
+ K,
2677
2819
  i,
2678
2820
  o,
2679
2821
  s,
2680
- B
2822
+ q
2681
2823
  ]);
2682
- let ee = n?.thumbnails?.at;
2824
+ let J = n?.thumbnails?.at;
2683
2825
  d(() => {
2684
- z({
2685
- thumbnails: P,
2686
- thumbnailAt: ee,
2687
- requestThumbnail: N,
2688
- togglePictureInPicture: F,
2689
- pictureInPictureMode: I,
2690
- burnedInSubtitles: L
2826
+ K({
2827
+ thumbnails: V,
2828
+ thumbnailAt: J,
2829
+ requestThumbnail: B,
2830
+ togglePictureInPicture: H,
2831
+ pictureInPictureMode: te,
2832
+ burnedInSubtitles: U
2691
2833
  });
2692
2834
  }, [
2693
- z,
2694
- P,
2695
- ee,
2696
- N,
2697
- F,
2698
- I,
2699
- L
2835
+ K,
2836
+ V,
2837
+ J,
2838
+ B,
2839
+ H,
2840
+ te,
2841
+ U
2700
2842
  ]), d(() => {
2701
- z({ passThroughPictureInPicture: R });
2702
- }, [z, R]);
2703
- 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;
2704
2848
  return d(() => {
2705
- V && z({
2706
- subtitleTracks: V.options.map(({ id: e, label: t, disabled: n }) => ({
2849
+ Y && K({
2850
+ subtitleTracks: Y.options.map(({ id: e, label: t, disabled: n }) => ({
2707
2851
  id: e,
2708
2852
  label: t,
2709
2853
  disabled: n
2710
2854
  })),
2711
- selectedSubtitleTrack: V.selectedId ?? void 0,
2712
- selectSubtitleTrack: (e) => V.select(e == null ? null : String(e)),
2713
- subtitleOffLabel: V.offLabel
2855
+ selectedSubtitleTrack: Y.selectedId ?? void 0,
2856
+ selectSubtitleTrack: (e) => Y.select(e == null ? null : String(e)),
2857
+ subtitleOffLabel: Y.offLabel
2714
2858
  });
2715
- }, [z, V]), d(() => {
2716
- H && z({
2717
- 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 }) => ({
2718
2862
  id: e,
2719
2863
  label: t,
2720
2864
  disabled: n
2721
2865
  })),
2722
- selectedAudioTrack: H.selectedId ?? void 0,
2723
- selectAudioTrack: (e) => H.select(String(e))
2866
+ selectedAudioTrack: X.selectedId ?? void 0,
2867
+ selectAudioTrack: (e) => X.select(String(e))
2724
2868
  });
2725
- }, [z, H]), d(() => {
2726
- a && z({ chapters: a });
2727
- }, [z, a]), /* @__PURE__ */ w(Zt, {
2728
- ref: _,
2729
- onVideoRef: n ? void 0 : x,
2730
- 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,
2731
2875
  overlay: e.overlay,
2732
2876
  controls: e.controls,
2733
2877
  children: t
2734
2878
  });
2735
- }, $t = g`
2879
+ }, on = g`
2736
2880
  /**
2737
2881
  * The chrome's whole scale, in one place.
2738
2882
  *
@@ -2802,17 +2946,17 @@ ${ut}
2802
2946
  height: 100%;
2803
2947
  width: 100%;
2804
2948
  overflow: hidden;
2805
- `, en = (e) => /* @__PURE__ */ w("div", {
2806
- css: $t,
2807
- children: /* @__PURE__ */ w(U.Provider, { children: /* @__PURE__ */ w(Qt, {
2949
+ `, sn = (e) => /* @__PURE__ */ T("div", {
2950
+ css: on,
2951
+ children: /* @__PURE__ */ T(W.Provider, { children: /* @__PURE__ */ T(an, {
2808
2952
  options: e,
2809
2953
  children: e.children
2810
2954
  }) })
2811
- }), 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 }) => ({
2812
2956
  length: e.size,
2813
2957
  name: t ?? (e instanceof File ? e.name : void 0),
2814
2958
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
2815
- }), an = async (e, t) => {
2959
+ }), dn = async (e, t) => {
2816
2960
  let n = await fetch(e, {
2817
2961
  headers: { Range: "bytes=0-1" },
2818
2962
  credentials: t
@@ -2822,8 +2966,8 @@ ${ut}
2822
2966
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
2823
2967
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
2824
2968
  return i;
2825
- }, on = async ({ url: e, length: t, name: n, credentials: r }) => {
2826
- 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);
2827
2971
  return {
2828
2972
  length: i,
2829
2973
  name: n,
@@ -2838,9 +2982,9 @@ ${ut}
2838
2982
  return o.arrayBuffer();
2839
2983
  }
2840
2984
  };
2841
- }, sn = async (e) => {
2842
- if ("blob" in e) return rn(e);
2843
- 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);
2844
2988
  if ("read" in e) return {
2845
2989
  length: e.length,
2846
2990
  name: e.name,
@@ -2849,4 +2993,4 @@ ${ut}
2849
2993
  throw Error(`Unknown source type: ${e}`);
2850
2994
  };
2851
2995
  //#endregion
2852
- export { en as MediaPlayer, en as default, U as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, sn as inputToRemuxerInput, nn as isDelegatedTracks, tn as isExternalThumbnails, te as sourceFeature, i as startPlayback, de as usePictureInPicture, W as usePlayer, ue 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 };