@banou/media-player 0.10.6 → 0.10.8

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
@@ -1,17 +1,18 @@
1
1
  import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-C6PdWBah.js";
2
- import { Children as s, Fragment as c, isValidElement as l, useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
3
- import { css as h, keyframes as g } from "@emotion/react";
4
- import { createPlayer as _, useContainerAttach as v, useMediaAttach as y } from "@videojs/react";
5
- import { definePlayerFeature as b, videoFeatures as x } from "@videojs/core/dom";
6
- import { Fragment as S, jsx as C, jsxs as w } from "@emotion/react/jsx-runtime";
7
- import { AlertTriangle as T, Check as E, ChevronLeft as D, ChevronRight as O, Copy as k, Maximize as A, Minimize as j, Pause as M, Play as N, RotateCcw as P, Settings as F, Volume1 as I, Volume2 as L, VolumeX as R } from "react-feather";
8
- import { Tooltip as z } from "react-tooltip";
2
+ import { Children as s, Fragment as c, isValidElement as l, useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
3
+ import { css as g, keyframes as _ } from "@emotion/react";
4
+ import { createPlayer as v, useContainerAttach as y, useMediaAttach as b } from "@videojs/react";
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";
9
9
  //#region src/lib/react/source-feature.ts
10
10
  var B = {
11
11
  indexes: [],
12
12
  chapters: [],
13
13
  thumbnails: [],
14
14
  requestThumbnail: () => {},
15
+ seekPreview: !1,
15
16
  subtitleTracks: [],
16
17
  selectedSubtitleTrack: void 0,
17
18
  selectSubtitleTrack: () => {},
@@ -22,13 +23,14 @@ var B = {
22
23
  setHideUI: () => {},
23
24
  hasMedia: !1,
24
25
  togglePictureInPicture: null,
26
+ passThroughPictureInPicture: null,
25
27
  pictureInPictureMode: null,
26
28
  burnedInSubtitles: !1,
27
29
  playbackError: null,
28
30
  playbackErrors: [],
29
31
  ready: !1,
30
32
  setSourceState: () => {}
31
- }, V = b({
33
+ }, V = x({
32
34
  name: "source",
33
35
  state: () => ({ ...B }),
34
36
  attach({ set: e }) {
@@ -37,10 +39,10 @@ var B = {
37
39
  setHideUI: (t) => e({ hideUI: t })
38
40
  });
39
41
  }
40
- }), H = _({
41
- features: [...x, V],
42
+ }), H = v({
43
+ features: [...S, V],
42
44
  displayName: "MediaPlayer"
43
- }), U = H.usePlayer, W = (e) => {
45
+ }), U = H.usePlayer, te = (e) => {
44
46
  if (e && e !== "und") try {
45
47
  return new Intl.DisplayNames([navigator.language || "en"], {
46
48
  type: "language",
@@ -49,39 +51,39 @@ var B = {
49
51
  } catch {
50
52
  return;
51
53
  }
52
- }, G = (e) => e?.replace(/_/g, " ").trim() || void 0, ee = (e) => {
53
- let t = e.map((e) => W(e.language) ?? G(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
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) => ({
54
56
  ...e,
55
57
  [t]: (e[t] ?? 0) + 1
56
58
  }), {});
57
59
  return e.map((e, r) => {
58
- let i = t[r], a = G(e.title);
60
+ let i = t[r], a = ne(e.title);
59
61
  return {
60
62
  track: e,
61
63
  label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
62
64
  };
63
65
  });
64
- }, K = (e) => ee(e).map(({ track: e, label: t }) => ({
66
+ }, G = (e) => W(e).map(({ track: e, label: t }) => ({
65
67
  id: e.streamIndex,
66
68
  label: t
67
- })), q = [
69
+ })), K = [
68
70
  0,
69
71
  250,
70
72
  1e3,
71
73
  3e3,
72
74
  1e4
73
- ], te = 6e4, ne = 500, re = 15e3, ie = (e) => e instanceof Error ? e.message : String(e), ae = (e) => {
75
+ ], re = 6e4, ie = 500, q = 15e3, J = (e) => e instanceof Error ? e.message : String(e), ae = (e) => {
74
76
  let t = [], n = e?.cause;
75
77
  for (let e = 0; n != null && e < 8; e++) {
76
78
  if (typeof MediaError < "u" && n instanceof MediaError) {
77
79
  t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
78
80
  break;
79
81
  }
80
- t.push(ie(n)), n = n?.cause;
82
+ t.push(J(n)), n = n?.cause;
81
83
  }
82
84
  return t.length ? t.join("\n") : void 0;
83
85
  }, oe = (e, t, r) => {
84
- 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 = ne } = r ?? {}, S = p(b);
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);
85
87
  S.current = b;
86
88
  let [C, w] = m(void 0), [T, E] = m(0), D = p({
87
89
  count: 0,
@@ -118,7 +120,7 @@ var B = {
118
120
  a.setSourceState({ seekingTo: e });
119
121
  let c = t.videoElement, l = () => {
120
122
  c?.removeEventListener("seeked", l), clearTimeout(u), a.setSourceState({ seekingTo: void 0 });
121
- }, u = setTimeout(l, re);
123
+ }, u = setTimeout(l, q);
122
124
  c?.addEventListener("seeked", l);
123
125
  let d = setTimeout(() => {
124
126
  o = "deadline", s();
@@ -148,7 +150,7 @@ var B = {
148
150
  ready: !1
149
151
  });
150
152
  let u = (t, n) => {
151
- let r = Date.now(), i = ie(t), o = ae(t), s = a.playbackErrors, c = s[s.length - 1];
153
+ let r = Date.now(), i = J(t), o = ae(t), s = a.playbackErrors, c = s[s.length - 1];
152
154
  if (c && c.message === i && c.detail === o && c.recovered === n) {
153
155
  let e = {
154
156
  ...c,
@@ -173,11 +175,11 @@ var B = {
173
175
  let t = n(e);
174
176
  if (u(e, t), t) {
175
177
  let t = performance.now();
176
- t - D.current.at > te && (D.current = {
178
+ t - D.current.at > re && (D.current = {
177
179
  count: 0,
178
180
  at: t
179
181
  });
180
- let n = q[Math.min(D.current.count, q.length - 1)];
182
+ let n = K[Math.min(D.current.count, K.length - 1)];
181
183
  D.current = {
182
184
  count: D.current.count + 1,
183
185
  at: t
@@ -214,13 +216,13 @@ var B = {
214
216
  onSeek: (e) => N.current?.(e),
215
217
  onSubtitleStreams: (e) => {
216
218
  r || a.setSourceState({
217
- subtitleTracks: K(e),
219
+ subtitleTracks: G(e),
218
220
  ...j.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
219
221
  });
220
222
  },
221
223
  onAudioStreams: (e, t) => {
222
224
  r || a.setSourceState({
223
- audioTracks: K(e),
225
+ audioTracks: G(e),
224
226
  selectedAudioTrack: t
225
227
  });
226
228
  }
@@ -328,7 +330,74 @@ var B = {
328
330
  mode: s,
329
331
  burnedIn: i
330
332
  };
331
- }, J = {
333
+ }, de = "(hover: hover) and (pointer: fine)", fe = () => typeof matchMedia == "function" ? matchMedia(de) : void 0, pe = (e) => {
334
+ let t = fe();
335
+ return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
336
+ }, me = () => !!fe()?.matches, he = () => !1, ge = (e, t) => {
337
+ let [n, r] = m(!1), [i, a] = m(), o = p(t);
338
+ t && (o.current = t);
339
+ let s = p(!1), c = u((e) => {
340
+ s.current !== e && (s.current = e, o.current?.onArmedChange(e));
341
+ }, []), l = u((t) => {
342
+ !e || e.readyState < 1 || e.error || (a(t), c(!0));
343
+ }, [e, c]), g = u(() => {
344
+ a(void 0), c(!1);
345
+ }, [c]), _ = !!t && !!e;
346
+ d(() => {
347
+ if (!_ || !e) return;
348
+ let t = () => {
349
+ r(!0), g();
350
+ }, n = () => r(!1);
351
+ return e.addEventListener("enterpictureinpicture", t), e.addEventListener("leavepictureinpicture", n), () => {
352
+ e.removeEventListener("enterpictureinpicture", t), e.removeEventListener("leavepictureinpicture", n), r(!1), g();
353
+ };
354
+ }, [
355
+ e,
356
+ _,
357
+ g
358
+ ]);
359
+ let v = h(pe, me, he), [y, b] = m(!1);
360
+ d(() => {
361
+ if (!_) return;
362
+ let e = (e) => {
363
+ e.pointerType === "touch" && b(!0);
364
+ }, t = (e) => {
365
+ e.pointerType !== "touch" && b(!1);
366
+ };
367
+ return window.addEventListener("pointerdown", e, {
368
+ capture: !0,
369
+ passive: !0
370
+ }), window.addEventListener("pointermove", t, {
371
+ capture: !0,
372
+ passive: !0
373
+ }), () => {
374
+ window.removeEventListener("pointerdown", e, { capture: !0 }), window.removeEventListener("pointermove", t, { capture: !0 });
375
+ };
376
+ }, [_]);
377
+ let x = _ && v && !y;
378
+ d(() => {
379
+ x || g();
380
+ }, [x, g]);
381
+ let S = u(() => {
382
+ Promise.resolve(e?.exitPictureInPicture?.()).catch((e) => {
383
+ console.warn("leaving picture in picture was refused", e);
384
+ });
385
+ }, [e]);
386
+ return f(() => x ? {
387
+ active: n,
388
+ armed: i,
389
+ arm: l,
390
+ disarm: g,
391
+ exit: S
392
+ } : null, [
393
+ x,
394
+ n,
395
+ i,
396
+ l,
397
+ g,
398
+ S
399
+ ]);
400
+ }, Y = {
332
401
  headings: {
333
402
  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 ",
334
403
  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 ",
@@ -355,7 +424,7 @@ var B = {
355
424
  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 ",
356
425
  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 "
357
426
  }
358
- }, de = h`
427
+ }, _e = g`
359
428
  display: flex;
360
429
  justify-content: center;
361
430
  align-items: center;
@@ -368,7 +437,7 @@ var B = {
368
437
  margin: auto;
369
438
  pointer-events: none;
370
439
  }
371
- `, fe = h`
440
+ `, ve = g`
372
441
  position: absolute;
373
442
  top: 0;
374
443
  left: 0;
@@ -376,7 +445,7 @@ var B = {
376
445
  padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
377
446
  /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
378
447
  padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
379
- ${J.headings.small}
448
+ ${Y.headings.small}
380
449
  color: white;
381
450
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
382
451
  z-index: 2;
@@ -397,9 +466,9 @@ var B = {
397
466
 
398
467
  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%);
399
468
  transition: opacity 0.1s cubic-bezier(.4,0,1,1);
400
- `, pe = g`
469
+ `, ye = _`
401
470
  to { transform: rotate(360deg); }
402
- `, me = h`
471
+ `, be = g`
403
472
  position: absolute;
404
473
  inset: 0;
405
474
  z-index: 2;
@@ -415,46 +484,46 @@ var B = {
415
484
  border-radius: 50%;
416
485
  border: 3px solid rgba(255, 255, 255, 0.25);
417
486
  border-top-color: #fff;
418
- animation: ${pe} 0.8s linear infinite;
487
+ animation: ${ye} 0.8s linear infinite;
419
488
  }
420
- `, he = h`
489
+ `, xe = g`
421
490
  position: absolute;
422
491
  inset: auto 0 20%;
423
492
  z-index: 3;
424
493
  padding: 0 calc(2 * var(--mp-unit));
425
494
  text-align: center;
426
495
  color: #fff;
427
- ${J.bLarge.regular}
496
+ ${Y.bLarge.regular}
428
497
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
429
498
  pointer-events: none;
430
- `, ge = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", _e = ({ onSubtitleRef: e }) => {
499
+ `, Se = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Ce = ({ onSubtitleRef: e }) => {
431
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);
432
- return /* @__PURE__ */ w(S, { children: [
433
- t ? /* @__PURE__ */ C("div", {
501
+ return /* @__PURE__ */ T(C, { children: [
502
+ t ? /* @__PURE__ */ w("div", {
434
503
  className: "title",
435
- css: fe,
504
+ css: ve,
436
505
  style: { ...n ? {
437
506
  opacity: "0",
438
507
  pointerEvents: "none"
439
508
  } : {} },
440
509
  children: t
441
510
  }) : void 0,
442
- ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ C("div", { css: me }) : void 0,
443
- r ? /* @__PURE__ */ C("div", {
444
- css: he,
445
- children: ge(r)
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)
446
515
  }) : void 0,
447
- /* @__PURE__ */ C("div", {
516
+ /* @__PURE__ */ w("div", {
448
517
  className: "subtitles",
449
518
  ref: e,
450
- css: de
519
+ css: _e
451
520
  })
452
521
  ] });
453
- }, ve = 1e-4, ye = 1, be = (e) => Math.max(ve, Math.min(ye, e)) ** 2, xe = (e) => Math.max(ve, Math.min(ye, e)) ** (ye / 2), Y = (e) => {
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) => {
454
523
  if (e === void 0) return "0:00";
455
524
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
456
525
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
457
- }, Se = (e, t) => `${Y(e)} / ${Y(t)}`, Ce = (e) => h`
526
+ }, Oe = (e, t) => `${X(e)} / ${X(t)}`, ke = (e) => g`
458
527
  display: flex;
459
528
  justify-content: flex-start;
460
529
 
@@ -486,44 +555,44 @@ var B = {
486
555
  z-index: 3;
487
556
 
488
557
  * {
489
- ${J.bMedium.regular}
558
+ ${Y.bMedium.regular}
490
559
  }
491
560
 
492
- ${e === "sm" && h`
561
+ ${e === "sm" && g`
493
562
  padding: calc(0.4 * var(--mp-unit))!important;
494
563
  `}
495
- ${e === "md" && h`
564
+ ${e === "md" && g`
496
565
  padding: calc(0.6 * var(--mp-unit))!important;
497
566
  `}
498
- ${e === "lg" && h`
567
+ ${e === "lg" && g`
499
568
  padding: calc(1.2 * var(--mp-unit))!important;
500
569
  `}
501
- `, X = {
570
+ `, Z = {
502
571
  x: -1,
503
572
  y: -1,
504
573
  anchors: 0
505
- }, we = (e) => {
506
- X.x = e.clientX, X.y = e.clientY;
507
- }, Te = () => (X.anchors++ === 0 && window.addEventListener("pointermove", we, {
574
+ }, Ae = (e) => {
575
+ Z.x = e.clientX, Z.y = e.clientY;
576
+ }, je = () => (Z.anchors++ === 0 && window.addEventListener("pointermove", Ae, {
508
577
  capture: !0,
509
578
  passive: !0
510
579
  }), () => {
511
- --X.anchors === 0 && window.removeEventListener("pointermove", we, { capture: !0 });
512
- }), Z = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
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" }) => {
513
582
  let l = p(null), u = p(null);
514
583
  return d(() => {
515
- let e = Te(), t = () => {
584
+ let e = je(), t = () => {
516
585
  let e = l.current;
517
586
  if (!e) return;
518
587
  let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
519
- X.x >= t && X.x < n && X.y >= r && X.y < i || u.current?.close();
588
+ Z.x >= t && Z.x < n && Z.y >= r && Z.y < i || u.current?.close();
520
589
  }, n = ["fullscreenchange", "webkitfullscreenchange"];
521
590
  for (let e of n) document.addEventListener(e, t);
522
591
  return () => {
523
592
  e();
524
593
  for (let e of n) document.removeEventListener(e, t);
525
594
  };
526
- }, []), /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
595
+ }, []), /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("div", {
527
596
  ref: l,
528
597
  "data-tooltip-id": e,
529
598
  "data-open": !0,
@@ -532,14 +601,14 @@ var B = {
532
601
  "data-tooltip-delay-hide": i,
533
602
  "data-tooltip-place": o,
534
603
  children: n
535
- }), !s && /* @__PURE__ */ C(z, {
604
+ }), !s && /* @__PURE__ */ w(ee, {
536
605
  ref: u,
537
- css: Ce(c),
606
+ css: ke(c),
538
607
  id: e,
539
608
  noArrow: !0,
540
609
  children: t
541
610
  })] });
542
- }, Ee = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
611
+ }, Me = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
543
612
  let [i, a] = m(!1), o = p(t);
544
613
  o.current = t;
545
614
  let s = p(null), c = u((t, r) => {
@@ -578,26 +647,26 @@ var B = {
578
647
  style: { touchAction: "none" }
579
648
  }
580
649
  };
581
- }, De = 2, Oe = .005, ke = "#000", Ae = "#0000", je = (e, t) => {
650
+ }, Ne = 2, Pe = .005, Fe = "#000", Ie = "#0000", Le = (e, t) => {
582
651
  if (!t) return [];
583
652
  let n = /* @__PURE__ */ new Set();
584
653
  for (let { start: r, end: i } of e) for (let e of [r, i]) {
585
654
  let r = e / t;
586
- r <= Oe || r >= .995 || n.add(Number((r * 100).toFixed(4)));
655
+ r <= Pe || r >= .995 || n.add(Number((r * 100).toFixed(4)));
587
656
  }
588
657
  return n.size ? [
589
658
  0,
590
659
  ...[...n].sort((e, t) => e - t),
591
660
  100
592
661
  ] : [];
593
- }, Me = (e, t) => {
594
- let n = De / 2, r = e.length - 2, i = [];
662
+ }, Re = (e, t) => {
663
+ let n = Ne / 2, r = e.length - 2, i = [];
595
664
  for (let a = 0; a <= r; a += 1) {
596
665
  let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
597
- i.push(`${t(a) ? ke : Ae} ${c} ${l}`), a !== r && i.push(`${Ae} calc(${s}% - ${n}px) 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)`);
598
667
  }
599
668
  return `linear-gradient(90deg, ${i.join(", ")})`;
600
- }, Ne = /* @__PURE__ */ new Set([
669
+ }, ze = /* @__PURE__ */ new Set([
601
670
  "op",
602
671
  "ops",
603
672
  "opening",
@@ -605,7 +674,7 @@ var B = {
605
674
  "ncop",
606
675
  "オープニング",
607
676
  "op主題歌"
608
- ]), Pe = /* @__PURE__ */ new Set([
677
+ ]), Be = /* @__PURE__ */ new Set([
609
678
  "ed",
610
679
  "eds",
611
680
  "ending",
@@ -618,13 +687,13 @@ var B = {
618
687
  "エンドカード",
619
688
  "エンドロール",
620
689
  "ed主題歌"
621
- ]), Fe = /* @__PURE__ */ new Set(["intro", "イントロ"]), Ie = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Le = {
690
+ ]), Ve = /* @__PURE__ */ new Set(["intro", "イントロ"]), He = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Ue = {
622
691
  "credits start": "ending",
623
692
  "credits end": null,
624
693
  "preview end": null,
625
694
  "end credits": "ending",
626
695
  "closing credits": "ending"
627
- }, Re = /* @__PURE__ */ new Set([
696
+ }, We = /* @__PURE__ */ new Set([
628
697
  "theme",
629
698
  "themes",
630
699
  "song",
@@ -643,53 +712,53 @@ var B = {
643
712
  "the",
644
713
  "主題歌",
645
714
  "ノンクレジット"
646
- ]), ze = /* @__PURE__ */ new Set([
715
+ ]), Ge = /* @__PURE__ */ new Set([
647
716
  "post",
648
717
  "pre",
649
718
  "after",
650
719
  "before",
651
720
  "non"
652
- ]), Be = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, Ve = (e) => /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), He = (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) && !Re.has(e)), Ue = (e, t) => {
653
- if (Ne.has(e)) return "opening";
654
- if (Pe.has(e)) return "ending";
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";
655
724
  if (t) {
656
- if (Fe.has(e)) return "opening";
657
- if (Ie.has(e)) return "ending";
725
+ if (Ve.has(e)) return "opening";
726
+ if (He.has(e)) return "ending";
658
727
  }
659
- }, We = (e, t) => {
660
- if (Ve(e)) return;
728
+ }, Xe = (e, t) => {
729
+ if (qe(e)) return;
661
730
  let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
662
- if (n in Le) return Le[n] ?? void 0;
663
- let r = n.split(Be).map((e) => e.trim()).filter(Boolean);
664
- if (r.some((e) => e.split(/[\s_]+/u).some((e) => ze.has(e)))) return;
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;
665
734
  let i = r.length > 1 ? [r[0], r.at(-1)] : r;
666
735
  for (let e of i) {
667
- let n = He(e);
736
+ let n = Je(e);
668
737
  if (n.length !== 1) continue;
669
- let r = Ue(n[0], t);
738
+ let r = Ye(n[0], t);
670
739
  if (r) return r;
671
740
  }
672
- }, Ge = 15, Ke = 87, qe = 93, Je = (e) => {
741
+ }, Ze = 15, Qe = 87, $e = 93, et = (e) => {
673
742
  let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
674
743
  if (!n) return t;
675
744
  let r = e.map((e, t) => ({
676
745
  index: t,
677
746
  start: e.start,
678
747
  length: e.end - e.start
679
- })).filter(({ length: e }) => e >= Ke && e <= qe), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
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);
680
749
  return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
681
- }, Ye = (e) => {
682
- let t = e.map(({ title: e }) => We(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);
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);
683
752
  if (r > 0 && n * 2 > r) return e.map(() => void 0);
684
753
  let i = e.map((e, n) => {
685
- if (e.end - e.start < Ge) return;
754
+ if (e.end - e.start < Ze) return;
686
755
  let r = t[n];
687
756
  if (r) return r;
688
- let i = We(e.title, !0);
757
+ let i = Xe(e.title, !0);
689
758
  return i && !t.includes(i) ? i : void 0;
690
759
  });
691
- return i.some(Boolean) ? i : Je(e);
692
- }, Xe = h`
760
+ return e.every(({ title: e }) => qe(e)) ? et(e) : i;
761
+ }, nt = g`
693
762
  position: relative;
694
763
  height: calc(.4 * var(--mp-unit));
695
764
 
@@ -774,7 +843,7 @@ var B = {
774
843
  box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
775
844
 
776
845
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
777
- ${J.bMedium.bold}
846
+ ${Y.bMedium.bold}
778
847
 
779
848
  gap: calc(.6 * var(--mp-unit));
780
849
 
@@ -908,50 +977,58 @@ var B = {
908
977
  --thumbnail-width: calc(18 * var(--mp-unit));
909
978
  --thumbnail-half: calc(9 * var(--mp-unit));
910
979
  }
911
- `, Ze = 4, Qe = () => {
912
- 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), _ = p(null), [v, y] = m(void 0), [b, x] = m(void 0), S = (e) => {
913
- x(e), u(e);
914
- }, T = p(void 0), E = p(0), D = p(void 0), O = p(void 0), k = p(!1), { dragging: A, handlers: j } = Ee({
915
- ref: _,
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) => {
982
+ C(e), u(e);
983
+ }, D = !!S;
984
+ d(() => {
985
+ if (D) return _({ seekPreview: !0 }), () => _({ seekPreview: !1 });
986
+ }, [_, D]), d(() => {
987
+ v && E(void 0);
988
+ }, [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({
990
+ ref: y,
916
991
  onChange: (e) => {
917
- if (E.current += 1, D.current = e, O.current === void 0) O.current = e;
918
- else if (!k.current) {
919
- let t = _.current?.getBoundingClientRect().width ?? 0;
920
- Math.abs(e - O.current) * t > Ze && (k.current = !0);
992
+ if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
993
+ else if (!M.current) {
994
+ let t = y.current?.getBoundingClientRect().width ?? 0;
995
+ Math.abs(e - j.current) * t > rt && (M.current = !0);
921
996
  }
922
- y(e), T.current !== "mouse" && S(e * r);
997
+ x(e), O.current !== "mouse" && E(e * r);
923
998
  }
924
- }), M = (e) => {
925
- T.current = e.pointerType, E.current = 0, O.current = void 0, k.current = !1, j.onPointerDown(e);
926
- }, N = (t) => {
927
- j.onPointerUp(t);
928
- let i = E.current > 0 ? D.current : void 0;
999
+ }), F = (e) => {
1000
+ O.current = e.pointerType, k.current = 0, j.current = void 0, M.current = !1, P.onPointerDown(e);
1001
+ }, I = (t) => {
1002
+ P.onPointerUp(t);
1003
+ let i = k.current > 0 ? A.current : void 0;
929
1004
  if (i !== void 0 && r) {
930
1005
  let t = i * r;
931
1006
  n ? n(t) : e.seek(t);
932
1007
  }
933
- E.current = 0, k.current = !1, O.current = void 0, t.pointerType !== "mouse" && S(void 0);
934
- }, P = (e) => {
935
- if (!_.current) return;
936
- let { left: t, right: n } = _.current.getBoundingClientRect();
1008
+ k.current = 0, M.current = !1, j.current = void 0, t.pointerType !== "mouse" && E(void 0);
1009
+ }, L = (e) => {
1010
+ if (!y.current) return;
1011
+ let { left: t, right: n } = y.current.getBoundingClientRect();
937
1012
  return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
938
- }, F = (e) => {
939
- S(P(e.clientX));
940
- }, I = () => {
941
- _.current && S(void 0);
942
- }, L = (e) => r ? e / r * 100 : 0, R = (e, t, n) => {
1013
+ }, R = p("mouse"), z = (e) => {
1014
+ R.current = e.pointerType;
1015
+ }, ee = (e) => {
1016
+ R.current !== "touch" && E(L(e.clientX));
1017
+ }, B = () => {
1018
+ y.current && E(void 0);
1019
+ }, V = (e) => r ? e / r * 100 : 0, H = (e, t, n) => {
943
1020
  let r = Number((n - t).toFixed(4)), i = t * 100;
944
- return /* @__PURE__ */ C("div", {
1021
+ return /* @__PURE__ */ w("div", {
945
1022
  className: "loaded-part",
946
1023
  style: {
947
1024
  transform: `scaleX(${r})`,
948
1025
  marginLeft: `${i}%`
949
1026
  }
950
1027
  }, e);
951
- }, z = f(() => i === void 0 ? r ? o.map(([e, t], n) => R(n, e / r, t / r)) : [] : a?.map((e, t) => {
1028
+ }, te = f(() => i === void 0 ? r ? o.map(([e, t], n) => H(n, e / r, t / r)) : [] : a?.map((e, t) => {
952
1029
  if (!i || !r) return null;
953
1030
  let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
954
- return !a || !o ? null : R(t, a.timestamp / r, o.timestamp / r);
1031
+ return !a || !o ? null : H(t, a.timestamp / r, o.timestamp / r);
955
1032
  }) ?? [], [
956
1033
  r,
957
1034
  i,
@@ -960,111 +1037,113 @@ var B = {
960
1037
  a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
961
1038
  ]);
962
1039
  d(() => {
963
- v !== void 0 && r && A && k.current && e.seek(v * r);
1040
+ b !== void 0 && r && N && M.current && e.seek(b * r);
964
1041
  }, [
965
1042
  e,
966
- A,
967
- v,
1043
+ N,
1044
+ b,
968
1045
  r
969
1046
  ]);
970
- let B = f(() => {
1047
+ let ne = f(() => {
971
1048
  if (!r) return 0;
972
- if (A && v !== void 0) return v;
1049
+ if (N && b !== void 0) return b;
973
1050
  let e = g ?? t;
974
1051
  return typeof e == "number" ? e / r : 0;
975
1052
  }, [
976
1053
  r,
977
1054
  t,
978
- A,
979
- v,
1055
+ N,
1056
+ b,
980
1057
  g
981
- ]), V = f(() => je(h, r), [h, r]), H = V.length > 0, W = f(() => {
982
- if (!H || b === void 0 || !r) return -1;
983
- let e = b / r * 100, t = V.findIndex((t, n) => n < V.length - 1 && e >= t && e < V[n + 1]);
984
- return t >= 0 ? t : V.length - 2;
1058
+ ]), W = f(() => Le(h, r), [h, r]), G = W.length > 0, K = f(() => {
1059
+ if (!G || S === void 0 || !r) return -1;
1060
+ let e = S / r * 100, t = W.findIndex((t, n) => n < W.length - 1 && e >= t && e < W[n + 1]);
1061
+ return t >= 0 ? t : W.length - 2;
985
1062
  }, [
986
- H,
987
- V,
988
- b,
1063
+ G,
1064
+ W,
1065
+ S,
989
1066
  r
990
- ]), G = f(() => H ? Me(V, (e) => e !== W) : void 0, [
991
- H,
992
- V,
993
- W
994
- ]), ee = f(() => W >= 0 ? Me(V, (e) => e === W) : void 0, [V, W]), K = f(() => {
995
- if (b !== void 0) return h.find(({ start: e, end: t }) => e <= b && b < t);
996
- }, [h, b]), q = f(() => {
997
- if (b) {
998
- if (l) return l(b);
999
- if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= b && b < t);
1067
+ ]), re = f(() => G ? Re(W, (e) => e !== K) : void 0, [
1068
+ G,
1069
+ W,
1070
+ K
1071
+ ]), ie = f(() => K >= 0 ? Re(W, (e) => e === K) : void 0, [W, K]), q = f(() => {
1072
+ if (S !== void 0) return h.find(({ start: e, end: t }) => e <= S && S < t);
1073
+ }, [h, S]), J = f(() => {
1074
+ if (S) {
1075
+ if (l) return l(S);
1076
+ if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= S && S < t);
1000
1077
  }
1001
1078
  }, [
1002
1079
  c,
1003
1080
  l,
1004
- b
1005
- ]), te = (e, t) => /* @__PURE__ */ w("div", {
1081
+ S
1082
+ ]), ae = (e, t) => /* @__PURE__ */ T("div", {
1006
1083
  className: e ? `track ${e}` : "track",
1007
1084
  style: t ? { maskImage: t } : void 0,
1008
1085
  children: [
1009
- /* @__PURE__ */ C("div", { className: "background-bar" }),
1010
- /* @__PURE__ */ C("div", {
1086
+ /* @__PURE__ */ w("div", { className: "background-bar" }),
1087
+ /* @__PURE__ */ w("div", {
1011
1088
  className: "loaded",
1012
- children: z
1089
+ children: te
1013
1090
  }),
1014
- /* @__PURE__ */ C("div", {
1091
+ /* @__PURE__ */ w("div", {
1015
1092
  className: "play-container",
1016
- children: /* @__PURE__ */ C("div", {
1093
+ children: /* @__PURE__ */ w("div", {
1017
1094
  className: "play",
1018
- style: { transform: `scaleX(${B})` }
1095
+ style: { transform: `scaleX(${ne})` }
1019
1096
  })
1020
1097
  })
1021
1098
  ]
1022
1099
  });
1023
- return /* @__PURE__ */ w("div", {
1024
- css: Xe,
1025
- ref: _,
1100
+ return /* @__PURE__ */ T("div", {
1101
+ css: nt,
1102
+ ref: y,
1026
1103
  className: [
1027
1104
  "progress-bar",
1028
- A ? "dragging" : "",
1029
- H ? "segmented" : ""
1105
+ N ? "dragging" : "",
1106
+ G ? "segmented" : ""
1030
1107
  ].filter(Boolean).join(" "),
1031
- onMouseMove: F,
1032
- onMouseOut: I,
1108
+ onPointerDown: z,
1109
+ onPointerMove: z,
1110
+ onMouseMove: ee,
1111
+ onMouseOut: B,
1033
1112
  children: [
1034
- te(void 0, G),
1035
- b ? /* @__PURE__ */ w("div", {
1113
+ ae(void 0, re),
1114
+ S ? /* @__PURE__ */ T("div", {
1036
1115
  className: "cursor-time",
1037
1116
  style: {
1038
- left: K ? `clamp(var(--thumbnail-half), ${L(b)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${L(b)}%, calc(100% - calc(3 * var(--mp-unit))))`,
1039
- maxWidth: K ? "var(--thumbnail-width)" : void 0
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
1040
1119
  },
1041
- children: [/* @__PURE__ */ C("span", {
1120
+ children: [/* @__PURE__ */ w("span", {
1042
1121
  className: "cursor-time-value",
1043
- children: Y(b)
1044
- }), K ? /* @__PURE__ */ C("span", {
1122
+ children: X(S)
1123
+ }), q ? /* @__PURE__ */ w("span", {
1045
1124
  className: "chapter-title",
1046
- children: K.title
1125
+ children: q.title
1047
1126
  }) : void 0]
1048
1127
  }) : void 0,
1049
- /* @__PURE__ */ C("div", { className: "progress" }),
1050
- /* @__PURE__ */ C("div", { className: "hover" }),
1051
- ee ? te("focus", ee) : void 0,
1052
- /* @__PURE__ */ C("div", { className: "scrubber" }),
1053
- /* @__PURE__ */ C("div", {
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", {
1054
1133
  className: "padding",
1055
- ...j,
1056
- onPointerDown: M,
1057
- onPointerUp: N,
1058
- onPointerCancel: N
1134
+ ...P,
1135
+ onPointerDown: F,
1136
+ onPointerUp: I,
1137
+ onPointerCancel: I
1059
1138
  }),
1060
- /* @__PURE__ */ C("div", {
1139
+ /* @__PURE__ */ w("div", {
1061
1140
  className: "thumbnail",
1062
- style: { left: `clamp(var(--thumbnail-half), ${L(b ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
1063
- children: q?.url ? /* @__PURE__ */ C("img", { src: q.url }) : void 0
1141
+ 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
1064
1143
  })
1065
1144
  ]
1066
1145
  });
1067
- }, $e = "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", Q = {
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", $ = {
1068
1147
  xmlns: "http://www.w3.org/2000/svg",
1069
1148
  width: 24,
1070
1149
  height: 24,
@@ -1074,22 +1153,22 @@ var B = {
1074
1153
  strokeWidth: 2,
1075
1154
  strokeLinecap: "round",
1076
1155
  strokeLinejoin: "round"
1077
- }, et = (e) => /* @__PURE__ */ w("svg", {
1078
- ...Q,
1156
+ }, ot = (e) => /* @__PURE__ */ T("svg", {
1157
+ ...$,
1079
1158
  ...e,
1080
- children: [/* @__PURE__ */ C("rect", {
1159
+ children: [/* @__PURE__ */ w("rect", {
1081
1160
  x: "3",
1082
1161
  y: "5",
1083
1162
  width: "18",
1084
1163
  height: "14",
1085
1164
  rx: "2",
1086
1165
  ry: "2"
1087
- }), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
1088
- }), tt = (e) => /* @__PURE__ */ w("svg", {
1089
- ...Q,
1166
+ }), /* @__PURE__ */ w("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
1167
+ }), st = (e) => /* @__PURE__ */ T("svg", {
1168
+ ...$,
1090
1169
  ...e,
1091
1170
  children: [
1092
- /* @__PURE__ */ C("rect", {
1171
+ /* @__PURE__ */ w("rect", {
1093
1172
  x: "3",
1094
1173
  y: "5",
1095
1174
  width: "18",
@@ -1097,20 +1176,20 @@ var B = {
1097
1176
  rx: "2",
1098
1177
  ry: "2"
1099
1178
  }),
1100
- /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
1101
- /* @__PURE__ */ C("line", {
1179
+ /* @__PURE__ */ w("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" }),
1180
+ /* @__PURE__ */ w("line", {
1102
1181
  x1: "2",
1103
1182
  y1: "2",
1104
1183
  x2: "22",
1105
1184
  y2: "22"
1106
1185
  })
1107
1186
  ]
1108
- }), nt = (e) => /* @__PURE__ */ w("svg", {
1109
- ...Q,
1187
+ }), ct = (e) => /* @__PURE__ */ T("svg", {
1188
+ ...$,
1110
1189
  ...e,
1111
1190
  children: [
1112
- /* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1113
- /* @__PURE__ */ C("rect", {
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", {
1114
1193
  x: "12",
1115
1194
  y: "13",
1116
1195
  width: "10",
@@ -1118,14 +1197,14 @@ var B = {
1118
1197
  rx: "1",
1119
1198
  ry: "1"
1120
1199
  }),
1121
- /* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
1200
+ /* @__PURE__ */ w("path", { d: "M14.5 18.5h2m2 0h1" })
1122
1201
  ]
1123
- }), rt = (e) => /* @__PURE__ */ w("svg", {
1124
- ...Q,
1202
+ }), lt = (e) => /* @__PURE__ */ T("svg", {
1203
+ ...$,
1125
1204
  ...e,
1126
1205
  children: [
1127
- /* @__PURE__ */ C("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
1128
- /* @__PURE__ */ C("rect", {
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", {
1129
1208
  x: "12",
1130
1209
  y: "13",
1131
1210
  width: "10",
@@ -1133,9 +1212,9 @@ var B = {
1133
1212
  rx: "1",
1134
1213
  ry: "1"
1135
1214
  }),
1136
- /* @__PURE__ */ C("path", { d: "M6 9h3m2 0h2" })
1215
+ /* @__PURE__ */ w("path", { d: "M6 9h3m2 0h2" })
1137
1216
  ]
1138
- }), it = h`
1217
+ }), ut = g`
1139
1218
  .popover {
1140
1219
  position: absolute;
1141
1220
  /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
@@ -1174,7 +1253,7 @@ var B = {
1174
1253
 
1175
1254
  border-radius: 8px;
1176
1255
  background-color: rgba(28,28,28,0.95);
1177
- ${J.bMedium.regular}
1256
+ ${Y.bMedium.regular}
1178
1257
 
1179
1258
  z-index: 4;
1180
1259
 
@@ -1217,7 +1296,7 @@ var B = {
1217
1296
 
1218
1297
  .secondary {
1219
1298
  color: #eee;
1220
- ${J.bSmall.regular}
1299
+ ${Y.bSmall.regular}
1221
1300
  }
1222
1301
  }
1223
1302
  }
@@ -1259,29 +1338,29 @@ var B = {
1259
1338
  .failed {
1260
1339
  border-bottom: 1px solid #4D4D4E;
1261
1340
  color: #f66;
1262
- ${J.bSmall.regular}
1341
+ ${Y.bSmall.regular}
1263
1342
  }
1264
1343
  }
1265
- `, at = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1344
+ `, dt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1266
1345
  let c = o !== void 0, l = (e, i, a) => {
1267
1346
  let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
1268
- return /* @__PURE__ */ w("div", {
1347
+ return /* @__PURE__ */ T("div", {
1269
1348
  onClick: () => {
1270
1349
  l || r(e ?? void 0);
1271
1350
  },
1272
1351
  className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
1273
- children: [/* @__PURE__ */ C("span", { children: i }), /* @__PURE__ */ C("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
1352
+ children: [/* @__PURE__ */ w("span", { children: i }), /* @__PURE__ */ w("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
1274
1353
  }, e ?? "__off__");
1275
1354
  };
1276
- return /* @__PURE__ */ w("div", {
1355
+ return /* @__PURE__ */ T("div", {
1277
1356
  className: "popover track-list",
1278
1357
  children: [
1279
- /* @__PURE__ */ w("div", {
1358
+ /* @__PURE__ */ T("div", {
1280
1359
  className: i ? "back" : "back no-hover",
1281
1360
  onClick: i,
1282
- children: [i ? /* @__PURE__ */ C(D, {}) : null, /* @__PURE__ */ C("span", { children: e })]
1361
+ children: [i ? /* @__PURE__ */ w(O, {}) : null, /* @__PURE__ */ w("span", { children: e })]
1283
1362
  }),
1284
- s ? /* @__PURE__ */ C("div", {
1363
+ s ? /* @__PURE__ */ w("div", {
1285
1364
  className: "no-hover failed",
1286
1365
  children: "Could not switch. Try again."
1287
1366
  }) : null,
@@ -1289,7 +1368,7 @@ var B = {
1289
1368
  t.map(({ id: e, label: t }) => l(e, t, "description"))
1290
1369
  ]
1291
1370
  });
1292
- }, ot = ({ onReset: e } = {}) => {
1371
+ }, ft = ({ onReset: e } = {}) => {
1293
1372
  let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
1294
1373
  c.current = e;
1295
1374
  let l = () => {
@@ -1330,7 +1409,7 @@ var B = {
1330
1409
  });
1331
1410
  }
1332
1411
  };
1333
- }, st = h`
1412
+ }, pt = g`
1334
1413
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1335
1414
  which is the width of the player box, so it can be clamped to it. */
1336
1415
  position: static;
@@ -1346,7 +1425,7 @@ position: static;
1346
1425
  }
1347
1426
  }
1348
1427
 
1349
- ${it}
1428
+ ${ut}
1350
1429
 
1351
1430
  .popover.error-list {
1352
1431
  /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
@@ -1374,7 +1453,7 @@ ${it}
1374
1453
 
1375
1454
  color: #fff;
1376
1455
  cursor: pointer;
1377
- ${J.bSmall.regular}
1456
+ ${Y.bSmall.regular}
1378
1457
 
1379
1458
  &:hover {
1380
1459
  background-color: rgba(255,255,255,.1);
@@ -1395,7 +1474,7 @@ ${it}
1395
1474
 
1396
1475
  .when {
1397
1476
  color: #bbb;
1398
- ${J.bSmall.regular}
1477
+ ${Y.bSmall.regular}
1399
1478
 
1400
1479
  /* the one part of the line worth scanning for, so it is the one part at full brightness */
1401
1480
  .count {
@@ -1414,72 +1493,72 @@ ${it}
1414
1493
  color: #ddd;
1415
1494
  overflow-wrap: anywhere;
1416
1495
  white-space: pre-wrap;
1417
- ${J.bSmall.regular}
1496
+ ${Y.bSmall.regular}
1418
1497
  }
1419
1498
  }
1420
1499
  }
1421
- `, ct = (e) => new Date(e).toLocaleTimeString(), lt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Y(Math.max(0, e)), ut = (e) => e.reduce((e, t) => e + t.count, 0), dt = (e) => e.map((e, t) => {
1422
- let n = lt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
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();
1423
1502
  return [
1424
1503
  `${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
1425
1504
  e.message,
1426
1505
  e.detail
1427
1506
  ].filter(Boolean).join("\n");
1428
- }).join("\n\n"), ft = () => {
1429
- let e = U((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = ot(), [i, a] = m(!1);
1507
+ }).join("\n\n"), vt = () => {
1508
+ let e = U((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = ft(), [i, a] = m(!1);
1430
1509
  if (e.length === 0) return null;
1431
1510
  let o = () => {
1432
- navigator.clipboard?.writeText(dt(e)).then(() => {
1511
+ navigator.clipboard?.writeText(_t(e)).then(() => {
1433
1512
  a(!0), setTimeout(() => a(!1), 2e3);
1434
1513
  }, (e) => console.warn("[media-player] could not copy the errors:", e));
1435
- }, s = `Playback errors (${ut(e)})`;
1436
- return /* @__PURE__ */ w("div", {
1437
- css: st,
1514
+ }, s = `Playback errors (${gt(e)})`;
1515
+ return /* @__PURE__ */ T("div", {
1516
+ css: pt,
1438
1517
  ref: r,
1439
- children: [/* @__PURE__ */ C(Z, {
1518
+ children: [/* @__PURE__ */ w(Q, {
1440
1519
  id: "errors",
1441
1520
  disabled: t,
1442
- text: /* @__PURE__ */ C("button", {
1521
+ text: /* @__PURE__ */ w("button", {
1443
1522
  className: "errors",
1444
1523
  type: "button",
1445
1524
  onClick: n,
1446
1525
  "aria-label": s,
1447
1526
  "aria-expanded": t,
1448
- children: /* @__PURE__ */ C(T, { className: "alert-triangle" })
1527
+ children: /* @__PURE__ */ w(E, { className: "alert-triangle" })
1449
1528
  }),
1450
- toolTipText: /* @__PURE__ */ C("span", { children: s })
1451
- }), t && /* @__PURE__ */ w("div", {
1529
+ toolTipText: /* @__PURE__ */ w("span", { children: s })
1530
+ }), t && /* @__PURE__ */ T("div", {
1452
1531
  className: "popover error-list",
1453
- children: [/* @__PURE__ */ w("div", {
1532
+ children: [/* @__PURE__ */ T("div", {
1454
1533
  className: "back no-hover",
1455
- children: [/* @__PURE__ */ C("span", { children: s }), /* @__PURE__ */ w("button", {
1534
+ children: [/* @__PURE__ */ w("span", { children: s }), /* @__PURE__ */ T("button", {
1456
1535
  className: "copy",
1457
1536
  type: "button",
1458
1537
  onClick: o,
1459
1538
  "aria-label": "Copy the errors",
1460
- children: [C(i ? E : k, {}), /* @__PURE__ */ C("span", { children: i ? "Copied" : "Copy" })]
1539
+ children: [w(i ? D : A, {}), /* @__PURE__ */ w("span", { children: i ? "Copied" : "Copy" })]
1461
1540
  })]
1462
- }), e.map((e, t) => /* @__PURE__ */ w("div", {
1541
+ }), e.map((e, t) => /* @__PURE__ */ T("div", {
1463
1542
  className: "entry no-hover",
1464
1543
  children: [
1465
- /* @__PURE__ */ w("span", {
1544
+ /* @__PURE__ */ T("span", {
1466
1545
  className: "when",
1467
1546
  children: [
1468
- ct(e.at),
1469
- e.count > 1 ? ` to ${ct(e.lastAt)}` : "",
1470
- lt(e.atMediaTime) ? ` at ${lt(e.atMediaTime)}` : "",
1547
+ mt(e.at),
1548
+ e.count > 1 ? ` to ${mt(e.lastAt)}` : "",
1549
+ ht(e.atMediaTime) ? ` at ${ht(e.atMediaTime)}` : "",
1471
1550
  e.recovered ? " recovered" : "",
1472
- e.count > 1 ? /* @__PURE__ */ C("span", {
1551
+ e.count > 1 ? /* @__PURE__ */ w("span", {
1473
1552
  className: "count",
1474
1553
  children: `×${e.count}`
1475
1554
  }) : null
1476
1555
  ]
1477
1556
  }),
1478
- /* @__PURE__ */ C("span", {
1557
+ /* @__PURE__ */ w("span", {
1479
1558
  className: "what",
1480
1559
  children: e.message
1481
1560
  }),
1482
- e.detail ? /* @__PURE__ */ C("span", {
1561
+ e.detail ? /* @__PURE__ */ w("span", {
1483
1562
  className: "cause",
1484
1563
  children: e.detail
1485
1564
  }) : null
@@ -1487,7 +1566,7 @@ ${it}
1487
1566
  }, `${e.at}-${t}`))]
1488
1567
  })]
1489
1568
  });
1490
- }, pt = h`
1569
+ }, yt = g`
1491
1570
  display: flex;
1492
1571
  align-items: center;
1493
1572
  justify-content: center;
@@ -1540,8 +1619,8 @@ width: 100%;
1540
1619
  }
1541
1620
  }
1542
1621
  }
1543
- `, mt = () => {
1544
- 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 } = Ee({
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({
1545
1624
  ref: r,
1546
1625
  onChange: (t) => e.setPlaybackRate(l(t))
1547
1626
  }), f = (t) => {
@@ -1556,26 +1635,26 @@ width: 100%;
1556
1635
  };
1557
1636
  }, [t]);
1558
1637
  let m = c(s);
1559
- return /* @__PURE__ */ w("div", {
1560
- css: pt,
1561
- children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
1638
+ return /* @__PURE__ */ T("div", {
1639
+ css: yt,
1640
+ children: [/* @__PURE__ */ T("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ w("div", {
1562
1641
  className: "playback-slider",
1563
1642
  ref: n,
1564
1643
  ...u,
1565
- children: /* @__PURE__ */ C("div", {
1644
+ children: /* @__PURE__ */ w("div", {
1566
1645
  ref: r,
1567
1646
  style: { background: `linear-gradient(to right,
1568
1647
  #fff 0% ${m}%,
1569
1648
  #3A3A3A ${m}% 100%
1570
1649
  )` },
1571
- children: /* @__PURE__ */ C("div", {
1650
+ children: /* @__PURE__ */ w("div", {
1572
1651
  className: "playback-handle",
1573
1652
  style: { left: `${m}%` }
1574
1653
  })
1575
1654
  })
1576
1655
  })]
1577
1656
  });
1578
- }, ht = h`
1657
+ }, xt = g`
1579
1658
  /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
1580
1659
  as wide as the player box and can therefore be clamped to it. The outside-click check uses
1581
1660
  \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
@@ -1593,7 +1672,7 @@ position: static;
1593
1672
  }
1594
1673
  }
1595
1674
 
1596
- ${it}
1675
+ ${ut}
1597
1676
 
1598
1677
  .playback-rate {
1599
1678
  .slider {
@@ -1634,72 +1713,72 @@ ${it}
1634
1713
  }
1635
1714
  }
1636
1715
 
1637
- `, gt = () => {
1638
- 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 } = ot({ onReset: () => o(0) }), p = (t) => {
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) => {
1639
1718
  e.setPlaybackRate(t), o(0);
1640
1719
  }, h = (e) => {
1641
1720
  e !== void 0 && f(e, () => i(e));
1642
1721
  }, g = (e) => () => {
1643
1722
  o(e);
1644
1723
  };
1645
- return /* @__PURE__ */ w("div", {
1646
- css: ht,
1724
+ return /* @__PURE__ */ T("div", {
1725
+ css: xt,
1647
1726
  ref: l,
1648
1727
  children: [
1649
- /* @__PURE__ */ C(Z, {
1728
+ /* @__PURE__ */ w(Q, {
1650
1729
  id: "settings",
1651
1730
  disabled: s,
1652
- text: /* @__PURE__ */ C("button", {
1731
+ text: /* @__PURE__ */ w("button", {
1653
1732
  className: "settings",
1654
1733
  type: "button",
1655
1734
  onClick: c,
1656
1735
  "aria-label": "Settings",
1657
1736
  "aria-expanded": s,
1658
- children: /* @__PURE__ */ C(F, {})
1737
+ children: /* @__PURE__ */ w(I, {})
1659
1738
  }),
1660
- toolTipText: /* @__PURE__ */ C("span", { children: "Settings" })
1739
+ toolTipText: /* @__PURE__ */ w("span", { children: "Settings" })
1661
1740
  }),
1662
- s && a === 0 && /* @__PURE__ */ w("div", {
1741
+ s && a === 0 && /* @__PURE__ */ T("div", {
1663
1742
  className: "popover menu",
1664
- children: [n.length > 1 ? /* @__PURE__ */ w("div", {
1743
+ children: [n.length > 1 ? /* @__PURE__ */ T("div", {
1665
1744
  onClick: g(2),
1666
- children: [/* @__PURE__ */ C("div", { children: "Audio" }), /* @__PURE__ */ C("div", { children: /* @__PURE__ */ C(O, {}) })]
1667
- }) : null, /* @__PURE__ */ w("div", {
1745
+ children: [/* @__PURE__ */ w("div", { children: "Audio" }), /* @__PURE__ */ w("div", { children: /* @__PURE__ */ w(k, {}) })]
1746
+ }) : null, /* @__PURE__ */ T("div", {
1668
1747
  onClick: g(1),
1669
- children: [/* @__PURE__ */ C("div", { children: "Playback speed" }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("span", {
1748
+ children: [/* @__PURE__ */ w("div", { children: "Playback speed" }), /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("span", {
1670
1749
  className: "secondary",
1671
1750
  children: t === 1 ? "(Default)" : t.toFixed(2)
1672
- }), /* @__PURE__ */ C(O, {})] })]
1751
+ }), /* @__PURE__ */ w(k, {})] })]
1673
1752
  })]
1674
1753
  }),
1675
- s && a === 1 && /* @__PURE__ */ w("div", {
1754
+ s && a === 1 && /* @__PURE__ */ T("div", {
1676
1755
  className: "popover playback-rate",
1677
1756
  children: [
1678
- /* @__PURE__ */ w("div", {
1757
+ /* @__PURE__ */ T("div", {
1679
1758
  className: "back",
1680
1759
  onClick: g(0),
1681
- children: [/* @__PURE__ */ C(D, {}), /* @__PURE__ */ C("span", { children: "Playback speed" })]
1760
+ children: [/* @__PURE__ */ w(O, {}), /* @__PURE__ */ w("span", { children: "Playback speed" })]
1682
1761
  }),
1683
- /* @__PURE__ */ C("div", {
1762
+ /* @__PURE__ */ w("div", {
1684
1763
  className: "slider no-hover",
1685
- children: /* @__PURE__ */ C(mt, {})
1764
+ children: /* @__PURE__ */ w(bt, {})
1686
1765
  }),
1687
- /* @__PURE__ */ w("div", {
1766
+ /* @__PURE__ */ T("div", {
1688
1767
  className: "options no-hover",
1689
1768
  children: [
1690
- /* @__PURE__ */ C("div", {
1769
+ /* @__PURE__ */ w("div", {
1691
1770
  onClick: () => p(.5),
1692
1771
  children: "0.5x"
1693
1772
  }),
1694
- /* @__PURE__ */ C("div", {
1773
+ /* @__PURE__ */ w("div", {
1695
1774
  onClick: () => p(1),
1696
1775
  children: "1x"
1697
1776
  }),
1698
- /* @__PURE__ */ C("div", {
1777
+ /* @__PURE__ */ w("div", {
1699
1778
  onClick: () => p(1.5),
1700
1779
  children: "1.5x"
1701
1780
  }),
1702
- /* @__PURE__ */ C("div", {
1781
+ /* @__PURE__ */ w("div", {
1703
1782
  onClick: () => p(2),
1704
1783
  children: "2x"
1705
1784
  })
@@ -1707,7 +1786,7 @@ ${it}
1707
1786
  })
1708
1787
  ]
1709
1788
  }),
1710
- s && a === 2 && /* @__PURE__ */ C(at, {
1789
+ s && a === 2 && /* @__PURE__ */ w(dt, {
1711
1790
  title: "Audio",
1712
1791
  tracks: n,
1713
1792
  selected: r,
@@ -1718,7 +1797,7 @@ ${it}
1718
1797
  })
1719
1798
  ]
1720
1799
  });
1721
- }, _t = h`
1800
+ }, Ct = g`
1722
1801
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1723
1802
  which is the width of the player box, so it can be clamped to it. */
1724
1803
  position: static;
@@ -1734,28 +1813,28 @@ position: static;
1734
1813
  }
1735
1814
  }
1736
1815
 
1737
- ${it}
1738
- `, vt = () => {
1739
- 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 } = ot();
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();
1740
1819
  if (e.length === 0) return null;
1741
1820
  let u = t !== void 0;
1742
- return /* @__PURE__ */ w("div", {
1743
- css: _t,
1821
+ return /* @__PURE__ */ T("div", {
1822
+ css: Ct,
1744
1823
  ref: o,
1745
- children: [/* @__PURE__ */ C(Z, {
1824
+ children: [/* @__PURE__ */ w(Q, {
1746
1825
  id: "subtitles",
1747
1826
  disabled: i,
1748
- text: /* @__PURE__ */ C("button", {
1827
+ text: /* @__PURE__ */ w("button", {
1749
1828
  className: "subtitles",
1750
1829
  type: "button",
1751
1830
  onClick: a,
1752
1831
  "aria-label": "Subtitles",
1753
1832
  "aria-expanded": i,
1754
1833
  "aria-pressed": u,
1755
- children: u ? /* @__PURE__ */ C(et, { className: "captions" }) : /* @__PURE__ */ C(tt, { className: "captions-off" })
1834
+ children: u ? /* @__PURE__ */ w(ot, { className: "captions" }) : /* @__PURE__ */ w(st, { className: "captions-off" })
1756
1835
  }),
1757
- toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
1758
- }), i && /* @__PURE__ */ C(at, {
1836
+ toolTipText: /* @__PURE__ */ w("span", { children: "Subtitles" })
1837
+ }), i && /* @__PURE__ */ w(dt, {
1759
1838
  title: "Subtitles",
1760
1839
  tracks: e,
1761
1840
  selected: t,
@@ -1765,13 +1844,13 @@ ${it}
1765
1844
  failed: c
1766
1845
  })]
1767
1846
  });
1768
- }, yt = {
1847
+ }, Tt = {
1769
1848
  primary: "#EAEBEE",
1770
1849
  secondary: "#D0D0D9",
1771
1850
  hover: "rgba(255, 255, 255, 0.13)",
1772
1851
  borderPrimary: "#384F70",
1773
1852
  backgroundTooltip: "#222222"
1774
- }, bt = h`
1853
+ }, Et = g`
1775
1854
  display: flex;
1776
1855
  align-items: center;
1777
1856
 
@@ -1814,8 +1893,8 @@ ${it}
1814
1893
  width: 10px;
1815
1894
  height: 10px;
1816
1895
  }
1817
- `, xt = ({ value: e, onChange: t }) => {
1818
- let n = U((e) => e.volume), r = U((e) => e.muted), i = p(null), a = p(null), { handlers: o } = Ee({
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({
1819
1898
  ref: a,
1820
1899
  onChange: t
1821
1900
  }), s = (n) => {
@@ -1829,31 +1908,31 @@ ${it}
1829
1908
  e && e.removeEventListener("wheel", s);
1830
1909
  };
1831
1910
  }, [e]);
1832
- let c = e * 100, l = f(() => Math.round(r ? 0 : xe(n) * 100), [n, r]);
1833
- return /* @__PURE__ */ C(Z, {
1911
+ let c = e * 100, l = f(() => Math.round(r ? 0 : De(n) * 100), [n, r]);
1912
+ return /* @__PURE__ */ w(Q, {
1834
1913
  id: "volume-slider",
1835
- text: /* @__PURE__ */ C("div", {
1914
+ text: /* @__PURE__ */ w("div", {
1836
1915
  ref: i,
1837
- css: bt,
1916
+ css: Et,
1838
1917
  ...o,
1839
- children: /* @__PURE__ */ C("div", {
1918
+ children: /* @__PURE__ */ w("div", {
1840
1919
  ref: a,
1841
1920
  style: { background: `linear-gradient(to right,
1842
1921
  #fff 0% ${c}%,
1843
1922
  #3A3A3A ${c}% 100%
1844
1923
  )` },
1845
- children: /* @__PURE__ */ C("div", {
1924
+ children: /* @__PURE__ */ w("div", {
1846
1925
  className: "volume-handle",
1847
1926
  style: { left: `${e * 100}%` }
1848
1927
  })
1849
1928
  })
1850
1929
  }),
1851
- toolTipText: /* @__PURE__ */ w("div", {
1930
+ toolTipText: /* @__PURE__ */ T("div", {
1852
1931
  className: "volume-value",
1853
1932
  children: [l, "%"]
1854
1933
  })
1855
1934
  });
1856
- }, St = h`
1935
+ }, Ot = g`
1857
1936
  position: relative;
1858
1937
  display: flex;
1859
1938
  align-items: center;
@@ -1878,7 +1957,7 @@ ${it}
1878
1957
  border-radius: 4px;
1879
1958
 
1880
1959
  .volume-value {
1881
- ${J.bMedium.regular};
1960
+ ${Y.bMedium.regular};
1882
1961
  color: #ffffff;
1883
1962
  }
1884
1963
  }
@@ -1916,39 +1995,39 @@ ${it}
1916
1995
  }
1917
1996
  }
1918
1997
 
1919
- `, Ct = ({ ref: e }) => {
1920
- let t = U(), n = U((e) => e.volume), r = U((e) => e.muted), i = f(() => xe(n), [n]);
1921
- return /* @__PURE__ */ w("div", {
1922
- css: St,
1923
- children: [/* @__PURE__ */ C(Z, {
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, {
1924
2003
  id: "sound",
1925
- text: /* @__PURE__ */ C("button", {
2004
+ text: /* @__PURE__ */ w("button", {
1926
2005
  className: "sound",
1927
2006
  type: "button",
1928
2007
  onClick: () => t.toggleMuted(),
1929
2008
  ref: e,
1930
2009
  "aria-label": "Mute",
1931
2010
  "aria-pressed": r || n === 0,
1932
- children: C(r || n === 0 ? R : n <= .5 ? I : L, {
2011
+ children: w(r || n === 0 ? z : n <= .5 ? L : R, {
1933
2012
  size: 18,
1934
2013
  color: "#fff"
1935
2014
  })
1936
2015
  }),
1937
- toolTipText: /* @__PURE__ */ C("span", { children: r ? "Unmute (m)" : "Mute (m)" })
1938
- }), /* @__PURE__ */ C("div", {
2016
+ toolTipText: /* @__PURE__ */ w("span", { children: r ? "Unmute (m)" : "Mute (m)" })
2017
+ }), /* @__PURE__ */ w("div", {
1939
2018
  className: "volume-slider-container",
1940
- children: /* @__PURE__ */ C("div", {
2019
+ children: /* @__PURE__ */ w("div", {
1941
2020
  className: "volume-slider-background",
1942
- children: /* @__PURE__ */ C(xt, {
2021
+ children: /* @__PURE__ */ w(Dt, {
1943
2022
  value: r ? 0 : i,
1944
2023
  onChange: (e) => {
1945
- t.setVolume(be(e));
2024
+ t.setVolume(Ee(e));
1946
2025
  }
1947
2026
  })
1948
2027
  })
1949
2028
  })]
1950
2029
  });
1951
- }, $ = .05, wt = 5, Tt = h`
2030
+ }, At = .05, jt = 5, Mt = 50, Nt = 1e3, Pt = g`
1952
2031
  display: flex;
1953
2032
  flex-direction: column;
1954
2033
  gap: calc(0.4 * var(--mp-unit));
@@ -1957,7 +2036,7 @@ ${it}
1957
2036
  opacity: 0.72;
1958
2037
  font-size: 0.9em;
1959
2038
  }
1960
- `, Et = h`
2039
+ `, Ft = g`
1961
2040
  position: absolute;
1962
2041
  bottom: 0;
1963
2042
  width: 100%;
@@ -2046,8 +2125,10 @@ ${it}
2046
2125
 
2047
2126
  cursor: pointer;
2048
2127
 
2049
- :hover {
2050
- background-color: ${yt.hover};
2128
+ /* .armed is the hover of a control letting its click through, which takes no pointer events
2129
+ of its own and so is never :hover */
2130
+ :hover, &.armed {
2131
+ background-color: ${Tt.hover};
2051
2132
  }
2052
2133
 
2053
2134
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -2064,7 +2145,7 @@ ${it}
2064
2145
 
2065
2146
  .left {
2066
2147
  .time {
2067
- ${J.bMedium.regular}
2148
+ ${Y.bMedium.regular}
2068
2149
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
2069
2150
  }
2070
2151
  }
@@ -2085,13 +2166,13 @@ ${it}
2085
2166
  }
2086
2167
  }
2087
2168
  }
2088
- `, Dt = () => {
2089
- 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.subtitleTracks), p = U((e) => e.requestSeek), [h, g] = m(null), _ = c === "burn-in", v = f.length > 0, y = r > 0 && n === r, b = u(({ direction: t, stepSize: n }) => {
2090
- let r = xe(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
2091
- e.setVolume(be(a)), o && !e.muted && e.toggleMuted();
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();
2092
2173
  }, [e]);
2093
2174
  d(() => {
2094
- let t = (t) => p ? p(t) : e.seek(t), n = (n) => {
2175
+ let t = (t) => g ? g(t) : e.seek(t), n = (n) => {
2095
2176
  let r = n.target;
2096
2177
  if (r?.isContentEditable || /^(input|textarea|select)$/i.test(r?.tagName ?? "")) return;
2097
2178
  let i = !0;
@@ -2099,116 +2180,159 @@ ${it}
2099
2180
  else if (n.key === "k") e.togglePaused();
2100
2181
  else if (n.key === " ") e.togglePaused();
2101
2182
  else if (n.key === "m") e.toggleMuted();
2102
- else if (n.key === "ArrowUp") b({
2183
+ else if (n.key === "ArrowUp") E({
2103
2184
  direction: "up",
2104
- stepSize: $
2185
+ stepSize: At
2105
2186
  });
2106
- else if (n.key === "ArrowDown") b({
2187
+ else if (n.key === "ArrowDown") E({
2107
2188
  direction: "down",
2108
- stepSize: $
2189
+ stepSize: At
2109
2190
  });
2110
2191
  else if (n.key === "ArrowRight") {
2111
2192
  if (!e.duration) return;
2112
- t(Math.min(e.currentTime + wt, e.duration));
2113
- } else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - wt, 0)) : i = !1;
2193
+ t(Math.min(e.currentTime + jt, e.duration));
2194
+ } else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - jt, 0)) : i = !1;
2114
2195
  i && n.preventDefault();
2115
2196
  };
2116
2197
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
2117
2198
  }, [
2118
2199
  e,
2119
- b,
2120
- p
2200
+ E,
2201
+ g
2121
2202
  ]);
2122
- let x = u((e) => {
2123
- e.preventDefault(), e.deltaY < 0 ? b({
2203
+ let D = u((e) => {
2204
+ e.preventDefault(), e.deltaY < 0 ? E({
2124
2205
  direction: "up",
2125
- stepSize: $
2126
- }) : b({
2206
+ stepSize: At
2207
+ }) : E({
2127
2208
  direction: "down",
2128
- stepSize: $
2209
+ stepSize: At
2129
2210
  });
2130
- }, [b]);
2211
+ }, [E]);
2212
+ d(() => {
2213
+ if (_) return _.addEventListener("wheel", D, { passive: !1 }), () => _.removeEventListener("wheel", D);
2214
+ }, [_, D]);
2215
+ let O = (e) => {
2216
+ if (!f || f.active || f.armed || e.pointerType === "touch") return;
2217
+ let { left: t, top: n, width: r, height: i } = e.currentTarget.getBoundingClientRect();
2218
+ f.arm({
2219
+ left: t,
2220
+ top: n,
2221
+ width: r,
2222
+ height: i
2223
+ });
2224
+ }, k = !!f?.armed;
2131
2225
  return d(() => {
2132
- if (h) return h.addEventListener("wheel", x, { passive: !1 }), () => h.removeEventListener("wheel", x);
2133
- }, [h, x]), /* @__PURE__ */ w("div", {
2134
- css: Et,
2226
+ if (!k) return;
2227
+ clearInterval(b.current);
2228
+ let e = Infinity, t = setInterval(() => {
2229
+ if (Date.now() > e) {
2230
+ clearInterval(t);
2231
+ return;
2232
+ }
2233
+ let n = y.current, r = document.activeElement;
2234
+ n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
2235
+ }, Mt);
2236
+ return b.current = t, () => {
2237
+ e = Date.now() + Nt;
2238
+ };
2239
+ }, [k]), d(() => () => clearInterval(b.current), []), /* @__PURE__ */ T("div", {
2240
+ css: Ft,
2135
2241
  style: { ...o ? {
2136
2242
  opacity: "0",
2137
2243
  pointerEvents: "none"
2138
- } : {} },
2139
- children: [/* @__PURE__ */ C(Qe, {}), /* @__PURE__ */ w("div", {
2244
+ } : k ? { pointerEvents: "none" } : {} },
2245
+ children: [/* @__PURE__ */ w(it, {}), /* @__PURE__ */ T("div", {
2140
2246
  className: "actions",
2141
- children: [/* @__PURE__ */ w("div", {
2247
+ children: [/* @__PURE__ */ T("div", {
2142
2248
  className: "left",
2143
2249
  children: [
2144
- /* @__PURE__ */ C(Z, {
2250
+ /* @__PURE__ */ w(Q, {
2145
2251
  id: "play",
2146
2252
  tooltipPlace: "top-start",
2147
- text: /* @__PURE__ */ C("button", {
2253
+ text: /* @__PURE__ */ w("button", {
2148
2254
  className: "play",
2149
2255
  type: "button",
2150
2256
  onClick: () => e.togglePaused(),
2151
- "aria-label": y ? "Replay" : t ? "Play" : "Pause",
2152
- children: C(y ? P : t ? N : M, {})
2257
+ "aria-label": C ? "Replay" : t ? "Play" : "Pause",
2258
+ children: w(C ? F : t ? P : N, {})
2153
2259
  }),
2154
- toolTipText: /* @__PURE__ */ C("span", { children: y ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
2260
+ toolTipText: /* @__PURE__ */ w("span", { children: C ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
2155
2261
  }),
2156
- /* @__PURE__ */ C(Ct, { ref: g }),
2157
- /* @__PURE__ */ C("div", {
2262
+ /* @__PURE__ */ w(kt, { ref: v }),
2263
+ /* @__PURE__ */ w("div", {
2158
2264
  className: "time",
2159
- children: Se(i ?? n, r)
2265
+ children: Oe(i ?? n, r)
2160
2266
  })
2161
2267
  ]
2162
- }), /* @__PURE__ */ w("div", {
2268
+ }), /* @__PURE__ */ T("div", {
2163
2269
  className: "right",
2164
2270
  children: [
2165
- /* @__PURE__ */ C(ft, {}),
2166
- /* @__PURE__ */ C(vt, {}),
2167
- /* @__PURE__ */ C(gt, {}),
2168
- s ? /* @__PURE__ */ C(Z, {
2271
+ /* @__PURE__ */ w(vt, {}),
2272
+ /* @__PURE__ */ w(wt, {}),
2273
+ /* @__PURE__ */ w(St, {}),
2274
+ f ? /* @__PURE__ */ w(Q, {
2275
+ id: "picture-in-picture",
2276
+ tooltipPlace: "top-end",
2277
+ text: /* @__PURE__ */ w("button", {
2278
+ ref: y,
2279
+ className: f.armed ? "picture-in-picture armed" : "picture-in-picture",
2280
+ type: "button",
2281
+ onPointerEnter: O,
2282
+ onPointerMove: O,
2283
+ onClick: f.active ? f.exit : void 0,
2284
+ "aria-label": "Picture in picture",
2285
+ "aria-pressed": f.active,
2286
+ children: /* @__PURE__ */ w("img", {
2287
+ src: at,
2288
+ alt: ""
2289
+ })
2290
+ }),
2291
+ toolTipText: /* @__PURE__ */ w("span", { children: f.active ? "Exit picture in picture" : "Picture in picture" })
2292
+ }) : s ? /* @__PURE__ */ w(Q, {
2169
2293
  id: "picture-in-picture",
2170
2294
  tooltipPlace: "top-end",
2171
- text: /* @__PURE__ */ C("button", {
2295
+ text: /* @__PURE__ */ w("button", {
2172
2296
  className: "picture-in-picture",
2173
2297
  type: "button",
2174
2298
  onClick: s,
2175
- disabled: _ && !v,
2176
- "aria-label": _ ? "Put the subtitles in the video" : "Picture in picture",
2177
- "aria-pressed": _ ? l : void 0,
2178
- children: _ ? C(l ? nt : rt, {}) : /* @__PURE__ */ C("img", {
2179
- src: $e,
2299
+ disabled: x && !S,
2300
+ "aria-label": x ? "Put the subtitles in the video" : "Picture in picture",
2301
+ "aria-pressed": x ? l : void 0,
2302
+ children: x ? w(l ? ct : lt, {}) : /* @__PURE__ */ w("img", {
2303
+ src: at,
2180
2304
  alt: ""
2181
2305
  })
2182
2306
  }),
2183
- toolTipText: /* @__PURE__ */ w("span", {
2184
- css: Tt,
2185
- children: [/* @__PURE__ */ C("span", {
2307
+ toolTipText: /* @__PURE__ */ T("span", {
2308
+ css: Pt,
2309
+ children: [/* @__PURE__ */ w("span", {
2186
2310
  className: "lead",
2187
- children: _ ? v ? l ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
2188
- }), _ && v ? /* @__PURE__ */ C("span", {
2311
+ 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", {
2189
2313
  className: "hint",
2190
2314
  children: "Then hover the video and click your browser's own pop out button"
2191
2315
  }) : null]
2192
2316
  })
2193
2317
  }) : null,
2194
- /* @__PURE__ */ C(Z, {
2318
+ /* @__PURE__ */ w(Q, {
2195
2319
  id: "full-screen",
2196
2320
  tooltipPlace: "top-end",
2197
- text: /* @__PURE__ */ C("button", {
2321
+ text: /* @__PURE__ */ w("button", {
2198
2322
  className: "full-screen",
2199
2323
  type: "button",
2200
2324
  onClick: () => e.toggleFullscreen(),
2201
2325
  "aria-label": "Full screen",
2202
2326
  "aria-pressed": a,
2203
- children: C(a ? j : A, {})
2327
+ children: w(a ? M : j, {})
2204
2328
  }),
2205
- toolTipText: /* @__PURE__ */ C("span", { children: a ? "Exit full screen (f)" : "Full screen (f)" })
2329
+ toolTipText: /* @__PURE__ */ w("span", { children: a ? "Exit full screen (f)" : "Full screen (f)" })
2206
2330
  })
2207
2331
  ]
2208
2332
  })]
2209
2333
  })]
2210
2334
  });
2211
- }, Ot = 9e3, kt = h`
2335
+ }, Lt = 9e3, Rt = g`
2212
2336
  position: absolute;
2213
2337
  inset: 0;
2214
2338
  z-index: 2;
@@ -2246,12 +2370,12 @@ ${it}
2246
2370
  }
2247
2371
 
2248
2372
  .title {
2249
- ${J.bMedium.bold}
2373
+ ${Y.bMedium.bold}
2250
2374
  color: #fff;
2251
2375
  }
2252
2376
 
2253
2377
  .body {
2254
- ${J.bSmall.regular}
2378
+ ${Y.bSmall.regular}
2255
2379
  color: rgba(255, 255, 255, 0.75);
2256
2380
  }
2257
2381
 
@@ -2262,7 +2386,7 @@ ${it}
2262
2386
  line-height: 1;
2263
2387
  color: #fff;
2264
2388
  }
2265
- `, At = () => {
2389
+ `, zt = () => {
2266
2390
  let e = U((e) => e.burnedInSubtitles), t = U((e) => e.pictureInPictureMode), [n, r] = m(!1);
2267
2391
  return d(() => {
2268
2392
  if (t !== "burn-in" || !e) {
@@ -2270,34 +2394,34 @@ ${it}
2270
2394
  return;
2271
2395
  }
2272
2396
  r(!0);
2273
- let n = setTimeout(() => r(!1), Ot);
2397
+ let n = setTimeout(() => r(!1), Lt);
2274
2398
  return () => clearTimeout(n);
2275
- }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
2276
- css: kt,
2399
+ }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ w("div", {
2400
+ css: Rt,
2277
2401
  className: n ? "show" : "",
2278
2402
  role: "status",
2279
- children: /* @__PURE__ */ w("div", {
2403
+ children: /* @__PURE__ */ T("div", {
2280
2404
  className: "card",
2281
- children: [/* @__PURE__ */ w("div", {
2405
+ children: [/* @__PURE__ */ T("div", {
2282
2406
  className: "words",
2283
- children: [/* @__PURE__ */ C("div", {
2407
+ children: [/* @__PURE__ */ w("div", {
2284
2408
  className: "title",
2285
2409
  children: "Subtitles are in the picture"
2286
- }), /* @__PURE__ */ C("div", {
2410
+ }), /* @__PURE__ */ w("div", {
2287
2411
  className: "body",
2288
2412
  children: "Now hover the video and click your browser's own pop out button"
2289
2413
  })]
2290
- }), /* @__PURE__ */ C("div", {
2414
+ }), /* @__PURE__ */ w("div", {
2291
2415
  className: "arrow",
2292
2416
  "aria-hidden": "true",
2293
2417
  children: "→"
2294
2418
  })]
2295
2419
  })
2296
2420
  });
2297
- }, jt = 1, Mt = 6e3, Nt = 1, Pt = {
2421
+ }, Bt = 1, Vt = 6e3, Ht = 1, Ut = {
2298
2422
  opening: "Skip Opening",
2299
2423
  ending: "Skip Ending"
2300
- }, Ft = h`
2424
+ }, Wt = g`
2301
2425
  position: absolute;
2302
2426
  inset: 0;
2303
2427
  z-index: 2;
@@ -2314,7 +2438,7 @@ ${it}
2314
2438
  pointer-events: auto;
2315
2439
  cursor: pointer;
2316
2440
 
2317
- ${J.bMedium.bold}
2441
+ ${Y.bMedium.bold}
2318
2442
  color: #fff;
2319
2443
  padding: calc(1 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
2320
2444
  border: 1px solid rgba(255, 255, 255, .55);
@@ -2348,47 +2472,47 @@ ${it}
2348
2472
  bottom: calc(9 * var(--mp-unit));
2349
2473
  }
2350
2474
  }
2351
- `, It = () => {
2352
- let e = U((e) => e.chapters), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U(), i = f(() => Ye(e), [e]), a = f(() => {
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(() => {
2353
2477
  if (typeof t != "number") return;
2354
- let n = e.findIndex((e, n) => i[n] !== void 0 && e.start - jt <= t && t < e.end), r = n >= 0 ? i[n] : void 0;
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;
2355
2479
  return r ? {
2356
2480
  kind: r,
2357
2481
  end: e[n].end
2358
2482
  } : void 0;
2359
2483
  }, [
2360
2484
  e,
2361
- i,
2485
+ a,
2362
2486
  t
2363
- ]), o = p(0), [s, c] = m(0);
2487
+ ]), s = p(0), [c, l] = m(0);
2364
2488
  d(() => {
2365
- let e = typeof t == "number" ? t : 0, n = o.current;
2366
- o.current = e, e < n - Nt && c((e) => e + 1);
2489
+ let e = typeof t == "number" ? t : 0, n = s.current;
2490
+ s.current = e, e < n - Ht && l((e) => e + 1);
2367
2491
  }, [t]);
2368
- let [l, u] = m(!1), h = a ? `${a.kind}@${a.end}` : "";
2492
+ let [u, h] = m(!1), g = o ? `${o.kind}@${o.end}` : "";
2369
2493
  return d(() => {
2370
- if (!h) {
2371
- u(!1);
2494
+ if (!g) {
2495
+ h(!1);
2372
2496
  return;
2373
2497
  }
2374
- u(!0);
2375
- let e = setTimeout(() => u(!1), Mt);
2498
+ h(!0);
2499
+ let e = setTimeout(() => h(!1), Vt);
2376
2500
  return () => clearTimeout(e);
2377
- }, [h, s]), d(() => {
2378
- a || u(!1);
2379
- }, [a]), a ? /* @__PURE__ */ C("div", {
2380
- css: Ft,
2381
- className: l ? "show" : "",
2382
- children: /* @__PURE__ */ C("button", {
2501
+ }, [g, c]), d(() => {
2502
+ o || h(!1);
2503
+ }, [o]), o ? /* @__PURE__ */ w("div", {
2504
+ css: Wt,
2505
+ className: u && !r ? "show" : "",
2506
+ children: /* @__PURE__ */ w("button", {
2383
2507
  type: "button",
2384
2508
  className: "skip-chapter",
2385
2509
  onClick: () => {
2386
- u(!1), n ? n(a.end) : r.seek(a.end);
2510
+ h(!1), n ? n(o.end) : i.seek(o.end);
2387
2511
  },
2388
- children: Pt[a.kind]
2512
+ children: Ut[o.kind]
2389
2513
  })
2390
2514
  }) : null;
2391
- }, Lt = 3e3, Rt = h`
2515
+ }, Kt = 3e3, qt = g`
2392
2516
  position: absolute;
2393
2517
  inset: 0;
2394
2518
  z-index: 2;
@@ -2399,7 +2523,10 @@ ${it}
2399
2523
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
2400
2524
  not, and transitioning it holds the item on screen for the length of the fade. */
2401
2525
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
2402
- `, zt = h`
2526
+ `, Jt = (e, t) => {
2527
+ let n = e.left - t.left, r = e.top - t.top;
2528
+ 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`
2403
2530
  position: relative;
2404
2531
  background-color: black;
2405
2532
  display: flex;
@@ -2426,6 +2553,15 @@ ${it}
2426
2553
  pointer-events: none;
2427
2554
  }
2428
2555
 
2556
+ /* Over everything, the control bar included, while a click on the picture in picture control is let
2557
+ through, with a hole at the control. Inside the hole every pointer event goes to the host's
2558
+ document and this one hears nothing, so the pointer arriving on this layer is the only sign here
2559
+ that it left the control. Named with its type for the specificity reason just above. */
2560
+ & > div.pass-through {
2561
+ inset: 0;
2562
+ z-index: 5;
2563
+ }
2564
+
2429
2565
  canvas {
2430
2566
  height: 100%;
2431
2567
  width: 100%;
@@ -2444,62 +2580,63 @@ ${it}
2444
2580
  &.hide {
2445
2581
  cursor: none;
2446
2582
  }
2447
- `, Bt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2583
+ `, Xt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2448
2584
  let r = `${t}${l(e) && e.key != null ? e.key : n}`;
2449
- return l(e) && e.type === c ? Bt(e.props.children, `${r}/`) : [{
2585
+ return l(e) && e.type === c ? Xt(e.props.children, `${r}/`) : [{
2450
2586
  key: r,
2451
2587
  item: e
2452
2588
  }];
2453
- }), Vt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2454
- let o = U(), s = U((e) => e.hideUI), c = U((e) => e.setHideUI), l = U((e) => e.hasMedia), u = p(void 0), f = p("mouse"), m = p({
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({
2455
2591
  x: -1,
2456
2592
  y: -1
2457
- }), h = p(null);
2458
- d(() => () => clearTimeout(u.current), []), d(() => {
2459
- l || (clearTimeout(u.current), c(!1));
2593
+ }), g = p(null);
2594
+ d(() => () => clearTimeout(f.current), []), d(() => {
2595
+ l || (clearTimeout(f.current), c(!1));
2460
2596
  }, [l, c]);
2461
- let g = () => {
2597
+ let _ = () => {
2462
2598
  l && c(!0);
2463
- }, _ = (t) => {
2464
- h.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
2465
- }, v = () => {
2466
- if (f.current !== "mouse") return !1;
2467
- let { x: e, y: t } = m.current;
2468
- if (!h.current || e < 0) return !1;
2469
- let n = document.elementFromPoint(e, t);
2470
- return !!n && h.current.contains(n) && !n.closest(".video");
2599
+ }, v = (t) => {
2600
+ g.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
2471
2601
  }, y = () => {
2472
- if (v()) {
2473
- u.current = setTimeout(y, Lt);
2602
+ if (o.passThroughPictureInPicture?.armed) return !0;
2603
+ if (m.current !== "mouse") return !1;
2604
+ let { x: e, y: t } = h.current;
2605
+ if (!g.current || e < 0) return !1;
2606
+ let n = document.elementFromPoint(e, t);
2607
+ return !!n && g.current.contains(n) && !n.closest(".video");
2608
+ }, b = () => {
2609
+ if (y()) {
2610
+ f.current = setTimeout(b, Kt);
2474
2611
  return;
2475
2612
  }
2476
- g();
2477
- }, b = () => {
2478
- c(!1), clearTimeout(u.current), u.current = setTimeout(y, Lt);
2613
+ _();
2614
+ }, x = () => {
2615
+ c(!1), clearTimeout(f.current), f.current = setTimeout(b, Kt);
2479
2616
  };
2480
- return /* @__PURE__ */ w("div", {
2481
- css: zt,
2482
- ref: _,
2617
+ return /* @__PURE__ */ T("div", {
2618
+ css: Yt,
2619
+ ref: v,
2483
2620
  onPointerMove: (e) => {
2484
- f.current = e.pointerType, e.pointerType === "mouse" && (m.current = {
2621
+ m.current = e.pointerType, e.pointerType === "mouse" && (h.current = {
2485
2622
  x: e.clientX,
2486
2623
  y: e.clientY
2487
- }, b());
2624
+ }, x());
2488
2625
  },
2489
2626
  onPointerDown: (e) => {
2490
- f.current = e.pointerType;
2627
+ m.current = e.pointerType;
2491
2628
  },
2492
2629
  onMouseOut: (e) => {
2493
2630
  let t = e.relatedTarget;
2494
2631
  if (t && e.currentTarget.contains(t)) return;
2495
2632
  let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
2496
- e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(u.current), g());
2633
+ e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(f.current), _());
2497
2634
  },
2498
2635
  className: s ? "hide" : "",
2499
2636
  children: [
2500
- /* @__PURE__ */ C(_e, { onSubtitleRef: n }),
2501
- Bt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
2502
- css: Rt,
2637
+ /* @__PURE__ */ w(Ce, { onSubtitleRef: n }),
2638
+ Xt(r).map(({ key: e, item: t }) => /* @__PURE__ */ w("div", {
2639
+ css: qt,
2503
2640
  style: { ...s ? {
2504
2641
  opacity: "0",
2505
2642
  visibility: "hidden",
@@ -2507,27 +2644,32 @@ ${it}
2507
2644
  } : {} },
2508
2645
  children: t
2509
2646
  }, e)),
2510
- i === !1 ? null : /* @__PURE__ */ C(Dt, {}),
2511
- /* @__PURE__ */ C(At, {}),
2512
- /* @__PURE__ */ C(It, {}),
2513
- /* @__PURE__ */ w("div", {
2647
+ i === !1 ? null : /* @__PURE__ */ w(It, {}),
2648
+ /* @__PURE__ */ w(zt, {}),
2649
+ /* @__PURE__ */ w(Gt, {}),
2650
+ u?.armed && g.current ? /* @__PURE__ */ w("div", {
2651
+ className: "pass-through",
2652
+ style: { clipPath: Jt(u.armed, g.current.getBoundingClientRect()) },
2653
+ onPointerOver: u.disarm
2654
+ }) : null,
2655
+ /* @__PURE__ */ T("div", {
2514
2656
  className: "video",
2515
2657
  onClick: () => {
2516
- if (f.current === "mouse") {
2658
+ if (m.current === "mouse") {
2517
2659
  o.togglePaused();
2518
2660
  return;
2519
2661
  }
2520
- s ? b() : (clearTimeout(u.current), g());
2662
+ s ? x() : (clearTimeout(f.current), _());
2521
2663
  },
2522
- children: [t ? /* @__PURE__ */ C("video", {
2664
+ children: [t ? /* @__PURE__ */ w("video", {
2523
2665
  ref: t,
2524
2666
  playsInline: !0
2525
2667
  }) : null, a]
2526
2668
  })
2527
2669
  ]
2528
2670
  });
2529
- }, Ht = ({ options: e, children: t }) => {
2530
- 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 = y(), _ = v(), [b, x] = m(null), [S, w] = m(null), T = n?.media ?? b;
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;
2531
2673
  d(() => (g?.(T), () => g?.(null)), [T, g]);
2532
2674
  let { expose: E } = e, D = E === !0 ? {} : E || void 0, O = p(D);
2533
2675
  O.current = D;
@@ -2546,31 +2688,31 @@ ${it}
2546
2688
  k,
2547
2689
  A,
2548
2690
  j
2549
- ]), oe(b, S, r);
2691
+ ]), oe(v, S, r);
2550
2692
  let { thumbnails: M, requestThumbnail: N } = le({
2551
2693
  publicPath: c,
2552
2694
  workerUrl: l,
2553
2695
  length: h === !1 ? void 0 : o,
2554
2696
  read: f ?? u,
2555
2697
  downloadedRanges: s
2556
- }), P = n?.thumbnails?.all ?? M, { toggle: F, mode: I, burnedIn: L } = ue(b, S), R = U((e) => e.setSourceState), z = n ? !!n.media : o !== void 0;
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;
2557
2699
  d(() => {
2558
- R({
2700
+ z({
2559
2701
  title: i,
2560
2702
  size: o,
2561
2703
  downloadedRanges: s,
2562
- hasMedia: z
2704
+ hasMedia: ee
2563
2705
  });
2564
2706
  }, [
2565
- R,
2707
+ z,
2566
2708
  i,
2567
2709
  o,
2568
2710
  s,
2569
- z
2711
+ ee
2570
2712
  ]);
2571
2713
  let B = n?.thumbnails?.at;
2572
2714
  d(() => {
2573
- R({
2715
+ z({
2574
2716
  thumbnails: P,
2575
2717
  thumbnailAt: B,
2576
2718
  requestThumbnail: N,
@@ -2579,17 +2721,19 @@ ${it}
2579
2721
  burnedInSubtitles: L
2580
2722
  });
2581
2723
  }, [
2582
- R,
2724
+ z,
2583
2725
  P,
2584
2726
  B,
2585
2727
  N,
2586
2728
  F,
2587
2729
  I,
2588
2730
  L
2589
- ]);
2731
+ ]), d(() => {
2732
+ z({ passThroughPictureInPicture: R });
2733
+ }, [z, R]);
2590
2734
  let V = n?.subtitles?.selection, H = n?.audioTracks?.selection;
2591
2735
  return d(() => {
2592
- V && R({
2736
+ V && z({
2593
2737
  subtitleTracks: V.options.map(({ id: e, label: t, disabled: n }) => ({
2594
2738
  id: e,
2595
2739
  label: t,
@@ -2599,8 +2743,8 @@ ${it}
2599
2743
  selectSubtitleTrack: (e) => V.select(e == null ? null : String(e)),
2600
2744
  subtitleOffLabel: V.offLabel
2601
2745
  });
2602
- }, [R, V]), d(() => {
2603
- H && R({
2746
+ }, [z, V]), d(() => {
2747
+ H && z({
2604
2748
  audioTracks: H.options.map(({ id: e, label: t, disabled: n }) => ({
2605
2749
  id: e,
2606
2750
  label: t,
@@ -2609,17 +2753,17 @@ ${it}
2609
2753
  selectedAudioTrack: H.selectedId ?? void 0,
2610
2754
  selectAudioTrack: (e) => H.select(String(e))
2611
2755
  });
2612
- }, [R, H]), d(() => {
2613
- a && R({ chapters: a });
2614
- }, [R, a]), /* @__PURE__ */ C(Vt, {
2756
+ }, [z, H]), d(() => {
2757
+ a && z({ chapters: a });
2758
+ }, [z, a]), /* @__PURE__ */ w(Zt, {
2615
2759
  ref: _,
2616
2760
  onVideoRef: n ? void 0 : x,
2617
- onSubtitleRef: w,
2761
+ onSubtitleRef: C,
2618
2762
  overlay: e.overlay,
2619
2763
  controls: e.controls,
2620
2764
  children: t
2621
2765
  });
2622
- }, Ut = h`
2766
+ }, $t = g`
2623
2767
  /**
2624
2768
  * The chrome's whole scale, in one place.
2625
2769
  *
@@ -2689,17 +2833,17 @@ ${it}
2689
2833
  height: 100%;
2690
2834
  width: 100%;
2691
2835
  overflow: hidden;
2692
- `, Wt = (e) => /* @__PURE__ */ C("div", {
2693
- css: Ut,
2694
- children: /* @__PURE__ */ C(H.Provider, { children: /* @__PURE__ */ C(Ht, {
2836
+ `, en = (e) => /* @__PURE__ */ w("div", {
2837
+ css: $t,
2838
+ children: /* @__PURE__ */ w(H.Provider, { children: /* @__PURE__ */ w(Qt, {
2695
2839
  options: e,
2696
2840
  children: e.children
2697
2841
  }) })
2698
- }), Gt = (e) => !!e && typeof e == "object" && "at" in e, Kt = (e) => !!e && typeof e == "object" && "selection" in e, qt = ({ blob: e, name: t }) => ({
2842
+ }), tn = (e) => !!e && typeof e == "object" && "at" in e, nn = (e) => !!e && typeof e == "object" && "selection" in e, rn = ({ blob: e, name: t }) => ({
2699
2843
  length: e.size,
2700
2844
  name: t ?? (e instanceof File ? e.name : void 0),
2701
2845
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
2702
- }), Jt = async (e, t) => {
2846
+ }), an = async (e, t) => {
2703
2847
  let n = await fetch(e, {
2704
2848
  headers: { Range: "bytes=0-1" },
2705
2849
  credentials: t
@@ -2709,8 +2853,8 @@ ${it}
2709
2853
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
2710
2854
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
2711
2855
  return i;
2712
- }, Yt = async ({ url: e, length: t, name: n, credentials: r }) => {
2713
- let i = t ?? await Jt(e, r);
2856
+ }, on = async ({ url: e, length: t, name: n, credentials: r }) => {
2857
+ let i = t ?? await an(e, r);
2714
2858
  return {
2715
2859
  length: i,
2716
2860
  name: n,
@@ -2725,9 +2869,9 @@ ${it}
2725
2869
  return o.arrayBuffer();
2726
2870
  }
2727
2871
  };
2728
- }, Xt = async (e) => {
2729
- if ("blob" in e) return qt(e);
2730
- if ("url" in e) return Yt(e);
2872
+ }, sn = async (e) => {
2873
+ if ("blob" in e) return rn(e);
2874
+ if ("url" in e) return on(e);
2731
2875
  if ("read" in e) return {
2732
2876
  length: e.length,
2733
2877
  name: e.name,
@@ -2736,4 +2880,4 @@ ${it}
2736
2880
  throw Error(`Unknown source type: ${e}`);
2737
2881
  };
2738
2882
  //#endregion
2739
- export { Wt as MediaPlayer, Wt as default, H as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, Xt as inputToRemuxerInput, Kt as isDelegatedTracks, Gt as isExternalThumbnails, V as sourceFeature, i as startPlayback, ue as usePictureInPicture, U as usePlayer, le as useSeekThumbnails };
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 };