@banou/media-player 0.10.2 → 0.10.4

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,4 +1,4 @@
1
- import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-DqyZgmTv.js";
1
+ import { l as e, n as t, o as n, r, s as i, t as a, u as o } from "./engine-CB5J5kah.js";
2
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
3
  import { css as h, keyframes as g } from "@emotion/react";
4
4
  import { createPlayer as _, useContainerAttach as v, useMediaAttach as y } from "@videojs/react";
@@ -20,6 +20,7 @@ var B = {
20
20
  selectAudioTrack: () => {},
21
21
  hideUI: !1,
22
22
  setHideUI: () => {},
23
+ hasMedia: !1,
23
24
  togglePictureInPicture: null,
24
25
  pictureInPictureMode: null,
25
26
  burnedInSubtitles: !1,
@@ -48,7 +49,7 @@ var B = {
48
49
  } catch {
49
50
  return;
50
51
  }
51
- }, G = (e) => e?.replace(/_/g, " ").trim() || void 0, ee = (e) => {
52
+ }, G = (e) => e?.replace(/_/g, " ").trim() || void 0, K = (e) => {
52
53
  let t = e.map((e) => W(e.language) ?? G(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
53
54
  ...e,
54
55
  [t]: (e[t] ?? 0) + 1
@@ -60,27 +61,27 @@ var B = {
60
61
  label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
61
62
  };
62
63
  });
63
- }, te = (e) => ee(e).map(({ track: e, label: t }) => ({
64
+ }, q = (e) => K(e).map(({ track: e, label: t }) => ({
64
65
  id: e.streamIndex,
65
66
  label: t
66
- })), ne = [
67
+ })), ee = [
67
68
  0,
68
69
  250,
69
70
  1e3,
70
71
  3e3,
71
72
  1e4
72
- ], re = 6e4, ie = 500, ae = (e) => e instanceof Error ? e.message : String(e), oe = (e) => {
73
+ ], te = 6e4, ne = 500, re = 15e3, ie = (e) => e instanceof Error ? e.message : String(e), ae = (e) => {
73
74
  let t = [], n = e?.cause;
74
75
  for (let e = 0; n != null && e < 8; e++) {
75
76
  if (typeof MediaError < "u" && n instanceof MediaError) {
76
77
  t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
77
78
  break;
78
79
  }
79
- t.push(ae(n)), n = n?.cause;
80
+ t.push(ie(n)), n = n?.cause;
80
81
  }
81
82
  return t.length ? t.join("\n") : void 0;
82
- }, se = (e, t, r) => {
83
- 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);
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
85
  S.current = b;
85
86
  let [C, w] = m(void 0), [T, E] = m(0), D = p({
86
87
  count: 0,
@@ -113,11 +114,17 @@ var B = {
113
114
  if (n) for (let t = 0; t < n.buffered.length; t++) n.buffered.start(t) <= e + 1 && e < n.buffered.end(t) && (i = n.buffered.end(t) - e);
114
115
  console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - r)}ms via ${o}, runway ${i.toFixed(1)}s${o === "deadline" ? " (EXPOSED: moved before its data was ready)" : ""}`);
115
116
  }
116
- }, c = setTimeout(() => {
117
+ };
118
+ a.setSourceState({ seekingTo: e });
119
+ let c = t.videoElement, l = () => {
120
+ c?.removeEventListener("seeked", l), clearTimeout(u), a.setSourceState({ seekingTo: void 0 });
121
+ }, u = setTimeout(l, re);
122
+ c?.addEventListener("seeked", l);
123
+ let d = setTimeout(() => {
117
124
  o = "deadline", s();
118
125
  }, x);
119
126
  t.prepareSeek(e).catch(() => {}).finally(() => {
120
- clearTimeout(c), s();
127
+ clearTimeout(d), s();
121
128
  });
122
129
  }, [a, x]), L = u((e) => {
123
130
  typeof e == "number" && (a.setSourceState({ selectedAudioTrack: e }), w(e));
@@ -141,7 +148,7 @@ var B = {
141
148
  ready: !1
142
149
  });
143
150
  let u = (t, n) => {
144
- let r = Date.now(), i = ae(t), o = oe(t), s = a.playbackErrors, c = s[s.length - 1];
151
+ let r = Date.now(), i = ie(t), o = ae(t), s = a.playbackErrors, c = s[s.length - 1];
145
152
  if (c && c.message === i && c.detail === o && c.recovered === n) {
146
153
  let e = {
147
154
  ...c,
@@ -166,11 +173,11 @@ var B = {
166
173
  let t = n(e);
167
174
  if (u(e, t), t) {
168
175
  let t = performance.now();
169
- t - D.current.at > re && (D.current = {
176
+ t - D.current.at > te && (D.current = {
170
177
  count: 0,
171
178
  at: t
172
179
  });
173
- let n = ne[Math.min(D.current.count, ne.length - 1)];
180
+ let n = ee[Math.min(D.current.count, ee.length - 1)];
174
181
  D.current = {
175
182
  count: D.current.count + 1,
176
183
  at: t
@@ -207,13 +214,13 @@ var B = {
207
214
  onSeek: (e) => N.current?.(e),
208
215
  onSubtitleStreams: (e) => {
209
216
  r || a.setSourceState({
210
- subtitleTracks: te(e),
217
+ subtitleTracks: q(e),
211
218
  ...j.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
212
219
  });
213
220
  },
214
221
  onAudioStreams: (e, t) => {
215
222
  r || a.setSourceState({
216
- audioTracks: te(e),
223
+ audioTracks: q(e),
217
224
  selectedAudioTrack: t
218
225
  });
219
226
  }
@@ -253,13 +260,13 @@ var B = {
253
260
  y,
254
261
  T
255
262
  ]);
256
- }, ce = 5e3, le = 6e4, ue = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
263
+ }, se = 5e3, ce = 6e4, le = ({ publicPath: e, workerUrl: t, length: n, read: i, downloadedRanges: a }) => {
257
264
  let [o, s] = m([]), c = p(null), l = p(i);
258
265
  l.current = i;
259
266
  let h = f(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = p(h);
260
267
  return g.current = h, d(() => {
261
268
  if (!n || !i || !e || !t) return;
262
- let a = !1, o = null, u, d = ce, f = () => {
269
+ let a = !1, o = null, u, d = se, f = () => {
263
270
  r({
264
271
  publicPath: e,
265
272
  workerUrl: t,
@@ -275,7 +282,7 @@ var B = {
275
282
  }
276
283
  o = e, c.current = e, e.update(g.current);
277
284
  }, () => {
278
- a || (u = setTimeout(f, d), d = Math.min(d * 2, le));
285
+ a || (u = setTimeout(f, d), d = Math.min(d * 2, ce));
279
286
  });
280
287
  };
281
288
  return f(), () => {
@@ -293,7 +300,7 @@ var B = {
293
300
  c.current?.prioritize(e);
294
301
  }, [])
295
302
  };
296
- }, de = (e, n) => {
303
+ }, ue = (e, n) => {
297
304
  let r = p(null), [i, o] = m(!1), [s] = m(() => t());
298
305
  d(() => {
299
306
  if (!e || !n || !s) return;
@@ -321,7 +328,7 @@ var B = {
321
328
  mode: s,
322
329
  burnedIn: i
323
330
  };
324
- }, K = {
331
+ }, J = {
325
332
  headings: {
326
333
  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 ",
327
334
  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 ",
@@ -348,7 +355,7 @@ var B = {
348
355
  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 ",
349
356
  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 "
350
357
  }
351
- }, fe = h`
358
+ }, de = h`
352
359
  display: flex;
353
360
  justify-content: center;
354
361
  align-items: center;
@@ -361,7 +368,7 @@ var B = {
361
368
  margin: auto;
362
369
  pointer-events: none;
363
370
  }
364
- `, pe = h`
371
+ `, fe = h`
365
372
  position: absolute;
366
373
  top: 0;
367
374
  left: 0;
@@ -369,7 +376,7 @@ var B = {
369
376
  padding: calc(1.2 * var(--mp-unit)) calc(1.6 * var(--mp-unit));
370
377
  /* clears a notch once the player is fullscreen; resolves to zero everywhere else */
371
378
  padding-top: calc(calc(1.2 * var(--mp-unit)) + env(safe-area-inset-top, 0px));
372
- ${K.headings.small}
379
+ ${J.headings.small}
373
380
  color: white;
374
381
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
375
382
  z-index: 2;
@@ -390,7 +397,7 @@ var B = {
390
397
 
391
398
  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%);
392
399
  transition: opacity 0.1s cubic-bezier(.4,0,1,1);
393
- `, me = h`
400
+ `, pe = h`
394
401
  position: absolute;
395
402
  inset: 0;
396
403
  z-index: 2;
@@ -410,44 +417,44 @@ var B = {
410
417
  to { transform: rotate(360deg); }
411
418
  `} 0.8s linear infinite;
412
419
  }
413
- `, he = h`
420
+ `, me = h`
414
421
  position: absolute;
415
422
  inset: auto 0 20%;
416
423
  z-index: 3;
417
424
  padding: 0 calc(2 * var(--mp-unit));
418
425
  text-align: center;
419
426
  color: #fff;
420
- ${K.bLarge.regular}
427
+ ${J.bLarge.regular}
421
428
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
422
429
  pointer-events: none;
423
- `, ge = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", _e = ({ onSubtitleRef: e }) => {
424
- 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);
430
+ `, he = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", ge = ({ 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);
425
432
  return /* @__PURE__ */ w(S, { children: [
426
433
  t ? /* @__PURE__ */ C("div", {
427
434
  className: "title",
428
- css: pe,
435
+ css: fe,
429
436
  style: { ...n ? {
430
437
  opacity: "0",
431
438
  pointerEvents: "none"
432
439
  } : {} },
433
440
  children: t
434
441
  }) : void 0,
435
- (a ? !i : o) && !r ? /* @__PURE__ */ C("div", { css: me }) : void 0,
442
+ ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ C("div", { css: pe }) : void 0,
436
443
  r ? /* @__PURE__ */ C("div", {
437
- css: he,
438
- children: ge(r)
444
+ css: me,
445
+ children: he(r)
439
446
  }) : void 0,
440
447
  /* @__PURE__ */ C("div", {
441
448
  className: "subtitles",
442
449
  ref: e,
443
- css: fe
450
+ css: de
444
451
  })
445
452
  ] });
446
- }, ve = 1e-4, q = 1, ye = (e) => Math.max(ve, Math.min(q, e)) ** 2, J = (e) => Math.max(ve, Math.min(q, e)) ** (q / 2), Y = (e) => {
453
+ }, _e = 1e-4, ve = 1, ye = (e) => Math.max(_e, Math.min(ve, e)) ** 2, be = (e) => Math.max(_e, Math.min(ve, e)) ** (ve / 2), Y = (e) => {
447
454
  if (e === void 0) return "0:00";
448
455
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
449
456
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
450
- }, be = (e, t) => `${Y(e)} / ${Y(t)}`, xe = (e) => h`
457
+ }, xe = (e, t) => `${Y(e)} / ${Y(t)}`, Se = (e) => h`
451
458
  display: flex;
452
459
  justify-content: flex-start;
453
460
 
@@ -479,7 +486,7 @@ var B = {
479
486
  z-index: 3;
480
487
 
481
488
  * {
482
- ${K.bMedium.regular}
489
+ ${J.bMedium.regular}
483
490
  }
484
491
 
485
492
  ${e === "sm" && h`
@@ -495,17 +502,17 @@ var B = {
495
502
  x: -1,
496
503
  y: -1,
497
504
  anchors: 0
498
- }, Se = (e) => {
505
+ }, Ce = (e) => {
499
506
  X.x = e.clientX, X.y = e.clientY;
500
- }, Ce = () => (X.anchors++ === 0 && window.addEventListener("pointermove", Se, {
507
+ }, we = () => (X.anchors++ === 0 && window.addEventListener("pointermove", Ce, {
501
508
  capture: !0,
502
509
  passive: !0
503
510
  }), () => {
504
- --X.anchors === 0 && window.removeEventListener("pointermove", Se, { capture: !0 });
511
+ --X.anchors === 0 && window.removeEventListener("pointermove", Ce, { capture: !0 });
505
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" }) => {
506
513
  let l = p(null), u = p(null);
507
514
  return d(() => {
508
- let e = Ce(), t = () => {
515
+ let e = we(), t = () => {
509
516
  let e = l.current;
510
517
  if (!e) return;
511
518
  let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
@@ -527,12 +534,12 @@ var B = {
527
534
  children: n
528
535
  }), !s && /* @__PURE__ */ C(z, {
529
536
  ref: u,
530
- css: xe(c),
537
+ css: Se(c),
531
538
  id: e,
532
539
  noArrow: !0,
533
540
  children: t
534
541
  })] });
535
- }, we = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
542
+ }, Te = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
536
543
  let [i, a] = m(!1), o = p(t);
537
544
  o.current = t;
538
545
  let s = p(null), c = u((t, r) => {
@@ -571,26 +578,26 @@ var B = {
571
578
  style: { touchAction: "none" }
572
579
  }
573
580
  };
574
- }, Te = 2, Ee = .005, De = "#000", Oe = "#0000", ke = (e, t) => {
581
+ }, Ee = 2, De = .005, Oe = "#000", ke = "#0000", Ae = (e, t) => {
575
582
  if (!t) return [];
576
583
  let n = /* @__PURE__ */ new Set();
577
584
  for (let { start: r, end: i } of e) for (let e of [r, i]) {
578
585
  let r = e / t;
579
- r <= Ee || r >= 1 - Ee || n.add(Number((r * 100).toFixed(4)));
586
+ r <= De || r >= 1 - De || n.add(Number((r * 100).toFixed(4)));
580
587
  }
581
588
  return n.size ? [
582
589
  0,
583
590
  ...[...n].sort((e, t) => e - t),
584
591
  100
585
592
  ] : [];
586
- }, Ae = (e, t) => {
587
- let n = Te / 2, r = e.length - 2, i = [];
593
+ }, je = (e, t) => {
594
+ let n = Ee / 2, r = e.length - 2, i = [];
588
595
  for (let a = 0; a <= r; a += 1) {
589
596
  let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
590
- i.push(`${t(a) ? De : Oe} ${c} ${l}`), a !== r && i.push(`${Oe} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
597
+ i.push(`${t(a) ? Oe : ke} ${c} ${l}`), a !== r && i.push(`${ke} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
591
598
  }
592
599
  return `linear-gradient(90deg, ${i.join(", ")})`;
593
- }, je = /* @__PURE__ */ new Set([
600
+ }, Me = /* @__PURE__ */ new Set([
594
601
  "op",
595
602
  "ops",
596
603
  "opening",
@@ -598,7 +605,7 @@ var B = {
598
605
  "ncop",
599
606
  "オープニング",
600
607
  "op主題歌"
601
- ]), Me = /* @__PURE__ */ new Set([
608
+ ]), Ne = /* @__PURE__ */ new Set([
602
609
  "ed",
603
610
  "eds",
604
611
  "ending",
@@ -611,13 +618,13 @@ var B = {
611
618
  "エンドカード",
612
619
  "エンドロール",
613
620
  "ed主題歌"
614
- ]), Ne = /* @__PURE__ */ new Set(["intro", "イントロ"]), Pe = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Fe = {
621
+ ]), Pe = /* @__PURE__ */ new Set(["intro", "イントロ"]), Fe = /* @__PURE__ */ new Set(["outro", "アウトロ"]), Ie = {
615
622
  "credits start": "ending",
616
623
  "credits end": null,
617
624
  "preview end": null,
618
625
  "end credits": "ending",
619
626
  "closing credits": "ending"
620
- }, Ie = /* @__PURE__ */ new Set([
627
+ }, Le = /* @__PURE__ */ new Set([
621
628
  "theme",
622
629
  "themes",
623
630
  "song",
@@ -636,53 +643,53 @@ var B = {
636
643
  "the",
637
644
  "主題歌",
638
645
  "ノンクレジット"
639
- ]), Le = /* @__PURE__ */ new Set([
646
+ ]), Re = /* @__PURE__ */ new Set([
640
647
  "post",
641
648
  "pre",
642
649
  "after",
643
650
  "before",
644
651
  "non"
645
- ]), Re = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, ze = (e) => /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), Be = (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) && !Ie.has(e)), Ve = (e, t) => {
646
- if (je.has(e)) return "opening";
647
- if (Me.has(e)) return "ending";
652
+ ]), ze = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, Be = (e) => /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), Ve = (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) && !Le.has(e)), He = (e, t) => {
653
+ if (Me.has(e)) return "opening";
654
+ if (Ne.has(e)) return "ending";
648
655
  if (t) {
649
- if (Ne.has(e)) return "opening";
650
- if (Pe.has(e)) return "ending";
656
+ if (Pe.has(e)) return "opening";
657
+ if (Fe.has(e)) return "ending";
651
658
  }
652
- }, He = (e, t) => {
653
- if (ze(e)) return;
659
+ }, Ue = (e, t) => {
660
+ if (Be(e)) return;
654
661
  let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
655
- if (n in Fe) return Fe[n] ?? void 0;
656
- let r = n.split(Re).map((e) => e.trim()).filter(Boolean);
657
- if (r.some((e) => e.split(/[\s_]+/u).some((e) => Le.has(e)))) return;
662
+ if (n in Ie) return Ie[n] ?? void 0;
663
+ let r = n.split(ze).map((e) => e.trim()).filter(Boolean);
664
+ if (r.some((e) => e.split(/[\s_]+/u).some((e) => Re.has(e)))) return;
658
665
  let i = r.length > 1 ? [r[0], r.at(-1)] : r;
659
666
  for (let e of i) {
660
- let n = Be(e);
667
+ let n = Ve(e);
661
668
  if (n.length !== 1) continue;
662
- let r = Ve(n[0], t);
669
+ let r = He(n[0], t);
663
670
  if (r) return r;
664
671
  }
665
- }, Ue = 15, We = 87, Ge = 93, Ke = (e) => {
672
+ }, We = 15, Ge = 87, Ke = 93, qe = (e) => {
666
673
  let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
667
674
  if (!n) return t;
668
675
  let r = e.map((e, t) => ({
669
676
  index: t,
670
677
  start: e.start,
671
678
  length: e.end - e.start
672
- })).filter(({ length: e }) => e >= We && e <= Ge), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
679
+ })).filter(({ length: e }) => e >= Ge && e <= Ke), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
673
680
  return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
674
- }, qe = (e) => {
675
- let t = e.map(({ title: e }) => He(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);
681
+ }, Je = (e) => {
682
+ let t = e.map(({ title: e }) => Ue(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);
676
683
  if (r > 0 && n * 2 > r) return e.map(() => void 0);
677
684
  let i = e.map((e, n) => {
678
- if (e.end - e.start < Ue) return;
685
+ if (e.end - e.start < We) return;
679
686
  let r = t[n];
680
687
  if (r) return r;
681
- let i = He(e.title, !0);
688
+ let i = Ue(e.title, !0);
682
689
  return i && !t.includes(i) ? i : void 0;
683
690
  });
684
- return i.some(Boolean) ? i : Ke(e);
685
- }, Je = h`
691
+ return i.some(Boolean) ? i : qe(e);
692
+ }, Ye = h`
686
693
  position: relative;
687
694
  height: calc(.4 * var(--mp-unit));
688
695
 
@@ -767,7 +774,7 @@ var B = {
767
774
  box-shadow: 0 0 calc(1 * var(--mp-unit)) rgba(0, 0, 0, .5);
768
775
 
769
776
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
770
- ${K.bMedium.bold}
777
+ ${J.bMedium.bold}
771
778
 
772
779
  gap: calc(.6 * var(--mp-unit));
773
780
 
@@ -901,38 +908,38 @@ var B = {
901
908
  --thumbnail-width: calc(18 * var(--mp-unit));
902
909
  --thumbnail-half: calc(9 * var(--mp-unit));
903
910
  }
904
- `, Ye = 4, Xe = () => {
905
- 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.indexes), s = U((e) => e.thumbnails), c = U((e) => e.thumbnailAt), l = U((e) => e.requestThumbnail), u = U((e) => e.chapters), h = p(null), [g, _] = m(void 0), [v, y] = m(void 0), b = (e) => {
906
- y(e), l(e);
907
- }, x = p(void 0), S = p(0), T = p(void 0), E = p(void 0), D = p(!1), { dragging: O, handlers: k } = we({
908
- ref: h,
911
+ `, Xe = 4, Ze = () => {
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.indexes), s = U((e) => e.thumbnails), c = U((e) => e.thumbnailAt), l = U((e) => e.requestThumbnail), u = U((e) => e.chapters), h = U((e) => e.seekingTo), g = p(null), [_, v] = m(void 0), [y, b] = m(void 0), x = (e) => {
913
+ b(e), l(e);
914
+ }, S = p(void 0), T = p(0), E = p(void 0), D = p(void 0), O = p(!1), { dragging: k, handlers: A } = Te({
915
+ ref: g,
909
916
  onChange: (e) => {
910
- if (S.current += 1, T.current = e, E.current === void 0) E.current = e;
911
- else if (!D.current) {
912
- let t = h.current?.getBoundingClientRect().width ?? 0;
913
- Math.abs(e - E.current) * t > Ye && (D.current = !0);
917
+ if (T.current += 1, E.current = e, D.current === void 0) D.current = e;
918
+ else if (!O.current) {
919
+ let t = g.current?.getBoundingClientRect().width ?? 0;
920
+ Math.abs(e - D.current) * t > Xe && (O.current = !0);
914
921
  }
915
- _(e), x.current !== "mouse" && b(e * r);
922
+ v(e), S.current !== "mouse" && x(e * r);
916
923
  }
917
- }), A = (e) => {
918
- x.current = e.pointerType, S.current = 0, E.current = void 0, D.current = !1, k.onPointerDown(e);
919
- }, j = (t) => {
920
- k.onPointerUp(t);
921
- let i = S.current > 0 ? T.current : void 0;
924
+ }), j = (e) => {
925
+ S.current = e.pointerType, T.current = 0, D.current = void 0, O.current = !1, A.onPointerDown(e);
926
+ }, M = (t) => {
927
+ A.onPointerUp(t);
928
+ let i = T.current > 0 ? E.current : void 0;
922
929
  if (i !== void 0 && r) {
923
930
  let t = i * r;
924
931
  n ? n(t) : e.seek(t);
925
932
  }
926
- S.current = 0, D.current = !1, E.current = void 0, t.pointerType !== "mouse" && b(void 0);
927
- }, M = (e) => {
928
- if (!h.current) return;
929
- let { left: t, right: n } = h.current.getBoundingClientRect();
930
- return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
933
+ T.current = 0, O.current = !1, D.current = void 0, t.pointerType !== "mouse" && x(void 0);
931
934
  }, N = (e) => {
932
- b(M(e.clientX));
933
- }, P = () => {
934
- h.current && b(void 0);
935
- }, F = (e) => r ? e / r * 100 : 0, I = f(() => a?.map((e, t) => {
935
+ if (!g.current) return;
936
+ let { left: t, right: n } = g.current.getBoundingClientRect();
937
+ return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
938
+ }, P = (e) => {
939
+ x(N(e.clientX));
940
+ }, F = () => {
941
+ g.current && x(void 0);
942
+ }, I = (e) => r ? e / r * 100 : 0, L = f(() => a?.map((e, t) => {
936
943
  if (!i || !r) return null;
937
944
  let n = o.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), s = n.at(-1);
938
945
  if (!a || !s) return null;
@@ -950,100 +957,111 @@ var B = {
950
957
  a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
951
958
  ]);
952
959
  d(() => {
953
- g === void 0 || !r || !O || !D.current || e.seek(g * r);
960
+ _ === void 0 || !r || !k || !O.current || e.seek(_ * r);
954
961
  }, [
955
962
  e,
956
- O,
957
- g,
963
+ k,
964
+ _,
958
965
  r
959
966
  ]);
960
- let L = f(() => !r || typeof t != "number" ? 0 : t / r, [r, t]), R = f(() => ke(u, r), [u, r]), z = R.length > 0, B = f(() => {
961
- if (!z || v === void 0 || !r) return -1;
962
- let e = v / r * 100, t = R.findIndex((t, n) => n < R.length - 1 && e >= t && e < R[n + 1]);
963
- return t >= 0 ? t : R.length - 2;
967
+ let R = f(() => {
968
+ if (!r) return 0;
969
+ if (k && _ !== void 0) return _;
970
+ let e = h ?? t;
971
+ return typeof e == "number" ? e / r : 0;
972
+ }, [
973
+ r,
974
+ t,
975
+ k,
976
+ _,
977
+ h
978
+ ]), z = f(() => Ae(u, r), [u, r]), B = z.length > 0, V = f(() => {
979
+ if (!B || y === void 0 || !r) return -1;
980
+ let e = y / r * 100, t = z.findIndex((t, n) => n < z.length - 1 && e >= t && e < z[n + 1]);
981
+ return t >= 0 ? t : z.length - 2;
964
982
  }, [
983
+ B,
965
984
  z,
966
- R,
967
- v,
985
+ y,
968
986
  r
969
- ]), V = f(() => z ? Ae(R, (e) => e !== B) : void 0, [
987
+ ]), H = f(() => B ? je(z, (e) => e !== V) : void 0, [
988
+ B,
970
989
  z,
971
- R,
972
- B
973
- ]), H = f(() => B >= 0 ? Ae(R, (e) => e === B) : void 0, [R, B]), W = f(() => {
974
- if (v !== void 0) return u.find(({ start: e, end: t }) => e <= v && v < t);
975
- }, [u, v]), G = f(() => {
976
- if (v) {
977
- if (c) return c(v);
978
- if (s.length) return s.find(({ startTime: e, endTime: t }) => e <= v && v < t);
990
+ V
991
+ ]), W = f(() => V >= 0 ? je(z, (e) => e === V) : void 0, [z, V]), G = f(() => {
992
+ if (y !== void 0) return u.find(({ start: e, end: t }) => e <= y && y < t);
993
+ }, [u, y]), K = f(() => {
994
+ if (y) {
995
+ if (c) return c(y);
996
+ if (s.length) return s.find(({ startTime: e, endTime: t }) => e <= y && y < t);
979
997
  }
980
998
  }, [
981
999
  s,
982
1000
  c,
983
- v
984
- ]), ee = (e, t) => /* @__PURE__ */ w("div", {
1001
+ y
1002
+ ]), q = (e, t) => /* @__PURE__ */ w("div", {
985
1003
  className: e ? `track ${e}` : "track",
986
1004
  style: t ? { maskImage: t } : void 0,
987
1005
  children: [
988
1006
  /* @__PURE__ */ C("div", { className: "background-bar" }),
989
1007
  /* @__PURE__ */ C("div", {
990
1008
  className: "loaded",
991
- children: I
1009
+ children: L
992
1010
  }),
993
1011
  /* @__PURE__ */ C("div", {
994
1012
  className: "play-container",
995
1013
  children: /* @__PURE__ */ C("div", {
996
1014
  className: "play",
997
- style: { transform: `scaleX(${L})` }
1015
+ style: { transform: `scaleX(${R})` }
998
1016
  })
999
1017
  })
1000
1018
  ]
1001
1019
  });
1002
1020
  return /* @__PURE__ */ w("div", {
1003
- css: Je,
1004
- ref: h,
1021
+ css: Ye,
1022
+ ref: g,
1005
1023
  className: [
1006
1024
  "progress-bar",
1007
- O ? "dragging" : "",
1008
- z ? "segmented" : ""
1025
+ k ? "dragging" : "",
1026
+ B ? "segmented" : ""
1009
1027
  ].filter(Boolean).join(" "),
1010
- onMouseMove: N,
1011
- onMouseOut: P,
1028
+ onMouseMove: P,
1029
+ onMouseOut: F,
1012
1030
  children: [
1013
- ee(void 0, V),
1014
- v ? /* @__PURE__ */ w("div", {
1031
+ q(void 0, H),
1032
+ y ? /* @__PURE__ */ w("div", {
1015
1033
  className: "cursor-time",
1016
1034
  style: {
1017
- left: W ? `clamp(var(--thumbnail-half), ${F(v)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${F(v)}%, calc(100% - calc(3 * var(--mp-unit))))`,
1018
- maxWidth: W ? "var(--thumbnail-width)" : void 0
1035
+ left: G ? `clamp(var(--thumbnail-half), ${I(y)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${I(y)}%, calc(100% - calc(3 * var(--mp-unit))))`,
1036
+ maxWidth: G ? "var(--thumbnail-width)" : void 0
1019
1037
  },
1020
1038
  children: [/* @__PURE__ */ C("span", {
1021
1039
  className: "cursor-time-value",
1022
- children: Y(v)
1023
- }), W ? /* @__PURE__ */ C("span", {
1040
+ children: Y(y)
1041
+ }), G ? /* @__PURE__ */ C("span", {
1024
1042
  className: "chapter-title",
1025
- children: W.title
1043
+ children: G.title
1026
1044
  }) : void 0]
1027
1045
  }) : void 0,
1028
1046
  /* @__PURE__ */ C("div", { className: "progress" }),
1029
1047
  /* @__PURE__ */ C("div", { className: "hover" }),
1030
- H ? ee("focus", H) : void 0,
1048
+ W ? q("focus", W) : void 0,
1031
1049
  /* @__PURE__ */ C("div", { className: "scrubber" }),
1032
1050
  /* @__PURE__ */ C("div", {
1033
1051
  className: "padding",
1034
- ...k,
1035
- onPointerDown: A,
1036
- onPointerUp: j,
1037
- onPointerCancel: j
1052
+ ...A,
1053
+ onPointerDown: j,
1054
+ onPointerUp: M,
1055
+ onPointerCancel: M
1038
1056
  }),
1039
1057
  /* @__PURE__ */ C("div", {
1040
1058
  className: "thumbnail",
1041
- style: { left: `clamp(var(--thumbnail-half), ${F(v ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
1042
- children: G?.url ? /* @__PURE__ */ C("img", { src: G.url }) : void 0
1059
+ style: { left: `clamp(var(--thumbnail-half), ${I(y ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
1060
+ children: K?.url ? /* @__PURE__ */ C("img", { src: K.url }) : void 0
1043
1061
  })
1044
1062
  ]
1045
1063
  });
1046
- }, Ze = "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 = {
1064
+ }, Qe = "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 = {
1047
1065
  xmlns: "http://www.w3.org/2000/svg",
1048
1066
  width: 24,
1049
1067
  height: 24,
@@ -1053,7 +1071,7 @@ var B = {
1053
1071
  strokeWidth: 2,
1054
1072
  strokeLinecap: "round",
1055
1073
  strokeLinejoin: "round"
1056
- }, Qe = (e) => /* @__PURE__ */ w("svg", {
1074
+ }, $e = (e) => /* @__PURE__ */ w("svg", {
1057
1075
  ...Q,
1058
1076
  ...e,
1059
1077
  children: [/* @__PURE__ */ C("rect", {
@@ -1064,7 +1082,7 @@ var B = {
1064
1082
  rx: "2",
1065
1083
  ry: "2"
1066
1084
  }), /* @__PURE__ */ C("path", { d: "M7 15h4m4 0h2M7 11h2m4 0h4" })]
1067
- }), $e = (e) => /* @__PURE__ */ w("svg", {
1085
+ }), et = (e) => /* @__PURE__ */ w("svg", {
1068
1086
  ...Q,
1069
1087
  ...e,
1070
1088
  children: [
@@ -1084,7 +1102,7 @@ var B = {
1084
1102
  y2: "22"
1085
1103
  })
1086
1104
  ]
1087
- }), et = (e) => /* @__PURE__ */ w("svg", {
1105
+ }), tt = (e) => /* @__PURE__ */ w("svg", {
1088
1106
  ...Q,
1089
1107
  ...e,
1090
1108
  children: [
@@ -1099,7 +1117,7 @@ var B = {
1099
1117
  }),
1100
1118
  /* @__PURE__ */ C("path", { d: "M14.5 18.5h2m2 0h1" })
1101
1119
  ]
1102
- }), tt = (e) => /* @__PURE__ */ w("svg", {
1120
+ }), nt = (e) => /* @__PURE__ */ w("svg", {
1103
1121
  ...Q,
1104
1122
  ...e,
1105
1123
  children: [
@@ -1114,7 +1132,7 @@ var B = {
1114
1132
  }),
1115
1133
  /* @__PURE__ */ C("path", { d: "M6 9h3m2 0h2" })
1116
1134
  ]
1117
- }), nt = h`
1135
+ }), rt = h`
1118
1136
  .popover {
1119
1137
  position: absolute;
1120
1138
  /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
@@ -1153,7 +1171,7 @@ var B = {
1153
1171
 
1154
1172
  border-radius: 8px;
1155
1173
  background-color: rgba(28,28,28,0.95);
1156
- ${K.bMedium.regular}
1174
+ ${J.bMedium.regular}
1157
1175
 
1158
1176
  z-index: 4;
1159
1177
 
@@ -1196,7 +1214,7 @@ var B = {
1196
1214
 
1197
1215
  .secondary {
1198
1216
  color: #eee;
1199
- ${K.bSmall.regular}
1217
+ ${J.bSmall.regular}
1200
1218
  }
1201
1219
  }
1202
1220
  }
@@ -1238,10 +1256,10 @@ var B = {
1238
1256
  .failed {
1239
1257
  border-bottom: 1px solid #4D4D4E;
1240
1258
  color: #f66;
1241
- ${K.bSmall.regular}
1259
+ ${J.bSmall.regular}
1242
1260
  }
1243
1261
  }
1244
- `, rt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1262
+ `, it = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1245
1263
  let c = o !== void 0, l = (e, i, a) => {
1246
1264
  let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
1247
1265
  return /* @__PURE__ */ w("div", {
@@ -1268,7 +1286,7 @@ var B = {
1268
1286
  t.map(({ id: e, label: t }) => l(e, t, "description"))
1269
1287
  ]
1270
1288
  });
1271
- }, it = ({ onReset: e } = {}) => {
1289
+ }, at = ({ onReset: e } = {}) => {
1272
1290
  let t = p(null), [n, r] = m(!1), [i, a] = m(void 0), [o, s] = m(!1), c = p(e);
1273
1291
  c.current = e;
1274
1292
  let l = () => {
@@ -1309,7 +1327,7 @@ var B = {
1309
1327
  });
1310
1328
  }
1311
1329
  };
1312
- }, at = h`
1330
+ }, ot = h`
1313
1331
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1314
1332
  which is the width of the player box, so it can be clamped to it. */
1315
1333
  position: static;
@@ -1325,7 +1343,7 @@ position: static;
1325
1343
  }
1326
1344
  }
1327
1345
 
1328
- ${nt}
1346
+ ${rt}
1329
1347
 
1330
1348
  .popover.error-list {
1331
1349
  /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
@@ -1353,7 +1371,7 @@ ${nt}
1353
1371
 
1354
1372
  color: #fff;
1355
1373
  cursor: pointer;
1356
- ${K.bSmall.regular}
1374
+ ${J.bSmall.regular}
1357
1375
 
1358
1376
  &:hover {
1359
1377
  background-color: rgba(255,255,255,.1);
@@ -1374,7 +1392,7 @@ ${nt}
1374
1392
 
1375
1393
  .when {
1376
1394
  color: #bbb;
1377
- ${K.bSmall.regular}
1395
+ ${J.bSmall.regular}
1378
1396
 
1379
1397
  /* the one part of the line worth scanning for, so it is the one part at full brightness */
1380
1398
  .count {
@@ -1393,27 +1411,27 @@ ${nt}
1393
1411
  color: #ddd;
1394
1412
  overflow-wrap: anywhere;
1395
1413
  white-space: pre-wrap;
1396
- ${K.bSmall.regular}
1414
+ ${J.bSmall.regular}
1397
1415
  }
1398
1416
  }
1399
1417
  }
1400
- `, ot = (e) => new Date(e).toLocaleTimeString(), st = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Y(Math.max(0, e)), ct = (e) => e.reduce((e, t) => e + t.count, 0), lt = (e) => e.map((e, t) => {
1401
- let n = st(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
1418
+ `, st = (e) => new Date(e).toLocaleTimeString(), ct = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Y(Math.max(0, e)), lt = (e) => e.reduce((e, t) => e + t.count, 0), ut = (e) => e.map((e, t) => {
1419
+ let n = ct(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
1402
1420
  return [
1403
1421
  `${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
1404
1422
  e.message,
1405
1423
  e.detail
1406
1424
  ].filter(Boolean).join("\n");
1407
- }).join("\n\n"), ut = () => {
1408
- let e = U((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = it(), [i, a] = m(!1);
1425
+ }).join("\n\n"), dt = () => {
1426
+ let e = U((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = at(), [i, a] = m(!1);
1409
1427
  if (e.length === 0) return null;
1410
1428
  let o = () => {
1411
- navigator.clipboard?.writeText(lt(e)).then(() => {
1429
+ navigator.clipboard?.writeText(ut(e)).then(() => {
1412
1430
  a(!0), setTimeout(() => a(!1), 2e3);
1413
1431
  }, (e) => console.warn("[media-player] could not copy the errors:", e));
1414
- }, s = `Playback errors (${ct(e)})`;
1432
+ }, s = `Playback errors (${lt(e)})`;
1415
1433
  return /* @__PURE__ */ w("div", {
1416
- css: at,
1434
+ css: ot,
1417
1435
  ref: r,
1418
1436
  children: [/* @__PURE__ */ C(Z, {
1419
1437
  id: "errors",
@@ -1444,9 +1462,9 @@ ${nt}
1444
1462
  /* @__PURE__ */ w("span", {
1445
1463
  className: "when",
1446
1464
  children: [
1447
- ot(e.at),
1448
- e.count > 1 ? ` to ${ot(e.lastAt)}` : "",
1449
- st(e.atMediaTime) ? ` at ${st(e.atMediaTime)}` : "",
1465
+ st(e.at),
1466
+ e.count > 1 ? ` to ${st(e.lastAt)}` : "",
1467
+ ct(e.atMediaTime) ? ` at ${ct(e.atMediaTime)}` : "",
1450
1468
  e.recovered ? " recovered" : "",
1451
1469
  e.count > 1 ? /* @__PURE__ */ C("span", {
1452
1470
  className: "count",
@@ -1466,7 +1484,7 @@ ${nt}
1466
1484
  }, `${e.at}-${t}`))]
1467
1485
  })]
1468
1486
  });
1469
- }, dt = h`
1487
+ }, ft = h`
1470
1488
  display: flex;
1471
1489
  align-items: center;
1472
1490
  justify-content: center;
@@ -1519,8 +1537,8 @@ width: 100%;
1519
1537
  }
1520
1538
  }
1521
1539
  }
1522
- `, ft = () => {
1523
- let e = U(), t = U((e) => e.playbackRate), n = p(null), r = p(null), i = .25, a = 3 - i, 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 } = we({
1540
+ `, pt = () => {
1541
+ let e = U(), t = U((e) => e.playbackRate), n = p(null), r = p(null), i = .25, a = 3 - i, 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 } = Te({
1524
1542
  ref: r,
1525
1543
  onChange: (t) => e.setPlaybackRate(l(t))
1526
1544
  }), f = (t) => {
@@ -1536,7 +1554,7 @@ width: 100%;
1536
1554
  }, [t]);
1537
1555
  let m = c(s);
1538
1556
  return /* @__PURE__ */ w("div", {
1539
- css: dt,
1557
+ css: ft,
1540
1558
  children: [/* @__PURE__ */ w("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ C("div", {
1541
1559
  className: "playback-slider",
1542
1560
  ref: n,
@@ -1554,7 +1572,7 @@ width: 100%;
1554
1572
  })
1555
1573
  })]
1556
1574
  });
1557
- }, pt = h`
1575
+ }, mt = h`
1558
1576
  /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
1559
1577
  as wide as the player box and can therefore be clamped to it. The outside-click check uses
1560
1578
  \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
@@ -1572,7 +1590,7 @@ position: static;
1572
1590
  }
1573
1591
  }
1574
1592
 
1575
- ${nt}
1593
+ ${rt}
1576
1594
 
1577
1595
  .playback-rate {
1578
1596
  .slider {
@@ -1613,8 +1631,8 @@ ${nt}
1613
1631
  }
1614
1632
  }
1615
1633
 
1616
- `, mt = () => {
1617
- 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 } = it({ onReset: () => o(0) }), p = (t) => {
1634
+ `, ht = () => {
1635
+ 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 } = at({ onReset: () => o(0) }), p = (t) => {
1618
1636
  e.setPlaybackRate(t), o(0);
1619
1637
  }, h = (e) => {
1620
1638
  e !== void 0 && f(e, () => i(e));
@@ -1622,7 +1640,7 @@ ${nt}
1622
1640
  o(e);
1623
1641
  };
1624
1642
  return /* @__PURE__ */ w("div", {
1625
- css: pt,
1643
+ css: mt,
1626
1644
  ref: l,
1627
1645
  children: [
1628
1646
  /* @__PURE__ */ C(Z, {
@@ -1661,7 +1679,7 @@ ${nt}
1661
1679
  }),
1662
1680
  /* @__PURE__ */ C("div", {
1663
1681
  className: "slider no-hover",
1664
- children: /* @__PURE__ */ C(ft, {})
1682
+ children: /* @__PURE__ */ C(pt, {})
1665
1683
  }),
1666
1684
  /* @__PURE__ */ w("div", {
1667
1685
  className: "options no-hover",
@@ -1686,7 +1704,7 @@ ${nt}
1686
1704
  })
1687
1705
  ]
1688
1706
  }),
1689
- s && a === 2 && /* @__PURE__ */ C(rt, {
1707
+ s && a === 2 && /* @__PURE__ */ C(it, {
1690
1708
  title: "Audio",
1691
1709
  tracks: n,
1692
1710
  selected: r,
@@ -1697,7 +1715,7 @@ ${nt}
1697
1715
  })
1698
1716
  ]
1699
1717
  });
1700
- }, ht = h`
1718
+ }, gt = h`
1701
1719
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1702
1720
  which is the width of the player box, so it can be clamped to it. */
1703
1721
  position: static;
@@ -1713,13 +1731,13 @@ position: static;
1713
1731
  }
1714
1732
  }
1715
1733
 
1716
- ${nt}
1717
- `, gt = () => {
1718
- 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 } = it();
1734
+ ${rt}
1735
+ `, _t = () => {
1736
+ 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 } = at();
1719
1737
  if (e.length === 0) return null;
1720
1738
  let u = t !== void 0;
1721
1739
  return /* @__PURE__ */ w("div", {
1722
- css: ht,
1740
+ css: gt,
1723
1741
  ref: o,
1724
1742
  children: [/* @__PURE__ */ C(Z, {
1725
1743
  id: "subtitles",
@@ -1731,10 +1749,10 @@ ${nt}
1731
1749
  "aria-label": "Subtitles",
1732
1750
  "aria-expanded": i,
1733
1751
  "aria-pressed": u,
1734
- children: u ? /* @__PURE__ */ C(Qe, { className: "captions" }) : /* @__PURE__ */ C($e, { className: "captions-off" })
1752
+ children: u ? /* @__PURE__ */ C($e, { className: "captions" }) : /* @__PURE__ */ C(et, { className: "captions-off" })
1735
1753
  }),
1736
1754
  toolTipText: /* @__PURE__ */ C("span", { children: "Subtitles" })
1737
- }), i && /* @__PURE__ */ C(rt, {
1755
+ }), i && /* @__PURE__ */ C(it, {
1738
1756
  title: "Subtitles",
1739
1757
  tracks: e,
1740
1758
  selected: t,
@@ -1744,13 +1762,13 @@ ${nt}
1744
1762
  failed: c
1745
1763
  })]
1746
1764
  });
1747
- }, _t = {
1765
+ }, vt = {
1748
1766
  primary: "#EAEBEE",
1749
1767
  secondary: "#D0D0D9",
1750
1768
  hover: "rgba(255, 255, 255, 0.13)",
1751
1769
  borderPrimary: "#384F70",
1752
1770
  backgroundTooltip: "#222222"
1753
- }, vt = h`
1771
+ }, yt = h`
1754
1772
  display: flex;
1755
1773
  align-items: center;
1756
1774
 
@@ -1793,8 +1811,8 @@ ${nt}
1793
1811
  width: 10px;
1794
1812
  height: 10px;
1795
1813
  }
1796
- `, yt = ({ value: e, onChange: t }) => {
1797
- let n = U((e) => e.volume), r = U((e) => e.muted), i = p(null), a = p(null), { handlers: o } = we({
1814
+ `, bt = ({ value: e, onChange: t }) => {
1815
+ let n = U((e) => e.volume), r = U((e) => e.muted), i = p(null), a = p(null), { handlers: o } = Te({
1798
1816
  ref: a,
1799
1817
  onChange: t
1800
1818
  }), s = (n) => {
@@ -1808,12 +1826,12 @@ ${nt}
1808
1826
  e && e.removeEventListener("wheel", s);
1809
1827
  };
1810
1828
  }, [e]);
1811
- let c = e * 100, l = f(() => Math.round(r ? 0 : J(n) * 100), [n, r]);
1829
+ let c = e * 100, l = f(() => Math.round(r ? 0 : be(n) * 100), [n, r]);
1812
1830
  return /* @__PURE__ */ C(Z, {
1813
1831
  id: "volume-slider",
1814
1832
  text: /* @__PURE__ */ C("div", {
1815
1833
  ref: i,
1816
- css: vt,
1834
+ css: yt,
1817
1835
  ...o,
1818
1836
  children: /* @__PURE__ */ C("div", {
1819
1837
  ref: a,
@@ -1832,7 +1850,7 @@ ${nt}
1832
1850
  children: [l, "%"]
1833
1851
  })
1834
1852
  });
1835
- }, bt = h`
1853
+ }, xt = h`
1836
1854
  position: relative;
1837
1855
  display: flex;
1838
1856
  align-items: center;
@@ -1857,7 +1875,7 @@ ${nt}
1857
1875
  border-radius: 4px;
1858
1876
 
1859
1877
  .volume-value {
1860
- ${K.bMedium.regular};
1878
+ ${J.bMedium.regular};
1861
1879
  color: #ffffff;
1862
1880
  }
1863
1881
  }
@@ -1895,10 +1913,10 @@ ${nt}
1895
1913
  }
1896
1914
  }
1897
1915
 
1898
- `, xt = ({ ref: e }) => {
1899
- let t = U(), n = U((e) => e.volume), r = U((e) => e.muted), i = f(() => J(n), [n]);
1916
+ `, St = ({ ref: e }) => {
1917
+ let t = U(), n = U((e) => e.volume), r = U((e) => e.muted), i = f(() => be(n), [n]);
1900
1918
  return /* @__PURE__ */ w("div", {
1901
- css: bt,
1919
+ css: xt,
1902
1920
  children: [/* @__PURE__ */ C(Z, {
1903
1921
  id: "sound",
1904
1922
  text: /* @__PURE__ */ C("button", {
@@ -1918,7 +1936,7 @@ ${nt}
1918
1936
  className: "volume-slider-container",
1919
1937
  children: /* @__PURE__ */ C("div", {
1920
1938
  className: "volume-slider-background",
1921
- children: /* @__PURE__ */ C(yt, {
1939
+ children: /* @__PURE__ */ C(bt, {
1922
1940
  value: r ? 0 : i,
1923
1941
  onChange: (e) => {
1924
1942
  t.setVolume(ye(e));
@@ -1927,7 +1945,7 @@ ${nt}
1927
1945
  })
1928
1946
  })]
1929
1947
  });
1930
- }, $ = .05, St = 5, Ct = h`
1948
+ }, $ = .05, Ct = 5, wt = h`
1931
1949
  display: flex;
1932
1950
  flex-direction: column;
1933
1951
  gap: calc(0.4 * var(--mp-unit));
@@ -1936,7 +1954,7 @@ ${nt}
1936
1954
  opacity: 0.72;
1937
1955
  font-size: 0.9em;
1938
1956
  }
1939
- `, wt = h`
1957
+ `, Tt = h`
1940
1958
  position: absolute;
1941
1959
  bottom: 0;
1942
1960
  width: 100%;
@@ -2026,7 +2044,7 @@ ${nt}
2026
2044
  cursor: pointer;
2027
2045
 
2028
2046
  :hover {
2029
- background-color: ${_t.hover};
2047
+ background-color: ${vt.hover};
2030
2048
  }
2031
2049
 
2032
2050
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -2043,7 +2061,7 @@ ${nt}
2043
2061
 
2044
2062
  .left {
2045
2063
  .time {
2046
- ${K.bMedium.regular}
2064
+ ${J.bMedium.regular}
2047
2065
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
2048
2066
  }
2049
2067
  }
@@ -2064,13 +2082,13 @@ ${nt}
2064
2082
  }
2065
2083
  }
2066
2084
  }
2067
- `, Tt = () => {
2068
- let e = U(), t = U((e) => e.paused), n = U((e) => e.currentTime), r = U((e) => e.duration), i = U((e) => e.fullscreen), a = U((e) => e.hideUI), o = U((e) => e.togglePictureInPicture), s = U((e) => e.pictureInPictureMode), c = U((e) => e.burnedInSubtitles), l = U((e) => e.subtitleTracks), f = U((e) => e.requestSeek), [p, h] = m(null), g = s === "burn-in", _ = l.length > 0, v = r > 0 && n === r, y = u(({ direction: t, stepSize: n }) => {
2069
- let r = J(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
2085
+ `, Et = () => {
2086
+ 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 }) => {
2087
+ let r = be(e.volume), i = t === "up" ? n : -n, a = Math.max(0, Math.min(1, r + i)), o = e.muted;
2070
2088
  e.setVolume(ye(a)), o && !e.muted && e.toggleMuted();
2071
2089
  }, [e]);
2072
2090
  d(() => {
2073
- let t = (t) => f ? f(t) : e.seek(t), n = (n) => {
2091
+ let t = (t) => p ? p(t) : e.seek(t), n = (n) => {
2074
2092
  let r = n.target;
2075
2093
  if (r?.isContentEditable || /^(input|textarea|select)$/i.test(r?.tagName ?? "")) return;
2076
2094
  let i = !0;
@@ -2078,44 +2096,44 @@ ${nt}
2078
2096
  else if (n.key === "k") e.togglePaused();
2079
2097
  else if (n.key === " ") e.togglePaused();
2080
2098
  else if (n.key === "m") e.toggleMuted();
2081
- else if (n.key === "ArrowUp") y({
2099
+ else if (n.key === "ArrowUp") b({
2082
2100
  direction: "up",
2083
2101
  stepSize: $
2084
2102
  });
2085
- else if (n.key === "ArrowDown") y({
2103
+ else if (n.key === "ArrowDown") b({
2086
2104
  direction: "down",
2087
2105
  stepSize: $
2088
2106
  });
2089
2107
  else if (n.key === "ArrowRight") {
2090
2108
  if (!e.duration) return;
2091
- t(Math.min(e.currentTime + St, e.duration));
2092
- } else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - St, 0)) : i = !1;
2109
+ t(Math.min(e.currentTime + Ct, e.duration));
2110
+ } else n.key === "ArrowLeft" ? t(Math.max(e.currentTime - Ct, 0)) : i = !1;
2093
2111
  i && n.preventDefault();
2094
2112
  };
2095
2113
  return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
2096
2114
  }, [
2097
2115
  e,
2098
- y,
2099
- f
2116
+ b,
2117
+ p
2100
2118
  ]);
2101
- let b = u((e) => {
2102
- e.preventDefault(), e.deltaY < 0 ? y({
2119
+ let x = u((e) => {
2120
+ e.preventDefault(), e.deltaY < 0 ? b({
2103
2121
  direction: "up",
2104
2122
  stepSize: $
2105
- }) : y({
2123
+ }) : b({
2106
2124
  direction: "down",
2107
2125
  stepSize: $
2108
2126
  });
2109
- }, [y]);
2127
+ }, [b]);
2110
2128
  return d(() => {
2111
- if (p) return p.addEventListener("wheel", b, { passive: !1 }), () => p.removeEventListener("wheel", b);
2112
- }, [p, b]), /* @__PURE__ */ w("div", {
2113
- css: wt,
2114
- style: { ...a ? {
2129
+ if (h) return h.addEventListener("wheel", x, { passive: !1 }), () => h.removeEventListener("wheel", x);
2130
+ }, [h, x]), /* @__PURE__ */ w("div", {
2131
+ css: Tt,
2132
+ style: { ...o ? {
2115
2133
  opacity: "0",
2116
2134
  pointerEvents: "none"
2117
2135
  } : {} },
2118
- children: [/* @__PURE__ */ C(Xe, {}), /* @__PURE__ */ w("div", {
2136
+ children: [/* @__PURE__ */ C(Ze, {}), /* @__PURE__ */ w("div", {
2119
2137
  className: "actions",
2120
2138
  children: [/* @__PURE__ */ w("div", {
2121
2139
  className: "left",
@@ -2127,44 +2145,44 @@ ${nt}
2127
2145
  className: "play",
2128
2146
  type: "button",
2129
2147
  onClick: () => e.togglePaused(),
2130
- "aria-label": v ? "Replay" : t ? "Play" : "Pause",
2131
- children: C(v ? P : t ? N : M, {})
2148
+ "aria-label": y ? "Replay" : t ? "Play" : "Pause",
2149
+ children: C(y ? P : t ? N : M, {})
2132
2150
  }),
2133
- toolTipText: /* @__PURE__ */ C("span", { children: v ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
2151
+ toolTipText: /* @__PURE__ */ C("span", { children: y ? "Replay (k)" : t ? "Play (k)" : "Pause (k)" })
2134
2152
  }),
2135
- /* @__PURE__ */ C(xt, { ref: h }),
2153
+ /* @__PURE__ */ C(St, { ref: g }),
2136
2154
  /* @__PURE__ */ C("div", {
2137
2155
  className: "time",
2138
- children: be(n, r)
2156
+ children: xe(i ?? n, r)
2139
2157
  })
2140
2158
  ]
2141
2159
  }), /* @__PURE__ */ w("div", {
2142
2160
  className: "right",
2143
2161
  children: [
2144
- /* @__PURE__ */ C(ut, {}),
2145
- /* @__PURE__ */ C(gt, {}),
2146
- /* @__PURE__ */ C(mt, {}),
2147
- o ? /* @__PURE__ */ C(Z, {
2162
+ /* @__PURE__ */ C(dt, {}),
2163
+ /* @__PURE__ */ C(_t, {}),
2164
+ /* @__PURE__ */ C(ht, {}),
2165
+ s ? /* @__PURE__ */ C(Z, {
2148
2166
  id: "picture-in-picture",
2149
2167
  tooltipPlace: "top-end",
2150
2168
  text: /* @__PURE__ */ C("button", {
2151
2169
  className: "picture-in-picture",
2152
2170
  type: "button",
2153
- onClick: o,
2154
- disabled: g && !_,
2155
- "aria-label": g ? "Put the subtitles in the video" : "Picture in picture",
2156
- "aria-pressed": g ? c : void 0,
2157
- children: g ? C(c ? et : tt, {}) : /* @__PURE__ */ C("img", {
2158
- src: Ze,
2171
+ onClick: s,
2172
+ disabled: _ && !v,
2173
+ "aria-label": _ ? "Put the subtitles in the video" : "Picture in picture",
2174
+ "aria-pressed": _ ? l : void 0,
2175
+ children: _ ? C(l ? tt : nt, {}) : /* @__PURE__ */ C("img", {
2176
+ src: Qe,
2159
2177
  alt: ""
2160
2178
  })
2161
2179
  }),
2162
2180
  toolTipText: /* @__PURE__ */ w("span", {
2163
- css: Ct,
2181
+ css: wt,
2164
2182
  children: [/* @__PURE__ */ C("span", {
2165
2183
  className: "lead",
2166
- children: g ? _ ? c ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
2167
- }), g && _ ? /* @__PURE__ */ C("span", {
2184
+ children: _ ? v ? l ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture"
2185
+ }), _ && v ? /* @__PURE__ */ C("span", {
2168
2186
  className: "hint",
2169
2187
  children: "Then hover the video and click your browser's own pop out button"
2170
2188
  }) : null]
@@ -2178,16 +2196,16 @@ ${nt}
2178
2196
  type: "button",
2179
2197
  onClick: () => e.toggleFullscreen(),
2180
2198
  "aria-label": "Full screen",
2181
- "aria-pressed": i,
2182
- children: C(i ? j : A, {})
2199
+ "aria-pressed": a,
2200
+ children: C(a ? j : A, {})
2183
2201
  }),
2184
- toolTipText: /* @__PURE__ */ C("span", { children: i ? "Exit full screen (f)" : "Full screen (f)" })
2202
+ toolTipText: /* @__PURE__ */ C("span", { children: a ? "Exit full screen (f)" : "Full screen (f)" })
2185
2203
  })
2186
2204
  ]
2187
2205
  })]
2188
2206
  })]
2189
2207
  });
2190
- }, Et = 9e3, Dt = h`
2208
+ }, Dt = 9e3, Ot = h`
2191
2209
  position: absolute;
2192
2210
  inset: 0;
2193
2211
  z-index: 2;
@@ -2225,12 +2243,12 @@ ${nt}
2225
2243
  }
2226
2244
 
2227
2245
  .title {
2228
- ${K.bMedium.bold}
2246
+ ${J.bMedium.bold}
2229
2247
  color: #fff;
2230
2248
  }
2231
2249
 
2232
2250
  .body {
2233
- ${K.bSmall.regular}
2251
+ ${J.bSmall.regular}
2234
2252
  color: rgba(255, 255, 255, 0.75);
2235
2253
  }
2236
2254
 
@@ -2241,7 +2259,7 @@ ${nt}
2241
2259
  line-height: 1;
2242
2260
  color: #fff;
2243
2261
  }
2244
- `, Ot = () => {
2262
+ `, kt = () => {
2245
2263
  let e = U((e) => e.burnedInSubtitles), t = U((e) => e.pictureInPictureMode), [n, r] = m(!1);
2246
2264
  return d(() => {
2247
2265
  if (t !== "burn-in" || !e) {
@@ -2249,10 +2267,10 @@ ${nt}
2249
2267
  return;
2250
2268
  }
2251
2269
  r(!0);
2252
- let n = setTimeout(() => r(!1), Et);
2270
+ let n = setTimeout(() => r(!1), Dt);
2253
2271
  return () => clearTimeout(n);
2254
2272
  }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ C("div", {
2255
- css: Dt,
2273
+ css: Ot,
2256
2274
  className: n ? "show" : "",
2257
2275
  role: "status",
2258
2276
  children: /* @__PURE__ */ w("div", {
@@ -2273,10 +2291,10 @@ ${nt}
2273
2291
  })]
2274
2292
  })
2275
2293
  });
2276
- }, kt = 1, At = 6e3, jt = 1, Mt = {
2294
+ }, At = 1, jt = 6e3, Mt = 1, Nt = {
2277
2295
  opening: "Skip Opening",
2278
2296
  ending: "Skip Ending"
2279
- }, Nt = h`
2297
+ }, Pt = h`
2280
2298
  position: absolute;
2281
2299
  inset: 0;
2282
2300
  z-index: 2;
@@ -2293,7 +2311,7 @@ ${nt}
2293
2311
  pointer-events: auto;
2294
2312
  cursor: pointer;
2295
2313
 
2296
- ${K.bMedium.bold}
2314
+ ${J.bMedium.bold}
2297
2315
  color: #fff;
2298
2316
  padding: calc(1 * var(--mp-unit)) calc(1.8 * var(--mp-unit));
2299
2317
  border: 1px solid rgba(255, 255, 255, .55);
@@ -2327,10 +2345,10 @@ ${nt}
2327
2345
  bottom: calc(9 * var(--mp-unit));
2328
2346
  }
2329
2347
  }
2330
- `, Pt = () => {
2331
- let e = U((e) => e.chapters), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U(), i = f(() => qe(e), [e]), a = f(() => {
2348
+ `, Ft = () => {
2349
+ let e = U((e) => e.chapters), t = U((e) => e.currentTime), n = U((e) => e.requestSeek), r = U(), i = f(() => Je(e), [e]), a = f(() => {
2332
2350
  if (typeof t != "number") return;
2333
- let n = e.findIndex((e, n) => i[n] !== void 0 && e.start - kt <= t && t < e.end), r = n >= 0 ? i[n] : void 0;
2351
+ let n = e.findIndex((e, n) => i[n] !== void 0 && e.start - At <= t && t < e.end), r = n >= 0 ? i[n] : void 0;
2334
2352
  return r ? {
2335
2353
  kind: r,
2336
2354
  end: e[n].end
@@ -2342,7 +2360,7 @@ ${nt}
2342
2360
  ]), o = p(0), [s, c] = m(0);
2343
2361
  d(() => {
2344
2362
  let e = typeof t == "number" ? t : 0, n = o.current;
2345
- o.current = e, e < n - jt && c((e) => e + 1);
2363
+ o.current = e, e < n - Mt && c((e) => e + 1);
2346
2364
  }, [t]);
2347
2365
  let [l, u] = m(!1), h = a ? `${a.kind}@${a.end}` : "";
2348
2366
  return d(() => {
@@ -2351,12 +2369,12 @@ ${nt}
2351
2369
  return;
2352
2370
  }
2353
2371
  u(!0);
2354
- let e = setTimeout(() => u(!1), At);
2372
+ let e = setTimeout(() => u(!1), jt);
2355
2373
  return () => clearTimeout(e);
2356
2374
  }, [h, s]), d(() => {
2357
2375
  a || u(!1);
2358
2376
  }, [a]), a ? /* @__PURE__ */ C("div", {
2359
- css: Nt,
2377
+ css: Pt,
2360
2378
  className: l ? "show" : "",
2361
2379
  children: /* @__PURE__ */ C("button", {
2362
2380
  type: "button",
@@ -2364,10 +2382,10 @@ ${nt}
2364
2382
  onClick: () => {
2365
2383
  u(!1), n ? n(a.end) : r.seek(a.end);
2366
2384
  },
2367
- children: Mt[a.kind]
2385
+ children: Nt[a.kind]
2368
2386
  })
2369
2387
  }) : null;
2370
- }, Ft = 3e3, It = h`
2388
+ }, It = 3e3, Lt = h`
2371
2389
  position: absolute;
2372
2390
  inset: 0;
2373
2391
  z-index: 2;
@@ -2378,7 +2396,7 @@ ${nt}
2378
2396
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
2379
2397
  not, and transitioning it holds the item on screen for the length of the fade. */
2380
2398
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
2381
- `, Lt = h`
2399
+ `, Rt = h`
2382
2400
  position: relative;
2383
2401
  background-color: black;
2384
2402
  display: flex;
@@ -2423,58 +2441,62 @@ ${nt}
2423
2441
  &.hide {
2424
2442
  cursor: none;
2425
2443
  }
2426
- `, Rt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2444
+ `, zt = (e, t = "") => s.toArray(e).flatMap((e, n) => {
2427
2445
  let r = `${t}${l(e) && e.key != null ? e.key : n}`;
2428
- return l(e) && e.type === c ? Rt(e.props.children, `${r}/`) : [{
2446
+ return l(e) && e.type === c ? zt(e.props.children, `${r}/`) : [{
2429
2447
  key: r,
2430
2448
  item: e
2431
2449
  }];
2432
- }), zt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2433
- let o = U(), s = U((e) => e.hideUI), c = U((e) => e.setHideUI), l = p(void 0), u = p("mouse"), f = p({
2450
+ }), Bt = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, children: a }) => {
2451
+ 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({
2434
2452
  x: -1,
2435
2453
  y: -1
2436
- }), m = p(null);
2437
- d(() => () => clearTimeout(l.current), []);
2438
- let h = (t) => {
2439
- m.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
2440
- }, g = () => {
2441
- if (u.current !== "mouse") return !1;
2442
- let { x: e, y: t } = f.current;
2443
- if (!m.current || e < 0) return !1;
2454
+ }), h = p(null);
2455
+ d(() => () => clearTimeout(u.current), []), d(() => {
2456
+ l || (clearTimeout(u.current), c(!1));
2457
+ }, [l, c]);
2458
+ let g = () => {
2459
+ l && c(!0);
2460
+ }, _ = (t) => {
2461
+ h.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
2462
+ }, v = () => {
2463
+ if (f.current !== "mouse") return !1;
2464
+ let { x: e, y: t } = m.current;
2465
+ if (!h.current || e < 0) return !1;
2444
2466
  let n = document.elementFromPoint(e, t);
2445
- return !!n && m.current.contains(n) && !n.closest(".video");
2446
- }, _ = () => {
2447
- if (g()) {
2448
- l.current = setTimeout(_, Ft);
2467
+ return !!n && h.current.contains(n) && !n.closest(".video");
2468
+ }, y = () => {
2469
+ if (v()) {
2470
+ u.current = setTimeout(y, It);
2449
2471
  return;
2450
2472
  }
2451
- c(!0);
2452
- }, v = () => {
2453
- c(!1), clearTimeout(l.current), l.current = setTimeout(_, Ft);
2473
+ g();
2474
+ }, b = () => {
2475
+ c(!1), clearTimeout(u.current), u.current = setTimeout(y, It);
2454
2476
  };
2455
2477
  return /* @__PURE__ */ w("div", {
2456
- css: Lt,
2457
- ref: h,
2478
+ css: Rt,
2479
+ ref: _,
2458
2480
  onPointerMove: (e) => {
2459
- u.current = e.pointerType, e.pointerType === "mouse" && (f.current = {
2481
+ f.current = e.pointerType, e.pointerType === "mouse" && (m.current = {
2460
2482
  x: e.clientX,
2461
2483
  y: e.clientY
2462
- }, v());
2484
+ }, b());
2463
2485
  },
2464
2486
  onPointerDown: (e) => {
2465
- u.current = e.pointerType;
2487
+ f.current = e.pointerType;
2466
2488
  },
2467
2489
  onMouseOut: (e) => {
2468
2490
  let t = e.relatedTarget;
2469
2491
  if (t && e.currentTarget.contains(t)) return;
2470
2492
  let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
2471
- e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(l.current), c(!0));
2493
+ e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(u.current), g());
2472
2494
  },
2473
2495
  className: s ? "hide" : "",
2474
2496
  children: [
2475
- /* @__PURE__ */ C(_e, { onSubtitleRef: n }),
2476
- Rt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
2477
- css: It,
2497
+ /* @__PURE__ */ C(ge, { onSubtitleRef: n }),
2498
+ zt(r).map(({ key: e, item: t }) => /* @__PURE__ */ C("div", {
2499
+ css: Lt,
2478
2500
  style: { ...s ? {
2479
2501
  opacity: "0",
2480
2502
  visibility: "hidden",
@@ -2482,17 +2504,17 @@ ${nt}
2482
2504
  } : {} },
2483
2505
  children: t
2484
2506
  }, e)),
2485
- i === !1 ? null : /* @__PURE__ */ C(Tt, {}),
2486
- /* @__PURE__ */ C(Ot, {}),
2487
- /* @__PURE__ */ C(Pt, {}),
2507
+ i === !1 ? null : /* @__PURE__ */ C(Et, {}),
2508
+ /* @__PURE__ */ C(kt, {}),
2509
+ /* @__PURE__ */ C(Ft, {}),
2488
2510
  /* @__PURE__ */ w("div", {
2489
2511
  className: "video",
2490
2512
  onClick: () => {
2491
- if (u.current === "mouse") {
2513
+ if (f.current === "mouse") {
2492
2514
  o.togglePaused();
2493
2515
  return;
2494
2516
  }
2495
- s ? v() : (clearTimeout(l.current), c(!0));
2517
+ s ? b() : (clearTimeout(u.current), g());
2496
2518
  },
2497
2519
  children: [t ? /* @__PURE__ */ C("video", {
2498
2520
  ref: t,
@@ -2501,7 +2523,7 @@ ${nt}
2501
2523
  })
2502
2524
  ]
2503
2525
  });
2504
- }, Bt = ({ options: e, children: t }) => {
2526
+ }, Vt = ({ options: e, children: t }) => {
2505
2527
  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;
2506
2528
  d(() => (g?.(T), () => g?.(null)), [T, g]);
2507
2529
  let { expose: E } = e, D = E === !0 ? {} : E || void 0, O = p(D);
@@ -2521,31 +2543,33 @@ ${nt}
2521
2543
  k,
2522
2544
  A,
2523
2545
  j
2524
- ]), se(b, S, r);
2525
- let { thumbnails: M, requestThumbnail: N } = ue({
2546
+ ]), oe(b, S, r);
2547
+ let { thumbnails: M, requestThumbnail: N } = le({
2526
2548
  publicPath: c,
2527
2549
  workerUrl: l,
2528
2550
  length: h === !1 ? void 0 : o,
2529
2551
  read: f ?? u,
2530
2552
  downloadedRanges: s
2531
- }), P = n?.thumbnails?.all ?? M, { toggle: F, mode: I, burnedIn: L } = de(b, S), R = U((e) => e.setSourceState);
2553
+ }), 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;
2532
2554
  d(() => {
2533
2555
  R({
2534
2556
  title: i,
2535
2557
  size: o,
2536
- downloadedRanges: s
2558
+ downloadedRanges: s,
2559
+ hasMedia: z
2537
2560
  });
2538
2561
  }, [
2539
2562
  R,
2540
2563
  i,
2541
2564
  o,
2542
- s
2565
+ s,
2566
+ z
2543
2567
  ]);
2544
- let z = n?.thumbnails?.at;
2568
+ let B = n?.thumbnails?.at;
2545
2569
  d(() => {
2546
2570
  R({
2547
2571
  thumbnails: P,
2548
- thumbnailAt: z,
2572
+ thumbnailAt: B,
2549
2573
  requestThumbnail: N,
2550
2574
  togglePictureInPicture: F,
2551
2575
  pictureInPictureMode: I,
@@ -2554,37 +2578,37 @@ ${nt}
2554
2578
  }, [
2555
2579
  R,
2556
2580
  P,
2557
- z,
2581
+ B,
2558
2582
  N,
2559
2583
  F,
2560
2584
  I,
2561
2585
  L
2562
2586
  ]);
2563
- let B = n?.subtitles?.selection, V = n?.audioTracks?.selection;
2587
+ let V = n?.subtitles?.selection, H = n?.audioTracks?.selection;
2564
2588
  return d(() => {
2565
- B && R({
2566
- subtitleTracks: B.options.map(({ id: e, label: t, disabled: n }) => ({
2589
+ V && R({
2590
+ subtitleTracks: V.options.map(({ id: e, label: t, disabled: n }) => ({
2567
2591
  id: e,
2568
2592
  label: t,
2569
2593
  disabled: n
2570
2594
  })),
2571
- selectedSubtitleTrack: B.selectedId ?? void 0,
2572
- selectSubtitleTrack: (e) => B.select(e == null ? null : String(e)),
2573
- subtitleOffLabel: B.offLabel
2595
+ selectedSubtitleTrack: V.selectedId ?? void 0,
2596
+ selectSubtitleTrack: (e) => V.select(e == null ? null : String(e)),
2597
+ subtitleOffLabel: V.offLabel
2574
2598
  });
2575
- }, [R, B]), d(() => {
2576
- V && R({
2577
- audioTracks: V.options.map(({ id: e, label: t, disabled: n }) => ({
2599
+ }, [R, V]), d(() => {
2600
+ H && R({
2601
+ audioTracks: H.options.map(({ id: e, label: t, disabled: n }) => ({
2578
2602
  id: e,
2579
2603
  label: t,
2580
2604
  disabled: n
2581
2605
  })),
2582
- selectedAudioTrack: V.selectedId ?? void 0,
2583
- selectAudioTrack: (e) => V.select(String(e))
2606
+ selectedAudioTrack: H.selectedId ?? void 0,
2607
+ selectAudioTrack: (e) => H.select(String(e))
2584
2608
  });
2585
- }, [R, V]), d(() => {
2609
+ }, [R, H]), d(() => {
2586
2610
  a && R({ chapters: a });
2587
- }, [R, a]), /* @__PURE__ */ C(zt, {
2611
+ }, [R, a]), /* @__PURE__ */ C(Bt, {
2588
2612
  ref: _,
2589
2613
  onVideoRef: n ? void 0 : x,
2590
2614
  onSubtitleRef: w,
@@ -2592,7 +2616,7 @@ ${nt}
2592
2616
  controls: e.controls,
2593
2617
  children: t
2594
2618
  });
2595
- }, Vt = h`
2619
+ }, Ht = h`
2596
2620
  /**
2597
2621
  * The chrome's whole scale, in one place.
2598
2622
  *
@@ -2662,17 +2686,17 @@ ${nt}
2662
2686
  height: 100%;
2663
2687
  width: 100%;
2664
2688
  overflow: hidden;
2665
- `, Ht = (e) => /* @__PURE__ */ C("div", {
2666
- css: Vt,
2667
- children: /* @__PURE__ */ C(H.Provider, { children: /* @__PURE__ */ C(Bt, {
2689
+ `, Ut = (e) => /* @__PURE__ */ C("div", {
2690
+ css: Ht,
2691
+ children: /* @__PURE__ */ C(H.Provider, { children: /* @__PURE__ */ C(Vt, {
2668
2692
  options: e,
2669
2693
  children: e.children
2670
2694
  }) })
2671
- }), Ut = (e) => !!e && typeof e == "object" && "at" in e, Wt = (e) => !!e && typeof e == "object" && "selection" in e, Gt = ({ blob: e, name: t }) => ({
2695
+ }), Wt = (e) => !!e && typeof e == "object" && "at" in e, Gt = (e) => !!e && typeof e == "object" && "selection" in e, Kt = ({ blob: e, name: t }) => ({
2672
2696
  length: e.size,
2673
2697
  name: t ?? (e instanceof File ? e.name : void 0),
2674
2698
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
2675
- }), Kt = async (e, t) => {
2699
+ }), qt = async (e, t) => {
2676
2700
  let n = await fetch(e, {
2677
2701
  headers: { Range: "bytes=0-1" },
2678
2702
  credentials: t
@@ -2682,8 +2706,8 @@ ${nt}
2682
2706
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
2683
2707
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
2684
2708
  return i;
2685
- }, qt = async ({ url: e, length: t, name: n, credentials: r }) => {
2686
- let i = t ?? await Kt(e, r);
2709
+ }, Jt = async ({ url: e, length: t, name: n, credentials: r }) => {
2710
+ let i = t ?? await qt(e, r);
2687
2711
  return {
2688
2712
  length: i,
2689
2713
  name: n,
@@ -2698,9 +2722,9 @@ ${nt}
2698
2722
  return o.arrayBuffer();
2699
2723
  }
2700
2724
  };
2701
- }, Jt = async (e) => {
2702
- if ("blob" in e) return Gt(e);
2703
- if ("url" in e) return qt(e);
2725
+ }, Yt = async (e) => {
2726
+ if ("blob" in e) return Kt(e);
2727
+ if ("url" in e) return Jt(e);
2704
2728
  if ("read" in e) return {
2705
2729
  length: e.length,
2706
2730
  name: e.name,
@@ -2709,4 +2733,4 @@ ${nt}
2709
2733
  throw Error(`Unknown source type: ${e}`);
2710
2734
  };
2711
2735
  //#endregion
2712
- export { Ht as MediaPlayer, Ht as default, H as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, Jt as inputToRemuxerInput, Wt as isDelegatedTracks, Ut as isExternalThumbnails, V as sourceFeature, i as startPlayback, de as usePictureInPicture, U as usePlayer, ue as useSeekThumbnails };
2736
+ export { Ut as MediaPlayer, Ut as default, H as Player, e as SUBTITLES_OFF, a as createPictureInPicture, o as createSubtitleRenderer, r as createThumbnailGenerator, Yt as inputToRemuxerInput, Gt as isDelegatedTracks, Wt as isExternalThumbnails, V as sourceFeature, i as startPlayback, ue as usePictureInPicture, U as usePlayer, le as useSeekThumbnails };