@banou/media-player 0.10.6 → 0.10.7

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